Examples of NValInt


Examples of org.openquark.cal.internal.machine.g.NValInt

        // Evaluate the 3 arguments.
        NRecordValue recordDictionary = (NRecordValue) executor.internalEvaluate(arguments[0]);
        Node genParams = executor.internalEvaluate(arguments[1]);
        Node independent = executor.internalEvaluate(arguments[2]);
       
        NValInt arbitraryMethodIndex = getIndexOfGenerateClassMethod(executor);
      
        List<String> fieldNames = recordDictionary.fieldNames();
        final int nFields = fieldNames.size();

        NRecordValue result=new NRecordValue(nFields);

        /*
         * Loops through all fields in the record dictionary and
         * invokes the arbitrary class method to
         * construct each record field
         */
        for (int i = 0; i < nFields; ++i) {
            genParams=executor.internalEvaluate(independent.apply( new NValInt(i)).apply(genParams));
           
            String fieldName = fieldNames.get(i);
            Node valueDictionaryThunk = recordDictionary.getValue(fieldName);
           
            result= result.insertRecordField(fieldName,
View Full Code Here

Examples of org.openquark.cal.internal.machine.g.NValInt

     * @return - NValInt holding the index.
     */
    private final NValInt getIndexOfGenerateClassMethod (Executor executor) {
        if (indexOfGenerateClassMethod == null) {
            final int index = classMethodDictionaryIndex(executor, CAL_QuickCheck_internal.Functions.generateInstance);            
            indexOfGenerateClassMethod = new NValInt(index);
        }
        return indexOfGenerateClassMethod;
    }
View Full Code Here

Examples of org.openquark.cal.internal.machine.g.NValInt

    public Node doEvaluation (Node[] arguments, Executor executor)
            throws CALExecutorException {

        //recordFieldValuePrimitive recordValue fieldIndex
        NRecordValue recordValue = (NRecordValue) executor.internalEvaluate(arguments[0]);
        NValInt fieldIndex = (NValInt) executor.internalEvaluate(arguments[1]);
       
        return recordValue.getNthValue(fieldIndex.getIntValue());
    }   
View Full Code Here

Examples of org.openquark.cal.internal.machine.g.NValInt

        // Evaluate the 3 arguments.
        NRecordValue recordDictionary = (NRecordValue) executor.internalEvaluate(arguments[0]);
        NRecordValue inputRecord = (NRecordValue) executor.internalEvaluate(arguments[1]);
        Node generator = executor.internalEvaluate(arguments[2]);
       
        NValInt coarbitraryMethodIndex = getIndexOfCoArbitraryClassMethod(executor);
      
        List<String> fieldNames = recordDictionary.fieldNames();
        final int nFields = fieldNames.size();

        Node result=generator;
View Full Code Here

Examples of org.openquark.cal.internal.machine.g.NValInt

     * @return - NValInt holding the index.
     */
    private final NValInt getIndexOfCoArbitraryClassMethod (Executor executor) {
        if (indexOfCoArbitraryClassMethod == null) {
            final int index = classMethodDictionaryIndex(executor, CAL_QuickCheck.Functions.coarbitrary);                       
            indexOfCoArbitraryClassMethod = new NValInt(index);
        }
        return indexOfCoArbitraryClassMethod;
    }
View Full Code Here

Examples of org.openquark.cal.internal.machine.g.NValInt

    @Override
    public Node doEvaluation (Node[] arguments, Executor executor)
            throws CALExecutorException {
       
        // Evaluate the argument and call getOrdinalValue.
        return new NValInt (executor.internalEvaluate(arguments[0]).getOrdinalValue());
    }
View Full Code Here

Examples of org.openquark.cal.internal.machine.g.NValInt

     * @return - NValInt holding the index.
     */
    private final NValInt getIndexOfCompareClassMethod (Executor executor) {
        if (indexOfCompareClassMethod == null) {
            final int index = classMethodDictionaryIndex(executor, CAL_Prelude.Functions.compare);                  
            indexOfCompareClassMethod = new NValInt(index);
        }
        return indexOfCompareClassMethod;
    }
View Full Code Here

Examples of org.openquark.cal.internal.machine.g.NValInt

    public Node doEvaluation (Node[] arguments, Executor executor)
            throws CALExecutorException {

        //recordFieldType recordDictionary recordValue fieldIndex
        NRecordValue recordDictionary = (NRecordValue) executor.internalEvaluate(arguments[0]);
        NValInt fieldIndex = (NValInt) executor.internalEvaluate(arguments[2]);
       
        // Note that we have evaluated the record dictionary and the field index, but NOT
        // the record value itself.
       
        return recordDictionary.getNthValue(fieldIndex.getIntValue()).apply(boolean_false);
    }
View Full Code Here

Examples of org.openquark.cal.internal.machine.g.NValInt

    public Node doEvaluation (Node[] arguments, Executor executor)
            throws CALExecutorException {

        // Evaluate the 3 arguments.
        NRecordValue recordDict = (NRecordValue) executor.internalEvaluate(arguments[0]);
        NValInt index = (NValInt) executor.internalEvaluate(arguments[1]);
        NRecordValue recordValue = (NRecordValue) executor.internalEvaluate(arguments[2]);
       
        int nFields = recordDict.getNFields();
       
        List<String> fieldNames = recordDict.fieldNames();

        NRecordValue result=new NRecordValue(nFields);
       
        int nParams = recordValue.getNFields();
       
        ArrayList<RecordParamHelper> paramSources = new ArrayList<RecordParamHelper>(nParams);
        for(int i=0; i<nParams; i++) {
            paramSources.add(RecordParamHelper.create(recordValue.getNthValue(i), executor));
        }
        for (int i = 0; i < nFields; ++i) {
           
            Node fieldDict = recordDict.getNthValue(i);           
            Node elem;

            if (index.getIntValue() == -1)
                elem = fieldDict;
            else
                elem = fieldDict.apply(index);
           
            //fill f's arguments using the param sources.
View Full Code Here

Examples of org.openquark.cal.internal.machine.g.NValInt

        // Evaluate the three arguments.
        NRecordValue recordDictionary = (NRecordValue) executor.internalEvaluate(arguments[0]);
        NRecordValue x = (NRecordValue) executor.internalEvaluate(arguments[1]);
        NRecordValue y = (NRecordValue) executor.internalEvaluate(arguments[2]);
       
        NValInt classMethodIndex = getIndexOfEqualsClassMethod(executor);
       
        List<String> fieldNames = recordDictionary.fieldNames();
        final int nFields = fieldNames.size();
       
        for (int i = 0; i < nFields; ++i) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.