本文整理汇总了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());
}
示例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" );
}
}
示例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();
}
示例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();
}
示例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));
}
}
}
示例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;
}
示例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();
}
示例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);
}
}
示例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();
}
示例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();
}
示例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);
}
}
示例12: init
import gnu.trove.list.array.TShortArrayList; //导入依赖的package包/类
protected void init(int offset) {
this.data = new TShortArrayList(256);
this.offset = offset;
}
示例13: AutoDeltaShortVector
import gnu.trove.list.array.TShortArrayList; //导入依赖的package包/类
public AutoDeltaShortVector() {
this.commands = new ArrayList<>(5);
this.v = new TShortArrayList();
this.baselineCommandCount = 0;
}