Word
edu.jas.poly

Class Word

    • Field Detail

      • mono

        public final WordFactory mono
        Defining alphabet in WordFactory.
    • Constructor Detail

      • Word

        public Word(WordFactory m)
        Constructor for Word.
        Parameters:
        m - factory for words.
      • Word

        public Word(WordFactory m,    String s)
        Constructor for Word.
        Parameters:
        m - factory for words.
        s - String
      • Word

        public Word(WordFactory m,    String s,    boolean translate)
        Constructor for Word.
        Parameters:
        m - factory for words.
        s - String
        translate - indicator if s needs translation
    • Method Detail

      • copy

        public Word copy()
        Copy this.
        Specified by:
        copy in interface Element<Word>
        Returns:
        copy of this.
      • getVal

        public char getVal(int i)
        Get the letter at position i.
        Parameters:
        i - position.
        Returns:
        val[i].
      • length

        public int length()
        Get the length of this word.
        Returns:
        val.length.
      • toScript

        public String toScript()
        Get a scripting compatible string representation.
        Specified by:
        toScript in interface Element<Word>
        Returns:
        script compatible representation for this Element.
        See Also:
        Element.toScript()
      • isONE

        public boolean isONE()
        Is Word one.
        Specified by:
        isONE in interface MonoidElem<Word>
        Returns:
        If this is the empty word then true is returned, else false.
      • isUnit

        public boolean isUnit()
        Is Word unit.
        Specified by:
        isUnit in interface MonoidElem<Word>
        Returns:
        If this is a unit then true is returned, else false.
      • multiply

        public Word multiply(Word V)
        Word multiplication.
        Specified by:
        multiply in interface MonoidElem<Word>
        Parameters:
        V - other word.
        Returns:
        this * V.
      • divide

        public Word divide(Word V)
        Word divide.
        Specified by:
        divide in interface MonoidElem<Word>
        Parameters:
        V - other word.
        Returns:
        this / V.
      • divideWord

        public Word[] divideWord(Word V)
        Word divide with prefix and suffix.
        Parameters:
        V - other word.
        Returns:
        [prefix(this/V), suffix(this/V)] = [left,right] with left * V * right = this.
      • remainder

        public Word remainder(Word V)
        Word remainder.
        Specified by:
        remainder in interface MonoidElem<Word>
        Parameters:
        V - other word.
        Returns:
        this (this/V). Note: not useful.
      • quotientRemainder

        public Word[] quotientRemainder(Word S)
        Quotient and remainder by division of this by S.
        Parameters:
        S - a Word
        Returns:
        [this/S, this - (this/S)*S]. Note: not useful.
      • signum

        public int signum()
        Word signum.
        Returns:
        0 if this is one, 1 if it is non empty.
      • degree

        public long degree()
        Word degree.
        Returns:
        total degree of all letters.
      • dependencyOnVariables

        public SortedMap<String,Integer> dependencyOnVariables()
        Word dependency on letters.
        Returns:
        sorted map of letters and the number of its occurences.
      • multipleOf

        public boolean multipleOf(Word V)
        Word multiple test.
        Parameters:
        V - other word.
        Returns:
        true if this is a multiple of V, else false.
      • divides

        public boolean divides(Word V)
        Word divides test.
        Parameters:
        V - other word.
        Returns:
        true if this divides V, else false.
      • compareTo

        public int compareTo(Word V)
        Word compareTo. Uses
         String.compareTo 
        .
        Specified by:
        compareTo in interface Element<Word>
        Specified by:
        compareTo in interface Comparable<Word>
        Parameters:
        V - other word.
        Returns:
        0 if U == V, -1 if U < V, 1 if U > V.
      • gradCompareTo

        public int gradCompareTo(Word V)
        Word graded comparison. Compares first be degree, then lexicographical.
        Parameters:
        V - other word.
        Returns:
        0 if U == V, -1 if U < V, 1 if U > V.
      • gradInvlexCompareTo

        public int gradInvlexCompareTo(Word V)
        Word graded comparison. Compares first be degree, then inverse lexicographical.
        Parameters:
        V - other word.
        Returns:
        0 if U == V, -1 if U < V, 1 if U > V.
      • isOverlap

        public boolean isOverlap(Overlap ol,                Word V)
        Is word overlap.
        Parameters:
        ol - = [l1,r1,l2,r2] an Overlap container of four words
        V - word
        Returns:
        true if l1 * this * r1 = l2 * V * r2, else false.
      • overlap

        public OverlapList overlap(Word V)
        Word overlap list.
        Parameters:
        V - other word.
        Returns:
        list of overlaps [l1,r1,l2,r2] with l1 * this * r1 = l2 * V * r2. If no such overlaps exist the empty overlap list is returned.
      • lcm

        public Word lcm(Word V)
        Word pseudo least common multiple.
        Parameters:
        V - other word.
        Returns:
        w = l1*this*r1, with l1*this*r1 == l2*V*r2, if l1, r1, l2, r2 exist, else null is returned.

SCaVis 2.0 © jWork.ORG