EMMA Coverage Report (generated Fri Apr 27 15:03:37 EDT 2012)
[all classes][org.jclouds.ec2.domain]

COVERAGE SUMMARY FOR SOURCE FILE [InstanceState.java]

nameclass, %method, %block, %line, %
InstanceState.java100% (1/1)62%  (5/8)78%  (97/125)40%  (8/20)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class InstanceState100% (1/1)62%  (5/8)78%  (97/125)40%  (8/20)
fromValue (int): InstanceState 0%   (0/1)0%   (0/16)0%   (0/8)
toString (): String 0%   (0/1)0%   (0/3)0%   (0/1)
value (): String 0%   (0/1)0%   (0/6)0%   (0/1)
fromValue (String): InstanceState 100% (1/1)75%  (9/12)33%  (1/3)
<static initializer> 100% (1/1)100% (74/74)100% (7/7)
InstanceState (String, int): void 100% (1/1)100% (5/5)100% (1/1)
valueOf (String): InstanceState 100% (1/1)100% (5/5)100% (1/1)
values (): InstanceState [] 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.ec2.domain;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import org.jclouds.ec2.EC2AsyncClient;
24 
25import com.google.common.base.CaseFormat;
26 
27/**
28 * 
29 * The current state of the instance..
30 * 
31 * @author Adrian Cole
32 * @see EC2AsyncClient#describeInstances
33 * @see EC2AsyncClient#runInstances
34 * @see EC2AsyncClient#terminateInstances
35 * 
36 */
37public enum InstanceState {
38 
39   /**
40    * the instance is in the process of being launched
41    */
42   PENDING,
43 
44   /**
45    * the instance launched (although the boot process might not be completed)
46    */
47   RUNNING,
48 
49   /**
50    * the instance started shutting down
51    */
52   SHUTTING_DOWN,
53   /**
54    * the instance terminated
55    */
56   TERMINATED,
57   /**
58    * the instance is stopping
59    */
60   STOPPING,
61   /**
62    * the instance is stopped
63    */
64   STOPPED, UNRECOGNIZED;
65 
66   public String value() {
67      return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name()));
68   }
69 
70   @Override
71   public String toString() {
72      return value();
73   }
74 
75   public static InstanceState fromValue(String state) {
76      try {
77         return valueOf(CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(state, "state")));
78      } catch (IllegalArgumentException e) {
79         return UNRECOGNIZED;
80      }
81   }
82 
83   public static InstanceState fromValue(int v) {
84      switch (v) {
85         case 0:
86            return PENDING;
87         case 16:
88            return RUNNING;
89         case 32:
90            return SHUTTING_DOWN;
91         case 48:
92            return TERMINATED;
93         case 64:
94            return STOPPING;
95         case 80:
96            return STOPPED;
97         default:
98            return UNRECOGNIZED;
99      }
100   }
101}

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