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