@Override public short shortValue() { return _value.shortValue(); }
@Override public short shortValue() { return _value.shortValue(); }
@Override public short shortValue() { return _value.shortValue(); }
return (X) Short.valueOf( value.shortValue() );
@Override public Short parseLiteral(Object input) { if (!(input instanceof IntValue)) { throw new CoercingParseLiteralException( "Expected AST type 'IntValue' but was '" + typeName(input) + "'." ); } BigInteger value = ((IntValue) input).getValue(); if (value.compareTo(SHORT_MIN) < 0 || value.compareTo(SHORT_MAX) > 0) { throw new CoercingParseLiteralException( "Expected value to be in the Short range but it was '" + value.toString() + "'" ); } return value.shortValue(); } });
fastBigIntegerValueUnscaled( fastSignum, fast0, fast1, fast2); return bigInteger.remainder(BIG_INTEGER_UNSIGNED_SHORT_MAX_VALUE).shortValue(); } else { fastBigIntegerValueUnscaled( fastSignum, result0, result1, result2); return bigInteger.remainder(BIG_INTEGER_UNSIGNED_SHORT_MAX_VALUE).shortValue();
public static short toShort(String s) throws SQLException { if (s != null) { try { s = s.trim(); return Short.parseShort(s); } catch (NumberFormatException e) { try { BigDecimal n = new BigDecimal(s); BigInteger i = n.toBigInteger(); int gt = i.compareTo(SHORTMAX); int lt = i.compareTo(SHORTMIN); if (gt > 0 || lt < 0) { throw new PSQLException(GT.tr("Bad value for type {0} : {1}", "short", s), PSQLState.NUMERIC_VALUE_OUT_OF_RANGE); } return i.shortValue(); } catch (NumberFormatException ne) { throw new PSQLException(GT.tr("Bad value for type {0} : {1}", "short", s), PSQLState.NUMERIC_VALUE_OUT_OF_RANGE); } } } return 0; // SQL NULL }
PSQLState.NUMERIC_VALUE_OUT_OF_RANGE); return i.shortValue();
@Override public Object convertCassTypeToObjType(PropertyMappingDefinition md, byte[] value) { BigInteger bigInt = new BigInteger(value); // determine our target integer type and then go from there on the // conversion method Class<?> targetClass = md.getPropDesc().getPropertyType(); if (targetClass.equals(Integer.class) || targetClass.equals(int.class)) { return Integer.valueOf(bigInt.intValue()); } else if (targetClass.equals(Long.class) || targetClass.equals(long.class)) { return Long.valueOf(bigInt.longValue()); } else if (targetClass.equals(Short.class) || targetClass.equals(short.class)) { return Short.valueOf(bigInt.shortValue()); } else if (targetClass.equals(Byte.class) || targetClass.equals(byte.class)) { return Byte.valueOf(bigInt.byteValue()); } else if (targetClass.equals(BigInteger.class)) { return bigInt; } else { throw new HectorObjectMapperException("Column, " + md.getColName() + ", cannot be converted using " + getClass().getSimpleName() + " because POJO property, " + md.getPropDesc().getName() + ", of type " + md.getPropDesc().getPropertyType().getName() + " is not an integer type (in a mathematical context)"); } }
return ((BigInteger) o).floatValue(); } else if (o instanceof BigInteger && cls.isAssignableFrom(Short.class)) { return ((BigInteger) o).shortValue(); } else if (o instanceof BigInteger && cls.isAssignableFrom(BigDecimal.class)) { return new BigDecimal((BigInteger) o); return ((BigDecimal) o).floatValue(); } else if (o instanceof BigDecimal && cls.isAssignableFrom(Short.class)) { return ((BigDecimal) o).toBigInteger().shortValue(); } else if (o instanceof BigDecimal && cls.isAssignableFrom(Long.class)) { return ((BigDecimal) o).toBigInteger().longValue();
public short shortValue(){ if(bipart == null) return (short) lpart; else return bipart.shortValue(); }
@Override public short toShort() { return value.shortValue(); }
@Override public short shortValue() { return value.shortValue(); }
@Override public short shortValue() { return value.shortValue(); }
@Override public short toShort() { if (type == Type.BIG_INTEGER) { return ((BigInteger) objectValue).shortValue(); } return (short) longValue; }
private static String asIpv6AddressString(BigInteger ipv6AddressAsBigInteger) { BigInteger remainder = ipv6AddressAsBigInteger; String[] pieces = new String[8]; for (int i = 0; i < 8; i++) { int mask = (int) remainder.shortValue() & 0xFFFF; pieces[7 - i] = String.format("%x", mask); remainder = remainder.shiftRight(16); } return StringUtils.join(pieces, ":"); }
@Override public short getShort() { if (value.compareTo(SHORT_MAX) > 0 || value.compareTo(SHORT_MIN) < 0) { throw new MessageTypeException(); // TODO message } return value.shortValue(); }
/** * Gets the value. * @return the value. */ public short getShortValue(){ return getBigIntegerValue().shortValue(); }
@Override public short asShort() { if (!isInShortRange()) { throw new MessageIntegerOverflowException(value); } return value.shortValue(); }
@Override void setValueFromMmsDataObj(Data data) throws ServiceError { if (data.getUnsigned() == null) { throw new ServiceError(ServiceError.TYPE_CONFLICT, "expected type: unsigned"); } value = data.getUnsigned().value.shortValue(); }