EMMA Coverage Report (generated Wed Aug 10 12:30:04 EDT 2011)
[all classes][org.jclouds.deltacloud.domain]

COVERAGE SUMMARY FOR SOURCE FILE [RangeHardwareProperty.java]

nameclass, %method, %block, %line, %
RangeHardwareProperty.java100% (1/1)50%  (3/6)55%  (86/156)63%  (18.8/30)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RangeHardwareProperty100% (1/1)50%  (3/6)55%  (86/156)63%  (18.8/30)
getFirst (): Number 0%   (0/1)0%   (0/3)0%   (0/1)
getLast (): Number 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/42)0%   (0/1)
equals (Object): boolean 100% (1/1)67%  (37/55)56%  (10/18)
hashCode (): int 100% (1/1)88%  (29/33)96%  (4.8/5)
RangeHardwareProperty (String, String, Number, HardwareParameter, Number, Num... 100% (1/1)100% (20/20)100% (4/4)

1/**
2 *
3 * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
4 *
5 * ====================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * 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, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 * ====================================================================
18 */
19package org.jclouds.deltacloud.domain;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23/**
24 * 
25 * @author Adrian Cole
26 */
27public class RangeHardwareProperty extends ParameterizedHardwareProperty {
28 
29   private final Number first;
30   private final Number last;
31 
32   public RangeHardwareProperty(String name, String unit, Number value, HardwareParameter param, Number first,
33         Number last) {
34      super(Kind.FIXED, name, unit, value, param);
35      this.first = checkNotNull(first, "first");
36      this.last = checkNotNull(last, "last");
37   }
38 
39   /**
40    * 
41    * @return minimum value
42    */
43   public Number getFirst() {
44      return first;
45   }
46 
47   /**
48    * 
49    * @return maximum value
50    */
51   public Number getLast() {
52      return last;
53   }
54 
55   @Override
56   public String toString() {
57      return "[kind=" + getKind() + ", name=" + getName() + ", unit=" + getUnit() + ", value=" + getValue()
58            + ", param=" + getParam() + ", first=" + first + ", last=" + last + "]";
59   }
60 
61   @Override
62   public int hashCode() {
63      final int prime = 31;
64      int result = super.hashCode();
65      result = prime * result + ((first == null) ? 0 : first.hashCode());
66      result = prime * result + ((last == null) ? 0 : last.hashCode());
67      return result;
68   }
69 
70   @Override
71   public boolean equals(Object obj) {
72      if (this == obj)
73         return true;
74      if (!super.equals(obj))
75         return false;
76      if (getClass() != obj.getClass())
77         return false;
78      RangeHardwareProperty other = (RangeHardwareProperty) obj;
79      if (first == null) {
80         if (other.first != null)
81            return false;
82      } else if (!first.equals(other.first))
83         return false;
84      if (last == null) {
85         if (other.last != null)
86            return false;
87      } else if (!last.equals(other.last))
88         return false;
89      return true;
90   }
91}

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