moves
Class EuMove

java.lang.Object
  |
  +--moves.EuMove
Direct Known Subclasses:
ASolution, moves.bracketFamily, constructFamily, Fuse, Name, newFamily, Provide, ProvidePackage, Require, Run, TestDatum

public abstract class EuMove
extends java.lang.Object

The class behind all move classes. Each such class represents a LEA move. Many of them can be constructed in two ways, one in which all input and output is specified (for use when reading from a LEA program on file) and one in which only tentative input is specified (for use when recording moves interactively).


Field Summary
protected  java.lang.String allowedSegments
           
protected  interagents.finalWrapper in
          Contains the input data for the move, as implicit information to be held up against a EuLab.
protected  interagents.finalWrapper out
          Contains the outdata for the move, as implicit information to be held up against a EuLab.
 
Constructor Summary
EuMove(interagents.finalWrapper in, interagents.finalWrapper out, fundamentals.EuArguments args, int beacon, java.lang.String inmodes, java.lang.String outmodes, java.lang.String allowedSegments, int argumentsExpected)
          This constructor checks syntax and sets up the variables in, out, in.mode, out.mode
EuMove(java.util.Vector inputs, java.util.Vector results, java.util.Vector newresults, interagents.EuLab lab, java.lang.String inmodes, java.lang.String outmodes)
          This constructor creates, given a selection of objects from a user, a move which the user may elect to perform.
 
Method Summary
protected  void checkSegment(int segment)
          Throws DesignException if the move is called in an illegal segment
protected  void ex(interagents.EuLab lab)
          Executes core commands of the move in joined main/macro mode, possibly affecting the passed @see EuLab.
 int executeMacro(interagents.EuLab lab, librarian.ppProcessor ppp, interagents.explicitHolder caller)
          Executes the move in macro mode, possibly affecting the passed @see EuLab Send or recieve data to/from calling program as explicits in a passed explicitHolder
 int executeMain(interagents.EuLab lab, librarian.ppProcessor ppp)
          Executes the move, possibly affecting the passed @see EuLab
 int executeSegmentOnly(interagents.EuLab lab, librarian.ppProcessor ppp)
           
protected  void exMacro(interagents.EuLab lab, interagents.explicitHolder caller)
          Executes core commands of the move in macro mode, possibly affecting the passed @see EuLab Send or recieve data to/from calling program as explicits in a passed explicitHolder.
protected  void exMain(interagents.EuLab lab)
          Executes core commands of the move in main mode, possibly affecting the passed @see EuLab Calls ex() as default.
 int getFirstOutIndex()
           
protected  void initArguments(fundamentals.EuArguments args, int numberOfArguments)
          Initializes arguments, throwing a DesignException if arguments unexpected This instance will not accept arguments
protected  void initBeacon(int beacon)
          Initializes beacon, throwing a DesignException if beacon unexpected This instance will not accept beacons
protected  boolean iobUsageChecks()
          Does various checks to see that the conditions described in the field Input/output/beacon usage of the description of the LEA commands are in fact met.
protected  void issueBeacon(interagents.finalWrapper preout, interagents.EuLab lab)
          Default is no beacons, overwritten in constructFamilyBeacon
 java.lang.String name()
           
 java.lang.String operationName()
           
 void passExceptionDetails(exceptions.LeaException le)
           
 void passHintDetails(fundamentals.EuHint hint, interagents.EuLab lab)
           
 void passSelection(interagents.userLab lab)
           
protected  int postMacro(interagents.EuLab lab, librarian.ppProcessor ppp)
           
protected  int postMain(interagents.EuLab lab, librarian.ppProcessor ppp)
           
protected  int postprocess(interagents.EuLab lab, librarian.ppProcessor ppp)
          Performs various postprocessing of the move, updating the ppProcessor if necessary.
protected  void preMacro(librarian.ppProcessor ppp)
           
protected  void preMain(librarian.ppProcessor ppp)
           
protected  void preprocess(librarian.ppProcessor ppp)
          Performs various preprocessing of the move.
protected  boolean specialSegmentOK(int segment)
          Determines whether a call to this move is legal in the passed special segment.
 java.lang.String toString()
          Document the move
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

in

protected interagents.finalWrapper in
Contains the input data for the move, as implicit information to be held up against a EuLab.


out

protected interagents.finalWrapper out
Contains the outdata for the move, as implicit information to be held up against a EuLab.


allowedSegments

protected java.lang.String allowedSegments
Constructor Detail

EuMove

public EuMove(interagents.finalWrapper in,
              interagents.finalWrapper out,
              fundamentals.EuArguments args,
              int beacon,
              java.lang.String inmodes,
              java.lang.String outmodes,
              java.lang.String allowedSegments,
              int argumentsExpected)
       throws DesignException
This constructor checks syntax and sets up the variables in, out, in.mode, out.mode

Parameters:
in - the input @see finalWrapper
out - the output @see finalWrapper
args - arguments
beacon - a beacon, or 0 if no such was requested

EuMove

public EuMove(java.util.Vector inputs,
              java.util.Vector results,
              java.util.Vector newresults,
              interagents.EuLab lab,
              java.lang.String inmodes,
              java.lang.String outmodes)
       throws LeaException
This constructor creates, given a selection of objects from a user, a move which the user may elect to perform. The constructor may end in exception if not all criteria for the move are met.

Method Detail

executeMain

public int executeMain(interagents.EuLab lab,
                       librarian.ppProcessor ppp)
                throws LeaException
Executes the move, possibly affecting the passed @see EuLab

Parameters:
lab - the @see EuLab on which to work
ppp - the @see ppProcessor to aid in pre- and postprocessing
Returns:
The new segment
LeaException

executeMacro

public int executeMacro(interagents.EuLab lab,
                        librarian.ppProcessor ppp,
                        interagents.explicitHolder caller)
                 throws LeaException
Executes the move in macro mode, possibly affecting the passed @see EuLab Send or recieve data to/from calling program as explicits in a passed explicitHolder

Parameters:
lab - the @see EuLab on which to work
ppp - the @see ppProcessor to aid in pre- and postprocessing
caller - the explicitHolder with which to communicate with the calling program.
Returns:
The new segment
LeaException

executeSegmentOnly

public int executeSegmentOnly(interagents.EuLab lab,
                              librarian.ppProcessor ppp)

exMain

protected void exMain(interagents.EuLab lab)
               throws LeaException
Executes core commands of the move in main mode, possibly affecting the passed @see EuLab Calls ex() as default.

Parameters:
lab - the @see EuLab on which to work
LeaException

exMacro

protected void exMacro(interagents.EuLab lab,
                       interagents.explicitHolder caller)
                throws LeaException
Executes core commands of the move in macro mode, possibly affecting the passed @see EuLab Send or recieve data to/from calling program as explicits in a passed explicitHolder. Forgets explicitHolder as default and calls ex().

Parameters:
lab - the @see EuLab on which to work
caller - the explicitHolder with which to communicate with the calling program.
LeaException

ex

protected void ex(interagents.EuLab lab)
           throws LeaException
Executes core commands of the move in joined main/macro mode, possibly affecting the passed @see EuLab. Has no effect as default, must override.

Parameters:
lab - the @see EuLab on which to work
LeaException

preMain

protected void preMain(librarian.ppProcessor ppp)
                throws LeaException
LeaException

preMacro

protected void preMacro(librarian.ppProcessor ppp)
                 throws LeaException
LeaException

preprocess

protected void preprocess(librarian.ppProcessor ppp)
                   throws LeaException
Performs various preprocessing of the move. Updates in- or output given in pidgin or by label. Overwritten by some moves to update also arguments and to collect other information for use in executing the move. All of this is made possible by use of the passed ppProcessor.

Parameters:
ppp - the ppProcessor from which to get additional information
LeaException

postMain

protected int postMain(interagents.EuLab lab,
                       librarian.ppProcessor ppp)
                throws LeaException
LeaException

postMacro

protected int postMacro(interagents.EuLab lab,
                        librarian.ppProcessor ppp)
                 throws LeaException
LeaException

postprocess

protected int postprocess(interagents.EuLab lab,
                          librarian.ppProcessor ppp)
                   throws LeaException
Performs various postprocessing of the move, updating the ppProcessor if necessary. The actions may be segment-dependent. As default only the history function of the ppProcessor is updated. Is overwritten in bracketFamily to alter current segment.

Parameters:
ppp - the ppProcessor to be updated
Returns:
the new segment
LeaException

checkSegment

protected void checkSegment(int segment)
                     throws DesignException
Throws DesignException if the move is called in an illegal segment

Parameters:
segment - the current segment
DesignException

specialSegmentOK

protected boolean specialSegmentOK(int segment)
Determines whether a call to this move is legal in the passed special segment. Default is false for all segments

Parameters:
segment - the current segment
Returns:
true if a call to this move is legal in the passed special segment

initBeacon

protected void initBeacon(int beacon)
                   throws DesignException
Initializes beacon, throwing a DesignException if beacon unexpected This instance will not accept beacons

Parameters:
beacon - an integer representing the requested beacon, or 0 if no beacon requested
Throws:
DesignException - if beacon unexpected

initArguments

protected void initArguments(fundamentals.EuArguments args,
                             int numberOfArguments)
                      throws DesignException
Initializes arguments, throwing a DesignException if arguments unexpected This instance will not accept arguments

Parameters:
args - a vector containing arguments
numberOfArguments - the number of arguments required, or -1 if no fixed requirement
Throws:
DesignException - if unexpected quantity of arguments

iobUsageChecks

protected boolean iobUsageChecks()
Does various checks to see that the conditions described in the field Input/output/beacon usage of the description of the LEA commands are in fact met.

Returns:
true if no problem encountered

name

public java.lang.String name()
Returns:
the name of the move

toString

public java.lang.String toString()
Document the move

Overrides:
toString in class java.lang.Object
Returns:
a string in the format exemplified by (R2, P4)>>>ConstructCircle>>(C6!)

issueBeacon

protected void issueBeacon(interagents.finalWrapper preout,
                           interagents.EuLab lab)
                    throws LeaException
Default is no beacons, overwritten in constructFamilyBeacon

LeaException

passExceptionDetails

public void passExceptionDetails(exceptions.LeaException le)

passHintDetails

public void passHintDetails(fundamentals.EuHint hint,
                            interagents.EuLab lab)
                     throws LeaException
LeaException

passSelection

public void passSelection(interagents.userLab lab)

operationName

public java.lang.String operationName()

getFirstOutIndex

public int getFirstOutIndex()