public class Parameter extends TrianaType
To extend this type to represent new kinds of parameters, the programmer simply needs to convert between the parameter type and a String and to provide relevant methods for doing this.
Parameter inherits directly from TrianaType. Do not confuse the Class Parameter with the term "parameter" used in TrianaType data types or in Triana units. In data types the term refers to data associated with types that is not stored in the dataContainer Hashtable. In Units the term refers to data controlling the operation of the OldUnit that the user can set using the user interface (parameter window) of the OldUnit. The Class is used to transfer OldUnit parameters (not data-type parameters) from one OldUnit to another.
TrianaType
,
Serialized FormNOT_CONNECTED, NOT_READY, OUT_OF_RANGE
Constructor and Description |
---|
Parameter()
Creates a null Parameter.
|
Parameter(boolean param)
Creates a new Parameter for a boolean.
|
Parameter(char param)
Creates a new Parameter for a char.
|
Parameter(double param)
Creates a new Parameter for a double.
|
Parameter(float param)
Creates a new Parameter for a float.
|
Parameter(int param)
Creates a new Parameter for an int.
|
Parameter(java.lang.Object param)
Creates a new Parameter with the contents set to the specified String.
|
Parameter(short param)
Creates a new Parameter for a short.
|
Modifier and Type | Method and Description |
---|---|
void |
copyData(TrianaType source)
Copies the Parameter by value from the given source, not by reference.
|
TrianaType |
copyMe()
This is one of the most important methods of Triana data.
|
void |
copyParameters(TrianaType source)
Copies modifiable parameters from the given source.
|
boolean |
equals(java.lang.Object parameter)
Returns true if the given Object is of Parameter type and has the same contents as this object.
|
java.lang.Object |
getParameter()
Returns a reference to the contents of this Parameter.
|
protected void |
setParameter(java.lang.Object newParam)
Sets the given Object to be the contents of the parameter object.
|
java.lang.String |
toString() |
containerSize, dataExists, deleteFromContainer, getDataContainer, getFromContainer, getSequenceNumber, insertIntoContainer, inspectDataContainer, setDataContainer, setSequenceNumber, updateObsoletePointers
public Parameter()
public Parameter(java.lang.Object param)
param
- the String containing the contents of the Parameter.public Parameter(short param)
param
- the valuepublic Parameter(int param)
param
- the valuepublic Parameter(float param)
param
- the valuepublic Parameter(double param)
param
- the valuepublic Parameter(char param)
param
- the valuepublic Parameter(boolean param)
param
- the valuepublic java.lang.Object getParameter()
protected void setParameter(java.lang.Object newParam)
newParam
- The new contentspublic boolean equals(java.lang.Object parameter)
equals
in class java.lang.Object
parameter
- The object being compared to this onepublic TrianaType copyMe()
To override, the programmer should not invoke the super.copyMe method. Instead, create an object of the current type and call methods copyData and copyParameters. If these have been written correctly, then they will do the copying. The code should createTool, for type YourType:
YourType y = null; try { y = (YourType)getClass().newInstance(); y.copyData( this ); y.copyParameters( this ); y.setLegend( this.getLegend() ); } catch (IllegalAccessException ee) { System.out.println("Illegal Access: " + ee.getMessage()); } catch (InstantiationException ee) { System.out.println("Couldn't be instantiated: " + ee.getMessage()); } return y;
The copied object's data should be identical to the original. The method here modifies only one item: a String indicating that the object was created as a copy is added to the description StringVector.
copyMe
in class TrianaType
public void copyData(TrianaType source)
copyData
in class TrianaType
source
- The Parameter object being copiedpublic void copyParameters(TrianaType source)
copyParameters
in class TrianaType
source
- The Parameter object being copiedpublic java.lang.String toString()
toString
in class java.lang.Object