package kr.ac.kaist.ds.groupd.groupname.impl;

import kr.ac.kaist.ds.groupd.groupname.GroupName;

public class StaticGroupName implements GroupName<String> {

	private String macAddress;
	private Long timestamp;

	public StaticGroupName(String macAddress, Long timestamp) {
		this.macAddress = macAddress;
		this.timestamp = timestamp;
	}

	@Override
	public String getName() {
		return macAddress + timestamp;
	}

    @Override
    public int hashCode() {
        //2^5-1
        final int prime = 31;
        int result = 1;
        result = prime * result + ((macAddress == null) ? 0 : macAddress.hashCode());
        result = prime * result + ((timestamp == null) ? 0 : timestamp.hashCode());
        return result;
    }

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

	
}

@@ -475,25 +475,8 @@
  %7B%0D%0A
-        //2%5E5-1%0D%0A
     
@@ -1440,16 +1440,154 @@
 %0D%0A    %7D%0D
+%0A    %0D%0A    @Override%0D%0A    public String toString() %7B%0D%0A        return %22StaticGroupName %5BgroupName=%22 + macAddress + timestamp + %22%5D%22;%0D%0A    %7D%0D
 %0A%0D%0A%09%0D%0A%7D%0D

add toString Method (staticGroupClass)