// Carnegie Mellon University
//   Information Networking Institute and
//   School of Computer Science
//
// Master Thesis: A Monitoring Tool for Overlay Network
// By: TungFai Chan and Annie Cheng
//
// File: OverlayHost.java
// Path: eventbase
// Description: HostClass

package eventbase;

public class OverlayHost {

  final String OBJECT_NAME = "OverlayHost";
  private int ID;
  private int Address = -1;
  private String Name = "";

  public OverlayHost (int hostID) {
    this.ID = hostID;
  }

  public OverlayHost(int hostID, String hostName) {
    this.ID = hostID;
    this.Address = -1;
    this.Name = hostName.trim();
  }

  public OverlayHost(int hostID, int hostAddr, String hostName) {
    this.ID = hostID;
    this.Address = hostAddr;
    this.Name = hostName.trim();
  }

  public boolean equals(OverlayHost a) {
    return (this.getID() == a.getID());
  }

  public int getID() {
    return ID;
  }

  public int getAddr() {
    return Address;
  }

  public String getName() {
    return Name;
  }
  // note, this may change if the code changes
  // String is not newed here, so we don't count that in our size
  public static int getMemorySize() {
    return 4 + 4 + 4; // ID.size() + Addr.size() + string pointer
  }
}