1 /* 2 * Copyright (c) 1998-2004 The Jgroup Team. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License version 2 as 6 * published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU Lesser General Public License for more details. 12 * 13 * You should have received a copy of the GNU Lesser General Public License 14 * along with this program; if not, write to the Free Software 15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 * 17 */ 18 19 package jgroup.experiment; 20 21 /** 22 * @author Bjarte Svaeren 23 */ 24 public class Range 25 { 26 //////////////////////////////////////////////////////////////////////////////////////////// 27 // Data fields 28 //////////////////////////////////////////////////////////////////////////////////////////// 29 30 private int start; 31 private int end; 32 33 34 //////////////////////////////////////////////////////////////////////////////////////////// 35 // Constructor 36 //////////////////////////////////////////////////////////////////////////////////////////// 37 38 public Range(int start, int end) 39 { 40 this.start = start; 41 this.end = end; 42 } 43 44 45 //////////////////////////////////////////////////////////////////////////////////////////// 46 // Public access methods 47 //////////////////////////////////////////////////////////////////////////////////////////// 48 49 public Range getRange() { return new Range(start, end); } 50 public int getStart() { return start; } 51 public int getEnd() { return end; } 52 53 54 55 //////////////////////////////////////////////////////////////////////////////////////////// 56 // Overridden methods from class Object 57 //////////////////////////////////////////////////////////////////////////////////////////// 58 59 /* (non-Javadoc) 60 * @see java.lang.Object#equals(java.lang.Object) 61 */ 62 public boolean equals(Object obj) { 63 if(obj == null || !(obj instanceof Range) ) 64 return false; 65 if(obj == this) 66 return true; 67 68 Range range = (Range) obj; 69 if(this.start == range.start && this.end == range.end) 70 return true; 71 72 return false; 73 } 74 }