org.uacalc.alg.op
Class AbstractOperation

java.lang.Object
  extended by org.uacalc.alg.op.AbstractOperation
All Implemented Interfaces:
Operation
Direct Known Subclasses:
OperationWithDefaultValue, TermOperationImp

public abstract class AbstractOperation
extends java.lang.Object
implements Operation

This class implements the basic methods of Operation. valueAt is abstract so must be overwritten.

Version:
$Id: AbstractOperation.java,v 1.7 2008/11/03 04:48:43 ralphfreese Exp $
Author:
Ralph Freese, Emil Kiss

Field Summary
protected  int algSize
           
protected  OperationSymbol symbol
           
protected  int[] valueTable
           
 
Constructor Summary
AbstractOperation(OperationSymbol symbol, int algSize)
           
AbstractOperation(java.lang.String name, int arity, int algSize)
           
 
Method Summary
 int arity()
          This gives the arity of this operation.
 int getSetSize()
          This gives the size of the set upon which the operation acts.
 int[] getTable()
          Get the table for this operation or null if it does not exist.
 int[] getTable(boolean makeTable)
          Get the table for this operation.
 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 isAssociative()
          Test if this operation is binary and associative.
 boolean isCommutative()
          Test if this operation is binary and commutative.
 boolean isIdempotent()
          Is this operation idempotent in the sense f(x,x,..,x) = x.
 boolean isTableBased()
           
 boolean isTotal()
          Only OperationWithDefaultValue's can fail this.
 boolean isTotallySymmetric()
          Test if this operation is totally symmetric; that is, invariant under all permutation of the variables.
 void makeTable()
          This will make a table and so make the operation faster but requires more space.
 OperationSymbol symbol()
          The operation symbol for this operation.
 int[] valueAt(int[][] args)
          This operation is for fast product operation.
abstract  java.lang.Object valueAt(java.util.List args)
          This operation is the element version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

symbol

protected OperationSymbol symbol

algSize

protected int algSize

valueTable

protected int[] valueTable
Constructor Detail

AbstractOperation

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

AbstractOperation

public AbstractOperation(OperationSymbol symbol,
                         int algSize)
Method Detail

arity

public int arity()
This gives the arity of this operation.

Specified by:
arity in interface Operation

getSetSize

public int getSetSize()
This gives the size of the set upon which the operation acts.

Specified by:
getSetSize in interface Operation

symbol

public OperationSymbol symbol()
Description copied from interface: Operation
The operation symbol for this operation.

Specified by:
symbol in interface Operation

valueAt

public abstract 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

valueAt

public int[] valueAt(int[][] args)
Description copied from interface: Operation
This operation is for fast product operation.

Specified by:
valueAt in interface Operation
Parameters:
args - an array of arity int arrays from the product algebra.

intValueAt

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

Specified by:
intValueAt in interface Operation

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
Parameters:
arg - the Horner encoding of the actual args.
Returns:

isTableBased

public boolean isTableBased()
Specified by:
isTableBased in interface Operation

isIdempotent

public boolean isIdempotent()
Is this operation idempotent in the sense f(x,x,..,x) = x.

Specified by:
isIdempotent in interface Operation

isTotal

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

Specified by:
isTotal in interface Operation
Returns:

isTotallySymmetric

public boolean isTotallySymmetric()
Test if this operation is totally symmetric; that is, invariant under all permutation of the variables.

Specified by:
isTotallySymmetric in interface Operation

isAssociative

public boolean isAssociative()
Test if this operation is binary and associative.

Specified by:
isAssociative in interface Operation

isCommutative

public boolean isCommutative()
Test if this operation is binary and commutative.

Specified by:
isCommutative in interface Operation

makeTable

public void makeTable()
Description copied from interface: Operation
This will make a table and so make the operation faster but requires more space. So if A is in HSP(B) then for ints x and y, x * y would be evaluated by finding the representative of x and y of the congruence; then these representatives would be expanded into array representing the corresponding elements in the direct product. These would be multiplied and then the whole process would be reversed. If A is reasonable small it may make sense to make a table for the multiplication.

Specified by:
makeTable in interface Operation

getTable

public int[] getTable()
Description copied from interface: Operation
Get the table for this operation or null if it does not exist.

Specified by:
getTable in interface Operation

getTable

public int[] getTable(boolean makeTable)
Description copied from interface: Operation
Get the table for this operation. If it does not exist make it if makeTable is true.

Specified by:
getTable in interface Operation
Parameters:
makeTable - forces the table to be made if necessary
Returns:
the table


Copyright 2003 Ralph Freese. All Rights Reserved.