// Path: yet-another-storm-ui-server/src/main/java/com/deepnighttwo/yasu/util/UptimeUtil.java
// public class UptimeUtil {
// 
//     private static final Splitter SPLITTER = Splitter.on(Pattern.compile("[d|h|m|s]")).omitEmptyStrings().trimResults();
// 
//     public static int compareUptime(String uptime1, String uptime2) {
//         if (uptime1 == null && uptime2 == null) {
//             return 0;
//         }
// 
//         if (uptime1 == null) {
//             return -1;
//         }
// 
//         if (uptime2 == null) {
//             return 1;
//         }
// 
//         String[] parts1 = getUptimeStrings(uptime1);
//         String[] parts2 = getUptimeStrings(uptime2);
// 
//         if (parts1.length != parts2.length) {
//             return parts1.length - parts2.length;
//         }
// 
//         for (int i = 0; i < parts1.length; i++) {
//             int ret = Integer.parseInt(parts1[i]) - Integer.parseInt(parts2[i]);
//             if (ret != 0) {
//                 return ret;
//             }
//         }
// 
//         return 0;
//     }
// 
//     public static String[] getUptimeStrings(String uptime) {
//         Iterable<String> uptimeParts = SPLITTER.split(uptime);
// 
//         List<String> parts = new ArrayList<String>(4);
//         for (String part : uptimeParts) {
//             parts.add(part);
//         }
//         return parts.toArray(new String[parts.size()]);
//     }
// }


import com.deepnighttwo.yasu.util.UptimeUtil;
import java.util.List;
package com.deepnighttwo.yasu.model;



/**
 * User: mzang
 * Date: 2014-10-09
 * Time: 18:18
 */
public class SlotStatus implements Comparable<SlotStatus> {
    String host;
    String ip;
    int port;
    String uptime;

    List<ExecutorStatus> stats;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof SlotStatus)) return false;

        SlotStatus that = (SlotStatus) o;

        if (port != that.port) return false;
        if (host != null ? !host.equals(that.host) : that.host != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = host != null ? host.hashCode() : 0;
        result = 31 * result + port;
        return result;
    }

    public String getUptime() {
        return uptime;
    }

    public void setUptime(String uptime) {
        this.uptime = uptime;
    }

    public void updateUptime(String uptime) {
// Path: yet-another-storm-ui-server/src/main/java/com/deepnighttwo/yasu/util/UptimeUtil.java
// public class UptimeUtil {
// 
//     private static final Splitter SPLITTER = Splitter.on(Pattern.compile("[d|h|m|s]")).omitEmptyStrings().trimResults();
// 
//     public static int compareUptime(String uptime1, String uptime2) {
//         if (uptime1 == null && uptime2 == null) {
//             return 0;
//         }
// 
//         if (uptime1 == null) {
//             return -1;
//         }
// 
//         if (uptime2 == null) {
//             return 1;
//         }
// 
//         String[] parts1 = getUptimeStrings(uptime1);
//         String[] parts2 = getUptimeStrings(uptime2);
// 
//         if (parts1.length != parts2.length) {
//             return parts1.length - parts2.length;
//         }
// 
//         for (int i = 0; i < parts1.length; i++) {
//             int ret = Integer.parseInt(parts1[i]) - Integer.parseInt(parts2[i]);
//             if (ret != 0) {
//                 return ret;
//             }
//         }
// 
//         return 0;
//     }
// 
//     public static String[] getUptimeStrings(String uptime) {
//         Iterable<String> uptimeParts = SPLITTER.split(uptime);
// 
//         List<String> parts = new ArrayList<String>(4);
//         for (String part : uptimeParts) {
//             parts.add(part);
//         }
//         return parts.toArray(new String[parts.size()]);
//     }
// }


// Path: yet-another-storm-ui-server/src/main/java/com/deepnighttwo/yasu/model/SlotStatus.java
import com.deepnighttwo.yasu.util.UptimeUtil;
import java.util.List;

package com.deepnighttwo.yasu.model;



/**
 * User: mzang
 * Date: 2014-10-09
 * Time: 18:18
 */
public class SlotStatus implements Comparable<SlotStatus> {
    String host;
    String ip;
    int port;
    String uptime;

    List<ExecutorStatus> stats;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof SlotStatus)) return false;

        SlotStatus that = (SlotStatus) o;

        if (port != that.port) return false;
        if (host != null ? !host.equals(that.host) : that.host != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = host != null ? host.hashCode() : 0;
        result = 31 * result + port;
        return result;
    }

    public String getUptime() {
        return uptime;
    }

    public void setUptime(String uptime) {
        this.uptime = uptime;
    }

    public void updateUptime(String uptime) {
        if (UptimeUtil.compareUptime(this.uptime, uptime) < 0) {