Examples of Instruction


Examples of com.eclipsesource.tabris.passepartout.Instruction

  }

  @Test
  public void testPicksNoRuleWithMultipleOneNoComplientCondition() {
    InstructionExtractor extractor = new InstructionExtractor( createEnvironment( new Bounds( 0, 0, 100, 100 ) ) );
    Instruction instruction = PassePartout.columns( 5 );
    Rule rule = PassePartout.when( minWidth( px( 90 ) ) ).and( maxWidth( px( 99 ) ) ).then( instruction );
    List<Rule> rules = new ArrayList<Rule>();
    rules.add( rule );

    List<Instruction> instructions = extractor.extract( rules );
View Full Code Here

Examples of com.eclipsesource.tabris.passepartout.Instruction

  @Test
  public void testCombinesComplientRulesWithMultipleRules() {
    InstructionExtractor extractor = new InstructionExtractor( createEnvironment( new Bounds( 0, 0, 100, 100 ) ) );
    List<Rule> rules = new ArrayList<Rule>();
    Instruction instruction = PassePartout.columns( 5 );
    Instruction instruction2 = PassePartout.columns( 10 );
    rules.add( PassePartout.when( minWidth( px( 90 ) ) ).then( instruction ) );
    rules.add( PassePartout.when( minWidth( px( 95 ) ) ).then( instruction2 ) );

    List<Instruction> instructions = extractor.extract( rules );
View Full Code Here

Examples of com.eclipsesource.tabris.passepartout.Instruction

  @Test
  public void testReturnsEmptyInstructionsWithoutComplientRule() {
    InstructionExtractor extractor = new InstructionExtractor( createEnvironment( new Bounds( 0, 0, 80, 100 ) ) );
    List<Rule> rules = new ArrayList<Rule>();
    Instruction instruction = PassePartout.columns( 5 );
    Instruction instruction2 = PassePartout.columns( 10 );
    rules.add( PassePartout.when( minWidth( px( 90 ) ) ).then( instruction ) );
    rules.add( PassePartout.when( minWidth( px( 95 ) ) ).then( instruction2 ) );

    List<Instruction> instructions = extractor.extract( rules );
View Full Code Here

Examples of com.eclipsesource.tabris.passepartout.Instruction

  }

  @Test
  public void testHasInstructions() {
    ArrayList<Instruction> instructions = new ArrayList<Instruction>();
    Instruction instruction = mock( Instruction.class );
    instructions.add( instruction );
    RuleImpl rule = new RuleImpl( new ArrayList<Condition>(), instructions );

    List<Instruction> actualInstructions = rule.getInstructions();
View Full Code Here

Examples of com.eclipsesource.tabris.passepartout.Instruction

  }

  @Test
  public void testThenAddsInstruction() {
    QueryImpl query = new QueryImpl( mock( Condition.class ) );
    Instruction instruction = mock( Instruction.class );

    Rule rule = query.then( instruction );

    List<Instruction> instructions = rule.getInstructions();
    assertEquals( instructions.get( 0 ), instruction );
View Full Code Here

Examples of com.eclipsesource.tabris.passepartout.Instruction

  }

  @Test
  public void testThenAddsAllInstructions() {
    QueryImpl query = new QueryImpl( mock( Condition.class ) );
    Instruction instruction = mock( Instruction.class );
    Instruction instruction2 = mock( Instruction.class );
    Instruction instruction3 = mock( Instruction.class );

    Rule rule = query.then( instruction, instruction2, instruction3 );

    List<Instruction> instructions = rule.getInstructions();
    assertEquals( instructions.get( 0 ), instruction );
View Full Code Here

Examples of com.linkedin.data.transform.Instruction

  @Override
  public void interpret(InterpreterContext instrCtx)
  {

    Instruction instruction = instrCtx.getCurrentInstruction();

    if ((!(instruction.getData().getClass() == DataMap.class))
        || (!(instruction.getOperation().getClass() == DataMap.class)))
    {
      instrCtx.addErrorMessage("data and operation in composition instruction have to be of type DataMap, instruction: %1$s",
                      instruction);
    }
    else
    {

      DataMap data = (DataMap) instruction.getData();
      DataMap op = (DataMap) instruction.getOperation();

      Object opWildcard = op.get(FilterConstants.WILDCARD);
      Object dataWildcard = data.get(FilterConstants.WILDCARD);

      if ((opWildcard != null && opWildcard.equals(FilterConstants.NEGATIVE))
View Full Code Here

Examples of com.litecoding.smali2java.entity.smali.Instruction

 
  /*
   * Internal methods
   */
  private Object generateCmdFromRules(ArrayList<Rule> rules) {
    Instruction command = null;
   
    boolean cmdDetermined = false;
    for(Rule innerRule : rules) {
      if(innerRule instanceof Rule_padding ||
        innerRule instanceof Rule_optPadding ||
        innerRule instanceof Rule_listSeparator)
        continue;
     
      if(innerRule instanceof Rule_codeLabel) {
          Label innerLabel = EntityFactory.createLabel(innerRule.rules.get(1).spelling);
          command.addArgument(innerLabel);
      } else if(innerRule instanceof Terminal_StringValue) {
        if(!cmdDetermined) {
          cmdDetermined = true;
          command = EntityFactory.createInstruction(innerRule.spelling, null);
        }       
      } else if(innerRule instanceof Rule_codeRegisterV ||
          innerRule instanceof Rule_codeRegisterVDst ||
          innerRule instanceof Rule_codeRegisterP ||
          innerRule instanceof Rule_codeRegister ||
          innerRule instanceof Rule_codeRegisterV64 ||
          innerRule instanceof Rule_codeRegisterV64Dst ||
          innerRule instanceof Rule_codeRegisterP64 ||
          innerRule instanceof Rule_codeRegister64 ||
          innerRule instanceof Rule_codeRegisterRet ||
          innerRule instanceof Rule_codeRegisterRet64 ||
          innerRule instanceof Rule_codeRegisterGroup ||
          innerRule instanceof Rule_smaliClassRef ||
          innerRule instanceof Rule_smaliFieldRef ||
          innerRule instanceof Rule_smaliMethodRef) {
        command.getArguments().add((SmaliCodeEntity)innerRule.accept(this));
      } else if(innerRule instanceof Rule_intValue ||
          innerRule instanceof Rule_strValue) {
        Value innerValue = new Value();
        innerValue.setName(innerRule.spelling);
        command.getArguments().add(innerValue);
      } else if(innerRule instanceof Rule_todoStubLine) {
        System.err.println("Warning: " + command.getName() + " is not fully supported");
      }
    }
       
    return command;
  }
View Full Code Here

Examples of com.strobel.assembler.ir.Instruction

    private void populateExceptionHandlerInfo(final InstructionCollection body, final List<ExceptionTableEntry> exceptionTable) {
        if (body.isEmpty()) {
            return;
        }

        final Instruction bodyEndInstruction = body.get(body.size() - 1);

        final List<HandlerWithRange> entries = new ArrayList<>(exceptionTable.size());

        for (final ExceptionTableEntry entry : exceptionTable) {
            entries.add(
                new HandlerWithRange(
                    entry,
                    new Range(entry.getHandlerOffset(), Integer.MAX_VALUE)
                )
            );
        }

//        Collections.sort(entries);

        final ControlFlowGraph cfg = ControlFlowGraphBuilder.build(body, Collections.<ExceptionHandler>emptyList());

        cfg.computeDominance();
        cfg.computeDominanceFrontier();

        final List<ControlFlowNode> nodes = cfg.getNodes();
        final Map<Instruction, ControlFlowNode> nodeLookup = new IdentityHashMap<>();

        for (int j = 0; j < nodes.size(); j++) {
            final ControlFlowNode node = nodes.get(j);

            if (node.getNodeType() != ControlFlowNodeType.Normal) {
                continue;
            }

            for (Instruction i = node.getStart();
                 i != null && i.getOffset() < node.getEnd().getEndOffset();
                 i = i.getNext()) {

                nodeLookup.put(i, node);
            }
        }

        for (int i = 0; i < entries.size(); i++) {
            int minOffset = Integer.MAX_VALUE;

            final HandlerWithRange entry = entries.get(i);

            ControlFlowNode tryEnd = null;

            for (int j = 0; j < nodes.size(); j++) {
                final ControlFlowNode node = nodes.get(j);
                final Instruction end = node.getEnd();

                if (end != null && end.getOffset() == entry.entry.getEndOffset()) {
                    final Instruction previousInstruction = node.getStart().getPrevious();
                    final HandlerWithRange nearestHandler = findNearestHandler(entries, entry);
                    final Instruction firstHandlerInstruction = body.atOffset(nearestHandler.range.getStart());

                    if (end.getOpCode() == OpCode.GOTO && end.getNext() == firstHandlerInstruction) {
                        tryEnd = nodeLookup.get(end);
                    }
                    else if (previousInstruction != null) {
                        tryEnd = nodeLookup.get(previousInstruction);
                    }

                    break;
                }
            }

            for (int j = 0; j < nodes.size(); j++) {
                final ControlFlowNode node = nodes.get(j);

                if (node.getNodeType() != ControlFlowNodeType.Normal) {
                    continue;
                }

                if (node.getStart().getOffset() == entry.range.getStart()) {
                    final ControlFlowNode end = findHandlerEnd(node, tryEnd, new LinkedHashSet<ControlFlowNode>(), cfg.getRegularExit());

                    if (end != null && end.getNodeType() == ControlFlowNodeType.Normal) {
                        minOffset = end.getEnd().getEndOffset();
                    }
                    else {
                        minOffset = node.getEnd().getEndOffset();
                    }

                    for (int k = 0; k < entries.size(); k++) {
                        final HandlerWithRange other = entries.get(k);

                        if (k != i &&
                            entry.entry.getStartOffset() >= other.entry.getStartOffset() &&
                            entry.entry.getHandlerOffset() < other.entry.getHandlerOffset() &&
                            entry.entry.getEndOffset() <= other.entry.getEndOffset() &&
                            other.range.getStart() < minOffset) {

                            minOffset = other.range.getStart();
                        }
                    }

                    break;
                }
            }

            if (minOffset != Integer.MAX_VALUE) {
                entry.range.setEnd(minOffset);
            }
        }

//        Collections.sort(entries);

        final List<ExceptionHandler> exceptionHandlers = _methodBody.getExceptionHandlers();

        for (final HandlerWithRange entry : entries) {
            final int startOffset = entry.entry.getStartOffset();
            final int endOffset = entry.entry.getEndOffset();
            final int handlerStart = entry.range.getStart();
            final int handlerEnd = entry.range.getEnd();
            final TypeReference catchType = entry.entry.getCatchType();

            final Instruction firstInstruction = body.tryGetAtOffset(startOffset);
            final Instruction lastInstruction;
            final Instruction handlerFirstInstruction = body.tryGetAtOffset(handlerStart);
            final Instruction handlerLastInstruction;

            if (endOffset <= bodyEndInstruction.getOffset()) {
                lastInstruction = body.tryGetAtOffset(endOffset).getPrevious();
            }
            else if (endOffset == bodyEndInstruction.getEndOffset()) {
                lastInstruction = bodyEndInstruction;
            }
            else {
                lastInstruction = new Instruction(endOffset, OpCode.NOP);
            }

            if (handlerEnd <= bodyEndInstruction.getOffset()) {
                handlerLastInstruction = body.tryGetAtOffset(handlerEnd).getPrevious();
            }
            else if (handlerEnd == bodyEndInstruction.getEndOffset()) {
                handlerLastInstruction = bodyEndInstruction;
            }
            else {
                handlerLastInstruction = new Instruction(handlerEnd, OpCode.NOP);
            }

            final ExceptionHandler handler;

            if (catchType == null) {
View Full Code Here

Examples of com.sun.org.apache.bcel.internal.generic.Instruction

            try {
                if (!match[0].hasTargeters() &&
                    !match[1].hasTargeters() &&
                    !match[2].hasTargeters())
                {
                    Instruction load_m = match[1].getInstruction();
                    il.insert(match[0], load_m);
                    il.delete(match[1], match[2]);
                }
            }
            catch (TargetLostException e) {
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.