Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.hp.hpl.jena.ontology.daml
Interface DAMLList  view DAMLList download DAMLList.java

All Superinterfaces:
com.hp.hpl.jena.graph.FrontsNode, com.hp.hpl.jena.rdf.model.RDFList, com.hp.hpl.jena.rdf.model.RDFNode, com.hp.hpl.jena.rdf.model.Resource

public interface DAMLList
extends com.hp.hpl.jena.rdf.model.RDFList

Java representation of a DAML List. A list is the specified interpretation of rdf:parseType="daml:Collection" attributes, where a sequence of values is interpreted as a nested sequence of head/tail list cells. One consequence of this is that the list is quite specifically ordered, whereas the daml:collection is said to be an unordered collection. Consquently, we must caution that future versions of the DAML specificiation may create an unordered interpretation of daml:collection, and client code should not rely on the positionality of elements in the current list interpretation.

Version:
CVS info: $Id: DAMLList.java,v 1.7 2005/02/21 12:05:00 andy_seaborne Exp $

Nested Class Summary
 
Nested classes inherited from class com.hp.hpl.jena.rdf.model.RDFList
com.hp.hpl.jena.rdf.model.RDFList.ApplyFn, com.hp.hpl.jena.rdf.model.RDFList.ReduceFn
 
Method Summary
 DAMLList cons(DAMLCommon value)
          Answer a new list formed by creating a new DAMLList element whose first is the given value and whose rest is the current list.
 DAMLList findLast()
          Find the last list element, i.e.
 com.hp.hpl.jena.util.iterator.ExtendedIterator getAll()
          Answer an iteration over the values in the list.
 int getCount()
          Answer a count of the items in the list.
 com.hp.hpl.jena.rdf.model.RDFNode getFirst()
          Answer the value at the head of the list.
 DAMLCommon getItem(int i)
          Answer the i'th element of the list, if it exists.
 DAMLList getNil()
          Answer the well-known constant denoting the nil list.
 DAMLList getRest()
          Answer the list that consists of all values of the list save the first.
 boolean isNil(com.hp.hpl.jena.rdf.model.Resource resource)
          Answer true if the given resource is the nil list.
 void setFirst(DAMLCommon value)
          Set the property daml:first for the given list element.
 void setRest(DAMLList tail)
          Set the property daml:rest for the given list element.
 void setRestNil()
          Set the property daml:rest for the given list element to be the nil list.
 
Methods inherited from interface com.hp.hpl.jena.rdf.model.RDFList
add, append, append, apply, asJavaList, concatenate, concatenate, cons, contains, copy, get, getHead, getStrict, getTail, getValidityErrorMessage, indexOf, indexOf, isEmpty, isValid, iterator, mapWith, reduce, remove, removeAll, removeHead, removeList, replace, sameListAs, setHead, setStrict, setTail, size, with
 
Methods inherited from interface com.hp.hpl.jena.rdf.model.Resource
abort, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, addProperty, begin, commit, equals, getId, getLocalName, getModel, getNameSpace, getNode, getProperty, getRequiredProperty, getURI, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasProperty, hasURI, isAnon, listProperties, listProperties, removeAll, removeProperties, toString
 
Methods inherited from interface com.hp.hpl.jena.rdf.model.RDFNode
as, canAs, inModel, visitWith
 
Methods inherited from interface com.hp.hpl.jena.graph.FrontsNode
asNode
 

Method Detail

getAll

public com.hp.hpl.jena.util.iterator.ExtendedIterator getAll()
Answer an iteration over the values in the list.


getFirst

public com.hp.hpl.jena.rdf.model.RDFNode getFirst()

Answer the value at the head of the list. Since, strictly speaking, DAML collections are unordered, the position items in the list should not be relied on in client code, as the definition of 'first' in the list may change in future releases. However, the identity

      List L = L.getFirst() + L.getRest()
 
is guaranteed, providing that the contents of L do not change.


cons

public DAMLList cons(DAMLCommon value)

Answer a new list formed by creating a new DAMLList element whose first is the given value and whose rest is the current list. This is the 'cons' operator familiar from other list processing languages.


getRest

public DAMLList getRest()

Answer the list that consists of all values of the list save the first. Since, strictly speaking, DAML collections are unordered, this corresponds to returning the collection minus an unspecified one of its values. However, the identity

      List L = L.getFirst() + L.getRest()
 
is guaranteed, providing that the contents of L do not change.


getCount

public int getCount()

Answer a count of the items in the list. Does not check for duplications, so this is the count of entries in the list, not the count of distinct items in the list.


setFirst

public void setFirst(DAMLCommon value)

Set the property daml:first for the given list element. This is a single value that denotes the value at this position of the list.


setRest

public void setRest(DAMLList tail)

Set the property daml:rest for the given list element. This is a single value that denotes the tail of the list.


setRestNil

public void setRestNil()

Set the property daml:rest for the given list element to be the nil list. This correctly terminates the list at this point.


getNil

public DAMLList getNil()

Answer the well-known constant denoting the nil list.


isNil

public boolean isNil(com.hp.hpl.jena.rdf.model.Resource resource)

Answer true if the given resource is the nil list.


findLast

public DAMLList findLast()

Find the last list element, i.e. the one whose rest is nil.


getItem

public DAMLCommon getItem(int i)

Answer the i'th element of the list, if it exists. If i is less than 1, or is larger than the length of the list, throw an illegal argument exception.