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