001 /*
002 * $Id: IdealWithRealRoots.java 3111 2010-05-05 21:05:56Z kredel $
003 */
004
005 package edu.jas.application;
006
007
008 import java.io.Serializable;
009 import java.util.List;
010
011 import edu.jas.arith.BigDecimal;
012 import edu.jas.poly.GenPolynomial;
013 import edu.jas.structure.GcdRingElem;
014
015
016 /**
017 * Container for Ideals together with univariate polynomials and real roots.
018 * @author Heinz Kredel
019 */
020 public class IdealWithRealRoots<C extends GcdRingElem<C>> extends IdealWithUniv<C> implements Serializable {
021
022
023 /**
024 * The list of real roots.
025 */
026 public final List<List<BigDecimal>> rroots;
027
028
029 /**
030 * Constructor not for use.
031 */
032 protected IdealWithRealRoots() {
033 throw new IllegalArgumentException("do not use this constructor");
034 }
035
036
037 /**
038 * Constructor.
039 * @param id the ideal
040 * @param up the list of univaraite polynomials
041 * @param rr the list of real roots
042 */
043 public IdealWithRealRoots(Ideal<C> id, List<GenPolynomial<C>> up, List<List<BigDecimal>> rr) {
044 super(id, up);
045 rroots = rr;
046 }
047
048
049 /**
050 * Constructor.
051 * @param iu the ideal with univariate polynomials
052 * @param rr the list of real roots
053 */
054 public IdealWithRealRoots(IdealWithUniv<C> iu, List<List<BigDecimal>> rr) {
055 super(iu.ideal, iu.upolys);
056 rroots = rr;
057 }
058
059
060 /**
061 * String representation of the ideal.
062 * @see java.lang.Object#toString()
063 */
064 @Override
065 public String toString() {
066 return super.toString() + "\nreal roots: " + rroots.toString();
067 }
068
069
070 /**
071 * Get a scripting compatible string representation.
072 * @return script compatible representation for this Element.
073 * @see edu.jas.structure.Element#toScript()
074 */
075 @Override
076 public String toScript() {
077 // Python case
078 return super.toScript() + ", " + rroots.toString();
079 }
080
081 }