SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
RandomStreamInstantiationException.java
1/*
2 * Class: RandomStreamInstantiationException
3 * Description: thrown when a random stream factory cannot instantiate a stream
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.rng;
26
34public class RandomStreamInstantiationException extends RuntimeException {
35 private RandomStreamFactory factory;
36
44 super();
45 this.factory = factory;
46 }
47
56 super(message);
57 this.factory = factory;
58 }
59
68 super(cause);
69 this.factory = factory;
70 }
71
80 public RandomStreamInstantiationException(RandomStreamFactory factory, String message, Throwable cause) {
81 super(message, cause);
82 this.factory = factory;
83 }
84
91 return factory;
92 }
93
105 public String toString() {
106 if (factory == null)
107 return super.toString();
108
109 StringBuffer sb = new StringBuffer(getClass().getName());
110 sb.append(": For random stream factory ");
111 sb.append(factory.toString());
112 String msg = getMessage();
113 if (msg != null)
114 sb.append(", ").append(msg);
115 return sb.toString();
116 }
117}
RandomStreamInstantiationException(RandomStreamFactory factory)
Constructs a new random stream instantiation exception with no message, no cause, and thrown by the g...
RandomStreamInstantiationException(RandomStreamFactory factory, Throwable cause)
Constructs a new random stream instantiation exception with no message, the given cause,...
RandomStreamInstantiationException(RandomStreamFactory factory, String message)
Constructs a new random stream instantiation exception with the given message, no cause,...
RandomStreamInstantiationException(RandomStreamFactory factory, String message, Throwable cause)
Constructs a new random stream instantiation exception with the given message, the supplied cause,...
String toString()
Returns a short description of the exception.
RandomStreamFactory getRandomStreamFactory()
Returns the random stream factory concerned by this exception.
Represents a random stream factory capable of constructing instances of a given type of random stream...