FileDocCategorySizeDatePackage
Identity.javaAPI DocExample1316Sun Oct 31 16:37:06 GMT 1999dcj.util.Collaborative

Identity

public class Identity extends Object implements Serializable
Source code from "Java Distributed Computing", by Jim Farley. Class: Identity Example: 9-2 Description: Representation of an agent identity.

Fields Summary
Hashtable
props
Constructors Summary
public Identity(int id)


      props.put("id", new Integer(id)); 
Methods Summary
public booleanequals(java.lang.Object o)

    boolean same = false;
    if (o != null && o.getClass() == this.getClass()) {
      Identity oi = (Identity)o;
      if (oi == this ||
           (oi.getId() == this.getId() &&
             ((oi.getName() == null && this.getName() == null) ||
              (oi.getName() != null && this.getName() != null &&
               oi.getName().compareTo(this.getName()) == 0)))) {
        same = true;
      }
    }
    return same;
  
public intgetId()

    Integer idNum = (Integer)props.get("id");
    return idNum.intValue();
  
public java.lang.StringgetName()

 return (String)props.get("name"); 
public java.lang.ObjectgetProperty(java.lang.Object key)

    return props.get(key);
  
public voidsetName(java.lang.String n)

 props.put("name", n); 
public voidsetProperty(java.lang.Object key, java.lang.Object val)

    props.put(key, val);