public List getValues() { List result = new ArrayList(); RDFList l = this; while (l != null && l.getFirst() != null) { result.add(l.getFirst()); l = l.getRest(); } return result; }
public void append(Object value) { boolean done = false; RDFList current = this; while (!done) { if (current.getFirst() == null) { current.setFirst(value); current.setRest(getOWLModel().getRDFNil()); done = true; } else if (current.getRest() == null || getOWLModel().getRDFNil().equals(current.getRest())) { RDFSNamedClass listClass = (RDFSNamedClass) getDirectType(); RDFList newRest = (RDFList) listClass.createAnonymousInstance(); newRest.setFirst(value); newRest.setRest(getOWLModel().getRDFNil()); current.setRest(newRest); done = true; } else { current = current.getRest(); // Recursion into tail } } }