EMMA Coverage Report (generated Wed Oct 26 13:47:17 EDT 2011)
[all classes][org.jclouds.compute.domain.internal]

COVERAGE SUMMARY FOR SOURCE FILE [TemplateImpl.java]

nameclass, %method, %block, %line, %
TemplateImpl.java100% (1/1)33%  (3/9)15%  (33/221)17%  (8/47)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TemplateImpl100% (1/1)33%  (3/9)15%  (33/221)17%  (8/47)
clone (): Object 0%   (0/1)0%   (0/12)0%   (0/1)
equals (Object): boolean 0%   (0/1)0%   (0/85)0%   (0/28)
getHardware (): Hardware 0%   (0/1)0%   (0/3)0%   (0/1)
getOptions (): TemplateOptions 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/58)0%   (0/7)
toString (): String 0%   (0/1)0%   (0/27)0%   (0/1)
TemplateImpl (Image, Hardware, Location, TemplateOptions): void 100% (1/1)100% (27/27)100% (6/6)
getImage (): Image 100% (1/1)100% (3/3)100% (1/1)
getLocation (): Location 100% (1/1)100% (3/3)100% (1/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.compute.domain.Image;
24import org.jclouds.compute.domain.Hardware;
25import org.jclouds.compute.domain.Template;
26import org.jclouds.compute.options.TemplateOptions;
27import org.jclouds.domain.Location;
28 
29/**
30 * 
31 * @author Adrian Cole
32 */
33public class TemplateImpl implements Template {
34 
35   private final Image image;
36   private final Hardware size;
37   private final Location location;
38   private final TemplateOptions options;
39 
40   public TemplateImpl(Image image, Hardware size, Location location, TemplateOptions options) {
41      this.image = checkNotNull(image, "image");
42      this.size = checkNotNull(size, "size");
43      this.location = checkNotNull(location, "location");
44      this.options = checkNotNull(options, "options");
45   }
46 
47   /**
48    * {@inheritDoc}
49    */
50   @Override
51   public Image getImage() {
52      return image;
53   }
54 
55   /**
56    * {@inheritDoc}
57    */
58   @Override
59   public Hardware getHardware() {
60      return size;
61   }
62 
63   /**
64    * {@inheritDoc}
65    */
66   @Override
67   public Location getLocation() {
68      return location;
69   }
70 
71   /**
72    * {@inheritDoc}
73    */
74   @Override
75   public TemplateOptions getOptions() {
76      return options;
77   }
78 
79   @Override
80   public int hashCode() {
81      final int prime = 31;
82      int result = 1;
83      result = prime * result + ((image == null) ? 0 : image.hashCode());
84      result = prime * result + ((location == null) ? 0 : location.hashCode());
85      result = prime * result + ((options == null) ? 0 : options.hashCode());
86      result = prime * result + ((size == null) ? 0 : size.hashCode());
87      return result;
88   }
89 
90   @Override
91   public boolean equals(Object obj) {
92      if (this == obj)
93         return true;
94      if (obj == null)
95         return false;
96      if (getClass() != obj.getClass())
97         return false;
98      TemplateImpl other = (TemplateImpl) obj;
99      if (image == null) {
100         if (other.image != null)
101            return false;
102      } else if (!image.equals(other.image))
103         return false;
104      if (location == null) {
105         if (other.location != null)
106            return false;
107      } else if (!location.equals(other.location))
108         return false;
109      if (options == null) {
110         if (other.options != null)
111            return false;
112      } else if (!options.equals(other.options))
113         return false;
114      if (size == null) {
115         if (other.size != null)
116            return false;
117      } else if (!size.equals(other.size))
118         return false;
119      return true;
120   }
121 
122   @Override
123   public String toString() {
124      return "[location=" + location + ", image=" + image + ", size=" + size + ", options="
125               + options + "]";
126   }
127 
128   /**
129    * {@inheritDoc}
130    */
131   @Override
132   protected Object clone() throws CloneNotSupportedException {
133      return new TemplateImpl(image, size, location, options);
134   }
135 
136}

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