Methods Summary |
---|
public void | addChild(ProblemDomain.Individual p)
if (this.children == null) children = new Vector(1);
this.children.addElement(p);
// link from other end
p.linkAsChild(this);
|
public void | addNote(ProblemDomain.Note comments)
if (this.notes == null) notes = new Vector(1);
notes.addElement(comments); return;
|
public void | delete()
// Remove from hash table
Family.All.remove(new Integer(this.getReference()));
|
public java.util.Vector | getAncestors(int spaces)
Vector storage = null;
Vector temp;
Enumeration list;
Family family;
String name;
String gap = new String();
for(int i=0;i<spaces;i++) gap = gap + " ";
if(spaces == 0) {
if(storage == null) storage = new Vector();
storage.addElement("Fathers Side:\n");
}
if(getHusband() != null) {
if(storage == null) storage = new Vector();
name = gap + getHusband().getName();
if(getHusband().getName().equals("null null")) name = gap + "Unknown";
storage.addElement(name);
if(getHusband().getChildOf() != null) {
temp = getHusband().getChildOf().getAncestors(spaces+1);
if(temp != null) {
list = temp.elements();
while(list.hasMoreElements()) {
storage.addElement(list.nextElement());
}
}
}
}
if(spaces == 0) {
if(storage == null) storage = new Vector();
storage.addElement("\n\nMothers Side:\n");
}
if(getWife() != null) {
if(storage == null) storage = new Vector();
name = gap + getWife().getName();
if(getWife().getName().equals("null null")) name = gap + "Unknown";
storage.addElement(name);
if(getWife().getChildOf() != null) {
temp = getWife().getChildOf().getAncestors(spaces+1);
if(temp != null) {
list = temp.elements();
while(list.hasMoreElements()) {
storage.addElement(list.nextElement());
}
}
}
}
return storage;
|
public java.util.Enumeration | getChildren()
return this.children.elements();
|
public java.util.Vector | getDescendants(java.lang.String parentsName, int spaces, boolean showSpouse)
Enumeration kids;
Enumeration subkids;
Individual person;
Individual child;
Vector descendantList = null;
Vector subList = null;
String individualsName = new String();
String childsName = new String();
String gaps = new String();
for(int i=0;i<spaces;i++) {
gaps = gaps + " ";
}
if(children != null) {
kids = getChildren();
while(kids.hasMoreElements()) {
if(descendantList == null) descendantList = new Vector();
person = (Individual)kids.nextElement();
individualsName = gaps + person.getGivenNames() + " " + person.getFamilyName();
if(showSpouse) {
individualsName = individualsName + " = " + parentsName;
}
descendantList.addElement(individualsName);
if(person.isParent()) {
subkids = person.getSpouseInList();
if(subkids != null)
{
while(subkids.hasMoreElements()) {
if(subList == null) subList = new Vector();
subList = ((Family)subkids.nextElement()).getDescendants(person.getName(),spaces+1,showSpouse);
if(subList != null) {
Enumeration l = subList.elements();
while(l.hasMoreElements()) {
childsName = (String)l.nextElement();
descendantList.addElement(childsName);
}
}
}
}
}
}
}
return descendantList;
|
public java.lang.String | getDetails()
String s = new String();
s = s + "Reference No.:" + Integer.toString(this.reference) + "\n";
if (this.husband != null) s = s + "Huband: " + this.husband.getName() + "\n";
if (this.wife != null) s = s + "Wife: " + this.wife.getName() + "\n";
if(this.children != null) {
Enumeration kids = this.getChildren();
s = s + "Children: \n";
while (kids.hasMoreElements()) {
s = s + " " + ((Individual)kids.nextElement()).getName() + "\n";
}
}
if (this.ceremony != null) s = s + "\nMarriage: \n " + this.ceremony.getDetails();
if (this.decree != null) s = s + "\nDivorce: \n " + this.decree.getDetails();
return s;
|
public java.lang.String | getDisplayName()
return this.displayName;
|
public Divorce | getDivorce()
return this.decree;
|
public static ProblemDomain.Family | getFamily(int reference)
return (Family)(Family.All.get(new Integer(reference)));
|
public Individual | getHusband()
return this.husband;
|
public Marriage | getMarriage()
return this.ceremony;
|
protected static int | getNextReference()
return ++lastReference;
|
public java.util.Enumeration | getNotes()
return notes.elements();
|
public int | getReference()
return this.reference;
|
public java.lang.String | getTextRecordIdentifier()
return "@F" + java.lang.Integer.toString(this.reference) + "@ FAM";
|
public Individual | getWife()
return this.wife;
|
public boolean | hasAsChild(ProblemDomain.Individual c)
return this.children.contains(c);
|
public boolean | hasAsSpouse(ProblemDomain.Individual p)
return (this.husband == p | this.wife == p);
|
public boolean | isNotSolemnised()
return this.notSolemnised;
|
public void | removeChild(ProblemDomain.Individual p)
this.children.removeElement(p);
// unlink other end
p.unlinkAsChild(this);
|
public void | removeNote(ProblemDomain.Note comments)
notes.removeElement(comments); return;
|
public void | removeNoteAt(int i)
notes.removeElementAt(i); return;
|
public void | reset() lastReference = 0;
|
public void | setDivorce(ProblemDomain.Divorce p)
this.decree = p; return;
|
public void | setHusband(ProblemDomain.Individual p)
// unlink other end
if (husband != null) {
husband.unlinkAsSpouse(this);}
// set
this.husband = p;
// link other end
husband.linkAsSpouse(this);
// update display name
this.displayName = this.husband.getFamilyName() + " = ";
if (this.wife != null) this.displayName = this.displayName
+ this.wife.getFamilyName();
return;
|
public void | setMarriage(ProblemDomain.Marriage p)
this.ceremony = p; return;
|
protected static void | setNextReference(int n)
if (lastReference < n) lastReference = n-1; return;
|
public void | setNotSolemnised(boolean b)
this.notSolemnised = b;
|
public void | setNoteAt(int i, ProblemDomain.Note s)
notes.setElementAt(s,i); return;
|
public void | setWife(ProblemDomain.Individual p)
// unlink other end
if (wife != null) {
wife.unlinkAsSpouse(this);}
// set
this.wife = p;
// link other end
wife.linkAsSpouse(this);
// update display name
this.displayName = " = " + this.wife.getFamilyName();
if (this.husband != null) this.displayName = this.husband.getFamilyName() + this.displayName;
return;
|
public static ProblemDomain.Family | testObject()
Family f = new Family(1,
Individual.testObject(), Individual.testObject2(),
Marriage.testObject(), Divorce.testObject());
f.addChild(Individual.testObject3());
f.addChild(Individual.testObject4());
f.addNote(new Note("A fine family there now."));
f.addNote(new Note("And that's the truth!"));
return f;
|
public java.lang.String | toString(java.lang.String sn)
String s = sn + " " + getTextRecordIdentifier() + "\n";
try {
sn = Integer.toString(Integer.parseInt(sn)+1);}
catch (NumberFormatException e) {
sn = sn + " ";}
s = s + sn + " REFN F" + Integer.toString(this.reference) + "\n";
if (this.husband != null) s = s + sn + " " + "HUSB @I" + Integer.toString(this.husband.getReference()) + "@\n";
if (this.wife != null) s = s + sn + " " + "WIFE @I" + Integer.toString(this.wife.getReference()) + "@\n";
if(this.children != null) {
Enumeration kids = this.getChildren();
while (kids.hasMoreElements()) {
s = s + sn + " " + "CHIL @I" + Integer.toString(((Individual)kids.nextElement()).getReference()) + "@\n";
}
}
if (this.ceremony != null) s = s + this.ceremony.toString(sn);
if (this.decree != null) s = s + this.decree.toString(sn);
s = s + sn + " " + "_PCODE F" + Integer.toString(this.reference) + "\n";
s = s + sn + " " + "_PNAME " + this.displayName + "\n";
s = s + sn + " " + "_FRECT " + "\n";
return s;
|