Interpreter.PrologInterpreter
Class OpSexp

java.lang.Object
  |
  +--Interpreter.Sexp.Sexp
        |
        +--Interpreter.Sexp.AtomSexp
              |
              +--Interpreter.Sexp.IdentSexp
                    |
                    +--Interpreter.PrologInterpreter.OpSexp

public class OpSexp
extends IdentSexp

Un oggetto OpSexp è un operatore.


Field Summary
protected  byte argnum
          Numero di argomenti.
protected  java.lang.Class classe
          Classe tramite cui costruire l'operatore o il termine.
static byte OP_FX
          Indicativo per operatore prefisso non associativo.
static byte OP_FY
          Indicativo per operatore prefisso associativo.
static byte OP_XF
          Indicativo per operatore postfisso non associativo.
static byte OP_XFX
          Indicativo per operatore infisso non associativo.
static byte OP_XFY
          Indicativo per operatore infisso associativo a destra.
static byte OP_YF
          Indicativo per operatore postfisso associativo a sinistra.
static byte OP_YFX
          Indicativo per operatore infisso associativo a sinistra.
protected  int priority
          Priorità dell'operatore.
static byte TERM
          Indicativo per termine predefinito.
protected  byte type
          Tipo dell'operatore o del termine.
 
Fields inherited from class Interpreter.Sexp.AtomSexp
name
 
Fields inherited from class Interpreter.Sexp.Sexp
BEGIN_S, COUPLE_S, END_S, isAList, Lisp, nil, NIL_S, SEP_S, Separators
 
Constructor Summary
OpSexp(java.lang.String name, int pr_an, byte type, java.lang.Class cls)
          Costruisce una nuova OpSexp.
 
Method Summary
 byte argNum()
          Restituisce il numero di argomenti dell'OpSexp.
 Sexp buildObject(Sexp arg)
          Costruisce l'oggetto della classe corrispondente all'operatore.
 Sexp buildObject(Sexp first, Sexp second)
          Costruisce l'oggetto della classe corrispondente all'operatore.
 Sexp buildTerm(Sexp args)
          Costruisce l'oggetto della classe corrispondente al termine.
 int priority()
          Restituisce il valore della priorità dell'OpSexp.
 byte type()
          Restituisce il tipo dell'OpSexp.
 
Methods inherited from class Interpreter.Sexp.IdentSexp
accept
 
Methods inherited from class Interpreter.Sexp.AtomSexp
append, car, cdr, count, equals, equals, reverse, toString, toString, toStringInList
 
Methods inherited from class Interpreter.Sexp.Sexp
isAList, isEq, reverse
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OP_FX

public static final byte OP_FX
Indicativo per operatore prefisso non associativo.

OP_FY

public static final byte OP_FY
Indicativo per operatore prefisso associativo.

OP_XFX

public static final byte OP_XFX
Indicativo per operatore infisso non associativo.

OP_YFX

public static final byte OP_YFX
Indicativo per operatore infisso associativo a sinistra.

OP_XFY

public static final byte OP_XFY
Indicativo per operatore infisso associativo a destra.

OP_XF

public static final byte OP_XF
Indicativo per operatore postfisso non associativo.

OP_YF

public static final byte OP_YF
Indicativo per operatore postfisso associativo a sinistra.

TERM

public static final byte TERM
Indicativo per termine predefinito.

priority

protected int priority
Priorità dell'operatore.

type

protected byte type
Tipo dell'operatore o del termine.

argnum

protected byte argnum
Numero di argomenti.

classe

protected java.lang.Class classe
Classe tramite cui costruire l'operatore o il termine.
Constructor Detail

OpSexp

public OpSexp(java.lang.String name,
              int pr_an,
              byte type,
              java.lang.Class cls)
       throws InterpreterException
Costruisce una nuova OpSexp.
Parameters:
name - nome dell'operatore.
pr_an - priorità dell'operatore, oppure numero di argomenti del termine.
tipo - dell'operatore.
Throws:
InterpreterException - se il tipo dell'operatore non è un valore valido.
Method Detail

priority

public int priority()
Restituisce il valore della priorità dell'OpSexp.
Returns:
il valore della priorità dell'operatore.

type

public byte type()
Restituisce il tipo dell'OpSexp.
Returns:
il tipo dell'operatore.

argNum

public byte argNum()
Restituisce il numero di argomenti dell'OpSexp.
Returns:
il numero di argomenti dell'operatore.

buildObject

public Sexp buildObject(Sexp arg)
                 throws InterpreterException
Costruisce l'oggetto della classe corrispondente all'operatore.
Da utilizzare per gli operatori prefissi e postfissi.
Returns:
l'oggetto della classe corrispondente all'operatore. throws InterpreterException in caso di fallita istanziazione del nuovo oggetto.

buildObject

public Sexp buildObject(Sexp first,
                        Sexp second)
                 throws InterpreterException
Costruisce l'oggetto della classe corrispondente all'operatore.
Da utilizzare per gli operatori infissi.
Returns:
l'oggetto della classe corrispondente all'operatore. throws InterpreterException in caso di fallita istanziazione del nuovo oggetto.

buildTerm

public Sexp buildTerm(Sexp args)
               throws InterpreterException
Costruisce l'oggetto della classe corrispondente al termine.
Returns:
l'oggetto della classe corrispondente al termine. throws InterpreterException in caso di fallita istanziazione del nuovo oggetto.


Codice realizzato da Francesco Geri & Marco Tamanti