001 /*
002 * Created on Dec 5, 2007
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
005 * in compliance with the License. You may obtain a copy of the License at
006 *
007 * http://www.apache.org/licenses/LICENSE-2.0
008 *
009 * Unless required by applicable law or agreed to in writing, software distributed under the License
010 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
011 * or implied. See the License for the specific language governing permissions and limitations under
012 * the License.
013 *
014 * Copyright @2007-2010 the original author or authors.
015 */
016 package org.fest.swing.util;
017
018 /**
019 * Understands a range (from, to.)
020 * <p>
021 * Usage:
022 * <pre>
023 * Range range = <code>{@link #from(int) from}</code>(0).<code>{@link #to(int) to}</code>(8);
024 * </pre>
025 * </p>
026 *
027 * @author Alex Ruiz
028 */
029 public final class Range {
030
031 /**
032 * Creates a new <code>{@link From}</code>, representing the starting value of a range.
033 * @param value the starting value of the range.
034 * @return the created <code>From</code>.
035 */
036 public static final From from(int value) {
037 return new From(value);
038 }
039
040 /**
041 * Creates a new <code>{@link To}</code>, representing the ending value of a range.
042 * @param value the ending value of the range.
043 * @return the created <code>To</code>.
044 */
045 public static final To to(int value) {
046 return new To(value);
047 }
048
049 /**
050 * Understands the starting value of a range.
051 * @see Range
052 *
053 * @author Alex Ruiz
054 */
055 public static class From {
056 public final int value;
057 From(int value) { this.value = value; }
058 }
059
060 /**
061 * Understands the ending value of a range.
062 * @see Range
063 *
064 * @author Alex Ruiz
065 */
066 public static class To {
067 public final int value;
068 To(int value) { this.value = value; }
069 }
070
071 private Range() {}
072 }