mapss.dif
Class DIFParameter

java.lang.Object
  extended by mapss.dif.DIFParameter

public class DIFParameter
extends java.lang.Object

Parameter class for DIF graph. The value of a DIFParameter can be one of the following type: Integer, Double, Complex, String, Boolean, int[], double[], Complex[], int[][], double[][], Complex[][], ArrayList.

The DIF refinement block can set a sub-parameter by referring to the parameter in the current graph. In other words, the_value of a DIFParameter can refer to another DIFParameter in the super graph. This semantics are useful in parameterized graph.

A parameter can be specified by its interval range, ie, a parameter's value can be set as an IntervalCollection containing the lower and upper bound or discrete region of this parameter.

In conclusion, a DIFParameter contains a valid value or a valid DIFParameter in super graph or a valid IntervalCollection.

Version:
$Id: DIFParameter.java 362 2007-02-25 21:08:57Z plishker $
Author:
Chia-Jui Hsu
See Also:
DIFGraph

Constructor Summary
protected DIFParameter()
           
  DIFParameter(java.lang.String name)
          Constructs a new parameter with the given name.
 
Method Summary
protected  java.lang.Object _cloneValue(java.lang.Object map)
          Clone token value.
protected  void _setName(java.lang.String name)
          Graph.addGraph(mocgraph.Graph) will modified the name if naming conflict.
 java.lang.Object clone()
          Clone this DIFParameter and return the cloned DIFParameter with the same name, same value.
 java.lang.Object clone(java.lang.Object map)
          Return the cloned version of DIFParameter with the same name, same value, or cloned reference DIFParameter.
 boolean equals(java.lang.Object object)
          Compare the DIFParameter object with the input object.
 DIFGraph getContainer()
          Get DIFGraph which contains this parameter.
 java.lang.String getDataType()
          Get datatype of the value of parameter.
 java.lang.String getName()
          Get parameter name.
 DIFParameter getParameterDeeply()
          Get parameter deeply.
 java.lang.Object getValue()
          Get value.
 java.lang.Object getValueDeeply()
          Get value deeply.
 int hashCode()
          Hash code.
protected  void setContainer(DIFGraph container)
          DIFGraph.setParameter() will set the back reference.
 void setDataType(java.lang.String datatype)
          Set the datatype of the value of parameter.
 java.lang.Object setValue(java.lang.Object value)
          Set parameter value.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DIFParameter

protected DIFParameter()

DIFParameter

public DIFParameter(java.lang.String name)
Constructs a new parameter with the given name.

Parameters:
name - Name of the parameter.
Throws:
java.lang.IllegalArgumentException - If Conventions.labelConvention(java.lang.String) returns an error for the parameter name.
Method Detail

clone

public java.lang.Object clone()
Clone this DIFParameter and return the cloned DIFParameter with the same name, same value. For reference value referring to DIFParameter in the super graph, we cannot simply copy the referred DIFParameter. Thus, if _value contains a reference, its cloned version is null.

Overrides:
clone in class java.lang.Object
Returns:
Cloned DIFParameter instance.

clone

public java.lang.Object clone(java.lang.Object map)
Return the cloned version of DIFParameter with the same name, same value, or cloned reference DIFParameter. For referred DIFParameter, the cloned object is obtained by map that contains the mapping from the original reference value to the cloned reference value.

Parameters:
map - The Map that contains the mapping from the original reference value to the mirrored reference value.
Returns:
Cloned DIFAttribute instance.
See Also:
_cloneValue(Object)

equals

public boolean equals(java.lang.Object object)
Compare the DIFParameter object with the input object. This method compares their name, and value. To compare _value fields in both objects, we use their toString() methods to make the comparison.

Overrides:
equals in class java.lang.Object
Parameters:
object - The DIFParameter instance.
Returns:
True if equal, otherwise, false.

getContainer

public DIFGraph getContainer()
Get DIFGraph which contains this parameter. Note that DIFGraph.setParameter() will set the back reference.

Returns:
DIFGraph

getDataType

public java.lang.String getDataType()
Get datatype of the value of parameter.

Returns:
datatype

getName

public java.lang.String getName()
Get parameter name.

Returns:
name

getValue

public java.lang.Object getValue()
Get value. The return type can be one of the following: value, DIFParameter, or IntervalCollection.

Returns:
The value of this parameter.

getValueDeeply

public java.lang.Object getValueDeeply()
Get value deeply. If this DIFParameter contains another DIFParameter as value, this method will trace along the way until the value is not a DIFParameter.

Returns:
The deepest value of this parameter. If the deepest value is null, then return null.

getParameterDeeply

public DIFParameter getParameterDeeply()
Get parameter deeply. If this DIFParameter contains another DIFParameter as value, this method will trace along the way until the deepest DIFParameter.

Returns:
The deepest DIFParameter. If the value of this DIFParameter is not a DIFParameter, then return this.

hashCode

public int hashCode()
Hash code.

Overrides:
hashCode in class java.lang.Object

setDataType

public void setDataType(java.lang.String datatype)
Set the datatype of the value of parameter. E.g., int, float, int*, float*.

Parameters:
datatype -

setValue

public java.lang.Object setValue(java.lang.Object value)
Set parameter value.

Parameters:
value - A value object. The current DIF language supports are Integer, Double, Complex, String, Boolean, int[], double[], Complex[], int[][], double[][], Complex[][], ArrayList, other DIFParameter instance, or IntervalCollection.
Returns:
The previous value object.

toString

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

setContainer

protected void setContainer(DIFGraph container)
DIFGraph.setParameter() will set the back reference.


_cloneValue

protected java.lang.Object _cloneValue(java.lang.Object map)
Clone token value. If _value contains a reference to a DIFParameter object, it finds the cloned object by using map. Note that it will return null if map does not contain the mapping.

Parameters:
map - The HashMap object.
See Also:
clone(Object)

_setName

protected void _setName(java.lang.String name)
Graph.addGraph(mocgraph.Graph) will modified the name if naming conflict.

Parameters:
name -