org.mindswap.rdfparser.rdf.util
Class RDFResourceList

java.lang.Object
  |
  +--org.mindswap.rdfparser.rdf.util.RDFResourceList
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class RDFResourceList
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

See Also:
Serialized Form

Constructor Summary
RDFResourceList()
           
 
Method Summary
 void addAll(RDFResourceList rl)
          Adds all elements of parameter to current list.

 void addElement(RDFResource res)
          Adds the parameter to the list if it has not already been added.

 void clear()
          Removes all elements from the list.

 java.lang.Object clone()
          Makes a copy of this object.

 boolean contains(java.lang.Object obj)
          Returns true or false depending on whether the parameter is currently in the list.

 RDFResource elementAt(int index)
          Returns the element at the specified index.

 RDFResource getResourceById(java.lang.String id)
          Search through the list and return the resource with the specified id.

 RDFResourceList getResourceByType(java.lang.String type)
          Search through the list and return all resources with the specifed type.

 int indexOf(RDFResource r)
          Returns the index of the parameter in the list.

 void remove(int index)
          Removes the element at the index from the list.

 void remove(RDFResource res)
          Removes the element from the list if it is in the list.

 void removeElement(RDFResource r)
          Removes element from list if currently in the list.

 void set(int index, RDFResource r)
          Sets the element at the specified index to the parameter r.

 void setElementAt(RDFResource r, int index)
          Sets the element at the specified index to the parameter r.

 int size()
          Returns the number of elements currently in the list.

 java.lang.String toRDF()
          Produce the RDF for each element in this list.

 java.lang.String toRDF(Namespaces ns, int indent)
          Produce the RDF for each element in this list.

 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RDFResourceList

public RDFResourceList()
Method Detail

clone

public java.lang.Object clone()
Makes a copy of this object.

Returns:
A copy of this object

addElement

public void addElement(RDFResource res)
Adds the parameter to the list if it has not already been added.

Parameters:
res - Element to be added

remove

public void remove(RDFResource res)
Removes the element from the list if it is in the list.

Parameters:
res - Element to be removed

remove

public void remove(int index)
Removes the element at the index from the list.

Parameters:
index - Index to remove element from

elementAt

public RDFResource elementAt(int index)
Returns the element at the specified index.

Parameters:
index - Index in array
Returns:
Element at index

size

public int size()
Returns the number of elements currently in the list.

Returns:
the size of the list

clear

public void clear()
Removes all elements from the list.


contains

public boolean contains(java.lang.Object obj)
Returns true or false depending on whether the parameter is currently in the list.

Parameters:
obj - Element to search for
Returns:
true if the element is in the list, false otherwise

set

public void set(int index,
                RDFResource r)
Sets the element at the specified index to the parameter r.

Parameters:
index - Index in array
r - Element to set
See Also:
setElementAt(org.mindswap.rdfparser.rdf.RDFResource, int)

setElementAt

public void setElementAt(RDFResource r,
                         int index)
Sets the element at the specified index to the parameter r.

Parameters:
f - Element to set
index - Index in array
See Also:
set(int, org.mindswap.rdfparser.rdf.RDFResource)

removeElement

public void removeElement(RDFResource r)
Removes element from list if currently in the list.

Parameters:
r - Element to remove

addAll

public void addAll(RDFResourceList rl)
Adds all elements of parameter to current list.

Parameters:
rl - List to be added

indexOf

public int indexOf(RDFResource r)
Returns the index of the parameter in the list.

Parameters:
fn - Element to search for
Returns:
Index of the parameter in the list, or -1 if not present in the list.

getResourceById

public RDFResource getResourceById(java.lang.String id)
Search through the list and return the resource with the specified id.

Parameters:
id - Id of resource to search for
Returns:
Resource with specified id, or null if not found.

getResourceByType

public RDFResourceList getResourceByType(java.lang.String type)
Search through the list and return all resources with the specifed type.

Parameters:
type - Type of resource to search for
Returns:
All resources with the specified type

toRDF

public java.lang.String toRDF()
Produce the RDF for each element in this list.

Returns:
String containing the RDF of all the member elements

toRDF

public java.lang.String toRDF(Namespaces ns,
                              int indent)
Produce the RDF for each element in this list.

Parameters:
ns - Namespace object for encoding this list
indent - number of spaces to indent the RDF
Returns:
String containing the RDF of all the member elements