@Override
  public void meet(IsNumeric node) throws RuntimeException {
    ValueExpr arg = node.getArg();

    // operator must be a variable or a constant
    if (arg instanceof ValueConstant) {
      try {
        Double.parseDouble(((ValueConstant) arg).getValue().stringValue());
        builder.append(Boolean.toString(true));
      } catch (NumberFormatException ex) {
        builder.append(Boolean.toString(false));
      }
    } else if (arg instanceof Var) {
      String var = getVariableAlias((Var) arg);

      Preconditions.checkState(var != null, "no alias available for variable");

      builder
          .append("(")
          .append(var)
          .append(".ntype = 'int' OR ")
          .append(var)
          .append(".ntype = 'double')");
    }
  }
 private void handleBranchingInstruction(
     ProblemsHolder holder,
     StandardInstructionVisitor visitor,
     Set<Instruction> trueSet,
     Set<Instruction> falseSet,
     HashSet<PsiElement> reportedAnchors,
     BranchingInstruction instruction,
     final boolean onTheFly) {
   PsiElement psiAnchor = instruction.getPsiAnchor();
   boolean underBinary = isAtRHSOfBooleanAnd(psiAnchor);
   if (instruction instanceof InstanceofInstruction
       && visitor.isInstanceofRedundant((InstanceofInstruction) instruction)) {
     if (visitor.canBeNull((BinopInstruction) instruction)) {
       holder.registerProblem(
           psiAnchor,
           InspectionsBundle.message("dataflow.message.redundant.instanceof"),
           new RedundantInstanceofFix());
     } else {
       final LocalQuickFix localQuickFix = createSimplifyBooleanExpressionFix(psiAnchor, true);
       holder.registerProblem(
           psiAnchor,
           InspectionsBundle.message(
               underBinary
                   ? "dataflow.message.constant.condition.when.reached"
                   : "dataflow.message.constant.condition",
               Boolean.toString(true)),
           localQuickFix == null ? null : new LocalQuickFix[] {localQuickFix});
     }
   } else if (psiAnchor instanceof PsiSwitchLabelStatement) {
     if (falseSet.contains(instruction)) {
       holder.registerProblem(
           psiAnchor, InspectionsBundle.message("dataflow.message.unreachable.switch.label"));
     }
   } else if (psiAnchor != null
       && !reportedAnchors.contains(psiAnchor)
       && !isFlagCheck(psiAnchor)) {
     boolean evaluatesToTrue = trueSet.contains(instruction);
     final PsiElement parent = psiAnchor.getParent();
     if (parent instanceof PsiAssignmentExpression
         && ((PsiAssignmentExpression) parent).getLExpression() == psiAnchor) {
       holder.registerProblem(
           psiAnchor,
           InspectionsBundle.message(
               "dataflow.message.pointless.assignment.expression",
               Boolean.toString(evaluatesToTrue)),
           createConditionalAssignmentFixes(
               evaluatesToTrue, (PsiAssignmentExpression) parent, onTheFly));
     } else if (!skipReportingConstantCondition(visitor, psiAnchor, evaluatesToTrue)) {
       final LocalQuickFix fix = createSimplifyBooleanExpressionFix(psiAnchor, evaluatesToTrue);
       String message =
           InspectionsBundle.message(
               underBinary
                   ? "dataflow.message.constant.condition.when.reached"
                   : "dataflow.message.constant.condition",
               Boolean.toString(evaluatesToTrue));
       holder.registerProblem(psiAnchor, message, fix == null ? null : new LocalQuickFix[] {fix});
     }
     reportedAnchors.add(psiAnchor);
   }
 }
Example #3
0
  @Override
  protected Map<String, String> getSystemPropertyDefaults() {
    // FIXME: some threads must be kept alive that prevent JVM
    // from shutting down
    FrameworkImpl.killAfterShutdown = true;

    Map<String, String> defaults = super.getSystemPropertyDefaults();
    String true_ = Boolean.toString(true);
    String false_ = Boolean.toString(false);

    // Audio system should not be disabled
    defaults.put(MediaServiceImpl.DISABLE_AUDIO_SUPPORT_PNAME, false_);

    defaults.put(DeviceConfiguration.PROP_AUDIO_SYSTEM, AudioSystem.LOCATOR_PROTOCOL_AUDIOSILENCE);
    defaults.put("org.jitsi.impl.neomedia.device.PortAudioSystem.disabled", true_);
    defaults.put("org.jitsi.impl.neomedia.device.PulseAudioSystem.disabled", true_);

    // Disables COIN notifications
    defaults.put(OperationSetTelephonyConferencingJabberImpl.DISABLE_COIN_PROP_NAME, true_);

    // FIXME not sure about this one
    // It makes no sense for Jitsi Videobridge to pace its RTP output.
    defaults.put(
        DeviceConfiguration.PROP_VIDEO_RTP_PACING_THRESHOLD, Integer.toString(Integer.MAX_VALUE));

    // FIXME not sure about this one
    /*
     * XXX Explicitly support JitMeet by default because is is the primary
     * use case of Jitsi Videobridge right now.
     */
    defaults.put(SsrcTransformEngine.DROP_MUTED_AUDIO_SOURCE_IN_REVERSE_TRANSFORM, true_);
    defaults.put(SRTPCryptoContext.CHECK_REPLAY_PNAME, false_);

    return defaults;
  }
Example #4
0
  public boolean visit(LambdaFunctionDeclaration s) throws Exception {
    Map<String, String> parameters = createInitialParameters(s);
    parameters.put("isReference", Boolean.toString(s.isReference()));
    if (s.isStatic()) {
      parameters.put("isStatic", Boolean.toString(s.isStatic()));
    }
    xmlWriter.startTag("LambdaFunctionDeclaration", parameters);

    xmlWriter.startTag("Arguments", new HashMap<String, String>());
    for (FormalParameter p : s.getArguments()) {
      p.traverse(this);
    }
    xmlWriter.endTag("Arguments");

    Collection<? extends Expression> lexicalVars = s.getLexicalVars();
    if (lexicalVars != null) {
      xmlWriter.startTag("LexicalVars", new HashMap<String, String>());
      for (Expression var : lexicalVars) {
        var.traverse(this);
      }
      xmlWriter.endTag("LexicalVars");
    }

    s.getBody().traverse(this);

    return false;
  }
Example #5
0
 public boolean visit(NamespaceReference s) throws Exception {
   Map<String, String> parameters = createInitialParameters(s);
   parameters.put("name", s.getName());
   parameters.put("global", Boolean.toString(s.isGlobal()));
   parameters.put("local", Boolean.toString(s.isLocal()));
   xmlWriter.startTag("NamespaceReference", parameters);
   return true;
 }
Example #6
0
 void SaveConfig() {
   String id = Long.toString(robot_uid);
   prefs.put(id + "_limit_top", Double.toString(limit_top));
   prefs.put(id + "_limit_bottom", Double.toString(limit_bottom));
   prefs.put(id + "_limit_right", Double.toString(limit_right));
   prefs.put(id + "_limit_left", Double.toString(limit_left));
   prefs.put(id + "_m1invert", Boolean.toString(m1invert));
   prefs.put(id + "_m2invert", Boolean.toString(m2invert));
 }
  public static void addNodeSetParams(
      final HashMap<String, String> params,
      final NodeSet nodeSet,
      final Boolean isKeepgoing,
      final String prefix) {

    if (null == nodeSet) {
      return;
    }
    if (nodeSet.getThreadCount() > 0) {
      params.put(prefix + "nodeThreadcount", Integer.toString(nodeSet.getThreadCount()));
    }
    if (null != isKeepgoing) {
      params.put(prefix + "nodeKeepgoing", Boolean.toString(isKeepgoing));
    }
    if (nodeSet.isBlank()) {
      return;
    }
    params.put(prefix + "doNodedispatch", "true");
    boolean excludeprecedence = true;
    if (null != nodeSet.getExclude() && nodeSet.getExclude().isDominant()) {
      excludeprecedence = true;
    } else if (null != nodeSet.getInclude() && nodeSet.getInclude().isDominant()) {
      excludeprecedence = false;
    }
    params.put(prefix + "nodeExcludePrecedence", Boolean.toString(excludeprecedence));

    final NodeSet.Include include = nodeSet.getInclude();

    for (NodeSet.FILTER_ENUM filter : NodeSet.FILTER_ENUM.values()) {
      String value = null;
      if (null != include && !include.isBlank()) {
        value = filter.value(include);
      }

      String key = nodeFilterParams.get(filter.getName());
      if (null != value && !"".equals(value)) {
        params.put(prefix + "nodeInclude" + key, value);
      } else {
        params.put(prefix + "nodeInclude" + key, "");
      }
    }
    final NodeSet.Exclude exclude = nodeSet.getExclude();

    for (NodeSet.FILTER_ENUM filter : NodeSet.FILTER_ENUM.values()) {
      String value = null;
      if (null != exclude && !exclude.isBlank()) {
        value = filter.value(exclude);
      }
      String key = nodeFilterParams.get(filter.getName());
      if (null != value && !"".equals(value)) {
        params.put(prefix + "nodeExclude" + key, value);
      } else {
        params.put(prefix + "nodeExclude" + key, "");
      }
    }
  }
    public String getEncodedDocument() {
      final Document eventsDocument = Dom4jUtils.createDocument();
      final Element eventsElement = eventsDocument.addElement(XFormsConstants.XXFORMS_EVENTS_QNAME);

      final Element eventElement = eventsElement.addElement(XFormsConstants.XXFORMS_EVENT_QNAME);
      eventElement.addAttribute("name", eventName);
      eventElement.addAttribute("source-control-id", targetEffectiveId);
      eventElement.addAttribute("bubbles", Boolean.toString(bubbles));
      eventElement.addAttribute("cancelable", Boolean.toString(cancelable));

      return XFormsUtils.encodeXML(eventsDocument, false);
    }
Example #9
0
 private static Map<String, String> nodeAllocationToMap(AssociationEntry entry) {
   final HashMap<String, String> map = new HashMap(8);
   map.put(FIELD_HOSTNAME, entry.getHostname());
   map.put(FIELD_IP, entry.getIpAddress());
   map.put(FIELD_MAC, entry.getMac());
   map.put(FIELD_BROADCAST, entry.getBroadcast());
   map.put(FIELD_SUBNET_MASK, entry.getSubnetMask());
   map.put(FIELD_GATEWAY, entry.getGateway());
   map.put(FIELD_IN_USE, Boolean.toString(entry.isInUse()));
   map.put(FIELD_EXPLICIT_MAC, Boolean.toString(entry.isExplicitMac()));
   return map;
 }
  private Element generatePortNode(Document doc, Port port) {
    Element portEl = doc.createElement(EL_PORT);

    portEl.setAttribute(ATR_NAME, port.getName());
    portEl.setAttribute(ATR_TYPE, port.getType());
    portEl.setAttribute(ATR_X, Integer.toString(port.getX()));
    portEl.setAttribute(ATR_Y, Integer.toString(port.getY()));
    portEl.setAttribute(ATR_PORT_CONNECTION, port.isArea() ? "area" : "");
    portEl.setAttribute(ATR_STRICT, Boolean.toString(port.isStrict()));
    portEl.setAttribute(ATR_MULTI, Boolean.toString(port.isMulti()));

    return portEl;
  }
 @NotNull
 private Element writeComposite(
     VirtualFile file,
     EditorWithProviderComposite composite,
     boolean pinned,
     EditorWithProviderComposite selectedEditor) {
   Element fileElement = new Element("file");
   fileElement.setAttribute("leaf-file-name", file.getName()); // TODO: all files
   composite.currentStateAsHistoryEntry().writeExternal(fileElement, getManager().getProject());
   fileElement.setAttribute(PINNED, Boolean.toString(pinned));
   fileElement.setAttribute(CURRENT_IN_TAB, Boolean.toString(composite.equals(selectedEditor)));
   return fileElement;
 }
 private String stringVal(Object value) {
   return value instanceof String
       ? (String) value
       : value instanceof Boolean
           ? Boolean.toString((Boolean) value)
           : value instanceof Date ? formatDate((Date) value) : value.toString();
 }
  private void loadInitialConfigurationValues() {
    logger.debug("");
    setJDigiDocConfigurationValue("DIGIDOC_LOG4J_CONFIG", DEFAULT_LOG4J_CONFIGURATION);
    setJDigiDocConfigurationValue("SIGN_OCSP_REQUESTS", Boolean.toString(mode == Mode.PROD));
    setJDigiDocConfigurationValue("DIGIDOC_SECURITY_PROVIDER", DEFAULT_SECURITY_PROVIDER);
    setJDigiDocConfigurationValue("DIGIDOC_SECURITY_PROVIDER_NAME", DEFAULT_SECURITY_PROVIDER_NAME);
    setJDigiDocConfigurationValue("KEY_USAGE_CHECK", DEFAULT_KEY_USAGE_CHECK);
    setJDigiDocConfigurationValue("DIGIDOC_OCSP_SIGN_CERT_SERIAL", "");
    setJDigiDocConfigurationValue("DATAFILE_HASHCODE_MODE", DEFAULT_DATAFILE_HASHCODE_MODE);
    setJDigiDocConfigurationValue(
        "CANONICALIZATION_FACTORY_IMPL", DEFAULT_CANONICALIZATION_FACTORY_IMPLEMENTATION);
    setJDigiDocConfigurationValue("DIGIDOC_MAX_DATAFILE_CACHED", DEFAULT_MAX_DATAFILE_CACHED);
    setJDigiDocConfigurationValue("DIGIDOC_USE_LOCAL_TSL", DEFAULT_USE_LOCAL_TSL);
    setJDigiDocConfigurationValue("DIGIDOC_NOTARY_IMPL", DEFAULT_NOTARY_IMPLEMENTATION);
    setJDigiDocConfigurationValue("DIGIDOC_TSLFAC_IMPL", DEFAULT_TSL_FACTORY_IMPLEMENTATION);
    setJDigiDocConfigurationValue("DIGIDOC_OCSP_RESPONDER_URL", getOcspSource());
    setJDigiDocConfigurationValue("DIGIDOC_FACTORY_IMPL", DEFAULT_FACTORY_IMPLEMENTATION);
    setJDigiDocConfigurationValue("DIGIDOC_DF_CACHE_DIR", null);

    setConfigurationValue("TSL_LOCATION", "tslLocation");
    setConfigurationValue("TSP_SOURCE", "tspSource");
    setConfigurationValue("VALIDATION_POLICY", "validationPolicy");
    setConfigurationValue("PKCS11_MODULE", "pkcs11Module");
    setConfigurationValue("OCSP_SOURCE", "ocspSource");
    setConfigurationValue("DIGIDOC_PKCS12_CONTAINER", "OCSPAccessCertificateFile");
    setConfigurationValue("DIGIDOC_PKCS12_PASSWD", "OCSPAccessCertificatePassword");
    setConfigurationValue("CONNECTION_TIMEOUT", "connectionTimeout");
  }
  @Test(groups = "dev")
  public void autoWrapTest() throws EventDeliveryException {
    ctx.put(MongoSink.AUTO_WRAP, Boolean.toString(true));
    ctx.put(MongoSink.DB_NAME, "test_wrap");

    MongoSink sink = new MongoSink();
    Configurables.configure(sink, ctx);

    sink.setChannel(channel);
    sink.start();

    Transaction tx = channel.getTransaction();
    tx.begin();
    String msg =
        "2012/10/26 11:23:08 [error] 7289#0: *6430831 open() \"/usr/local/nginx/html/50x.html\" failed (2: No such file or directory), client: 10.160.105.161, server: sg15.redatoms.com, request: \"POST /mojo/ajax/embed HTTP/1.0\", upstream: \"fastcgi://unix:/tmp/php-fpm.sock:\", host: \"sg15.redatoms.com\", referrer: \"http://sg15.redatoms.com/mojo/mobile/package\"";

    Event e = EventBuilder.withBody(msg.getBytes());
    channel.put(e);
    tx.commit();
    tx.close();

    sink.process();
    sink.stop();

    DB db = mongo.getDB("test_wrap");
    DBCollection collection = db.getCollection("test_log");
    DBCursor cursor = collection.find(new BasicDBObject(MongoSink.DEFAULT_WRAP_FIELD, msg));
    assertTrue(cursor.hasNext());
    DBObject dbObject = cursor.next();
    assertNotNull(dbObject);
    assertEquals(dbObject.get(MongoSink.DEFAULT_WRAP_FIELD), msg);
    mongo.dropDatabase("test_wrap");
  }
Example #15
0
 void updateProperties() {
   Config config = MCPatcherUtils.config;
   Element mods = config.getMods();
   if (mods == null) {
     return;
   }
   HashMap<String, Element> oldElements = new HashMap<String, Element>();
   while (mods.hasChildNodes()) {
     Node node = mods.getFirstChild();
     if (node instanceof Element) {
       Element element = (Element) node;
       String name = config.getText(element, Config.TAG_NAME);
       if (name != null) {
         oldElements.put(name, element);
       }
     }
     mods.removeChild(node);
   }
   for (Mod mod : modsByIndex) {
     if (mod.internal) {
       continue;
     }
     Element element = oldElements.get(mod.getName());
     if (element == null) {
       defaultModElement(mod);
     } else {
       config.setText(
           element, Config.TAG_ENABLED, Boolean.toString(mod.isEnabled() && mod.okToApply()));
       updateModElement(mod, element);
       mods.appendChild(element);
       oldElements.remove(mod.getName());
     }
   }
 }
Example #16
0
  public void saveData(@NotNull Element element) {
    logger.debug("saveData");
    Element search = new Element("search");
    if (lastSearch != null) {
      search.addContent(createElementWithText("last-search", lastSearch));
    }
    if (lastOffset != null) {
      search.addContent(createElementWithText("last-offset", lastOffset));
    }
    if (lastPattern != null) {
      search.addContent(createElementWithText("last-pattern", lastPattern));
    }
    if (lastReplace != null) {
      search.addContent(createElementWithText("last-replace", lastReplace));
    }
    if (lastSubstitute != null) {
      search.addContent(createElementWithText("last-substitute", lastSubstitute));
    }
    Element text = new Element("last-dir");
    text.addContent(Integer.toString(lastDir));
    search.addContent(text);

    text = new Element("show-last");
    text.addContent(Boolean.toString(showSearchHighlight));
    if (logger.isDebugEnabled()) logger.debug("text=" + text);
    search.addContent(text);

    element.addContent(search);
  }
 private static void saveState(TreeAction action, boolean state) {
   if (action instanceof PropertyOwner) {
     final String propertyName = ((PropertyOwner) action).getPropertyName();
     PropertiesComponent.getInstance()
         .setValue(getPropertyName(propertyName), Boolean.toString(state));
   }
 }
  @Override
  public void meet(IsLiteral node) throws RuntimeException {
    ValueExpr arg = node.getArg();

    // operator must be a variable or a constant
    if (arg instanceof ValueConstant) {
      builder.append(Boolean.toString(((ValueConstant) arg).getValue() instanceof Literal));
    } else if (arg instanceof Var) {
      String var = getVariableAlias((Var) arg);

      Preconditions.checkState(var != null, "no alias available for variable");

      builder
          .append("(")
          .append(var)
          .append(".ntype = 'string' OR ")
          .append(var)
          .append(".ntype = 'int' OR ")
          .append(var)
          .append(".ntype = 'double' OR ")
          .append(var)
          .append(".ntype = 'date' OR ")
          .append(var)
          .append(".ntype = 'boolean')");
    }
  }
 private void writeComposite(
     final Element res,
     final VirtualFile file,
     final EditorWithProviderComposite composite,
     final boolean pinned,
     final EditorWithProviderComposite selectedEditor) {
   final Element fileElement = new Element("file");
   fileElement.setAttribute("leaf-file-name", file.getName()); // TODO: all files
   final HistoryEntry entry = composite.currentStateAsHistoryEntry();
   entry.writeExternal(fileElement, getManager().getProject());
   fileElement.setAttribute("pinned", Boolean.toString(pinned));
   fileElement.setAttribute(
       "current", Boolean.toString(composite.equals(getManager().getLastSelected())));
   fileElement.setAttribute("current-in-tab", Boolean.toString(composite.equals(selectedEditor)));
   res.addContent(fileElement);
 }
 public void saveInitialCheckBoxState(boolean state) {
   PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(myProject);
   if (Boolean.TRUE
       .toString()
       .equals(propertiesComponent.getValue("GoToAction.toSaveAllIncluded"))) {
     propertiesComponent.setValue("GoToAction.allIncluded", Boolean.toString(state));
   }
 }
Example #21
0
 private static void setCommonResponseHttpHeaders(HttpServletResponse response) {
   response.setHeader("X-h2o-build-project-version", H2O.ABV.projectVersion());
   response.setHeader(
       "X-h2o-rest-api-version-max",
       Integer.toString(water.api.RequestServer.H2O_REST_API_VERSION));
   response.setHeader("X-h2o-cluster-id", Long.toString(H2O.CLUSTER_ID));
   response.setHeader("X-h2o-cluster-good", Boolean.toString(H2O.CLOUD.healthy()));
 }
Example #22
0
  public void execute() throws BuildException {
    List<String> packagesToDoc = new ArrayList<String>();
    Path sourceDirs = new Path(getProject());
    Properties properties = new Properties();
    properties.setProperty("windowTitle", windowTitle);
    properties.setProperty("docTitle", docTitle);
    properties.setProperty("footer", footer);
    properties.setProperty("header", header);
    checkScopeProperties(properties);
    properties.setProperty("publicScope", publicScope.toString());
    properties.setProperty("protectedScope", protectedScope.toString());
    properties.setProperty("packageScope", packageScope.toString());
    properties.setProperty("privateScope", privateScope.toString());
    properties.setProperty("author", author.toString());
    properties.setProperty("processScripts", processScripts.toString());
    properties.setProperty("includeMainForScripts", includeMainForScripts.toString());
    properties.setProperty(
        "overviewFile", overviewFile != null ? overviewFile.getAbsolutePath() : "");
    properties.setProperty("charset", charset != null ? charset : "");
    properties.setProperty("fileEncoding", fileEncoding != null ? fileEncoding : "");

    if (sourcePath != null) {
      sourceDirs.addExisting(sourcePath);
    }
    parsePackages(packagesToDoc, sourceDirs);

    GroovyDocTool htmlTool =
        new GroovyDocTool(
            new ClasspathResourceManager(), // we're gonna get the default templates out of the dist
                                            // jar file
            sourcePath.list(),
            getDocTemplates(),
            getPackageTemplates(),
            getClassTemplates(),
            links,
            properties);

    try {
      htmlTool.add(sourceFilesToDoc);
      FileOutputTool output = new FileOutputTool();
      htmlTool.renderToOutput(
          output, destDir.getCanonicalPath()); // TODO push destDir through APIs?
    } catch (Exception e) {
      e.printStackTrace();
    }
    // try to override the default stylesheet with custom specified one if needed
    if (styleSheetFile != null) {
      try {
        String css = ResourceGroovyMethods.getText(styleSheetFile);
        File outfile = new File(destDir, "stylesheet.css");
        ResourceGroovyMethods.setText(outfile, css);
      } catch (IOException e) {
        System.out.println(
            "Warning: Unable to copy specified stylesheet '"
                + styleSheetFile.getAbsolutePath()
                + "'. Using default stylesheet instead. Due to: "
                + e.getMessage());
      }
    }
  }
  @Override
  public void dispose() {
    PropertiesComponent instance = PropertiesComponent.getInstance();
    instance.setValue(PROP_SORTED, Boolean.toString(isAlphabeticallySorted()));
    instance.setValue(PROP_SHOWCLASSES, Boolean.toString(myShowClasses));

    if (myCopyJavadocCheckbox != null) {
      instance.setValue(PROP_COPYJAVADOC, Boolean.toString(myCopyJavadocCheckbox.isSelected()));
    }

    final Container contentPane = getContentPane();
    if (contentPane != null) {
      contentPane.removeAll();
    }
    mySelectedNodes.clear();
    myElements = null;
    super.dispose();
  }
  protected Map<String, String> addCustomDerivedQualifications(
      Map<String, String> qualificiation, DateTime asOfDate, boolean activeOnly) {
    Map<String, String> qual = new HashMap<String, String>();
    qual.putAll(qualificiation);
    qual.put("asOfDate", asOfDate.toString());
    qual.put("activeOnly", Boolean.toString(activeOnly));

    return qual;
  }
  private Element generateGraphicsNode(Document doc, ClassGraphics gr) {

    Element graphicsEl = doc.createElement(EL_GRAPHICS);

    Element bounds = doc.createElement(EL_BOUNDS);
    graphicsEl.appendChild(bounds);
    bounds.setAttribute(ATR_X, Integer.toString(gr.getBoundX()));
    bounds.setAttribute(ATR_Y, Integer.toString(gr.getBoundY()));
    bounds.setAttribute(ATR_WIDTH, Integer.toString(gr.getBoundWidth()));
    bounds.setAttribute(ATR_HEIGHT, Integer.toString(gr.getBoundHeight()));

    for (Shape shape : gr.getShapes()) {

      if (shape instanceof Rect) {
        Rect rect = (Rect) shape;
        Element rectEl = doc.createElement(EL_RECT);
        graphicsEl.appendChild(rectEl);
        rectEl.setAttribute(ATR_X, Integer.toString(rect.getX()));
        rectEl.setAttribute(ATR_Y, Integer.toString(rect.getY()));
        rectEl.setAttribute(ATR_WIDTH, Integer.toString(rect.getWidth()));
        rectEl.setAttribute(ATR_HEIGHT, Integer.toString(rect.getHeight()));
        rectEl.setAttribute(ATR_COLOUR, Integer.toString(rect.getColor().getRGB()));
        rectEl.setAttribute(ATR_FILLED, Boolean.toString(rect.isFilled()));
        rectEl.setAttribute(ATR_FIXED, Boolean.toString(rect.isFixed()));
        rectEl.setAttribute(ATR_STROKE, Float.toString(rect.getStroke().getLineWidth()));
        rectEl.setAttribute(ATR_LINETYPE, Float.toString(rect.getLineType()));
        rectEl.setAttribute(ATR_TRANSPARENCY, Integer.toString(rect.getTransparency()));
      } else if (shape instanceof Text) {
        Text text = (Text) shape;
        Element textEl = doc.createElement(EL_TEXT);
        textEl.setAttribute(ATR_STRING, text.getText());
        textEl.setAttribute(ATR_X, Integer.toString(text.getX()));
        textEl.setAttribute(ATR_Y, Integer.toString(text.getY()));
        textEl.setAttribute(ATR_FONTNAME, text.getFont().getName());
        textEl.setAttribute(ATR_FONTSIZE, Integer.toString(text.getFont().getSize()));
        textEl.setAttribute(ATR_FONTSTYLE, Integer.toString(text.getFont().getStyle()));
        textEl.setAttribute(ATR_TRANSPARENCY, Integer.toString(text.getTransparency()));
        textEl.setAttribute(ATR_COLOUR, Integer.toString(text.getColor().getRGB()));
        graphicsEl.appendChild(textEl);
      } // TODO handle the rest of shapes
    }

    return graphicsEl;
  }
Example #26
0
  public XMLElement toXML() {
    XMLElement xmulti = new XMLElement("multisnipe");
    xmulti.setEmpty();
    xmulti.setProperty("subtractshipping", Boolean.toString(subtractShipping()));
    xmulti.setProperty("color", getColorString());
    xmulti.setProperty("default", getSnipeValue(null).fullCurrency());
    xmulti.setProperty("id", Long.toString(getIdentifier()));

    return xmulti;
  }
Example #27
0
 void prePerform(MultiStatus status, EngineSession session, IProgressMonitor monitor) {
   IProfile profile = session.getProfile();
   phaseParameters.put(PARM_PROFILE, profile);
   phaseParameters.put(PARM_PROFILE_DATA_DIRECTORY, session.getProfileDataDirectory());
   phaseParameters.put(PARM_CONTEXT, session.getProvisioningContext());
   phaseParameters.put(PARM_PHASE_ID, phaseId);
   phaseParameters.put(PARM_FORCED, Boolean.toString(forced));
   phaseParameters.put(PARM_AGENT, session.getAgent());
   mergeStatus(status, initializePhase(monitor, profile, phaseParameters));
 }
Example #28
0
  public boolean getOwnOptionBoolean(String optionName, String world, boolean defaultValue) {
    String option = this.getOwnOption(optionName, world, Boolean.toString(defaultValue));

    if ("false".equalsIgnoreCase(option)) {
      return false;
    } else if ("true".equalsIgnoreCase(option)) {
      return true;
    }

    return defaultValue;
  }
Example #29
0
 private Element defaultModElement(Mod mod) {
   Config config = MCPatcherUtils.config;
   Element mods = config.getMods();
   if (mods == null) {
     return null;
   }
   Element element = config.getMod(mod.getName());
   config.setText(element, Config.TAG_ENABLED, Boolean.toString(mod.defaultEnabled));
   updateModElement(mod, element);
   return element;
 }
  @Override
  public void meet(IsBNode node) throws RuntimeException {
    ValueExpr arg = node.getArg();

    // operator must be a variable or a constant
    if (arg instanceof ValueConstant) {
      builder.append(Boolean.toString(((ValueConstant) arg).getValue() instanceof BNode));
    } else if (arg instanceof Var) {
      String var = getVariableAlias((Var) arg);

      builder.append(var).append(".ntype = 'bnode'");
    }
  }