goldengine.java
Class Reduction

java.lang.Object
  |
  +--goldengine.java.Reduction

public class Reduction
extends java.lang.Object

-------------------------------------------------------------------------------------------
Source File: Reduction.java
Author: Devin Cook, Matthew Hawkins
Description: A representation of a Reduction. An instance of this class will hold the resulting parse tree once created, and if the source file has been accepted.
-------------------------------------------------------------------------------------------
Revision List

      Author          Version         Description
      ------          -------         -----------
      MPH             1.0             First Issue

-------------------------------------------------------------------------------------------
IMPORT: java.util
-------------------------------------------------------------------------------------------


Constructor Summary
Reduction()
           
 
Method Summary
 Rule getParentRule()
          getParentRule This method returns the rule associated with this Reduction.
 int getTag()
          getTag Will return the tag associated with this Reduction.
 Token getToken(int index)
          getToken Will retrieve a Token at the specified index.
 int getTokenCount()
          getTokenCount This method returns the number of tokens.
 void setParentRule(Rule newRule)
          setParentRule Will set the Rule of this Reduction to the one passed in.
 void setTag(int value)
          setTag Will set the tag of this Reduction to that passed in.
 void setToken(int index, Token value)
          setToken Will place a Token at the specified index.
 void setTokenCount(int value)
          setTokenCount This method implicitly sets the number of tokens in this Reduction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Reduction

public Reduction()
Method Detail

setTokenCount

public void setTokenCount(int value)
setTokenCount This method implicitly sets the number of tokens in this Reduction. If the value is 0 or less, then we clear the tokens in this reduction and set the number of tokens to 0.
Parameters:
value - The number of tokens in this reduction.

getTokenCount

public int getTokenCount()
getTokenCount This method returns the number of tokens.
Returns:
The number of tokens

getParentRule

public Rule getParentRule()
getParentRule This method returns the rule associated with this Reduction.
Returns:
The rule associated with this Reduction.

getTag

public int getTag()
getTag Will return the tag associated with this Reduction.
Returns:
The tag associated with this Reduction.

setParentRule

public void setParentRule(Rule newRule)
setParentRule Will set the Rule of this Reduction to the one passed in.
Parameters:
newRule - The parent Rule of this Reduction.

setTag

public void setTag(int value)
setTag Will set the tag of this Reduction to that passed in.
Parameters:
value - The value of the tag.

getToken

public Token getToken(int index)
getToken Will retrieve a Token at the specified index. The index specified must be equal or greater than 0 and less than the current number of Tokens.
Parameters:
index - The index of the token in this Reduction.
Returns:
The Token at the specified index.

setToken

public void setToken(int index,
                     Token value)
setToken Will place a Token at the specified index. It will only do this if the index is greater or equal to 0, and less than the token count.
Parameters:
index - The index to place the token at.
value - The token to set at the index.