Creates a new instance of the DurationRule

@param maxAge - maximum age of the cell to keep
@param timeUnit - timeunit for the age
508519
public DurationRule maxAge(long maxAge, TimeUnit timeUnit) {
    return maxAge(Duration.ofNanos(TimeUnit.NANOSECONDS.convert(maxAge, timeUnit)));
  }
564487
public static void checkMinMax(int min, int max) {
    checkMin(min);
    checkMax(max);
    checkArgument(min <= max, "min > max");
  }
294958
public BaseWindowedBolt<T> withMaxLagMs(Time maxLag) {
        this.maxLagMs = maxLag.toMilliseconds();
        ensureNonNegativeTime(maxLagMs);
        return this;
    }
428236
public void setMinMax(double min, double max)
    {
        if(min <= 0 || Double.isNaN(min) || Double.isInfinite(min))
            throw new IllegalArgumentException("min value must be positive, not " + min);
        else if(min >= max || Double.isNaN(max) || Double.isInfinite(max))
            throw new IllegalArgumentException("max (" + max + ") must be larger than min (" + min+")" );
        this.max = max;
        this.min = min;
        this.logMax = Math.log(max);
        this.logMin = Math.log(min);
        this.logDiff = logMax-logMin;
        this.diff = max-min;
    }
882872
@Nonnull
  public CacheControlBuilder setSharedMaxAge (@Nonnull final TimeUnit eTimeUnit, final long nDuration)
  {
    return setSharedMaxAgeSeconds (eTimeUnit.toSeconds (nDuration));
  }
784493
public static ConcurrentLimitRule of(int concurrentLimit, TimeUnit timeOutUnit, long timeOut) {
        requireNonNull(timeOutUnit, "time out unit can not be null");
        return new ConcurrentLimitRule(concurrentLimit, timeOutUnit.toMillis(timeOut));
    }
1157126
public void setMaxRetryTimeMillis(long maxRetryTimeMillis) {
        if (this.httpClient instanceof DefaultHttpClient) {
            ((DefaultHttpClient) this.httpClient).setMaxRetryTimeMillis(maxRetryTimeMillis);
        }
        else
            throw new UnsupportedOperationException("Invalid operation for class " + this.httpClient.getClass());
    }
108586
public void setMax(Double max) {
        String maxStr = doubleToNiceStr(max);
        JQMCommon.setAttribute(input, "max", maxStr);
        refreshMax(input.getElement().getId(), maxStr);
        validateValue();
    }
342820
public Expiring<T> withDefault(long expireTime, TimeUnit expireUnit) {
		checkArgument(expireTime > 0);
		this.defaultExpireTime = Optional.of(expireTime);
		this.defaultExpireUnit = Optional.of(expireUnit);
		return this;
	}
769693
public void setCacheMaxAges(Map<String, ? extends Number> cacheMaxAges) {
        final Builder<String, Long> cacheMaxAgesBuilder = ImmutableMap.builder();
        final Builder<Long, String> cachedControlStringsBuilder = ImmutableMap.builder();
        final Set<Long> maxAgeLog = new HashSet<Long>();
        
        for (final Map.Entry<String, ? extends Number> cacheMaxAgeEntry : cacheMaxAges.entrySet()) {
            final Number maxAgeNum = cacheMaxAgeEntry.getValue();
            final int maxAge = maxAgeNum.intValue();
            final long maxAgeMillis = TimeUnit.SECONDS.toMillis(maxAge);
            cacheMaxAgesBuilder.put(cacheMaxAgeEntry.getKey(), maxAgeMillis);
            
            if (maxAgeLog.add(maxAgeMillis)) {
                cachedControlStringsBuilder.put(maxAgeMillis, "public, max-age=" + maxAge);
            }
        }
        
        this.cacheMaxAges = cacheMaxAgesBuilder.build();
        this.cachedControlStrings = cachedControlStringsBuilder.build();
    }
289338
@Override
    public ChronoZonedDateTime<D> with(TemporalField field, long newValue) {
        if (field instanceof ChronoField) {
            ChronoField f = (ChronoField) field;
            switch (f) {
                case INSTANT_SECONDS: return plus(newValue - toEpochSecond(), SECONDS);
                case OFFSET_SECONDS: {
                    ZoneOffset offset = ZoneOffset.ofTotalSeconds(f.checkValidIntValue(newValue));
                    return create(dateTime.toInstant(offset), zone);
                }
            }
            return ofBest(dateTime.with(field, newValue), zone, offset);
        }
        return ChronoZonedDateTimeImpl.ensureValid(getChronology(), field.adjustInto(this, newValue));
    }
1180977
public static RateLimiter create(double permitsPerSecond, double maxBurstSeconds, boolean filledWithToken)
			throws ReflectiveOperationException {
		Class<?> sleepingStopwatchClass = Class
				.forName("com.google.common.util.concurrent.RateLimiter$SleepingStopwatch");
		Method createStopwatchMethod = sleepingStopwatchClass.getDeclaredMethod("createFromSystemTimer");
		createStopwatchMethod.setAccessible(true);
		Object stopwatch = createStopwatchMethod.invoke(null);

		Class<?> burstyRateLimiterClass = Class
				.forName("com.google.common.util.concurrent.SmoothRateLimiter$SmoothBursty");
		Constructor<?> burstyRateLimiterConstructor = burstyRateLimiterClass.getDeclaredConstructors()[0];
		burstyRateLimiterConstructor.setAccessible(true);

		// set maxBurstSeconds
		RateLimiter rateLimiter = (RateLimiter) burstyRateLimiterConstructor.newInstance(stopwatch, maxBurstSeconds);
		rateLimiter.setRate(permitsPerSecond);

		if (filledWithToken) {
			// set storedPermits
			setField(rateLimiter, "storedPermits", permitsPerSecond * maxBurstSeconds);
		}

		return rateLimiter;
	}
278962
public Duration add( long duration,
                         TimeUnit unit ) {
        long durationInNanos = TimeUnit.NANOSECONDS.convert(duration, unit);
        return new Duration(this.durationInNanos + durationInNanos);
    }
187981
public static Duration getInstance(double duration, TimeUnit type)
   {
      Duration result;
      if (duration == 0)
      {
         result = ZERO_DURATIONS[type.getValue()];
      }
      else
      {
         result = new Duration(duration, type);
      }
      return (result);
   }
690332
public void setIdleMaxAge(long idleMaxAge, TimeUnit timeUnit) {
		this.idleMaxAgeInSeconds = TimeUnit.SECONDS.convert(idleMaxAge, checkNotNull(timeUnit)); 
	}
458453
public static boolean checkValidInterval(int interval, TimeUnit unit)
    {
        if (0 >= interval || INTERVAL_MAX < interval)
        {
            return false;
        }

        switch (unit)
        {
        case HOURS:
            break;
        case MINUTES:
            break;
        case SECONDS:
            break;
        case MILLISECONDS:
            break;
        default:
            return false;
        }

        return true;
    }
882916
public void setMinimumDuration(@NotNull final Duration minimumDuration) {
        if (minimumDuration.compareTo(MAXIMUM_DURATION) > 0) {
            throw new IllegalArgumentException("The minimum duaration has to be smaller than 23:59:59.");
        }
        this.minimumDuration = durationToDate(minimumDuration);
    }