EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.aws.ec2.domain]

COVERAGE SUMMARY FOR SOURCE FILE [Spot.java]

nameclass, %method, %block, %line, %
Spot.java100% (2/2)63%  (12/19)68%  (208/305)67%  (47.7/71)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Spot100% (1/1)36%  (4/11)61%  (150/247)56%  (29.7/53)
compareTo (Spot): int 0%   (0/1)0%   (0/6)0%   (0/1)
getInstanceType (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getProductDescription (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getRegion (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getSpotPrice (): float 0%   (0/1)0%   (0/3)0%   (0/1)
getTimestamp (): Date 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/32)0%   (0/1)
equals (Object): boolean 100% (1/1)62%  (58/94)47%  (14/30)
hashCode (): int 100% (1/1)88%  (58/66)96%  (7.7/8)
Spot (String, String, String, float, Date): void 100% (1/1)100% (30/30)100% (7/7)
builder (): Spot$Builder 100% (1/1)100% (4/4)100% (1/1)
     
class Spot$Builder100% (1/1)100% (8/8)100% (58/58)100% (18/18)
Spot$Builder (): void 100% (1/1)100% (3/3)100% (1/1)
build (): Spot 100% (1/1)100% (14/14)100% (1/1)
clear (): void 100% (1/1)100% (16/16)100% (6/6)
instanceType (String): Spot$Builder 100% (1/1)100% (5/5)100% (2/2)
productDescription (String): Spot$Builder 100% (1/1)100% (5/5)100% (2/2)
region (String): Spot$Builder 100% (1/1)100% (5/5)100% (2/2)
spotPrice (float): Spot$Builder 100% (1/1)100% (5/5)100% (2/2)
timestamp (Date): Spot$Builder 100% (1/1)100% (5/5)100% (2/2)

1/**
2 * Licensed to jclouds, Inc. (jclouds) under one or more
3 * contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  jclouds licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  You may obtain a copy of the License at
9 *
10 *   http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied.  See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19package org.jclouds.aws.ec2.domain;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.util.Date;
24 
25/**
26 * @see <a href=
27 *      "http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribeSpotPriceHistory.html"
28 *      />
29 * @author Adrian Cole
30 */
31public class Spot implements Comparable<Spot> {
32   public static Builder builder() {
33      return new Builder();
34   }
35 
36   public static class Builder {
37      private String region;
38      private String instanceType;
39      private String productDescription;
40      private float spotPrice;
41      private Date timestamp;
42 
43      public void clear() {
44         this.region = null;
45         this.instanceType = null;
46         this.productDescription = null;
47         this.spotPrice = 0.0f;
48         this.timestamp = null;
49      }
50 
51      public Builder region(String region) {
52         this.region = region;
53         return this;
54      }
55 
56      public Builder instanceType(String instanceType) {
57         this.instanceType = instanceType;
58         return this;
59      }
60 
61      public Builder productDescription(String productDescription) {
62         this.productDescription = productDescription;
63         return this;
64      }
65 
66      public Builder spotPrice(float spotPrice) {
67         this.spotPrice = spotPrice;
68         return this;
69      }
70 
71      public Builder timestamp(Date timestamp) {
72         this.timestamp = timestamp;
73         return this;
74      }
75 
76      public Spot build() {
77         return new Spot(region, instanceType, productDescription, spotPrice, timestamp);
78      }
79   }
80 
81   private final String region;
82   private final String instanceType;
83   private final String productDescription;
84   private final float spotPrice;
85   private final Date timestamp;
86 
87   public Spot(String region, String instanceType, String productDescription, float spotPrice, Date timestamp) {
88      this.region = checkNotNull(region, "region");
89      this.instanceType = checkNotNull(instanceType, "instanceType");
90      this.productDescription = checkNotNull(productDescription, "productDescription");
91      this.spotPrice = spotPrice;
92      this.timestamp = checkNotNull(timestamp, "timestamp");
93   }
94 
95   public String getRegion() {
96      return region;
97   }
98 
99   public String getInstanceType() {
100      return instanceType;
101   }
102 
103   public String getProductDescription() {
104      return productDescription;
105   }
106 
107   public float getSpotPrice() {
108      return spotPrice;
109   }
110 
111   public Date getTimestamp() {
112      return timestamp;
113   }
114 
115   @Override
116   public int compareTo(Spot o) {
117      return Float.compare(spotPrice, o.spotPrice);
118   }
119 
120   @Override
121   public int hashCode() {
122      final int prime = 31;
123      int result = 1;
124      result = prime * result + ((instanceType == null) ? 0 : instanceType.hashCode());
125      result = prime * result + ((productDescription == null) ? 0 : productDescription.hashCode());
126      result = prime * result + ((region == null) ? 0 : region.hashCode());
127      result = prime * result + Float.floatToIntBits(spotPrice);
128      result = prime * result + ((timestamp == null) ? 0 : timestamp.hashCode());
129      return result;
130   }
131 
132   @Override
133   public boolean equals(Object obj) {
134      if (this == obj)
135         return true;
136      if (obj == null)
137         return false;
138      if (getClass() != obj.getClass())
139         return false;
140      Spot other = (Spot) obj;
141      if (instanceType == null) {
142         if (other.instanceType != null)
143            return false;
144      } else if (!instanceType.equals(other.instanceType))
145         return false;
146      if (productDescription == null) {
147         if (other.productDescription != null)
148            return false;
149      } else if (!productDescription.equals(other.productDescription))
150         return false;
151      if (region == null) {
152         if (other.region != null)
153            return false;
154      } else if (!region.equals(other.region))
155         return false;
156      if (Float.floatToIntBits(spotPrice) != Float.floatToIntBits(other.spotPrice))
157         return false;
158      if (timestamp == null) {
159         if (other.timestamp != null)
160            return false;
161      } else if (!timestamp.equals(other.timestamp))
162         return false;
163      return true;
164   }
165 
166   @Override
167   public String toString() {
168      return "[region=" + region + ", instanceType=" + instanceType + ", productDescription=" + productDescription
169            + ", spotPrice=" + spotPrice + ", timestamp=" + timestamp + "]";
170   }
171 
172}

[all classes][org.jclouds.aws.ec2.domain]
EMMA 2.0.5312 (C) Vladimir Roubtsov