public class DefaultType extends TrianaType
NOT_CONNECTED, NOT_READY, OUT_OF_RANGE
Constructor and Description |
---|
DefaultType() |
Modifier and Type | Method and Description |
---|---|
protected void |
copyData(TrianaType source)
Copies data held in dataContainer from the argument object to the current object.
|
TrianaType |
copyMe()
This is one of the most important methods of Triana data.
|
containerSize, copyParameters, dataExists, deleteFromContainer, getDataContainer, getFromContainer, getSequenceNumber, insertIntoContainer, inspectDataContainer, setDataContainer, setSequenceNumber, updateObsoletePointers
public TrianaType copyMe()
TrianaType
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
protected void copyData(TrianaType source)
TrianaType
This method must be overridden if subclasses add more data to dataContainer, and the overriding method should invoke its super method. This method is called by copyMe().
copyData
in class TrianaType
source
- Object that contains the data to be copied.