SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
LinkedListStat.java
1/*
2 * Class: LinkedListStat
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.simevents;
26
27import java.util.Collection;
28import java.util.LinkedList;
29import java.util.NoSuchElementException;
30import umontreal.ssj.util.PrintfFormat;
31
38public class LinkedListStat<E> extends ListWithStat<E> {
39
43 public LinkedListStat() {
44 super(Simulator.getDefaultSimulator(), new LinkedList<Node<E>>());
45 }
46
52 public LinkedListStat(Simulator inSim) {
53 super(inSim, new LinkedList<Node<E>>());
54 }
55
62 public LinkedListStat(Collection<? extends E> c) {
63 super(Simulator.getDefaultSimulator(), new LinkedList<Node<E>>(), c);
64 }
65
72 public LinkedListStat(Simulator inSim, Collection<? extends E> c) {
73 super(inSim, new LinkedList<Node<E>>(), c);
74 }
75
82 public LinkedListStat(String name) {
83 super(Simulator.getDefaultSimulator(), new LinkedList<Node<E>>(), name);
84 }
85
93 public LinkedListStat(Simulator inSim, String name) {
94 super(inSim, new LinkedList<Node<E>>(), name);
95 }
96
105 public LinkedListStat(Collection<? extends E> c, String name) {
106 super(Simulator.getDefaultSimulator(), new LinkedList<Node<E>>(), c, name);
107 }
108
118 public LinkedListStat(Simulator inSim, Collection<? extends E> c, String name) {
119 super(inSim, new LinkedList<Node<E>>(), c, name);
120 }
121
129 public void addFirst(E obj) {
130 add(0, obj);
131 }
132
133 public void addLast(E obj) {
134 add(size(), obj);
135 }
136
137 public E getFirst() {
138 if (isEmpty())
139 throw new NoSuchElementException();
140 return get(0);
141 }
142
143 public E getLast() {
144 if (isEmpty())
145 throw new NoSuchElementException();
146 return get(size() - 1);
147 }
148
149 public E removeFirst() {
150 if (isEmpty())
151 throw new NoSuchElementException();
152 return remove(0);
153 }
154
155 public E removeLast() {
156 if (isEmpty())
157 throw new NoSuchElementException();
158 return remove(size() - 1);
159 }
160}
161
LinkedListStat(Simulator inSim)
Constructs a new list, initially empty, and using the default simulator.
LinkedListStat(Simulator inSim, Collection<? extends E > c)
Constructs a list containing the elements of the specified collection.
LinkedListStat()
Constructs a new list, initially empty.
LinkedListStat(String name)
Constructs a new list with name name, using the default simulator.
LinkedListStat(Collection<? extends E > c)
Constructs a list containing the elements of the specified collection, using the default simulator.
LinkedListStat(Simulator inSim, Collection<? extends E > c, String name)
Constructs a new list containing the elements of the specified collection c and with name name.
LinkedListStat(Collection<? extends E > c, String name)
Constructs a new list containing the elements of the specified collection c and with name name,...
LinkedListStat(Simulator inSim, String name)
Constructs a new list with name name.
Represents a node that can be part of a list with statistical collecting.
ListWithStat(List< Node< E > > nodeList)
Constructs a new list with internal data structure using the default simulator and implemented by nod...
Represents the executive of a discrete-event simulator.
static Simulator getDefaultSimulator()
Returns the default simulator instance used by the deprecated class.