Package condor.classad

Examples of condor.classad.Constant


         *
         * if (exprType == Expr.RECORD) { Ad ad = new Ad(); ad.jobAd =
         * (RecordExpr) value; // put the right casting TBD put a // valid
         * constructor return ad; } else {
         */
        Constant co = (Constant) value;
        if (exprType == Expr.INTEGER) {
            return new Integer(co.intValue()); // Integer Value
        } else if (exprType == Expr.BOOLEAN) {
            return new Boolean(co.isTrue()); // Boolean Value
        } else if (exprType == Expr.REAL) {
            return new Double(co.realValue()); // Real Value
        } else if (exprType == Expr.STRING) {
            return co.stringValue(); // String Value
        } else {
            throw new IllegalArgumentException(attrName + ": unexpected type found.");
        }
        // }
    }
View Full Code Here


    private String getString(Expr expr) throws Exception, ClassCastException {
        if (expr == null) {
            throw new Exception("expression not defined!");
        }

        Constant co = (Constant) expr;
        String result = co.stringValue();

        if (result != null) {
            if (result.startsWith("\"") && result.endsWith("\"")) {
                result = result.substring(1, result.length() - 1);
            } else if (result.length() == 0) {
View Full Code Here

            }
        }

        Expr expr = attributes.get(attrName.toLowerCase());
        if (expr instanceof Constant) {
            Constant co = (Constant) expr;

            if (exprType == Expr.INTEGER) {
                try {
                    return new Integer(co.intValue()); // Integer Value
                } catch (Throwable ex) {
                    throw new Exception("wrong type (expected type: integer)");
                }
            } else if (exprType == Expr.BOOLEAN) {
                try {
                    return new Boolean(co.isTrue()); // Boolean Value
                } catch (Throwable ex) {
                    throw new Exception("wrong type (expected type: boolean)");
                }
            } else if (exprType == Expr.REAL) {
                return new Double(co.realValue()); // Real Value
            } else if (exprType == Expr.STRING) {
                String result = co.stringValue();

                if (result != null) {
                    if (result.startsWith("\"") && result.endsWith("\"")) {
                        result = result.substring(1, result.length() - 1);
                    } else if (result.length() == 0) {
View Full Code Here

TOP

Related Classes of condor.classad.Constant

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.