org.uacalc.alg
Class GeneralAlgebra

java.lang.Object
  extended by org.uacalc.alg.GeneralAlgebra
All Implemented Interfaces:
Algebra
Direct Known Subclasses:
BasicAlgebra, BasicLattice, BigProductAlgebra, PolinLikeAlgebra, ProductAlgebra, QuotientAlgebra, ReductAlgebra, Subalgebra, SubProductAlgebra, UnaryTermsMonoid

public class GeneralAlgebra
extends java.lang.Object
implements Algebra

This class represents general algebras that may or may not be "computer finite".

Version:
$Id: GeneralAlgebra.java,v 1.17 2008/09/20 02:41:13 ralphfreese Exp $
Author:
Ralph Freese

Field Summary
protected  CongruenceLattice con
           
protected  java.lang.String description
           
static ProgressReport monitor
           
protected  java.lang.String name
           
protected  java.util.List<Operation> operations
           
protected  java.util.Map<OperationSymbol,Operation> operationsMap
           
protected  SimilarityType similarityType
           
protected  int size
           
protected  SubalgebraLattice sub
           
protected  java.util.Set universe
           
 
Fields inherited from interface org.uacalc.alg.Algebra
CARDINALITY_COUNTABLE, CARDINALITY_COUNTABLY_INFINITE, CARDINALITY_FINITE, CARDINALITY_INFINITE, CARDINALITY_UNKNOWN
 
Constructor Summary
protected GeneralAlgebra(java.lang.String name)
           
  GeneralAlgebra(java.lang.String name, java.util.Set univ)
           
  GeneralAlgebra(java.lang.String name, java.util.Set univ, java.util.List<Operation> operations)
           
 
Method Summary
 int cardinality()
           
 CongruenceLattice con()
           
 java.util.List constantOperations()
          This gives a list of the operations of arity 0, which is a little different from the constants.
 java.lang.String getDescription()
           
 ProgressReport getMonitor()
           
 java.lang.String getName()
           
 Operation getOperation(OperationSymbol sym)
          Get the operation correspond to a symbol or null if the symbol is not part of the similarityType.
 java.util.Map<OperationSymbol,Operation> getOperationsMap()
           
 int inputSize()
          The sum of the cardinality of the algebra raised to the arity of the operations.
 boolean isIdempotent()
          Test if all of the operations are idempotent.
 boolean isSimilarTo(Algebra alg2)
           
 boolean isTotal()
          This will fail only if there are some OperationWithDefaultValue's which are not total.
 boolean isUnary()
           
 java.util.Iterator iterator()
          returns the iterator of the universe.
 void makeOperationTables()
          Make operation tables to speed up the evaluation of operations at the cost using more space.
 boolean monitoring()
           
 java.util.List<Operation> operations()
           
 SmallAlgebra parent()
           
 java.util.List<SmallAlgebra> parents()
           
 void resetConAndSub()
          This does nothing but is overwritten for BasicAlgebra's.
 void setDescription(java.lang.String desc)
           
 void setMonitor(ProgressReport m)
           
 void setName(java.lang.String v)
           
protected  void setOperations(java.util.List<Operation> ops)
           
protected  void setUniverse(java.util.Set univ)
           
 SimilarityType similarityType()
           
 SubalgebraLattice sub()
           
 java.util.Set universe()
          We use java.util.Set to hold the universe of the algebra.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

operations

protected java.util.List<Operation> operations

operationsMap

protected java.util.Map<OperationSymbol,Operation> operationsMap

similarityType

protected SimilarityType similarityType

universe

protected java.util.Set universe

con

protected CongruenceLattice con

sub

protected SubalgebraLattice sub

name

protected java.lang.String name

description

protected java.lang.String description

size

protected int size

monitor

public static ProgressReport monitor
Constructor Detail

GeneralAlgebra

protected GeneralAlgebra(java.lang.String name)

GeneralAlgebra

public GeneralAlgebra(java.lang.String name,
                      java.util.Set univ)

GeneralAlgebra

public GeneralAlgebra(java.lang.String name,
                      java.util.Set univ,
                      java.util.List<Operation> operations)
Method Detail

setMonitor

public final void setMonitor(ProgressReport m)
Specified by:
setMonitor in interface Algebra

getMonitor

public final ProgressReport getMonitor()
Specified by:
getMonitor in interface Algebra

monitoring

public final boolean monitoring()
Specified by:
monitoring in interface Algebra

isTotal

public boolean isTotal()
Description copied from interface: Algebra
This will fail only if there are some OperationWithDefaultValue's which are not total.

Specified by:
isTotal in interface Algebra
Returns:

setUniverse

protected void setUniverse(java.util.Set univ)

setOperations

protected void setOperations(java.util.List<Operation> ops)

getOperationsMap

public java.util.Map<OperationSymbol,Operation> getOperationsMap()
Specified by:
getOperationsMap in interface Algebra

operations

public java.util.List<Operation> operations()
Specified by:
operations in interface Algebra

getOperation

public Operation getOperation(OperationSymbol sym)
Description copied from interface: Algebra
Get the operation correspond to a symbol or null if the symbol is not part of the similarityType.

Specified by:
getOperation in interface Algebra

isUnary

public boolean isUnary()
Specified by:
isUnary in interface Algebra

constantOperations

public java.util.List constantOperations()
This gives a list of the operations of arity 0, which is a little different from the constants.

Specified by:
constantOperations in interface Algebra

similarityType

public SimilarityType similarityType()
Specified by:
similarityType in interface Algebra

getName

public java.lang.String getName()
Specified by:
getName in interface Algebra

setName

public void setName(java.lang.String v)
Specified by:
setName in interface Algebra

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface Algebra

setDescription

public void setDescription(java.lang.String desc)
Specified by:
setDescription in interface Algebra

isSimilarTo

public boolean isSimilarTo(Algebra alg2)
Specified by:
isSimilarTo in interface Algebra

iterator

public java.util.Iterator iterator()
Description copied from interface: Algebra
returns the iterator of the universe. Since we allow that to be optional, this may throw an UnsupportedOperationException.

Specified by:
iterator in interface Algebra

cardinality

public int cardinality()
Specified by:
cardinality in interface Algebra
Returns:
the cardinality if possible, else a negative int

inputSize

public int inputSize()
Description copied from interface: Algebra
The sum of the cardinality of the algebra raised to the arity of the operations.

Specified by:
inputSize in interface Algebra
Returns:
the inputSize or -1 if it is not an int

universe

public java.util.Set universe()
Description copied from interface: Algebra
We use java.util.Set to hold the universe of the algebra. In order to accomodate infinite algebras and algebras with unknown cardinality, we allow the following changes:

Specified by:
universe in interface Algebra

con

public CongruenceLattice con()

sub

public SubalgebraLattice sub()

resetConAndSub

public void resetConAndSub()
This does nothing but is overwritten for BasicAlgebra's.


makeOperationTables

public void makeOperationTables()
Description copied from interface: Algebra
Make operation tables to speed up the evaluation of operations at the cost using more space.

Specified by:
makeOperationTables in interface Algebra
See Also:
Operation.makeTable

parent

public SmallAlgebra parent()

parents

public java.util.List<SmallAlgebra> parents()

isIdempotent

public boolean isIdempotent()
Description copied from interface: Algebra
Test if all of the operations are idempotent.

Specified by:
isIdempotent in interface Algebra


Copyright 2003 Ralph Freese. All Rights Reserved.