public boolean equals(ConstructDataBinningAttributes obj) {
    int i;

    // Compare the elements in the varnames vector.
    boolean varnames_equal = (obj.varnames.size() == varnames.size());
    for (i = 0; (i < varnames.size()) && varnames_equal; ++i) {
      // Make references to String from Object.
      String varnames1 = (String) varnames.elementAt(i);
      String varnames2 = (String) obj.varnames.elementAt(i);
      varnames_equal = varnames1.equals(varnames2);
    }
    // Compare the elements in the binType vector.
    boolean binType_equal = (obj.binType.size() == binType.size());
    for (i = 0; (i < binType.size()) && binType_equal; ++i) {
      // Make references to Byte from Object.
      Byte binType1 = (Byte) binType.elementAt(i);
      Byte binType2 = (Byte) obj.binType.elementAt(i);
      binType_equal = binType1.equals(binType2);
    }
    // Compare the elements in the binBoundaries vector.
    boolean binBoundaries_equal = (obj.binBoundaries.size() == binBoundaries.size());
    for (i = 0; (i < binBoundaries.size()) && binBoundaries_equal; ++i) {
      // Make references to Double from Object.
      Double binBoundaries1 = (Double) binBoundaries.elementAt(i);
      Double binBoundaries2 = (Double) obj.binBoundaries.elementAt(i);
      binBoundaries_equal = binBoundaries1.equals(binBoundaries2);
    }
    // Compare the elements in the numBins vector.
    boolean numBins_equal = (obj.numBins.size() == numBins.size());
    for (i = 0; (i < numBins.size()) && numBins_equal; ++i) {
      // Make references to Integer from Object.
      Integer numBins1 = (Integer) numBins.elementAt(i);
      Integer numBins2 = (Integer) obj.numBins.elementAt(i);
      numBins_equal = numBins1.equals(numBins2);
    }
    // Create the return value
    return ((name.equals(obj.name))
        && varnames_equal
        && binType_equal
        && binBoundaries_equal
        && (reductionOperator == obj.reductionOperator)
        && (varForReductionOperator.equals(obj.varForReductionOperator))
        && (undefinedValue == obj.undefinedValue)
        && (binningScheme == obj.binningScheme)
        && numBins_equal
        && (overTime == obj.overTime)
        && (timeStart == obj.timeStart)
        && (timeEnd == obj.timeEnd)
        && (timeStride == obj.timeStride)
        && (outOfBoundsBehavior == obj.outOfBoundsBehavior));
  }
  /**
   * Convert a byte array to a hex string
   *
   * @param bytes byte array to convert to a hex string
   * @return return a String in hex representing the byte array
   */
  public String toHexString(byte[] bytes) {
    StringBuffer result = new StringBuffer("0x");

    for (int i = 0; i < bytes.length; i++) {
      Byte aByte = new Byte(bytes[i]);
      Integer anInt = new Integer(aByte.intValue());
      String hexVal = Integer.toHexString(anInt.intValue());

      if (hexVal.length() > SIZE) hexVal = hexVal.substring(hexVal.length() - SIZE);

      result.append(
          (SIZE > hexVal.length() ? ZEROS.substring(0, SIZE - hexVal.length()) : "") + hexVal);
    }
    return (result.toString());
  }
Beispiel #3
0
  protected Map<java.lang.Short, Object> createOptionalParameterByCode(
      OptionalParameter[] optionalParameters) {
    if (optionalParameters == null) {
      return null;
    }

    Map<java.lang.Short, Object> optParams = new HashMap<java.lang.Short, Object>();
    for (OptionalParameter optPara : optionalParameters) {
      if (COctetString.class.isInstance(optPara)) {
        optParams.put(
            java.lang.Short.valueOf(optPara.tag), ((COctetString) optPara).getValueAsString());
      } else if (org.jsmpp.bean.OptionalParameter.OctetString.class.isInstance(optPara)) {
        optParams.put(java.lang.Short.valueOf(optPara.tag), ((OctetString) optPara).getValue());
      } else if (org.jsmpp.bean.OptionalParameter.Byte.class.isInstance(optPara)) {
        optParams.put(
            java.lang.Short.valueOf(optPara.tag),
            java.lang.Byte.valueOf(((org.jsmpp.bean.OptionalParameter.Byte) optPara).getValue()));
      } else if (org.jsmpp.bean.OptionalParameter.Short.class.isInstance(optPara)) {
        optParams.put(
            java.lang.Short.valueOf(optPara.tag),
            java.lang.Short.valueOf(((org.jsmpp.bean.OptionalParameter.Short) optPara).getValue()));
      } else if (org.jsmpp.bean.OptionalParameter.Int.class.isInstance(optPara)) {
        optParams.put(
            java.lang.Short.valueOf(optPara.tag),
            Integer.valueOf(((org.jsmpp.bean.OptionalParameter.Int) optPara).getValue()));
      } else if (Null.class.isInstance(optPara)) {
        optParams.put(java.lang.Short.valueOf(optPara.tag), null);
      }
    }

    return optParams;
  }
  public ConstructDataBinningAttributes(ConstructDataBinningAttributes obj) {
    super(ConstructDataBinningAttributes_numAdditionalAtts);

    int i;

    name = new String(obj.name);
    varnames = new Vector(obj.varnames.size());
    for (i = 0; i < obj.varnames.size(); ++i)
      varnames.addElement(new String((String) obj.varnames.elementAt(i)));

    binType = new Vector(obj.binType.size());
    for (i = 0; i < obj.binType.size(); ++i) {
      Byte bv = (Byte) obj.binType.elementAt(i);
      binType.addElement(new Byte(bv.byteValue()));
    }

    binBoundaries = new Vector(obj.binBoundaries.size());
    for (i = 0; i < obj.binBoundaries.size(); ++i) {
      Double dv = (Double) obj.binBoundaries.elementAt(i);
      binBoundaries.addElement(new Double(dv.doubleValue()));
    }

    reductionOperator = obj.reductionOperator;
    varForReductionOperator = new String(obj.varForReductionOperator);
    undefinedValue = obj.undefinedValue;
    binningScheme = obj.binningScheme;
    numBins = new Vector();
    for (i = 0; i < obj.numBins.size(); ++i) {
      Integer iv = (Integer) obj.numBins.elementAt(i);
      numBins.addElement(new Integer(iv.intValue()));
    }
    overTime = obj.overTime;
    timeStart = obj.timeStart;
    timeEnd = obj.timeEnd;
    timeStride = obj.timeStride;
    outOfBoundsBehavior = obj.outOfBoundsBehavior;

    SelectAll();
  }
 @JSFunction
 public static void setBlock(
     String worldName, int x, int y, int z, String tileName, int tileData) {
   org.dragonet.DragonetServer.instance()
       .getServer()
       .getWorld(worldName)
       .getBlockAt(x, y, z)
       .setType(Material.getMaterial(tileName));
   org.dragonet.DragonetServer.instance()
       .getServer()
       .getWorld(worldName)
       .getBlockAt(x, y, z)
       .setData(java.lang.Byte.parseByte(tileData + ""));
 }
 ////////////////
 //
 // World Methods
 //
 ////////////////
 @JSFunction
 public static void setArea(
     String worldName,
     int x1,
     int y1,
     int z1,
     int x2,
     int y2,
     int z2,
     String materialName,
     int tileData) {
   for (int x = x1; x < x2; x++) {
     for (int y = y1; y < y2; y++) {
       for (int z = z1; z < z2; z++) {
         setBlock(worldName, x, y, z, materialName, java.lang.Byte.parseByte(tileData + ""));
       }
     }
   }
 }
Beispiel #7
0
 @Override
 public String toString() {
   if ($value >= 0) return java.lang.Byte.toString($value);
   else return java.lang.Integer.toString((int) $value & 0xff);
 }