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

COVERAGE SUMMARY FOR SOURCE FILE [Flavor.java]

nameclass, %method, %block, %line, %
Flavor.java100% (1/1)75%  (6/8)68%  (107/158)70%  (26/37)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Flavor100% (1/1)75%  (6/8)68%  (107/158)70%  (26/37)
getPrice (): int 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/27)0%   (0/1)
equals (Object): boolean 100% (1/1)69%  (43/62)53%  (10/19)
hashCode (): int 100% (1/1)95%  (40/42)99%  (7/7)
Flavor (int, String, int, int): void 100% (1/1)100% (15/15)100% (6/6)
getId (): int 100% (1/1)100% (3/3)100% (1/1)
getName (): String 100% (1/1)100% (3/3)100% (1/1)
getRam (): int 100% (1/1)100% (3/3)100% (1/1)

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.slicehost.domain;
20 
21/**
22 * 
23 * A flavor is an available hardware configuration for a slice.
24 * 
25 * @author Adrian Cole
26 */
27public class Flavor {
28 
29   private final int id;
30   private final String name;
31   private final int price;
32   private final int ram;
33 
34   public Flavor(int id, String name, int price, int ram) {
35      this.id = id;
36      this.name = name;
37      this.price = price;
38      this.ram = ram;
39   }
40 
41   /**
42    * @return id of the flavor
43    */
44   public int getId() {
45      return id;
46   }
47 
48   /**
49    * @return Verbose name for the flavor, e.g. 256 slice
50    */
51   public String getName() {
52      return name;
53   }
54 
55   /**
56    * @return The price as an integer of cents. For example: 2000 equals $20.00.
57    *         Note that all prices are in USD
58    */
59   public int getPrice() {
60      return price;
61   }
62 
63   /**
64    * @return The amount of RAM (in Megabytes) included with the plan
65    */
66   public int getRam() {
67      return ram;
68   }
69 
70   @Override
71   public int hashCode() {
72      final int prime = 31;
73      int result = 1;
74      result = prime * result + id;
75      result = prime * result + ((name == null) ? 0 : name.hashCode());
76      result = prime * result + Float.floatToIntBits(price);
77      result = prime * result + ram;
78      return result;
79   }
80 
81   @Override
82   public boolean equals(Object obj) {
83      if (this == obj)
84         return true;
85      if (obj == null)
86         return false;
87      if (getClass() != obj.getClass())
88         return false;
89      Flavor other = (Flavor) obj;
90      if (id != other.id)
91         return false;
92      if (name == null) {
93         if (other.name != null)
94            return false;
95      } else if (!name.equals(other.name))
96         return false;
97      if (Float.floatToIntBits(price) != Float.floatToIntBits(other.price))
98         return false;
99      if (ram != other.ram)
100         return false;
101      return true;
102   }
103 
104   @Override
105   public String toString() {
106      return "[id=" + id + ", name=" + name + ", price=" + price + ", ram=" + ram + "]";
107   }
108 
109}

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