package jsci.maths.groups;

/**
* The CyclicGroup class represents the nth cyclic group.
* Elements are represented by the integers mod n.
* @jsci.planetmath CyclicGroup
* @version 1.4
* @author Mark Hale
*/
public final class CyclicGroup extends FiniteGroup implements AbelianGroup {
        /**
        * The zero element.
        */
        private final Member ZERO;
        /**
        * Constructs a cyclic group.
        * @param n the order of the group
        */
        public CyclicGroup(int n) {
                super(n);
                ZERO = new Member(0);
        }
        /**
        * Returns true if this group is isomorphic to another.
        */
        public boolean equals(Object o) {
                return (o instanceof CyclicGroup) && (((CyclicGroup)o).order == order);
        }
	public int hashCode() {
		return order;
	}
        public String toString() {
                return "Z_"+order;
        }
        /**
        * Returns an element from the group.
        * @param i the integer representing the element
        */
        public Member getElement(int i) {
                return new Member(i);
        }
        /**
        * Returns the elements of this group.
        */
        public Group.Member[] getElements() {
                Group.Member elements[] = new Group.Member[order];
                for(int i=0; i 

Ads help maintain this website.