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

COVERAGE SUMMARY FOR SOURCE FILE [IDEDevice.java]

nameclass, %method, %block, %line, %
IDEDevice.java100% (2/2)67%  (6/9)70%  (106/152)74%  (23.5/32)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class IDEDevice100% (1/1)57%  (4/7)65%  (85/131)69%  (18.5/27)
getBus (): int 0%   (0/1)0%   (0/3)0%   (0/1)
getUnit (): int 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/22)0%   (0/1)
equals (Object): boolean 100% (1/1)71%  (25/35)58%  (7/12)
IDEDevice (String, MediaType, int, int): void 100% (1/1)74%  (23/31)92%  (5.5/6)
getId (): String 100% (1/1)100% (17/17)100% (1/1)
hashCode (): int 100% (1/1)100% (20/20)100% (5/5)
     
class IDEDevice$Builder100% (1/1)100% (2/2)100% (21/21)100% (5/5)
IDEDevice$Builder (int, int): void 100% (1/1)100% (9/9)100% (4/4)
build (): Device 100% (1/1)100% (12/12)100% (1/1)

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.cloudsigma.domain;
20 
21import static com.google.common.base.Preconditions.checkArgument;
22 
23/**
24 * 
25 * @author Adrian Cole
26 */
27public class IDEDevice extends Device {
28   public static class Builder extends Device.Builder {
29      private final int bus;
30      private final int unit;
31 
32      public Builder(int bus, int unit) {
33         this.bus = bus;
34         this.unit = unit;
35      }
36 
37      @Override
38      public Device build() {
39         return new IDEDevice(uuid, mediaType, bus, unit);
40      }
41 
42   }
43 
44   private final int bus;
45   private final int unit;
46 
47   public IDEDevice(String driveUuid, MediaType mediaType, int bus, int unit) {
48      super(driveUuid, mediaType);
49      checkArgument(bus == 0 || bus == 1, "bus must be 0 or 1");
50      checkArgument(unit == 0 || unit == 1, "unit must be 0 or 1");
51      this.bus = bus;
52      this.unit = unit;
53   }
54 
55   @Override
56   public int hashCode() {
57      final int prime = 31;
58      int result = 1;
59      result = prime * result + bus;
60      result = prime * result + unit;
61      return result;
62   }
63 
64   @Override
65   public boolean equals(Object obj) {
66      if (this == obj)
67         return true;
68      if (obj == null)
69         return false;
70      if (getClass() != obj.getClass())
71         return false;
72      IDEDevice other = (IDEDevice) obj;
73      if (bus != other.bus)
74         return false;
75      if (unit != other.unit)
76         return false;
77      return true;
78   }
79 
80   @Override
81   public String getId() {
82      return String.format("ide:%d:%d", bus, unit);
83   }
84 
85   public int getBus() {
86      return bus;
87   }
88 
89   public int getUnit() {
90      return unit;
91   }
92 
93   @Override
94   public String toString() {
95      return "[id=" + getId() + ", driveUuid=" + driveUuid + ", mediaType=" + mediaType + "]";
96   }
97}

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