EASE.Sensing.Specification
Class Cell

java.lang.Object
  |
  +--EASE.Sensing.Specification.Cell
Direct Known Subclasses:
Conditional, Constant, ExportCell, FactorySuggestion, IfStatement, InputData, InputObjectField, Parameter, UnaryExpression

public abstract class Cell
extends java.lang.Object
implements java.io.Serializable, CellChangeListener

Abstract class for cell types

It is not intended that this is changed after it is created hence there are no set methods. Instead the old version should be passed to the constructor of a new object.

All subClasses are able to store subCells here. The order of the subcells is important so the order is remained but this class knows nothing of what the order means.

See Also:
Serialized Form

Field Summary
protected  java.lang.String comment
           
protected  java.util.Date creationDate
           
protected static Debugger debugger
           
private  java.lang.String defaultFileName
           
protected  java.lang.String fileName
           
protected  java.util.Vector instantiatedParams
           
private  java.util.Vector listeners
           
protected  java.lang.String name
           
 Cell previousVersion
           
(package private) static long serialVersionUID
           
private  java.util.Vector subCells
           
private  Cell subsequentVersion
           
 java.lang.String[] treePath
           
 
Constructor Summary
Cell(java.lang.String name, java.lang.String comment)
           
Cell(java.lang.String name, java.lang.String comment, Cell versionOf)
          Constructor for subsequent versions
Cell(java.lang.String name, java.lang.String comment, Cell versionOf, java.util.Vector instantiatedParams)
          Constructor with instantiated parameters
 
Method Summary
 void addChangeListener(CellChangeListener listener)
           
protected  void addSub(Cell c)
          Add a subcell to end of subcell vector
 javax.swing.tree.DefaultMutableTreeNode createChildDisplayTreeBranch()
          Create a tree node of the subcells of this cell for debugging.
 javax.swing.tree.DefaultMutableTreeNode createParentDisplayTreeBranch()
          Create a tree node of the listeners of this cell for debugging.
 java.lang.String getComment()
           
 Node getEngineNode()
           
 java.lang.String getFactory()
          Gets the factory this cell or its subcells are associated with, if any.
 java.lang.String getFileName()
           
 java.lang.String getFullName()
           
 java.lang.String getHistory()
           
 java.util.Vector getInstantiatedParams()
           
 java.lang.String getListenerNames()
           
 InputListData getListType()
          Gets a the list type parameter if there is one. Assumes there can only be one at most.
 java.lang.String getName()
           
 java.util.Vector getParameters()
           
 Cell getPrevious()
           
protected  Cell getSub(int i)
          Get the subcell at index i
protected  java.util.Vector getSubs()
          Get the vector of all subCells
 Cell getSuccessor()
           
 javax.swing.tree.TreePath getTreePath()
           
abstract  int getType()
           
 boolean hasListeners()
           
 boolean hasParameters()
           
protected  Node instantiateParamsForEngine(Node n)
           
static Node instantiateParamsForEngine(Node n, java.util.Vector instantiatedParams)
           
 boolean justCreated()
          Returns true if cell was just created and has not yet been put in a file.
private static InstantiatedParameter matchParam(Parameter p, java.util.Vector instantiatedParams)
           
 void notifyAllListeners()
           
 void notifyChange(Cell source)
           
 void removeChangeListener(CellChangeListener listener)
           
protected  void removeInstantiated(java.util.Vector params)
          If there is an instantiated parameter in instantiated that matches a parameter in params the parameter is removed from params.
 void saveValidateSubs(SpecExport spec)
          This is responsible for checking all subcells, if they are set to be in a different file then a CellReference should be used.
private  void saveValidateVector(java.util.Vector v, SpecExport spec)
           
 void setFileName(java.lang.String fileName)
           
 void setInstantiatedParams(java.util.Vector p)
          This seems to get called and the first if statement entered at the wrong time.
protected  void setSubs(java.util.Vector cs)
          Set the vector cs to be the subcells of this cell
 void setSuccessor(Cell successor)
           
 void setTreePath(java.lang.String[] path)
           
 java.lang.String shortFileName()
           
 java.lang.String toString()
           
 void validateSubs(CellStore store)
          Engine version of validation code
private  void validateVector(java.util.Vector v, CellStore store)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

subCells

private java.util.Vector subCells

listeners

private transient java.util.Vector listeners

instantiatedParams

protected java.util.Vector instantiatedParams

treePath

public java.lang.String[] treePath

previousVersion

public Cell previousVersion

subsequentVersion

private Cell subsequentVersion

creationDate

protected java.util.Date creationDate

debugger

protected static Debugger debugger

defaultFileName

private final java.lang.String defaultFileName

name

protected java.lang.String name

comment

protected java.lang.String comment

fileName

protected java.lang.String fileName

serialVersionUID

static final long serialVersionUID
Constructor Detail

Cell

public Cell(java.lang.String name,
            java.lang.String comment)

Cell

public Cell(java.lang.String name,
            java.lang.String comment,
            Cell versionOf)
Constructor for subsequent versions

Cell

public Cell(java.lang.String name,
            java.lang.String comment,
            Cell versionOf,
            java.util.Vector instantiatedParams)
Constructor with instantiated parameters
Method Detail

hasParameters

public boolean hasParameters()

getParameters

public java.util.Vector getParameters()

setInstantiatedParams

public void setInstantiatedParams(java.util.Vector p)
This seems to get called and the first if statement entered at the wrong time. Hence the extra check for ip.getValue() returning null. I'm not sure why this happens and it may point to a bug elsewhere. Perhaps it simply gets called twice for some reason?

getInstantiatedParams

public java.util.Vector getInstantiatedParams()

removeInstantiated

protected void removeInstantiated(java.util.Vector params)
If there is an instantiated parameter in instantiated that matches a parameter in params the parameter is removed from params.


getListType

public InputListData getListType()
Gets a the list type parameter if there is one.

Assumes there can only be one at most.

All subclasses except for InputListData should return null.


getFactory

public java.lang.String getFactory()
Gets the factory this cell or its subcells are associated with, if any.

All subclasses except FactorySuggestion should return null.

More than one factory will cause a problem . .


getSub

protected Cell getSub(int i)
Get the subcell at index i

getSubs

protected java.util.Vector getSubs()
Get the vector of all subCells

addSub

protected void addSub(Cell c)
Add a subcell to end of subcell vector

setSubs

protected void setSubs(java.util.Vector cs)
Set the vector cs to be the subcells of this cell

createChildDisplayTreeBranch

public javax.swing.tree.DefaultMutableTreeNode createChildDisplayTreeBranch()
Create a tree node of the subcells of this cell for debugging.

Recursively call in children


createParentDisplayTreeBranch

public javax.swing.tree.DefaultMutableTreeNode createParentDisplayTreeBranch()
Create a tree node of the listeners of this cell for debugging.

Recursively call in listeners


saveValidateSubs

public void saveValidateSubs(SpecExport spec)
This is responsible for checking all subcells, if they are set to be in a different file then a CellReference should be used.
It is called when the cell is to be saved.


saveValidateVector

private void saveValidateVector(java.util.Vector v,
                                SpecExport spec)

validateSubs

public void validateSubs(CellStore store)
Engine version of validation code

validateVector

private void validateVector(java.util.Vector v,
                            CellStore store)

getName

public java.lang.String getName()
Specified by:
getName in interface CellChangeListener

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

shortFileName

public java.lang.String shortFileName()

getFullName

public java.lang.String getFullName()

getFileName

public java.lang.String getFileName()

setFileName

public void setFileName(java.lang.String fileName)

justCreated

public boolean justCreated()
Returns true if cell was just created and has not yet been put in a file.


getComment

public java.lang.String getComment()

getHistory

public java.lang.String getHistory()

hasListeners

public boolean hasListeners()

getListenerNames

public java.lang.String getListenerNames()

addChangeListener

public void addChangeListener(CellChangeListener listener)

removeChangeListener

public void removeChangeListener(CellChangeListener listener)

notifyChange

public void notifyChange(Cell source)
Specified by:
notifyChange in interface CellChangeListener

notifyAllListeners

public void notifyAllListeners()

getEngineNode

public Node getEngineNode()

instantiateParamsForEngine

protected Node instantiateParamsForEngine(Node n)

instantiateParamsForEngine

public static Node instantiateParamsForEngine(Node n,
                                              java.util.Vector instantiatedParams)

matchParam

private static InstantiatedParameter matchParam(Parameter p,
                                                java.util.Vector instantiatedParams)

getTreePath

public javax.swing.tree.TreePath getTreePath()

setTreePath

public void setTreePath(java.lang.String[] path)

getType

public abstract int getType()

getPrevious

public Cell getPrevious()

setSuccessor

public void setSuccessor(Cell successor)

getSuccessor

public Cell getSuccessor()