Beispiel #1
0
 public Object freeze(ColumnLoader.ValueSet valueSet) {
   final int n = valueSet.map.keySet().size();
   int extra = valueSet.containsNull ? 1 : 0;
   Comparable[] codeValues = valueSet.map.keySet().toArray(new Comparable[n + extra]);
   Arrays.sort(codeValues, 0, n);
   ColumnLoader.ValueSet codeValueSet = new ColumnLoader.ValueSet(int.class);
   for (Comparable value : valueSet.values) {
     int code;
     if (value == null) {
       code = n;
     } else {
       code = Arrays.binarySearch(codeValues, value);
       assert code >= 0 : code + ", " + value;
     }
     codeValueSet.add(code);
   }
   Object codes = representation.freeze(codeValueSet);
   return Pair.of(codes, codeValues);
 }
Beispiel #2
0
 public Object getObject(Object dataSet, int ordinal) {
   Pair<Object, Object[]> pair = (Pair<Object, Object[]>) dataSet;
   int code = representation.getInt(pair.left, ordinal);
   return pair.right[code];
 }