java.util.BitSet.intersects()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(172)

本文整理了Java中java.util.BitSet.intersects()方法的一些代码示例,展示了BitSet.intersects()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BitSet.intersects()方法的具体详情如下:
包路径:java.util.BitSet
类名称:BitSet
方法名:intersects

BitSet.intersects介绍

[英]Returns true if this.and(bs) is non-empty, but may be faster than computing that.
[中]如果是,则返回true。and(bs)是非空的,但可能比计算速度快。

代码示例

代码示例来源:origin: PipelineAI/pipeline

  1. public boolean containsAnyOf(BitSet other) {
  2. return events.intersects(other);
  3. }

代码示例来源:origin: osmandapp/Osmand

  1. private boolean checkAllTypesShouldNotBePresent(BitSet types) {
  2. if(filterNotTypes.intersects(types)) {
  3. return false;
  4. }
  5. return true;
  6. }

代码示例来源:origin: apache/kylin

  1. public boolean intersects(ImmutableBitSet another) {
  2. return set.intersects(another.set);
  3. }

代码示例来源:origin: opentripplanner/OpenTripPlanner

  1. /** Do any of the services for this set of service codes run on this ServiceDay? */
  2. public boolean anyServiceRunning(BitSet serviceCodes) {
  3. return this.serviceIdsRunning.intersects(serviceCodes);
  4. }

代码示例来源:origin: osmandapp/Osmand

  1. private boolean checkFreeTags(BitSet types) {
  2. for (String ts : onlyTags) {
  3. BitSet b = tagRuleMask.get(ts);
  4. if (b == null || !b.intersects(types)) {
  5. return false;
  6. }
  7. }
  8. return true;
  9. }

代码示例来源:origin: osmandapp/Osmand

  1. private boolean checkNotFreeTags(BitSet types) {
  2. for (String ts : onlyNotTags) {
  3. BitSet b = tagRuleMask.get(ts);
  4. if (b != null && b.intersects(types)) {
  5. return false;
  6. }
  7. }
  8. return true;
  9. }

代码示例来源:origin: osmandapp/Osmand

  1. protected Object calcSelectValue(BitSet types, ParameterContext paramContext) {
  2. if (selectValue instanceof String && selectValue.toString().startsWith("$")) {
  3. BitSet mask = tagRuleMask.get(selectValue.toString().substring(1));
  4. if (mask != null && mask.intersects(types)) {
  5. BitSet findBit = new BitSet(mask.length());
  6. findBit.or(mask);
  7. findBit.and(types);
  8. int value = findBit.nextSetBit(0);
  9. return parseValueFromTag(value, selectType);
  10. }
  11. } else if (selectValue instanceof String && selectValue.toString().startsWith(":")) {
  12. String p = ((String) selectValue).substring(1);
  13. if (paramContext != null && paramContext.vars.containsKey(p)) {
  14. selectValue = parseValue(paramContext.vars.get(p), selectType);
  15. } else {
  16. return null;
  17. }
  18. }
  19. return selectValue;
  20. }

代码示例来源:origin: osmandapp/Osmand

  1. if (value instanceof String && value.toString().startsWith("$")) {
  2. BitSet mask = tagRuleMask.get(value.toString().substring(1));
  3. if (mask != null && mask.intersects(types)) {
  4. BitSet findBit = new BitSet(mask.length());
  5. findBit.or(mask);

代码示例来源:origin: konsoletyper/teavm

  1. public static boolean intersects(TAbstractCharClass cc1, TAbstractCharClass cc2) {
  2. if (cc1.getBits() == null || cc2.getBits() == null) {
  3. return true;
  4. }
  5. return cc1.getBits().intersects(cc2.getBits());
  6. }

代码示例来源:origin: graphhopper/graphhopper

  1. TripWithStopTimeAndArrivalNode lastTrip = li.previous();
  2. int dwellTime = departureTime - lastTrip.arrivalTime;
  3. if (dwellTime >= 0 && accumulatorValidity.intersects(lastTrip.tripWithStopTimes.validOnDay)) {
  4. BitSet blockTransferValidity = new BitSet(validOn.validity.size());
  5. blockTransferValidity.or(validOn.validity);

代码示例来源:origin: spotbugs/spotbugs

  1. @Override
  2. public void visitClassContext(ClassContext classContext) {
  3. this.classContext = classContext;
  4. JavaClass jclass = classContext.getJavaClass();
  5. Method[] methodList = jclass.getMethods();
  6. for (Method method : methodList) {
  7. MethodGen methodGen = classContext.getMethodGen(method);
  8. if (methodGen == null) {
  9. continue;
  10. }
  11. // Prescreening - must have IF_ACMPEQ, IF_ACMPNE,
  12. // or an invocation of an instance method
  13. BitSet bytecodeSet = classContext.getBytecodeSet(method);
  14. if (bytecodeSet == null || !bytecodeSet.intersects(prescreenSet)) {
  15. continue;
  16. }
  17. if (DEBUG) {
  18. System.out.println("FindRefComparison: analyzing " + SignatureConverter.convertMethodSignature(methodGen));
  19. }
  20. try {
  21. analyzeMethod(classContext, method);
  22. } catch (CFGBuilderException e) {
  23. bugReporter.logError("Error analyzing " + method.toString(), e);
  24. } catch (DataflowAnalysisException e) {
  25. // bugReporter.logError("Error analyzing " + method.toString(),
  26. // e);
  27. }
  28. bugAccumulator.reportAccumulatedBugs();
  29. }
  30. }

代码示例来源:origin: vsch/flexmark-java

  1. public boolean intersects(BitSet set) {return myBits.intersects(set);}

代码示例来源:origin: Mojang/DataFixerUpper

  1. final boolean firstId = Objects.equals(firstF, Functions.id());
  2. final boolean secondId = Objects.equals(secondF, Functions.id());
  3. if (firstAlgFunc.recData().intersects(secondModifies) || secondAlgFunc.recData().intersects(firstModifies)) {

代码示例来源:origin: org.openscience.cdk/cdk-core

  1. /**
  2. * Check if the edges are disjoint with respect to their reduced
  3. * vertices. That is, excluding the endpoints, no reduced vertices are
  4. * shared.
  5. *
  6. * @param other another edge
  7. * @return the edges reduced vertices are disjoint.
  8. */
  9. final boolean disjoint(final PathEdge other) {
  10. return !this.xs.intersects(other.xs);
  11. }

代码示例来源:origin: cdk/cdk

  1. /**
  2. * Check if the edges are disjoint with respect to their reduced
  3. * vertices. That is, excluding the endpoints, no reduced vertices are
  4. * shared.
  5. *
  6. * @param other another edge
  7. * @return the edges reduced vertices are disjoint.
  8. */
  9. final boolean disjoint(final PathEdge other) {
  10. return !this.xs.intersects(other.xs);
  11. }

代码示例来源:origin: UniTime/cpsolver

  1. /** true if weeks overlap
  2. * @param anotherLocation another time
  3. * @return true if the date patterns overlap
  4. */
  5. public boolean shareWeeks(TimeLocation anotherLocation) {
  6. return iWeekCode.intersects(anotherLocation.iWeekCode);
  7. }

代码示例来源:origin: com.oracle.substratevm/pointsto

  1. private static TypeState doSubtraction0(BigBang bb, MultiTypeState s1, MultiTypeState s2, boolean resultCanBeNull) {
  2. /* Speculate that s1 and s2 have either the same types, or no types in common. */
  3. if (s1.typesBitSet.equals(s2.typesBitSet)) {
  4. /* Speculate that s1 and s2 have the same types, i.e., the result is empty set. */
  5. return TypeState.forEmpty().forCanBeNull(bb, resultCanBeNull);
  6. }
  7. if (!s1.typesBitSet.intersects(s2.typesBitSet)) {
  8. /* Speculate that s1 and s2 have no types in common, i.e., the result is s1. */
  9. return s1.forCanBeNull(bb, resultCanBeNull);
  10. }
  11. return doSubtraction1(bb, s1, s2, resultCanBeNull);
  12. }

代码示例来源:origin: com.oracle.substratevm/pointsto

  1. private static TypeState doIntersection0(BigBang bb, MultiTypeState s1, MultiTypeState s2, boolean resultCanBeNull) {
  2. /* Speculate that s1 and s2 have either the same types, or no types in common. */
  3. if (s1.typesBitSet.equals(s2.typesBitSet)) {
  4. /* Speculate that s1 and s2 have the same types, i.e., the result is s1. */
  5. return s1.forCanBeNull(bb, resultCanBeNull);
  6. }
  7. if (!s1.typesBitSet.intersects(s2.typesBitSet)) {
  8. /* Speculate that s1 and s2 have no types in common, i.e., the result is empty. */
  9. return TypeState.forEmpty().forCanBeNull(bb, resultCanBeNull);
  10. }
  11. return doIntersection1(bb, s1, s2, resultCanBeNull);
  12. }

代码示例来源:origin: ch.cern.hadoop/hadoop-common

  1. @Test
  2. public void testNot() {
  3. BloomFilter bf = new BloomFilter(8, 1, Hash.JENKINS_HASH);
  4. bf.bits = BitSet.valueOf(new byte[] { (byte) 0x95 });
  5. BitSet origBitSet = (BitSet) bf.bits.clone();
  6. bf.not();
  7. assertFalse("BloomFilter#not should have inverted all bits",
  8. bf.bits.intersects(origBitSet));
  9. }
  10. }

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

  1. @Test
  2. public void testNot() {
  3. BloomFilter bf = new BloomFilter(8, 1, Hash.JENKINS_HASH);
  4. bf.bits = BitSet.valueOf(new byte[] { (byte) 0x95 });
  5. BitSet origBitSet = (BitSet) bf.bits.clone();
  6. bf.not();
  7. assertFalse("BloomFilter#not should have inverted all bits",
  8. bf.bits.intersects(origBitSet));
  9. }
  10. }

相关文章