package jsci.maths.groups;

/**
* The DihedralGroup class represents the nth dihedral group.
* Elements are represented by rotations and reflections.
* @jsci.planetmath DihedralGroup
* @version 1.4
* @author Mark Hale
*/
public final class DihedralGroup extends FiniteGroup {
        /**
        * The number of rotations/reflections.
        */
        private final int n;
        /**
        * The identity element.
        */
        private final Member ONE;
        /**
        * Constructs a dihedral group.
        * @param n the number of rotations/reflections
        */
        public DihedralGroup(int n) {
                super(2*n);
                this.n = n;
                ONE = new Member(0, false);
        }
        /**
        * Returns true if this group is isomorphic to another.
        */
        public boolean equals(Object o) {
                return (o instanceof DihedralGroup) && (((DihedralGroup)o).order == order);
        }
	public int hashCode() {
		return order;
	}
        public String toString() {
                return "D_"+n;
        }
        /**
        * 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.