Updating the coverage ranges.

@param range the global range array.
@param ruleIntervals The intervals used for this update.
@return an updated array.
336777
public static boolean[] updateRanges(boolean[] range, List<RuleInterval> ruleIntervals) {
    boolean[] res = Arrays.copyOf(range, range.length);
    for (RuleInterval i : ruleIntervals) {
      int start = i.getStart();
      int end = i.getEnd();
      for (int j = start; j < end; j++) {
        res[j] = true;
      }
    }
    return res;
  }
943461
public IVersionRange merge(IVersionRange... ranges) {
    if (ranges.length < 2) {
      return ranges[0];
    }

    // Check the type of the first range
    if (!(ranges[0] instanceof VersionRange)) {
      if (!(ranges[0] instanceof OrRange)) {
        throw new UnsupportedOperationException("Incorrect type for ranges[0]");
      }
      if (((OrRange) ranges[0]).size() != 2) {
        throw new UnsupportedOperationException("Incorrect size for ranges[0]");
      }
    }
    else {
      if (!((VersionRange) ranges[0]).isUnbounded()) {
        throw new UnsupportedOperationException("ranges[0] should be unbounded (> or >=)");
      }
    }

    int lastIndex = ranges.length - 1;

    // Check the type of the last range
    if (!(ranges[lastIndex] instanceof VersionRange)) {
      if (!(ranges[lastIndex] instanceof OrRange)) {
        throw new UnsupportedOperationException("Incorrect type for ranges[last]");
      }
      if (((OrRange) ranges[lastIndex]).size() != 2) {
        throw new UnsupportedOperationException("Incorrect size for ranges[last]");
      }
    }
    else {
      if (((VersionRange) ranges[lastIndex]).isUnbounded()) {
        throw new UnsupportedOperationException("ranges[0] should be bounded (< or <=)");
      }
    }

    // Check the rest of the types
    for (int i = 1; i < lastIndex; i++) {
      if (!(ranges[i] instanceof OrRange)) {
        throw new UnsupportedOperationException("Incorrect type for ranges[" + i + "]");
      }

      if (((OrRange) ranges[i]).size() != 2) {
        throw new UnsupportedOperationException("Incorrect size for ranges[" + i + "]");
      }
    }

    List<IVersionRange> results = new LinkedList<IVersionRange>();
    IVersionRange last = null;
    for (int i = 0; i < ranges.length; i++) {
      IVersionRange range = ranges[i];
      if (last == null) {
        if (range instanceof VersionRange) {
          last = range;
        }
        else {
          OrRange orange = (OrRange) range;
          results.add(orange.first());
          last = orange.last();
        }
      }
      else {
        if (range instanceof VersionRange) {
          AndRange arange = new AndRange(last, range);
          results.add(arange);
          last = null;
        }
        else {
          OrRange orange = (OrRange) range;
          AndRange arange = new AndRange(last, orange.first());
          results.add(arange);
          last = orange.last();
        }
      }
    }

    if (last != null) {
      results.add(last);
    }

    return new OrRange(results);
  }
296691
public void setRuleSets(java.util.Collection<MatchmakingRuleSet> ruleSets) {
        if (ruleSets == null) {
            this.ruleSets = null;
            return;
        }

        this.ruleSets = new java.util.ArrayList<MatchmakingRuleSet>(ruleSets);
    }
489975
public static boolean[] updateRanges(boolean[] range, GrammarRules grammar) {
    boolean[] res = Arrays.copyOf(range, range.length);
    for (GrammarRuleRecord r : grammar) {
      if (0 == r.getRuleNumber()) {
        continue;
      }
      res = updateRanges(res, r.getRuleIntervals());
    }
    return res;
  }
739516
public synchronized void setMaxInactiveInterval(int interval) {
        if (com.ibm.websphere.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_WAS.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_WAS.entering(methodClassName, methodNames[SET_MAX_INACTIVE_INTERVAL], "interval= " + interval);
        }
        if (_maxInactiveInterval != interval) {
            _maxInactiveInterval = interval;
            maxInactWriteHit = true;
        }
    }
144404
public CircuitBreakerBuilder counterUpdateInterval(Duration counterUpdateInterval) {
        requireNonNull(counterUpdateInterval, "counterUpdateInterval");
        if (counterUpdateInterval.isNegative() || counterUpdateInterval.isZero()) {
            throw new IllegalArgumentException(
                    "counterUpdateInterval: " + counterUpdateInterval + " (expected: > 0)");
        }
        this.counterUpdateInterval = counterUpdateInterval;
        return this;
    }
72973
public void setRules(java.util.Collection<Rule> rules) {
        if (rules == null) {
            this.rules = null;
            return;
        }

        this.rules = new java.util.ArrayList<Rule>(rules);
    }
522020
public void setDefaultInterval(long defaultInterval) {
    	if(defaultInterval <= 0) {
    		LOG.severe("collector.scheduler.interval must be greater than 0. Recommended value is 500-1000. Current value is " + defaultInterval);
    		throw new IllegalArgumentException("collector.scheduler.interval must be greater than 0. Recommended value is 500-1000. Current value is " + defaultInterval);
    	}
        this.defaultInterval = defaultInterval;
    }
972277
private void createIntervalList(){
		synchronized(intervalLock){
			if (_cachedIntervalInfos!=null)
				return;
			List<Interval> intervals = intervalRegistry.getIntervals();
			_cachedIntervalInfos = new ArrayList<IntervalInfo>(intervals.size());
			for (Interval interval : intervals) {
				_cachedIntervalInfos.add(new IntervalInfo(interval));
				interval.addSecondaryIntervalListener(this);
			}
		}
	}
1206920
public void buildIntervals(SAXRecords records, double[] originalTimeSeries,
      int slidingWindowSize) {

    records.buildIndex();

    for (int ruleIdx = 1; ruleIdx <= this.theRules.size(); ruleIdx++) {

      RePairRule rr = this.theRules.get(ruleIdx);

      String[] split = rr.expandedRuleString.split(" ");
      for (int strPos : rr.getOccurrences()) {
        Integer tsPos = records.mapStringIndexToTSPosition(strPos + split.length - 1);
        if (null == tsPos) {
          rr.ruleIntervals.add(new RuleInterval(records.mapStringIndexToTSPosition(strPos),
              originalTimeSeries.length + 1)); // +1 cause right point is excluded
        }
        else {
          rr.ruleIntervals.add(new RuleInterval(records.mapStringIndexToTSPosition(strPos),
              records.mapStringIndexToTSPosition(strPos + split.length - 1) + slidingWindowSize));
        }
      }
    }

  }
1325237
static TimingInterval merge(Iterable<TimingInterval> intervals, int maxSamples, long start)
    {
        ThreadLocalRandom rnd = ThreadLocalRandom.current();
        long operationCount = 0, partitionCount = 0, rowCount = 0, errorCount = 0;
        long maxLatency = 0, totalLatency = 0;
        List<SampleOfLongs> latencies = new ArrayList<>();
        long end = 0;
        long pauseStart = 0, pauseEnd = Long.MAX_VALUE;
        for (TimingInterval interval : intervals)
        {
            if (interval != null)
            {
                end = Math.max(end, interval.end);
                operationCount += interval.operationCount;
                maxLatency = Math.max(interval.maxLatency, maxLatency);
                totalLatency += interval.totalLatency;
                partitionCount += interval.partitionCount;
                rowCount += interval.rowCount;
                errorCount += interval.errorCount;
                latencies.addAll(Arrays.asList(interval.sample));
                if (interval.pauseLength > 0)
                {
                    pauseStart = Math.max(pauseStart, interval.pauseStart);
                    pauseEnd = Math.min(pauseEnd, interval.pauseStart + interval.pauseLength);
                }
            }
        }

        if (pauseEnd < pauseStart || pauseStart <= 0)
        {
            pauseEnd = pauseStart = 0;
        }

        return new TimingInterval(start, end, maxLatency, pauseStart, pauseEnd - pauseStart, partitionCount, rowCount,
                                  totalLatency, operationCount, errorCount, SampleOfLongs.merge(rnd, latencies, maxSamples));

    }
881775
public static Version getStrictVersion(Collection<? extends VersionRangeCollection> ranges)
    {
        for (VersionRangeCollection collection : ranges) {
            if (collection.getRanges().size() == 1) {
                VersionRange range = collection.getRanges().iterator().next();
                if (range instanceof DefaultVersionRange) {
                    DefaultVersionRange defaultRange = (DefaultVersionRange) range;
                    Version lowerBound = defaultRange.getLowerBound();
                    if (lowerBound != null && (lowerBound.equals(defaultRange.getUpperBound()))) {
                        return lowerBound;
                    }
                }
            }
        }

        return null;
    }
596868
public static VersionRange intersection(VersionRange... ranges)
   {
      Assert.notNull(ranges, "Version ranges must not be null.");
      Assert.isTrue(ranges.length >= 1, "Version ranges must not be empty.");
      return intersection(Arrays.asList(ranges));
   }
692332
public static void invalidRangeIf(boolean tester, String msg, Object... args) {
        if (tester) {
            throw invalidRange(msg, args);
        }
    }
974905
public CommandLine setInterpolateVariables(boolean interpolate) {
        getCommandSpec().interpolateVariables(interpolate);
        for (CommandLine command : getCommandSpec().subcommands().values()) {
            command.setInterpolateVariables(interpolate);
        }
        return this;
    }
34403
public static Range fromInterval(int start, int end) {
        if (start < 0) {
            throw new IllegalArgumentException("Range start must be >= 0: " + start);
        }
        if (end < 0) {
            throw new IllegalArgumentException("Range end must be >= 0: " + end);
        }
        if (end < start) {
            throw new IllegalArgumentException("Range end must be >= start: " + end + "<" + start);
        }
        return new Range(start, end - start);
    }
1116350
@Override
  public boolean intersects(IVersionRange yourRange)
  {
    // The set has explicit versions, so just check these against the supplied range
    for (IVersion version : set) {
      if (yourRange.contains(version)) {
        return true;
      }
    }
    return false;
  }