SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
ContainerPointSet.java
1/*
2 * Class: ContainerPointSet
3 * Description:
4 * Environment: Java
5 * Software: SSJ
6 * Copyright (C) 2001 Pierre L'Ecuyer and Universite de Montreal
7 * Organization: DIRO, Universite de Montreal
8 * @author
9 * @since
10 *
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 *
24 */
25package umontreal.ssj.hups;
26
27import umontreal.ssj.util.PrintfFormat;
28import umontreal.ssj.rng.RandomStream;
29
51public abstract class ContainerPointSet extends PointSet {
52 protected PointSet P; // contained point set
53
61 protected void init(PointSet p0) {
62 P = p0;
63 // this.dim = P.getDimension();
64 // this.numPoints = P.getNumPoints();
65 }
66
73 return P;
74 }
75
81 public int getDimension() {
82 return P.getDimension();
83 }
84
90 public int getNumPoints() {
91 return P.getNumPoints();
92 }
93
100 public double getCoordinate(int i, int j) {
101 return P.getCoordinate(i, j);
102 }
103
110 return new ContainerPointSetIterator();
111 }
112
120 rand.randomize(P);
121 }
122
130 public void addRandomShift(int d1, int d2, RandomStream stream) {
131 P.addRandomShift(d1, d2, stream);
132 }
133
139 public void addRandomShift(RandomStream stream) {
140 P.addRandomShift(stream);
141 }
142
146 public void clearRandomShift() {
147 P.clearRandomShift();
148 }
149
150 public String toString() {
151 return "Container point set of: {" + PrintfFormat.NEWLINE + P.toString() + PrintfFormat.NEWLINE + "}";
152 }
153
154 // ********************************************************
156
157 protected PointSetIterator innerIterator = P.iterator();
158
159 public void setCurCoordIndex(int j) {
160 innerIterator.setCurCoordIndex(j);
161 }
162
163 public void resetCurCoordIndex() {
164 innerIterator.resetCurCoordIndex();
165 }
166
167 public boolean hasNextCoordinate() {
168 return innerIterator.hasNextCoordinate();
169 }
170
171 public double nextCoordinate() {
172 return innerIterator.nextCoordinate();
173 }
174
175 public void setCurPointIndex(int i) {
176 innerIterator.setCurPointIndex(i);
177 }
178
179 public void resetCurPointIndex() {
180 innerIterator.resetCurPointIndex();
181 }
182
183 public int resetToNextPoint() {
184 return innerIterator.resetToNextPoint();
185 }
186
187 public boolean hasNextPoint() {
188 return innerIterator.hasNextPoint();
189 }
190
191 }
192}
int resetToNextPoint()
Resets the current point index to the next one and current coordinate to 0, and returns the new curre...
void resetCurPointIndex()
Resets both the current point index and the current coordinate to 0.
void setCurPointIndex(int i)
Resets the current point index to i and current coordinate to 0.
This acts as a generic base class for all container classes that contain a point set and apply a spec...
void addRandomShift(RandomStream stream)
Calls addRandomShift(stream) of the contained point set.
String toString()
Formats a string that contains information about the point set.
PointSetIterator iterator()
Return an iterator for this ContainerPointSet.
int getNumPoints()
Returns the number of points in the contained point set.
void addRandomShift(int d1, int d2, RandomStream stream)
Calls addRandomShift(d1, d2, stream) of the contained point set.
int getDimension()
Returns the dimension of the contained point set.
PointSet getOriginalPointSet()
Returns the (untransformed) point set contained in this container.
void init(PointSet p0)
Initializes this container point set so that it will contain the point set p0.
double getCoordinate(int i, int j)
By default, returns the untransformed coordinate for the contained point set.
void randomize(PointSetRandomization rand)
Randomizes the contained point set using rand.
void clearRandomShift()
Calls clearRandomShift() of the contained point set.
This class implements a default point set iterator.
This abstract class represents a general point set.
Definition PointSet.java:99
static final String NEWLINE
End-of-line symbol or line separator.
This is the interface for iterators that permit one to go through the points of a PointSet and the su...
This interface is for a randomization that can be used to randomize a umontreal.ssj....
void randomize(PointSet p)
This method must randomize p.
This interface defines the basic structures to handle multiple streams of uniform (pseudo)random numb...