Search in sources :

Example 11 with AMutableString

use of org.apache.asterix.om.base.AMutableString in project asterixdb by apache.

the class FunctionalTester method print_version.

/*********************************************************************
     * Function: print_version
     * Purpose:
     *********************************************************************/
public static void print_version() {
    AMutableString classad_version = new AMutableString(null);
    ClassAd.classAdLibraryVersion(classad_version);
    System.out.println("ClassAd Functional Tester v" + classad_version.getStringValue());
    return;
}
Also used : AMutableString(org.apache.asterix.om.base.AMutableString)

Example 12 with AMutableString

use of org.apache.asterix.om.base.AMutableString in project asterixdb by apache.

the class FunctionalTester method handle_eval.

/*********************************************************************
     * Function: handle_eval
     * Purpose:
     *
     * @throws IOException
     *********************************************************************/
public static void handle_eval(AMutableString line, State state, Parameters parameters, ClassAdObjectPool objectPool) throws IOException {
    AMutableString variable_name = new AMutableString("");
    ExprTree tree;
    Variable variable;
    if (get_variable_name(line, true, variable_name, state, parameters)) {
        tree = get_expr(line, state, parameters, objectPool);
        if (tree != null) {
            Value value = new Value(objectPool);
            if (!evaluate_expr(tree, value, parameters, objectPool)) {
                print_error_message("Couldn't evaluate rvalue", state);
            } else {
                variable = new Variable(variable_name.getStringValue(), value);
                variables.put(variable_name.getStringValue(), variable);
            }
        }
    }
    return;
}
Also used : Value(org.apache.asterix.external.classad.Value) AMutableString(org.apache.asterix.om.base.AMutableString) ExprTree(org.apache.asterix.external.classad.ExprTree)

Example 13 with AMutableString

use of org.apache.asterix.om.base.AMutableString in project asterixdb by apache.

the class FunctionalTester method test.

// typedef map<string, Variable *> VariableMap;
/*--------------------------------------------------------------------
     *
     * Private Functions
     *
     *--------------------------------------------------------------------*/
public static int test(int argc, String[] argv, ClassAdObjectPool objectPool) throws IOException {
    // here
    boolean quit;
    AMutableString line = new AMutableString(null);
    State state = new State();
    Parameters parameters = new Parameters();
    print_version();
    parameters.parseCommandLine(argc, argv);
    quit = false;
    while (!quit && readLine(line, state, parameters) == true) {
        boolean good_line;
        Command command;
        good_line = replace_variables(line, state, parameters, objectPool);
        if (good_line) {
            command = get_command(line, parameters);
            quit = handle_command(command, line, state, parameters, objectPool);
        }
    }
    print_final_state(state);
    if (!parameters.interactive && parameters.inputFile != null) {
        parameters.inputFile.close();
    }
    if (state.number_of_errors == 0) {
        return 0;
    } else {
        return 1;
    }
}
Also used : AMutableString(org.apache.asterix.om.base.AMutableString)

Example 14 with AMutableString

use of org.apache.asterix.om.base.AMutableString in project asterixdb by apache.

the class ClassAdUnitTester method printVersion.

/*********************************************************************
     * Function: print_version
     * Purpose:
     *********************************************************************/
public static void printVersion() {
    AMutableString classadVersion = new AMutableString(null);
    ClassAd.classAdLibraryVersion(classadVersion);
    System.out.println("ClassAd Unit Tester v" + classadVersion + "\n");
}
Also used : AMutableString(org.apache.asterix.om.base.AMutableString)

Example 15 with AMutableString

use of org.apache.asterix.om.base.AMutableString in project asterixdb by apache.

the class FunctionalTester method handle_let.

/*********************************************************************
     * Function: handle_let
     * Purpose:
     *
     * @throws IOException
     *********************************************************************/
public static void handle_let(AMutableString line, State state, Parameters parameters, ClassAdObjectPool objectPool) throws IOException {
    AMutableString variable_name = new AMutableString(null);
    ExprTree tree;
    Variable variable;
    if (get_variable_name(line, true, variable_name, state, parameters)) {
        tree = get_expr(line, state, parameters, objectPool);
        if (tree != null) {
            variable = new Variable(variable_name.getStringValue(), tree, objectPool);
            variables.put(variable_name.getStringValue(), variable);
            if (parameters.interactive) {
                print_expr(tree, state, parameters, objectPool);
            }
        }
    }
    return;
}
Also used : AMutableString(org.apache.asterix.om.base.AMutableString) ExprTree(org.apache.asterix.external.classad.ExprTree)

Aggregations

AMutableString (org.apache.asterix.om.base.AMutableString)21 AString (org.apache.asterix.om.base.AString)10 ArrayBackedValueStorage (org.apache.hyracks.data.std.util.ArrayBackedValueStorage)9 RecordBuilder (org.apache.asterix.builders.RecordBuilder)8 IARecordBuilder (org.apache.asterix.builders.IARecordBuilder)7 AMutableCharArrayString (org.apache.asterix.external.classad.AMutableCharArrayString)3 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)3 OrderedListBuilder (org.apache.asterix.builders.OrderedListBuilder)2 ExprTree (org.apache.asterix.external.classad.ExprTree)2 PrettyPrint (org.apache.asterix.external.classad.PrettyPrint)2 AInt32 (org.apache.asterix.om.base.AInt32)2 ArrayTupleBuilder (org.apache.hyracks.dataflow.common.comm.io.ArrayTupleBuilder)2 ArrayTupleReference (org.apache.hyracks.dataflow.common.comm.io.ArrayTupleReference)2 BufferedReader (java.io.BufferedReader)1 InputStreamReader (java.io.InputStreamReader)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 CompilationException (org.apache.asterix.common.exceptions.CompilationException)1 Value (org.apache.asterix.external.classad.Value)1