Determine whether we can occupy the specified slice of the decorations
array.
164547
function canOccupySlice(
  decorations: Array<?string>,
  start: number,
  end: number
): boolean {
  // eslint-disable-next-line no-plusplus
  for (let ii = start; ii < end; ii++) {
    if (decorations[ii] != null) {
      return false;
    }
  }
  return true;
}
25960
static boolean isCollectionOrArray(final Object obj) {
        final Class<?> cls = obj.getClass();
        return Collection.class.isAssignableFrom(cls) || cls.isArray();
    }
1283791
function canCollectOrCombine(node) {
  return LikeTermCollector.canCollectLikeTerms(node) ||
    checks.resolvesToConstant(node) ||
    checks.canSimplifyPolynomialTerms(node);
}
1314223
public boolean hasDecoration(byte decorationType) {
		if (hasDecorations()) {
            for (Decoration m_decoration : m_decorations) {
                if (m_decoration.isType(decorationType))
                    return true;
            }
		}
		return false;
	}
303434
private int[] checkBoundaries(int[] minMax, int[] dim) {
        if (minMax[0] < 0) {
            minMax[0] = 0;
        }
        if (minMax[1] > dim[0]) {
            minMax[1] = dim[0];
        }
        if (minMax[2] < 0) {
            minMax[2] = 0;
        }
        if (minMax[3] > dim[1]) {
            minMax[3] = dim[1];
        }
        if (minMax[4] < 0) {
            minMax[4] = 0;
        }
        if (minMax[5] > dim[2]) {
            minMax[5] = dim[2];
        }
        return minMax;
    }
200300
def is_subset?(array1, array2)
      result = array1 & array2
      (array2.length == result.length)
    end
1000325
def slice_slice(old_slice, applied_slice, size):
    
    step = (old_slice.step or 1) * (applied_slice.step or 1)

    # For now, use the hack of turning old_slice into an ndarray to reconstruct
    # the slice start and stop. This is not entirely ideal, but it is still
    # definitely better than leaving the indexer as an array.
    items = _expand_slice(old_slice, size)[applied_slice]
    if len(items) > 0:
        start = items[0]
        stop = items[-1] + int(np.sign(step))
        if stop < 0:
            stop = None
    else:
        start = 0
        stop = 0
    return slice(start, stop, step)
647406
private static boolean isTree(int n, boolean[][] chart) {
        if (!chart[0][n]) {
            // Root must be a span.
            return false;
        }
        for (int width = 1; width <= n; width++) {
            for (int start = 0; start <= n - width; start++) {
                int end = start + width;
                if (width == 1) {
                    if (!chart[start][end]) {
                        // All width 1 spans must be set.
                        return false;
                    }
                } else {
                    if (chart[start][end]) {
                        // Count the number of pairs of child spans which could have been combined to form this span.
                        int childPairCount = 0;
                        for (int mid = start + 1; mid <= end - 1; mid++) {
                            if (chart[start][mid] && chart[mid][end]) {
                                childPairCount++;
                            }
                        }
                        if (childPairCount != 1) {
                            // This span should have been built from exactly one pair of child spans.
                            return false;
                        }
                    }
                }
            }
        }
        return true;
    }
52832
function hasProblematicOverloading(instances) {
    // Check if there are same lengthed argument sets
    const knownLengths = [];
    return instances.map(({ args }) => args.length).reduce((carry, item) => {
      if (carry || knownLengths.some((l) => l === item)) {
        return true;
      }

      knownLengths.push(item);
      return false;
    }, false);
  }
678585
public static boolean if_infeasible(double[] x) {
    boolean infeasible = false;
    for (int i = 0; i < pindex9.length - 1; i++) {
      double[][] p = new double[pindex9[i + 1] - pindex9[i]][2];
      for (int j = pindex9[i]; j < pindex9[i + 1]; j++) {
        p[j - pindex9[i]] = oth_poly_points9[j];
      }
      infeasible = if_inside_polygon(x, p);
      if (infeasible) {
        break;
      }
    }
    if (infeasible) {//check if the point is on the edges of regular polygon
      for (int i = 0; i < r_polyline9.length - 1; i++) {
        if (r_polyline9[i][0] == 1) {
          if (x[0] == r_polyline9[i][1] && x[1] >= rangey9[i][0] && x[1] <= rangey9[i][1]) {
            infeasible = false;
            break;
          }
        } else {
          if ((x[0] * r_polyline9[i][1] + r_polyline9[i][2] == x[1]) && x[1] >= rangey9[i][0]
              && x[1] <= rangey9[i][1] && x[0] >= rangex9[i][0] && x[0] <= rangex9[i][1]) {
            infeasible = false;
            break;
          }
        }
      }
      if (r_polyline9[M9 - 1][0] == 1) {
        if (x[0] == r_polyline9[M9 - 1][1] && x[1] >= rangey9[M9 - 1][0] && x[1] <= rangey9[M9
            - 1][1]) {
          infeasible = false;
        }
      } else {
        if (x[0] * r_polyline9[M9 - 1][1] + r_polyline9[M9 - 1][2] == x[1] && x[1] >= rangey9[M9
            - 1][0] && x[1] <= rangey9[M9 - 1][1]
            && x[0] >= rangex9[M9 - 1][0] && x[0] <= rangex9[M9 - 1][1]) {
          infeasible = false;
        }
      }
    }

    return infeasible;
  }
93973
function applyDisallowedRuleToArray( itemsRule, items ) {
		if ( !itemsRule )
			return false;

		var hadInvalid = false,
			allDisallowed = itemsRule === true;

		for ( var i = items.length; i--; ) {
			if ( allDisallowed || itemsRule( items[ i ] ) ) {
				items.splice( i, 1 );
				hadInvalid = true;
			}
		}

		return hadInvalid;
	}
979981
function(slices) {
      this.haveTopLevelSlicesBeenBuilt = false;
      slices.forEach(function(slice) {
        slice.parentContainer = this.parentContainer_;
        this.slices.push(slice);
      }, this);
    }
138845
def _slice_at(self, index, length=1):
        """"""
        length_ = len(self)
        if -length <= index < 0:
            index += length_
        return slice(index, index + length)
1187331
function(s) {
                //TODO: validate array length
		//TODO: return unwanted subset as new Px object

                var counts = this.valCounts(),
                multipliers = [];

                _.each(s, function(d, i) {
                    if (d[0] === '*') {
                        s[i] = _.range(0, counts[i] - 1);
                    }
                });

                for (var i = 0, l = counts.length; i < l - 1; i++) {
                    multipliers[i] = _.reduce(counts.slice(i+1), function(a, b) { return a * b; });
                }
                multipliers.push(1);

                for (var j = 0, k = s.length; j < k; j++) {
                    
                    // drop the values
                    this.metadata.VALUES[this.variables()[j]] = 
                        _.filter(this.metadata.VALUES[this.variables()[j]], function(e, m) {
                            return _.indexOf(s[j], m) !== -1;
                        });
                }

                var keepIdxs = [];
                var pattern = function pattern(c,m,w,p) {
                    if (c.length > 1) {
                        p = typeof p !== 'undefined' ? p : 1;
                        var count = c.pop(),
                            multiple = m.pop(),
                            want = w.pop();

                        var patt = _.flatten(_.map(_.range(0, count), function(d) { 
                            return _.include(want, d) ? p : _arrayOfZeroes(multiple);
                        }));

                        pattern(c, m, w, patt);
                    }
                    keepIdxs.push(_.flatten(p));
                };
                pattern(counts,multipliers,s);
                keepIdxs = keepIdxs[0];

                var indices = [];
                _.each(s[0], function(d) {
                    var start = d * multipliers[0];
                    var end = start + multipliers[0];
                    indices.push(_.filter(_.range(start, end), function(d, i) {return keepIdxs[i] === 1;}));
                });
                indices = _.flatten(indices);
                this.data = _.filter(this.data, function(d, i) {return _.indexOf(indices, i) !== -1;});
            }
831930
function slice(array) {
  const newArray = new Array(array.length);

  let i,
      l;

  for (i = 0, l = array.length; i < l; i++)
    newArray[i] = array[i];

  return newArray;
}
207094
public boolean isSingleTable() {
        Collection<String> tableNames = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
        for (Table each : tables) {
            tableNames.add(each.getName());
        }
        return 1 == tableNames.size();
    }
137274
function isFlattenable(value) {
  return isArray_1(value) || isArguments_1(value) ||
    !!(spreadableSymbol && value && value[spreadableSymbol]);
}