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
FieldsModifier and TypeFieldDescriptionprotected intResult code for last action.protected DataBushHandlerInternal DataBush handler.static final intIndex of element's name in array of constructor's parameters.static final intIndex of element's virtual flag in array of constructor's parameters. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs 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 DBElementDescriptorReturns the descriptor object for this element.abstract intelType()Returns the code of element's type.booleanTest if some other object is equal to reference objectobjintReturns 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.booleanReturns virtual switch that prevents element to be updated.inthashCode()This method return hash code of name of this element.booleanReturnstrueif this element is currently initialized in DataBush,falseif this element is not in DataBush.booleanReturns virtual switch that prevents element to be updated.voidsetVirtual(boolean value) Sets virtual switch to element.voidSets parameters values of this element to those in parameter array.protected voidthrowISE.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- aStringname of element
-
AbstractDataBushElement
Constructs DataBush element with specified name and virtual flag.- Parameters:
name- aStringname 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:
clonein interfaceISimpleElement- Overrides:
clonein classObject- Returns:
- a
Objectthe clone of this element.
-
descriptor
Returns the descriptor object for this element.DBElementDescriptorhelps 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:
getNamein interfaceISimpleElement- Returns:
- a
Stringthe 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()Returnstrueif this element is currently initialized in DataBush,falseif this element is not in DataBush.- Returns:
trueif 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 notnullobject in array.- Parameters:
par- an array ofObjectobjects- 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:
toStringin interfaceISimpleElement- Overrides:
toStringin classObject
-