uk.co.agena.minerva.model.extendedbn
Class ExtendedNodeFunction

java.lang.Object
  extended by uk.co.agena.minerva.model.extendedbn.ExtendedNodeFunction
All Implemented Interfaces:
java.lang.Cloneable, Writable

public class ExtendedNodeFunction
extends java.lang.Object
implements java.lang.Cloneable, Writable

This class encapsulates a function used to define (in full or in part) the NPT for an ExtendedNode. ExtendedNodeFunctions can be fully specified or not fully specified. Whether they are or are not may be of interest to applications that need to display what information a user is required to provide.


Field Summary
static int CURRENT_TYPE
          Constant indicating that a function is the current one for an ExtendedNode.
static int DEFAULT_TYPE
          Constant indicating that a function is a default one.
static char NEW_LINE_REPLACEMENT
          When saving the parameters of an expression it is not possible to save user entered new lines as these adversly affect subsequent loading of the expression.
 
Fields inherited from interface uk.co.agena.minerva.util.model.Writable
FIELD_SEPARATOR
 
Constructor Summary
ExtendedNodeFunction()
          Default constructor.
ExtendedNodeFunction(java.lang.String name, java.util.List parameters)
          Creates a new ExtendedNodeFunction with the supplied name and parameters.
ExtendedNodeFunction(java.lang.String name, java.util.List parameters, int type)
          Constructs an ExtendedNodeFunction with the supplied name, parameters and type.
 
Method Summary
 java.lang.Object clone()
          Makes a copy of this ExtendedNodeFunction.
 java.lang.String getName()
          Returns the name of this ExtendedNodeFunction.
 java.util.List getParameters()
          Returns the parameters for this ExtendedNodeFunction without any user entered Tabs or New Lines.
 java.util.List getParametersWithFormatting()
          Returns the parameters for this ExtendedNodeFunction with all user entered Tabs and New Lines.
 int getType()
          Returns the type of this ExtendedNodeFunction.
 double getVersion()
          Returns the version of the class.
 boolean isFullySpecified()
          Returns whether the ExtendedNodeFunction is fully specified.
 int read(java.util.List strings, int currentLineNumber)
           
 void setName(java.lang.String name)
           
 void setParameters(java.util.List parameters)
           
 void setType(int type)
          Sets the type of this ExtendedNodeFunction to the value specified.
 void setVersion(double version)
          Sets the version number of the class.
 java.lang.String toString()
          Returns a String representation of the ExtendedNodeFunction.
 void updateParameterStrings(java.lang.String oldFunctionName, java.lang.String newFunctionName)
          Updates the parameter strings with the new function name for the nodes involved.
 java.util.List write()
          Writes the object in question to a List of Strings.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_TYPE

public static final int DEFAULT_TYPE
Constant indicating that a function is a default one. If an ExtendedNode's current function is changed, it will always be possible to return the current function to a default one.

See Also:
Constant Field Values

CURRENT_TYPE

public static final int CURRENT_TYPE
Constant indicating that a function is the current one for an ExtendedNode.

See Also:
Constant Field Values

NEW_LINE_REPLACEMENT

public static final char NEW_LINE_REPLACEMENT
When saving the parameters of an expression it is not possible to save user entered new lines as these adversly affect subsequent loading of the expression. We therefore need to replace the new line chars with a char which will not affect the loading process and will also not figure in the parameter strings themselves, for this we use ascii char code '?' which represents '‡', this char is not normally allowed in an expression.

See Also:
Constant Field Values
Constructor Detail

ExtendedNodeFunction

public ExtendedNodeFunction()
Default constructor.


ExtendedNodeFunction

public ExtendedNodeFunction(java.lang.String name,
                            java.util.List parameters)
Creates a new ExtendedNodeFunction with the supplied name and parameters.

Parameters:
name -
parameters -

ExtendedNodeFunction

public ExtendedNodeFunction(java.lang.String name,
                            java.util.List parameters,
                            int type)
Constructs an ExtendedNodeFunction with the supplied name, parameters and type.

Parameters:
name - the name of the ExtendedNodeFunction
parameters - the parameters for the ExtendedNodeFunction
type - the type of the ExtendedNodeFunction (DEFAULT_TYPE or CURRENT_TYPE)
Method Detail

getName

public java.lang.String getName()
Returns the name of this ExtendedNodeFunction.

Returns:
the name of this ExtendedNodeFunction

setName

public void setName(java.lang.String name)

setParameters

public void setParameters(java.util.List parameters)

getVersion

public double getVersion()
Description copied from interface: Writable
Returns the version of the class. Used to ensure backward compatibility.

Specified by:
getVersion in interface Writable
Returns:
the version number

setVersion

public void setVersion(double version)
Description copied from interface: Writable
Sets the version number of the class. Used to ensure backward compatibility.

Specified by:
setVersion in interface Writable
Parameters:
version - the version number

getParameters

public java.util.List getParameters()
Returns the parameters for this ExtendedNodeFunction without any user entered Tabs or New Lines. NOTE: This returns a copy of the paramters List so any changes made to the contained Strings will not extend to the List of paramters stored for the ExtendedNodeFunction. If you want to make changes to the parameters you should use getParametersWithFormatting() instead.

Returns:
the parameters for this ExtendedNodeFunction without the user entered formatting.

getParametersWithFormatting

public java.util.List getParametersWithFormatting()
Returns the parameters for this ExtendedNodeFunction with all user entered Tabs and New Lines. NOTE: Returned List is a direct link to parameters List for this ExtendedNodeFunction.

Returns:
the parameters for this ExtendedNodeFunction with all the user entered formatting.

isFullySpecified

public boolean isFullySpecified()
Returns whether the ExtendedNodeFunction is fully specified.

Returns:
true if the ExtendedNodeFunction is fully specified, false otherwise

getType

public int getType()
Returns the type of this ExtendedNodeFunction.

Returns:
the type of this ExtendedNodeFunction (DEFAULT_TYPE or CURRENT_TYPE)

updateParameterStrings

public void updateParameterStrings(java.lang.String oldFunctionName,
                                   java.lang.String newFunctionName)
Updates the parameter strings with the new function name for the nodes involved.

Parameters:
oldFunctionName -
newFunctionName -

setType

public void setType(int type)
Sets the type of this ExtendedNodeFunction to the value specified.

Parameters:
type - the new type of this ExtendedNodeFunction (DEFAULT_TYPE or CURRENT_TYPE)

clone

public java.lang.Object clone()
Makes a copy of this ExtendedNodeFunction.

Overrides:
clone in class java.lang.Object
Returns:
a copy of this ExtendedNodeFunction

toString

public java.lang.String toString()
Returns a String representation of the ExtendedNodeFunction.

Overrides:
toString in class java.lang.Object

write

public java.util.List write()
                     throws MinervaReadWriteException
Description copied from interface: Writable
Writes the object in question to a List of Strings.

Specified by:
write in interface Writable
Returns:
the List to which the Strings have been written
Throws:
MinervaReadWriteException - if there

read

public int read(java.util.List strings,
                int currentLineNumber)
         throws MinervaReadWriteException
Specified by:
read in interface Writable
Throws:
MinervaReadWriteException


Copyright © 2006 Agena Ltd. All Rights Reserved.