package com.timgroup.tucker.info;

public final class Report {
    
    private static final Object NO_VALUE = new Object();
    
    public static Status worstStatus(Iterable<Report> reports) {
        Status worst = Status.OK;
        for (Report report : reports) {
            worst = worst.or(report.getStatus());
        }
        return worst;
    }
    
    private final Status status;
    private final Object value;
    
    public Report(Status status, Object value) {
        this.status = status;
        this.value = (value == null) ? NO_VALUE : value;
    }
    
    public Report(Status status) {
        this(status, NO_VALUE);
    }
    
    public Report(Throwable e) {
        this(Status.CRITICAL, e);
    }
    
    public Status getStatus() {
        return status;
    }
    
    public boolean hasValue() {
        return value != NO_VALUE;
    }
    
    public boolean isSuccessful() {
        return !(value instanceof Throwable);
    }
    
    public Object getValue() {
        return value;
    }
    
    public Throwable getException() {
        return (Throwable) value;
    }

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((status == null) ? 0 : status.hashCode());
		result = prime * result + ((value == null) ? 0 : value.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Report other = (Report) obj;
		if (status != other.status)
			return false;
		if (value == null) {
			if (other.value != null)
				return false;
		} else if (!value.equals(other.value))
			return false;
		return true;
	}

    @Override
    public String toString() {
        return "Report [status=" + status + ", value=" + value + "]";
    }
}

@@ -1107,17 +1107,20 @@
 %0A    %7D%0A%0A
-%09
+    
 @Overrid
@@ -1117,25 +1117,28 @@
   @Override%0A
-%09
+    
 public int h
@@ -1149,18 +1149,24 @@
 ode() %7B%0A
-%09%09
+        
 final in
@@ -1179,18 +1179,24 @@
 e = 31;%0A
-%09%09
+        
 int resu
@@ -1203,18 +1203,24 @@
 lt = 1;%0A
-%09%09
+        
 result =
@@ -1281,18 +1281,24 @@
 ode());%0A
-%09%09
+        
 result =
@@ -1357,18 +1357,24 @@
 ode());%0A
-%09%09
+        
 return r
@@ -1384,13 +1384,19 @@
 lt;%0A
-%09%7D%0A%0A%09
+    %7D%0A%0A    
 @Ove
@@ -1401,17 +1401,20 @@
 verride%0A
-%09
+    
 public b
@@ -1441,18 +1441,24 @@
  obj) %7B%0A
-%09%09
+        
 if (this
@@ -1466,19 +1466,28 @@
 == obj)%0A
-%09%09%09
+            
 return t
@@ -1491,18 +1491,24 @@
 n true;%0A
-%09%09
+        
 if (obj 
@@ -1516,19 +1516,28 @@
 = null)%0A
-%09%09%09
+            
 return f
@@ -1538,26 +1538,32 @@
 turn false;%0A
-%09%09
+        
 if (getClass
@@ -1584,19 +1584,28 @@
 lass())%0A
-%09%09%09
+            
 return f
@@ -1610,18 +1610,24 @@
  false;%0A
-%09%09
+        
 Report o
@@ -1647,18 +1647,24 @@
 t) obj;%0A
-%09%09
+        
 if (stat
@@ -1683,19 +1683,28 @@
 status)%0A
-%09%09%09
+            
 return f
@@ -1709,18 +1709,24 @@
  false;%0A
-%09%09
+        
 if (valu
@@ -1738,19 +1738,28 @@
 null) %7B%0A
-%09%09%09
+            
 if (othe
@@ -1779,12 +1779,24 @@
 ll)%0A
-%09%09%09%09
+                
 retu
@@ -1805,18 +1805,24 @@
  false;%0A
-%09%09
+        
 %7D else i
@@ -1856,11 +1856,20 @@
 e))%0A
-%09%09%09
+            
 retu
@@ -1882,10 +1882,16 @@
 se;%0A
-%09%09
+        
 retu
@@ -1903,9 +1903,12 @@
 ue;%0A
-%09
+    
 %7D%0A%0A 

replace tabs with spaces