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

COVERAGE SUMMARY FOR SOURCE FILE [PlacementGroup.java]

nameclass, %method, %block, %line, %
PlacementGroup.java100% (2/2)50%  (8/16)68%  (203/300)53%  (28.6/54)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PlacementGroup100% (1/1)33%  (3/9)60%  (128/215)54%  (25.6/47)
compareTo (PlacementGroup): int 0%   (0/1)0%   (0/6)0%   (0/1)
getName (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getRegion (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getState (): PlacementGroup$State 0%   (0/1)0%   (0/3)0%   (0/1)
getStrategy (): String 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/27)0%   (0/1)
equals (Object): boolean 100% (1/1)60%  (51/85)46%  (13/28)
hashCode (): int 100% (1/1)86%  (50/58)94%  (6.6/7)
PlacementGroup (String, String, String, PlacementGroup$State): void 100% (1/1)100% (27/27)100% (6/6)
     
class PlacementGroup$State100% (1/1)71%  (5/7)88%  (75/85)43%  (3/7)
toString (): String 0%   (0/1)0%   (0/3)0%   (0/1)
value (): String 0%   (0/1)0%   (0/4)0%   (0/1)
fromValue (String): PlacementGroup$State 100% (1/1)70%  (7/10)33%  (1/3)
<static initializer> 100% (1/1)100% (54/54)100% (2/2)
PlacementGroup$State (String, int): void 100% (1/1)100% (5/5)100% (1/1)
valueOf (String): PlacementGroup$State 100% (1/1)100% (5/5)100% (1/1)
values (): PlacementGroup$State [] 100% (1/1)100% (4/4)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.aws.ec2.domain;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23/**
24 * A placement group is a logical grouping of instances.
25 * 
26 * <p/>
27 * You first create a cluster placement group, then launch multiple cluster compute instances into
28 * the group. Currently cluster compute instances are available only in the US-East (Northern
29 * Virginia) Region. You must give each placement group a name that is unique within your account.
30 * For more information about cluster placement groups, see Cluster Compute Instance Concepts.
31 * <p/>
32 * Note
33 * <p/>
34 * You can't merge cluster placement groups. Instead you must terminate the instances in one of the
35 * groups, and then relaunch the instances into the other group.
36 * 
37 * @see <a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribePlacementGroups.html"
38 *      />
39 * @author Adrian Cole
40 */
41public class PlacementGroup implements Comparable<PlacementGroup> {
42   public static enum State {
43      PENDING, AVAILABLE, DELETING, DELETED, UNRECOGNIZED;
44      public String value() {
45         return name().toLowerCase();
46      }
47 
48      @Override
49      public String toString() {
50         return value();
51      }
52 
53      public static State fromValue(String state) {
54         try {
55            return valueOf(checkNotNull(state, "state").toUpperCase());
56         } catch (IllegalArgumentException e) {
57            return UNRECOGNIZED;
58         }
59      }
60   }
61 
62   private final String region;
63   private final String name;
64   private final String strategy;
65   private final State state;
66 
67   public PlacementGroup(String region, String name, String strategy, State state) {
68      this.region = checkNotNull(region, "region");
69      this.name = checkNotNull(name, "name");
70      this.strategy = checkNotNull(strategy, "strategy");
71      this.state = checkNotNull(state, "state");
72   }
73 
74   @Override
75   public int compareTo(PlacementGroup o) {
76      return name.compareTo(o.name);
77   }
78 
79   /**
80    * @return placement groups are in a region, however the namescope is global.
81    */
82   public String getRegion() {
83      return region;
84   }
85 
86   /**
87    * @return Name of the placement group.
88    */
89   public String getName() {
90      return name;
91   }
92 
93   /**
94    * @return The placement strategy.
95    */
96   public String getStrategy() {
97      return strategy;
98   }
99 
100   /**
101    * @return Status of the placement group.
102    */
103   public State getState() {
104      return state;
105   }
106 
107   @Override
108   public int hashCode() {
109      final int prime = 31;
110      int result = 1;
111      result = prime * result + ((name == null) ? 0 : name.hashCode());
112      result = prime * result + ((region == null) ? 0 : region.hashCode());
113      result = prime * result + ((state == null) ? 0 : state.hashCode());
114      result = prime * result + ((strategy == null) ? 0 : strategy.hashCode());
115      return result;
116   }
117 
118   @Override
119   public boolean equals(Object obj) {
120      if (this == obj)
121         return true;
122      if (obj == null)
123         return false;
124      if (getClass() != obj.getClass())
125         return false;
126      PlacementGroup other = (PlacementGroup) obj;
127      if (name == null) {
128         if (other.name != null)
129            return false;
130      } else if (!name.equals(other.name))
131         return false;
132      if (region == null) {
133         if (other.region != null)
134            return false;
135      } else if (!region.equals(other.region))
136         return false;
137      if (state == null) {
138         if (other.state != null)
139            return false;
140      } else if (!state.equals(other.state))
141         return false;
142      if (strategy == null) {
143         if (other.strategy != null)
144            return false;
145      } else if (!strategy.equals(other.strategy))
146         return false;
147      return true;
148   }
149 
150   @Override
151   public String toString() {
152      return "[name=" + name + ", region=" + region + ", state=" + state + ", strategy=" + strategy + "]";
153   }
154 
155}

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