EMMA Coverage Report (generated Mon Dec 09 15:12:29 EST 2013)
[all classes][org.jclouds.glesys.domain]

COVERAGE SUMMARY FOR SOURCE FILE [ResourceUsageValue.java]

nameclass, %method, %block, %line, %
ResourceUsageValue.java75%  (3/4)76%  (13/17)81%  (112/139)80%  (19.3/24)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ResourceUsageValue$10%   (0/1)100% (0/0)100% (0/0)100% (0/0)
     
class ResourceUsageValue$Builder100% (1/1)80%  (4/5)76%  (26/34)86%  (6/7)
fromResourceUsage (ResourceUsageValue): ResourceUsageValue$Builder 0%   (0/1)0%   (0/8)0%   (0/1)
ResourceUsageValue$Builder (): void 100% (1/1)100% (3/3)100% (1/1)
build (): ResourceUsageValue 100% (1/1)100% (8/8)100% (1/1)
timestamp (Date): ResourceUsageValue$Builder 100% (1/1)100% (9/9)100% (2/2)
value (double): ResourceUsageValue$Builder 100% (1/1)100% (6/6)100% (2/2)
     
class ResourceUsageValue100% (1/1)67%  (6/9)80%  (78/97)75%  (11.3/15)
getTimestamp (): Date 0%   (0/1)0%   (0/3)0%   (0/1)
getValue (): double 0%   (0/1)0%   (0/3)0%   (0/1)
toBuilder (): ResourceUsageValue$Builder 0%   (0/1)0%   (0/7)0%   (0/1)
equals (Object): boolean 100% (1/1)84%  (31/37)82%  (3.3/4)
ResourceUsageValue (double, Date): void 100% (1/1)100% (12/12)100% (4/4)
builder (): ResourceUsageValue$Builder 100% (1/1)100% (5/5)100% (1/1)
hashCode (): int 100% (1/1)100% (15/15)100% (1/1)
string (): Objects$ToStringHelper 100% (1/1)100% (11/11)100% (1/1)
toString (): String 100% (1/1)100% (4/4)100% (1/1)
     
class ResourceUsageValue$ConcreteBuilder100% (1/1)100% (3/3)100% (8/8)100% (2/2)
ResourceUsageValue$ConcreteBuilder (): void 100% (1/1)100% (3/3)100% (1/1)
ResourceUsageValue$ConcreteBuilder (ResourceUsageValue$1): void 100% (1/1)100% (3/3)100% (1/1)
self (): ResourceUsageValue$ConcreteBuilder 100% (1/1)100% (2/2)100% (1/1)

1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17package org.jclouds.glesys.domain;
18 
19import static com.google.common.base.Preconditions.checkNotNull;
20 
21import java.beans.ConstructorProperties;
22import java.util.Date;
23 
24import com.google.common.base.Objects;
25import com.google.common.base.Objects.ToStringHelper;
26 
27/**
28 * Detailed information on usage
29 *
30 * @author Adam Lowe
31 * @see org.jclouds.glesys.domain.ServerStatus
32 */
33public class ResourceUsageValue {
34 
35   public static Builder<?> builder() {
36      return new ConcreteBuilder();
37   }
38 
39   public Builder<?> toBuilder() {
40      return new ConcreteBuilder().fromResourceUsage(this);
41   }
42 
43   public abstract static class Builder<T extends Builder<T>> {
44      protected abstract T self();
45 
46      protected double value;
47      protected Date timestamp;
48 
49 
50      /**
51       * @see ResourceUsageValue#getValue()
52       */
53      public T value(double value) {
54         this.value = value;
55         return self();
56      }
57 
58      /**
59       * @see ResourceUsageValue#getTimestamp()
60       */
61      public T timestamp(Date timestamp) {
62         this.timestamp = checkNotNull(timestamp, "timestamp");
63         return self();
64      }
65 
66      public ResourceUsageValue build() {
67         return new ResourceUsageValue(value, timestamp);
68      }
69 
70      public T fromResourceUsage(ResourceUsageValue in) {
71         return this
72               .value(in.getValue())
73               .timestamp(in.getTimestamp());
74      }
75   }
76 
77   private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
78      @Override
79      protected ConcreteBuilder self() {
80         return this;
81      }
82   }
83 
84   private final double value;
85   private final Date timestamp;
86 
87   @ConstructorProperties({
88         "value", "timestamp"
89   })
90   protected ResourceUsageValue(double value, Date timestamp) {
91      this.value = value;
92      this.timestamp = checkNotNull(timestamp, "timestamp");
93   }
94 
95   public double getValue() {
96      return this.value;
97   }
98 
99   public Date getTimestamp() {
100      return this.timestamp;
101   }
102 
103   @Override
104   public int hashCode() {
105      return Objects.hashCode(value, timestamp);
106   }
107 
108   @Override
109   public boolean equals(Object obj) {
110      if (this == obj) return true;
111      if (obj == null || getClass() != obj.getClass()) return false;
112      ResourceUsageValue that = ResourceUsageValue.class.cast(obj);
113      return Objects.equal(this.value, that.value)
114            && Objects.equal(this.timestamp, that.timestamp);
115   }
116 
117   protected ToStringHelper string() {
118      return Objects.toStringHelper("").add("value", value).add("timestamp", timestamp);
119   }
120 
121   @Override
122   public String toString() {
123      return string().toString();
124   }
125 
126}

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