Package xal.tools.data
Class TransientDataAdaptor
java.lang.Object
xal.tools.data.TransientDataAdaptor
- All Implemented Interfaces:
DataAdaptor
A volatile implementation of the
DataAdaptor interface.
TransientDataAdaptor is intended as a convenience class for
passing data using the DataAdaptor interface. Note, however,
class supports no persistence. Once an object of class
TransientDataAdaptor is destroyed all internal data is lost.- Author:
- Christopher K. Allen
-
Constructor Summary
ConstructorsConstructorDescriptionTransientDataAdaptor(String strLabel) Create a new instance of VolatileDataAdaptor -
Method Summary
Modifier and TypeMethodDescriptionString[]Get all the attribute names in the data node.booleanbooleanValue(String strAttrName) Get the value of an attribute.childAdaptor(String strLabel) Convenience method to get a single child adaptor when only one is expected.Get an iterator containing all child adaptors of this node.childAdaptorIterator(String strLabel) Get an iterator for all child data nodes having a given data label.Get all the child data nodes of this adaptor.childAdaptors(String strLabel) Get all the child data nodes of a particular data label.createChild(String strLabel) Create a new empty child adaptor with the specified label.double[]doubleArray(String strAttr) Returns the value of an attribute as an array of doubles.doubledoubleValue(String strAttrName) Get the value of an attribute.booleanhasAttribute(String strAttrName) Test whether or not an attribute is present in the data node.intGet the value of an attribute.longGet the value of an attribute.name()Get the label for this data node.intGet the number of child data nodes.voidprint(PrintStream os) Print out the contents of this adaptor.voidremoveChild(DataAdaptor adaptor) Remove a child adaptorvoidSet the value of the specified attributevoidSet the value of the specified attributevoidSets the attribute (name,value) pair for the given arguments.voidSet the value of the specified attributevoidSet the value of the specified attributevoidSet the value of the specified attributevoidSet the value of the specified attribute as a string.stringValue(String strAttrName) Get the value of an attribute.voidwriteNode(DataListener ifcSrc) Write out the listener data as a new node then append it as a child node in the data tree.voidwriteNodes(Collection<? extends DataListener> colSrcs) write the collection of listeners to new nodes and append them to the data tree.
-
Constructor Details
-
TransientDataAdaptor
Create a new instance of VolatileDataAdaptor- Parameters:
strLabel- label for new data node
-
-
Method Details
-
name
Get the label for this data node.- Specified by:
namein interfaceDataAdaptor- Returns:
- name for the particular node in the data tree
-
attributes
Get all the attribute names in the data node.- Specified by:
attributesin interfaceDataAdaptor- Returns:
- array of all attributes names
-
hasAttribute
Test whether or not an attribute is present in the data node.- Specified by:
hasAttributein interfaceDataAdaptor- Parameters:
strAttrName- attribute name- Returns:
- true if specified attribute is present, false otherwise
-
stringValue
Get the value of an attribute.- Specified by:
stringValuein interfaceDataAdaptor- Parameters:
strAttrName- name of attribute- Returns:
- value of attribute as boolean
-
booleanValue
Get the value of an attribute.- Specified by:
booleanValuein interfaceDataAdaptor- Parameters:
strAttrName- name of attribute- Returns:
- value of attribute as boolean
- Throws:
NumberFormatException- unable to parse value as boolean
-
intValue
Get the value of an attribute.- Specified by:
intValuein interfaceDataAdaptor- Parameters:
strAttrName- name of attribute- Returns:
- value of attribute as int
- Throws:
NumberFormatException- unable to parse value as int
-
longValue
Get the value of an attribute.- Specified by:
longValuein interfaceDataAdaptor- Parameters:
strAttrName- name of attribute- Returns:
- value of attribute as long
- Throws:
NumberFormatException- unable to parse value as long
-
doubleValue
Get the value of an attribute.- Specified by:
doubleValuein interfaceDataAdaptor- Parameters:
strAttrName- name of attribute- Returns:
- value of attribute as double
- Throws:
NumberFormatException- unable to parse value as double
-
doubleArray
Returns the value of an attribute as an array of doubles. The attribute value must be stored as a string of comma separated values (CSVs). The values are parsed into doubles and packed into the returned array.- Specified by:
doubleArrayin interfaceDataAdaptor- Parameters:
strAttr- the attribute name- Returns:
- Array of double values as parsed from the value string. A
nullvalue is returned if the value string is empty. - Throws:
NumberFormatException- at least one value was malformed, or the CSV string was malformed- Since:
- Mar 12, 2010
-
setValue
Set the value of the specified attribute as a string.- Specified by:
setValuein interfaceDataAdaptor- Parameters:
strAttrName- attribute namestrAttrVal- attribute value
-
setValue
Set the value of the specified attribute- Specified by:
setValuein interfaceDataAdaptor- Parameters:
strAttrName- attribute nameobjAttrVal- new attribute value
-
setValue
Set the value of the specified attribute- Specified by:
setValuein interfaceDataAdaptor- Parameters:
strAttrName- attribute namebolAttrVal- new attribute value
-
setValue
Set the value of the specified attribute- Specified by:
setValuein interfaceDataAdaptor- Parameters:
strAttrName- attribute nameintAttrVal- new attribute value
-
setValue
Set the value of the specified attribute- Specified by:
setValuein interfaceDataAdaptor- Parameters:
strAttrName- attribute namelongAttrVal- new attribute value
-
setValue
Set the value of the specified attribute- Specified by:
setValuein interfaceDataAdaptor- Parameters:
strAttrName- attribute namedblAttrVal- new attribute value
-
setValue
Sets the attribute (name,value) pair for the given arguments. The value here is a double array which is stored as a string of comma separated values.- Specified by:
setValuein interfaceDataAdaptor- Parameters:
strAttr- attribute namearrVal- attribute value- Since:
- Mar 11, 2010
- See Also:
-
nodeCount
public int nodeCount()Get the number of child data nodes.- Returns:
- number of child node adaptors
-
childAdaptor
Convenience method to get a single child adaptor when only one is expected.- Specified by:
childAdaptorin interfaceDataAdaptor- Parameters:
strLabel- data label of child node- Returns:
- first child node with label strLabel, null if none exist
-
childAdaptors
Get all the child data nodes of this adaptor.- Specified by:
childAdaptorsin interfaceDataAdaptor- Returns:
- all child adaptors
-
childAdaptors
Get all the child data nodes of a particular data label.- Specified by:
childAdaptorsin interfaceDataAdaptor- Parameters:
strLabel- data label for child nodes- Returns:
- all child adaptors with specified label
-
childAdaptorIterator
Get an iterator containing all child adaptors of this node.- Returns:
- iterator of all child adaptors
-
childAdaptorIterator
Get an iterator for all child data nodes having a given data label.- Parameters:
strLabel- data label for child nodes- Returns:
- iterator of child adaptors with specified label
-
createChild
Create a new empty child adaptor with the specified label.- Specified by:
createChildin interfaceDataAdaptor- Parameters:
strLabel- data label for the child node- Returns:
- new child data node attached to this
-
removeChild
Description copied from interface:DataAdaptorRemove a child adaptor- Specified by:
removeChildin interfaceDataAdaptor
-
writeNode
Write out the listener data as a new node then append it as a child node in the data tree.- Specified by:
writeNodein interfaceDataAdaptor- Parameters:
ifcSrc-
-
writeNodes
write the collection of listeners to new nodes and append them to the data tree.- Specified by:
writeNodesin interfaceDataAdaptor- Parameters:
colSrcs- collection data sources exposingDataListenerinterface
-
print
Print out the contents of this adaptor.- Parameters:
os- output stream- Since:
- Mar 12, 2010
-