org.uacalc.alg
Class Subalgebra

java.lang.Object
  extended by org.uacalc.alg.GeneralAlgebra
      extended by org.uacalc.alg.Subalgebra
All Implemented Interfaces:
Algebra, SmallAlgebra

public class Subalgebra
extends GeneralAlgebra
implements SmallAlgebra

This class represents a subalgebra of a SmallAlgebra.

Version:
$Id: Subalgebra.java,v 1.9 2008/08/20 21:49:04 ralphfreese Exp $
Author:
Ralph Freese

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.uacalc.alg.SmallAlgebra
SmallAlgebra.AlgebraType
 
Field Summary
protected  SmallAlgebra superAlgebra
           
protected  int[] univArray
           
 
Fields inherited from class org.uacalc.alg.GeneralAlgebra
con, description, monitor, name, operations, operationsMap, similarityType, size, sub, universe
 
Fields inherited from interface org.uacalc.alg.Algebra
CARDINALITY_COUNTABLE, CARDINALITY_COUNTABLY_INFINITE, CARDINALITY_FINITE, CARDINALITY_INFINITE, CARDINALITY_UNKNOWN
 
Constructor Summary
Subalgebra(SmallAlgebra alg, int[] univ)
           
Subalgebra(SmallAlgebra alg, IntArray univ)
           
Subalgebra(java.lang.String name, SmallAlgebra alg, int[] univ)
          Form the subalgebra given the super algebra and the subuniverse.
Subalgebra(java.lang.String name, SmallAlgebra alg, IntArray univ)
           
 
Method Summary
 SmallAlgebra.AlgebraType algebraType()
          The type of algebra this is, like a quotient algebra.
 CongruenceLattice con()
          The congurence lattice.
static SmallAlgebra congruenceAsAlgebra(SmallAlgebra alg, Partition cong)
          This gives the congruence cong as a subalgebra of A^2.
static SmallAlgebra congruenceAsAlgebra(java.lang.String name, SmallAlgebra alg, Partition cong)
          This gives the congruence cong as a subalgebra of A^2.
 void convertToDefaultValueOps()
          This is used in the UI.
 int elementIndex(java.lang.Object obj)
          This method will return k if elem is the kth element; otherwise -1.
 java.lang.Object getElement(int index)
          returns the kth element.
 int[] getSubuniverseArray()
          Get the subuniverse of the super algebra for this algebra.
 java.util.List getUniverseList()
          The universe as a List such getElement(k) will equal the kth element of the List.
 java.util.Map getUniverseOrder()
          A map that can be used for elementIndex(a).
 int index(int k)
          Find the index in this subalgebra of the element with index k in the super algebra.
static void main(java.lang.String[] args)
           
 void makeOperationTables()
          Make operation tables to speed up the evaluation of operations at the cost using more space.
protected  java.util.Set makeUniverse()
           
 BasicPartition restrictPartition(Partition par)
          Restrict a partition (or congruence) on the parent algebra to this subalgebra.
 SubalgebraLattice sub()
          The subalgebra lattice.
 SmallAlgebra superAlgebra()
           
 java.util.Set universe()
          We use java.util.Set to hold the universe of the algebra.
 
Methods inherited from class org.uacalc.alg.GeneralAlgebra
cardinality, constantOperations, getDescription, getMonitor, getName, getOperation, getOperationsMap, inputSize, isIdempotent, isSimilarTo, isTotal, isUnary, iterator, monitoring, operations, parent, parents, resetConAndSub, setDescription, setMonitor, setName, setOperations, setUniverse, similarityType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.uacalc.alg.SmallAlgebra
parent, parents, resetConAndSub
 
Methods inherited from interface org.uacalc.alg.Algebra
cardinality, constantOperations, getDescription, getMonitor, getName, getOperation, getOperationsMap, inputSize, isIdempotent, isSimilarTo, isTotal, isUnary, iterator, monitoring, operations, setDescription, setMonitor, setName, similarityType
 

Field Detail

superAlgebra

protected final SmallAlgebra superAlgebra

univArray

protected final int[] univArray
Constructor Detail

Subalgebra

public Subalgebra(SmallAlgebra alg,
                  int[] univ)

Subalgebra

public Subalgebra(SmallAlgebra alg,
                  IntArray univ)

Subalgebra

public Subalgebra(java.lang.String name,
                  SmallAlgebra alg,
                  IntArray univ)

Subalgebra

public Subalgebra(java.lang.String name,
                  SmallAlgebra alg,
                  int[] univ)
Form the subalgebra given the super algebra and the subuniverse.

Method Detail

index

public int index(int k)
Find the index in this subalgebra of the element with index k in the super algebra. If k is not in the subalgebra, a negative number is returned.


restrictPartition

public BasicPartition restrictPartition(Partition par)
Restrict a partition (or congruence) on the parent algebra to this subalgebra.


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
Overrides:
makeOperationTables in class GeneralAlgebra
See Also:
Operation.makeTable

superAlgebra

public SmallAlgebra superAlgebra()

getSubuniverseArray

public int[] getSubuniverseArray()
Get the subuniverse of the super algebra for this algebra.


con

public CongruenceLattice con()
Description copied from interface: SmallAlgebra
The congurence lattice.

Specified by:
con in interface SmallAlgebra
Overrides:
con in class GeneralAlgebra

sub

public SubalgebraLattice sub()
Description copied from interface: SmallAlgebra
The subalgebra lattice.

Specified by:
sub in interface SmallAlgebra
Overrides:
sub in class GeneralAlgebra

elementIndex

public int elementIndex(java.lang.Object obj)
Description copied from interface: SmallAlgebra
This method will return k if elem is the kth element; otherwise -1. (Should we have it throw an error instead?)

Specified by:
elementIndex in interface SmallAlgebra

getElement

public java.lang.Object getElement(int index)
Description copied from interface: SmallAlgebra
returns the kth element.

Specified by:
getElement in interface SmallAlgebra

getUniverseList

public java.util.List getUniverseList()
Description copied from interface: SmallAlgebra
The universe as a List such getElement(k) will equal the kth element of the List. It is allowed to be null.

Specified by:
getUniverseList in interface SmallAlgebra

getUniverseOrder

public java.util.Map getUniverseOrder()
Description copied from interface: SmallAlgebra
A map that can be used for elementIndex(a). It is allowed to be null.

Specified by:
getUniverseOrder in interface SmallAlgebra

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
Overrides:
universe in class GeneralAlgebra

makeUniverse

protected java.util.Set makeUniverse()

congruenceAsAlgebra

public static SmallAlgebra congruenceAsAlgebra(SmallAlgebra alg,
                                               Partition cong)
This gives the congruence cong as a subalgebra of A^2.


congruenceAsAlgebra

public static SmallAlgebra congruenceAsAlgebra(java.lang.String name,
                                               SmallAlgebra alg,
                                               Partition cong)
This gives the congruence cong as a subalgebra of A^2.


convertToDefaultValueOps

public void convertToDefaultValueOps()
Description copied from interface: SmallAlgebra
This is used in the UI. Only valid for BASIC algebras.

Specified by:
convertToDefaultValueOps in interface SmallAlgebra

algebraType

public SmallAlgebra.AlgebraType algebraType()
Description copied from interface: SmallAlgebra
The type of algebra this is, like a quotient algebra.

Specified by:
algebraType in interface SmallAlgebra
Returns:

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException,
                        BadAlgebraFileException
Throws:
java.io.IOException
BadAlgebraFileException


Copyright 2003 Ralph Freese. All Rights Reserved.