当前位置: 首页>>代码示例>>Java>>正文


Java ShortArrayList类代码示例

本文整理汇总了Java中it.unimi.dsi.fastutil.shorts.ShortArrayList的典型用法代码示例。如果您正苦于以下问题:Java ShortArrayList类的具体用法?Java ShortArrayList怎么用?Java ShortArrayList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ShortArrayList类属于it.unimi.dsi.fastutil.shorts包,在下文中一共展示了ShortArrayList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: translate

import it.unimi.dsi.fastutil.shorts.ShortArrayList; //导入依赖的package包/类
public short translate(final BitSet writerSet){
	Short combiIndex = index.get(writerSet);
	if (combiIndex == null){
		BitSet bnew = new BitSet();
		
		bnew.or(writerSet);
		ShortArrayList a = new ShortArrayList();
		for (int i = writerSet.nextSetBit(0); i >= 0; i = writerSet.nextSetBit(i + 1)) {
			a.add((short) i);
		}
		combiIndex = (short) (sets.size() - DICT_START);
		if (combiIndex == Short.MAX_VALUE){
			throw new RuntimeException("writerDictionary is full. Decrease --max-areas value");
		}
		sets.add(bnew);
		arrays.add(a);
		index.put(bnew, combiIndex);
	}
	return combiIndex;
}
 
开发者ID:mantlik,项目名称:osm2garmin,代码行数:21,代码来源:SplitProcessor.java

示例2: remove

import it.unimi.dsi.fastutil.shorts.ShortArrayList; //导入依赖的package包/类
public short remove(int key) {
	int chunkid = key/CHUNK_SIZE;
	int chunkoffset = key%CHUNK_SIZE;
	if (chunkid >= valschunks.size())
		return unassigned;
	ShortArrayList chunk = valschunks.get(chunkid);
	long chunkmask = bitmasks.get(chunkid);
	long elementmask = 1L << chunkoffset;
	if ((chunkmask & elementmask) == 0) {
		// Not in the array.
		// Do nothing;
		return unassigned;
	} else {
		size--;
		// In the array. Time to insert.
		int offset = countUnder(chunkmask,chunkoffset);
		short out = chunk.get(offset);
		chunk.rem(offset);
		bitmasks.set(chunkid, (~elementmask) & chunkmask);
		return out;
	}		
}
 
开发者ID:mantlik,项目名称:osm2garmin,代码行数:23,代码来源:SparseInt2ShortMap.java

示例3: end

import it.unimi.dsi.fastutil.shorts.ShortArrayList; //导入依赖的package包/类
@Override
public void end() {
  if (elementClass == boolean.class) {
    parent.add(((BooleanArrayList) container).toBooleanArray());
  } else if (elementClass == byte.class) {
    parent.add(((ByteArrayList) container).toByteArray());
  } else if (elementClass == char.class) {
    parent.add(((CharArrayList) container).toCharArray());
  } else if (elementClass == short.class) {
    parent.add(((ShortArrayList) container).toShortArray());
  } else if (elementClass == int.class) {
    parent.add(((IntArrayList) container).toIntArray());
  } else if (elementClass == long.class) {
    parent.add(((LongArrayList) container).toLongArray());
  } else if (elementClass == float.class) {
    parent.add(((FloatArrayList) container).toFloatArray());
  } else if (elementClass == double.class) {
    parent.add(((DoubleArrayList) container).toDoubleArray());
  } else {
    parent.add(((ArrayList) container).toArray());
  }
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:23,代码来源:AvroRecordConverter.java

示例4: unique

import it.unimi.dsi.fastutil.shorts.ShortArrayList; //导入依赖的package包/类
@Override
public ShortColumn unique() {
    Selection selection = new BitmapBackedSelection();
    for (short i : data) {
        selection.add(i);
    }
    int[] ints = selection.toArray();
    short[] shorts = new short[ints.length];
    for (int i = 0; i < ints.length; i++) {
        shorts[i] = (short) ints[i];
    }
    return new ShortColumn(name() + " Unique values", ShortArrayList.wrap(shorts));
}
 
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:14,代码来源:ShortColumn.java

示例5: put

import it.unimi.dsi.fastutil.shorts.ShortArrayList; //导入依赖的package包/类
public short put(int key, short val) {
	if (val == unassigned) {
		throw new IllegalArgumentException("Cannot store the value that is reserved as being unassigned. val="+val);
	}
	if (key < 0) {
		throw new IllegalArgumentException("Cannot store the negative key,"+key);
	}

	resizeTo(key);
	int chunkid = key/CHUNK_SIZE;
	int chunkoffset = key%CHUNK_SIZE;
	if (valschunks.get(chunkid) == null)
		valschunks.set(chunkid, new ShortArrayList(1));
	ShortArrayList chunk = valschunks.get(chunkid);
	long chunkmask = bitmasks.get(chunkid);
	long elementmask = 1L << chunkoffset;
	if ((chunkmask & elementmask) != 0) {
		// Already in the array, find the offset and store.
		short out = chunk.get(countUnder(chunkmask,chunkoffset));
		chunk.set(countUnder(chunkmask,chunkoffset), val);
		//System.out.println("Returning found key "+out+" from put "+ key + " " + val);
		return out;
	} else {
		size++;
		// Not in the array. Time to insert.
		int offset = countUnder(chunkmask,chunkoffset);
		chunk.add(offset,val);
		bitmasks.set(chunkid, elementmask | chunkmask);
		//System.out.println("Returning unassigned from put "+ key + " " + val);
		return unassigned;
	}
}
 
开发者ID:mantlik,项目名称:osm2garmin,代码行数:33,代码来源:SparseInt2ShortMap.java

示例6: get

import it.unimi.dsi.fastutil.shorts.ShortArrayList; //导入依赖的package包/类
public short get(int key) {
	int chunkid = key/CHUNK_SIZE;
	int chunkoffset = key%CHUNK_SIZE;
	if (key <= 0 || chunkid >= valschunks.size())
		return unassigned;
	ShortArrayList chunk = valschunks.get(chunkid);
	long chunkmask = bitmasks.get(chunkid);
	long elementmask = 1L << chunkoffset;
	if ((chunkmask & elementmask) == 0) {
		return unassigned;
	} else {
		return chunk.get(countUnder(chunkmask,chunkoffset));
	}
}
 
开发者ID:mantlik,项目名称:osm2garmin,代码行数:15,代码来源:SparseInt2ShortMap.java

示例7: clear

import it.unimi.dsi.fastutil.shorts.ShortArrayList; //导入依赖的package包/类
@Override
public void clear() {
	valschunks = new ObjectArrayList<ShortArrayList>();
	bitmasks = new LongArrayList();	
	capacity = 0;
	size = 0;
}
 
开发者ID:mantlik,项目名称:osm2garmin,代码行数:8,代码来源:SparseInt2ShortMap.java

示例8: get

import it.unimi.dsi.fastutil.shorts.ShortArrayList; //导入依赖的package包/类
public ShortList get(int key) {
	if (!map.containsKey(key))
		return ShortLists.EMPTY_LIST;
	ShortArrayList out = new ShortArrayList(1);
	addTo(key,out);
	return out;
}
 
开发者ID:mantlik,项目名称:osm2garmin,代码行数:8,代码来源:SparseInt2ShortMultiMap.java

示例9: addTo

import it.unimi.dsi.fastutil.shorts.ShortArrayList; //导入依赖的package包/类
public void addTo(int key, ShortArrayList out) {
	if (!map.containsKey(key))
		return;
	out.add(map.get(key));
	if (overflow != null)
		overflow.addTo(key,out);
}
 
开发者ID:mantlik,项目名称:osm2garmin,代码行数:8,代码来源:SparseInt2ShortMultiMap.java

示例10: join

import it.unimi.dsi.fastutil.shorts.ShortArrayList; //导入依赖的package包/类
/**
 * Joins arrays together, if only one array contains elements it will be returned without coping anything. <br>
 * If given array or arrays is empty, new empty array will be returned.
 *
 * @param arrays arrays to join.
 *
 * @return new joined array, or one of given ones if other arrays were empty.
 */
public static short[] join(final short[]... arrays)
{
    if (arrays.length == 0)
    {
        return EMPTY_SHORTS;
    }
    if (arrays.length == 1)
    {
        return arrays[0];
    }
    if (arrays.length == 2)
    {
        return join(arrays[0], arrays[1]);
    }
    short[] notNull = null;
    int finalSize = 0;
    int nullArrays = 0;
    final ShortArrayList list = new ShortArrayList(arrays.length * 10);
    for (final short[] array : arrays)
    {
        if ((array == null) || (array.length == 0))
        {
            nullArrays++;
        }
        else
        {
            notNull = array;
            finalSize += array.length;
            list.addElements(list.size(), array);
        }
    }
    if (nullArrays == arrays.length)
    {
        return EMPTY_SHORTS;
    }
    if (nullArrays == (arrays.length - 1))
    {
        return notNull;
    }
    return list.toArray(new short[list.size()]);
}
 
开发者ID:Diorite,项目名称:Diorite-old,代码行数:50,代码来源:DioriteArrayUtils.java

示例11: ShortColumn

import it.unimi.dsi.fastutil.shorts.ShortArrayList; //导入依赖的package包/类
public ShortColumn(String name) {
    this(name, new ShortArrayList(DEFAULT_ARRAY_SIZE));
}
 
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:4,代码来源:ShortColumn.java

示例12: data

import it.unimi.dsi.fastutil.shorts.ShortArrayList; //导入依赖的package包/类
public ShortArrayList data() {
    return data;
}
 
开发者ID:jtablesaw,项目名称:tablesaw,代码行数:4,代码来源:ShortColumn.java

示例13: WriterDictionary

import it.unimi.dsi.fastutil.shorts.ShortArrayList; //导入依赖的package包/类
WriterDictionary (){
	sets = new ObjectArrayList<BitSet>();
	arrays = new ObjectArrayList<ShortArrayList>();
	index = new HashMap<BitSet, Short>();
	init();
}
 
开发者ID:mantlik,项目名称:osm2garmin,代码行数:7,代码来源:SplitProcessor.java

示例14: getList

import it.unimi.dsi.fastutil.shorts.ShortArrayList; //导入依赖的package包/类
public ShortArrayList getList (final short idx){
	return arrays.get(idx + DICT_START);
}
 
开发者ID:mantlik,项目名称:osm2garmin,代码行数:4,代码来源:SplitProcessor.java

示例15: chunkAdd

import it.unimi.dsi.fastutil.shorts.ShortArrayList; //导入依赖的package包/类
void chunkAdd(ShortArrayList arraylist, int index, short val) {
	arraylist.add(index,val);
}
 
开发者ID:mantlik,项目名称:osm2garmin,代码行数:4,代码来源:SparseInt2ShortMapInline.java


注:本文中的it.unimi.dsi.fastutil.shorts.ShortArrayList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。