public boolean getIsSimple() { boolean result = false; if (type instanceof StdIntegerType) { result = (((StdIntegerType) type).getType() != datascript.antlr.DataScriptParserTokenTypes.UINT64); } else if (type instanceof BitFieldType) { BitFieldType bitField = (BitFieldType) type; result = 0 < bitField.getLength() && bitField.getLength() < 64; } return result; }
public long getMaxVal() { if (type instanceof SignedBitFieldType) { BitFieldType bitField = (BitFieldType) type; return (1 << bitField.getLength() - 1) - 1; } if (type instanceof BitFieldType) { BitFieldType bitField = (BitFieldType) type; return (1 << bitField.getLength()) - 1; } if (type instanceof StdIntegerType) { StdIntegerType integerType = (StdIntegerType) type; return integerType.getUpperBound().longValue(); } throw new RuntimeException("type of field '" + param.getName() + "' is not a simple type"); }
protected String getTypeName(BitFieldType t) { int length = t.getLength(); if (length < 64) return "INT"; else return "BLOB"; }