artisynth.core.modelbase
Class ScannableList<C extends Scannable>

java.lang.Object
  extended by artisynth.core.modelbase.ScannableList<C>
All Implemented Interfaces:
ParameterizedClass<C>, java.lang.Iterable<C>, java.util.Collection<C>, Scannable
Direct Known Subclasses:
ComponentListImpl

public class ScannableList<C extends Scannable>
extends java.lang.Object
implements Scannable, java.util.Collection<C>, ParameterizedClass<C>


Constructor Summary
ScannableList(java.lang.Class<C> type)
           
ScannableList(java.lang.Class<C> type, int cap)
           
 
Method Summary
 boolean add(C obj)
           
 void add(int idx, C obj)
           
 boolean addAll(java.util.Collection<? extends C> c)
           
 void clear()
           
 boolean contains(C obj)
           
 boolean contains(java.lang.Object obj)
           
 boolean containsAll(java.util.Collection<?> c)
           
 ScannableList<C> copy(int flags)
           
 C createComponent(artisynth.core.modelbase.ScannableList.ClassInfo classInfo)
           
 void ensureCapacity(int minCap)
           
 C get(int idx)
           
 java.lang.Class<C> getTypeParameter()
          Returns the base type for the class parameterization.
 boolean hasParameterizedType()
          Returns true if this class explicitly utilizes a parameterized type.
 int indexOf(C obj)
           
 boolean isEmpty()
           
 boolean isWritable()
          Returns true if this component should in fact be written to secondary storage.
 java.util.Iterator<C> iterator()
           
 C remove(int idx)
           
 boolean remove(java.lang.Object obj)
           
 boolean removeAll(java.util.Collection<?> c)
           
 boolean retainAll(java.util.Collection<?> c)
           
 void scan(ReaderTokenizer rtok, java.lang.Object ref)
          Scans this element from a ReaderTokenizer.
 C set(int idx, C obj)
           
 int size()
           
 java.lang.Object[] toArray()
           
<C> C[]
toArray(C[] array)
           
 void write(java.io.PrintWriter pw, NumberFormat fmt, java.lang.Object ref)
          Writes a text description of this element to a PrintWriter.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

ScannableList

public ScannableList(java.lang.Class<C> type)

ScannableList

public ScannableList(java.lang.Class<C> type,
                     int cap)
Method Detail

ensureCapacity

public void ensureCapacity(int minCap)

indexOf

public int indexOf(C obj)

iterator

public java.util.Iterator<C> iterator()
Specified by:
iterator in interface java.lang.Iterable<C extends Scannable>
Specified by:
iterator in interface java.util.Collection<C extends Scannable>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection<C extends Scannable>

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection<C extends Scannable>

toArray

public <C> C[] toArray(C[] array)
Specified by:
toArray in interface java.util.Collection<C extends Scannable>

contains

public boolean contains(C obj)

get

public C get(int idx)

set

public C set(int idx,
             C obj)

size

public int size()
Specified by:
size in interface java.util.Collection<C extends Scannable>

clear

public void clear()
Specified by:
clear in interface java.util.Collection<C extends Scannable>

add

public boolean add(C obj)
Specified by:
add in interface java.util.Collection<C extends Scannable>

add

public void add(int idx,
                C obj)

addAll

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

remove

public boolean remove(java.lang.Object obj)
Specified by:
remove in interface java.util.Collection<C extends Scannable>

retainAll

public boolean retainAll(java.util.Collection<?> c)
Specified by:
retainAll in interface java.util.Collection<C extends Scannable>

removeAll

public boolean removeAll(java.util.Collection<?> c)
Specified by:
removeAll in interface java.util.Collection<C extends Scannable>

remove

public C remove(int idx)

isWritable

public boolean isWritable()
Returns true if this component should in fact be written to secondary storage. This gives subclasses control over whether or not they are actually written out.

Specified by:
isWritable in interface Scannable
Returns:
true if this component should be written to secondary storage.

write

public void write(java.io.PrintWriter pw,
                  NumberFormat fmt,
                  java.lang.Object ref)
           throws java.io.IOException
Writes a text description of this element to a PrintWriter. The text description should be compatable with scan and complete enough to allow full reconstruction of the element.

Specified by:
write in interface Scannable
Parameters:
pw - stream for writing the element
fmt - numeric formating information
ref - optional reference object which can be used for producing references to other objects
Throws:
java.io.IOException - if an I/O error occured

scan

public void scan(ReaderTokenizer rtok,
                 java.lang.Object ref)
          throws java.io.IOException
Description copied from interface: Scannable
Scans this element from a ReaderTokenizer. The expected text format is assumed to be compatible with that produced by write.

Specified by:
scan in interface Scannable
Parameters:
rtok - Tokenizer from which to scan the element
ref - optional reference object which can be used for resolving references to other objects
Throws:
java.io.IOException - if an I/O or formatting error occured

createComponent

public C createComponent(artisynth.core.modelbase.ScannableList.ClassInfo classInfo)
                                    throws java.lang.InstantiationException,
                                           java.lang.IllegalAccessException,
                                           java.lang.reflect.InvocationTargetException
Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException

getTypeParameter

public java.lang.Class<C> getTypeParameter()
Description copied from interface: ParameterizedClass
Returns the base type for the class parameterization.

Specified by:
getTypeParameter in interface ParameterizedClass<C extends Scannable>

hasParameterizedType

public boolean hasParameterizedType()
Description copied from interface: ParameterizedClass
Returns true if this class explicitly utilizes a parameterized type.

Specified by:
hasParameterizedType in interface ParameterizedClass<C extends Scannable>

copy

public ScannableList<C> copy(int flags)

containsAll

public boolean containsAll(java.util.Collection<?> c)
Specified by:
containsAll in interface java.util.Collection<C extends Scannable>

contains

public boolean contains(java.lang.Object obj)
Specified by:
contains in interface java.util.Collection<C extends Scannable>