Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.singularsys.jep
Class OperatorTable2

    java.lang.Object
      com.singularsys.jep.OperatorTable2

All Implemented Interfaces:
  JepComponent, OperatorTableI, java.io.Serializable

Direct Known Subclasses:
  StandardOperatorTable2

    public class OperatorTable2

extends java.lang.Object
implements OperatorTableI

An operator table where operators are identified by enums.

Author:
  Richard Morris
See Also:
  Serialized Form

Nested Class Summary
`static class` | `OperatorTable2.BasicOperators` The basic arithmetic comparative and logical operators
`static interface` | `OperatorTable2.OperatorKey` All operators enums must implement this interface.
`static class` | `OperatorTable2.PsudoOperators` Operators which do not correspond to
`static class` | `OperatorTable2.SpecialOperators` Special purpose operators

Constructor Summary
`OperatorTable2()`
`OperatorTable2(OperatorTable2 oldTable)` Decorator constructor.

Method Summary
`Operator` | `addOperator(OperatorTable2.OperatorKey key, Operator op)` Add a operator with a given key.
`Operator` | `addOperator(OperatorTable2.OperatorKey key, Operator op, Operator existingOp)` Add operator with the same precedence level as an existing operator.
`Operator` | `appendOperator(OperatorTable2.OperatorKey key, Operator op, Operator existingOp)` Add an operator with a new precedence level which is lower than the existing op.
`java.util.Set<java.util.Map.Entry<OperatorTable2.OperatorKey,Operator>>` | `entrySet()`
`Operator` | `getAdd()`
`Operator` | `getAnd()`
`Operator` | `getAssign()`
`Operator` | `getCross()`
`Operator` | `getDivide()`
`Operator` | `getDot()`
`Operator` | `getEle()`
`Operator` | `getEQ()`
`Operator` | `getGE()`
`Operator` | `getGT()`
`OperatorTable2.OperatorKey` | `getKey(Operator op)` Gets the key associated with a specific operator
`Operator` | `getLE()`
`JepComponent` | `getLightWeightInstance()` Gets a light-weight instance suitable for using in multiple threads.
`Operator` | `getList()`
`Operator` | `getLT()`
`Operator` | `getMod()`
`Operator` | `getMultiply()`
`Operator` | `getNE()`
`Operator` | `getNop()`
`Operator` | `getNot()`
`int` | `getNumOps()`
`Operator` | `getOperator(OperatorTable2.OperatorKey key)` Get operator by its key code.
`java.util.Collection<Operator>` | `getOperators()` Return the full list of operators
`Operator` | `getOperatorsByName(java.lang.String name)` Get the operator with a given name
`java.util.List<Operator>` | `getOperatorsBySymbol(java.lang.String symbol)` Gets all the operators with a given symbol
`Operator` | `getOr()`
`Operator` | `getPower()`
`Operator` | `getRange()`
`Operator` | `getSubtract()`
`Operator` | `getUDivide()` unary division i.e. 1/x or x^(-1) *
`Operator` | `getUMinus()`
`Operator` | `getUPlus()`
`void` | `init(Jep jep)` Initialize the component.
`Operator` | `insertOperator(OperatorTable2.OperatorKey key, Operator op, Operator existingOp)` Add operator with the same precedence level as an existing operator.
`java.util.Set<OperatorTable2.OperatorKey>` | `keySet()`
`void` | `removeOperator(Operator op)` Remove a give operator from the table
`void` | `removeOperator(OperatorTable2.OperatorKey key)` Remove a give operator from the table
`void` | `replaceOperator(Operator oldOp, Operator op)` Replace a give operator with a new one.
`void` | `replaceOperator(OperatorTable2.OperatorKey key, Operator op)` Replace a give operator with a new one.
`protected boolean` | `setBinaryInverseOp(OperatorTable2.OperatorKey key1, OperatorTable2.OperatorKey key2)`
`protected boolean` | `setDistributiveOver(OperatorTable2.OperatorKey key1, OperatorTable2.OperatorKey key2)`
`protected boolean` | `setInverseOp(OperatorTable2.OperatorKey key1, OperatorTable2.OperatorKey key2)`
`boolean` | `setPrecedenceTable(OperatorTable2.OperatorKey[][] precArray)` Sets the precedence of all operators at one time.
`protected boolean` | `setRootOp(OperatorTable2.OperatorKey key1, OperatorTable2.OperatorKey key2)`
`protected void` | `setStandardOperatorRelations()` Sets up the standard relations between +,-,*,/
`java.lang.String` | `toString()` String rep operators ordered by precedence, one per line.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### OperatorTable2

    public OperatorTable2()

### OperatorTable2

    public OperatorTable2(OperatorTable2 oldTable)

  Decorator constructor. The new class will share the same internal table as its argument.

  Parameters:
    `oldTable` -

Method Detail

### init

    public void init(Jep jep)

  Description copied from interface: `JepComponent`
  Initialize the component. This methods is called whenever a component is added to Jep. Hence it allows components to keep track of the other components they may rely on.

  Specified by:
    `init` in interface `JepComponent`
  Parameters:
    `jep` - the current Jep instance

### getNumOps

    public int getNumOps()

### addOperator

    public Operator addOperator(OperatorTable2.OperatorKey key,
                                Operator op)

  Add a operator with a given key.

  Parameters:
    `key` - integer key value
    `op` -
  Returns:
    the operator op

### addOperator

    public Operator addOperator(OperatorTable2.OperatorKey key,
                                Operator op,
                                Operator existingOp)

  Add operator with the same precedence level as an existing operator.

  Parameters:
    `key` -
    `op` -
    `existingOp` -
  Returns:
    the operator

### insertOperator

    public Operator insertOperator(OperatorTable2.OperatorKey key,
                                   Operator op,
                                   Operator existingOp)

  Add operator with the same precedence level as an existing operator.

  Parameters:
    `op` -
    `existingOp` -
  Returns:
    the operator

### appendOperator

    public Operator appendOperator(OperatorTable2.OperatorKey key,
                                   Operator op,
                                   Operator existingOp)

  Add an operator with a new precedence level which is lower than the existing op. Increments the precedence of all operators with a greater precedence by one.

  Parameters:
    `key` -
    `op` -
    `existingOp` -
  Returns:
    the operator

### getKey

    public OperatorTable2.OperatorKey getKey(Operator op)

  Gets the key associated with a specific operator

  Parameters:
    `op` -
  Returns:
    the key, null if op is not in the table

### removeOperator

    public void removeOperator(Operator op)

  Remove a give operator from the table

  Parameters:
    `op` -

### removeOperator

    public void removeOperator(OperatorTable2.OperatorKey key)

  Remove a give operator from the table

  Parameters:
    `key` -

### replaceOperator

    public void replaceOperator(Operator oldOp,
                                Operator op)

  Replace a give operator with a new one. The new operator will have the same precedence as the old one

  Parameters:
    `oldOp` - the operator to be replaced
    `op` - the new operator

### replaceOperator

    public void replaceOperator(OperatorTable2.OperatorKey key,
                                Operator op)

  Replace a give operator with a new one. The new operator will have the same precedence as the old one

  Parameters:
    `key` - the key for the operator
    `op` - the new operator

### getOperator

    public Operator getOperator(OperatorTable2.OperatorKey key)

  Get operator by its key code. Most efficient way to get an operator.

  Parameters:
    `key` - code used in the table
  Returns:
    the operator or null if not found

### getOperatorsBySymbol

    public java.util.List<Operator> getOperatorsBySymbol(java.lang.String symbol)

  Gets all the operators with a given symbol

  Specified by:
    `getOperatorsBySymbol` in interface `OperatorTableI`
  Parameters:
    `symbol` - symbol used for operator
  Returns:
    list of operators with a given symbol, empty list if none are found.

### getOperatorsByName

    public Operator getOperatorsByName(java.lang.String name)

  Get the operator with a given name

  Specified by:
    `getOperatorsByName` in interface `OperatorTableI`
  Parameters:
    `name` - unique name of operator
  Returns:
    the operator or null if not found

### getOperators

    public java.util.Collection<Operator> getOperators()

  Return the full list of operators

  Specified by:
    `getOperators` in interface `OperatorTableI`

### entrySet

    public java.util.Set<java.util.Map.Entry<OperatorTable2.OperatorKey,Operator>> entrySet()

### keySet

    public java.util.Set<OperatorTable2.OperatorKey> keySet()

### setPrecedenceTable

    public final boolean setPrecedenceTable(OperatorTable2.OperatorKey[][] precArray)

  Sets the precedence of all operators at one time. An array of arrays of key codes of operators is used to set the table operators with the same precedence are grouped together and listed from tighter binding to loose binding. For example

       setPrecedenceTable(new OperatorKey[][] {
       { POWER },
       { NEG, UPLUS, NOT },
       { MUL, DIV, MOD, DOT, CROSS },
       { ADD, SU },
       { LT, LE, GT, GE },
       { EQ, NE },
       { AND },
       { OR },
       { ASSIGN },
       });

  Parameters:
    `precArray` -
  Returns:
    flag

### setInverseOp

    protected boolean setInverseOp(OperatorTable2.OperatorKey key1,
                                   OperatorTable2.OperatorKey key2)

### setBinaryInverseOp

    protected boolean setBinaryInverseOp(OperatorTable2.OperatorKey key1,
                                         OperatorTable2.OperatorKey key2)

### setRootOp

    protected boolean setRootOp(OperatorTable2.OperatorKey key1,
                                OperatorTable2.OperatorKey key2)

### setDistributiveOver

    protected boolean setDistributiveOver(OperatorTable2.OperatorKey key1,
                                          OperatorTable2.OperatorKey key2)

### setStandardOperatorRelations

    protected void setStandardOperatorRelations()

  Sets up the standard relations between +,-,*,/

### getNop

    public Operator getNop()

  Specified by:
    `getNop` in interface `OperatorTableI`

### getAdd

    public Operator getAdd()

  Specified by:
    `getAdd` in interface `OperatorTableI`

### getSubtract

    public Operator getSubtract()

  Specified by:
    `getSubtract` in interface `OperatorTableI`

### getUMinus

    public Operator getUMinus()

  Specified by:
    `getUMinus` in interface `OperatorTableI`

### getUPlus

    public Operator getUPlus()

  Specified by:
    `getUPlus` in interface `OperatorTableI`

### getMultiply

    public Operator getMultiply()

  Specified by:
    `getMultiply` in interface `OperatorTableI`

### getDivide

    public Operator getDivide()

  Specified by:
    `getDivide` in interface `OperatorTableI`

### getMod

    public Operator getMod()

  Specified by:
    `getMod` in interface `OperatorTableI`

### getUDivide

    public Operator getUDivide()

  unary division i.e. 1/x or x^(-1) *

  Specified by:
    `getUDivide` in interface `OperatorTableI`

### getPower

    public Operator getPower()

  Specified by:
    `getPower` in interface `OperatorTableI`

### getGT

    public Operator getGT()

  Specified by:
    `getGT` in interface `OperatorTableI`

### getLT

    public Operator getLT()

  Specified by:
    `getLT` in interface `OperatorTableI`

### getEQ

    public Operator getEQ()

  Specified by:
    `getEQ` in interface `OperatorTableI`

### getLE

    public Operator getLE()

  Specified by:
    `getLE` in interface `OperatorTableI`

### getGE

    public Operator getGE()

  Specified by:
    `getGE` in interface `OperatorTableI`

### getNE

    public Operator getNE()

  Specified by:
    `getNE` in interface `OperatorTableI`

### getAnd

    public Operator getAnd()

  Specified by:
    `getAnd` in interface `OperatorTableI`

### getOr

    public Operator getOr()

  Specified by:
    `getOr` in interface `OperatorTableI`

### getNot

    public Operator getNot()

  Specified by:
    `getNot` in interface `OperatorTableI`

### getAssign

    public Operator getAssign()

  Specified by:
    `getAssign` in interface `OperatorTableI`

### getDot

    public Operator getDot()

  Specified by:
    `getDot` in interface `OperatorTableI`

### getCross

    public Operator getCross()

  Specified by:
    `getCross` in interface `OperatorTableI`

### getList

    public Operator getList()

  Specified by:
    `getList` in interface `OperatorTableI`

### getEle

    public Operator getEle()

  Specified by:
    `getEle` in interface `OperatorTableI`

### getRange

    public Operator getRange()

  Specified by:
    `getRange` in interface `OperatorTableI`

### toString

    public java.lang.String toString()

  String rep operators ordered by precedence, one per line.

  Overrides:
    `toString` in class `java.lang.Object`

### getLightWeightInstance

    public JepComponent getLightWeightInstance()

  Description copied from interface: `JepComponent`
  Gets a light-weight instance suitable for using in multiple threads.

  Specified by:
    `getLightWeightInstance` in interface `JepComponent`
  Returns:
    this

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008 Singular Systems http://www.singularsys.com/jep