@Override public int setIndex(int index) { Arguments.mustBeGreaterThanOrEqualToValue("index", index, INVALID_INDEX); int oldIndex = this.index; this.index = index; return oldIndex; }
MinLengthImpl(int minLength) { this.minLength = Arguments.mustBeGreaterThanOrEqualToValue("minLength", minLength, 0); }
@Override public void validate(String e) { Arguments.mustBeGreaterThanOrEqualToValue("e.length()", e.length(), this.minLength); }
protected final void checkSubListRange(int subListHeadHide, int subListTailHide) { Arguments.mustBeGreaterThanOrEqualToValue("subListHeadHide", subListHeadHide, 0); Arguments.mustBeGreaterThanOrEqualToValue("subListTailHide", subListTailHide, 0); Arguments.mustBeLessThanOrEqualToValue( "subListHeadHide + subListTailHide", subListHeadHide + subListTailHide, this.allSize()); }
public static LazyBehaviorProcessor of(int rowLimit, int countLimit) { Arguments.mustBeGreaterThanOrEqualToValue("rowLimit", rowLimit, 0); Arguments.mustBeGreaterThanOrEqualToValue("countLimit", rowLimit, 0); Arguments.mustBeLessThanOrEqualToOther("countLimit", countLimit, "rowLimit", rowLimit); if (rowLimit == 0 && countLimit == 0) { return DISABLED; } return new Normal(rowLimit, countLimit); }
public boolean setPosition(int position) { //Don't check this.isLocked() //because it is loced before this.setPosition Arguments.mustBeGreaterThanOrEqualToValue("position", position, 0); if (this.name != null) { throw new UnsupportedOperationException(canNotSetPositionOfNamedParameter()); } if (this.position == null) { this.position = position; return true; } return false; }
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <T> T mustBeGreaterThanOrEqualToValue( String parameterName, T argument, T minimumValue, Comparator<? super T> comparator) { if (comparator == null) { return (T)mustBeGreaterThanOrEqualToValue(parameterName, (Comparable)argument, (Comparable)minimumValue); } if (argument != null && minimumValue != null && comparator.compare(argument, minimumValue) < 0) { throw new IllegalArgumentException( mustBeGreaterThanValueMessage(parameterName, minimumValue.toString())); } return argument; }
public ArrayElements( BidiType bidiType, Object comparatorOrEqualityComparatorOrUnifiedComparator, int initCapacity, float expandFactor, Float collapseFactor) { super(bidiType, comparatorOrEqualityComparatorOrUnifiedComparator); Arguments.mustBeGreaterThanOrEqualToValue("initCapacity", initCapacity, 0); Arguments.mustBetweenValue("expandFactory", expandFactor, 1, true, 4, true); if (collapseFactor != null) { float factor = collapseFactor.floatValue(); Arguments.mustBetweenValue("expandFactory", factor, 0.1F, true, 0.9F, true); } if (initCapacity != 0) { this.data = new Object[initCapacity]; } }
@Override public int setIndex(final int index) { int oldIndex = this.index; if (this.index == index) { return index; } Arguments.mustBeGreaterThanOrEqualToValue("index", index, INVALID_INDEX); T oldValue = this.value; IndexedValueEvent<T> event = IndexedValueEvent.createReplaceEvent( this, IndexedReferenceModifications.<T>setIndex(oldIndex), oldValue, oldValue, oldIndex, index); this.setRaw(event, reference -> { ((MAIndexedReferenceImpl<T>)reference).index = index; }); return oldIndex; }