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

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

本文整理了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

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

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

private boolean checkAllTypesShouldNotBePresent(BitSet types) {
  if(filterNotTypes.intersects(types)) {
    return false;
  }
  return true;
}

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

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

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

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

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

private boolean checkFreeTags(BitSet types) {
  for (String ts : onlyTags) {
    BitSet b = tagRuleMask.get(ts);
    if (b == null || !b.intersects(types)) {
      return false;
    }
  }
  return true;
}

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

private boolean checkNotFreeTags(BitSet types) {
  for (String ts : onlyNotTags) {
    BitSet b = tagRuleMask.get(ts);
    if (b != null && b.intersects(types)) {
      return false;
    }
  }
  return true;
}

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

protected Object calcSelectValue(BitSet types, ParameterContext paramContext) {
  if (selectValue instanceof String && selectValue.toString().startsWith("$")) {
    BitSet mask = tagRuleMask.get(selectValue.toString().substring(1));
    if (mask != null && mask.intersects(types)) {
      BitSet findBit = new BitSet(mask.length());
      findBit.or(mask);
      findBit.and(types);
      int value = findBit.nextSetBit(0);
      return parseValueFromTag(value, selectType);
    }
  } else if (selectValue instanceof String && selectValue.toString().startsWith(":")) {
    String p = ((String) selectValue).substring(1);
    if (paramContext != null && paramContext.vars.containsKey(p)) {
      selectValue = parseValue(paramContext.vars.get(p), selectType);
    } else {
      return null;
    }
  }
  return selectValue;
}

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

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

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

public static boolean intersects(TAbstractCharClass cc1, TAbstractCharClass cc2) {
  if (cc1.getBits() == null || cc2.getBits() == null) {
    return true;
  }
  return cc1.getBits().intersects(cc2.getBits());
}

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

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

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

@Override
public void visitClassContext(ClassContext classContext) {
  this.classContext = classContext;
  JavaClass jclass = classContext.getJavaClass();
  Method[] methodList = jclass.getMethods();
  for (Method method : methodList) {
    MethodGen methodGen = classContext.getMethodGen(method);
    if (methodGen == null) {
      continue;
    }
    // Prescreening - must have IF_ACMPEQ, IF_ACMPNE,
    // or an invocation of an instance method
    BitSet bytecodeSet = classContext.getBytecodeSet(method);
    if (bytecodeSet == null || !bytecodeSet.intersects(prescreenSet)) {
      continue;
    }
    if (DEBUG) {
      System.out.println("FindRefComparison: analyzing " + SignatureConverter.convertMethodSignature(methodGen));
    }
    try {
      analyzeMethod(classContext, method);
    } catch (CFGBuilderException e) {
      bugReporter.logError("Error analyzing " + method.toString(), e);
    } catch (DataflowAnalysisException e) {
      // bugReporter.logError("Error analyzing " + method.toString(),
      // e);
    }
    bugAccumulator.reportAccumulatedBugs();
  }
}

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

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

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

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

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

/**
 * Check if the edges are disjoint with respect to their reduced
 * vertices. That is, excluding the endpoints, no reduced vertices are
 * shared.
 *
 * @param other another edge
 * @return the edges reduced vertices are disjoint.
 */
final boolean disjoint(final PathEdge other) {
  return !this.xs.intersects(other.xs);
}

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

/**
 * Check if the edges are disjoint with respect to their reduced
 * vertices. That is, excluding the endpoints, no reduced vertices are
 * shared.
 *
 * @param other another edge
 * @return the edges reduced vertices are disjoint.
 */
final boolean disjoint(final PathEdge other) {
  return !this.xs.intersects(other.xs);
}

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

/** true if weeks overlap
 * @param anotherLocation another time
 * @return true if the date patterns overlap
 */
public boolean shareWeeks(TimeLocation anotherLocation) {
  return iWeekCode.intersects(anotherLocation.iWeekCode);
}

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

private static TypeState doSubtraction0(BigBang bb, MultiTypeState s1, MultiTypeState s2, boolean resultCanBeNull) {
  /* Speculate that s1 and s2 have either the same types, or no types in common. */
  if (s1.typesBitSet.equals(s2.typesBitSet)) {
    /* Speculate that s1 and s2 have the same types, i.e., the result is empty set. */
    return TypeState.forEmpty().forCanBeNull(bb, resultCanBeNull);
  }
  if (!s1.typesBitSet.intersects(s2.typesBitSet)) {
    /* Speculate that s1 and s2 have no types in common, i.e., the result is s1. */
    return s1.forCanBeNull(bb, resultCanBeNull);
  }
  return doSubtraction1(bb, s1, s2, resultCanBeNull);
}

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

private static TypeState doIntersection0(BigBang bb, MultiTypeState s1, MultiTypeState s2, boolean resultCanBeNull) {
  /* Speculate that s1 and s2 have either the same types, or no types in common. */
  if (s1.typesBitSet.equals(s2.typesBitSet)) {
    /* Speculate that s1 and s2 have the same types, i.e., the result is s1. */
    return s1.forCanBeNull(bb, resultCanBeNull);
  }
  if (!s1.typesBitSet.intersects(s2.typesBitSet)) {
    /* Speculate that s1 and s2 have no types in common, i.e., the result is empty. */
    return TypeState.forEmpty().forCanBeNull(bb, resultCanBeNull);
  }
  return doIntersection1(bb, s1, s2, resultCanBeNull);
}

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

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

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

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

相关文章