예제 #1
0
 @Override
 public OperationResult invokeOperation(String name, Configuration parameters) throws Exception {
   if (name.equals(ENABLE_OPERATION)) {
     Operation operation = new Operation(ENABLE_OPERATION, getAddress());
     Boolean persistent =
         Boolean.valueOf(parameters.getSimpleValue("persistent", TRUE.toString()));
     operation.addAdditionalProperty("persistent", persistent);
     Result res = getASConnection().execute(operation);
     if (res.isSuccess()) {
       return new OperationResult();
     } else {
       OperationResult operationResult = new OperationResult();
       operationResult.setErrorMessage(res.getFailureDescription());
       return operationResult;
     }
   }
   if (name.equals(DISABLE_OPERATION)) {
     Operation operation = new Operation(DISABLE_OPERATION, getAddress());
     boolean allowResourceServiceRestart =
         Boolean.parseBoolean(
             parameters.getSimpleValue("allow-resource-service-restart", FALSE.toString()));
     if (allowResourceServiceRestart) {
       operation.allowResourceServiceRestart();
     }
     Result res = getASConnection().execute(operation);
     if (res.isSuccess()) {
       return new OperationResult();
     } else {
       OperationResult operationResult = new OperationResult();
       operationResult.setErrorMessage(res.getFailureDescription());
       return operationResult;
     }
   }
   return super.invokeOperation(name, parameters);
 }
예제 #2
0
 /**
  * Returns TRUE of FALSE if 'expr' is a boolean expression and its value is known statically. The
  * caller should be careful when replacing this expression as it may have side effects.
  */
 private Boolean getKnownValue(Expression expr) {
   Object value = expr.getConstantValue();
   if (value instanceof Boolean) {
     return (Boolean) value;
   }
   switch (expr.getKind()) {
     case BOOLEAN_LITERAL:
       return ((BooleanLiteral) expr).booleanValue();
     case INFIX_EXPRESSION:
       {
         InfixExpression infixExpr = (InfixExpression) expr;
         InfixExpression.Operator op = infixExpr.getOperator();
         if (op == CONDITIONAL_AND || op == CONDITIONAL_OR) {
           // We assume that this node has already been visited and pruned so
           // if it has a known value, it will be equal to the last operand.
           List<Expression> operands = infixExpr.getOperands();
           Boolean lastOperand = getKnownValue(operands.get(operands.size() - 1));
           if (lastOperand != null && lastOperand.booleanValue() == (op == CONDITIONAL_OR)) {
             return lastOperand;
           }
         }
         return null;
       }
     case PARENTHESIZED_EXPRESSION:
       return getKnownValue(((ParenthesizedExpression) expr).getExpression());
     default:
       return null;
   }
 }
예제 #3
0
 java.lang.Object interpret(
     COM.dragonflow.SiteView.SiteViewObject siteviewobject, COM.dragonflow.SiteView.Rule rule)
     throws COM.dragonflow.Utils.InterpreterException {
   java.lang.Boolean boolean1 = (java.lang.Boolean) left.interpret(siteviewobject, rule);
   java.lang.Boolean boolean2 = (java.lang.Boolean) right.interpret(siteviewobject, rule);
   if (!boolean1.booleanValue() && !boolean2.booleanValue()) {
     return new Boolean(false);
   } else {
     return new Boolean(true);
   }
 }
예제 #4
0
 protected boolean queryBoolean(String query) throws IOException {
   if (USECACHE) {
     if (cache == null) cache = new Hashtable();
     Object r = cache.get(query);
     if (r != null) return ((Boolean) r).booleanValue();
     Boolean r1 = queryBoolean1(query);
     cache.put(query, r1);
     return r1.booleanValue();
   } else {
     return queryBoolean1(query).booleanValue();
   }
 }
예제 #5
0
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((value == null) ? 0 : value.hashCode());
   return result;
 }
예제 #6
0
파일: Main.java 프로젝트: DaciCop/dacicop
  public void proccessConnection() {
    iptables = new AccesIptables();
    // Thread thread = new Thread(iptables);
    // thread.start();
    try {
      while (in.ready()) {

        String linie[] = in.readLine().split("\\¶{1}");
        // System.out.println("Linie mesaj" +"- "+ linie[0] +" - "+ linie[1] +" - "+
        // java.lang.Boolean.parseBoolean(linie[2]));
        iptables.accesIptables(linie[0], linie[1], java.lang.Boolean.parseBoolean(linie[2]));
        // if (sesUtilDeDezactivat!=null) if (sesUtilDeDezactivat.compareTo("")!=0)
        // {interziceListaCereri(sesUtilDeDezactivat);
        // String idutil=dbcon.getString("SELECT id from utilizatori where
        // utilizator='"+sesUtilDeDezactivat+"'", "id");
        // String ip = dbcon.getString("SELECT ip from sesiuni where idutil='"+idutil+"' and
        // datapornire=dataoprire order by datapornire desc", "ip");
        // dbcon.update("UPDATE sesiuni set dataoprire=NOW() where ip='"+ip+"' and
        // datapornire=dataoprire");
      }
      out.flush();
      out.close();
    } catch (Exception ex) {
      //  jurnal.println("Eroare la procesarea conexiunii: "+ex.getMessage());
      ex.printStackTrace();
    }
    iptables.run();
  }
예제 #7
0
 public CreateObjectMonitor(String n, ObjectURL wturl, WithHash w, Boolean r) {
   super();
   name = n;
   with = w;
   this.wturl = wturl;
   replace = r.booleanValue();
 }
예제 #8
0
 @Override
 public int hashCode() {
   int result = hashCode;
   if (result == 0) {
     result = extensionsHashCode();
     result =
         result * 37 + (message_set_wire_format != null ? message_set_wire_format.hashCode() : 0);
     result =
         result * 37
             + (no_standard_descriptor_accessor != null
                 ? no_standard_descriptor_accessor.hashCode()
                 : 0);
     result = result * 37 + (uninterpreted_option != null ? uninterpreted_option.hashCode() : 1);
     hashCode = result;
   }
   return result;
 }
 /**
  * Write an object to a stream.
  *
  * @param ostream The stream to write to.
  * @param obj The object to write.
  * @param indent The current indentation level.
  * @throws IOException on I/O error
  */
 @Override
 public void write(final Appendable ostream, final HarvestableFixture obj, final int indent)
     throws IOException {
   if (obj instanceof CacheFixture) {
     writeTag(ostream, "cache", indent);
     final CacheFixture cache = (CacheFixture) obj;
     writeProperty(ostream, "kind", cache.getKind());
     writeProperty(ostream, "contents", cache.getContents());
   } else if (obj instanceof Meadow) {
     writeTag(ostream, getMeadowTag((Meadow) obj), indent);
     final Meadow meadow = (Meadow) obj;
     writeProperty(ostream, "kind", meadow.getKind());
     writeProperty(ostream, "cultivated", Boolean.toString(meadow.isCultivated()));
     writeProperty(ostream, "status", meadow.getStatus().toString());
   } else if (obj instanceof Grove) {
     writeTag(ostream, getGroveTag((Grove) obj), indent);
     final Grove grove = (Grove) obj;
     writeProperty(ostream, "cultivated", Boolean.toString(grove.isCultivated()));
     writeProperty(ostream, "kind", grove.getKind());
   } else if (obj instanceof Mine) {
     writeTag(ostream, "mine", indent);
     final Mine mine = (Mine) obj;
     writeProperty(ostream, "kind", mine.getKind());
     writeProperty(ostream, "status", mine.getStatus().toString());
   } else if (obj instanceof MineralVein) {
     writeTag(ostream, "mineral", indent);
     final MineralVein mineral = (MineralVein) obj;
     writeProperty(ostream, "kind", mineral.getKind());
     writeProperty(ostream, "exposed", Boolean.toString(mineral.isExposed()));
     writeProperty(ostream, "dc", Integer.toString(mineral.getDC()));
   } else if (obj instanceof Shrub) {
     writeTag(ostream, "shrub", indent);
     writeProperty(ostream, "kind", ((Shrub) obj).getKind());
   } else if (obj instanceof StoneDeposit) {
     writeTag(ostream, "stone", indent);
     final StoneDeposit stone = (StoneDeposit) obj;
     writeProperty(ostream, "kind", stone.stone().toString());
     writeProperty(ostream, "dc", Integer.toString(stone.getDC()));
   } else {
     throw new IllegalStateException("Unhandled HarvestableFixture subtype");
   }
   writeProperty(ostream, "id", Integer.toString(obj.getID()));
   writeImageXML(ostream, obj);
   closeLeafTag(ostream);
 }
  /**
   * @param value
   * @param type
   * @return
   */
  private Object createTypedObject(String value, Class type) {
    if (java.lang.String.class == type) return value;
    else if (java.lang.Integer.class == type) return java.lang.Integer.parseInt(value);
    else if (java.lang.Long.class == type) return java.lang.Long.parseLong(value);
    else if (java.lang.Boolean.class == type) return java.lang.Boolean.parseBoolean(value);
    else if (java.lang.Float.class == type) return java.lang.Float.parseFloat(value);
    else if (java.lang.Double.class == type) return java.lang.Double.parseDouble(value);

    return null;
  }
예제 #11
0
  protected void setProperties(UIComponent component) {
    super.setProperties(component);
    javax.faces.component.UIOutput output = null;
    try {
      output = (javax.faces.component.UIOutput) component;
    } catch (ClassCastException cce) {
      throw new IllegalStateException(
          "Component "
              + component.toString()
              + " not expected type.  Expected: javax.faces.component.UIOutput.  Perhaps you're missing a tag?");
    }

    if (converter != null) {
      if (!converter.isLiteralText()) {
        output.setValueExpression("converter", converter);
      } else {
        Converter conv =
            FacesContext.getCurrentInstance()
                .getApplication()
                .createConverter(converter.getExpressionString());
        output.setConverter(conv);
      }
    }

    if (value != null) {
      if (!value.isLiteralText()) {
        output.setValueExpression("value", value);
      } else {
        output.setValue(value.getExpressionString());
      }
    }
    if (escape != null) {
      if (!escape.isLiteralText()) {
        output.setValueExpression("escape", escape);
      } else {
        output
            .getAttributes()
            .put("escape", java.lang.Boolean.valueOf(escape.getExpressionString()));
      }
    }
    if (style != null) {
      if (!style.isLiteralText()) {
        output.setValueExpression("style", style);
      } else {
        output.getAttributes().put("style", style.getExpressionString());
      }
    }
    if (styleClass != null) {
      if (!styleClass.isLiteralText()) {
        output.setValueExpression("styleClass", styleClass);
      } else {
        output.getAttributes().put("styleClass", styleClass.getExpressionString());
      }
    }
  }
예제 #12
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   IsAliveFromWaterMeter other = (IsAliveFromWaterMeter) obj;
   if (value == null) {
     if (other.value != null) return false;
   } else if (!value.equals(other.value)) return false;
   return true;
 }
예제 #13
0
  private boolean getBoolean(
      final Map<String, String> options, final String key, final boolean defaultValue) {

    final String option = options.get(key);

    if (StringUtils.hasText(option)) {
      return java.lang.Boolean.parseBoolean(option);
    }

    return defaultValue;
  }
예제 #14
0
 @Override
 public int hashCode() {
   int result = super.hashCode;
   if (result == 0) {
     result = unknownFields().hashCode();
     result = result * 37 + (deprecated != null ? deprecated.hashCode() : 0);
     result = result * 37 + (uninterpreted_option != null ? uninterpreted_option.hashCode() : 1);
     super.hashCode = result;
   }
   return result;
 }
예제 #15
0
  private abstract static class Cache {
    static final boolean enabled =
        java.lang.Boolean.parseBoolean(System.getProperty("x10.lang.UByte.Cache.enabled", "false"));
    static final int low = -128;
    static final int high = enabled ? 127 : (low - 1); // disable caching
    static final UByte cache[] = new UByte[high - low + 1];

    static {
      for (int i = 0; i < cache.length; ++i) {
        cache[i] = new UByte((byte) (low + i));
      }
    }
  }
예제 #16
0
  protected void setProperties(UIComponent component) {
    super.setProperties(component);
    javax.faces.component.UICommand command = null;
    try {
      command = (javax.faces.component.UICommand) component;
    } catch (ClassCastException cce) {
      throw new IllegalStateException(
          "Component "
              + component.toString()
              + " not expected type.  Expected: javax.faces.component.UICommand.  Perhaps you're missing a tag?");
    }

    if (action != null) {
      command.setActionExpression(action);
    }
    if (actionListener != null) {
      command.addActionListener(new MethodExpressionActionListener(actionListener));
    }
    if (immediate != null) {
      if (!immediate.isLiteralText()) {
        command.setValueExpression("immediate", immediate);
      } else {
        command.setImmediate(
            java.lang.Boolean.valueOf(immediate.getExpressionString()).booleanValue());
      }
    }
    if (label != null) {
      if (!label.isLiteralText()) {
        command.setValueExpression("label", label);
      } else {
        command.getAttributes().put("label", label.getExpressionString());
      }
    }
    if (oncommand != null) {
      if (!oncommand.isLiteralText()) {
        command.setValueExpression("oncommand", oncommand);
      } else {
        command.getAttributes().put("oncommand", oncommand.getExpressionString());
      }
    }
    if (onclick != null) {
      if (!onclick.isLiteralText()) {
        command.setValueExpression("onclick", onclick);
      } else {
        command.getAttributes().put("onclick", onclick.getExpressionString());
      }
    }
    if (onfocusin != null) {
      if (!onfocusin.isLiteralText()) {
        command.setValueExpression("onfocusin", onfocusin);
      } else {
        command.getAttributes().put("onfocusin", onfocusin.getExpressionString());
      }
    }
    if (onfocusout != null) {
      if (!onfocusout.isLiteralText()) {
        command.setValueExpression("onfocusout", onfocusout);
      } else {
        command.getAttributes().put("onfocusout", onfocusout.getExpressionString());
      }
    }
    if (onmousedown != null) {
      if (!onmousedown.isLiteralText()) {
        command.setValueExpression("onmousedown", onmousedown);
      } else {
        command.getAttributes().put("onmousedown", onmousedown.getExpressionString());
      }
    }
    if (onmousemove != null) {
      if (!onmousemove.isLiteralText()) {
        command.setValueExpression("onmousemove", onmousemove);
      } else {
        command.getAttributes().put("onmousemove", onmousemove.getExpressionString());
      }
    }
    if (onmouseout != null) {
      if (!onmouseout.isLiteralText()) {
        command.setValueExpression("onmouseout", onmouseout);
      } else {
        command.getAttributes().put("onmouseout", onmouseout.getExpressionString());
      }
    }
    if (onmouseover != null) {
      if (!onmouseover.isLiteralText()) {
        command.setValueExpression("onmouseover", onmouseover);
      } else {
        command.getAttributes().put("onmouseover", onmouseover.getExpressionString());
      }
    }
    if (onmouseup != null) {
      if (!onmouseup.isLiteralText()) {
        command.setValueExpression("onmouseup", onmouseup);
      } else {
        command.getAttributes().put("onmouseup", onmouseup.getExpressionString());
      }
    }
    if (style != null) {
      if (!style.isLiteralText()) {
        command.setValueExpression("style", style);
      } else {
        command.getAttributes().put("style", style.getExpressionString());
      }
    }
    if (styleClass != null) {
      if (!styleClass.isLiteralText()) {
        command.setValueExpression("styleClass", styleClass);
      } else {
        command.getAttributes().put("styleClass", styleClass.getExpressionString());
      }
    }
    if (type != null) {
      if (!type.isLiteralText()) {
        command.setValueExpression("type", type);
      } else {
        command.getAttributes().put("type", type.getExpressionString());
      }
    }
    if (value != null) {
      if (!value.isLiteralText()) {
        command.setValueExpression("value", value);
      } else {
        command.setValue(value.getExpressionString());
      }
    }
  }
예제 #17
0
파일: Boolean.java 프로젝트: ceylon/ceylon
 @Ignore
 public static Boolean valueOf(java.lang.String string) {
   return instance(java.lang.Boolean.parseBoolean(string));
 }
 /**
  * Convenience method for parsing and setting whether conversion sounds should be enabled by the
  * SDK.
  *
  * @param enabled String representation of boolean enabled
  */
 private void setConversationSoundsEnabled(String enabled) {
   if (enabled != null && enabled.length() > 0) {
     builder.setShouldPlayConversationSounds(Boolean.parseBoolean(enabled));
   }
 }
 /**
  * Convenience method for parsing and setting whether the intro dialog should be shown the first
  * time the app is opened.
  *
  * @param enabled String representation of boolean enabled
  */
 private void setIntroDialogEnabled(String enabled) {
   if (enabled != null && enabled.length() > 0) {
     builder.setShouldShowIntroDialog(Boolean.parseBoolean(enabled));
   }
 }
예제 #20
0
 /**
  * Returns the String representation of the current value.
  *
  * @return the String representation of the current value.
  */
 public java.lang.String toString() {
   return java.lang.Boolean.toString(get());
 }
 /**
  * Convenience method for parsing and setting whether the debug logs from the Instabug SDK are
  * should be printed to LogCat.
  *
  * @param enabled String representation of boolean enabled
  */
 private void setDebugEnabled(String enabled) {
   if (enabled != null && enabled.length() > 0) {
     builder.setDebugEnabled(Boolean.parseBoolean(enabled));
   }
 }
 public static String readBooleanExtension(Element c, String uri) {
   Extension ex = c.getExtension(uri);
   if (ex == null) return null;
   if (!(ex.getValue() instanceof Boolean)) return null;
   return java.lang.Boolean.toString(((Boolean) ex.getValue()).getValue());
 }
 /**
  * Convenience method for parsing and setting whether the comment field is required.
  *
  * @param required String representation of boolean required
  */
 private void setCommentFieldRequired(String required) {
   if (enabled != null && enabled.length() > 0) {
     builder.setCommentFieldRequired(Boolean.parseBoolean(enabled));
   }
 }
예제 #24
0
 protected Boolean parseBooleanPrimitive(Boolean value) {
   return java.lang.Boolean.valueOf(value);
 }
 /**
  * Returns a hash code for this {@code Boolean} object.
  *
  * @return the integer {@code 1231} if this object represents {@code true}; returns the integer
  *     {@code 1237} if this object represents {@code false}.
  */
 @Override
 public int hashCode() {
   return Boolean.hashCode(value);
 }
예제 #26
0
 public java.lang.String toString(byte[] bytes) {
   return java.lang.Boolean.toString(Bytes.toBoolean(bytes));
 }
예제 #27
0
 public byte[] toBytes(java.lang.String value) {
   return Bytes.toBytes(java.lang.Boolean.parseBoolean(value));
 }
 @Override
 public String write(Boolean value) throws Exception {
   return value != null ? value.toString() : EMPTY;
 }