@Override
  public boolean containsAny(IntSet c)
  {
    if (c == null || c.isEmpty() || c == this) {
      return true;
    }
    if (isEmpty()) {
      return false;
    }

    final ConciseSet other = convert(c);
    if (other.size == 1) {
      return contains(other.last);
    }

    // disjoint sets
    if (isSequenceWithNoBits(this.words[0])
        && maxLiteralLengthMultiplication(getSequenceCount(this.words[0]) + 1) > other.last) {
      if (isZeroSequence(this.words[0])) {
        return false;
      }
      return true;
    }
    if (isSequenceWithNoBits(other.words[0])
        && maxLiteralLengthMultiplication(getSequenceCount(other.words[0]) + 1) > this.last) {
      if (isZeroSequence(other.words[0])) {
        return false;
      }
      return true;
    }

    // scan "this" and "other"
    WordIterator thisItr = new WordIterator();
    WordIterator otherItr = other.new WordIterator();
    while (true) {
      if (!thisItr.isLiteral) {
        if (!otherItr.isLiteral) {
          int minCount = Math.min(thisItr.count, otherItr.count);
          if ((ConciseSetUtils.SEQUENCE_BIT & thisItr.word & otherItr.word) != 0) {
            return true;
          }
          if (!thisItr.prepareNext(minCount) | !otherItr.prepareNext(minCount)) // NOT ||
          {
            return false;
          }
        } else {
          if ((thisItr.toLiteral() & otherItr.word) != ConciseSetUtils.ALL_ZEROS_LITERAL) {
            return true;
          }
          thisItr.word--;
          if (!thisItr.prepareNext(1) | !otherItr.prepareNext()) // do NOT use "||"
          {
            return false;
          }
        }
      } else if (!otherItr.isLiteral) {
        if ((thisItr.word & otherItr.toLiteral()) != ConciseSetUtils.ALL_ZEROS_LITERAL) {
          return true;
        }
        otherItr.word--;
        if (!thisItr.prepareNext() | !otherItr.prepareNext(1)) // do NOT use  "||"
        {
          return false;
        }
      } else {
        if ((thisItr.word & otherItr.word) != ConciseSetUtils.ALL_ZEROS_LITERAL) {
          return true;
        }
        if (!thisItr.prepareNext() | !otherItr.prepareNext()) // do NOT use  "||"
        {
          return false;
        }
      }
    }
  }
@ Override public boolean containsAny ( IntSet c ) { if ( c == null || c . isEmpty ( ) || c == this ) { return true ; } if ( isEmpty ( ) ) { return false ; } final ConciseSet other = convert ( c ) ; if ( other . size == 1 ) { return contains ( other . last ) ; } if ( isSequenceWithNoBits ( this . words [ 0 ] ) && maxLiteralLengthMultiplication ( getSequenceCount ( this . words [ 0 ] ) + 1 ) > other . last ) { if ( isZeroSequence ( this . words [ 0 ] ) ) { return false ; } return true ; } if ( isSequenceWithNoBits ( other . words [ 0 ] ) && maxLiteralLengthMultiplication ( getSequenceCount ( other . words [ 0 ] ) + 1 ) > this . last ) { if ( isZeroSequence ( other . words [ 0 ] ) ) { return false ; } return true ; } WordIterator thisItr = new WordIterator ( ) ; WordIterator otherItr = other . new WordIterator ( ) ; while ( true ) { if ( ! thisItr . isLiteral ) { if ( ! otherItr . isLiteral ) { int minCount = Math . min ( thisItr . count , otherItr . count ) ; if ( ( ConciseSetUtils . SEQUENCE_BIT & thisItr . word & otherItr . word ) != 0 ) { return true ; } if ( ! thisItr . prepareNext ( minCount ) | ! otherItr . prepareNext ( minCount ) ) { return false ; } } else { if ( ( thisItr . toLiteral ( ) & otherItr . word ) != ConciseSetUtils . ALL_ZEROS_LITERAL ) { return true ; } thisItr . word -- ; if ( ! thisItr . prepareNext ( 1 ) | ! otherItr . prepareNext ( ) ) { return false ; } } } else if ( ! otherItr . isLiteral ) { if ( ( thisItr . word & otherItr . toLiteral ( ) ) != ConciseSetUtils . ALL_ZEROS_LITERAL ) { return true ; } otherItr . word -- ; if ( ! thisItr . prepareNext ( ) | ! otherItr . prepareNext ( 1 ) ) { return false ; } } else { if ( ( thisItr . word & otherItr . word ) != ConciseSetUtils . ALL_ZEROS_LITERAL ) { return true ; } if ( ! thisItr . prepareNext ( ) | ! otherItr . prepareNext ( ) ) { return false ; } } } }
{@inheritDoc}