Examples of UnsignedShort


Examples of propel.core.userTypes.UnsignedShort

    if (targetType.equals(Int128.class))
      return bool ? new Int128("1") : new Int128("0");
    if (targetType.equals(UnsignedByte.class))
      return bool ? new UnsignedByte((byte) 1) : new UnsignedByte((byte) 0);
    if (targetType.equals(UnsignedShort.class))
      return bool ? new UnsignedShort(1) : new UnsignedShort(0);
    if (targetType.equals(UnsignedInteger.class))
      return bool ? new UnsignedInteger(1) : new UnsignedInteger(0);
    if (targetType.equals(UnsignedLong.class))
      return bool ? new UnsignedLong("1") : new UnsignedLong("0");
    if (targetType.equals(SignedByte.class))
View Full Code Here

Examples of propel.core.userTypes.UnsignedShort

    if (targetType.equals(Int128.class))
      return StringUtils.parseInt128(str);
    if (targetType.equals(UnsignedByte.class))
      return new UnsignedByte(str);
    if (targetType.equals(UnsignedShort.class))
      return new UnsignedShort(str);
    if (targetType.equals(UnsignedInteger.class))
      return new UnsignedInteger(str);
    if (targetType.equals(UnsignedLong.class))
      return new UnsignedLong(str);
    if (targetType.equals(SignedByte.class))
View Full Code Here

Examples of propel.core.userTypes.UnsignedShort

   * @throws NumberFormatException A number could not be parsed.
   */
  @Validate
  public static UnsignedShort fromBinaryToUInt16(@NotNull final String binary)
  {
    return new UnsignedShort(new BigInteger(binary, 2));
  }
View Full Code Here

Examples of propel.core.userTypes.UnsignedShort

   * @throws NumberFormatException A number could not be parsed.
   */
  @Validate
  public static UnsignedShort fromStringToUInt16(@NotNull final String value)
  {
    return new UnsignedShort(value);
  }
View Full Code Here

Examples of propel.core.userTypes.UnsignedShort

    if (targetType.equals(Int128.class))
      return new Int128(number.toString());
    if (targetType.equals(UnsignedByte.class))
      return new UnsignedByte((short) (number.byteValue() & 0xFF));
    if (targetType.equals(UnsignedShort.class))
      return new UnsignedShort((int) (number.shortValue() & 0xFFFF));
    if (targetType.equals(UnsignedInteger.class))
      return new UnsignedInteger((long) (number.intValue() & 0xFFFFFFFF));
    if (targetType.equals(UnsignedLong.class))
    {
      // perform similar operation as above to get rid of the negative values
View Full Code Here

Examples of propel.core.userTypes.UnsignedShort

    if (targetType.equals(Int128.class))
      return new Int128(Integer.valueOf(ch).toString());
    if (targetType.equals(UnsignedByte.class))
      return new UnsignedByte((byte) ch);
    if (targetType.equals(UnsignedShort.class))
      return new UnsignedShort(ch);
    if (targetType.equals(UnsignedInteger.class))
      return new UnsignedInteger(ch);
    if (targetType.equals(UnsignedLong.class))
      return new UnsignedLong(new Integer(ch).toString());
    if (targetType.equals(SignedByte.class))
View Full Code Here

Examples of propel.core.userTypes.UnsignedShort

    if (targetType.equals(Int128.class))
      return bool ? new Int128("1") : new Int128("0");
    if (targetType.equals(UnsignedByte.class))
      return bool ? new UnsignedByte((byte) 1) : new UnsignedByte((byte) 0);
    if (targetType.equals(UnsignedShort.class))
      return bool ? new UnsignedShort(1) : new UnsignedShort(0);
    if (targetType.equals(UnsignedInteger.class))
      return bool ? new UnsignedInteger(1) : new UnsignedInteger(0);
    if (targetType.equals(UnsignedLong.class))
      return bool ? new UnsignedLong("1") : new UnsignedLong("0");
    if (targetType.equals(SignedByte.class))
View Full Code Here

Examples of propel.core.userTypes.UnsignedShort

    if (targetType.equals(Int128.class))
      return StringUtils.parseInt128(str);
    if (targetType.equals(UnsignedByte.class))
      return new UnsignedByte(str);
    if (targetType.equals(UnsignedShort.class))
      return new UnsignedShort(str);
    if (targetType.equals(UnsignedInteger.class))
      return new UnsignedInteger(str);
    if (targetType.equals(UnsignedLong.class))
      return new UnsignedLong(str);
    if (targetType.equals(SignedByte.class))
View Full Code Here

Examples of propel.core.userTypes.UnsignedShort

  @Validate
  public static UnsignedShort parseUInt16(@NotNull final String value, @NotNull final UnsignedShort minValue,
                                          @NotNull final UnsignedShort maxValue)
  {
    // parse
    UnsignedShort result;
    try
    {
      result = new UnsignedShort(value);
    }
    catch(Throwable e)
    {
      throw new NumberFormatException("The value '" + value + "' could not be parsed: " + e.getMessage());
    }

    // sanity check
    if (result.compareTo(minValue) < 0)
      throw new NumberFormatException("Value (" + result + ") was less than allowed minimum (" + minValue + ").");
    if (result.compareTo(maxValue) > 0)
      throw new NumberFormatException("Value (" + result + ") was more than allowed maximum (" + maxValue + ").");

    return result;
  }
View Full Code Here

Examples of propel.core.userTypes.UnsignedShort

      value = reverse(value);

    BigInteger result = BigInteger.ZERO;
    result = result.or(new BigInteger(CONSTANT.EMPTY_STRING + (((value[0] & 0xff) << 8) | (value[1] & 0xff))));

    return new UnsignedShort(result);
  }
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.