001/*
002 * $Id: PairList.java 5322 2015-11-23 21:38:46Z kredel $
003 */
004
005package edu.jas.gb;
006
007import java.util.List;
008import java.io.Serializable;
009
010import edu.jas.structure.RingElem;
011import edu.jas.poly.ExpVector;
012import edu.jas.poly.TermOrder;
013import edu.jas.poly.GenPolynomial;
014import edu.jas.poly.GenPolynomialRing;
015
016
017/**
018 * Pair list management interface.
019 * @author Heinz Kredel
020 */
021
022public interface PairList<C extends RingElem<C> > extends Serializable {
023
024
025    /**
026     * Create a new PairList.
027     * @param r polynomial ring.
028     */
029    public PairList<C> create(GenPolynomialRing<C> r);
030
031
032    /**
033     * Create a new PairList.
034     * @param m number of module variables.
035     * @param r polynomial ring.
036     */
037    public PairList<C> create(int m, GenPolynomialRing<C> r);
038
039
040    /**
041     * toString.
042     */
043    @Override
044    public String toString();
045
046
047    /**
048     * Put one Polynomial to the pairlist and reduction matrix.
049     * @param p polynomial.
050     * @return the index of the added polynomial.
051     */
052    public int put(GenPolynomial<C> p);
053
054
055    /**
056     * Put all polynomials in F to the pairlist and reduction matrix.
057     * @param F polynomial list.
058     * @return the index of the last added polynomial.
059     */
060    public int put(List<GenPolynomial<C>> F);
061
062
063    /**
064     * Put to ONE-Polynomial to the pairlist.
065     * @return the index of the last polynomial.
066     */
067    public int putOne();
068
069
070    /**
071     * Remove the next required pair from the pairlist and reduction matrix.
072     * Appy the criterions 3 and 4 to see if the S-polynomial is required.
073     * @return the next pair if one exists, otherwise null.
074     */
075    public Pair<C> removeNext();
076
077
078    /**
079     * Test if there is possibly a pair in the list.
080     * @return true if a next pair could exist, otherwise false.
081     */
082    public boolean hasNext();
083
084
085    /**
086     * Get the size of the list of polynomials.
087     * @return size of the polynomial list.
088     */
089    public int size();
090
091
092    /**
093     * Get the list of polynomials.
094     * @return the polynomial list.
095     */
096    public List<GenPolynomial<C>> getList();
097
098
099    /**
100     * Set the list of polynomials.
101     * @param F the polynomial list.
102     */
103    public void setList(List<GenPolynomial<C>> F);
104
105
106    /**
107     * Get the number of polynomials put to the pairlist.
108     * @return the number of calls to put.
109     */
110    public int putCount();
111
112
113    /**
114     * Get the number of required pairs removed from the pairlist.
115     * @return the number of non null pairs delivered.
116     */
117    public int remCount();
118
119
120    /**
121     * GB criterium 3.
122     * @return true if the S-polynomial(i,j) is required.
123     */
124    public boolean criterion3(int i, int j, ExpVector eij);
125
126}
127