1 /* 2 * Licensed under the GPL License. You may not use this file except in compliance with the License. 3 * You may obtain a copy of the License at 4 * 5 * https://www.gnu.org/licenses/old-licenses/gpl-2.0.html 6 * 7 * THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 8 * WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR 9 * PURPOSE. 10 */ 11 package psiprobe.beans.stats.listeners; 12 13 import org.jfree.data.xy.XYDataItem; 14 15 /** 16 * The Class StatsCollectionEvent. 17 */ 18 public class StatsCollectionEvent { 19 20 /** The name. */ 21 private String name; 22 23 /** The data. */ 24 private XYDataItem data; 25 26 /** 27 * Instantiates a new stats collection event. 28 */ 29 public StatsCollectionEvent() { 30 // Required due to override 31 } 32 33 /** 34 * Instantiates a new stats collection event. 35 * 36 * @param name the name 37 * @param data the data 38 */ 39 public StatsCollectionEvent(String name, XYDataItem data) { 40 this.name = name; 41 this.data = data; 42 } 43 44 /** 45 * Instantiates a new stats collection event. 46 * 47 * @param name the name 48 * @param time the time 49 * @param data the data 50 */ 51 public StatsCollectionEvent(String name, long time, long data) { 52 this(name, new XYDataItem(time, data)); 53 } 54 55 /** 56 * Gets the name. 57 * 58 * @return the name 59 */ 60 public String getName() { 61 return name; 62 } 63 64 /** 65 * Sets the name. 66 * 67 * @param name the new name 68 */ 69 public void setName(String name) { 70 this.name = name; 71 } 72 73 /** 74 * Gets the data. 75 * 76 * @return the data 77 */ 78 public XYDataItem getData() { 79 return data; 80 } 81 82 /** 83 * Sets the data. 84 * 85 * @param data the new data 86 */ 87 public void setData(XYDataItem data) { 88 this.data = data; 89 } 90 91 /** 92 * Gets the value. 93 * 94 * @return the value 95 */ 96 public long getValue() { 97 return getData().getY().longValue(); 98 } 99 100 /** 101 * Gets the time. 102 * 103 * @return the time 104 */ 105 public long getTime() { 106 return getData().getX().longValue(); 107 } 108 109 }