ExplicitOrdering(List<T> valuesInOrder) { this(Maps.indexMap(valuesInOrder)); }
ExplicitOrdering(List<T> valuesInOrder) { this(Maps.indexMap(valuesInOrder)); }
PowerSet(Set<E> input) { checkArgument( input.size() <= 30, "Too many elements to create power set: %s > 30", input.size()); this.inputSet = Maps.indexMap(input); }
ExplicitOrdering(List<T> valuesInOrder) { this(Maps.indexMap(valuesInOrder)); }
PowerSet(Set<E> input) { this.inputSet = Maps.indexMap(input); checkArgument( inputSet.size() <= 30, "Too many elements to create power set: %s > 30", inputSet.size()); }
private ArrayTable(Iterable<? extends R> rowKeys, Iterable<? extends C> columnKeys) { this.rowList = ImmutableList.copyOf(rowKeys); this.columnList = ImmutableList.copyOf(columnKeys); checkArgument(rowList.isEmpty() == columnList.isEmpty()); /* * TODO(jlevy): Support only one of rowKey / columnKey being empty? If we * do, when columnKeys is empty but rowKeys isn't, rowKeyList() can contain * elements but rowKeySet() will be empty and containsRow() won't * acknolwedge them. */ rowKeyToIndex = Maps.indexMap(rowList); columnKeyToIndex = Maps.indexMap(columnList); @SuppressWarnings("unchecked") V[][] tmpArray = (V[][]) new Object[rowList.size()][columnList.size()]; array = tmpArray; // Necessary because in GWT the arrays are initialized with "undefined" instead of null. eraseAll(); }
private ArrayTable(Iterable<? extends R> rowKeys, Iterable<? extends C> columnKeys) { this.rowList = ImmutableList.copyOf(rowKeys); this.columnList = ImmutableList.copyOf(columnKeys); checkArgument(rowList.isEmpty() == columnList.isEmpty()); /* * TODO(jlevy): Support only one of rowKey / columnKey being empty? If we * do, when columnKeys is empty but rowKeys isn't, rowKeyList() can contain * elements but rowKeySet() will be empty and containsRow() won't * acknolwedge them. */ rowKeyToIndex = Maps.indexMap(rowList); columnKeyToIndex = Maps.indexMap(columnList); @SuppressWarnings("unchecked") V[][] tmpArray = (V[][]) new Object[rowList.size()][columnList.size()]; array = tmpArray; // Necessary because in GWT the arrays are initialized with "undefined" instead of null. eraseAll(); }
ImmutableSet<R> rowSpace, ImmutableSet<C> columnSpace) { Map<R, Integer> rowIndex = Maps.indexMap(rowSpace); Map<R, Map<C, V>> rows = Maps.newLinkedHashMap(); for (R row : rowSpace) {
private ArrayTable(Iterable<? extends R> rowKeys, Iterable<? extends C> columnKeys) { this.rowList = ImmutableList.copyOf(rowKeys); this.columnList = ImmutableList.copyOf(columnKeys); checkArgument(rowList.isEmpty() == columnList.isEmpty()); /* * TODO(jlevy): Support only one of rowKey / columnKey being empty? If we * do, when columnKeys is empty but rowKeys isn't, rowKeyList() can contain * elements but rowKeySet() will be empty and containsRow() won't * acknolwedge them. */ rowKeyToIndex = Maps.indexMap(rowList); columnKeyToIndex = Maps.indexMap(columnList); @SuppressWarnings("unchecked") V[][] tmpArray = (V[][]) new Object[rowList.size()][columnList.size()]; array = tmpArray; // Necessary because in GWT the arrays are initialized with "undefined" instead of null. eraseAll(); }
@Override SerializedForm createSerializedForm() { Map<C, Integer> columnKeyToIndex = Maps.indexMap(columnKeySet()); int[] cellColumnIndices = new int[cellSet().size()]; int i = 0; for (Cell<R, C, V> cell : cellSet()) { cellColumnIndices[i++] = columnKeyToIndex.get(cell.getColumnKey()); } return SerializedForm.create(this, cellRowIndices, cellColumnIndices); } }
PowerSet(Set<E> input) { this.inputSet = Maps.indexMap(input); checkArgument( inputSet.size() <= 30, "Too many elements to create power set: %s > 30", inputSet.size()); }
ImmutableSet<R> rowSpace, ImmutableSet<C> columnSpace) { Map<R, Integer> rowIndex = Maps.indexMap(rowSpace); Map<R, Map<C, V>> rows = Maps.newLinkedHashMap(); for (R row : rowSpace) {
final ImmutableMap<E, Integer> index = Maps.indexMap(set); checkNonnegative(size, "size"); checkArgument(size <= index.size(), "size (%s) must be <= set.size() (%s)", size, index.size());
@Override SerializedForm createSerializedForm() { Map<C, Integer> columnKeyToIndex = Maps.indexMap(columnKeySet()); int[] cellColumnIndices = new int[cellSet().size()]; int i = 0; for (Cell<R, C, V> cell : cellSet()) { cellColumnIndices[i++] = columnKeyToIndex.get(cell.getColumnKey()); } return SerializedForm.create(this, cellRowIndices, cellColumnIndices); } }
final ImmutableMap<E, Integer> index = Maps.indexMap(set); checkNonnegative(size, "size"); checkArgument(size <= index.size(), "size (%s) must be <= set.size() (%s)", size, index.size());
ImmutableSet<R> rowSpace, ImmutableSet<C> columnSpace) { Map<R, Integer> rowIndex = Maps.indexMap(rowSpace); Map<R, Map<C, V>> rows = Maps.newLinkedHashMap(); for (R row : rowSpace) {
@Override SerializedForm createSerializedForm() { Map<C, Integer> columnKeyToIndex = Maps.indexMap(columnKeySet()); int[] cellColumnIndices = new int[cellSet().size()]; int i = 0; for (Cell<R, C, V> cell : cellSet()) { cellColumnIndices[i++] = columnKeyToIndex.get(cell.getColumnKey()); } return SerializedForm.create(this, cellRowIndices, cellColumnIndices); } }