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

COVERAGE SUMMARY FOR SOURCE FILE [SCSIDevice.java]

nameclass, %method, %block, %line, %
SCSIDevice.java0%   (0/2)0%   (0/9)0%   (0/135)0%   (0/30)

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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