JSci.maths.groups
Class CyclicGroup

java.lang.Object
  extended by JSci.maths.groups.FiniteGroup
      extended by JSci.maths.groups.CyclicGroup
All Implemented Interfaces:
AbelianGroup, Group, Monoid

public final class CyclicGroup
extends FiniteGroup
implements AbelianGroup

The CyclicGroup class represents the nth cyclic group. Elements are represented by the integers mod n.

PlanetMath references:
CyclicGroup

Nested Class Summary
(package private)  class CyclicGroup.Member
           
 
Field Summary
 
Fields inherited from class JSci.maths.groups.FiniteGroup
order
 
Constructor Summary
CyclicGroup(int n)
          Constructs a cyclic group.
 
Method Summary
 boolean equals(java.lang.Object o)
          Returns true if this group is isomorphic to another.
 CyclicGroup.Member getElement(int i)
          Returns an element from the group.
 Group.Member[] getElements()
          Returns the elements of this group.
 int hashCode()
           
 Monoid.Member identity()
          Returns the identity element.
 boolean isIdentity(Monoid.Member g)
          Returns true if the member is the identity element of this group.
 boolean isInverse(Group.Member a, Group.Member b)
          Returns true if one member is the inverse of the other.
 boolean isNegative(AbelianGroup.Member a, AbelianGroup.Member b)
          Returns true if one member is the negative (inverse) of the other.
 boolean isZero(AbelianGroup.Member g)
          Returns true if the member is the identity element of this group.
 java.lang.String toString()
           
 AbelianGroup.Member zero()
          Returns the identity element.
 
Methods inherited from class JSci.maths.groups.FiniteGroup
order
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CyclicGroup

public CyclicGroup(int n)
Constructs a cyclic group.

Parameters:
n - the order of the group
Method Detail

equals

public boolean equals(java.lang.Object o)
Returns true if this group is isomorphic to another.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getElement

public CyclicGroup.Member getElement(int i)
Returns an element from the group.

Parameters:
i - the integer representing the element

getElements

public Group.Member[] getElements()
Returns the elements of this group.

Specified by:
getElements in class FiniteGroup

zero

public AbelianGroup.Member zero()
Returns the identity element.

Specified by:
zero in interface AbelianGroup

isZero

public boolean isZero(AbelianGroup.Member g)
Returns true if the member is the identity element of this group.

Specified by:
isZero in interface AbelianGroup
Parameters:
g - a group member

isNegative

public boolean isNegative(AbelianGroup.Member a,
                          AbelianGroup.Member b)
Returns true if one member is the negative (inverse) of the other.

Specified by:
isNegative in interface AbelianGroup
Parameters:
a - a group member
b - a group member

identity

public Monoid.Member identity()
Returns the identity element.

Specified by:
identity in interface Monoid

isIdentity

public boolean isIdentity(Monoid.Member g)
Returns true if the member is the identity element of this group.

Specified by:
isIdentity in interface Monoid
Parameters:
g - a group member

isInverse

public boolean isInverse(Group.Member a,
                         Group.Member b)
Returns true if one member is the inverse of the other.

Specified by:
isInverse in interface Group
Parameters:
a - a group member
b - a group member