KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > lsmp > djep > groupJep > values > FreeGroupElement


1 /* @author rich
2  * Created on 09-Mar-2004
3  *
4  * This code is covered by a Creative Commons
5  * Attribution, Non Commercial, Share Alike license
6  * <a HREF="http://creativecommons.org/licenses/by-nc-sa/1.0">License</a>
7  */

8 package org.lsmp.djep.groupJep.values;
9
10 import org.lsmp.djep.groupJep.groups.FreeGroup;
11 import org.nfunk.jep.type.*;
12
13 /**
14  * An element of a free group with one generator.
15  *
16  * @see org.lsmp.djep.groupJep.groups.FreeGroup
17  * @author Rich Morris
18  * Created on 09-Mar-2004
19  */

20 public class FreeGroupElement extends Polynomial implements HasComplexValueI {
21
22     FreeGroup group;
23
24     /**
25      * An element of a free group with one generator.
26      * @param the free group.
27      * @param coeffs array of coeficients for this element c0 + c1 t + ... + cn t^n
28      */

29     public FreeGroupElement(FreeGroup K, Number JavaDoc coeffs[]) {
30         super(K.getBaseRing(),K.getSymbol(),coeffs);
31         this.group = K;
32     }
33
34 // public AlgebraicNumber(RingI baseRing,Polynomial poly,Number coeffs[]) {
35
// this(new AlgebraicExtension(baseRing,poly),coeffs);
36
// }
37

38     /** sub classes should overright this to make the correct type. */
39     protected Polynomial valueOf(Number JavaDoc lcoeffs[])
40     {
41         FreeGroupElement g = new FreeGroupElement(group,lcoeffs);
42         return g;
43     }
44
45     /** Returns an aproximation to the complex number representing this algebraic number.
46      * This only gives meaningful results if setRootValue has been called
47      * or if it is a quadratic extension (t^2+b t+c) or if it is a simple n-th root (t^n+a).
48      * In the last two cases the root value is calculated automatically.
49      * @return Complex(Nan) if I dont know how to calculate it. */

50
51     public Complex getComplexValue() {
52             return calculateComplexValue((Complex) group.getRootVal());
53     }
54 }
55
Popular Tags