it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap Java Examples

The following examples show how to use it.unimi.dsi.fastutil.objects.Object2IntLinkedOpenHashMap. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TableReader.java    From fastjgame with Apache License 2.0 6 votes vote down vote up
/**
 * 读取属性名行
 *
 * @param fileName 文件名,用于打印更详细的错误原因
 * @param rowIndex 行索引
 * @param row      行内容
 * @return 命名行
 */
private ColNameRow readColNameRow(String fileName, int rowIndex, T row) {
    // 使用LinkedHashMap以保持读入顺序
    int totalColNum = getTotalColNum(row);
    Object2IntMap<String> colName2Index = new Object2IntLinkedOpenHashMap<>(totalColNum + 1);
    for (int colIndex = 0; colIndex < totalColNum; colIndex++) {
        String originalColName = getNullableCell(row, colIndex);
        // 属性名称行,空白属性跳过
        if (null == originalColName) {
            continue;
        }
        // 去掉空白填充
        String realColName = originalColName.trim();
        if (realColName.length() == 0) {
            continue;
        }
        // 属性名不可以有重复
        if (colName2Index.containsKey(realColName)) {
            throw new IllegalArgumentException("file " + fileName
                    + " propertyNameRow has duplicate column " + realColName);
        }
        colName2Index.put(realColName, colIndex);
    }
    return new ColNameRow(rowIndex, colName2Index);
}
 
Example #2
Source File: FieldsDescriptor.java    From attic-apex-malhar with Apache License 2.0 4 votes vote down vote up
/**
 * Gets the type to field to index map.
 * @return The type to field to index map.
 */
public Map<Type, Object2IntLinkedOpenHashMap<String>> getTypeToFieldToIndex()
{
  return typeToFieldToIndex;
}
 
Example #3
Source File: FieldsDescriptor.java    From attic-apex-malhar with Apache License 2.0 2 votes vote down vote up
/**
 * Gets the mapping from the type of a field to the number of values to store for that type.
 * The number of of values to store for a type is usually the number of fields of that type,
 * but if there is type compression enabled for a type, the number of values to store for
 * that type will be 1.
 * @return A map from a type to the number of values to store for that type.
 */
public Object2IntLinkedOpenHashMap<Type> getTypeToSize()
{
  return typeToSize;
}