Here you can find the source of checkPoint(Point point, String name)
Checks a Point.
Parameter | Description |
---|---|
point | the Point to be checked. |
name | the name of the Point. |
Parameter | Description |
---|---|
IllegalArgumentException | If the Point is null or its x/y is negative. |
public static void checkPoint(Point point, String name)
//package com.java2s; import java.awt.Point; public class Main { /**/*w w w.jav a 2 s .co m*/ * <p> * Checks a Point. * If the Point is null or its x/y is negative, throw an <code>IllegalArgumentException</code>. * </p> * * @param point * the Point to be checked. * @param name * the name of the Point. * @throws IllegalArgumentException * If the Point is null or its x/y is negative. */ public static void checkPoint(Point point, String name) { checkNull(point, name); checkNegative(point.x, name + "'s x"); checkNegative(point.y, name + "'s y"); } /** * <p> * Checks an Object. * If the Object is null, throw an <code>IllegalArgumentException</code>. * </p> * * @param obj * the Object to be checked. * @param name * the name of the obj. * @throws IllegalArgumentException * If the Object is null. */ public static void checkNull(Object obj, String name) { if (obj == null) { throw new IllegalArgumentException("The [" + name + "] should not be null."); } } /** * <p> * Checks an int value. * If the int value is negative, throw an <code>IllegalArgumentException</code>. * </p> * * @param value * the int value to be checked. * @param name * the name of the value. * @throws IllegalArgumentException * If the int value is negative. */ public static void checkNegative(int value, String name) { if (value < 0) { throw new IllegalArgumentException("The [" + name + "] should not be negative."); } } }