com.google.zxing.common.reedsolomon

## Class GenericGFPoly

- java.lang.Object
- - com.google.zxing.common.reedsolomon.GenericGFPoly

-     final class GenericGFPoly
      extends Object

  Represents a polynomial whose coefficients are elements of a GF. Instances of this class are immutable.

  Much credit is due to William Rucklidge since portions of this code are an indirect port of his C++ Reed-Solomon implementation.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GenericGFPoly(GenericGF field, int[] coefficients)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) GenericGFPoly` | `addOrSubtract(GenericGFPoly other)`
    `(package private) GenericGFPoly[]` | `divide(GenericGFPoly other)`
    `(package private) int` | `evaluateAt(int a)`
    `(package private) int` | `getCoefficient(int degree)`
    `(package private) int[]` | `getCoefficients()`
    `(package private) int` | `getDegree()`
    `(package private) boolean` | `isZero()`
    `(package private) GenericGFPoly` | `multiply(GenericGFPoly other)`
    `(package private) GenericGFPoly` | `multiply(int scalar)`
    `(package private) GenericGFPoly` | `multiplyByMonomial(int degree, int coefficient)`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### GenericGFPoly

          GenericGFPoly(GenericGF field,
                        int[] coefficients)

      Parameters:
        `field` - the `GenericGF` instance representing the field to use to perform computations
        `coefficients` - coefficients as ints representing elements of GF(size), arranged from most significant (highest-power term) coefficient to least significant
      Throws:
        `IllegalArgumentException` - if argument is null or empty, or if leading coefficient is 0 and this is not a constant polynomial (that is, it is not the monomial "0")

  - ### Method Detail

    - #### addOrSubtract

          GenericGFPoly addOrSubtract(GenericGFPoly other)

    - #### divide

          GenericGFPoly[] divide(GenericGFPoly other)

    - #### evaluateAt

          int evaluateAt(int a)

      Returns:
        evaluation of this polynomial at a given point

    - #### getCoefficient

          int getCoefficient(int degree)

      Returns:
        coefficient of x^degree term in this polynomial

    - #### getCoefficients

          int[] getCoefficients()

    - #### getDegree

          int getDegree()

      Returns:
        degree of this polynomial

    - #### isZero

          boolean isZero()

      Returns:
        true iff this polynomial is the monomial "0"

    - #### multiply

          GenericGFPoly multiply(GenericGFPoly other)

    - #### multiply

          GenericGFPoly multiply(int scalar)

    - #### multiplyByMonomial

          GenericGFPoly multiplyByMonomial(int degree,
                                           int coefficient)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`