001 /* 002 * $Id: AlgebraicNotInvertibleException.java 3472 2011-01-07 17:19:22Z kredel $ 003 */ 004 005 package edu.jas.poly; 006 007 008 import edu.jas.structure.NotInvertibleException; 009 010 011 /** 012 * Algebraic number NotInvertibleException class. 013 * Runtime Exception to be thrown for not invertible algebraic numbers. 014 * Container for the non-trivial factors found by the inversion algorithm. 015 * <b>Note: </b> cannot be generic because of Throwable. 016 * @author Heinz Kredel 017 */ 018 public class AlgebraicNotInvertibleException extends NotInvertibleException { 019 020 021 public final GenPolynomial f; // = f1 * f2 022 023 public final GenPolynomial f1; 024 025 public final GenPolynomial f2; 026 027 028 public AlgebraicNotInvertibleException() { 029 this(null,null,null); 030 } 031 032 033 public AlgebraicNotInvertibleException(String c) { 034 this(c,null,null,null); 035 } 036 037 038 public AlgebraicNotInvertibleException(String c, Throwable t) { 039 this(c,t,null,null,null); 040 } 041 042 043 public AlgebraicNotInvertibleException(Throwable t) { 044 this(t,null,null,null); 045 } 046 047 048 /** 049 * Constructor. 050 * @param f polynomial with f = f1 * f2. 051 * @param f1 polynomial. 052 * @param f2 polynomial. 053 */ 054 public AlgebraicNotInvertibleException(GenPolynomial f, GenPolynomial f1, GenPolynomial f2) { 055 super("AlgebraicNotInvertibleException"); 056 this.f = f; 057 this.f1 = f1; 058 this.f2 = f2; 059 } 060 061 062 /** 063 * Constructor. 064 * @param f polynomial with f = f1 * f2. 065 * @param f1 polynomial. 066 * @param f2 polynomial. 067 */ 068 public AlgebraicNotInvertibleException(String c, GenPolynomial f, GenPolynomial f1, GenPolynomial f2) { 069 super(c); 070 this.f = f; 071 this.f1 = f1; 072 this.f2 = f2; 073 } 074 075 076 /** 077 * Constructor. 078 * @param f polynomial with f = f1 * f2. 079 * @param f1 polynomial. 080 * @param f2 polynomial. 081 */ 082 public AlgebraicNotInvertibleException(String c, Throwable t, GenPolynomial f, GenPolynomial f1, GenPolynomial f2) { 083 super(c,t); 084 this.f = f; 085 this.f1 = f1; 086 this.f2 = f2; 087 } 088 089 090 /** 091 * Constructor. 092 * @param f polynomial with f = f1 * f2. 093 * @param f1 polynomial. 094 * @param f2 polynomial. 095 */ 096 public AlgebraicNotInvertibleException(Throwable t, GenPolynomial f, GenPolynomial f1, GenPolynomial f2) { 097 super("AlgebraicNotInvertibleException",t); 098 this.f = f; 099 this.f1 = f1; 100 this.f2 = f2; 101 } 102 103 104 /** 105 * Get the String representation. 106 * @see java.lang.Object#toString() 107 */ 108 @Override 109 public String toString() { 110 String s = super.toString(); 111 if ( f != null || f1 != null || f2 != null) { 112 s += ", f = " + f + ", f1 = " + f1 + ", f2 = " + f2; 113 } 114 return s; 115 } 116 117 }