001    /*
002     * $Id: MonoidElem.java 1708 2008-02-24 17:28:36Z kredel $
003     */
004    
005    package edu.jas.structure;
006    
007    
008    /**
009     * Monoid element interface.
010     * Defines the multiplicative methods.
011     * @param <C> element type
012     * @author Heinz Kredel
013     */
014    
015    public interface MonoidElem<C extends MonoidElem<C>> 
016                     extends Element<C> {
017    
018    
019        /**
020         * Test if this is one.
021         * @return true if this is 1, else false.
022         */
023        public boolean isONE();
024    
025    
026        /**
027         * Test if this is a unit. 
028         * I.e. there exists x with this.multiply(x).isONE() == true.
029         * @return true if this is a unit, else false.
030         */
031        public boolean isUnit();
032    
033    
034        /**
035         * Multiply this with S.
036         * @param S
037         * @return this * S.
038         */
039        public C multiply(C S);
040    
041    
042        /**
043         * Divide this by S.
044         * @param S
045         * @return this / S.
046         */
047        public C divide(C S);
048    
049    
050        /**
051         * Remainder after division of this by S.
052         * @param S
053         * @return this - (this / S) * S.
054         */
055        public C remainder(C S);
056    
057    
058        /**
059         * Inverse of this.
060         * Some implementing classes will throw NotInvertibleException if the element is not invertible.
061         * @return x with this * x = 1, if it exists.
062         */
063        public C inverse() /*throws NotInvertibleException*/;
064    
065    }