本文整理汇总了Java中gnu.trove.TIntHashSet.add方法的典型用法代码示例。如果您正苦于以下问题:Java TIntHashSet.add方法的具体用法?Java TIntHashSet.add怎么用?Java TIntHashSet.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnu.trove.TIntHashSet
的用法示例。
在下文中一共展示了TIntHashSet.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: read
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
public TIntArrayList read(@NotNull DataInput dataInput) throws IOException {
TIntHashSet result = new TIntHashSet();
while (((InputStream)dataInput).available() > 0) {
int id = DataInputOutputUtil.readINT(dataInput);
if (REMOVED_MARKER == id) {
id = DataInputOutputUtil.readINT(dataInput);
result.remove(id);
}
else {
result.add(id);
}
}
return new TIntArrayList(result.toArray());
}
示例2: findRowsToSelectAndScroll
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
@NotNull
private Pair<TIntHashSet, Integer> findRowsToSelectAndScroll(@NotNull GraphTableModel model,
@NotNull VisibleGraph<Integer> visibleGraph) {
TIntHashSet rowsToSelect = new TIntHashSet();
if (model.getRowCount() == 0) {
// this should have been covered by facade.getVisibleCommitCount,
// but if the table is empty (no commits match the filter), the GraphFacade is not updated, because it can't handle it
// => it has previous values set.
return Pair.create(rowsToSelect, null);
}
Integer rowToScroll = null;
for (int row = 0;
row < visibleGraph.getVisibleCommitCount() && (rowsToSelect.size() < mySelectedCommits.size() || rowToScroll == null);
row++) { //stop iterating if found all hashes
int commit = visibleGraph.getRowInfo(row).getCommit();
if (mySelectedCommits.contains(commit)) {
rowsToSelect.add(row);
}
if (myVisibleSelectedCommit != null && myVisibleSelectedCommit == commit) {
rowToScroll = row;
}
}
return Pair.create(rowsToSelect, rowToScroll);
}
示例3: updateBreakpoints
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
private void updateBreakpoints(@NotNull Document document) {
Collection<XLineBreakpointImpl> breakpoints = myBreakpoints.getKeysByValue(document);
if (breakpoints == null) {
return;
}
TIntHashSet lines = new TIntHashSet();
List<XBreakpoint<?>> toRemove = new SmartList<XBreakpoint<?>>();
for (XLineBreakpointImpl breakpoint : breakpoints) {
breakpoint.updatePosition();
if (!breakpoint.isValid() || !lines.add(breakpoint.getLine())) {
toRemove.add(breakpoint);
}
}
removeBreakpoints(toRemove);
}
示例4: loadHashedIds
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
@NotNull
private static TIntHashSet loadHashedIds(@NotNull File fileWithCaches) throws IOException {
DataInputStream inputStream = null;
try {
inputStream = new DataInputStream(new BufferedInputStream(new FileInputStream(fileWithCaches)));
int capacity = DataInputOutputUtil.readINT(inputStream);
TIntHashSet hashMaskSet = new TIntHashSet(capacity);
while(capacity > 0) {
hashMaskSet.add(DataInputOutputUtil.readINT(inputStream));
--capacity;
}
inputStream.close();
return hashMaskSet;
}
finally {
if (inputStream != null) {
try {
inputStream.close();
}
catch (IOException ignored) {}
}
}
}
示例5: determineSuperclasses
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
/**
* Creates a cached table of superclass name IDs.
*/
private void determineSuperclasses() {
superclasses = new TIntHashSet(2);
Classfile clazz = this;
while(clazz != null) {
ClassInfo superInfo = clazz.getSuperclassInfo();
if(superInfo != null) superclasses.add(superInfo.getName().getID());
clazz = clazz.getSuperclass();
}
superclasses.trimToSize();
}
示例6: visitPostOrderIterative
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
private TObjectIntHashMap<Instruction> visitPostOrderIterative(Instruction start, ArrayList<Instruction> instructionsInPostOrderTraversalOfReverseControlFlowGraph) {
TObjectIntHashMap<Instruction>postOrderNumbers = new TObjectIntHashMap<Instruction>();
ArrayList<Instruction> stack = new ArrayList<Instruction>();
TIntHashSet visitedIndices = new TIntHashSet(code.getNumberOfInstructions());
TIntHashSet processedIndices = new TIntHashSet(code.getNumberOfInstructions());
stack.add(start);
while(stack.size() > 0) {
Instruction top = stack.get(stack.size() - 1);
if(visitedIndices.contains(top.getIndex())) {
stack.remove(stack.size() - 1);
if(!processedIndices.contains(top.getIndex())) {
processedIndices.add(top.getIndex());
instructionsInPostOrderTraversalOfReverseControlFlowGraph.add(0, top);
postOrderNumbers.put(top, instructionsInPostOrderTraversalOfReverseControlFlowGraph.size());
}
}
// Remember that we were here, then add the predecessors in reverse order to the stack.
else {
visitedIndices.add(top.getIndex());
int insertionIndex = 0;
for(Instruction predecessor : top.getOrderedPredecessors()) {
if(!visitedIndices.contains(predecessor.getIndex())) {
stack.add(stack.size() - insertionIndex, predecessor);
insertionIndex++;
}
}
}
}
return postOrderNumbers;
}
示例7: read
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
public TIntHashSet read(@NotNull DataInput in) throws IOException {
final TIntHashSet result = new TIntHashSet();
final DataInputStream stream = (DataInputStream)in;
while (stream.available() > 0) {
result.add(in.readInt());
}
return result;
}
示例8: addMapping
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
protected void addMapping(Collection<String> outputPaths, int buildTargetId) throws IOException {
final TIntHashSet set = new TIntHashSet();
set.add(buildTargetId);
for (String outputPath : outputPaths) {
appendData(FileUtil.pathHashCode(outputPath), set);
}
}
示例9: read
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
public static TIntHashSet read(final TIntHashSet acc, final DataInput in) {
try {
final int size = DataInputOutputUtil.readINT(in);
for (int i = 0; i<size; i++) {
acc.add(DataInputOutputUtil.readINT(in));
}
return acc;
}
catch (IOException x) {
throw new BuildDataCorruptedException(x);
}
}
示例10: read
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
@Override
public TIntHashSet read(@NotNull final DataInput in) throws IOException {
final TIntHashSet result = new TIntHashSet();
final DataInputStream stream = (DataInputStream)in;
while (stream.available() > 0) {
result.add(DataInputOutputUtil.readINT(in));
}
return result;
}
示例11: put
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
@Override
public void put(final int key, final int value) {
final TIntHashSet collection = myMap.get(key);
if (collection == null) {
final TIntHashSet x = new TIntHashSet();
x.add(value);
myMap.put(key, x);
}
else {
collection.add(value);
}
}
示例12: Selection
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
public Selection(@NotNull VcsLogGraphTable table) {
myTable = table;
List<Integer> selectedRows = ContainerUtil.sorted(toList(myTable.getSelectedRows()));
Couple<Integer> visibleRows = ScrollingUtil.getVisibleRows(myTable);
myScrollToTop = visibleRows.first - 1 == 0;
VisibleGraph<Integer> graph = myTable.getVisibleGraph();
mySelectedCommits = new TIntHashSet();
Integer visibleSelectedCommit = null;
Integer delta = null;
for (int row : selectedRows) {
if (row < graph.getVisibleCommitCount()) {
Integer commit = graph.getRowInfo(row).getCommit();
mySelectedCommits.add(commit);
if (visibleRows.first - 1 <= row && row <= visibleRows.second && visibleSelectedCommit == null) {
visibleSelectedCommit = commit;
delta = myTable.getCellRect(row, 0, false).y - myTable.getVisibleRect().y;
}
}
}
if (visibleSelectedCommit == null && visibleRows.first - 1 >= 0) {
visibleSelectedCommit = graph.getRowInfo(visibleRows.first - 1).getCommit();
delta = myTable.getCellRect(visibleRows.first - 1, 0, false).y - myTable.getVisibleRect().y;
}
myVisibleSelectedCommit = visibleSelectedCommit;
myDelta = delta;
}
示例13: areVisualLinesUnique
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
private static boolean areVisualLinesUnique(java.util.List<Caret> carets) {
if (carets.size() > 1) {
TIntHashSet lines = new TIntHashSet(carets.size());
for (Caret caret : carets) {
if (!lines.add(caret.getVisualLineStart())) {
return false;
}
}
}
return true;
}
示例14: collectSoftWrapStartOffsets
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
private static TIntHashSet collectSoftWrapStartOffsets(int documentLine) {
TIntHashSet result = new TIntHashSet();
for (SoftWrap softWrap : myEditor.getSoftWrapModel().getSoftWrapsForLine(documentLine)) {
result.add(softWrap.getStart());
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:SoftWrapApplianceOnDocumentModificationTest.java
示例15: read
import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
@Override
public TIntHashSet read(@NotNull DataInput in) throws IOException {
int size = in.readInt();
final TIntHashSet set = new TIntHashSet(size);
while (size-- > 0) {
set.add(in.readInt());
}
return set;
}