/** * PIMEntity abstract class definition * * All PIMEntitys have: * priority (a string) * owner (a string) * shared (a boolean) */ import java.io.*; public abstract class PIMEntity implements Serializable { int id; String Priority; // every kind of item has a priority String Owner; // every item has an owner boolean Shared; // is this a public or private item? /** default constructor sets priority to "Normal" * owner to "Nobody" * and share to true (the default is that the item is public) */ PIMEntity() { id=0; // 0 is "unset" Priority = "Normal"; Owner = "Nobody"; Shared = true; } /** can specify the priority, owner and sharing * */ PIMEntity(String priority, String owner, boolean shared) { id = 0; Priority = priority; Owner = owner; Shared = shared; } /** * set the id field */ public void setId(int _id) { id = _id; } /** * get the id */ public int getId() { return id; } /** * returns the current priority string */ public String getPriority() { return Priority; } // method that changes the priority string public void setPriority(String p) { Priority = p; } /** accessor function for getting the owner */ public String getOwner() { return Owner; } /** method that changes the owner */ public void setOwner(String owner) { Owner = owner; } /** accessor function for getting the sharing flag */ public boolean getShared() { return Shared; } /** set sharing policy for this item * true means the item is public. (false - it is not shared) */ public void setShared(boolean shared) { Shared = shared; } /** * Base class toString returns information common to * all PIMEntitys formatted for printing. * (this is called by derived class toString methods) */ public String toString() { return "Priority: " + Priority + "\n" + "Id: " + id + "\n" + "Owner: " + Owner + "\n" + "Shared: " + (Shared?"Yes":"No") + "\n"; } }