本文整理汇总了Java中gnu.trove.TIntHashSet类的典型用法代码示例。如果您正苦于以下问题:Java TIntHashSet类的具体用法?Java TIntHashSet怎么用?Java TIntHashSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TIntHashSet类属于gnu.trove包,在下文中一共展示了TIntHashSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getReachable
import gnu.trove.TIntHashSet; //导入依赖的package包/类
private static LinkedHashSet<Integer> getReachable(final LinkedHashSet<Integer> fragmentInsns, final Instruction[] flow, TIntObjectHashMap<TIntHashSet> dfaResult, final int[] postorder) {
final LinkedHashSet<Integer> result = new LinkedHashSet<Integer>();
for (Instruction insn : flow) {
if (insn instanceof ReadWriteVariableInstruction &&
!((ReadWriteVariableInstruction) insn).isWrite()) {
final int ref = insn.num();
TIntHashSet defs = dfaResult.get(ref);
defs.forEach(new TIntProcedure() {
public boolean execute(int def) {
if (fragmentInsns.contains(def)) {
if (!fragmentInsns.contains(ref) || postorder[ref] < postorder[def]) {
result.add(ref);
return false;
}
}
return true;
}
});
}
}
return result;
}
示例2: fun
import gnu.trove.TIntHashSet; //导入依赖的package包/类
public void fun(TIntObjectHashMap<TIntHashSet> m, Instruction instruction) {
if (instruction instanceof ReadWriteVariableInstruction) {
final ReadWriteVariableInstruction varInsn = (ReadWriteVariableInstruction) instruction;
final String name = varInsn.getVariableName();
if (name == null) return;
assert myVarToIndexMap.containsKey(name);
final int num = myVarToIndexMap.get(name);
if (varInsn.isWrite()) {
TIntHashSet defs = m.get(num);
if (defs == null) {
defs = new TIntHashSet();
m.put(num, defs);
} else defs.clear();
defs.add(varInsn.num());
}
}
}
示例3: mixClassifications
import gnu.trove.TIntHashSet; //导入依赖的package包/类
@SuppressWarnings("unused")
private static IClassificationDB mixClassifications(
IClassificationDB trueClassification,
IClassificationDB predictedClassification,
TIntHashSet fromTrueClassification) {
TroveClassificationDBBuilder builder = new TroveClassificationDBBuilder(
trueClassification.getDocumentDB(),
trueClassification.getCategoryDB());
IIntIterator documents = trueClassification.getDocumentDB()
.getDocuments();
while (documents.hasNext()) {
int document = documents.next();
if (fromTrueClassification.contains(document))
copyClassification(document, trueClassification, builder);
else
copyClassification(document, predictedClassification, builder);
}
return builder.getClassificationDB();
}
示例4: Incremental
import gnu.trove.TIntHashSet; //导入依赖的package包/类
public Incremental(int trainSize, ClassificationScoreDB classification, TIntHashSet categoriesFilter,
EstimationType estimation, ContingencyTableSet evaluation, IGain gain, IGain firstRankGain, double[] probabilitySlope, double[] prevalencies) {
super(trainSize, classification, categoriesFilter, estimation, evaluation, firstRankGain, probabilitySlope, prevalencies);
macroRankTable = new TIntDoubleHashMap((int) (testSize + testSize * 0.25), (float) 0.75);
microRankTable = new TIntDoubleHashMap((int) (testSize + testSize * 0.25), (float) 0.75);
macroAlreadySeen = new TIntHashSet((int) (testSize + testSize * 0.25), (float) 0.75);
microAlreadySeen = new TIntHashSet((int) (testSize + testSize * 0.25), (float) 0.75);
probabilities = new double[testSize][numOfCategories];
for (int docId = 0; docId < testSize; docId++) {
Set<Entry<Short, ClassifierRangeWithScore>> entries = classification.getDocumentScoresAsSet(docId);
Iterator<Entry<Short, ClassifierRangeWithScore>> iterator = entries.iterator();
while (iterator.hasNext()) {
Entry<Short, ClassifierRangeWithScore> next = iterator.next();
ClassifierRangeWithScore value = next.getValue();
if (categoriesFilter.contains(next.getKey())) {
probabilities[docId][catMap.get(next.getKey())] = probability(Math.abs(value.score - value.border), next.getKey());
}
}
}
}
示例5: removeMapping
import gnu.trove.TIntHashSet; //导入依赖的package包/类
public void removeMapping(Collection<String> outputPaths, int buildTargetId) throws IOException {
if (outputPaths.isEmpty()) {
return;
}
for (String outputPath : outputPaths) {
final int key = FileUtil.pathHashCode(outputPath);
synchronized (myDataLock) {
final TIntHashSet state = getState(key);
if (state != null) {
final boolean removed = state.remove(buildTargetId);
if (state.isEmpty()) {
remove(key);
}
else {
if (removed) {
update(key, state);
}
}
}
}
}
}
示例6: getSafeToDeleteOutputs
import gnu.trove.TIntHashSet; //导入依赖的package包/类
public Collection<String> getSafeToDeleteOutputs(Collection<String> outputPaths, int currentTargetId) throws IOException {
final int size = outputPaths.size();
if (size == 0) {
return outputPaths;
}
final Collection<String> result = new ArrayList<String>(size);
for (String outputPath : outputPaths) {
final int key = FileUtil.pathHashCode(outputPath);
synchronized (myDataLock) {
final TIntHashSet associatedTargets = getState(key);
if (associatedTargets == null || associatedTargets.size() != 1) {
continue;
}
if (associatedTargets.contains(currentTargetId)) {
result.add(outputPath);
}
}
}
return result;
}
示例7: save
import gnu.trove.TIntHashSet; //导入依赖的package包/类
public static <X> void save(final TIntHashSet x, final DataOutput out) {
try {
DataInputOutputUtil.writeINT(out, x.size());
x.forEach(new TIntProcedure() {
@Override
public boolean execute(int value) {
try {
DataInputOutputUtil.writeINT(out, value);
return true;
}
catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
});
}
catch (IOException c) {
throw new BuildDataCorruptedException(c);
}
}
示例8: removeAll
import gnu.trove.TIntHashSet; //导入依赖的package包/类
@Override
public void removeAll(int key, TIntHashSet values) {
try {
final TIntHashSet collection = myCache.get(key);
if (collection != NULL_COLLECTION) {
if (collection.removeAll(values.toArray())) {
myCache.remove(key);
if (collection.isEmpty()) {
myMap.remove(key);
}
else {
myMap.put(key, collection);
}
}
}
}
catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
示例9: removeFrom
import gnu.trove.TIntHashSet; //导入依赖的package包/类
@Override
public void removeFrom(final int key, final int value) {
try {
final TIntHashSet collection = myCache.get(key);
if (collection != NULL_COLLECTION) {
if (collection.remove(value)) {
myCache.remove(key);
if (collection.isEmpty()) {
myMap.remove(key);
}
else {
myMap.put(key, collection);
}
}
}
}
catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
示例10: removeAll
import gnu.trove.TIntHashSet; //导入依赖的package包/类
@Override
public void removeAll(int key, TIntHashSet values) {
final TIntHashSet collection = myMap.get(key);
if (collection != null) {
values.forEach(new TIntProcedure() {
@Override
public boolean execute(int value) {
collection.remove(value);
return true;
}
});
if (collection.isEmpty()) {
myMap.remove(key);
}
}
}
示例11: 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());
}
示例12: drawCollapsedFolderBackground
import gnu.trove.TIntHashSet; //导入依赖的package包/类
private void drawCollapsedFolderBackground(@NotNull Graphics g,
@NotNull Rectangle clip,
@NotNull Color defaultBackground,
@Nullable Color prevBackColor,
@NotNull Point position,
@NotNull Color backColor,
int fontType,
@NotNull TIntHashSet softWrapsToSkip,
@NotNull boolean[] caretRowPainted,
@NotNull CharSequence text,
@NotNull FoldRegion collapsedFolderAt) {
SoftWrap softWrap = mySoftWrapModel.getSoftWrap(collapsedFolderAt.getStartOffset());
if (softWrap != null) {
position.x = drawSoftWrapAwareBackground(
g, backColor, prevBackColor, text, collapsedFolderAt.getStartOffset(), collapsedFolderAt.getStartOffset(), position, fontType,
defaultBackground, clip, softWrapsToSkip, caretRowPainted
);
}
CharSequence chars = collapsedFolderAt.getPlaceholderText();
position.x = drawBackground(g, backColor, chars, 0, chars.length(), position, fontType, defaultBackground, clip);
}
示例13: findFirstObsoleteBlock
import gnu.trove.TIntHashSet; //导入依赖的package包/类
private int findFirstObsoleteBlock(long period, int intervalBetweenActivities, TIntHashSet recursionGuard) throws IOException {
long prevTimestamp = 0;
long length = 0;
int last = myStorage.getLastRecord();
while (last != 0) {
long t = myStorage.getTimestamp(last);
if (prevTimestamp == 0) prevTimestamp = t;
long delta = prevTimestamp - t;
prevTimestamp = t;
// we sum only intervals between changes during one 'day' (intervalBetweenActivities) and add '1' between two 'days'
length += delta < intervalBetweenActivities ? delta : 1;
if (length >= period) return last;
last = doReadPrevSafely(last, recursionGuard);
}
return 0;
}
示例14: 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);
}
示例15: testTrailingSoftWrapOffsetShiftOnTyping
import gnu.trove.TIntHashSet; //导入依赖的package包/类
public void testTrailingSoftWrapOffsetShiftOnTyping() throws IOException {
// The main idea is to type on a logical line before soft wrap in order to ensure that its offset is correctly shifted back.
String text =
"line1<caret>\n" +
"second line that is long enough to be soft wrapped";
init(15, text);
TIntHashSet offsetsBefore = collectSoftWrapStartOffsets(1);
assertTrue(!offsetsBefore.isEmpty());
type('2');
final TIntHashSet offsetsAfter = collectSoftWrapStartOffsets(1);
assertSame(offsetsBefore.size(), offsetsAfter.size());
offsetsBefore.forEach(new TIntProcedure() {
@Override
public boolean execute(int value) {
assertTrue(offsetsAfter.contains(value + 1));
return true;
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:SoftWrapApplianceOnDocumentModificationTest.java