EMMA Coverage Report (generated Tue Jun 21 05:51:52 EDT 2011)
[all classes][org.jclouds.compute.domain.internal]

COVERAGE SUMMARY FOR SOURCE FILE [VolumeImpl.java]

nameclass, %method, %block, %line, %
VolumeImpl.java0%   (0/1)0%   (0/12)0%   (0/276)0%   (0/60)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class VolumeImpl0%   (0/1)0%   (0/12)0%   (0/276)0%   (0/60)
VolumeImpl (Float, String, boolean, boolean): void 0%   (0/1)0%   (0/9)0%   (0/2)
VolumeImpl (Float, boolean, boolean): void 0%   (0/1)0%   (0/9)0%   (0/2)
VolumeImpl (String, Volume$Type, Float, String, boolean, boolean): void 0%   (0/1)0%   (0/24)0%   (0/8)
equals (Object): boolean 0%   (0/1)0%   (0/99)0%   (0/32)
getDevice (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getId (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getSize (): Float 0%   (0/1)0%   (0/3)0%   (0/1)
getType (): Volume$Type 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/80)0%   (0/9)
isBootDevice (): boolean 0%   (0/1)0%   (0/3)0%   (0/1)
isDurable (): boolean 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/37)0%   (0/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.compute.domain.internal;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import javax.annotation.Nullable;
24 
25import org.jclouds.compute.domain.Volume;
26 
27/**
28 * @author Adrian Cole
29 */
30public class VolumeImpl implements Volume {
31   /** The serialVersionUID */
32   private static final long serialVersionUID = -3306004212804159093L;
33 
34   private final String id;
35   private final Volume.Type type;
36   private final @Nullable
37   Float size;
38   private final @Nullable
39   String device;
40   private final boolean bootDevice;
41   private final boolean durable;
42 
43   public VolumeImpl(@Nullable String id, Volume.Type type, @Nullable Float size, @Nullable String device,
44            boolean bootDevice, boolean durable) {
45      this.id = id;
46      this.type = checkNotNull(type, "type");
47      this.size = size;
48      this.device = device;
49      this.bootDevice = bootDevice;
50      this.durable = durable;
51   }
52 
53   public VolumeImpl(@Nullable Float size, boolean bootDevice, boolean durable) {
54      this(null, Volume.Type.LOCAL, size, null, bootDevice, durable);
55   }
56 
57   public VolumeImpl(@Nullable Float size, @Nullable String device, boolean bootDevice, boolean durable) {
58      this(null, Volume.Type.LOCAL, size, device, bootDevice, durable);
59   }
60 
61   /**
62    * {@inheritDoc}
63    */
64   @Override
65   public String getId() {
66      return id;
67   }
68 
69   /**
70    * {@inheritDoc}
71    */
72   @Override
73   public Volume.Type getType() {
74      return type;
75   }
76 
77   /**
78    * {@inheritDoc}
79    */
80   @Override
81   public Float getSize() {
82      return size;
83   }
84 
85   /**
86    * {@inheritDoc}
87    */
88   @Override
89   public String getDevice() {
90      return device;
91   }
92 
93   /**
94    * {@inheritDoc}
95    */
96   @Override
97   public boolean isDurable() {
98      return durable;
99   }
100 
101   /**
102    * {@inheritDoc}
103    */
104   @Override
105   public boolean isBootDevice() {
106      return bootDevice;
107   }
108 
109   /**
110    * {@inheritDoc}
111    */
112   @Override
113   public String toString() {
114      return "[id=" + getId() + ", type=" + type + ", size=" + size + ", device=" + device + ", durable=" + durable
115               + ", isBootDevice=" + bootDevice + "]";
116   }
117 
118   @Override
119   public int hashCode() {
120      final int prime = 31;
121      int result = 1;
122      result = prime * result + (bootDevice ? 1231 : 1237);
123      result = prime * result + ((device == null) ? 0 : device.hashCode());
124      result = prime * result + (durable ? 1231 : 1237);
125      result = prime * result + ((id == null) ? 0 : id.hashCode());
126      result = prime * result + ((size == null) ? 0 : size.hashCode());
127      result = prime * result + ((type == null) ? 0 : type.hashCode());
128      return result;
129   }
130 
131   @Override
132   public boolean equals(Object obj) {
133      if (this == obj)
134         return true;
135      if (obj == null)
136         return false;
137      if (getClass() != obj.getClass())
138         return false;
139      VolumeImpl other = (VolumeImpl) obj;
140      if (bootDevice != other.bootDevice)
141         return false;
142      if (device == null) {
143         if (other.device != null)
144            return false;
145      } else if (!device.equals(other.device))
146         return false;
147      if (durable != other.durable)
148         return false;
149      if (id == null) {
150         if (other.id != null)
151            return false;
152      } else if (!id.equals(other.id))
153         return false;
154      if (size == null) {
155         if (other.size != null)
156            return false;
157      } else if (!size.equals(other.size))
158         return false;
159      if (type == null) {
160         if (other.type != null)
161            return false;
162      } else if (!type.equals(other.type))
163         return false;
164      return true;
165   }
166 
167}

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