|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.Vector
simtools.data.DataSourceCollection
simtools.data.DynamicDataSourceCollection
simtools.data.DataSourceCollectionAnimator
public class DataSourceCollectionAnimator
This class adds dynamical features to a DataSourceCollection. This is useful to replay time series, for example. It will use the underlying collection to provide the values, and has its own API to control how to advance the index : step by step, or with a timer. Note: All APIs from superclasses are also redirected, including vector. Collective data sources are also redirect to us. So, this wrapper should really be transparent. This is especially important to understand the code behind buffer functions also works without overloading base functions.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class simtools.data.DynamicDataSourceCollection |
---|
DynamicDataSourceCollection.SourceInfo |
Nested classes/interfaces inherited from class simtools.data.DataSourceCollection |
---|
DataSourceCollection.Container |
Field Summary | |
---|---|
protected boolean |
autoStop
|
protected boolean |
finished
|
static java.lang.String |
MARKER
|
protected long |
period
|
protected DataSourceCollection |
target
|
protected java.util.Timer |
timer
|
Fields inherited from class simtools.data.DynamicDataSourceCollection |
---|
ourInfo, sourceInfo |
Fields inherited from class simtools.data.DataSourceCollection |
---|
buffers, endNotificationListeners, lastIndex, listeners, map, startIndex |
Fields inherited from class java.util.Vector |
---|
capacityIncrement, elementCount, elementData |
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
DataSourceCollectionAnimator(DataSourceCollection dsc)
|
Method Summary | |
---|---|
void |
add(int index,
java.lang.Object element)
|
boolean |
add(java.lang.Object o)
|
boolean |
addAll(java.util.Collection c)
|
boolean |
addAll(int index,
java.util.Collection c)
|
void |
addElement(java.lang.Object obj)
|
int |
capacity()
|
void |
clear()
|
java.lang.Object |
clone()
|
boolean |
contains(java.lang.Object elem)
|
boolean |
containsAll(java.util.Collection c)
|
void |
copyInto(java.lang.Object[] anArray)
|
protected DataSource |
createDataSource(DataInfo info)
|
protected DataSource |
createDataSource(DataInfo info,
int kind)
Add a data source with the given info. |
void |
DataSourceCollectionDataSourceAdded(DataSourceCollection dsc,
DataSource ds)
Called when the information about the data source collection changed |
void |
DataSourceCollectionDataSourceRemoved(DataSourceCollection dsc,
DataSource ds)
Called when the information about the data source collection changed |
void |
DataSourceCollectionInfoChanged(DataSourceCollection dsc,
DataInfo newInfo)
Called when the information about the data source collection changed |
void |
DataSourceCollectionRemoved(DataSourceCollection dsc)
Called when the data source collection has been removed |
java.lang.Object |
elementAt(int index)
|
java.util.Enumeration |
elements()
|
void |
ensureCapacity(int minCapacity)
|
boolean |
equals(java.lang.Object o)
|
java.lang.Object |
firstElement()
|
java.lang.Object |
get(int index)
|
DataSource |
get(java.lang.String id)
|
DataInfo |
getInformation()
|
long |
getPeriod()
|
DataSourceCollection |
getTargetCollection()
|
int |
hashCode()
Overrides Vector/AbstractList implementation to get a fix hashcode and be able to put and remove a collection from a HashSet for instance |
int |
indexOf(java.lang.Object elem)
|
int |
indexOf(java.lang.Object elem,
int index)
|
void |
insertElementAt(java.lang.Object obj,
int index)
|
boolean |
isAutoStop()
|
boolean |
isEmpty()
|
boolean |
isFinished()
|
boolean |
isRunning()
|
java.util.Iterator |
iterator()
|
java.lang.Object |
lastElement()
|
int |
lastIndexOf(java.lang.Object elem)
|
int |
lastIndexOf(java.lang.Object elem,
int index)
|
java.util.ListIterator |
listIterator()
|
java.util.ListIterator |
listIterator(int index)
|
java.lang.Object |
remove(int index)
|
boolean |
remove(java.lang.Object o)
|
boolean |
removeAll(java.util.Collection c)
|
void |
removeAllElements()
|
boolean |
removeElement(java.lang.Object obj)
|
void |
removeElementAt(int index)
|
void |
reset()
Resets the source. |
boolean |
retainAll(java.util.Collection c)
|
java.lang.Object |
set(int index,
java.lang.Object element)
|
void |
setAutoStop(boolean autoStop)
|
void |
setElementAt(java.lang.Object obj,
int index)
|
void |
setPeriod(long period)
Sets a period for cyclic execution |
void |
setSize(int newSize)
|
int |
size()
|
void |
start()
Starts to update the values with the previously set period. |
void |
start(long period)
Starts to update the values with the given period. |
void |
step()
Increase current index |
void |
stop()
Stop to update the values. |
java.util.List |
subList(int fromIndex,
int toIndex)
|
java.lang.Object[] |
toArray()
|
java.lang.Object[] |
toArray(java.lang.Object[] a)
|
java.lang.String |
toString()
|
void |
trimToSize()
|
Methods inherited from class java.util.Vector |
---|
removeRange |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String MARKER
protected DataSourceCollection target
protected long period
protected java.util.Timer timer
protected boolean finished
protected boolean autoStop
Constructor Detail |
---|
public DataSourceCollectionAnimator(DataSourceCollection dsc)
Method Detail |
---|
public boolean isFinished()
public DataInfo getInformation()
getInformation
in class DynamicDataSourceCollection
public void step() throws DataException
DataException
public long getPeriod()
public void setPeriod(long period)
period,
- in millisecondspublic boolean isRunning()
public void start(long period)
public void start()
public void stop()
public void reset()
public boolean isAutoStop()
public void setAutoStop(boolean autoStop)
autoStop
- The autoStop to set.protected DataSource createDataSource(DataInfo info, int kind)
DynamicDataSourceCollection
createDataSource
in class DynamicDataSourceCollection
info
- Any information that will describe the data source, null is possible but
not recommended.kind
- the data source kind, see ValueProvider. Object is default.
protected DataSource createDataSource(DataInfo info)
createDataSource
in class DynamicDataSourceCollection
public void DataSourceCollectionInfoChanged(DataSourceCollection dsc, DataInfo newInfo)
DataSourceCollectionListener
DataSourceCollectionInfoChanged
in interface DataSourceCollectionListener
dsc
- The data source collection that changednewInfo
- The new information concerning this collectionpublic void DataSourceCollectionDataSourceAdded(DataSourceCollection dsc, DataSource ds)
DataSourceCollectionListener
DataSourceCollectionDataSourceAdded
in interface DataSourceCollectionListener
dsc
- The data source collection that changedds
- The data source that was addedpublic void DataSourceCollectionDataSourceRemoved(DataSourceCollection dsc, DataSource ds)
DataSourceCollectionListener
DataSourceCollectionDataSourceRemoved
in interface DataSourceCollectionListener
dsc
- The data source collection that changedds
- The data source that was removedpublic void DataSourceCollectionRemoved(DataSourceCollection dsc)
DataSourceCollectionListener
DataSourceCollectionRemoved
in interface DataSourceCollectionListener
dsc
- The data source collection that has been removedpublic DataSource get(java.lang.String id)
get
in class DataSourceCollection
public void copyInto(java.lang.Object[] anArray)
copyInto
in class java.util.Vector
public void trimToSize()
trimToSize
in class java.util.Vector
public void ensureCapacity(int minCapacity)
ensureCapacity
in class java.util.Vector
public void setSize(int newSize)
setSize
in class java.util.Vector
public int capacity()
capacity
in class java.util.Vector
public int size()
size
in interface java.util.Collection
size
in interface java.util.List
size
in class java.util.Vector
public boolean isEmpty()
isEmpty
in interface java.util.Collection
isEmpty
in interface java.util.List
isEmpty
in class java.util.Vector
public java.util.Enumeration elements()
elements
in class java.util.Vector
public boolean contains(java.lang.Object elem)
contains
in interface java.util.Collection
contains
in interface java.util.List
contains
in class java.util.Vector
public int indexOf(java.lang.Object elem)
indexOf
in interface java.util.List
indexOf
in class java.util.Vector
public int indexOf(java.lang.Object elem, int index)
indexOf
in class java.util.Vector
public int lastIndexOf(java.lang.Object elem)
lastIndexOf
in interface java.util.List
lastIndexOf
in class java.util.Vector
public int lastIndexOf(java.lang.Object elem, int index)
lastIndexOf
in class java.util.Vector
public java.lang.Object elementAt(int index)
elementAt
in class java.util.Vector
public java.lang.Object firstElement()
firstElement
in class java.util.Vector
public java.lang.Object lastElement()
lastElement
in class java.util.Vector
public void setElementAt(java.lang.Object obj, int index)
setElementAt
in class java.util.Vector
public void removeElementAt(int index)
removeElementAt
in class java.util.Vector
public void insertElementAt(java.lang.Object obj, int index)
insertElementAt
in class java.util.Vector
public void addElement(java.lang.Object obj)
addElement
in class java.util.Vector
public boolean removeElement(java.lang.Object obj)
removeElement
in class java.util.Vector
public void removeAllElements()
removeAllElements
in class DataSourceCollection
public java.lang.Object clone()
clone
in class java.util.Vector
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection
toArray
in interface java.util.List
toArray
in class java.util.Vector
public java.lang.Object[] toArray(java.lang.Object[] a)
toArray
in interface java.util.Collection
toArray
in interface java.util.List
toArray
in class java.util.Vector
public java.lang.Object get(int index)
get
in interface java.util.List
get
in class java.util.Vector
public java.lang.Object set(int index, java.lang.Object element)
set
in interface java.util.List
set
in class java.util.Vector
public boolean add(java.lang.Object o)
add
in interface java.util.Collection
add
in interface java.util.List
add
in class java.util.Vector
public boolean remove(java.lang.Object o)
remove
in interface java.util.Collection
remove
in interface java.util.List
remove
in class java.util.Vector
public void add(int index, java.lang.Object element)
add
in interface java.util.List
add
in class java.util.Vector
public java.lang.Object remove(int index)
remove
in interface java.util.List
remove
in class java.util.Vector
public void clear()
clear
in interface java.util.Collection
clear
in interface java.util.List
clear
in class java.util.Vector
public boolean containsAll(java.util.Collection c)
containsAll
in interface java.util.Collection
containsAll
in interface java.util.List
containsAll
in class java.util.Vector
public boolean addAll(java.util.Collection c)
addAll
in interface java.util.Collection
addAll
in interface java.util.List
addAll
in class java.util.Vector
public boolean removeAll(java.util.Collection c)
removeAll
in interface java.util.Collection
removeAll
in interface java.util.List
removeAll
in class java.util.Vector
public boolean retainAll(java.util.Collection c)
retainAll
in interface java.util.Collection
retainAll
in interface java.util.List
retainAll
in class java.util.Vector
public boolean addAll(int index, java.util.Collection c)
addAll
in interface java.util.List
addAll
in class java.util.Vector
public boolean equals(java.lang.Object o)
equals
in interface java.util.Collection
equals
in interface java.util.List
equals
in class java.util.Vector
public int hashCode()
DataSourceCollection
hashCode
in interface java.util.Collection
hashCode
in interface java.util.List
hashCode
in class DataSourceCollection
public java.lang.String toString()
toString
in class java.util.Vector
public java.util.List subList(int fromIndex, int toIndex)
subList
in interface java.util.List
subList
in class java.util.Vector
public java.util.Iterator iterator()
iterator
in interface java.lang.Iterable
iterator
in interface java.util.Collection
iterator
in interface java.util.List
iterator
in class java.util.AbstractList
public java.util.ListIterator listIterator()
listIterator
in interface java.util.List
listIterator
in class java.util.AbstractList
public java.util.ListIterator listIterator(int index)
listIterator
in interface java.util.List
listIterator
in class java.util.AbstractList
public DataSourceCollection getTargetCollection()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |