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


Java TShortArrayList类代码示例

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


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

示例1: bitset

import gnu.trove.list.array.TShortArrayList; //导入依赖的package包/类
public static bitset bitset(boolean bits[]) {
    TShortList resultList = new TShortArrayList();
    boolean expect = true;

    int bitsIdx = 0;
    while (bitsIdx < bits.length) {
        int end = bitsIdx;
        while (end < bits.length && bits[end] == expect)
            ++end;

        int len = end - bitsIdx;
        while (len > 65535) {
            bitsIdx += 65535;
            len -= 65535;
            resultList.add((short) 0xffff);
            resultList.add((short) 0);
        }

        resultList.add((short) len);
        bitsIdx += len;

        expect = !expect;
    }

    return new bitset(resultList.toArray());
}
 
开发者ID:groupon,项目名称:monsoon,代码行数:27,代码来源:ToXdr.java

示例2: TShortArrayStack

import gnu.trove.list.array.TShortArrayList; //导入依赖的package包/类
/**
 * Creates a new <code>TShortArrayStack</code> instance that is
 * a copy of the instanced passed to us.
 *
 * @param stack the instance to copy
 */
public TShortArrayStack( TShortStack stack ) {
    if ( stack instanceof TShortArrayStack ) {
        TShortArrayStack array_stack = ( TShortArrayStack ) stack;
        this._list = new TShortArrayList( array_stack._list );
    } else {
        throw new UnsupportedOperationException( "Only support TShortArrayStack" );
    }
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:15,代码来源:TShortArrayStack.java

示例3: readExternal

import gnu.trove.list.array.TShortArrayList; //导入依赖的package包/类
public void readExternal( ObjectInput in )
	throws IOException, ClassNotFoundException {

	// VERSION
	in.readByte();

	// LIST
	_list = ( TShortArrayList ) in.readObject();
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:10,代码来源:TShortArrayStack.java

示例4: readExternal

import gnu.trove.list.array.TShortArrayList; //导入依赖的package包/类
@Override
public void readExternal( ObjectInput in )
	throws IOException, ClassNotFoundException {

	// VERSION
	in.readByte();

	// LIST
	_list = ( TShortArrayList ) in.readObject();
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:11,代码来源:TShortArrayStack.java

示例5: ShortMapTidList

import gnu.trove.list.array.TShortArrayList; //导入依赖的package包/类
public ShortMapTidList(Counters c) {
	for (int i = 0; i < c.getMaxFrequent()+1; i++) {
		int count = c.getDistinctTransactionsCount(i);
		if (count > 0) {
			this.occurrences.put(i, new TShortArrayList(count));
		}
	}
}
 
开发者ID:slide-lig,项目名称:TopPI,代码行数:9,代码来源:ShortMapTidList.java

示例6: clone

import gnu.trove.list.array.TShortArrayList; //导入依赖的package包/类
@Override
public TidList clone() {
	ShortMapTidList o = (ShortMapTidList) super.clone();
	o.occurrences = new TIntObjectHashMap<TShortList>(this.occurrences.size());
	TIntObjectIterator<TShortList> iter = this.occurrences.iterator();
	while (iter.hasNext()) {
		iter.advance();
		o.occurrences.put(iter.key(), new TShortArrayList(iter.value()));
	}
	return o;
}
 
开发者ID:slide-lig,项目名称:TopPI,代码行数:12,代码来源:ShortMapTidList.java

示例7: extractKnownPOITags

import gnu.trove.list.array.TShortArrayList; //导入依赖的package包/类
/**
 * Extracts known POI tags and returns their ids.
 *
 * @param tags the node
 * @return the ids of the identified tags
 */
public static short[] extractKnownPOITags(LMTag[] tags) {
    TShortArrayList currentTags = new TShortArrayList();
    OSMTagMapping mapping = OSMTagMapping.getInstance();
    if (tags != null) {
        for (LMTag tag : tags) {
            OSMTag wayTag = mapping.getPoiTag(tag.key.toString(), tag.value.toString());
            if (wayTag != null) {
                currentTags.add(wayTag.getId());
            }
        }
    }
    return currentTags.toArray();
}
 
开发者ID:Longri,项目名称:CB_MAP,代码行数:20,代码来源:LMUtils.java

示例8: ReadWordRegistersResponse

import gnu.trove.list.array.TShortArrayList; //导入依赖的package包/类
public ReadWordRegistersResponse(int transectionId, int unitId, ModbusRegisterType registerType,
        int startingAddress, int[] values) {
    super(transectionId, unitId, registerType, startingAddress);
    this.quantity = values.length;
    this.values = new TShortArrayList(values.length);
    for (int v : values) {
        this.values.add((short) v);
    }
}
 
开发者ID:epsilony,项目名称:codec-modbus,代码行数:10,代码来源:ReadWordRegistersResponse.java

示例9: extractKnownWayTags

import gnu.trove.list.array.TShortArrayList; //导入依赖的package包/类
/**
 * Extracts known way tags and returns their ids.
 * 
 * @param entity
 *            the way
 * @return the ids of the identified tags
 */
public static short[] extractKnownWayTags(Entity entity) {
	TShortArrayList currentTags = new TShortArrayList();
	OSMTagMapping mapping = OSMTagMapping.getInstance();
	if (entity.getTags() != null) {
		for (Tag tag : entity.getTags()) {
			OSMTag wayTag = mapping.getWayTag(tag.getKey(), tag.getValue());
			if (wayTag != null) {
				currentTags.add(wayTag.getId());
			}
		}
	}
	return currentTags.toArray();
}
 
开发者ID:DonTomika,项目名称:mapsforge,代码行数:21,代码来源:OSMUtils.java

示例10: extractKnownPOITags

import gnu.trove.list.array.TShortArrayList; //导入依赖的package包/类
/**
 * Extracts known POI tags and returns their ids.
 * 
 * @param entity
 *            the node
 * @return the ids of the identified tags
 */
public static short[] extractKnownPOITags(Entity entity) {
	TShortArrayList currentTags = new TShortArrayList();
	OSMTagMapping mapping = OSMTagMapping.getInstance();
	if (entity.getTags() != null) {
		for (Tag tag : entity.getTags()) {
			OSMTag wayTag = mapping.getPoiTag(tag.getKey(), tag.getValue());
			if (wayTag != null) {
				currentTags.add(wayTag.getId());
			}
		}
	}
	return currentTags.toArray();
}
 
开发者ID:DonTomika,项目名称:mapsforge,代码行数:21,代码来源:OSMUtils.java

示例11: ConvertFile

import gnu.trove.list.array.TShortArrayList; //导入依赖的package包/类
/**
 * Convert the file to short format
 * <p>
 * read in the file (float format) and write it out in short format.
 * reopen the file and read the iVersion and fParams flags.
 * <p>
 * Port note: the caller will need to set its iVersion and fParams flags, unlike in the C version.
 *
 * @param fp       pointer to open file
 * @param fn       filename (used when rewriting the file)
 * @param iVersion version of open file
 * @return converted data input stream, pointing to the start of the coefficients (just after the version and params have been read)
 */
static CBinaryReader ConvertFile(CBinaryReader fp, String fn, int iVersion) {
    try {
        // convert float coefficient file to int. Write new coefficients file to disk and reload.
        TShortArrayList newCoeffs = new TShortArrayList();
        float oldCoeff;
        while (fp.available() != 0) {
            oldCoeff = fp.readFloat();
            int coeff = (int) (oldCoeff * Utils.kStoneValue);
            if (coeff > 0x3FFF)
                coeff = 0x3FFF;
            if (coeff < -0x3FFF)
                coeff = -0x3FFF;
            newCoeffs.add((short) coeff);
        }
        fp.close();
        DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(fn)));
        out.writeInt(iVersion);
        final int fParams = 100;
        out.writeInt(fParams);
        for (short i : newCoeffs.toArray()) {
            out.writeShort(i);
        }
        out.close();
        fp = new CBinaryReader(new BufferedInputStream(new FileInputStream(fn)));
        Require.eq(fp.readInt(), "version in new file", iVersion);
        Require.eq(fp.readInt(), "params in new file", fParams);
        return fp;
    } catch (IOException e) {
        throw new IllegalArgumentException(e);
    }
}
 
开发者ID:weltyc,项目名称:novello,代码行数:45,代码来源:CEvaluatorJ.java

示例12: init

import gnu.trove.list.array.TShortArrayList; //导入依赖的package包/类
protected void init(int offset) {
  this.data = new TShortArrayList(256);
  this.offset = offset;
}
 
开发者ID:cubedb,项目名称:cubedb,代码行数:5,代码来源:TinyColumn.java

示例13: AutoDeltaShortVector

import gnu.trove.list.array.TShortArrayList; //导入依赖的package包/类
public AutoDeltaShortVector() {
    this.commands = new ArrayList<>(5);
    this.v = new TShortArrayList();
    this.baselineCommandCount = 0;
}
 
开发者ID:bacta,项目名称:pre-cu,代码行数:6,代码来源:AutoDeltaShortVector.java


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