uk.ac.bham.gloss
Class Mode

java.lang.Object
  extended by uk.ac.bham.gloss.Mode
Direct Known Subclasses:
ModeExecution

public class Mode
extends java.lang.Object

A mode is the main building block for modular vocabularies and the glossing operation. This class stores various data concerning a mode, and is used to provide a convenient object for storage and transmission of data during a gloss Copyright Richard Kaye 2007-8 for GLOSS, http://gloss.bham.ac.uk Usage permitted according to the GPL. No waranty.


Field Summary
protected  java.lang.String accept
           
protected  boolean acceptDef
           
protected  java.util.TreeMap<java.lang.String,Mode> capturedModes
           
protected  int children
           
protected  boolean childrenDef
           
static int EXECUTE_TYPE
           
protected  Mode executeMode
           
static int INCLUDE_TYPE
           
protected  org.w3c.dom.Element modeElt
           
protected  org.w3c.dom.NodeList modeElts
           
protected  java.lang.String modeName
           
protected  int modeType
           
protected  Mode postProcessMode
           
protected  ParameterContainer prefixes
           
protected  Mode preProcessMode
           
static int PROCESS_TYPE
           
protected  Mode processMode
           
protected  java.lang.String template
           
protected  boolean templateDef
           
static java.lang.String[] typeString
           
static int UNDEFINED_TYPE
           
protected  boolean useIndentation
           
protected  boolean useIndentationDef
           
 
Constructor Summary
Mode()
          Constructs a strange "init" node used as the root to get the gloss process going.
Mode(org.w3c.dom.Element mode, ParameterContainer p)
          Main constructor: defines a mode from a given XML DOM element and a given list of valid prefixes.
Mode(Mode mode)
          shallow clone of an existing mode
Mode(ParameterContainer p)
          Constructs a strange "init" node used as the root to initialize variables.
 
Method Summary
 java.lang.String accept()
          returns the "accept" attribute
 Mode actionMode(java.lang.String action)
          gets the action mode corresponding to preprocess, process, postprocess, execute.
 org.w3c.dom.NodeList children()
          Returns the children nodes for this mode.
 int childrenToFind()
          returns the number of children to find
 int depth()
          Returns the depth of the current token, provided for compatibility with ModeExecution.
 Mode executeMode()
          Accessor
 Mode getCapturedMode(java.lang.String name, java.lang.String type)
          Accessor
 boolean isExecuteType()
          Returns true if it is a execute type mode.
 boolean isIncludeType()
          Returns true if it is a include type mode.
 boolean isProcessType()
          Returns true if it is a process type mode.
 boolean isUndefinedType()
          Returns true if it is a process type mode.
 java.lang.String name()
          Returns the mode name.
 org.w3c.dom.Element node()
          Returns the node for this mode.
 Mode parent()
          Returns the mode name.
 Mode postProcessMode()
          Accessor
 ParameterContainer prefixes()
          Returns the container of prefixes.
 Mode preProcessMode()
          Accessor
 Mode processMode()
          Accessor
 java.lang.String resolvePrefix(java.lang.String name)
          uses this mode's set of prefixes to resolve the name
 void setAccept(java.lang.String val)
          Resets the "accept" attribute
 void setActionMode(Mode m, java.lang.String type)
          gets the action mode corresponding to preprocess, process, postprocess, execute.
 void setCapturedMode(java.lang.String name, java.lang.String type, Mode mode)
          Sets captured mode
 Token token()
          Returns the current token, for compatibility with ModeExecution.
 java.lang.String toString()
          Returns a string representation of this mode.
 int type()
          Returns the mode type.
 boolean useIndentation()
          returns the use-indentation status
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNDEFINED_TYPE

public static final int UNDEFINED_TYPE
See Also:
Constant Field Values

EXECUTE_TYPE

public static final int EXECUTE_TYPE
See Also:
Constant Field Values

PROCESS_TYPE

public static final int PROCESS_TYPE
See Also:
Constant Field Values

INCLUDE_TYPE

public static final int INCLUDE_TYPE
See Also:
Constant Field Values

typeString

public static final java.lang.String[] typeString

modeName

protected java.lang.String modeName

modeType

protected int modeType

modeElt

protected org.w3c.dom.Element modeElt

modeElts

protected org.w3c.dom.NodeList modeElts

prefixes

protected ParameterContainer prefixes

useIndentation

protected boolean useIndentation

accept

protected java.lang.String accept

children

protected int children

template

protected java.lang.String template

useIndentationDef

protected boolean useIndentationDef

acceptDef

protected boolean acceptDef

childrenDef

protected boolean childrenDef

templateDef

protected boolean templateDef

capturedModes

protected java.util.TreeMap<java.lang.String,Mode> capturedModes

executeMode

protected Mode executeMode

preProcessMode

protected Mode preProcessMode

processMode

protected Mode processMode

postProcessMode

protected Mode postProcessMode
Constructor Detail

Mode

public Mode()
Constructs a strange "init" node used as the root to get the gloss process going.


Mode

public Mode(ParameterContainer p)
Constructs a strange "init" node used as the root to initialize variables. The argument here is a list of valid prefixes.


Mode

public Mode(Mode mode)
shallow clone of an existing mode


Mode

public Mode(org.w3c.dom.Element mode,
            ParameterContainer p)
     throws GlossException
Main constructor: defines a mode from a given XML DOM element and a given list of valid prefixes.

Throws:
GlossException
Method Detail

name

public java.lang.String name()
Returns the mode name.


parent

public Mode parent()
Returns the mode name.


type

public int type()
Returns the mode type.


isUndefinedType

public boolean isUndefinedType()
Returns true if it is a process type mode.


isProcessType

public boolean isProcessType()
Returns true if it is a process type mode.


isExecuteType

public boolean isExecuteType()
Returns true if it is a execute type mode.


isIncludeType

public boolean isIncludeType()
Returns true if it is a include type mode.


prefixes

public ParameterContainer prefixes()
Returns the container of prefixes.


node

public org.w3c.dom.Element node()
Returns the node for this mode.


children

public org.w3c.dom.NodeList children()
Returns the children nodes for this mode.


accept

public java.lang.String accept()
returns the "accept" attribute


setAccept

public void setAccept(java.lang.String val)
Resets the "accept" attribute


childrenToFind

public int childrenToFind()
returns the number of children to find


useIndentation

public boolean useIndentation()
returns the use-indentation status


executeMode

public Mode executeMode()
Accessor


preProcessMode

public Mode preProcessMode()
Accessor


processMode

public Mode processMode()
Accessor


postProcessMode

public Mode postProcessMode()
Accessor


actionMode

public Mode actionMode(java.lang.String action)
gets the action mode corresponding to preprocess, process, postprocess, execute.


setActionMode

public void setActionMode(Mode m,
                          java.lang.String type)
gets the action mode corresponding to preprocess, process, postprocess, execute.


getCapturedMode

public Mode getCapturedMode(java.lang.String name,
                            java.lang.String type)
Accessor


setCapturedMode

public void setCapturedMode(java.lang.String name,
                            java.lang.String type,
                            Mode mode)
Sets captured mode


resolvePrefix

public java.lang.String resolvePrefix(java.lang.String name)
uses this mode's set of prefixes to resolve the name


depth

public int depth()
Returns the depth of the current token, provided for compatibility with ModeExecution. Here returns -1.


token

public Token token()
Returns the current token, for compatibility with ModeExecution. Here returns null.


toString

public java.lang.String toString()
Returns a string representation of this mode.

Overrides:
toString in class java.lang.Object