[1207] | 1 | package simulator.stats.implementation; |
---|
| 2 | |
---|
| 3 | import schedframe.resources.ResourceType; |
---|
| 4 | import simulator.stats.implementation.out.StatsSerializer; |
---|
| 5 | |
---|
| 6 | public class ResourceAvailabilityStats implements StatsInterface{ |
---|
| 7 | |
---|
| 8 | protected String resourceName; |
---|
| 9 | protected String usageType; |
---|
| 10 | protected ResourceType resourceType; |
---|
| 11 | protected long timestamp; |
---|
| 12 | protected double value; |
---|
| 13 | |
---|
| 14 | private String[] headers = { "resourceName", "timestamp", "availability" }; |
---|
| 15 | |
---|
| 16 | public ResourceAvailabilityStats (String resourceName, ResourceType resourceType, String usageType, double value, long timestamp) { |
---|
| 17 | this.resourceName = resourceName; |
---|
| 18 | this.resourceType = resourceType; |
---|
| 19 | this.usageType = usageType; |
---|
| 20 | this.value = value; |
---|
| 21 | this.timestamp = timestamp; |
---|
| 22 | if(usageType == null){ |
---|
| 23 | this.usageType = "availability"; |
---|
| 24 | } |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | public ResourceAvailabilityStats (String resourceName, ResourceType resourceType, String usageType, double value) { |
---|
| 28 | this(resourceName, resourceType, usageType, value, 0); |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | public double getValue() { |
---|
| 33 | return value; |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | public Object serialize(StatsSerializer serializer) { |
---|
| 37 | return serializer.visit(this); |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | public String getResourceName() { |
---|
| 41 | return this.resourceName; |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | public ResourceType getResourceType() { |
---|
| 45 | return resourceType; |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | public String getUsageType() { |
---|
| 49 | return this.usageType; |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | public String[] getHeaders() { |
---|
| 53 | return headers; |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | public long getTimestamp() { |
---|
| 57 | return timestamp; |
---|
| 58 | } |
---|
| 59 | |
---|
| 60 | } |
---|