コード例 #1
0
ファイル: StringConvertors.java プロジェクト: dhosa/yamcs
 public static String toString(Value rv, boolean withType) {
   if (withType) return toString(rv);
   switch (rv.getType()) {
     case BINARY:
       return arrayToHexString(rv.getBinaryValue());
     case DOUBLE:
       return Double.toString(rv.getDoubleValue());
     case FLOAT:
       return Float.toString(rv.getFloatValue());
     case SINT32:
       return Integer.toString(rv.getSint32Value());
     case UINT32:
       return Long.toString(rv.getUint32Value() & 0xFFFFFFFFL);
     case SINT64:
       return Long.toString(rv.getSint64Value());
     case UINT64:
       if (rv.getUint64Value() >= 0) return Long.toString(rv.getUint64Value());
       else return BigInteger.valueOf(rv.getUint64Value()).add(B64).toString();
     case STRING:
       return rv.getStringValue();
     case BOOLEAN:
       return Boolean.toString(rv.getBooleanValue());
     case TIMESTAMP:
       return TimeEncoding.toOrdinalDateTime(rv.getTimestampValue());
   }
   return null;
 }
コード例 #2
0
ファイル: StringConvertors.java プロジェクト: dhosa/yamcs
 public static String toString(Value rv) {
   switch (rv.getType()) {
     case BINARY:
       return "(BINARY)" + arrayToHexString(rv.getBinaryValue());
     case DOUBLE:
       return "(DOUBLE)" + rv.getDoubleValue();
     case FLOAT:
       return "(FLOAT)" + rv.getFloatValue();
     case SINT32:
       return "(SIGNED_INTEGER)" + rv.getSint32Value();
     case UINT32:
       return "(UNSIGNED_INTEGER)" + Long.toString(rv.getUint32Value() & 0xFFFFFFFFL);
     case SINT64:
       return "(SIGNED_INTEGER)" + rv.getSint64Value();
     case UINT64:
       return "(UNSIGNED_INTEGER)" + rv.getUint64Value();
     case STRING:
       return "(STRING)" + rv.getStringValue();
     case BOOLEAN:
       return "(BOOLEAN)" + rv.getBooleanValue();
     case TIMESTAMP:
       return "(TIMESTAMP)" + TimeEncoding.toOrdinalDateTime(rv.getTimestampValue());
   }
   return null;
 }