Skip to content

Commit 72e894a

Browse files
committed
Fixed throws format
Old-style C++ throws.
1 parent ca48597 commit 72e894a

File tree

9 files changed

+26
-28
lines changed

9 files changed

+26
-28
lines changed

src/main/java/org/javasim/SimulationEntity.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ public void interrupt (SimulationEntity toInterrupt, boolean immediate)
4343
throws SimulationException, RestartException
4444
{
4545
if (toInterrupt.terminated())
46-
throw (new SimulationException("Entity already terminated."));
46+
throw new SimulationException("Entity already terminated.");
4747

4848
if (!toInterrupt._waiting)
49-
throw (new SimulationException("Entity not waiting."));
49+
throw new SimulationException("Entity not waiting.");
5050

5151
toInterrupt._interrupted = true;
5252

@@ -149,15 +149,15 @@ protected void timedWait (double waitTime) throws SimulationException,
149149
}
150150
catch (SimulationException e)
151151
{
152-
throw (new SimulationException("Invalid entity."));
152+
throw new SimulationException("Invalid entity.");
153153
}
154154

155155
_waiting = false;
156156

157157
if (_interrupted)
158158
{
159159
_interrupted = false;
160-
throw (new InterruptedException());
160+
throw new InterruptedException();
161161
}
162162
}
163163

@@ -252,7 +252,7 @@ protected void waitForTrigger (TriggerQueue _queue)
252252
if (_triggered)
253253
_triggered = false;
254254
else
255-
throw (new InterruptedException());
255+
throw new InterruptedException();
256256
}
257257

258258
/**

src/main/java/org/javasim/SimulationProcess.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@ public synchronized SimulationProcess nextEv ()
8585
if (!idle())
8686
return Scheduler.getQueue().getNext(this);
8787
else
88-
throw (new SimulationException(
89-
"SimulationProcess not on run queue."));
88+
throw new SimulationException("SimulationProcess not on run queue.");
9089
}
9190

9291
/**

src/main/java/org/javasim/TriggerQueue.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public synchronized void triggerFirst (boolean setTrigger)
7676
throws NoSuchElementException
7777
{
7878
if (head.size() == 0)
79-
throw (new NoSuchElementException());
79+
throw new NoSuchElementException();
8080

8181
SimulationEntity removed = this.remove();
8282

@@ -118,7 +118,7 @@ public synchronized void triggerAll () throws NoSuchElementException
118118
long currentNumber = head.size();
119119

120120
if (currentNumber == 0)
121-
throw (new NoSuchElementException());
121+
throw new NoSuchElementException();
122122

123123
for (int i = 0; i < currentNumber; i++)
124124
triggerFirst();
@@ -128,7 +128,7 @@ protected synchronized void insert (SimulationEntity toAdd)
128128
throws SimulationException
129129
{
130130
if (toAdd.isWaiting())
131-
throw (new SimulationException("Entity already waiting on event."));
131+
throw new SimulationException("Entity already waiting on event.");
132132

133133
head.add(toAdd);
134134
}

src/main/java/org/javasim/internal/SimulationProcessList.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public synchronized SimulationProcess remove (SimulationProcess element)
120120
// Take care of boundary condition - empty list
121121

122122
if (Head == null)
123-
throw (new NoSuchElementException());
123+
throw new NoSuchElementException();
124124

125125
SimulationProcess p = null;
126126

@@ -145,7 +145,7 @@ public synchronized SimulationProcess remove (SimulationProcess element)
145145
}
146146
}
147147

148-
throw (new NoSuchElementException());
148+
throw new NoSuchElementException();
149149
}
150150

151151
public synchronized SimulationProcess remove ()
@@ -156,7 +156,7 @@ public synchronized SimulationProcess remove ()
156156
if (Head != null)
157157
return (remove(Head.car()));
158158
else
159-
throw (new NoSuchElementException());
159+
throw new NoSuchElementException();
160160
}
161161

162162
public synchronized SimulationProcess getNext (SimulationProcess current)
@@ -165,7 +165,7 @@ public synchronized SimulationProcess getNext (SimulationProcess current)
165165
// take care of boundary condition - empty list.
166166

167167
if ((Head == null) || (current == null))
168-
throw (new NoSuchElementException());
168+
throw new NoSuchElementException();
169169

170170
for (SimulationProcessCons ptr = Head; ptr != null; ptr = ptr.cdr())
171171
{

src/main/java/org/javasim/stats/PrecisionHistogram.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public double sizeByIndex (long index) throws StatisticsException,
121121
Bucket ptr = Head;
122122

123123
if ((index < 0) || (index > length))
124-
throw (new IllegalArgumentException("index out of range."));
124+
throw new IllegalArgumentException("index out of range.");
125125

126126
for (long i = 0; (i < index) && (ptr != null); i++)
127127
ptr = ptr.cdr();
@@ -131,7 +131,7 @@ public double sizeByIndex (long index) throws StatisticsException,
131131

132132
// we should never get here!
133133

134-
throw (new StatisticsException("sizeByIndex went off end of list."));
134+
throw new StatisticsException("sizeByIndex went off end of list.");
135135
}
136136

137137
/**
@@ -150,8 +150,7 @@ public double sizeByName (double name) throws IllegalArgumentException
150150
break;
151151
}
152152

153-
throw (new IllegalArgumentException("Bucket name " + name
154-
+ " not found."));
153+
throw new IllegalArgumentException("Bucket name " + name + " not found.");
155154
}
156155

157156
/**

src/main/java/org/javasim/stats/Quantile.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public Quantile(double q) throws IllegalArgumentException
4848
qProb = q;
4949

5050
if ((q <= 0.0) || (q > 1.0))
51-
throw (new IllegalArgumentException("Quantile::Quantile ( " + q
52-
+ " ) : bad value."));
51+
throw new IllegalArgumentException("Quantile::Quantile ( " + q
52+
+ " ) : bad value.");
5353
}
5454

5555
/**

src/main/java/org/javasim/stats/SimpleHistogram.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ public SimpleHistogram(double min, double max, double w)
9797
public void setValue (double value) throws IllegalArgumentException
9898
{
9999
if ((value < minIndex) || (value > maxIndex))
100-
throw (new IllegalArgumentException("Value " + value
100+
throw new IllegalArgumentException("Value " + value
101101
+ " is beyond histogram range [ " + minIndex + ", "
102-
+ maxIndex + " ]"));
102+
+ maxIndex + " ]");
103103

104104
for (Bucket ptr = Head; ptr != null; ptr = ptr.cdr())
105105
{
@@ -114,8 +114,8 @@ public void setValue (double value) throws IllegalArgumentException
114114

115115
// shouldn't get here!!
116116

117-
throw (new IllegalArgumentException("Something went wrong with "
118-
+ value));
117+
throw new IllegalArgumentException("Something went wrong with "
118+
+ value);
119119
}
120120

121121
/**
@@ -145,7 +145,7 @@ public void reset ()
145145
public double sizeByName (double name) throws IllegalArgumentException
146146
{
147147
if ((name < minIndex) || (name > maxIndex))
148-
throw (new IllegalArgumentException("Argument out of range."));
148+
throw new IllegalArgumentException("Argument out of range.");
149149

150150
for (Bucket ptr = Head; ptr != null; ptr = ptr.cdr())
151151
{
@@ -155,7 +155,7 @@ public double sizeByName (double name) throws IllegalArgumentException
155155
return ptr.size();
156156
}
157157

158-
throw (new IllegalArgumentException("Name " + name + " out of range."));
158+
throw new IllegalArgumentException("Name " + name + " out of range.");
159159
}
160160

161161
/**

src/test/java/org/javasim/examples/basic/Queue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public long queueSize ()
4646
public Job dequeue () throws NoSuchElementException
4747
{
4848
if (isEmpty())
49-
throw (new NoSuchElementException());
49+
throw new NoSuchElementException();
5050

5151
List ptr = head;
5252
head = head.next;

src/test/java/org/javasim/examples/interrupt/Queue.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public long queueSize ()
4646
public Job dequeue () throws NoSuchElementException
4747
{
4848
if (isEmpty())
49-
throw (new NoSuchElementException());
49+
throw new NoSuchElementException();
5050

5151
List ptr = head;
5252
head = head.next;

0 commit comments

Comments
 (0)