Package ptolemy.data

Examples of ptolemy.data.ComplexToken


                            .notSupportedConversionMessage(token, toString()));
                }
                // Try to create a new [complex] type with just one member.
                // The following conversion will fail if the member cannot
                // be converted to an int.
                ComplexToken singleMember = ComplexToken.convert(token);
                Complex[][] matrix = new Complex[1][1];
                matrix[0][0] = singleMember.complexValue();
                return new ComplexMatrixToken(matrix);
            }

        }
View Full Code Here


     @exception IllegalActionException If a runtime type error occurs.
     */
    public void fire() throws IllegalActionException {
        super.fire();

        ComplexToken inputToken = ((ComplexToken) input.get(0));
        int index = 0;
        double distance = _computeEuclideanDistance(_table[0], inputToken
                .complexValue());

        for (int i = 1; i < _size; i++) {
            double tempDistance = _computeEuclideanDistance(_table[i],
                    inputToken.complexValue());

            if (tempDistance < distance) {
                index = i;
                distance = tempDistance;
            }
View Full Code Here

        double angleValue = ((DoubleToken) (angle.get(0))).doubleValue();

        double xValue = magnitudeValue * Math.cos(angleValue);
        double yValue = magnitudeValue * Math.sin(angleValue);

        output.send(0, new ComplexToken(new Complex(xValue, yValue)));
    }
View Full Code Here

        } else if (result instanceof String) {
            resultToken = new StringToken((String) result);
        } else if (result instanceof Boolean) {
            resultToken = new BooleanToken(((Boolean) result).booleanValue());
        } else if (result instanceof Complex) {
            resultToken = new ComplexToken((Complex) result);
        } else if (result instanceof FixPoint) {
            resultToken = new FixToken((FixPoint) result);
        } else {
            throw new IllegalActionException(this, "Result of method call "
                    + port.getName() + " is not a supported type: boolean, "
View Full Code Here

     */
    public void fire() throws IllegalActionException {
        super.fire();
        double xValue = ((DoubleToken) x.get(0)).doubleValue();
        double yValue = ((DoubleToken) y.get(0)).doubleValue();
        ComplexToken token = new ComplexToken(new Complex(xValue, yValue));
        output.send(0, token);
    }
View Full Code Here

TOP

Related Classes of ptolemy.data.ComplexToken

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.