MCPcopy Create free account
hub / github.com/akeranen/the-one / putToQueue

Method putToQueue

input/ScheduledUpdatesQueue.java:78–94  ·  view source on GitHub ↗

Puts a event to the queue in the right place @param ee The event to put to the queue

(ExternalEvent ee)

Source from the content-addressed store, hash-verified

76 * @param ee The event to put to the queue
77 */
78 private void putToQueue(ExternalEvent ee) {
79 double eeTime = ee.getTime();
80
81 for (int i=0, n=this.updates.size(); i<n; i++) {
82 double time = updates.get(i).getTime();
83 if (time == eeTime) {
84 return; // update with the given time exists -> no need for new
85 }
86 else if (eeTime < time) {
87 this.updates.add(i, ee);
88 return;
89 }
90 }
91
92 /* all existing updates are earlier -> add to the end of the list */
93 this.updates.add(ee);
94 }
95
96 public String toString() {
97 String times = "updates @ " + this.nextEvent.getTime();

Callers 1

addUpdateMethod · 0.95

Calls 3

addMethod · 0.80
getTimeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected