public class RdfList extends AbstractList<Resource>
java.util.List
backed by an RDF
collection (rdf:List). The list allows modification that are reflected
to the underlying TripleCollection
. It reads the data from the
TripleCollection
when it is first needed, so changes to the
TripleCollection affecting the rdf:List may or may not have an effect on the
values returned by instances of this class. For that reason only one
instance of this class should be used for accessing an rdf:List of sublists
thereof when the lists are being modified, having multiple lists exclusively
for read operations (such as for immutable TripleCollection
s) is
not problematic.modCount
Constructor and Description |
---|
RdfList(GraphNode listNode)
Get a list for the specified resource node.
|
RdfList(NonLiteral listResource,
TripleCollection tc)
Get a list for the specified resource.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
Resource element) |
static RdfList |
createEmptyList(NonLiteral listResource,
TripleCollection tc)
Creates an empty RdfList by writing a triple
"
listResource owl:sameAs rdf.nil ." to tc . |
boolean |
equals(Object obj) |
static Set<GraphNode> |
findContainingListNodes(GraphNode element)
Returns a set of
GraphNode S which are the first list nodes (meaning
they are not the beginning of a sublist) of the list containing the specified
GraphNode as an element. |
static Set<RdfList> |
findContainingLists(GraphNode element)
Returns the rdf lists of which the specified
GraphNode is
an element of. |
Resource |
get(int index) |
NonLiteral |
getListResource() |
int |
hashCode() |
Resource |
remove(int index) |
int |
size() |
add, addAll, clear, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, set, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
public RdfList(NonLiteral listResource, TripleCollection tc)
listResource
will always be the first list.listResource
- tc
- public RdfList(GraphNode listNode)
listNode
- public static RdfList createEmptyList(NonLiteral listResource, TripleCollection tc) throws IllegalArgumentException
listResource
owl:sameAs rdf.nil ." to tc
.listResource
- tc
- IllegalArgumentException
- if the provided listResource
is a non-empty rdf:List.public Resource get(int index)
public int size()
size
in interface Collection<Resource>
size
in interface List<Resource>
size
in class AbstractCollection<Resource>
public void add(int index, Resource element)
public Resource remove(int index)
public NonLiteral getListResource()
public boolean equals(Object obj)
equals
in interface Collection<Resource>
equals
in interface List<Resource>
equals
in class AbstractList<Resource>
public int hashCode()
hashCode
in interface Collection<Resource>
hashCode
in interface List<Resource>
hashCode
in class AbstractList<Resource>
public static Set<RdfList> findContainingLists(GraphNode element)
GraphNode
is
an element of. Sublists of other lists are not returned.element
- Copyright © 2014 The Apache Software Foundation. All Rights Reserved.