/** * Set the loading depth parameter, which controls how deep a subgraph should be read when a node is loaded from the * persistence store. By default, this value is 1. * * @param depth the depth that should be read whenever a single node is loaded * @throws IllegalArgumentException if the depth is not positive */ public void setDepthForLoadingNodes( int depth ) { CheckArg.isPositive(depth, "depth"); this.loadDepth = depth; }
public DeleteChildrenToDepthRequest( Location at, String workspaceName, int maxDepth ) { super(at, workspaceName); CheckArg.isPositive(maxDepth, "maxDepth"); this.maxDepth = maxDepth; }
/** * Creates a new UTC {@link LocalDateTime} instance based on the given millis value * * @param millis a positive amount of millis * @return a {@link LocalDateTime} instance. */ public static LocalDateTime localDateTimeUTC( long millis ) { CheckArg.isPositive(millis, "millis"); return LocalDateTime.ofInstant(Instant.ofEpochMilli(millis), UTC); } }
/** * Creates a new UTC {@link LocalDateTime} instance based on the given millis value * * @param millis a positive amount of millis * @return a {@link LocalDateTime} instance. */ public static LocalDateTime localDateTimeUTC( long millis ) { CheckArg.isPositive(millis, "millis"); return LocalDateTime.ofInstant(Instant.ofEpochMilli(millis), UTC); } }
/** * Creates a new UTC {@link LocalDateTime} instance based on the given millis value * * @param millis a positive amount of millis * @return a {@link LocalDateTime} instance. */ public static LocalDateTime localDateTimeUTC( long millis ) { CheckArg.isPositive(millis, "millis"); return LocalDateTime.ofInstant(Instant.ofEpochMilli(millis), UTC); } }
public SingleProducerCursor( int bufferSize, WaitStrategy waitStrategy ) { CheckArg.isPositive(bufferSize, "cursor.getBufferSize()"); CheckArg.isPowerOfTwo(bufferSize, "cursor.getBufferSize()"); this.bufferSize = bufferSize; this.waitStrategy = waitStrategy; }
public SingleProducerCursor( int bufferSize, WaitStrategy waitStrategy ) { CheckArg.isPositive(bufferSize, "cursor.getBufferSize()"); CheckArg.isPowerOfTwo(bufferSize, "cursor.getBufferSize()"); this.bufferSize = bufferSize; this.waitStrategy = waitStrategy; }
public SingleProducerCursor( int bufferSize, WaitStrategy waitStrategy ) { CheckArg.isPositive(bufferSize, "cursor.getBufferSize()"); CheckArg.isPowerOfTwo(bufferSize, "cursor.getBufferSize()"); this.bufferSize = bufferSize; this.waitStrategy = waitStrategy; }
/** * @param minimumSize Sets minimumSize to the specified value. */ public void setMinimumSize( int minimumSize ) { CheckArg.isPositive(minimumSize, "minimumSize"); this.minimumSize = minimumSize; }
/** * Create a new generator that uses the specified number of bits for the counter portion of the keys. * * @param bitsUsedInCounter the number of bits in the counter portion of the keys; must be a positive number for which theere * is enough space to left shift without overflowing. * @return the generator instance; never null */ public static TimeBasedKeys create( int bitsUsedInCounter ) { CheckArg.isPositive(bitsUsedInCounter, "bitsUsedInCounter"); int maxAvailableBitsToShift = Long.numberOfLeadingZeros(System.currentTimeMillis()); CheckArg.isLessThan(bitsUsedInCounter, maxAvailableBitsToShift, "bitsUsedInCounter"); return new TimeBasedKeys((short)bitsUsedInCounter); }
@Override public Limit limit( int rowLimit, int offset ) { CheckArg.isPositive(rowLimit, "rowLimit"); CheckArg.isNonNegative(offset, "offset"); return new Limit(rowLimit, offset); }
@Override public Limit limit( int rowLimit, int offset ) { CheckArg.isPositive(rowLimit, "rowLimit"); CheckArg.isNonNegative(offset, "offset"); return new Limit(rowLimit, offset); }
public BackupDocumentWriter( File parentDirectory, String filenamePrefix, long documentsPerFile, boolean compress, Problems problems ) { CheckArg.isNotNull(parentDirectory, "parentDirectory"); CheckArg.isNotEmpty(filenamePrefix, "filenamePrefix"); CheckArg.isPositive(documentsPerFile, "documentsPerFile"); this.parentDirectory = parentDirectory; this.filenamePrefix = filenamePrefix; this.maxDocumentsPerFile = documentsPerFile; this.problems = problems; this.compress = compress; }
public RingBufferBuilder<T, C> ofSize( int bufferSize ) { CheckArg.isPositive(bufferSize, "bufferSize"); try { CheckArg.isPowerOfTwo(bufferSize, "bufferSize"); } catch (IllegalArgumentException e) { int nextPowerOf2 = nextPowerOf2(bufferSize); logger.warn(CommonI18n.incorrectRingBufferSize, bufferSize, nextPowerOf2); bufferSize = nextPowerOf2; } this.bufferSize = bufferSize; return this; }
public RingBufferBuilder<T, C> ofSize( int bufferSize ) { CheckArg.isPositive(bufferSize, "bufferSize"); try { CheckArg.isPowerOfTwo(bufferSize, "bufferSize"); } catch (IllegalArgumentException e) { int nextPowerOf2 = nextPowerOf2(bufferSize); logger.warn(CommonI18n.incorrectRingBufferSize, bufferSize, nextPowerOf2); bufferSize = nextPowerOf2; } this.bufferSize = bufferSize; return this; }
@Test( expected = IllegalArgumentException.class ) public void isPositiveLongShouldThrowExceptionIfNegative() { CheckArg.isPositive(-1l, "test"); }
@Test( expected = IllegalArgumentException.class ) public void isPositiveShouldThrowExceptionIfZero() { CheckArg.isPositive(0, "test"); }
@Test public void isPositiveLongShouldNotThrowExceptionIfPositiveNumber() { CheckArg.isPositive(1l, "test"); }
public RingBufferBuilder<T, C> ofSize( int bufferSize ) { CheckArg.isPositive(bufferSize, "bufferSize"); try { CheckArg.isPowerOfTwo(bufferSize, "bufferSize"); } catch (IllegalArgumentException e) { int nextPowerOf2 = nextPowerOf2(bufferSize); logger.warn(CommonI18n.incorrectRingBufferSize, bufferSize, nextPowerOf2); bufferSize = nextPowerOf2; } this.bufferSize = bufferSize; return this; }
@Test( expected = IllegalArgumentException.class ) public void isPositiveShouldThrowExceptionIfNegative() { CheckArg.isPositive(-1, "test"); }