Class AbstractDataBushElement

java.lang.Object
org.scictrl.mp.orbitcorrect.model.optics.AbstractDataBushElement
All Implemented Interfaces:
Cloneable, ISimpleElement
Direct Known Subclasses:
AbstractOpticalElement, DataBushInfo, PowerSupply, RFGenerator

public abstract class AbstractDataBushElement extends Object implements ISimpleElement, Cloneable
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

    Fields
    Modifier and Type
    Field
    Description
    protected 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

    Constructors
    Constructor
    Description
    Constructs 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 Type
    Method
    Description
    Returns the clone of this element.
    Returns the descriptor object for this element.
    abstract int
    Returns the code of element's type.
    boolean
    Test if some other object is equal to reference object obj
    int
    Returns the result produced by last update, apply, connect or disconnect action.
    Returns the unique name of this element.
    Returns the DataBush instance, in wich is element initialized.
    boolean
    Returns virtual switch that prevents element to be updated.
    int
    This method return hash code of name of this element.
    boolean
    Returns true 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
    setWith(Object[] par)
    Sets parameters values of this element to those in parameter array.
    protected void
    throwISE.
    Returns the string representation of this element.

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • PR_ELEMENT_NAME

      public static final int PR_ELEMENT_NAME
      Index 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_VIRTUAL
      Index of element's virtual flag in array of constructor's parameters. Use with DBElementDescriptor as help for working with elements dynamically.
      See Also:
    • owner

      protected DataBushHandler owner
      Internal DataBush handler.
    • lastActionResult

      protected int lastActionResult
      Result code for last action.
  • Constructor Details

    • AbstractDataBushElement

      public AbstractDataBushElement(String name)
      Constructs DataBush element with specified name and default parameter's values.
      Parameters:
      name - a String name of element
    • AbstractDataBushElement

      public AbstractDataBushElement(String name, boolean virtual)
      Constructs DataBush element with specified name and virtual flag.
      Parameters:
      name - a String name of element
      virtual - a boolean virtual flag
  • Method Details

    • clone

      public Object 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 interface ISimpleElement
      Overrides:
      clone in class Object
      Returns:
      a Object the clone of this element.
    • descriptor

      public abstract DBElementDescriptor 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

      public boolean equals(Object obj)
      Test if some other object is equal to reference object obj
      Overrides:
      equals in class Object
    • 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

      public String 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 interface ISimpleElement
      Returns:
      a String the unique name of this element.
    • getOwner

      public DataBush 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.
      Overrides:
      hashCode in class Object
      See Also:
    • isInitialized

      public boolean isInitialized()
      Returns true 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

      public void setVirtual(boolean value) throws IllegalStateException
      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

      public void setWith(Object[] par) throws IllegalStateException
      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 not null object in array.
      Parameters:
      par - an array of Object objects
      Throws:
      IllegalStateException - if element is initialized and inside DataBush.
    • throwISE

      protected void throwISE(String s) throws IllegalStateException

      throwISE.

      Parameters:
      s - java.lang.String
      Throws:
      IllegalStateException - if any.
    • toString

      public String toString()
      Returns the string representation of this element. Returns string describing this element. String is formated in input-file code.
      Specified by:
      toString in interface ISimpleElement
      Overrides:
      toString in class Object