com.partnersoft.data.cog
Class Cog

java.lang.Object
  extended by com.partnersoft.data.cog.Cog
Direct Known Subclasses:
CogList, CogNaming, CogStructure, CogWrapper

public abstract class Cog
extends java.lang.Object

Cog stands for Configurable Object Graph. It's a configurable, flexible data structure with standard methods for reading, writing, querying, and transforming its data.


Constructor Summary
Cog()
           
 
Method Summary
 void convertAndSet(java.lang.String path, java.lang.Object value)
           
 Cog deepCopy()
           
protected abstract  Cog deepCopyImp()
          Subclasses must implement this to provide a deep copy.
 boolean getBoolean(java.lang.String path)
           
protected abstract  int getChildCountImp()
          Subclasses must implement this to return the number of children nodes.
protected abstract  java.lang.String[] getChildNamesImp()
          Subclasses must implement this to provide a list of valid children names or indexes.
protected abstract  java.lang.Object getChildNodeImp(java.lang.String childName)
          Subclasses must implement this to return the Cog node or primitive leaf node with the given name or index.
 Cog getCog(java.lang.String path)
           
 java.lang.String getDatatypeName()
          Name of structure datatype - used to fetch metadata; available fields, etc.
 double getDouble(java.lang.String path)
           
 float getFloat(java.lang.String path)
           
 java.lang.String getID()
           
 int getInt(java.lang.String path)
           
 java.util.ArrayList getList(java.lang.String path)
           
 long getLong(java.lang.String path)
           
 Naming getNaming(java.lang.String path)
           
 java.lang.Object getObject(java.lang.String path)
          This provides either the Cog node or the primitive leaf node with the given path.
 short getShort(java.lang.String path)
           
 java.lang.String getString(java.lang.String path)
           
 java.lang.String getStringButNullBlanks(java.lang.String path)
          Same as getString(), but if result is empty returns a null instead.
 Naming getValues()
           
 void move(java.lang.String oldPath, java.lang.String newPath)
           
 java.lang.Object remove(java.lang.String path)
          This removes the Cog node or primitive leaf node at the given path and returns the current value.
protected abstract  java.lang.Object removeChildNodeImp(java.lang.String childName)
           
 void setBoolean(java.lang.String path, boolean newValue)
           
protected abstract  void setChildNodeImp(java.lang.String childName, java.lang.Object newValue)
           
 void setCog(java.lang.String path, java.lang.Object newValue)
           
 void setDatatypeName(java.lang.String argDatatypeName)
           
 void setDouble(java.lang.String path, double newValue)
           
 void setFloat(java.lang.String path, float newValue)
           
 void setID(java.lang.String argID)
           
 void setInt(java.lang.String path, int newValue)
           
 void setList(java.lang.String path, java.util.Collection newValue)
           
 void setLong(java.lang.String path, long newValue)
           
 void setNaming(java.lang.String path, Naming newValue)
           
 void setObject(java.lang.String path, java.lang.Object newValue)
          This sets the Cog node or primitive leaf node at the given path to the given object.
 void setShort(java.lang.String path, short newValue)
           
 void setString(java.lang.String path, java.lang.String newValue)
           
 void setValues(java.util.Map values)
           
 Cog shallowCopy()
           
protected abstract  Cog shallowCopyImp()
          Subclasses must implement this to provide a shallow copy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cog

public Cog()
Method Detail

getObject

public java.lang.Object getObject(java.lang.String path)
This provides either the Cog node or the primitive leaf node with the given path. A path is a slash-separated list of names, much like a directory path or web URL.


setObject

public void setObject(java.lang.String path,
                      java.lang.Object newValue)
This sets the Cog node or primitive leaf node at the given path to the given object.


convertAndSet

public void convertAndSet(java.lang.String path,
                          java.lang.Object value)

shallowCopy

public Cog shallowCopy()

deepCopy

public Cog deepCopy()

remove

public java.lang.Object remove(java.lang.String path)
This removes the Cog node or primitive leaf node at the given path and returns the current value.


move

public void move(java.lang.String oldPath,
                 java.lang.String newPath)

getBoolean

public boolean getBoolean(java.lang.String path)

setBoolean

public void setBoolean(java.lang.String path,
                       boolean newValue)

getString

public java.lang.String getString(java.lang.String path)

getStringButNullBlanks

public java.lang.String getStringButNullBlanks(java.lang.String path)
Same as getString(), but if result is empty returns a null instead.


setString

public void setString(java.lang.String path,
                      java.lang.String newValue)

getInt

public int getInt(java.lang.String path)

setInt

public void setInt(java.lang.String path,
                   int newValue)

getShort

public short getShort(java.lang.String path)

setShort

public void setShort(java.lang.String path,
                     short newValue)

getLong

public long getLong(java.lang.String path)

setLong

public void setLong(java.lang.String path,
                    long newValue)

getFloat

public float getFloat(java.lang.String path)

setFloat

public void setFloat(java.lang.String path,
                     float newValue)

getDouble

public double getDouble(java.lang.String path)

setDouble

public void setDouble(java.lang.String path,
                      double newValue)

getNaming

public Naming getNaming(java.lang.String path)

setNaming

public void setNaming(java.lang.String path,
                      Naming newValue)

getList

public java.util.ArrayList getList(java.lang.String path)

setList

public void setList(java.lang.String path,
                    java.util.Collection newValue)

setValues

public void setValues(java.util.Map values)

getValues

public Naming getValues()

getCog

public Cog getCog(java.lang.String path)

setCog

public void setCog(java.lang.String path,
                   java.lang.Object newValue)

getDatatypeName

public java.lang.String getDatatypeName()
Name of structure datatype - used to fetch metadata; available fields, etc.


setDatatypeName

public void setDatatypeName(java.lang.String argDatatypeName)

getID

public java.lang.String getID()

setID

public void setID(java.lang.String argID)

getChildNodeImp

protected abstract java.lang.Object getChildNodeImp(java.lang.String childName)
Subclasses must implement this to return the Cog node or primitive leaf node with the given name or index. For structures, this is the value of the named field. For sets of named values, this is the value named. For lists, this is the entry with the given number. Etc.


setChildNodeImp

protected abstract void setChildNodeImp(java.lang.String childName,
                                        java.lang.Object newValue)

removeChildNodeImp

protected abstract java.lang.Object removeChildNodeImp(java.lang.String childName)

getChildCountImp

protected abstract int getChildCountImp()
Subclasses must implement this to return the number of children nodes.


getChildNamesImp

protected abstract java.lang.String[] getChildNamesImp()
Subclasses must implement this to provide a list of valid children names or indexes.


shallowCopyImp

protected abstract Cog shallowCopyImp()
Subclasses must implement this to provide a shallow copy.


deepCopyImp

protected abstract Cog deepCopyImp()
Subclasses must implement this to provide a deep copy.