org.xmloperator.lambda.tree.model
Interface Term

All Known Subinterfaces:
Abstraction, Application, EndOfScope, Leaf, TermWithBody

public interface Term

Namefree lambda-term. This is either a Leaf, an EndOfScope, an Abstraction or an Application. A Term instance is created by using a TermFactory and is terminated by being returned to the same TermFactory.

See Also:
TermFactory

Field Summary
static int TYPE_ABSTRACTION
           
static int TYPE_APPLICATION
           
static int TYPE_ENDOFSCOPE
           
static int TYPE_LEAF
           
 
Method Summary
 boolean canBeReturnedToFactory()
          Returns true if this can be returned to its factory.
 TermFactory getFactory()
          Returns the factory of this Term, which can be used for building compatible Terms.
 TermWithBody getParent()
          A Term may have a parent Term.
 int getType()
          Returns the type of this term.
 boolean isAbstraction()
          Returns true if this Term is an Abstraction.
 boolean isApplication()
          Returns true if this Term is an Application.
 boolean isEndOfScope()
          Returns true if this Term is an EndOfScope.
 boolean isLeaf()
          Returns true if this Term is a Leaf.
 void returnToFactory()
          Returns this Term to its Factory.
 

Field Detail

TYPE_LEAF

public static final int TYPE_LEAF
See Also:
Constant Field Values

TYPE_ENDOFSCOPE

public static final int TYPE_ENDOFSCOPE
See Also:
Constant Field Values

TYPE_ABSTRACTION

public static final int TYPE_ABSTRACTION
See Also:
Constant Field Values

TYPE_APPLICATION

public static final int TYPE_APPLICATION
See Also:
Constant Field Values
Method Detail

getFactory

public TermFactory getFactory()
Returns the factory of this Term, which can be used for building compatible Terms.

Returns:
the factory of this Term.

canBeReturnedToFactory

public boolean canBeReturnedToFactory()
Returns true if this can be returned to its factory. If this has a parent or a content then this cannot be returned to factory.

Returns:
true if this can be returned to its factory.

returnToFactory

public void returnToFactory()
Returns this Term to its Factory.

Pre-condition: can be returned to factory.

Post-condition: is no more usable.

Throws:
java.lang.IllegalStateException - if this cannot be returned to factory.

getType

public int getType()
Returns the type of this term.

Returns:
the type of this term. It is one of the constants TYPE_*

isLeaf

public boolean isLeaf()
Returns true if this Term is a Leaf.

Returns:
true if this Term is a Leaf.

isEndOfScope

public boolean isEndOfScope()
Returns true if this Term is an EndOfScope.

Returns:
true if this Term is an EndOfScope.

isAbstraction

public boolean isAbstraction()
Returns true if this Term is an Abstraction.

Returns:
true if this Term is an Abstraction.

isApplication

public boolean isApplication()
Returns true if this Term is an Application.

Returns:
true if this Term is an Application.

getParent

public TermWithBody getParent()
A Term may have a parent Term. A parent Term is either an EndOfScope, an Abstraction, or an Application. Returns the parent of this Term, if any.

Returns:
the parent of this Term if any, null elsewhere.