org.xmloperator.lambda.net.reduction
Class NetBetaUtils

java.lang.Object
  |
  +--org.xmloperator.lambda.net.reduction.NetBetaUtils

public abstract class NetBetaUtils
extends java.lang.Object

Beta reductions in a lambda-net.


Constructor Summary
NetBetaUtils()
           
 
Method Summary
static boolean isRedex(Applicator applicator)
          Returns true if the given Applicator is a redex.
static Applicator leftermostOutermostRedex(org.xmloperator.lambda.net.util.WalkingContext walkingContext)
          Return the leftermost-outermost redex Applicator of a lambda-net or null if the lambda-net has no redex.
static void reduce(Eraser rootEraser, Applicator redexApplicator, org.xmloperator.lambda.net.util.InteractionListener interactionListener)
          Reduce a beta interaction and apply the x-rules.
static void reduceDeeply(org.xmloperator.lambda.net.util.WalkingContext walkingContext, org.xmloperator.lambda.net.util.InteractionListener interactionListener, org.xmloperator.lambda.net.reduction.ReductionListener redexListener)
          Reduce a lambda-net until a normal form is obtained or an exception is throwed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetBetaUtils

public NetBetaUtils()
Method Detail

isRedex

public static final boolean isRedex(Applicator applicator)
Returns true if the given Applicator is a redex.

Parameters:
applicator - an Applicator.
Returns:
true if the given Applicator is a redex.

leftermostOutermostRedex

public static final Applicator leftermostOutermostRedex(org.xmloperator.lambda.net.util.WalkingContext walkingContext)
Return the leftermost-outermost redex Applicator of a lambda-net or null if the lambda-net has no redex.

Pre-conditions:

Post-condition: the WalkingContext is positioned to the root Eraser.

Parameters:
walkingContext - a WalkingContext.
Returns:
the leftermost-outermost redex Applicator or null if none.
Throws:
java.lang.IllegalStateException - if the given WalkingContext is not curently positioned to the root Eraser.
java.lang.NullPointerException - if the given lambda-net is not closed.

reduce

public static final void reduce(Eraser rootEraser,
                                Applicator redexApplicator,
                                org.xmloperator.lambda.net.util.InteractionListener interactionListener)
Reduce a beta interaction and apply the x-rules.

Pre-conditions:

Post-conditions:

Parameters:
rootEraser - a root Eraser.
redexApplicator - a redex Applicator.
interactionListener - an InteractionListener. May be null.

reduceDeeply

public static final void reduceDeeply(org.xmloperator.lambda.net.util.WalkingContext walkingContext,
                                      org.xmloperator.lambda.net.util.InteractionListener interactionListener,
                                      org.xmloperator.lambda.net.reduction.ReductionListener redexListener)
Reduce a lambda-net until a normal form is obtained or an exception is throwed.

Pre-conditions:

Post-conditions:

Parameters:
walkingContext - a WalkingContext.
interactionListener - an InteractionListener. May be null.
redexListener - a RedexListener. May be null.
Throws:
java.lang.NullPointerException - if the lambda-net is broken.
NotInNormalFormException - if the ReductionListener decides to throw this exception in order to stop this process.