1 package at.ac.tuwien.lsdc.types;
3 public class Application implements Comparable<Application> {
6 private long timestamp;
12 public Application(int id, long timestamp, int size, int ram, int cpu, int duration) {
14 this.timestamp = timestamp;
18 this.duration = duration;
25 public long getTimestamp() {
29 public int getSize() {
41 public int getDuration() {
45 public String toString() {
46 return new String("App ID: " + id + " Timestamp: " + timestamp + " size: " + size + " ram: " + ram + " cpu: " + cpu + " duration: " + duration);
50 public int compareTo(Application other) {
51 final int BEFORE = -1;
55 //this optimization is usually worthwhile, and can
57 if ( this == other ) return EQUAL;
58 if ( this.getTimestamp() == other.getTimestamp() ) return EQUAL;
59 if ( this.getTimestamp() < other.getTimestamp() ) return BEFORE;
60 if ( this.getTimestamp() > other.getTimestamp() ) return AFTER;