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

COVERAGE SUMMARY FOR SOURCE FILE [IpAddress.java]

nameclass, %method, %block, %line, %
IpAddress.java100% (2/2)53%  (8/15)65%  (155/237)56%  (25.8/46)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class IpAddress100% (1/1)38%  (3/8)58%  (98/168)58%  (22.8/39)
compareTo (IpAddress): int 0%   (0/1)0%   (0/11)0%   (0/1)
getAddress (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getServer (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getStatus (): IpAddress$Status 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/22)0%   (0/1)
equals (Object): boolean 100% (1/1)65%  (45/69)52%  (12/23)
hashCode (): int 100% (1/1)91%  (41/45)96%  (5.8/6)
IpAddress (String, IpAddress$Status, String): void 100% (1/1)100% (12/12)100% (5/5)
     
class IpAddress$Status100% (1/1)71%  (5/7)83%  (57/69)43%  (3/7)
toString (): String 0%   (0/1)0%   (0/3)0%   (0/1)
value (): String 0%   (0/1)0%   (0/6)0%   (0/1)
fromValue (String): IpAddress$Status 100% (1/1)75%  (9/12)33%  (1/3)
<static initializer> 100% (1/1)100% (34/34)100% (2/2)
IpAddress$Status (String, int): void 100% (1/1)100% (5/5)100% (1/1)
valueOf (String): IpAddress$Status 100% (1/1)100% (5/5)100% (1/1)
values (): IpAddress$Status [] 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.trmk.vcloud_0_8.domain;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import org.jclouds.javax.annotation.Nullable;
24 
25import com.google.common.base.CaseFormat;
26 
27/**
28 * @author Adrian Cole
29 */
30public class IpAddress implements Comparable<IpAddress> {
31 
32   public static enum Status {
33      AVAILABLE, ASSIGNED, UNRECOGNIZED;
34      public String value() {
35         return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
36      }
37 
38      @Override
39      public String toString() {
40         return value();
41      }
42 
43      public static Status fromValue(String status) {
44         try {
45            return valueOf(CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, checkNotNull(status, "status")));
46         } catch (IllegalArgumentException e) {
47            return UNRECOGNIZED;
48         }
49      }
50 
51   }
52 
53   private final String address;
54   private final Status status;
55   @Nullable
56   private final String server;
57 
58   public IpAddress(String address, Status status, String server) {
59      this.address = address;
60      this.status = status;
61      this.server = server;
62   }
63 
64   public String getAddress() {
65      return address;
66   }
67 
68   public Status getStatus() {
69      return status;
70   }
71 
72   public String getServer() {
73      return server;
74   }
75 
76   @Override
77   public String toString() {
78      return "IpAddress [address=" + address + ", server=" + server + ", status=" + status + "]";
79   }
80 
81   @Override
82   public int compareTo(IpAddress o) {
83      return (this == o) ? 0 : getAddress().compareTo(o.getAddress());
84   }
85 
86   @Override
87   public int hashCode() {
88      final int prime = 31;
89      int result = 1;
90      result = prime * result + ((address == null) ? 0 : address.hashCode());
91      result = prime * result + ((server == null) ? 0 : server.hashCode());
92      result = prime * result + ((status == null) ? 0 : status.hashCode());
93      return result;
94   }
95 
96   @Override
97   public boolean equals(Object obj) {
98      if (this == obj)
99         return true;
100      if (obj == null)
101         return false;
102      if (getClass() != obj.getClass())
103         return false;
104      IpAddress other = (IpAddress) obj;
105      if (address == null) {
106         if (other.address != null)
107            return false;
108      } else if (!address.equals(other.address))
109         return false;
110      if (server == null) {
111         if (other.server != null)
112            return false;
113      } else if (!server.equals(other.server))
114         return false;
115      if (status == null) {
116         if (other.status != null)
117            return false;
118      } else if (!status.equals(other.status))
119         return false;
120      return true;
121   }
122 
123}

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