package org.kne.cloud.network.ipv6;

import java.util.UUID;
import java.util.concurrent.atomic.AtomicLong;

public class PacketID {
	private UUID flowuuid;
	private long sequence;
	
	public PacketID(UUID flowuuid, long sequence) {
		super();
		this.flowuuid = flowuuid;
		this.sequence = sequence;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		long value = flowuuid.getMostSignificantBits() ^ flowuuid.getLeastSignificantBits();
		result = prime * result + (int)(value ^ (value >>> 32));
		result = prime * result + (int) (sequence ^ (sequence >>> 32));
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PacketID other = (PacketID) obj;
		if (flowuuid == null) {
			if (other.flowuuid != null)
				return false;
		} else if (!flowuuid.equals(other.flowuuid))
			return false;
		if (sequence != other.sequence)
			return false;
		return true;
	}
	@Override
	public String toString() {
		return "PacketID [flowuuid=" + flowuuid + ", sequence=" + sequence + "]";
	}
	public UUID getFlowuuid() {
		return flowuuid;
	}
	public long getSequence() {
		return sequence;
	}
	
}
