/** * @see Iterator#next */ @Override public RDFNode next() { m_seen = m_head; m_head = m_head.getTail(); return m_seen.getHead(); }
/** * @see Iterator#next */ @Override public RDFNode next() { m_seen = m_head; m_head = m_head.getTail(); return m_seen.getHead(); }
/** * <p> * Answer the node that is the i'th element of the list, assuming that the * head is item zero. If the list is too short to have an i'th element, * throws a {@link ListIndexException}. * </p> * * @param i The index into the list, from 0 * @return The list value at index i, or null * @exception ListIndexException if the list has fewer than (i + 1) * elements. */ @Override public RDFNode get( int i ) { if (s_checkValid) { checkValid(); } checkNotNil( "Tried to get an element from the empty list" ); return findElement( false, i ).getHead(); }
/** * <p> * Answer the node that is the i'th element of the list, assuming that the * head is item zero. If the list is too short to have an i'th element, * throws a {@link ListIndexException}. * </p> * * @param i The index into the list, from 0 * @return The list value at index i, or null * @exception ListIndexException if the list has fewer than (i + 1) * elements. */ @Override public RDFNode get( int i ) { if (s_checkValid) { checkValid(); } checkNotNil( "Tried to get an element from the empty list" ); return findElement( false, i ).getHead(); }
if (cell.getHead().equals( val )) {
if (cell.getHead().equals( val )) {
public void testHead() { model.read(getFileName("ontology/list5.rdf")); RDFList l0 = getListRoot(model); final String[] names = { "a", "b", "c", "d", "e" }; for (final String name : names) { Assert.assertEquals("head of list has incorrect URI", TestList.NS + name, ((Resource) l0.getHead()).getURI()); l0 = l0.getTail(); } }
public void testHead() { model.read(getFileName("ontology/list5.rdf")); RDFList l0 = getListRoot(model); final String[] names = { "a", "b", "c", "d", "e" }; for (final String name : names) { Assert.assertEquals("head of list has incorrect URI", TestList.NS + name, ((Resource) l0.getHead()).getURI()); l0 = l0.getTail(); } }
public void testSetHead() { final Resource root = model.createResource(TestList.NS + "root"); final Property p = model.createProperty(TestList.NS, "p"); // a list of the nil object, but not typed final Resource nil = RDF.nil; model.add(nil, RDF.type, RDF.List); final Resource list = model.createResource(); model.add(list, RDF.type, RDF.List); model.add(list, RDF.first, "fred"); model.add(list, RDF.rest, nil); model.add(root, p, list); final RDFList l1 = getListRoot(model); checkValid("sethead1", l1, true); Assert.assertEquals("List head should be 'fred'", "fred", ((Literal) l1.getHead()).getString()); l1.setHead(model.createTypedLiteral(42)); checkValid("sethead2", l1, true); Assert.assertEquals("List head should be '42'", 42, ((Literal) l1.getHead()).getInt()); }
public void testSetHead() { final Resource root = model.createResource(TestList.NS + "root"); final Property p = model.createProperty(TestList.NS, "p"); // a list of the nil object, but not typed final Resource nil = RDF.nil; model.add(nil, RDF.type, RDF.List); final Resource list = model.createResource(); model.add(list, RDF.type, RDF.List); model.add(list, RDF.first, "fred"); model.add(list, RDF.rest, nil); model.add(root, p, list); final RDFList l1 = getListRoot(model); checkValid("sethead1", l1, true); Assert.assertEquals("List head should be 'fred'", "fred", ((Literal) l1.getHead()).getString()); l1.setHead(model.createTypedLiteral(42)); checkValid("sethead2", l1, true); Assert.assertEquals("List head should be '42'", 42, ((Literal) l1.getHead()).getInt()); }