本文整理汇总了Java中org.eclipse.collections.api.set.SetIterable类的典型用法代码示例。如果您正苦于以下问题:Java SetIterable类的具体用法?Java SetIterable怎么用?Java SetIterable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SetIterable类属于org.eclipse.collections.api.set包,在下文中一共展示了SetIterable类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCalculateDependenciesForChange
import org.eclipse.collections.api.set.SetIterable; //导入依赖的package包/类
@Test
public void testCalculateDependenciesForChange() {
SetIterable<String> dependencies = enricher.calculateDependencies("test1", "create procedure sp1\n" +
"// Comment sp2\n" +
"-- Comment sp2\n" +
"call sp_3(1234) -- end of line comment sp5\n" +
"/* Comment sp5 */\n" +
"/* Comment\n" +
"sp5\n" +
"\n" +
"sp5 */\n" +
"call sp4(1234)\n" +
"end\n" +
"", Sets.mutable.with("sp1", "sp2", "sp_3", "sp4", "sp5"));
assertEquals(Sets.mutable.with("sp1", "sp_3", "sp4"), dependencies);
}
示例2: examineAtLoc
import org.eclipse.collections.api.set.SetIterable; //导入依赖的package包/类
public void examineAtLoc(@NonNull SequenceLocation location,
LocationExaminationResults result,
@NonNull SetIterable<@NonNull CandidateSequence> candidateSet,
@NonNull CandidateCounter topCounter,
@NonNull CandidateCounter bottomCounter,
Mutinack analyzer,
Parameters param,
AnalysisStats stats) {
if (result.threadCount.incrementAndGet() != 1) {
throw new AssertionFailedException();
}
try {
examineAtLoc1(location, result, candidateSet,
topCounter, bottomCounter, analyzer, param, stats);
lastExaminedPosition = location.position;
} catch (Exception e) {
throw new RuntimeException("Problem with duplex " + this, e);
} finally {
if (result.threadCount.decrementAndGet() != 0) {
//noinspection ThrowFromFinallyBlock
throw new AssertionFailedException();
}
}
}
示例3: getDonutTypesOrdered
import org.eclipse.collections.api.set.SetIterable; //导入依赖的package包/类
public SetIterable<DonutType> getDonutTypesOrdered()
{
return this.deliveries
.flatCollect(Delivery::getDonuts)
.collect(Donut::getType)
.toSet();
}
示例4: determineChecksumDifferences
import org.eclipse.collections.api.set.SetIterable; //导入依赖的package包/类
@Override
public ImmutableCollection<ChecksumBreak> determineChecksumDifferences(Predicate<? super ChecksumEntry> checksumEntryInclusionPredicate) {
MutableList<ChecksumBreak> checksumBreaks = Lists.mutable.empty();
for (PhysicalSchema physicalSchema : physicalSchemas) {
DaCatalog catalog = dbMetadataManager.getDatabase(physicalSchema, new DaSchemaInfoLevel().setMaximum(), true, true);
ImmutableCollection<ChecksumEntry> newChecksums = checksumCalculator.getChecksums(catalog)
.select(checksumEntryInclusionPredicate);
MapIterable<String, ChecksumEntry> newChecksumMap = newChecksums.toMap(ChecksumEntry.TO_KEY, Functions.<ChecksumEntry>getPassThru());
ImmutableCollection<ChecksumEntry> existingChecksums = dbChecksumDao.getPersistedEntries(physicalSchema);
MapIterable<String, ChecksumEntry> existingChecksumMap = existingChecksums.toMap(ChecksumEntry.TO_KEY, Functions.<ChecksumEntry>getPassThru());
SetIterable<String> allChecksumKeys = newChecksumMap.keysView().toSet().withAll(existingChecksumMap.keysView());
for (String checksumKey : allChecksumKeys) {
ChecksumEntry newChecksum = newChecksumMap.get(checksumKey);
ChecksumEntry existingChecksum = existingChecksumMap.get(checksumKey);
if (newChecksum == null && existingChecksum != null) {
checksumBreaks.add(new ChecksumBreak(existingChecksum.getKey(), existingChecksum, newChecksum, ChecksumBreakType.IN_AUDIT_BUT_NOT_DB, checksumEntryInclusionPredicate.accept(existingChecksum)));
} else if (newChecksum != null && existingChecksum == null) {
checksumBreaks.add(new ChecksumBreak(newChecksum.getKey(), existingChecksum, newChecksum, ChecksumBreakType.IN_DB_BUT_NOT_AUDIT, false));
} else if (!newChecksum.getChecksum().equalsIgnoreCase(existingChecksum.getChecksum())) {
checksumBreaks.add(new ChecksumBreak(newChecksum.getKey(), existingChecksum, newChecksum, ChecksumBreakType.DIFFERENCE, false));
}
}
}
return checksumBreaks.toImmutable();
}
示例5: getDependentNodes
import org.eclipse.collections.api.set.SetIterable; //导入依赖的package包/类
public static <T> SetIterable<T> getDependentNodes(final DirectedGraph<T, DefaultEdge> graph, T vertex) {
return SetAdapter.adapt(graph.outgoingEdgesOf(vertex)).collect(new Function<DefaultEdge, T>() {
@Override
public T valueOf(DefaultEdge edge) {
return graph.getEdgeTarget(edge);
}
});
}
示例6: getDependencyNodes
import org.eclipse.collections.api.set.SetIterable; //导入依赖的package包/类
public static <T> SetIterable<T> getDependencyNodes(final DirectedGraph<T, DefaultEdge> graph, T vertex) {
return SetAdapter.adapt(graph.incomingEdgesOf(vertex)).collect(new Function<DefaultEdge, T>() {
@Override
public T valueOf(DefaultEdge edge) {
return graph.getEdgeSource(edge);
}
});
}
示例7: getDependencyNodesAndEdges
import org.eclipse.collections.api.set.SetIterable; //导入依赖的package包/类
public static <T, E> SetIterable<Pair<T, E>> getDependencyNodesAndEdges(final DirectedGraph<T, E> graph, T vertex) {
return SetAdapter.adapt(graph.incomingEdgesOf(vertex)).collect(new Function<E, Pair<T, E>>() {
@Override
public Pair<T, E> valueOf(E edge) {
return Tuples.pair(graph.getEdgeSource(edge), edge);
}
});
}
示例8: lowMutFreq
import org.eclipse.collections.api.set.SetIterable; //导入依赖的package包/类
private boolean lowMutFreq(Mutation mut, SetIterable<CandidateSequence> candidateSet, int nGOrDDuplexes) {
Objects.requireNonNull(mut);
Handle<Boolean> result = new Handle<>(true);
candidateSet.detect((CandidateSequence c) -> {
Mutation cMut = c.getMutation();
if (cMut.equals(mut)) {
if (c.getnGoodOrDubiousDuplexes() > param.maxMutFreqForDisag * nGOrDDuplexes) {
result.set(false);
}
return true;
}
return false;
});
return result.get();
}
示例9: checkDuplexAndCandidates
import org.eclipse.collections.api.set.SetIterable; //导入依赖的package包/类
@SuppressWarnings("ReferenceEquality")
private static void checkDuplexAndCandidates(Set<Duplex> duplexes,
SetIterable<CandidateSequence> candidateSet) {
checkDuplexes(duplexes);
candidateSet.each(c -> {
Assert.isTrue(c.getNonMutableConcurringReads().keySet().equals(
c.getMutableConcurringReads().keySet()));
Set<Duplex> duplexesSupportingC = c.computeSupportingDuplexes();
candidateSet.each(c2 -> {
Assert.isTrue(c.getNonMutableConcurringReads().keySet().equals(
c.getMutableConcurringReads().keySet()));
//noinspection ObjectEquality
if (c2 == c) {
return;
}
if (c2.equals(c)) {
throw new AssertionFailedException();
}
c2.getNonMutableConcurringReads().keySet().forEach(r -> {
//if (r.isOpticalDuplicate()) {
// return;
//}
Assert.isFalse(r.discarded);
Duplex d = r.duplex;
if (d != null && duplexesSupportingC.contains(d)) {
boolean disowned = !d.allRecords.contains(r);
throw new AssertionFailedException(disowned + " Duplex " + d +
" associated with candidates " + c + " and " + c2);
}
});
});
});
}
示例10: CandidateCounter
import org.eclipse.collections.api.set.SetIterable; //导入依赖的package包/类
public CandidateCounter(@NonNull SetIterable<@NonNull CandidateSequence> candidates,
@NonNull SequenceLocation location) {
this.candidates = candidates;
this.location = location;
keptRecords = new THashSet<>();
candidateCounts = new UnifiedMap<>(5);
}
示例11: determineChangeset
import org.eclipse.collections.api.set.SetIterable; //导入依赖的package包/类
@Override
public Changeset determineChangeset(RichIterable<Change> deploys, final RichIterable<Change> sources,
final boolean rollback, final boolean initAllowedOnHashExceptions, Predicate<? super ExecuteChangeCommand> changesetPredicate) {
final Multimap<ChangeType, Change> deployChangesByType = deploys.groupBy(Change.TO_CHANGE_TYPE);
final Multimap<ChangeType, Change> sourceChangesByType = sources.groupBy(Change.TO_CHANGE_TYPE);
SetIterable<ChangeType> changeTypes = Sets.mutable.withAll(deployChangesByType.keysView()).withAll(sourceChangesByType.keysView());
RichIterable<ChangeCommand> commands = changeTypes.flatCollect(new Function<ChangeType, Iterable<ChangeCommand>>() {
@Override
public Iterable<ChangeCommand> valueOf(ChangeType changeType) {
RichIterable<Change> changeTypeDeploys = deployChangesByType.get(changeType);
RichIterable<Change> changeTypeSources = sourceChangesByType.get(changeType);
final MutableMap<Change, ChangePair> changes = UnifiedMapWithHashingStrategy
.newMap(hashStrategy);
Procedure2<Change, Boolean> addChangeToMap = new Procedure2<Change, Boolean>() {
@Override
public void value(Change change, Boolean fromSource) {
ChangePair changePair = changes.get(change);
if (changePair == null) {
changePair = new ChangePair();
changes.put(change, changePair);
}
if (fromSource) {
changePair.setSourceChange(change);
} else {
changePair.setDeployedChange(change);
}
}
};
changeTypeSources.forEachWith(addChangeToMap, true);
changeTypeDeploys.forEachWith(addChangeToMap, false);
return changeTypeBehaviorRegistry.getChangeTypeBehavior(changeType.getName()).getChangeTypeCalculator().calculateCommands(changeType, changes.valuesView(), sources, rollback, initAllowedOnHashExceptions);
}
});
PartitionIterable<ChangeCommand> executePartition = commands.partition(instanceOf(ExecuteChangeCommand.class));
PartitionIterable<ChangeCommand> auditPartition = executePartition.getRejected().partition(instanceOf(AuditChangeCommand.class));
PartitionIterable<ChangeCommand> warningPartition = auditPartition.getRejected().partition(instanceOf(ChangeCommandWarning.class));
if (warningPartition.getRejected().notEmpty()) {
throw new IllegalStateException("These changes are not of an expected class type: " + executePartition.getRejected());
}
ImmutableList<ExecuteChangeCommand> changeCommands = changeCommandSorter.sort(cast(executePartition.getSelected(), ExecuteChangeCommand.class), rollback);
if (changesetPredicate == null) {
changesetPredicate = DEFAULT_DEFERRED_PREDICATE;
}
PartitionImmutableList<ExecuteChangeCommand> changesetPartition = changeCommands.partition(
changesetPredicate
);
return new Changeset(changesetPartition.getSelected(),
changesetPartition.getRejected(),
cast(auditPartition.getSelected(), AuditChangeCommand.class),
cast(warningPartition.getSelected(), ChangeCommandWarning.class)
);
}
示例12: verifyExpectedDependencies
import org.eclipse.collections.api.set.SetIterable; //导入依赖的package包/类
protected void verifyExpectedDependencies(TextDependencyExtractable item, SetIterable<CodeDependency> expectedDependencies) {
ArgumentCaptor<ImmutableSet> setDependencies = ArgumentCaptor.forClass(ImmutableSet.class);
verify(item).setCodeDependencies(setDependencies.capture());
assertEquals(expectedDependencies, setDependencies.getValue());
}