Package flanagan.complex

Examples of flanagan.complex.Complex


                this.phaseInRad = ph2.phaseInRad;
        }

        // Add complex number to this Phasor and replace this with the sum
        public void plusEquals(Complex com1 ){
                Complex com2 = this.toRectangular();
                Complex com3 = com1.plus(com2);
                Phasor ph2 = Phasor.toPhasor(com3);
                this.magnitude += ph2.magnitude;
                this.phaseInDeg += ph2.phaseInDeg;
                this.phaseInRad += ph2.phaseInRad;
        }
View Full Code Here


        // SUBTRACTION

        // Subtract a Phasor from this Phasor
        // this Phasor remains unaltered
        public Phasor minus(Phasor ph){
                Complex com1 = this.toRectangular();
                Complex com2 = ph.toRectangular();
                Complex com3 = com1.minus(com2);
                return Phasor.toPhasor(com3);
        }
View Full Code Here

        // Subtract a complex number from this Phasor
        // this Phasor remains unaltered
        public Phasor minus(Complex com1){
                Phasor ph = new Phasor();
                Complex com2 = this.toRectangular();
                Complex com3 = com1.minus(com2);
                return Phasor.toPhasor(com3);
        }
View Full Code Here

                return Phasor.toPhasor(com3);
        }

       // Subtract a Phasor from this Phasor and replace this with the difference
        public void minusEquals(Phasor ph1 ){
                Complex com1 = this.toRectangular();
                Complex com2 = ph1.toRectangular();
                Complex com3 = com1.plus(com2);
                Phasor ph2 = Phasor.toPhasor(com3);
                this.magnitude = ph2.magnitude;
                this.phaseInDeg = ph2.phaseInDeg;
                this.phaseInRad = ph2.phaseInRad;
        }
View Full Code Here

                this.phaseInRad = ph2.phaseInRad;
        }

        // Subtract a complex number from this Phasor and replace this with the difference
        public void minusEquals(Complex com1 ){
                Complex com2 = this.toRectangular();
                Complex com3 = com1.plus(com2);
                Phasor ph2 = Phasor.toPhasor(com3);
                this.magnitude = ph2.magnitude;
                this.phaseInDeg = ph2.phaseInDeg;
                this.phaseInRad = ph2.phaseInRad;
        }
View Full Code Here

                return ph2;
        }

        // nth power of a Phasor - Complex n
        public static Phasor pow(Phasor ph1, Complex n){
                Complex com1 = ph1.toRectangular();
                Complex com2 = Complex.pow(com1, n);
                Phasor ph2 = Phasor.toPhasor(com2);
                return ph2;
        }
View Full Code Here

                return ph2;
        }

        // nth power of a Phasor - Phasor n
        public static Phasor pow(Phasor ph1, Phasor n){
                Complex com1 = ph1.toRectangular();
                Complex comn = n.toRectangular();
                Complex com2 = Complex.pow(com1, comn);
                Phasor ph2 = Phasor.toPhasor(com2);
                return ph2;
        }
View Full Code Here

        }


        // Exponential of a Phasor
        public static Phasor exp(Phasor ph1){
            Complex com = ph1.toRectangular();
            com = Complex.exp(com);
            Phasor ph2 = Phasor.toPhasor(com);
            return ph2;
        }
View Full Code Here

        // e.g.  2 + j3, 2 + i3 are NOT allowed
        public final synchronized Complex readComplex(){

                this.inputType = true;
                String word="";
                Complex cc = null;

                if(!this.testFullLineT) this.enterLine();
                word = nextWord();

                if(!eof)cc = Complex.parseComplex(word.trim());
View Full Code Here

                                this.array.add(hold12.toString());
                                break;
                        case 13: BigInteger hold13 = (BigInteger)arrayv.elementAt(i);
                                this.array.add(hold13.toString());
                                break;
                        case 14: Complex hold14 = (Complex)arrayv.elementAt(i);
                                this.array.add(hold14.toString());
                                break;
                        case 15: Phasor hold15 = (Phasor)arrayv.elementAt(i);
                                this.array.add(hold15.toString());
                                break;
                        case 17: Character hold17 = (Character)arrayv.elementAt(i);
                                this.array.add(hold17.toString());
                                break;
                        case 18: String hold18 = (String)arrayv.elementAt(i);
                                this.array.add(hold18);
                                break;
                        default: throw new IllegalArgumentException("Data type not identified by this method");
                        }
                    }
                    break;
            case 1: this.type = 14;
                    for(int i=0; i<this.length; i++){
                        switch(this.originalTypes[i]){
                        case 1: Double hold1= (Double)arrayv.elementAt(i);
                                this.array.add(new Complex(hold1.doubleValue()));
                                break;
                        case 3: Float hold3 = (Float)arrayv.elementAt(i);
                                this.array.add(new Complex(hold3.doubleValue()));
                                break;
                        case 5: Long hold5 = (Long)arrayv.elementAt(i);
                                this.array.add(new Complex(hold5.doubleValue()));
                                break;
                        case 7: Integer hold7 = (Integer)arrayv.elementAt(i);
                                this.array.add(new Complex(hold7.doubleValue()));
                                break;
                        case 9: Short hold9 = (Short)arrayv.elementAt(i);
                                this.array.add(new Complex(hold9.doubleValue()));
                                break;
                        case 11: Byte hold11 = (Byte)arrayv.elementAt(i);
                                this.array.add(new Complex(hold11.doubleValue()));
                                break;
                        case 12: BigDecimal hold12 = (BigDecimal)arrayv.elementAt(i);
                                this.array.add(new Complex(hold12.doubleValue()));
                                break;
                        case 13: BigInteger hold13 = (BigInteger)arrayv.elementAt(i);
                                this.array.add(new Complex(hold13.doubleValue()));
                                break;
                        case 14: Complex hold14 = (Complex)arrayv.elementAt(i);
                                this.array.add(hold14);
                                break;
                        case 15: Phasor hold15 = (Phasor)arrayv.elementAt(i);
                                this.array.add(Conv.convert_Phasor_to_Complex(hold15));
                                break;
                        case 17: Character hold17 = (Character)arrayv.elementAt(i);
                                this.array.add(new Complex((double)((int)hold17.charValue())));
                                break;
                        case 18: String hold18 = (String)arrayv.elementAt(i);
                                this.array.add(new Complex(Double.parseDouble(hold18)));
                                break;
                        default: throw new IllegalArgumentException("Data type not identified by this method");
                        }
                    }
                    break;
            case 2: this.type = 15;
                    for(int i=0; i<this.length; i++){
                        switch(this.originalTypes[i]){
                        case 1: Double hold1= (Double)arrayv.elementAt(i);
                                this.array.add(new Phasor(hold1.doubleValue()));
                                break;
                        case 3: Float hold3 = (Float)arrayv.elementAt(i);
                                this.array.add(new Phasor(hold3.doubleValue()));
                                break;
                        case 5: Long hold5 = (Long)arrayv.elementAt(i);
                                this.array.add(new Phasor(hold5.doubleValue()));
                                break;
                        case 7: Integer hold7 = (Integer)arrayv.elementAt(i);
                                this.array.add(new Phasor(hold7.doubleValue()));
                                break;
                        case 9: Short hold9 = (Short)arrayv.elementAt(i);
                                this.array.add(new Phasor(hold9.doubleValue()));
                                break;
                        case 11: Byte hold11 = (Byte)arrayv.elementAt(i);
                                this.array.add(new Phasor(hold11.doubleValue()));
                                break;
                        case 12: BigDecimal hold12 = (BigDecimal)arrayv.elementAt(i);
                                this.array.add(new Phasor(hold12.doubleValue()));
                                break;
                        case 13: BigInteger hold13 = (BigInteger)arrayv.elementAt(i);
                                this.array.add(new Phasor(hold13.doubleValue()));
                                break;
                        case 14: Complex hold14 = (Complex)arrayv.elementAt(i);
                                this.array.add(Conv.convert_Complex_to_Phasor(hold14));
                                break;
                        case 15: Phasor hold15 = (Phasor)arrayv.elementAt(i);
                                this.array.add(hold15);
                                break;
View Full Code Here

TOP

Related Classes of flanagan.complex.Complex

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.