Examples of NValObject


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

        NRecordValue recordDictionary = (NRecordValue) executor.internalEvaluate(arguments[0]);
       
        // Note that we have evaluated the record dictionary but NOT
        // the record value itself.
       
        return new NValObject(recordDictionary);
    }
View Full Code Here

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

           
            Object fieldVal = executor.internalEvaluate(valueDictionaryThunk.apply (xValueThunk)).getValue();
            resultMap.put(FieldName.make(fieldName), fieldVal);
        }
       
        return new NValObject(resultMap);
       
    }
View Full Code Here

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

           
            Object fieldVal = executor.internalEvaluate(valueDictionaryThunk.apply (xValueThunk)).getValue();
            resultList.add(fieldVal);
        }
       
        return new NValObject(resultList);
       
    }
View Full Code Here

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

            return executor.internalEvaluate(arguments[0]);
           
        } catch (CALExecutorException.ExternalException.PrimThrowFunctionException primThrowException) {
           
            //the Exception.throw function was called
            return arguments[1].apply(new NValObject(primThrowException.getCause()));
           
        } catch (CALExecutorException.ExternalException.ForeignOrPrimitiveFunctionException foreignFunctionException) {
           
            //an exception occurred while calling a foreign function
            return arguments[1].apply(new NValObject(foreignFunctionException.getCause()));
           
        } catch (CALExecutorException.ExternalException.PatternMatchFailure patternMatchFailure) {
           
            return arguments[1].apply(new NValObject(patternMatchFailure));
           
        } catch (CALExecutorException.ExternalException.ErrorFunctionException errorException) {                                  
           
            return arguments[1].apply(new NValObject(errorException));
                   
        } catch (Throwable throwable) {
           
            if (throwable instanceof CALExecutorException) {
                throw (CALExecutorException)throwable;
            }
           
            //todoBI check this for the g-machine
            //most likely an unchecked foreign function exception. Could also be a programming error in CAL's Java implementation.
            //at the moment we have no way to distinguish these 2 cases.
            //todoBI
            //One solution is to wrap all calls to foreign functions so that a CALExecutor.CALForeignFunctionException is thrown,
            //but this is a performance hit.
            return arguments[1].apply(new NValObject(throwable));
        }  
       
        //todoBI handle CALExecutor.CALTerminatedByClientException. We may want to give code a chance to clean up after
        //a client has terminated.     
    }
View Full Code Here

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

    private NPrimThrow () {/* constructor made private for singleton */ }

    /** {@inheritDoc} */
    @Override
    public Node doEvaluation(Node[] arguments, Executor executor) throws CALExecutorException {
        NValObject throwableObject = (NValObject)executor.internalEvaluate(arguments[0]);
        throw new CALExecutorException.ExternalException.PrimThrowFunctionException(CAL_Exception_internal.Functions.primThrow.getQualifiedName() + " called.", (Throwable)throwableObject.getValue());
    }
View Full Code Here

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

            final String fieldNameFromInputMap = ((FieldName)entry.getKey()).getCalSourceForm();                             
            final String fieldName = fieldNames.get(i);
            if (!fieldNameFromInputMap.equals(fieldName)) {
                throw new IllegalArgumentException("The field names of the input map and target record must match exactly.");
            }           
            newRecord.putValue (fieldName, recordDictionary.getValue(fieldName).apply (new NValObject(entry.getValue())));
        }
       
        return newRecord;
    }
View Full Code Here

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

            }
           
            result.add(elem);
        }
       
        return new NValObject(result);
    }
View Full Code Here

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

            }
           
            showResult.append("}");
        }
       
        return (new NValObject(showResult.toString()));

    }
View Full Code Here

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

       
        // The order of iteration over the fields is unimportant in this case, since there is no
        // evaluation being done.  We're just pushing suspensions into the NRecordValue node.
        for (int i = 0; i < nFields; ++i) {
            String fieldName = fieldNames.get(i);
            newRecord.putValue (fieldName, recordDictionary.getValue(fieldName).apply (new NValObject(inputListIterator.next())));
        }
       
        return newRecord;
    }
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.