589590591592593594595596597598599
NaturalNumber n; Expression c, c0; for (Expression t : terms) { if (pt.matches(t)) { n = pt.exponent(); c = pt.coefficient(); } else { throw new IllegalArgumentException( String.format("Illegal polynomial term: %s (%s)", t, t.getClass())); }