scphEditor
Class Identifier

java.lang.Object
  extended by java.util.Observable
      extended by scphEditor.CloneableObservable
          extended by scphEditor.OperandVector
              extended by scphEditor.Operand
                  extended by scphEditor.Identifier
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, IOperator
Direct Known Subclasses:
Variable

public class Identifier
extends Operand
implements IOperator

This class models terminal expressions, such as variables and constants like x and 10. An Identifier object has a name, and this is precisely the x or 10 part. It could also have an alternative name to be used with the theorem prover.

It implements Operator, because variables and constants are degenerate cases of functions.

It is a subclass of Operand as well. It is an operand that has no child and an operator - itself.

Identifier objects are designed to be flyweights. You can use the lookup method to look up an existing Identifier object by its name.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface scphEditor.IOperator
ASSOC, LEFT, nARY, NONASSOC, RIGHT
 
Constructor Summary
protected Identifier(java.lang.String nameOf)
          Creates an identifier with the given name.
protected Identifier(java.lang.String nameOf, java.lang.String pnameOf)
          Creates an identifier with the given name and prover name.
 
Method Summary
 void acceptVisitor(OperandVisitor v)
          Calls v.visitIdentifier(this).
 int arity()
          Returns the arity of this identifier (as an operator).
 int associative()
          Returns the associativity of this identifier (as an operator).
 java.lang.Object clone()
          ``Clones'' this identifier.
 boolean commutative()
          Returns the commutativity of this identifier (as an operator).
 IEmbedding format()
           
 java.lang.String getName()
          Returns the name of this identifier.
 IOperator getOperator()
          Gives the operator in this identifier operand, which is the identifier itself.
 java.lang.String getPName()
          Returns the prover name of this identifier.
 java.lang.String id()
           
static Identifier lookup(java.lang.String name)
          Looks up an Identifier object from the dictionary.
 int precedence()
          Returns the precedence of this identifier (as an operator).
 java.lang.String[] proverName()
           
 java.lang.String proverName0()
           
 
Methods inherited from class scphEditor.Operand
addParen, deParen, ensureParen, getParen, getSplit, needParen, removeParen, setSplit
 
Methods inherited from class scphEditor.OperandVector
addChild, countChildren, delChild, getChild, getChildren, setChild
 
Methods inherited from class scphEditor.CloneableObservable
addObserver, cloneObserverList, cloneObserverList, countObservers, deleteObserver, deleteObservers, notifyObservers, notifyObservers
 
Methods inherited from class java.util.Observable
clearChanged, hasChanged, setChanged
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Identifier

protected Identifier(java.lang.String nameOf)
Creates an identifier with the given name.

Parameters:
nameOf - The name.

Identifier

protected Identifier(java.lang.String nameOf,
                     java.lang.String pnameOf)
Creates an identifier with the given name and prover name.

Parameters:
nameOf - The name.
pnameOf - The prover name.
Method Detail

lookup

public static Identifier lookup(java.lang.String name)
Looks up an Identifier object from the dictionary.

Parameters:
name - The [prover] name of the desired identifier.
Returns:
The corresponding identifier or null.

getName

public java.lang.String getName()
Returns the name of this identifier.


getPName

public java.lang.String getPName()
Returns the prover name of this identifier.


precedence

public int precedence()
Returns the precedence of this identifier (as an operator). Always 0.

Specified by:
precedence in interface IOperator

associative

public int associative()
Returns the associativity of this identifier (as an operator). Always Operator.NONASSOC.

Specified by:
associative in interface IOperator

commutative

public boolean commutative()
Returns the commutativity of this identifier (as an operator). Always false.

Specified by:
commutative in interface IOperator

arity

public int arity()
Returns the arity of this identifier (as an operator). Always 0.

Specified by:
arity in interface IOperator

clone

public java.lang.Object clone()
``Clones'' this identifier. Since identifiers are flyweights, there is no cloning; the object itself is returned.

Overrides:
clone in class Operand
Returns:
this

getOperator

public IOperator getOperator()
Gives the operator in this identifier operand, which is the identifier itself.

Specified by:
getOperator in class Operand
Returns:
this
See Also:
IOperator

acceptVisitor

public void acceptVisitor(OperandVisitor v)
Calls v.visitIdentifier(this).

Specified by:
acceptVisitor in class Operand
Parameters:
v - the visitor object that wants to visit this operand.

id

public java.lang.String id()
Specified by:
id in interface IOperator
Returns:
Returns the internal unique id.

format

public IEmbedding format()
Specified by:
format in interface IOperator
Returns:
the format.

proverName

public java.lang.String[] proverName()
Specified by:
proverName in interface IOperator
Returns:
Returns the names on the prover.

proverName0

public java.lang.String proverName0()
Specified by:
proverName0 in interface IOperator
Returns:
Returns the first name on the prover.