|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectartisynth.core.modelbase.ModelComponentBase
artisynth.core.modelbase.ComponentList<C>
public class ComponentList<C extends ModelComponent>
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface artisynth.core.modelbase.CompositeComponent |
---|
CompositeComponent.NavpanelDisplay |
Nested classes/interfaces inherited from interface artisynth.core.modelbase.ModelComponent |
---|
ModelComponent.NavpanelVisibility |
Field Summary | |
---|---|
static CompositeComponent.NavpanelDisplay |
DEFAULT_NAVPANEL_DISPLAY
|
static PropertyList |
myProps
|
Fields inherited from class artisynth.core.modelbase.ModelComponentBase |
---|
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames |
Constructor Summary | |
---|---|
ComponentList(java.lang.Class<C> type)
|
|
ComponentList(java.lang.Class<C> type,
java.lang.String name)
|
|
ComponentList(java.lang.Class<C> type,
java.lang.String name,
java.lang.String shortName)
|
Method Summary | ||
---|---|---|
boolean |
add(C comp)
Adds a component to this MutableCompositeComponent. |
|
void |
add(C comp,
int idx)
|
|
boolean |
addAll(java.util.Collection<? extends C> c)
|
|
void |
addComponents(ModelComponent[] comps,
int[] indices,
int ncomps)
Adds a set of components to this MutableCompositeComponent. |
|
boolean |
addFixed(C comp)
|
|
boolean |
addNumbered(C comp,
int number)
|
|
void |
clear()
|
|
java.lang.Object |
clone()
|
|
void |
componentChanged(ComponentChangeEvent e)
Notifies this composite component that a change has occured within one or more of its descendants. |
|
boolean |
contains(C comp)
Faster implementation using component parent pointer. |
|
boolean |
contains(java.lang.Object obj)
Returns true if a particular element is contained in this list. |
|
boolean |
containsAll(java.util.Collection<?> c)
|
|
ComponentList<C> |
copy(int flags,
java.util.Map<ModelComponent,ModelComponent> copyMap)
|
|
void |
ensureCapacity(int cap)
|
|
C |
findComponent(java.lang.String path)
Recursively searches for a sub-component of this ModelComponent, identified by a path of component names. |
|
C |
get(int idx)
Get the component at a particular index, or null if there is no such component. |
|
C |
get(java.lang.String nameOrNumber)
Get the component with particular name, or null if there is no such component. |
|
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by this object. |
|
C |
getByNumber(int num)
Get the component with the specified number, or null if there is no such component. |
|
java.util.Iterator<? extends HierarchyNode> |
getChildren()
|
|
CompositeComponent.NavpanelDisplay |
getNavpanelDisplay()
Returns the DisplayMode for this component. |
|
int |
getNumberLimit()
Returns the current upper limit for numbers among all sub-components in this composite. |
|
java.lang.String |
getShortName()
Gets the short name of this component list. |
|
java.lang.Class<C> |
getTypeParameter()
Returns the base type for the class parameterization. |
|
boolean |
hasChildren()
|
|
boolean |
hasParameterizedType()
Returns true if this class explicitly utilizes a parameterized type. |
|
boolean |
hierarchyContainsReferences()
Returns true if the component hierarchy formed by this component and its descendents is closed with respect to references. |
|
int |
indexOf(ModelComponent comp)
Get the index of a particular component in this list, or -1 if the specified component is not present. |
|
boolean |
isEmpty()
|
|
java.util.Iterator<C> |
iterator()
Return an iterator over all components in this list. |
|
int |
nextComponentNumber()
Returns the number that will be assigned to the next component added to this list. |
|
int |
numComponents()
Returns the number of components in this CompositeComponent. |
|
void |
postscan(java.util.Deque<ScanToken> tokens,
CompositeComponent ancestor)
Performs any required post-scanning for this component. |
|
C |
remove(int idx)
|
|
boolean |
remove(java.lang.Object obj)
Removes a component from this MutableCompositeComponent, returning true if the componet was in fact found and removed. |
|
void |
removeAll()
|
|
boolean |
removeAll(java.util.Collection<?> c)
|
|
void |
removeComponents(ModelComponent[] comps,
int[] indices,
int ncomps)
Removes a set of components from this MutableCompositeComponent. |
|
boolean |
retainAll(java.util.Collection<?> c)
|
|
void |
scan(ReaderTokenizer rtok,
java.lang.Object ref)
Scans this element from a ReaderTokenizer. |
|
void |
setNavpanelDisplay(CompositeComponent.NavpanelDisplay mode)
Sets the display mode for this component. |
|
void |
setNumberingStartAtOne()
|
|
void |
setShortName(java.lang.String name)
|
|
int |
size()
Get the number of components in this list. |
|
java.lang.Object[] |
toArray()
|
|
|
toArray(C[] array)
|
|
void |
updateNameMap(java.lang.String newName,
java.lang.String oldName,
ModelComponent comp)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface artisynth.core.modelbase.ComponentListView |
---|
getName |
Methods inherited from interface artisynth.core.modelbase.ModelComponent |
---|
connectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, setFixed, setMarked, setName, setNumber, setParent, setSelected, updateReferences |
Methods inherited from interface maspack.properties.HasProperties |
---|
getProperty |
Methods inherited from interface maspack.util.Scannable |
---|
isWritable, write |
Methods inherited from interface java.util.Collection |
---|
equals, hashCode |
Field Detail |
---|
public static CompositeComponent.NavpanelDisplay DEFAULT_NAVPANEL_DISPLAY
public static PropertyList myProps
Constructor Detail |
---|
public ComponentList(java.lang.Class<C> type)
public ComponentList(java.lang.Class<C> type, java.lang.String name)
public ComponentList(java.lang.Class<C> type, java.lang.String name, java.lang.String shortName)
Method Detail |
---|
public PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class ModelComponentBase
public C get(java.lang.String nameOrNumber)
get
in interface ComponentListView<C extends ModelComponent>
get
in interface CompositeComponent
nameOrNumber
- name of the component
public C getByNumber(int num)
getByNumber
in interface ComponentListView<C extends ModelComponent>
getByNumber
in interface CompositeComponent
num
- number of the component
public int numComponents()
numComponents
in interface CompositeComponent
numComponents
in interface IndexedComponentList
public int indexOf(ModelComponent comp)
indexOf
in interface ComponentListView<C extends ModelComponent>
indexOf
in interface CompositeComponent
comp
- component to search for
public C findComponent(java.lang.String path)
findComponent
in interface CompositeComponent
path
- path leading to the sub-component
public int getNumberLimit()
getNumberLimit
in interface CompositeComponent
public CompositeComponent.NavpanelDisplay getNavpanelDisplay()
getNavpanelDisplay
in interface CompositeComponent
public void setNavpanelDisplay(CompositeComponent.NavpanelDisplay mode)
NORMAL
.
mode
- new display modepublic void componentChanged(ComponentChangeEvent e)
This method should propagate the notification up the component hierarchy
by calling notifyParentOfChange
.
componentChanged
in interface ComponentChangeListener
componentChanged
in interface CompositeComponent
e
- optional argument giving specific information about the changepublic void updateNameMap(java.lang.String newName, java.lang.String oldName, ModelComponent comp)
updateNameMap
in interface CompositeComponent
public boolean hierarchyContainsReferences()
In particular, this means that one does not need to search outside the hierarchy when looking for dependencies.
hierarchyContainsReferences
in interface CompositeComponent
public int nextComponentNumber()
nextComponentNumber
in interface ComponentListView<C extends ModelComponent>
public int size()
ComponentListView
size
in interface ComponentListView<C extends ModelComponent>
size
in interface java.util.Collection<C extends ModelComponent>
size
in interface ListView<C extends ModelComponent>
public C get(int idx)
ComponentListView
get
in interface ComponentListView<C extends ModelComponent>
get
in interface CompositeComponent
get
in interface IndexedComponentList
get
in interface ListView<C extends ModelComponent>
idx
- index of the component
public java.util.Iterator<C> iterator()
ComponentListView
iterator
in interface ComponentListView<C extends ModelComponent>
iterator
in interface java.lang.Iterable<C extends ModelComponent>
iterator
in interface java.util.Collection<C extends ModelComponent>
iterator
in interface ListView<C extends ModelComponent>
public boolean contains(java.lang.Object obj)
ListView
contains
in interface java.util.Collection<C extends ModelComponent>
contains
in interface ListView<C extends ModelComponent>
obj
- element to search for
public boolean isEmpty()
isEmpty
in interface java.util.Collection<C extends ModelComponent>
public java.lang.Class<C> getTypeParameter()
ParameterizedClass
getTypeParameter
in interface ParameterizedClass
public boolean hasParameterizedType()
ParameterizedClass
hasParameterizedType
in interface ParameterizedClass
public boolean addAll(java.util.Collection<? extends C> c)
addAll
in interface java.util.Collection<C extends ModelComponent>
public java.util.Iterator<? extends HierarchyNode> getChildren()
getChildren
in interface HierarchyNode
getChildren
in class ModelComponentBase
public boolean hasChildren()
hasChildren
in interface HierarchyNode
hasChildren
in class ModelComponentBase
public boolean add(C comp)
add
in interface MutableCompositeComponent<C extends ModelComponent>
add
in interface java.util.Collection<C extends ModelComponent>
comp
- component to be addedpublic boolean addFixed(C comp)
public void add(C comp, int idx)
public boolean addNumbered(C comp, int number)
public void addComponents(ModelComponent[] comps, int[] indices, int ncomps)
indices
is not
null, it specified the index locations at which the components should be
added. It is up to the caller to insure that the specified index values
make sense; in particular, they must not exceed the final size of the
component and no two specified indices can be the same.
addComponents
in interface MutableCompositeComponent<C extends ModelComponent>
comps
- list of components to be addedindices
- (optional) index locations of componentsncomps
- number of components to be addedpublic boolean remove(java.lang.Object obj)
remove
in interface MutableCompositeComponent<C extends ModelComponent>
remove
in interface java.util.Collection<C extends ModelComponent>
obj
- component to be added
public C remove(int idx)
public void removeComponents(ModelComponent[] comps, int[] indices, int ncomps)
indices
is not
null, it is used to return the indices where the components were located.
removeComponents
in interface MutableCompositeComponent<C extends ModelComponent>
comps
- components to be removedindices
- (optional) stores the indices of the removed componentsncomps
- number of components to be removedpublic void removeAll()
public boolean retainAll(java.util.Collection<?> c)
retainAll
in interface java.util.Collection<C extends ModelComponent>
public boolean removeAll(java.util.Collection<?> c)
removeAll
in interface java.util.Collection<C extends ModelComponent>
public boolean containsAll(java.util.Collection<?> c)
containsAll
in interface java.util.Collection<C extends ModelComponent>
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<C extends ModelComponent>
public <C> C[] toArray(C[] array)
toArray
in interface java.util.Collection<C extends ModelComponent>
public void clear()
clear
in interface java.util.Collection<C extends ModelComponent>
public void ensureCapacity(int cap)
public void setNumberingStartAtOne()
public void setShortName(java.lang.String name)
public java.lang.String getShortName()
ComponentListView
getShortName
in interface ComponentListView<C extends ModelComponent>
public boolean contains(C comp)
contains
in interface ComponentListView<C extends ModelComponent>
comp
- component to search for
public void scan(ReaderTokenizer rtok, java.lang.Object ref) throws java.io.IOException
ModelComponentBase
write
.
scan
in interface ModelComponent
scan
in interface Scannable
scan
in class ModelComponentBase
rtok
- Tokenizer from which to scan the elementref
- optional reference object which can be used for resolving references to
other objects
java.io.IOException
- if an I/O or formatting error occuredpublic void postscan(java.util.Deque<ScanToken> tokens, CompositeComponent ancestor) throws java.io.IOException
ModelComponent
scan()
method and stored in the token queue.
The most common use of this method is to resolve the paths
of component references, which may not have been created
at the time of the initial scan()
call.
postscan
in interface ModelComponent
postscan
in class ModelComponentBase
tokens
- token information that was stored during
scan()
.ancestor
- ancestor component with respect to which
reference component paths are defined.
java.io.IOException
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class ModelComponentBase
java.lang.CloneNotSupportedException
public ComponentList<C> copy(int flags, java.util.Map<ModelComponent,ModelComponent> copyMap)
copy
in class ModelComponentBase
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |