[kepler-users] problem in output port data type

Christopher Brooks cxh at eecs.berkeley.edu
Mon Aug 13 08:00:44 PDT 2007


Hi,

Double is a wrapper class for the double primitive type.
For more information, see: 
http://java.sun.com/docs/books/tutorial/java/data/numberclasses.html

You have something like:
     _data[j] = Double.valueOf(inputValue.getElement(i).toString()).doubleValue();
You could do something like:
     _data[j] = Double.valueOf(inputValue.getElement(i).toString());

However, this does use the type system very effectively.  Are you sure
you want data[j] to be of type Double?  If it was of type Token, 
then your class could pass it as an output.  If you want performance,
you could call this actor ArrayDoubleColumn and have the array be
double _data[j].  

Take a look at the ptolemy/actor/lib/Array*.java classes for ideas.

_Christopher



--------

    Hi,
    
    As you said, i am using the Double class to parse the string but i get 
    following error messages,
    
    compile:
        [javac] Compiling 1 source file to 
    /SFS/users/turuncu/progs/cvs/kepler/build/classes
        [javac] 
    /SFS/users/turuncu/progs/cvs/kepler/build/src/edu/tutorial/turuncu/ArrayCol
   umn.java:114: 
    incompatible types
        [javac] found   : double
        [javac] required: java.lang.Double
        [javac]                 _data[j] = 
    Double.valueOf(inputValue.getElement(i).toString()).doubleValue();
        
    [javac]                                                                    
                          
    ^
        [javac] 1 error
    
    the inputValue variable is ArrayToken type and _data is in Double array 
    type. Double.valueOf expect a String argument but it is not working in 
    this way. I study sume examples that use Double.valueOf method in 
    Ptolemy actor directory but in my case i am not using stringTokenizer.
    
    thank you again for your help
    best regrads,
    
    ufuk
    _______________________________________________
    Kepler-users mailing list
    Kepler-users at ecoinformatics.org
    http://mercury.nceas.ucsb.edu/ecoinformatics/mailman/listinfo/kepler-users
--------



More information about the Kepler-users mailing list