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

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