gov.sns.xal.model.gen
Class SequenceGenerator

java.lang.Object
  |
  +--gov.sns.xal.model.gen.SequenceGenerator
All Implemented Interfaces:
IProxyVisitor

public class SequenceGenerator
extends java.lang.Object
implements IProxyVisitor

This class build model sequences (Sector objects) from the hardware representation given by AcceleratorSeq objects. Note that Sector objects may be nested within each other to arbitrary order. A proxy tree is built (@see gov.sns.xal.model.gen.ptree) which breaks the hardware into nested sequences hardware components and subcomponents that have model representations. The SequenceGenerator class implements the IProxyVisitor interface, which means it is a visitor class of the proxy tree.


Constructor Summary
SequenceGenerator()
           
 
Method Summary
static Sector buildModelSector(AcceleratorSeq smfSeq)
          Build and return an Sector sequence object that models the given hardware represented by the AcceleratorSeq argument.
 Sector genModelSector(AcceleratorSeq smfSeq)
          Build and return an Sector sequence object that models the given hardware represented by the AcceleratorSeq argument.
 void leaving(ProxyTree pxyNode)
          Catch the end of processing event for a ProxyTree node.
 void process(DriftSpace pxyNode)
          Accept a proxy-tree node of type DriftSpace and perform any visitor specific processing of the node argument.
 void process(ProxyTree pxyNode)
          Begin building a (Sub)sequence of model elements.
 void process(ThickHardware pxyNode)
          Process a ThickHardware node of the proxy tree.
 void process(ThinHardware pxyNode)
          Process a ThinHardware node of the proxy tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SequenceGenerator

public SequenceGenerator()
Method Detail

buildModelSector

public static Sector buildModelSector(AcceleratorSeq smfSeq)
                               throws GenerationException
Build and return an Sector sequence object that models the given hardware represented by the AcceleratorSeq argument.

Parameters:
smfSeq - hardware reference to be modeled
Returns:
synchronized model of the hardware reference argument
Throws:
GenerationException - unable to build model

genModelSector

public Sector genModelSector(AcceleratorSeq smfSeq)
                      throws GenerationException
Build and return an Sector sequence object that models the given hardware represented by the AcceleratorSeq argument.

Parameters:
smfSeq - hardware reference to be modeled
Returns:
synchronized model of the hardware reference argument
Throws:
GenerationException - unable to build model

process

public void process(ThinHardware pxyNode)
             throws GenerationException
Process a ThinHardware node of the proxy tree. Check if node is a leaf in the tree then build a modeling element and initiate synchronization if so.

Specified by:
process in interface IProxyVisitor
Parameters:
pxyNode - ThinHardware proxy-tree node
Throws:
GenerationException - unable to process node (visitor specific)
See Also:
IProxyVisitor.process(gov.sns.xal.model.gen.ptree.ThinHardware)

process

public void process(ThickHardware pxyNode)
             throws GenerationException
Process a ThickHardware node of the proxy tree. Check if node is a leaf in the tree then build a modeling element and initiate synchronization if so.

Specified by:
process in interface IProxyVisitor
Parameters:
pxyNode - ThickHardware proxy-tree node
Throws:
GenerationException - unable to process node (visitor specific)
See Also:
IProxyVisitor.process(gov.sns.xal.model.gen.ptree.ThickHardware)

process

public void process(DriftSpace pxyNode)
             throws GenerationException
Description copied from interface: IProxyVisitor
Accept a proxy-tree node of type DriftSpace and perform any visitor specific processing of the node argument.

Specified by:
process in interface IProxyVisitor
Parameters:
pxyNode -
Throws:
GenerationException - unable to process node (visitor specific)
See Also:
IProxyVisitor.process(gov.sns.xal.model.gen.ptree.DriftSpace)

process

public void process(ProxyTree pxyNode)
             throws GenerationException
Begin building a (Sub)sequence of model elements. We have encountered a ProxyTree node in the proxy tree object which indicates a child sequence. We must create a new Sector object and push it onto the sequence stack as the current sequence under construction. If this is the first time this method is called on the proxy tree we must set the newly created Sector object as the master sequence for the tree.

Specified by:
process in interface IProxyVisitor
Parameters:
pxyNode - ProxyTree object representing an AcceleratorSeq object
Throws:
GenerationException - unable to process node (visitor specific)
See Also:
IProxyVisitor.process(gov.sns.xal.model.gen.ptree.ProxyTree)

leaving

public void leaving(ProxyTree pxyNode)
             throws GenerationException
Catch the end of processing event for a ProxyTree node. We must pop the sequence stack to return to the building of the previous Sector object.

Specified by:
leaving in interface IProxyVisitor
Parameters:
pxyNode - dummy argument indicatin we are leaving a ProxyTree object
Throws:
GenerationException - must have been a sequence stack crash
See Also:
IProxyVisitor.leaving(gov.sns.xal.model.gen.ptree.ProxyTree)