Examples of SWITCH


Examples of org.apache.bcel.generic.SWITCH

  body.append(methodGen.loadDOM());
  body.append(new ILOAD(_currentIndex));
  body.append(new INVOKEINTERFACE(getType, 2));

  // Append switch() statement - main dispatch loop in applyTemplates()
  InstructionHandle disp = body.append(new SWITCH(types, targets, ihLoop));

  // Append all the "case:" statements
  appendTestSequences(body);
  // Append the actual template code
  appendTemplateCode(body);
View Full Code Here

Examples of org.apache.bcel.generic.SWITCH

  body.append(methodGen.loadDOM());
  body.append(new ILOAD(_currentIndex));
  body.append(new INVOKEINTERFACE(getType, 2));

  // Append switch() statement - main dispatch loop in applyTemplates()
  InstructionHandle disp = body.append(new SWITCH(types,targets,ihLoop));

  // Append all the "case:" statements
  appendTestSequences(body);
  // Append the actual template code
  appendTemplateCode(body);
View Full Code Here

Examples of org.apache.bcel.generic.SWITCH

              "getNamespaceType",
              "(I)I");
      il.append(methodGen.loadDOM());
      il.append(new ILOAD(_currentIndex));
      il.append(new INVOKEINTERFACE(getNS, 2));
      il.append(new SWITCH(types, targets, defaultTarget));
      return(il);
  }
  else {
      return(null);
  }
View Full Code Here

Examples of org.apache.commons.cli2.option.Switch

    /**
     * Creates a new Switch instance
     * @return a new Switch instance
     */
    public Switch create() {
        final Switch option =
            new Switch(enabledPrefix, disabledPrefix, preferredName, aliases, description,
                       required, argument, children, id, switchDefault);

        reset();

        return option;
View Full Code Here

Examples of org.aspectj.apache.bcel.generic.SWITCH

      for (int ii = 0; ii < targets.length; ii++) {
        targets[ii] = freshSelect.getTargets()[ii];
      }
         
      // Create a new select statement with the new targets array
      SWITCH switchStatement =
        new SWITCH(freshSelect.getMatchs(), targets, freshSelect.getTarget());
      return (Select)switchStatement.getInstruction()
    } else {
      return i.copy(); // Use clone for shallow copy...
    }
  }
View Full Code Here

Examples of org.candle.decompiler.intermediate.expression.Switch

    handleSwitch();
  }

  public void handleSwitch() {
    Expression switchVal = context.getExpressions().pop();
    Switch switchExpression = new Switch(context.getCurrentInstruction(), switchVal);

    MultiBranchIntermediate mbi = new MultiBranchIntermediate(context.getCurrentInstruction(), switchExpression);
    context.pushIntermediateToInstruction(mbi);
  }
View Full Code Here

Examples of org.openhab.binding.epsonprojector.internal.EpsonProjectorDevice.Switch

        return new DecimalType(hKeystone);
      case HPOSITION:
        int hPosition = remoteController.getHorizontalPosition();
        return new DecimalType(hPosition);
      case HREVERSE:
        Switch hReverse = remoteController.getHorizontalReverse();
        return hReverse == Switch.ON ? OnOffType.ON : OnOffType.OFF;
      case KEY_CODE:
        break;
      case LAMP_TIME:
        int lampTime = remoteController.getLampTime();
        return new DecimalType(lampTime);
      case LUMINANCE:
        Luminance luminance = remoteController.getLuminance();
        return new StringType(luminance.toString());
      case MUTE:
        Switch mute = remoteController.getMute();
        return mute == Switch.ON ? OnOffType.ON : OnOffType.OFF;
      case OFFSET_BLUE:
        int offsetBlue = remoteController.getOffsetBlue();
        return new DecimalType(offsetBlue);
      case OFFSET_GREEN:
        int offsetGreen = remoteController.getOffsetGreen();
        return new DecimalType(offsetGreen);
      case OFFSET_RED:
        int offsetRed = remoteController.getOffsetRed();
        return new DecimalType(offsetRed);
      case POWER:
        PowerStatus powerStatus = remoteController.getPowerStatus();

        if (powerStatus == PowerStatus.ON)
          return OnOffType.ON;
        else
          return OnOffType.OFF;
      case POWER_STATE:
        PowerStatus powerStatus1 = remoteController.getPowerStatus();
        return new StringType(powerStatus1.toString());
      case SHARP:
        logger.warn("Get '{}' not implemented!",
            commmandType.toString());
        return null;
      case SOURCE:
        Source source = remoteController.getSource();
        return new StringType(source.toString());
      case SYNC:
        int sync = remoteController.getSync();
        return new DecimalType(sync);
      case TINT:
        int tint = remoteController.getTint();
        return new DecimalType(tint);
      case TRACKING:
        int tracking = remoteController.getTracking();
        return new DecimalType(tracking);
      case VKEYSTONE:
        int vKeystone = remoteController.getVerticalKeystone();
        return new DecimalType(vKeystone);
      case VPOSITION:
        int vPosition = remoteController.getVerticalPosition();
        return new DecimalType(vPosition);
      case VREVERSE:
        Switch vReverse = remoteController.getVerticalReverse();
        return vReverse == Switch.ON ? OnOffType.ON : OnOffType.OFF;
      default:
        logger.warn("Unknown '{}' command!", commmandType);
        return null;
      }
View Full Code Here

Examples of org.openhab.model.sitemap.Switch

 
  /**
   * {@inheritDoc}
   */
  public EList<Widget> renderWidget(Widget w, StringBuilder sb) throws RenderException {
    Switch s = (Switch) w;
   
    String snippetName = null;
    Item item;
    try {
      item = itemUIRegistry.getItem(w.getItem());
      if(s.getMappings().size()==0) {
        if(item instanceof RollershutterItem) {
          snippetName = "rollerblind";
        } else if (item instanceof GroupItem && ((GroupItem) item).getBaseItem() instanceof RollershutterItem) {
          snippetName = "rollerblind";
        } else {
          snippetName = "switch";
        }
      } else {
        snippetName = "buttons";
      }
    } catch (ItemNotFoundException e) {
      logger.warn("Cannot determine item type of '{}'", w.getItem(), e);
      snippetName = "switch";
    }

    String snippet = getSnippet(snippetName);

    snippet = StringUtils.replace(snippet, "%id%", itemUIRegistry.getWidgetId(w));
    snippet = StringUtils.replace(snippet, "%icon%", escapeURLPath(itemUIRegistry.getIcon(w)));
    snippet = StringUtils.replace(snippet, "%item%", w.getItem());
    snippet = StringUtils.replace(snippet, "%label%", getLabel(w));
    snippet = StringUtils.replace(snippet, "%servletname%", WebAppServlet.SERVLET_NAME);
   
    State state = itemUIRegistry.getState(w);
   
    if(s.getMappings().size()==0) {
      if(state instanceof PercentType) {
        state = ((PercentType) state).intValue() > 0 ? OnOffType.ON : OnOffType.OFF;
      }
      if(state.equals(OnOffType.ON)) {
        snippet = snippet.replaceAll("%checked%", "checked=true");
      } else {
        snippet = snippet.replaceAll("%checked%", "");
      }
    } else {
      StringBuilder buttons = new StringBuilder();
      for(Mapping mapping : s.getMappings()) {
        String button = getSnippet("button");
        button = StringUtils.replace(button, "%item%",w.getItem());
        button = StringUtils.replace(button, "%cmd%", mapping.getCmd());
        button = StringUtils.replace(button, "%label%", mapping.getLabel());
        if(s.getMappings().size()>1 && state.toString().equals(mapping.getCmd())) {
          button = StringUtils.replace(button, "%type%", "Warn"); // button with red color
        } else {
          button = StringUtils.replace(button, "%type%", "Action"); // button with blue color
        }
        buttons.insert(0, button);
View Full Code Here

Examples of org.springmodules.validation.util.Switch

            protected String[] getValidationContextTokens(MethodInvocation methodInvocation) {
                return new String[] { "ctx1", "ctx2" };
            }
        };

        final Switch methodCalledSwitch = new Switch();

        MethodInvocation invocation = new MethodInvocation() {
            public Method getMethod() {
                return null;
            }

            public Object[] getArguments() {
                return new Object[0];
            }

            public Object proceed() throws Throwable {
                methodCalledSwitch.turnOn();
                assertNotNull(ValidationContextHolder.getValidationContext());
                assertTrue(DefaultValidationContext.class.isInstance(ValidationContextHolder.getValidationContext()));
                DefaultValidationContext context = (DefaultValidationContext)ValidationContextHolder.getValidationContext();
                String[] tokens = context.getTokens();
                assertNotNull(tokens);
                assertEquals(2, tokens.length);
                assertEquals("ctx1", tokens[0]);
                assertEquals("ctx2", tokens[1]);
                return "result";
            }

            public Object getThis() {
                return null;
            }

            public AccessibleObject getStaticPart() {
                return null;
            }
        };

        Object result = interceptor.invoke(invocation);

        assertTrue(methodCalledSwitch.isOn());
        assertEquals("result", result);
    }
View Full Code Here

Examples of org.springmodules.validation.util.Switch

        ValidationContextFilter filter = new ValidationContextFilter();
        filter.setValidationContextUrlMappings(mappings);

        filter.afterPropertiesSet();

        final Switch filterCallSwitch = new Switch();
        FilterChain filterChain = new FilterChain() {
            public void doFilter(ServletRequest req, ServletResponse res) {
                filterCallSwitch.turnOn();
                assertTrue(ValidationContextUtils.tokensSupportedByCurrentContext(new String[] { "ctx1", "ctx2" }));
                assertFalse(ValidationContextUtils.tokensSupportedByCurrentContext(new String[] { "ctx3" }));
            }
        };

        MockHttpServletRequest request = new MockHttpServletRequest("GET", "/user/test.html");
        MockHttpServletResponse response = new MockHttpServletResponse();
        filter.doFilterInternal(request, response, filterChain);

        assertTrue(filterCallSwitch.isOn()); // making sure the filter was called
    }
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.