cayleytable
Class groupMatrix

java.lang.Object
  extended by cayleytable.groupMatrix

public class groupMatrix
extends java.lang.Object

Class used as a storage device for all groups. Stores the Cayley table as an ArrayList of ArrayList of Strings where each row in the table is one of the ArrayList of Strings and each cell is represented by one String. The class also has analysis functions to determine if the Cayley Table has group characteristics such as an Identity element, inverse for each element, and associativity.

Author:
Jeffrey Barr

Field Summary
private  java.util.ArrayList<java.util.ArrayList<java.lang.String>> matrixRows
          ArrayList of ArrayList of Strings used for storing the Cayley Table where each row in the table is one of the ArrayList of Strings and each cell is represented by one String.
private  int order
          Order of the group being stored refers to the number of rows and columns in the Cayley Table.
 
Constructor Summary
groupMatrix()
          Creates a new instance of groupMatrix with an empty Cayley Table (order 0).
groupMatrix(int n)
          Creates a new instance of groupMatrix with a Cayley Table of a specific given order.
 
Method Summary
private  boolean checkArray(int[] values, int size)
          Method to check if a given array has a unique set of elements that never repeat.
 boolean checkComplete()
          Method to determine if all of the cells in the Cayley Table have a value.
 boolean checkForIdentity()
          Method to determine if the Cayley Table contains an identity element
 boolean checkForInverse()
          Method to determine if all elements in the Cayley Table have an inverse element.
 boolean checkForUniquenessInRowAndCol()
          Method to determine if all rows and columns in the Cayley Table have unique elements for each cell in the row or column.
 boolean checkIfAssociative()
          Method to determine if all operations in the Cayley Table are associative.
 boolean checkIfCommutative()
          Method to determine if all operations in the Cayley Table are commutative.
 int findIdentity()
          Method to determine the identity element of the group stored in the Cayley Table.
 int findInverse(int element)
          Method to return inverse of an element in the group
 int getEntry(int row, int col)
          Method to get the value of a specific cell in the Cayley Table.
 int getOrder()
          Method to return value of order in this instance of groupMatrix
 boolean isEqual(groupMatrix check)
          Method to determine if another groupMatrix object is equal to the current group stored in this groupMatrix instance.
 void resetGroup(groupMatrix reset)
          Method to update the matrixRows and order of the current group with the values from a new groupMatrix object.
 void resetSize(int size)
          Method to reset the groupMatrix object to an Cayley Table of a given order filled with all -1 values.
 void setEntry(int row, int col, int value)
          Method to set the value of a specific cell in the Cayley Table to a given value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

matrixRows

private java.util.ArrayList<java.util.ArrayList<java.lang.String>> matrixRows
ArrayList of ArrayList of Strings used for storing the Cayley Table where each row in the table is one of the ArrayList of Strings and each cell is represented by one String.


order

private int order
Order of the group being stored refers to the number of rows and columns in the Cayley Table.

Constructor Detail

groupMatrix

public groupMatrix()
Creates a new instance of groupMatrix with an empty Cayley Table (order 0).


groupMatrix

public groupMatrix(int n)
Creates a new instance of groupMatrix with a Cayley Table of a specific given order.

Parameters:
n - Order of group to create.
Method Detail

resetGroup

public void resetGroup(groupMatrix reset)
Method to update the matrixRows and order of the current group with the values from a new groupMatrix object.

Parameters:
reset - groupMatrix object that contains new group to update the current group.

isEqual

public boolean isEqual(groupMatrix check)
Method to determine if another groupMatrix object is equal to the current group stored in this groupMatrix instance.

Parameters:
check - groupMatrix object to compare to this instance.
Returns:
Boolean value whose result determines if the two groups being compared are equal.

resetSize

public void resetSize(int size)
Method to reset the groupMatrix object to an Cayley Table of a given order filled with all -1 values.

Parameters:
size - New order of the Cayley Table.

setEntry

public void setEntry(int row,
                     int col,
                     int value)
Method to set the value of a specific cell in the Cayley Table to a given value.

Parameters:
row - integer containing row of the cell to change in the Cayley Table
col - integer containing column of the cell to change in the Cayley Table
value - integer containing new value of the cell stored in the Cayley Table

getEntry

public int getEntry(int row,
                    int col)
Method to get the value of a specific cell in the Cayley Table.

Parameters:
row - integer containing row of the cell to retrieve in the Cayley Table
col - integer containing column of the cell to retrieve in the Cayley Table
Returns:
integer containing value of the cell retrieved from the Cayley Table

checkComplete

public boolean checkComplete()
Method to determine if all of the cells in the Cayley Table have a value. Does not determine if the values are legal (0 to order-1).

Returns:
Boolean with result of the check

getOrder

public int getOrder()
Method to return value of order in this instance of groupMatrix

Returns:
integer value containing order of the Cayley Table.

findIdentity

public int findIdentity()
Method to determine the identity element of the group stored in the Cayley Table.

Returns:
integer value of the identity element

findInverse

public int findInverse(int element)
Method to return inverse of an element in the group

Parameters:
element - integer element in group of which to find inverse
Returns:
integer value of the inverse

checkForIdentity

public boolean checkForIdentity()
Method to determine if the Cayley Table contains an identity element

Returns:
Boolean result of the check

checkForInverse

public boolean checkForInverse()
Method to determine if all elements in the Cayley Table have an inverse element.

Returns:
Boolean result of the check

checkIfAssociative

public boolean checkIfAssociative()
Method to determine if all operations in the Cayley Table are associative.

Returns:
Boolean result of the check

checkIfCommutative

public boolean checkIfCommutative()
Method to determine if all operations in the Cayley Table are commutative.

Returns:
Boolean result of the check

checkForUniquenessInRowAndCol

public boolean checkForUniquenessInRowAndCol()
Method to determine if all rows and columns in the Cayley Table have unique elements for each cell in the row or column.

Returns:
Boolean result of the check

checkArray

private boolean checkArray(int[] values,
                           int size)
Method to check if a given array has a unique set of elements that never repeat.

Parameters:
values - Array of integers that is being checked.
size - integer size of array being checked
Returns:
Boolean result of the check