Package flanagan.circuits

Examples of flanagan.circuits.Phasor


            case 14:Complex[] co = this.getArray_as_Complex();
                   for(int i=0; i<this.length; i++)am.array.add(new Complex(Math.ceil(co[i].getReal()), Math.ceil(co[i].getImag())));
                   am.type = this.type;
                   break;
            case 15:Phasor[] ph = this.getArray_as_Phasor();
                   for(int i=0; i<this.length; i++)am.array.add(new Phasor(Math.ceil(ph[i].getMagnitude()), Math.ceil(ph[i].getPhaseInDegrees())));
                   am.type = this.type;
                   break;
            case 16:
            case 17:char[] ch = this.getArray_as_char();
                   for(int i=0; i<this.length; i++)am.array.add(new Character(ch[i]));
View Full Code Here


            case 14:Complex[] co = this.getArray_as_Complex();
                   for(int i=0; i<this.length; i++)am.array.add(new Complex(Math.rint(co[i].getReal()), Math.rint(co[i].getImag())));
                   am.type = this.type;
                   break;
            case 15:Phasor[] ph = this.getArray_as_Phasor();
                   for(int i=0; i<this.length; i++)am.array.add(new Phasor(Math.rint(ph[i].getMagnitude()), Math.rint(ph[i].getPhaseInDegrees())));
                   am.type = this.type;
                   break;
            case 16:
            case 17:char[] ch = this.getArray_as_char();
                   for(int i=0; i<this.length; i++)am.array.add(new Character(ch[i]));
View Full Code Here

                    Complex sumcc = Complex.zero();
                            for(int i=0; i<this.length; i++)sumcc.plus(cc[i]);
                        this.summ.add(sumcc);
                    break;
            case 15: Phasor[] pp = this.getArray_as_Phasor();
                    Phasor sumpp = Phasor.zero();
                    for(int i=0; i<this.length; i++)sumpp.plus(pp[i]);
                    this.summ.add(sumpp);
                    break;
            default: throw new IllegalArgumentException("Data type not identified by this method");
        }
        this.sumDone = true;
View Full Code Here

    }

   public Phasor getSum_as_Phasor(){
        if(this.suppressMessages)Conv.suppressMessages();
        if(!this.sumDone)this.calcSum();
        Phasor sum = Phasor.zero();
        switch(this.type){
            case 0:
            case 1:
            case 2:
            case 3:
            case 18: sum = new Phasor(((Double)this.summ.get(0)).doubleValue());
                    break;
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
            case 10:
            case 11:
            case 16:
            case 17: if(this.sumlongToDouble){
                        sum = new Phasor(((Double)this.summ.get(0)).doubleValue());
                    }
                    else{
                        sum = new Phasor(((Long)this.summ.get(0)).doubleValue());
                    }
                    break;
            case 12: sum = new Phasor(((BigDecimal)this.summ.get(0)).doubleValue());
                    break;
            case 13: sum = new Phasor(((BigInteger)this.summ.get(0)).doubleValue());
                    break;
            case 14:
            case 15: throw new IllegalArgumentException("The " + this.typeName[this.type] + " is not a numerical type for which a sum as Phasor is meaningful/supported");
            default: throw new IllegalArgumentException("Data type not identified by this method");
        }
View Full Code Here

                    Complex productcc = Complex.plusOne();
                    for(int i=0; i<this.length; i++)productcc.times(cc[i]);
                    this.productt.add(productcc);
                    break;
            case 15: Phasor[] pp = this.getArray_as_Phasor();
                    Phasor productpp = Phasor.plusOne();
                    for(int i=0; i<this.length; i++)productpp.times(pp[i]);
                    this.productt.add(productpp);
                    break;
            default: throw new IllegalArgumentException("Data type not identified by this method");
        }
        this.productDone = true;
View Full Code Here

    }

    public Phasor getProduct_as_Phasor(){
        if(this.suppressMessages)Conv.suppressMessages();
        if(!this.productDone)this.calcProduct();
        Phasor product= Phasor.zero();
        switch(this.type){
            case 0:
            case 1:
            case 2:
            case 3:
            case 18: product= new Phasor(((Double)this.productt.get(0)).doubleValue());
                    break;
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
            case 10:
            case 11:
            case 16:
            case 17: if(this.productlongToDouble){
                        product= new Phasor(((Double)this.productt.get(0)).doubleValue());
                    }
                    else{
                        product= new Phasor(((Long)this.productt.get(0)).doubleValue());
                    }
                    break;
            case 12: product= new Phasor(((BigDecimal)this.productt.get(0)).doubleValue());
                    break;
            case 13: product= new Phasor(((BigInteger)this.productt.get(0)).doubleValue());
                    break;
            case 14:
            case 15: throw new IllegalArgumentException("The " + this.typeName[this.type] + " is not a numerical type for which a productas Phasor is meaningful/supported");
            default: throw new IllegalArgumentException("Data type not identified by this method");
        }
View Full Code Here

                                this.array.add(hold13.toString());
                                break;
                        case 14: Complex hold14 = (Complex)arrayl.get(i);
                                this.array.add(hold14.toString());
                                break;
                        case 15: Phasor hold15 = (Phasor)arrayl.get(i);
                                this.array.add(hold15.toString());
                                break;
                        case 17: Character hold17 = (Character)arrayl.get(i);
                                this.array.add(hold17.toString());
                                break;
                        case 18: String hold18 = (String)arrayl.get(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)arrayl.get(i);
                                this.array.add(new Complex(hold1.doubleValue()));
                                break;
                        case 3: Float hold3 = (Float)arrayl.get(i);
                                this.array.add(new Complex(hold3.doubleValue()));
                                break;
                        case 5: Long hold5 = (Long)arrayl.get(i);
                                this.array.add(new Complex(hold5.doubleValue()));
                                break;
                        case 7: Integer hold7 = (Integer)arrayl.get(i);
                                this.array.add(new Complex(hold7.doubleValue()));
                                break;
                        case 9: Short hold9 = (Short)arrayl.get(i);
                                this.array.add(new Complex(hold9.doubleValue()));
                                break;
                        case 11: Byte hold11 = (Byte)arrayl.get(i);
                                this.array.add(new Complex(hold11.doubleValue()));
                                break;
                        case 12: BigDecimal hold12 = (BigDecimal)arrayl.get(i);
                                this.array.add(new Complex(hold12.doubleValue()));
                                break;
                        case 13: BigInteger hold13 = (BigInteger)arrayl.get(i);
                                this.array.add(new Complex(hold13.doubleValue()));
                                break;
                        case 14: Complex hold14 = (Complex)arrayl.get(i);
                                this.array.add(hold14);
                                break;
                        case 15: Phasor hold15 = (Phasor)arrayl.get(i);
                                this.array.add(Conv.convert_Phasor_to_Complex(hold15));
                                break;
                        case 17: Character hold17 = (Character)arrayl.get(i);
                                this.array.add(new Complex((double)((int)hold17.charValue())));
                                break;
                        case 18: String hold18 = (String)arrayl.get(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)arrayl.get(i);
                                this.array.add(new Phasor(hold1.doubleValue()));
                                break;
                        case 3: Float hold3 = (Float)arrayl.get(i);
                                this.array.add(new Phasor(hold3.doubleValue()));
                                break;
                        case 5: Long hold5 = (Long)arrayl.get(i);
                                this.array.add(new Phasor(hold5.doubleValue()));
                                break;
                        case 7: Integer hold7 = (Integer)arrayl.get(i);
                                this.array.add(new Phasor(hold7.doubleValue()));
                                break;
                        case 9: Short hold9 = (Short)arrayl.get(i);
                                this.array.add(new Phasor(hold9.doubleValue()));
                                break;
                        case 11: Byte hold11 = (Byte)arrayl.get(i);
                                this.array.add(new Phasor(hold11.doubleValue()));
                                break;
                        case 12: BigDecimal hold12 = (BigDecimal)arrayl.get(i);
                                this.array.add(new Phasor(hold12.doubleValue()));
                                break;
                        case 13: BigInteger hold13 = (BigInteger)arrayl.get(i);
                                this.array.add(new Phasor(hold13.doubleValue()));
                                break;
                        case 14: Complex hold14 = (Complex)arrayl.get(i);
                                this.array.add(Conv.convert_Complex_to_Phasor(hold14));
                                break;
                        case 15: Phasor hold15 = (Phasor)arrayl.get(i);
                                this.array.add(hold15);
                                break;
                        case 17: Character hold17 = (Character)arrayl.get(i);
                                this.array.add(new Phasor((double)((int)hold17.charValue())));
                                break;
                        default: throw new IllegalArgumentException("Data type not identified by this method");
                        }
                    }
                    break;
View Full Code Here

                    am.summ.add(bi);
                    break;
            case 14:  Complex cc = (Complex)summ.get(0);
                    am.summ.add(cc);
                    break;
            case 15:  Phasor pp = (Phasor)summ.get(0);
                    am.summ.add(pp);
                    break;
            default: throw new IllegalArgumentException("Data type not identified by this method");
            }
        }

        am.productt = new ArrayList<Object>();
        if(this.productt.size()!=0){
            switch(this.type){
            case 0:
            case 1:
            case 2:
            case 3:
            case 18: double dd = ((Double)productt.get(0)).doubleValue();
                    am.productt.add(new Double(dd));
                    break;
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
            case 10:
            case 11:
            case 16:
            case 17: if(this.sumlongToDouble){
                        double dd2 = ((Double)productt.get(0)).doubleValue();
                        am.productt.add(new Double(dd2));
                    }
                    else{
                        long ll = ((Long)productt.get(0)).longValue();
                        am.productt.add(new Long(ll));
                    }
                    break;
            case 12: BigDecimal bd = (BigDecimal)productt.get(0);
                    am.productt.add(bd);
                    break;
            case 13:  BigInteger bi = (BigInteger)productt.get(0);
                    am.productt.add(bi);
                    break;
            case 14:  Complex cc = (Complex)productt.get(0);
                    am.productt.add(cc);
                    break;
            case 15:  Phasor pp = (Phasor)productt.get(0);
                    am.productt.add(pp);
                    break;
            default: throw new IllegalArgumentException("Data type not identified by this method");
            }
        }
View Full Code Here

                    am.summ.add(bi);
                    break;
            case 14:  Complex cc = (Complex)summ.get(0);
                    am.summ.add(cc);
                    break;
            case 15:  Phasor pp = (Phasor)summ.get(0);
                    am.summ.add(pp);
                    break;
            default: throw new IllegalArgumentException("Data type not identified by this method");
            }
        }

        am.productt = new ArrayList<Object>();
        if(this.productt.size()!=0){
            switch(this.type){
            case 0:
            case 1:
            case 2:
            case 3:
            case 18: double dd = ((Double)productt.get(0)).doubleValue();
                    am.productt.add(new Double(dd));
                    break;
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
            case 10:
            case 11:
            case 16:
            case 17: if(this.sumlongToDouble){
                        double dd2 = ((Double)productt.get(0)).doubleValue();
                        am.productt.add(new Double(dd2));
                    }
                    else{
                        long ll = ((Long)productt.get(0)).longValue();
                        am.productt.add(new Long(ll));
                    }
                    break;
            case 12: BigDecimal bd = (BigDecimal)productt.get(0);
                    am.productt.add(bd);
                    break;
            case 13:  BigInteger bi = (BigInteger)productt.get(0);
                    am.productt.add(bi);
                    break;
            case 14:  Complex cc = (Complex)productt.get(0);
                    am.productt.add(cc);
                    break;
            case 15:  Phasor pp = (Phasor)productt.get(0);
                    am.productt.add(pp);
                    break;
            default: throw new IllegalArgumentException("Data type not identified by this method");
            }
        }
View Full Code Here

    public Phasor[] getArray_as_Phasor(){
        if(this.suppressMessages)Conv.suppressMessages();
        Phasor[] retArray = Phasor.oneDarray(this.length);
        switch(this.type){
            case 0:
            case 1: for(int i=0; i<this.length; i++)retArray[i] = new Phasor(((Double)this.array.get(i)).doubleValue());
                    break;
            case 2:
            case 3: for(int i=0; i<this.length; i++)retArray[i] = new Phasor(((Float)this.array.get(i)).doubleValue());
                    break;
            case 4:
            case 5: for(int i=0; i<this.length; i++)retArray[i] = new Phasor(Conv.convert_Long_to_double((Long)this.array.get(i)));
                    break;
            case 6:
            case 7: for(int i=0; i<this.length; i++)retArray[i] = new Phasor(Conv.convert_Integer_to_double((Integer)this.array.get(i)));
                    break;
            case 8:
            case 9: for(int i=0; i<this.length; i++)retArray[i] = new Phasor(Conv.convert_Short_to_double((Short)this.array.get(i)));
                    break;
            case 10:
            case 11: for(int i=0; i<this.length; i++)retArray[i] = new Phasor(Conv.convert_Byte_to_double((Byte)this.array.get(i)));
                    break;
            case 12: for(int i=0; i<this.length; i++)retArray[i] = new Phasor(Conv.convert_BigDecimal_to_double((BigDecimal)this.array.get(i)));
                    break;
            case 13: for(int i=0; i<this.length; i++)retArray[i] = new Phasor(Conv.convert_BigInteger_to_double((BigInteger)this.array.get(i)));
                    break;
            case 14: for(int i=0; i<this.length; i++)retArray[i] = Conv.convert_Complex_to_Phasor((Complex)this.array.get(i));
                    break;
            case 15: for(int i=0; i<this.length; i++)retArray[i] = (Phasor)this.array.get(i);
                    break;
            case 18: for(int i=0; i<this.length; i++){
                        String ss = ((String)this.array.get(i)).trim();
                        if(ss.indexOf('<')!=-1 || ss.indexOf('L')!=-1){
                            retArray[i] = Phasor.valueOf(ss);
                        }
                        else{
                            retArray[i] = new Phasor(Double.valueOf(ss));
                        }
                    }
                    break;
            case 16:
            case 17: for(int i=0; i<this.length; i++)retArray[i] = new Phasor(Conv.convert_int_to_double((int)((Character)this.array.get(i)).charValue()));
                    break;
            default: throw new IllegalArgumentException("Data type not identified by this method");
        }
        Conv.restoreMessages();
        return retArray;
View Full Code Here

TOP

Related Classes of flanagan.circuits.Phasor

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.