Class InMemoryDataAdaptor

java.lang.Object
xal.tools.data.InMemoryDataAdaptor
All Implemented Interfaces:
DataAdaptor

public class InMemoryDataAdaptor extends Object implements DataAdaptor
InMemoryDataAdaptor
  • Constructor Details

    • InMemoryDataAdaptor

      public InMemoryDataAdaptor(String name)
      Constructor
  • Method Details

    • name

      public String name()
      name for the particular node in the data tree
      Specified by:
      name in interface DataAdaptor
    • hasAttribute

      public boolean hasAttribute(String attribute)
      returns true if the node has the specified attribute
      Specified by:
      hasAttribute in interface DataAdaptor
    • stringValue

      public String stringValue(String attribute)
      string value associated with the specified attribute
      Specified by:
      stringValue in interface DataAdaptor
    • doubleValue

      public double doubleValue(String attribute)
      double value associated with the specified attribute
      Specified by:
      doubleValue in interface DataAdaptor
    • longValue

      public long longValue(String attribute)
      long value associated with the specified attribute
      Specified by:
      longValue in interface DataAdaptor
    • intValue

      public int intValue(String attribute)
      integer value associated with the specified attribute
      Specified by:
      intValue in interface DataAdaptor
    • booleanValue

      public boolean booleanValue(String attribute)
      boolean value associated with the specified attribute
      Specified by:
      booleanValue in interface DataAdaptor
    • doubleArray

      public double[] doubleArray(String attribute)
      Description copied from interface: DataAdaptor
      Returns the value of an attribute as an array of doubles.
      Specified by:
      doubleArray in interface DataAdaptor
      Parameters:
      attribute - the attribute name
      Returns:
      Array of double values, a null value is returned if the value string is empty.
    • setValue

      public void setValue(String attribute, String value)
      set the value of the specified attribute to the specified value
      Specified by:
      setValue in interface DataAdaptor
    • setValue

      public void setValue(String attribute, double value)
      set the value of the specified attribute to the specified value
      Specified by:
      setValue in interface DataAdaptor
    • setValue

      public void setValue(String attribute, long value)
      set the value of the specified attribute to the specified value
      Specified by:
      setValue in interface DataAdaptor
    • setValue

      public void setValue(String attribute, int value)
      set the value of the specified attribute to the specified value
      Specified by:
      setValue in interface DataAdaptor
    • setValue

      public void setValue(String attribute, boolean value)
      set the value of the specified attribute to the specified value
      Specified by:
      setValue in interface DataAdaptor
    • setValue

      public void setValue(String attribute, Object value)
      set the value of the specified attribute to the specified value
      Specified by:
      setValue in interface DataAdaptor
    • setValue

      public void setValue(String attribute, double[] value)
      Stores the value of the given double[] object in the data adaptor backing store.
      Specified by:
      setValue in interface DataAdaptor
      Parameters:
      attribute - attribute name
      value - attribute value
    • attributes

      public String[] attributes()
      return the array of all attributes
      Specified by:
      attributes in interface DataAdaptor
    • nodeCount

      public int nodeCount()
      return the number of child node adaptors
    • childAdaptors

      public List<DataAdaptor> childAdaptors()
      return all child adaptors
      Specified by:
      childAdaptors in interface DataAdaptor
    • childAdaptors

      public List<DataAdaptor> childAdaptors(String label)
      return all child adaptors of the specified node name
      Specified by:
      childAdaptors in interface DataAdaptor
    • childAdaptorIterator

      public Iterator<DataAdaptor> childAdaptorIterator()
      return an iterator of all child adaptors
    • childAdaptorIterator

      public Iterator<DataAdaptor> childAdaptorIterator(String label)
      return an iterator of all child adaptors of the specified name
    • childAdaptor

      public DataAdaptor childAdaptor(String label)
      Convenience method to get a single child adaptor when only one is expected
      Specified by:
      childAdaptor in interface DataAdaptor
    • createChild

      public DataAdaptor createChild(String label)
      Create an new empty child adaptor with label
      Specified by:
      createChild in interface DataAdaptor
    • removeChild

      public void removeChild(DataAdaptor adaptor)
      Description copied from interface: DataAdaptor
      Remove a child adaptor
      Specified by:
      removeChild in interface DataAdaptor
    • writeNode

      public void writeNode(DataListener listener)
      write the listener as a new node and append it to the data tree
      Specified by:
      writeNode in interface DataAdaptor
    • writeNodes

      public void writeNodes(Collection<? extends DataListener> nodes)
      Write the collection of listeners to new nodes and append them to the data tree.
      Specified by:
      writeNodes in interface DataAdaptor
      Parameters:
      nodes - the nodes to write