net.sf.joost.instruction
Class AbstractInstruction

java.lang.Object
  extended by net.sf.joost.instruction.AbstractInstruction
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
NodeBase, NodeBase.End, ProcessBase.ProcessEnd

public abstract class AbstractInstruction
extends Object
implements Cloneable

Abstract base class for all nodes in an STX transformation sheet. Actually nodes will be represented similar to tags. For an element from the transformation sheet two objects (derived from AbstractInstruction) will be created: the first to be processed at the beginning of the element, the second to be processed at the end (see NodeBase).

Version:
$Revision: 2.3 $ $Date: 2008/10/04 17:13:14 $
Author:
Oliver Becker

Field Summary
 int colNo
          The column number of this instruction in the transformation sheet.
 int lineNo
          The line number of this instruction in the transformation sheet.
 AbstractInstruction next
          The next instruction in the chain.
 
Constructor Summary
AbstractInstruction()
           
 
Method Summary
 AbstractInstruction deepCopy(HashMap copies)
          Creates a deep copy of this instruction
static Hashtable deepHashtableCopy(Hashtable hashtable, HashMap copies)
          Create a deep copy of a Hashtable that contains AbstractInstruction instances as values
static TemplateFactory.Instance[] deepTemplateArrayCopy(TemplateFactory.Instance[] templates, HashMap copies)
          Create a deep copy of an array of STX template instances.
abstract  NodeBase getNode()
           
protected  void onDeepCopy(AbstractInstruction copy, HashMap copies)
          Callback that will be called when a clone of this instance has been created.
abstract  short process(Context context)
          The method that does the actual processing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

next

public AbstractInstruction next
The next instruction in the chain. The subtree of nodes in a template or procedure will be represented as a linked list.


lineNo

public int lineNo
The line number of this instruction in the transformation sheet. Normally this corresponds to the position of a start tag or an end tag resp.


colNo

public int colNo
The column number of this instruction in the transformation sheet. Normally this corresponds to the position of a start tag or an end tag resp.

Constructor Detail

AbstractInstruction

public AbstractInstruction()
Method Detail

getNode

public abstract NodeBase getNode()
Returns:
the node this instruction belongs to

process

public abstract short process(Context context)
                       throws SAXException
The method that does the actual processing. This method will be called while traversing the list of nodes.

Parameters:
context - the current context
Returns:
Constants.PR_CONTINUE, when the processing should continue with the next node; otherwise when the processing should be suspended due to an stx:process-xxx instruction. This in turn means that only the implementations for these stx:process-xxx instructions must return a value other than PR_CONTINUE. (Exception from the rule: non-recoverable errors)
Throws:
SAXException

deepCopy

public final AbstractInstruction deepCopy(HashMap copies)
Creates a deep copy of this instruction

Parameters:
copies - the map of already copied objects
Returns:
the copy of this instruction

onDeepCopy

protected void onDeepCopy(AbstractInstruction copy,
                          HashMap copies)
Callback that will be called when a clone of this instance has been created. To be overridden in subclasses.

Parameters:
copy - the created clones
copies - the map of already copied objects

deepHashtableCopy

public static final Hashtable deepHashtableCopy(Hashtable hashtable,
                                                HashMap copies)
Create a deep copy of a Hashtable that contains AbstractInstruction instances as values

Parameters:
hashtable - the Hashtable to be copied
copies - the map of already copied objects
Returns:
the copy

deepTemplateArrayCopy

public static final TemplateFactory.Instance[] deepTemplateArrayCopy(TemplateFactory.Instance[] templates,
                                                                     HashMap copies)
Create a deep copy of an array of STX template instances.

Parameters:
templates - the array to be copied
copies - the map of already copied objects
Returns:
the copy