Class AbstractDataBushElement
java.lang.Object
org.scictrl.mp.orbitcorrect.model.optics.AbstractDataBushElement
- All Implemented Interfaces:
Cloneable
,ISimpleElement
- Direct Known Subclasses:
AbstractOpticalElement
,DataBushInfo
,PowerSupply
,RFGenerator
Basic abstract element for all DataBush elements.
AbstractDataBushElement
has number
of properties common to all DataBush elements. Some of them are stored in DataBush input
file and are necessary to initialize elements:
name
- is required by ISimpleElement interface. Has to be unique for each element in DataBush.virtual
- flag specifyes basic behaviour of element, can it read and send values to other elements.
- Author:
- igor@scictrl.com
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
Result code for last action.protected DataBushHandler
Internal DataBush handler.static final int
Index of element's name in array of constructor's parameters.static final int
Index of element's virtual flag in array of constructor's parameters. -
Constructor Summary
ConstructorDescriptionConstructs DataBush element with specified name and default parameter's values.AbstractDataBushElement
(String name, boolean virtual) Constructs DataBush element with specified name and virtual flag. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns the clone of this element.abstract DBElementDescriptor
Returns the descriptor object for this element.abstract int
elType()
Returns the code of element's type.boolean
Test if some other object is equal to reference objectobj
int
Returns the result produced by last update, apply, connect or disconnect action.getName()
Returns the unique name of this element.getOwner()
Returns the DataBush instance, in wich is element initialized.boolean
Returns virtual switch that prevents element to be updated.int
hashCode()
This method return hash code of name of this element.boolean
Returnstrue
if this element is currently initialized in DataBush,false
if this element is not in DataBush.boolean
Returns virtual switch that prevents element to be updated.void
setVirtual
(boolean value) Sets virtual switch to element.void
Sets parameters values of this element to those in parameter array.protected void
throwISE.toString()
Returns the string representation of this element.
-
Field Details
-
PR_ELEMENT_NAME
public static final int PR_ELEMENT_NAMEIndex of element's name in array of constructor's parameters. Use with DBElementDescriptor as help for working with elements dynamically.- See Also:
-
PR_VIRTUAL
public static final int PR_VIRTUALIndex of element's virtual flag in array of constructor's parameters. Use with DBElementDescriptor as help for working with elements dynamically.- See Also:
-
owner
Internal DataBush handler. -
lastActionResult
protected int lastActionResultResult code for last action.
-
-
Constructor Details
-
AbstractDataBushElement
Constructs DataBush element with specified name and default parameter's values.- Parameters:
name
- aString
name of element
-
AbstractDataBushElement
Constructs DataBush element with specified name and virtual flag.- Parameters:
name
- aString
name of elementvirtual
- a boolean virtual flag
-
-
Method Details
-
clone
Returns the clone of this element. Returns not initialized clone of this element. All data is copied to the clone.- Specified by:
clone
in interfaceISimpleElement
- Overrides:
clone
in classObject
- Returns:
- a
Object
the clone of this element.
-
descriptor
Returns the descriptor object for this element.DBElementDescriptor
helps manipulating DataBush elements dynamically.- Returns:
- the descriptor object for this element.
- See Also:
-
elType
public abstract int elType()Returns the code of element's type.- Returns:
- the code of element's type.
- See Also:
-
equals
Test if some other object is equal to reference objectobj
-
getLastActionResult
public int getLastActionResult()Returns the result produced by last update, apply, connect or disconnect action.- Returns:
- the result produced by last update, apply, connect or disconnect action.
-
getName
Returns the unique name of this element. Each element used in DataBush must have unique name. Two element instances with same name are threated as same instance. Returns the name of this element.- Specified by:
getName
in interfaceISimpleElement
- Returns:
- a
String
the unique name of this element.
-
getOwner
Returns the DataBush instance, in wich is element initialized. Null if element is not in DataBush.- Returns:
- the DataBush instance, in wich is element initialized.
-
getVirtual
public boolean getVirtual()Returns virtual switch that prevents element to be updated.- Returns:
- virtual switch
- See Also:
-
hashCode
public int hashCode()This method return hash code of name of this element. -
isInitialized
public boolean isInitialized()Returnstrue
if this element is currently initialized in DataBush,false
if this element is not in DataBush.- Returns:
true
if this element is currently initialized in DataBush.
-
isVirtual
public boolean isVirtual()Returns virtual switch that prevents element to be updated.- Returns:
- virtual switch
- See Also:
-
setVirtual
Sets virtual switch to element. NOTE! Since virtual element can not be updated, this method must be synchronized with update metod.- Parameters:
value
- new virtual value- Throws:
IllegalStateException
- if any.
-
setWith
Sets parameters values of this element to those in parameter array. As parameter must be used such array as for dynamical construction of new instance of this class. Current values are overriden for each notnull
object in array.- Parameters:
par
- an array ofObject
objects- Throws:
IllegalStateException
- if element is initialized and inside DataBush.
-
throwISE
throwISE.
- Parameters:
s
- java.lang.String- Throws:
IllegalStateException
- if any.
-
toString
Returns the string representation of this element. Returns string describing this element. String is formated in input-file code.- Specified by:
toString
in interfaceISimpleElement
- Overrides:
toString
in classObject
-