ABL4J (Alignment Based Learning for Java) - 0.9.7

org.schwiebert.abl4j.data
Class NonTerminal

java.lang.Object
  extended by org.schwiebert.abl4j.data.NonTerminal
All Implemented Interfaces:
Serializable

public class NonTerminal
extends Object
implements Serializable

This class is used to store a nonterminal. Creating a nonterminal actually gives an unused nonterminal ''constant''. Creating a nonterminals always returns a new, unique one. They are printed as integers. It is also possible to create a nonterminal by initialising it with an integer. However, it may be the case that when initialising the nonterminal with an integer, it is has the same value as an already existing one.

Author:
Menno van Zaanen (menno@ics.mq.edu.au) (original C++ Version), Jeroen Geertzen (j.geertzen@uvt.nl) (modifications in C++ Version), Stephan Schwiebert (sschwieb@spinfo.uni-koeln.de) (Java-Implementation)
See Also:
Serialized Form

Nested Class Summary
private static class NonTerminal.UpperNTBuffer
           
 
Field Summary
private static long serialVersionUID
           
private static InheritableThreadLocal<NonTerminal.UpperNTBuffer> upperNt
           
 long value
          the value of the nonterminal
static NonTerminal ZERO_NON_TERMINAL
           
 
Constructor Summary
NonTerminal()
          Creates a new Nonterminal whose value will be the currently largest value.
NonTerminal(long n)
          Creates a new Nonterminal with value n.
 
Method Summary
 boolean equals(Object obj)
          Returns true, if obj is an instanceof Nonterminal and the value of both objects is identical.
 int hashCode()
          Returns the hashcode of field value, calculated as in Long.hashCode()
static void resetUpperNt()
          Only required for testing purposes.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

value

public final long value
the value of the nonterminal


upperNt

private static InheritableThreadLocal<NonTerminal.UpperNTBuffer> upperNt

ZERO_NON_TERMINAL

public static NonTerminal ZERO_NON_TERMINAL
Constructor Detail

NonTerminal

public NonTerminal(long n)
Creates a new Nonterminal with value n.

Parameters:
n -

NonTerminal

public NonTerminal()
Creates a new Nonterminal whose value will be the currently largest value.

Method Detail

resetUpperNt

public static void resetUpperNt()
Only required for testing purposes. Don't call this from anywhere else.


equals

public boolean equals(Object obj)
Returns true, if obj is an instanceof Nonterminal and the value of both objects is identical.

Overrides:
equals in class Object

hashCode

public int hashCode()
Returns the hashcode of field value, calculated as in Long.hashCode()

Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

ABL4J (Alignment Based Learning for Java) - 0.9.7

© 2007 Stephan Schwiebert