Package hu.sztaki.ilab.longneck.process

Examples of hu.sztaki.ilab.longneck.process.VariableSpace


                return new CheckResult(this, false, null, null, null, results);
            }
           
            if (m.groupCount() >= 1 && constraints != null && constraints.size() > 0) {
                // Create match record
                VariableSpace matchScope = new VariableSpace(scope);
               
                for (int i = 0; i <= m.groupCount(); ++i) {
                    scope.setVariable(Integer.toString(i), m.group(i));
                }
                scope.setVariable("groupCount", Integer.toString(m.groupCount()));
View Full Code Here


        @Override
        public void beforeChildren(KernelState kernelState, Record record)
                throws RedirectException {
           
            VariableSpace variables = kernelState.getLastExecutionFrame().getVariables();
            String cacheKey = BlockUtils.getValue(caching.getApplyTo().get(0), record, variables);
            List<Field> cacheValue = caching.getCacheElement(cacheKey);
       
            //cache hit
            if (cacheValue != null) {
View Full Code Here

        }

        @Override
        public void afterChildren(KernelState kernelState, Record record) throws CheckError {
            if (hit == false) {
                VariableSpace variables = kernelState.getLastExecutionFrame().getVariables();
                String cacheKey = BlockUtils.getValue(caching.getApplyTo().get(0), record, variables);
               
                List<Field> cacheValue = new ArrayList<Field>(caching.getOutputFields().size());
               
                for (String s : caching.getOutputFields()) {
View Full Code Here

    }

    public ExecutionFrame(CompoundBlock block, ExecutionFrame parentFrame) {
        position = 0;
        this.parentFrame = parentFrame;
        variables = new VariableSpace(parentFrame.variables);

        hostBlock = block;
        control = getControl(block);

        hasControl = (this.control instanceof ControlStructure);
View Full Code Here

    }

    public ExecutionFrame(BlockReference blockRef, ExecutionFrame parentFrame) {
        position = 0;
        this.parentFrame = parentFrame;
        variables = new VariableSpace(parentFrame.variables);

        hostBlock = blockRef.getReferredBlock();
        control = getControl(blockRef);

        hasControl = (this.control instanceof ControlStructure);
View Full Code Here

    public ExecutionFrame(ExecutionFrame other, ExecutionFrame parent) {
        position = other.position;
        parentFrame = parent;

        if (parent != null) {
            variables = new VariableSpace(other.variables, parent.variables);
        } else {
            variables = null;
        }

        hostBlock = (CompoundBlock) other.hostBlock.clone();
View Full Code Here

public class SetCharacterCaseTest {
   
    @Test
    public void testCase1() throws BlockError {
        Record r = new RecordImpl();
        VariableSpace scope = new VariableSpace();
       
        r.add(new Field("test"));
        r.get("test").setValue("NAgy HAjnalka");
       
        SetCharacterCase scc = new SetCharacterCase();
View Full Code Here

    Record r = new RecordImpl();
    List<Block> blocks = process.getBlocks();
    Block setBlock = blocks.get(0);

    Assert.assertTrue("First block is not of type " + Set.class.getName(), setBlock instanceof Set);
    setBlock.apply(r, new VariableSpace());

    Block timestampBlock = blocks.get(1);
    Assert.assertTrue("Second block is not of type " +
      ExtractUnixtimestamp.class.getName(), timestampBlock instanceof ExtractUnixtimestamp);
   
        VariableSpace variables = new VariableSpace();
    timestampBlock.apply(r, variables);

    checkFields(variables, "year", "1963");
    checkFields(variables, "month", "12");
    checkFields(variables, "day", "4");
View Full Code Here

    @Test
    public void testVariableAccessDefinedVariable() {
        NotNullConstraint c = new NotNullConstraint();
        c.setApplyTo(Arrays.asList(new String[] { "$a1" }));
       
        VariableSpace scope = new VariableSpace();
        scope.setVariable("a1", "aaa");
        Record r = new RecordImpl();
       
        c.check(r, scope);
        CheckResult res = c.check(r, scope);
        Assert.assertTrue(res.isPassed());
View Full Code Here

    @Test
    public void testVariableAccessUndefinedVariable() {
        NotNullConstraint c = new NotNullConstraint();
        c.setApplyTo(Arrays.asList(new String[] { "$a1" }));
       
        VariableSpace scope = new VariableSpace();
        Record r = new RecordImpl();

        CheckResult res = c.check(r, scope);
        Assert.assertFalse(res.isPassed());
    }
View Full Code Here

TOP

Related Classes of hu.sztaki.ilab.longneck.process.VariableSpace

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.