/* Wotonomy: OpenStep design patterns for pure Java applications. Copyright (C) 2000 Blacksmith, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, see http://www.gnu.org */ package net.wotonomy.foundation; /** * A pure java implementation of NSMutableRange. An NSMutableRange is a * modifiable NSRange. * * @author michael@mpowers.net * @author $Author: cgruber $ * @version $Revision: 893 $ */ public class NSMutableRange extends NSRange { /** * Default constructor produces an empty range. */ public NSMutableRange() { super(); } /** * Produces a range that has the same location and length as the specified * range. */ public NSMutableRange(NSRange aRange) { super(aRange); } /** * Produces a range with the specified location and length. */ public NSMutableRange(int location, int length) { super(location, length); } /** * Sets the location of this range. */ public void setLocation(int location) { loc = location; } /** * Sets the length of this range. */ public void setLength(int length) { len = length; } /** * Modifies this range to be the union of this range and the specified range. */ public void unionRange(NSRange aRange) { NSRange range = rangeByUnioningRange(aRange); setLocation(range.location()); setLength(range.length()); } /** * Modifies this range to be the intersection of this range and the specified * range. */ public void intersectRange(NSRange aRange) { NSRange range = rangeByIntersectingRange(aRange); setLocation(range.location()); setLength(range.length()); } /** * Returns a copy of this range. */ public Object clone() { return new NSMutableRange(location(), length()); } } /* * $Log$ Revision 1.2 2006/02/16 13:15:00 cgruber Check in all sources in * eclipse-friendly maven-enabled packages. * * Revision 1.1.1.1 2000/12/21 15:47:36 mpowers Contributing wotonomy. * * Revision 1.3 2000/12/20 16:25:38 michael Added log to all files. * * */