org.uacalc.alg.op
Class OperationWithDefaultValue

java.lang.Object
  extended by org.uacalc.alg.op.AbstractOperation
      extended by org.uacalc.alg.op.OperationWithDefaultValue
All Implemented Interfaces:
Operation

public class OperationWithDefaultValue
extends AbstractOperation

A convenience class for the UI.

Author:
ralph

Field Summary
 
Fields inherited from class org.uacalc.alg.op.AbstractOperation
algSize, symbol, valueTable
 
Constructor Summary
OperationWithDefaultValue(Operation op)
           
OperationWithDefaultValue(Operation op, int algSize)
           
OperationWithDefaultValue(OperationSymbol sym, int algSize)
           
OperationWithDefaultValue(OperationSymbol sym, int algSize, int defaultValue)
           
OperationWithDefaultValue(OperationSymbol sym, int algSize, int[] valueTable, int defaultValue)
           
OperationWithDefaultValue(java.lang.String name, int arity, int algSize, int defaultValue)
           
OperationWithDefaultValue(java.lang.String name, int arity, int algSize, int[] valueTable, int defaultValue)
           
 
Method Summary
 int getDefaultValue()
           
 int[] getRandomValueTable()
           
 int[] getTotalTable()
          Get the table with the default and random values filled in.
 int intValueAt(int arg)
          This (optional) operation is for fast access to the table, if it exits.
 int intValueAt(int[] args)
          This (optional) operation is the int version.
 boolean isDiagonal(int row, int col)
           
 boolean isIdempotentSet()
           
 boolean isTotal()
          Only OperationWithDefaultValue's can fail this.
 void makeIdempotent()
           
static java.util.List<Operation> makeOrdinary(java.util.List<Operation> ops)
           
 Operation makeOrdinaryOperation()
          Make an operation with the default value filled in.
 void makeTable()
          Note this effectively kills the default value part of this.
 void setDefaultValue(int v)
           
 void setIdempotent(boolean v)
           
 void updateRandomValueTable()
           
 java.lang.Object valueAt(java.util.List args)
          This operation is the element version.
 
Methods inherited from class org.uacalc.alg.op.AbstractOperation
arity, getSetSize, getTable, getTable, isAssociative, isCommutative, isIdempotent, isTableBased, isTotallySymmetric, symbol, valueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationWithDefaultValue

public OperationWithDefaultValue(Operation op)

OperationWithDefaultValue

public OperationWithDefaultValue(java.lang.String name,
                                 int arity,
                                 int algSize,
                                 int defaultValue)

OperationWithDefaultValue

public OperationWithDefaultValue(OperationSymbol sym,
                                 int algSize)

OperationWithDefaultValue

public OperationWithDefaultValue(OperationSymbol sym,
                                 int algSize,
                                 int defaultValue)

OperationWithDefaultValue

public OperationWithDefaultValue(Operation op,
                                 int algSize)

OperationWithDefaultValue

public OperationWithDefaultValue(OperationSymbol sym,
                                 int algSize,
                                 int[] valueTable,
                                 int defaultValue)

OperationWithDefaultValue

public OperationWithDefaultValue(java.lang.String name,
                                 int arity,
                                 int algSize,
                                 int[] valueTable,
                                 int defaultValue)
Method Detail

updateRandomValueTable

public void updateRandomValueTable()

getRandomValueTable

public int[] getRandomValueTable()

isTotal

public boolean isTotal()
Description copied from interface: Operation
Only OperationWithDefaultValue's can fail this.

Specified by:
isTotal in interface Operation
Overrides:
isTotal in class AbstractOperation
Returns:

getDefaultValue

public int getDefaultValue()

setDefaultValue

public void setDefaultValue(int v)

isIdempotentSet

public boolean isIdempotentSet()

setIdempotent

public void setIdempotent(boolean v)

makeIdempotent

public void makeIdempotent()

isDiagonal

public boolean isDiagonal(int row,
                          int col)

valueAt

public java.lang.Object valueAt(java.util.List args)
Description copied from interface: Operation
This operation is the element version.

Specified by:
valueAt in interface Operation
Specified by:
valueAt in class AbstractOperation

intValueAt

public int intValueAt(int[] args)
Description copied from interface: Operation
This (optional) operation is the int version.

Specified by:
intValueAt in interface Operation
Overrides:
intValueAt in class AbstractOperation

intValueAt

public int intValueAt(int arg)
Description copied from interface: Operation
This (optional) operation is for fast access to the table, if it exits.

Specified by:
intValueAt in interface Operation
Overrides:
intValueAt in class AbstractOperation
Parameters:
arg - the Horner encoding of the actual args.
Returns:

makeTable

public void makeTable()
Note this effectively kills the default value part of this.

Specified by:
makeTable in interface Operation
Overrides:
makeTable in class AbstractOperation

getTotalTable

public int[] getTotalTable()
Get the table with the default and random values filled in.

Returns:
the filled in table or null if not possible

makeOrdinaryOperation

public Operation makeOrdinaryOperation()
Make an operation with the default value filled in.

Returns:
an operation or null if the defaultValue is -1 and there is a -1 in the table

makeOrdinary

public static java.util.List<Operation> makeOrdinary(java.util.List<Operation> ops)


Copyright 2003 Ralph Freese. All Rights Reserved.