/** * Get a scripting compatible string representation. * * @return script compatible representation for this Element. * @see edu.jas.structure.Element#toScript() */ @Override public String toScript() { StringBuffer s = new StringBuffer(); switch (Scripting.getLang()) { case Ruby: s.append("SolvPolyRing.new("); break; case Python: default: s.append("SolvPolyRing("); } if (coFac instanceof RingElem) { s.append(((RingElem<C>) coFac).toScriptFactory()); } else { s.append(coFac.toScript().trim()); } s.append(",\"" + varsToString() + "\","); String to = tord.toString(); if (tord.getEvord() == TermOrder.INVLEX) { to = "PolyRing.lex"; } if (tord.getEvord() == TermOrder.IGRLEX) { to = "PolyRing.grad"; } s.append(to); if (table.size() > 0) { String rel = table.toScript(); s.append(",rel="); s.append(rel); } s.append(")"); return s.toString(); }
/** * Get the String representation. * * @see java.lang.Object#toString() */ @Override public String toString() { String res = super.toString(); if (PrettyPrint.isTrue()) { res += "\n" + table.toString(vars); } else { res += ", #rel = " + table.size(); } return res; }
/** * Hash code for this polynomial ring. * * @see java.lang.Object#hashCode() */ @Override public int hashCode() { int h; h = super.hashCode(); h = 37 * h + table.hashCode(); return h; }
/** * Query if this ring is commutative. * * @return true if this ring is commutative, else false. */ @Override public boolean isCommutative() { if (table.size() == 0) { return super.isCommutative(); } // todo: check structure of relations return false; }
/** * Comparison with any other object. * * @see java.lang.Object#equals(java.lang.Object) */ @Override @SuppressWarnings("unchecked") public boolean equals(Object other) { if (!(other instanceof GenSolvablePolynomialRing)) { return false; } GenSolvablePolynomialRing<C> oring = null; try { oring = (GenSolvablePolynomialRing<C>) other; } catch (ClassCastException ignored) { } if (oring == null) { return false; } // do a super.equals( ) if (!super.equals(other)) { return false; } // check same base relations if (!table.equals(oring.table)) { return false; } return true; }
/** * Generate the relation table of the solvable polynomial ring from a solvable polynomial list of * relations. * * @param rel solvable polynomial list of relations [..., ei, fj, pij, ... ] with ei * fj = pij. */ public void addSolvRelations(List<GenSolvablePolynomial<C>> rel) { table.addSolvRelations(rel); }
/** * Generate the relation table of the solvable polynomial ring from a polynomial list of * relations. * * @param rel polynomial list of relations [..., ei, fj, pij, ... ] with ei * fj = pij. */ public void addRelations(List<GenPolynomial<C>> rel) { table.addRelations(rel); }