本文整理匯總了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);
}