/** * Asserts that the given boolean is <code>true</code>. If this * is not the case, some kind of unchecked exception is thrown. * * @param expression the outcome of the check * @return <code>true</code> if the check passes (does not return * if the check fails) */ public static boolean isTrue(boolean expression) { // succeed as quickly as possible if (expression) { return true; } return isTrue(expression, "");//$NON-NLS-1$ }
/** * Asserts that the given boolean is <code>true</code>. If this * is not the case, some kind of unchecked exception is thrown. * * @param expression the outcome of the check * @return <code>true</code> if the check passes (does not return * if the check fails) */ public static boolean isTrue(boolean expression) { // succeed as quickly as possible if (expression) { return true; } return isTrue(expression, "");//$NON-NLS-1$ }
/** * Creates a new instance. * * @param chars the chars to match. */ public CharacterMatch(char[] chars) { Assert.isNotNull(chars); Assert.isTrue(chars.length > 0); _chars = chars; Arrays.sort(chars); }
/** * Creates a new completion proposal. All fields are initialized based on the provided information. * * @param replacementString the actual string to be inserted into the document * @param replacementPosition the position of the text to be replaced * @param cursorPosition the position of the cursor following the insert relative to replacementOffset * @param image the image to display for this proposal * @param displayString the string to be displayed for the proposal * @param contextInformation the context information associated with this proposal * @param additionalProposalInfo the additional information associated with this proposal */ public PositionBasedCompletionProposal(String replacementString, Position replacementPosition, int cursorPosition, Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo) { Assert.isNotNull(replacementString); Assert.isTrue(replacementPosition != null); fReplacementString= replacementString; fReplacementPosition= replacementPosition; fCursorPosition= cursorPosition; fImage= image; fDisplayString= displayString; fContextInformation= contextInformation; fAdditionalProposalInfo= additionalProposalInfo; }
/** * Checks whether <code>position</code> resides in a default (SQL) partition of <code>_document</code>. * * @param position the position to be checked * @return <code>true</code> if <code>position</code> is in the default partition of <code>_document</code>, * <code>false</code> otherwise */ public boolean isDefaultPartition(int position) { Assert.isTrue(position >= 0); Assert.isTrue(position <= _document.getLength()); try { ITypedRegion region = TextUtilities.getPartition(_document, _partitioning, position, false); return region.getType().equals(_partition); } catch (BadLocationException e) { // _log.debug(EditorMessages.error_badLocationException, e); } return false; }
Assert.isTrue((increments.length() != 0 || decrements.length() != 0) && !increments.equals(decrements));
Assert.isTrue(start < _document.getLength());
Assert.isTrue(start <= _document.getLength());