本文整理汇总了Java中gnu.trove.list.array.TIntArrayList.add方法的典型用法代码示例。如果您正苦于以下问题:Java TIntArrayList.add方法的具体用法?Java TIntArrayList.add怎么用?Java TIntArrayList.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnu.trove.list.array.TIntArrayList
的用法示例。
在下文中一共展示了TIntArrayList.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ConfiguredBusImpl
import gnu.trove.list.array.TIntArrayList; //导入方法依赖的package包/类
ConfiguredBusImpl(String id, VoltageLevelExt voltageLevel) {
super(id, voltageLevel);
network = voltageLevel.getNetwork().getRef();
int stateArraySize = network.get().getStateManager().getStateArraySize();
terminals = new ArrayList<>(stateArraySize);
v = new TFloatArrayList(stateArraySize);
angle = new TFloatArrayList(stateArraySize);
connectedComponentNumber = new TIntArrayList(stateArraySize);
synchronousComponentNumber = new TIntArrayList(stateArraySize);
for (int i = 0; i < stateArraySize; i++) {
terminals.add(new ArrayList<>());
v.add(Float.NaN);
angle.add(Float.NaN);
connectedComponentNumber.add(-1);
synchronousComponentNumber.add(-1);
}
}
示例2: readDecimalFully
import gnu.trove.list.array.TIntArrayList; //导入方法依赖的package包/类
/**
* read a decimal value from CodecDataInput
*
* @param cdi cdi is source data.
*/
public static BigDecimal readDecimalFully(CodecDataInput cdi) {
if (cdi.available() < 3) {
throw new IllegalArgumentException("insufficient bytes to read value");
}
// 64 should be larger enough for avoiding unnecessary growth.
TIntArrayList data = new TIntArrayList(64);
int precision = cdi.readUnsignedByte();
int frac = cdi.readUnsignedByte();
int length = precision + frac;
int curPos = cdi.size() - cdi.available();
for (int i = 0; i < length; i++) {
if (cdi.eof()) {
break;
}
data.add(cdi.readUnsignedByte());
}
MyDecimal dec = new MyDecimal();
int binSize = dec.fromBin(precision, frac, data.toArray());
cdi.mark(curPos + binSize);
cdi.reset();
return dec.toDecimal();
}
示例3: getValueAsListOfInts
import gnu.trove.list.array.TIntArrayList; //导入方法依赖的package包/类
public TIntArrayList getValueAsListOfInts(String fieldName) throws Exception
{
ListInit list = getValueAsListInit(fieldName);
TIntArrayList res = new TIntArrayList();
for (int i = 0; i < list.getSize(); i++)
{
IntInit ii = list.getElement(i) instanceof IntInit ?
(IntInit)list.getElement(i) : null;
if (ii != null)
res.add((int) ii.getValue());
else
throw new Exception("Record '" + getName() + "', field '" +
fieldName + "' does not have a list of ints initializer!");
}
return res;
}
示例4: CCState
import gnu.trove.list.array.TIntArrayList; //导入方法依赖的package包/类
public CCState(backend.support.CallingConv cc,
boolean isVarArg,
TargetMachine tm,
ArrayList<CCValAssign> locs)
{
callingConv = cc;
this.isVarArg = isVarArg;
this.tm = tm;
tri = tm.getRegisterInfo();
this.locs = locs;
stackOffset = 0;
usedRegs = new TIntArrayList();
for (int capacity = (tri.getNumRegs() + 31) / 32;
capacity != 0; --capacity)
usedRegs.add(0);
}
示例5: tryToCompress
import gnu.trove.list.array.TIntArrayList; //导入方法依赖的package包/类
@Override
public StringArrayChunk tryToCompress() {
List<String> stepValues = new ArrayList<>();
TIntArrayList stepLengths = new TIntArrayList();
int compressedEstimatedSize = 0;
for (String value : values) {
if (stepValues.isEmpty()) {
// create first step
stepValues.add(value);
stepLengths.add(1);
compressedEstimatedSize += CompressedStringArrayChunk.getStepEstimatedSize(value);
} else {
int previousIndex = stepValues.size() - 1;
String previousValue = stepValues.get(previousIndex);
if (Objects.equals(previousValue, value)) {
stepLengths.set(previousIndex, stepLengths.getQuick(previousIndex) + 1);
} else {
// create a new step
stepValues.add(value);
stepLengths.add(1);
compressedEstimatedSize += CompressedStringArrayChunk.getStepEstimatedSize(value);
}
}
if (compressedEstimatedSize > estimatedSize) {
// compression is inefficient
return this;
}
}
return new CompressedStringArrayChunk(offset, values.length, stepValues.toArray(new String[stepValues.size()]),
stepLengths.toArray());
}
示例6: getEdges
import gnu.trove.list.array.TIntArrayList; //导入方法依赖的package包/类
@Override
public int[] getEdges() {
TIntArrayList t = new TIntArrayList(getEdgeCount());
for (int e = 0; e < edges.size(); e++) {
if (edges.get(e) != null) {
t.add(e);
}
}
return t.toArray();
}
示例7: findAllPaths
import gnu.trove.list.array.TIntArrayList; //导入方法依赖的package包/类
private boolean findAllPaths(int e, int v1or2, Function<V, Boolean> pathComplete, Function<E, Boolean> pathCanceled,
TIntArrayList path, BitSet encountered, List<TIntArrayList> paths) {
if (encountered.get(v1or2)) {
return false;
}
Vertex<V> obj1or2 = vertices.get(v1or2);
path.add(e);
if (pathComplete.apply(obj1or2.getObject())) {
paths.add(path);
return true;
} else {
findAllPaths(v1or2, pathComplete, pathCanceled, path, encountered, paths);
return false;
}
}
示例8: NodeTerminal
import gnu.trove.list.array.TIntArrayList; //导入方法依赖的package包/类
NodeTerminal(Ref<? extends MultiStateObject> network, int node) {
super(network);
this.node = node;
int stateArraySize = network.get().getStateManager().getStateArraySize();
v = new TFloatArrayList(stateArraySize);
angle = new TFloatArrayList(stateArraySize);
connectedComponentNumber = new TIntArrayList(stateArraySize);
synchronousComponentNumber = new TIntArrayList(stateArraySize);
for (int i = 0; i < stateArraySize; i++) {
v.add(Float.NaN);
angle.add(Float.NaN);
connectedComponentNumber.add(0);
synchronousComponentNumber.add(0);
}
}
示例9: TreePatternNode
import gnu.trove.list.array.TIntArrayList; //导入方法依赖的package包/类
public TreePatternNode(Record op, ArrayList<TreePatternNode> chs)
{
types = new TIntArrayList();
predicateFns = new ArrayList<>();
operator = op;
children = new ArrayList<>();
children.addAll(chs);
types.add(EEVT.isUnknown);
}
示例10: updateNodeType
import gnu.trove.list.array.TIntArrayList; //导入方法依赖的package包/类
public boolean updateNodeType(int extVT, TreePattern pattern)
throws Exception
{
TIntArrayList list = new TIntArrayList();
list.add(extVT);
return updateNodeType(list, pattern);
}
示例11: filterEVTs
import gnu.trove.list.array.TIntArrayList; //导入方法依赖的package包/类
public static TIntArrayList filterEVTs(TIntArrayList inVTs, Predicate<Integer> filter)
{
TIntArrayList result = new TIntArrayList();
for (int i = 0, e = inVTs.size(); i != e; i++)
{
int val = inVTs.get(i);
if (filter.test(val))
result.add(val);
}
return result;
}
示例12: filterVTs
import gnu.trove.list.array.TIntArrayList; //导入方法依赖的package包/类
public static TIntArrayList filterVTs(TIntArrayList inVTs, Predicate<Integer> filter)
{
TIntArrayList result = new TIntArrayList();
for (int i = 0; i < inVTs.size(); i++)
{
int vt = inVTs.get(i);
if (filter.test(vt))
result.add(vt);
}
return result;
}
示例13: getLineHeadTokenPositions
import gnu.trove.list.array.TIntArrayList; //导入方法依赖的package包/类
/**
* @return token positions that are the first tokens of lines,
* i.e. each pos in the resultant array satisfies: getLine(pos-1) < getLine(pos).
*/
public int[] getLineHeadTokenPositions() {
TIntArrayList result = new TIntArrayList();
for (int i=0; i<size(); i++) {
if (i == 0 || getLine(i-1) < getLine(i)) {
result.add(i);
}
}
return result.toArray();
}
示例14: parseIndexList
import gnu.trove.list.array.TIntArrayList; //导入方法依赖的package包/类
private boolean parseIndexList(TIntArrayList indices)
{
if (lexer.getTokKind() != LLTokenKind.comma)
return tokError("expected ',' as start of index list");
OutParamWrapper<Integer> index = new OutParamWrapper<>(0);
while (expectToken(LLTokenKind.comma))
{
if (parseInt32(index))
return true;
indices.add(index.get());
}
return false;
}
示例15: foldMemoryOperand
import gnu.trove.list.array.TIntArrayList; //导入方法依赖的package包/类
public MachineInstr foldMemoryOperand(MachineFunction mf,
MachineInstr mi,
int ops,
int frameIndex)
{
TIntArrayList list = new TIntArrayList();
list.add(ops);
return foldMemoryOperand(mf, mi, list, frameIndex);
}