Algernon Software

org.algernon.aam
Class Opcode

java.lang.Object
  extended byorg.jatha.dynatype.StandardLispValue
      extended byorg.algernon.aam.Opcode
All Implemented Interfaces:
Comparable, LispValue
Direct Known Subclasses:
ActivateBCRules, ActivateFCRules, Any, Ask, Assert, Assume, Bind, Branch, BranchByUser, Child, ClassOp, Clause, ClearRelation, ConjunctiveBranch, ConjunctiveClear, Continuation, Count, CreateClass, CreateFacet, CreateInstance, CreateRelation, CreateRelationRules, CreateRules, Date, DeleteClass, DeleteClause, DeleteFacet, DeleteFrame, DeleteInstance, DeleteRelation, DirectClass, DirectInstance, DirectSubclass, DirectSuperclass, Eval, Fire, For, Instance, IsClass, IsFacet, IsFrame, IsInstance, IsRelation, Label, LeafClass, LeastCommonSuperclass, Limit, MergeBindings, Name, NotEqual, Parent, Pop, Print, Push, Query, Return, RootClass, Save, Select, Show, ShowCode, Skip, Stop, Subclass, Subroutine, SubstituteBindings, SubstituteBindings1, Superclass, TemplateRelation, TestBound, TestFail, TestKnown, TestSucceed, TestTrue, TestUnbound, TestUnique, Trace, UseKB, Verify

public class Opcode
extends StandardLispValue

This class represents an Opcode in the AAM. Each opcode is an instance of this class. The OpcodeSet contains an instance of each Opcode. A numberOfArguments of 0 means any number is acceptable.


Field Summary
protected  Algernon f_algy
           
protected  String m_name
           
protected  int m_numberOfArguments
           
 
Fields inherited from class org.jatha.dynatype.StandardLispValue
f_lisp
 
Constructor Summary
Opcode(Algernon algy, String name, int numberOfArguments)
          Create a new AAM Opcode.
 
Method Summary
 AlgernonClass argumentToClass(AlgernonKB kb, LispValue classVal)
          Utility method to convert an argument to an AlgernonClass.
 AlgernonClass argumentToClass(AlgernonKBSet kbSet, LispValue classVal)
          Utility method to convert an argument to an AlgernonClass.
 AlgernonFacet argumentToFacet(AlgernonKB kb, LispValue facetVal)
          Utility method to convert an argument to an AlgernonFacet.
 AlgernonFacet argumentToFacet(AlgernonKBSet kb, LispValue facetVal)
          Utility method to convert an argument to an AlgernonFacet.
 AlgernonFrame argumentToFrame(AlgernonKB kb, LispValue frameVal)
          Utility method to convert an argument to an AlgernonFrame.
 AlgernonFrame argumentToFrame(AlgernonKBSet kb, LispValue frameVal)
          Utility method to convert an argument to an AlgernonFrame.
 AlgernonInstance argumentToInstance(AlgernonKB kb, AlgernonClass aClass, LispValue instanceVal)
          Utility method to convert an argument to an AlgernonInstance.
 AlgernonInstance argumentToInstance(AlgernonKB kb, LispValue instanceVal)
          Utility method to convert an argument to an AlgernonInstance.
 AlgernonInstance argumentToInstance(AlgernonKBSet kb, LispValue instanceVal)
          Utility method to convert an argument to an AlgernonInstance.
 AlgernonRelation argumentToRelation(AlgernonKB kb, LispValue relationVal)
          Utility method to convert an argument to an AlgernonClass.
 AlgernonRelation argumentToRelation(AlgernonKBSet kb, LispValue relationVal)
          Utility method to convert an argument to an AlgernonClass.
 void execute(Processor processor, AlgernonKBSet kbSet)
          Executes this opcode, using information in the given processor.
 String getName()
          Returns the value of Name.
 int getNumberOfArguments()
          Returns the value of NumberOfArguments.
 void setName(String newName)
          Sets the value of Name.
 void setNumberOfArguments(int newNumberOfArguments)
          Sets the value of NumberOfArguments.
 String toString()
           
 
Methods inherited from class org.jatha.dynatype.StandardLispValue
abs, acos, add, adjustSpecialCount, append, apply, apropos_print, asin, assoc, atan, atan2, atom, basic_atom, basic_bignump, basic_consp, basic_constantp, basic_floatp, basic_foreignp, basic_functionp, basic_integerp, basic_keywordp, basic_length, basic_listp, basic_macrop, basic_null, basic_numberp, basic_stringp, basic_symbolp, bignump, boundp, butlast, car, cdr, ceiling, characterp, clrhash, compareTo, concatenate, consp, constantp, contains, copy_list, copy, cos, cot, csc, degreesToRadians, divide, eighth, elt, elt, eq, eql, equal, equalNumeric, factorial, fboundp, fifth, first, floatp, floor, fourth, funcall, functionp, get_specialCount, gethash, gethash, getLisp, greaterThan, greaterThanOrEqual, hash_table_count, hash_table_rehash_size, hash_table_rehash_threshold, hash_table_size, hash_table_test, hashtablep, integerp, internal_getName, internal_prin1_as_cdr, internal_prin1, internal_princ_as_cdr, internal_princ, internal_print_as_cdr, internal_print, iterator, keywordp, last, length, lessThan, lessThanOrEqual, lisp_null, list, listp, max, member, min, multiply, nconc, negate, neql, ninth, nreverse, nstringCapitalize, nstringDowncase, nstringUpcase, numberp, pop, position, prin1, princ, print, push, radiansToDegrees, rassoc, reciprocal, remhash, remove, rest, reverse, rplaca, rplacd, sec, second, set_special, setf_gethash, setf_symbol_function, setf_symbol_plist, setf_symbol_value, setLisp, setPackage, setq, seventh, sin, sixth, specialP, sqrt, string, stringCapitalize, stringDowncase, stringEndsWith, stringEq, stringEqual, stringGreaterP, stringGreaterThan, stringGreaterThanOrEqual, stringLeftTrim, stringLeftTrim, stringLessP, stringLessThan, stringLessThanOrEqual, stringNeq, stringNotGreaterP, stringNotLessP, stringp, stringRightTrim, stringRightTrim, stringStartsWith, stringTrim, stringTrim, stringUpcase, subst, substring, substring, subtract, symbol_function, symbol_name, symbol_package, symbol_plist, symbol_value, symbolp, tan, tenth, third, toCollection, toJava, toJava, toString, toStringAsCdr_internal, toStringAsCdr, toStringShort, toStringShort, toStringSimple, type_of, typep, zerop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_numberOfArguments

protected int m_numberOfArguments

m_name

protected String m_name

f_algy

protected Algernon f_algy
Constructor Detail

Opcode

public Opcode(Algernon algy,
              String name,
              int numberOfArguments)
Create a new AAM Opcode.

Method Detail

toString

public String toString()

execute

public void execute(Processor processor,
                    AlgernonKBSet kbSet)
             throws AlgernonException
Executes this opcode, using information in the given processor. Throws an AAMExecutionException if there is a problem.

Throws:
AlgernonException

getName

public String getName()
Returns the value of Name.


setName

public void setName(String newName)
Sets the value of Name.


getNumberOfArguments

public int getNumberOfArguments()
Returns the value of NumberOfArguments.


setNumberOfArguments

public void setNumberOfArguments(int newNumberOfArguments)
Sets the value of NumberOfArguments.


argumentToClass

public AlgernonClass argumentToClass(AlgernonKB kb,
                                     LispValue classVal)
                              throws AlgernonDataException
Utility method to convert an argument to an AlgernonClass. The classVal argument is either already an AlgernonClass, is a LispSymbol or a LispString. This method returns either a true instance of AlgernonClass or null.

Parameters:
kb - The KB to look in for the class.
classVal - the thing to be converted to an AlgernonClass.
Returns:
an AlgernonClass or null.
Throws:
AlgernonDataException

argumentToInstance

public AlgernonInstance argumentToInstance(AlgernonKB kb,
                                           AlgernonClass aClass,
                                           LispValue instanceVal)
                                    throws AlgernonDataException
Utility method to convert an argument to an AlgernonInstance. The instanceVal argument is either already an AlgernonInstance, is a LispSymbol or a LispString. This method returns either a true instance of AlgernonInstance or null.

Parameters:
kb - The KB to look in for the class.
instanceVal - the thing to be converted to an AlgernonInstance.
Returns:
an AlgernonInstance or null.
Throws:
AlgernonDataException

argumentToInstance

public AlgernonInstance argumentToInstance(AlgernonKB kb,
                                           LispValue instanceVal)
                                    throws AlgernonDataException
Utility method to convert an argument to an AlgernonInstance. The classVal argument is either already an AlgernonInstance, is a LispSymbol or a LispString. This method returns either a true instance of AlgernonInstance or null.

Parameters:
kb - The KB to look in for the class.
instanceVal - the thing to be converted to an AlgernonInstance.
Returns:
an AlgernonInstance or null.
Throws:
AlgernonDataException

argumentToFacet

public AlgernonFacet argumentToFacet(AlgernonKB kb,
                                     LispValue facetVal)
                              throws AlgernonDataException
Utility method to convert an argument to an AlgernonFacet. The classVal argument is either already an AlgernonFacet, is a LispSymbol or a LispString. This method returns either a true instance of AlgernonFacet or null.

Parameters:
kb - The KBs to look in for the class.
facetVal - the thing to be converted to an AlgernonFacet.
Returns:
an AlgernonFacet or null.
Throws:
AlgernonDataException

argumentToRelation

public AlgernonRelation argumentToRelation(AlgernonKB kb,
                                           LispValue relationVal)
                                    throws AlgernonDataException
Utility method to convert an argument to an AlgernonClass. The classVal argument is either already an AlgernonClass, is a LispSymbol or a LispString. This method returns either a true instance of AlgernonClass or null.

Parameters:
kb - The KBs to look in for the class.
relationVal - the thing to be converted to an AlgernonClass.
Returns:
an AlgernonClass or null.
Throws:
AlgernonDataException

argumentToFrame

public AlgernonFrame argumentToFrame(AlgernonKB kb,
                                     LispValue frameVal)
                              throws AlgernonDataException
Utility method to convert an argument to an AlgernonFrame. The classVal argument is either already an AlgernonFrame, is a LispSymbol or a LispString. This method returns either a true instance of AlgernonInstance or null.

Parameters:
kb - The KBs to look in for the class.
frameVal - the thing to be converted to an AlgernonFrame.
Returns:
an AlgernonFrame or null.
Throws:
AlgernonDataException

argumentToClass

public AlgernonClass argumentToClass(AlgernonKBSet kbSet,
                                     LispValue classVal)
                              throws AlgernonDataException
Utility method to convert an argument to an AlgernonClass. The classVal argument is either already an AlgernonClass, is a LispSymbol or a LispString. This method returns either a true instance of AlgernonClass or null.

Parameters:
kbSet - The KBs to look in for the class.
classVal - the thing to be converted to an AlgernonClass.
Returns:
an AlgernonClass or null.
Throws:
AlgernonDataException

argumentToInstance

public AlgernonInstance argumentToInstance(AlgernonKBSet kb,
                                           LispValue instanceVal)
                                    throws AlgernonDataException
Utility method to convert an argument to an AlgernonInstance. The classVal argument is either already an AlgernonInstance, is a LispSymbol or a LispString. This method returns either a true instance of AlgernonInstance or null.

Parameters:
kb - The KBs to look in for the class.
instanceVal - the thing to be converted to an AlgernonInstance.
Returns:
an AlgernonInstance or null.
Throws:
AlgernonDataException

argumentToFacet

public AlgernonFacet argumentToFacet(AlgernonKBSet kb,
                                     LispValue facetVal)
                              throws AlgernonDataException
Utility method to convert an argument to an AlgernonFacet. The classVal argument is either already an AlgernonFacet, is a LispSymbol or a LispString. This method returns either a true instance of AlgernonFacet or null.

Parameters:
kb - The KBs to look in for the class.
facetVal - the thing to be converted to an AlgernonFacet.
Returns:
an AlgernonFacet or null.
Throws:
AlgernonDataException

argumentToRelation

public AlgernonRelation argumentToRelation(AlgernonKBSet kb,
                                           LispValue relationVal)
                                    throws AlgernonDataException
Utility method to convert an argument to an AlgernonClass. The classVal argument is either already an AlgernonClass, is a LispSymbol or a LispString. This method returns either a true instance of AlgernonClass or null.

Parameters:
kb - The KBs to look in for the class.
relationVal - the thing to be converted to an AlgernonClass.
Returns:
an AlgernonClass or null.
Throws:
AlgernonDataException

argumentToFrame

public AlgernonFrame argumentToFrame(AlgernonKBSet kb,
                                     LispValue frameVal)
                              throws AlgernonDataException
Utility method to convert an argument to an AlgernonFrame. The classVal argument is either already an AlgernonFrame, is a LispSymbol or a LispString. This method returns either a true instance of AlgernonInstance or null.

Parameters:
kb - The KBs to look in for the class.
frameVal - the thing to be converted to an AlgernonFrame.
Returns:
an AlgernonFrame or null.
Throws:
AlgernonDataException

Algernon Software