gov.sns.xal.model.elem
Class Element

java.lang.Object
  |
  +--gov.sns.xal.model.elem.Element
All Implemented Interfaces:
IComponent, IElement
Direct Known Subclasses:
ThickElement, ThinElement

public abstract class Element
extends java.lang.Object
implements IElement

Convenience abstract base class for constructing XAL modeling elements. This class implements many of the general methods for the IElement interface that are not element specific.


Field Summary
 
Fields inherited from interface gov.sns.xal.model.IElement
LightSpeed, Permeability, Permittivity, UnitCharge
 
Constructor Summary
Element(java.lang.String strType)
          Creates a new instance of Element
Element(java.lang.String strType, java.lang.String strId)
          Creates a new instance of Element
 
Method Summary
 double compDriftingTime(IProbe probe, double dblLen)
          Compute the time the probe probe spends drifting a a distance dblLen.
abstract  double elapsedTime(IProbe probe, double dblLen)
          Returns the time taken for the probe probe to propagate through a subsection of the element with length dblLen.
abstract  double energyGain(IProbe probe, double dblLen)
          Returns energy gain for subsection of this element of length dblLen for the specified given probe.
 java.lang.String getId()
          Returns the string identifier for this element.
abstract  double getLength()
          Return the length of this element.
 java.lang.String getType()
          Return the element type identifier
 int getUID()
          Return the internal class unique identifier of this element.
 void initializeFrom(IModelDataSource source)
          Initialize this Element from the supplied object.
 void print(java.io.PrintWriter os)
          Dump current state and content to output stream.
 void propagate(IProbe probe)
          Propagates the Probe object through this element based on the associated algorithm.
 void setId(java.lang.String strId)
          Set the string identifier for the element.
abstract  PhaseMap transferMap(IProbe probe, double dblLen)
          Compute the tranfer matrix for subsection of this element of length dblLen for the specified given probe.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Element

public Element(java.lang.String strType)
Creates a new instance of Element

Parameters:
strType - type identifier of the element

Element

public Element(java.lang.String strType,
               java.lang.String strId)
Creates a new instance of Element

Parameters:
strType - type identifier of the element
strId - string identifier of the element
Method Detail

getLength

public abstract double getLength()
Return the length of this element. Derived class must implement this because it is undetermine whether or not this is a thin or thick element.

Specified by:
getLength in interface IComponent
Returns:
length of the element (in meters)

elapsedTime

public abstract double elapsedTime(IProbe probe,
                                   double dblLen)
Returns the time taken for the probe probe to propagate through a subsection of the element with length dblLen.

Specified by:
elapsedTime in interface IElement
Parameters:
probe - determine energy gain for this probe
dblLen - length of subsection to calculate energy gain for
Returns:
the elapsed time through sectionUnits: seconds

energyGain

public abstract double energyGain(IProbe probe,
                                  double dblLen)
Returns energy gain for subsection of this element of length dblLen for the specified given probe.

Specified by:
energyGain in interface IElement
Parameters:
probe - determine energy gain for this probe
dblLen - length of subsection to calculate energy gain
Returns:
the energy gain provided by this element Units: eV

transferMap

public abstract PhaseMap transferMap(IProbe probe,
                                     double dblLen)
                              throws ModelException
Compute the tranfer matrix for subsection of this element of length dblLen for the specified given probe. That is, this method should return the incremental transfer matrix.

Specified by:
transferMap in interface IElement
Parameters:
dblLen - length of subelement
probe - probe containing parameters for the subsectional transfer matrix
Returns:
transfer map for an element of length dblLen
Throws:
ModelException - unable to compute transfer map
See Also:
#transferMap()

initializeFrom

public void initializeFrom(IModelDataSource source)
                    throws ModelException
Initialize this Element from the supplied object. Subclasses should override this method as appropriate, e.g., cast the source to some expected type and then retrieve values from it.

Specified by:
initializeFrom in interface IElement
Parameters:
source - object to initialize element from
Throws:
ModelException - if error initializing from source

setId

public void setId(java.lang.String strId)
Set the string identifier for the element.

Parameters:
strId - new string identifier for element

getUID

public int getUID()
Return the internal class unique identifier of this element.

Returns:
the unique identifier of this object

getType

public java.lang.String getType()
Return the element type identifier

Specified by:
getType in interface IComponent
Returns:
element type string

getId

public java.lang.String getId()
Returns the string identifier for this element.

Specified by:
getId in interface IComponent
Returns:
string identifier

propagate

public void propagate(IProbe probe)
               throws ModelException
Propagates the Probe object through this element based on the associated algorithm.

Specified by:
propagate in interface IComponent
Parameters:
probe - probe object to propagate
Throws:
ModelException - error occurred during propagation

compDriftingTime

public double compDriftingTime(IProbe probe,
                               double dblLen)
Compute the time the probe probe spends drifting a a distance dblLen.

Parameters:
probe - interface to drifting probe
dblLen - length of drift in meters
Returns:
time interval during drift in seconds

print

public void print(java.io.PrintWriter os)
Dump current state and content to output stream.

Parameters:
os - output stream object