info.sswap.impl.empire.model
Class ListImpl

java.lang.Object
  extended by info.sswap.impl.empire.model.ModelImpl
      extended by info.sswap.impl.empire.model.ElementImpl
          extended by info.sswap.impl.empire.model.ListImpl
All Implemented Interfaces:
com.clarkparsia.empire.SupportsRdfId, SSWAPElement, SSWAPList, SSWAPModel, java.lang.Iterable<SSWAPElement>, java.util.Collection<SSWAPElement>, java.util.List<SSWAPElement>

public class ListImpl
extends ElementImpl
implements SSWAPList

Implementation of SSWAPList. This class wraps a LinkedList to provide both the functionality of the list and the SSWAPElement.

Author:
Blazej Bulka

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.clarkparsia.empire.SupportsRdfId
com.clarkparsia.empire.SupportsRdfId.BNodeKey, com.clarkparsia.empire.SupportsRdfId.RdfKey<T>, com.clarkparsia.empire.SupportsRdfId.URIKey
 
Field Summary
private  java.util.LinkedList<SSWAPElement> list
          The underlying implementation of the list.
 
Constructor Summary
ListImpl()
          Creates an empty list.
ListImpl(java.util.Collection<SSWAPElement> originalList)
          Creates a list initialized with data from a collection of SSWAPElements.
 
Method Summary
 void add(int index, SSWAPElement element)
           
 boolean add(SSWAPElement o)
           
 boolean addAll(java.util.Collection<? extends SSWAPElement> c)
           
 boolean addAll(int index, java.util.Collection<? extends SSWAPElement> c)
           
 SSWAPList asList()
          Type-safe cast of this SSWAPElement into SSWAPList
 void clear()
           
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection<?> c)
           
 SSWAPElement get(int index)
           
 com.clarkparsia.empire.SupportsRdfId.RdfKey getRdfId()
          Returns the RDF identifier of this list, which is always null.
 int indexOf(java.lang.Object o)
           
 boolean isEmpty()
           
 boolean isList()
          Informs the caller that this object is a list.
 java.util.Iterator<SSWAPElement> iterator()
           
 int lastIndexOf(java.lang.Object o)
           
 java.util.ListIterator<SSWAPElement> listIterator()
           
 java.util.ListIterator<SSWAPElement> listIterator(int index)
           
 SSWAPElement remove(int index)
           
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection<?> c)
           
 boolean retainAll(java.util.Collection<?> c)
           
 SSWAPElement set(int index, SSWAPElement element)
           
 void setRdfId(com.clarkparsia.empire.SupportsRdfId.RdfKey rdfId)
          This method is required by the interface, but since lists cannot have their own identifiers, a call to this will result in UnsupportedOperationException
 int size()
           
 java.util.List<SSWAPElement> subList(int fromIndex, int toIndex)
           
 java.lang.Object[] toArray()
           
<T> T[]
toArray(T[] a)
           
 
Methods inherited from class info.sswap.impl.empire.model.ElementImpl
addComment, addLabel, asBoolean, asDouble, asIndividual, asInteger, asLiteral, asString, getComment, getJenaResource, getLabel, isAnonymous, isIndividual, isLiteral
 
Methods inherited from class info.sswap.impl.empire.model.ModelImpl
addImport, assertModel, assertSourceModel, checkProfile, dereference, dereference, doClosure, getAllDependentObjects, getDependentObject, getDocument, getExpressivity, getImports, getInputStream, getNsPrefixMap, getReasoningService, getSourceModel, getTypeSignature, getURI, hasSourceModel, hasSourceModelWithEntityManager, isDereferenced, persist, rdfIdEquals, rdfIdHashCode, refresh, refreshSiblings, removeImport, removeNsPrefix, serialize, serialize, setDereferenced, setNsPrefix, setSourceModel, setURI, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface info.sswap.api.model.SSWAPElement
addComment, addLabel, asBoolean, asDouble, asIndividual, asInteger, asLiteral, asString, getComment, getLabel, isIndividual, isLiteral
 
Methods inherited from interface info.sswap.api.model.SSWAPModel
addImport, checkProfile, dereference, dereference, doClosure, getDocument, getImports, getInputStream, getNsPrefixMap, getReasoningService, getTypeSignature, getURI, isDereferenced, removeImport, removeNsPrefix, serialize, serialize, setNsPrefix, validate
 
Methods inherited from interface java.util.List
equals, hashCode
 

Field Detail

list

private java.util.LinkedList<SSWAPElement> list
The underlying implementation of the list.

Constructor Detail

ListImpl

public ListImpl()
Creates an empty list.


ListImpl

public ListImpl(java.util.Collection<SSWAPElement> originalList)
Creates a list initialized with data from a collection of SSWAPElements.

Parameters:
originalList - the original list whose elements will be used to populate this list.
Method Detail

add

public boolean add(SSWAPElement o)
Specified by:
add in interface java.util.Collection<SSWAPElement>
Specified by:
add in interface java.util.List<SSWAPElement>

add

public void add(int index,
                SSWAPElement element)
Specified by:
add in interface java.util.List<SSWAPElement>

addAll

public boolean addAll(java.util.Collection<? extends SSWAPElement> c)
Specified by:
addAll in interface java.util.Collection<SSWAPElement>
Specified by:
addAll in interface java.util.List<SSWAPElement>

addAll

public boolean addAll(int index,
                      java.util.Collection<? extends SSWAPElement> c)
Specified by:
addAll in interface java.util.List<SSWAPElement>

clear

public void clear()
Specified by:
clear in interface java.util.Collection<SSWAPElement>
Specified by:
clear in interface java.util.List<SSWAPElement>

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection<SSWAPElement>
Specified by:
contains in interface java.util.List<SSWAPElement>

containsAll

public boolean containsAll(java.util.Collection<?> c)
Specified by:
containsAll in interface java.util.Collection<SSWAPElement>
Specified by:
containsAll in interface java.util.List<SSWAPElement>

get

public SSWAPElement get(int index)
Specified by:
get in interface java.util.List<SSWAPElement>

indexOf

public int indexOf(java.lang.Object o)
Specified by:
indexOf in interface java.util.List<SSWAPElement>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection<SSWAPElement>
Specified by:
isEmpty in interface java.util.List<SSWAPElement>

iterator

public java.util.Iterator<SSWAPElement> iterator()
Specified by:
iterator in interface java.lang.Iterable<SSWAPElement>
Specified by:
iterator in interface java.util.Collection<SSWAPElement>
Specified by:
iterator in interface java.util.List<SSWAPElement>

lastIndexOf

public int lastIndexOf(java.lang.Object o)
Specified by:
lastIndexOf in interface java.util.List<SSWAPElement>

listIterator

public java.util.ListIterator<SSWAPElement> listIterator()
Specified by:
listIterator in interface java.util.List<SSWAPElement>

listIterator

public java.util.ListIterator<SSWAPElement> listIterator(int index)
Specified by:
listIterator in interface java.util.List<SSWAPElement>

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection<SSWAPElement>
Specified by:
remove in interface java.util.List<SSWAPElement>

remove

public SSWAPElement remove(int index)
Specified by:
remove in interface java.util.List<SSWAPElement>

removeAll

public boolean removeAll(java.util.Collection<?> c)
Specified by:
removeAll in interface java.util.Collection<SSWAPElement>
Specified by:
removeAll in interface java.util.List<SSWAPElement>

retainAll

public boolean retainAll(java.util.Collection<?> c)
Specified by:
retainAll in interface java.util.Collection<SSWAPElement>
Specified by:
retainAll in interface java.util.List<SSWAPElement>

set

public SSWAPElement set(int index,
                        SSWAPElement element)
Specified by:
set in interface java.util.List<SSWAPElement>

size

public int size()
Specified by:
size in interface java.util.Collection<SSWAPElement>
Specified by:
size in interface java.util.List<SSWAPElement>

subList

public java.util.List<SSWAPElement> subList(int fromIndex,
                                            int toIndex)
Specified by:
subList in interface java.util.List<SSWAPElement>

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection<SSWAPElement>
Specified by:
toArray in interface java.util.List<SSWAPElement>

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface java.util.Collection<SSWAPElement>
Specified by:
toArray in interface java.util.List<SSWAPElement>

getRdfId

public com.clarkparsia.empire.SupportsRdfId.RdfKey getRdfId()
Returns the RDF identifier of this list, which is always null.

Specified by:
getRdfId in interface com.clarkparsia.empire.SupportsRdfId
Returns:
always null

setRdfId

public void setRdfId(com.clarkparsia.empire.SupportsRdfId.RdfKey rdfId)
This method is required by the interface, but since lists cannot have their own identifiers, a call to this will result in UnsupportedOperationException

Specified by:
setRdfId in interface com.clarkparsia.empire.SupportsRdfId
Parameters:
rdfId - the RDF identifier
Throws:
java.lang.UnsupportedOperationException - every time this method is called

isList

public boolean isList()
Informs the caller that this object is a list.

Specified by:
isList in interface SSWAPElement
Overrides:
isList in class ElementImpl
Returns:
true

asList

public SSWAPList asList()
Type-safe cast of this SSWAPElement into SSWAPList

Specified by:
asList in interface SSWAPElement
Overrides:
asList in class ElementImpl
Returns:
this object typed as SSWAPList


Copyright (c) 2011, iPlant Collaborative, University of Arizona, Cold Spring Harbor Laboratories, University of Texas at Austin.