blob: 2bfb6921f1f561d16d434c2402f4f7f39195dee6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
/*
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.
*
*
*/
|