Methods Summary |
---|
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
Individual.All.remove(new Integer(this.getReference()));
|
public static java.util.Enumeration | getAll()
return All.elements();
|
public Birth | getBirth()return this.birth;
|
public Family | getChildOf()return this.childOf;
|
public Death | getDeath()return this.death;
|
public java.lang.String | getDetails()
String s = new String();
s = s + "Reference No.: " + Integer.toString(this.reference) + "\n";
if ((this.familyName + this.givenNames) != "")
s = s + " NAME " + this.givenNames + " " + this.familyName + "\n";
if (this.birth != null) s = s + "\nBirth: \n " + this.birth.getDetails();
if (this.death != null) s = s + "\nDeath: \n " + this.death.getDetails();
if (this.childOf != null) s = s + "Child of Family: " + this.childOf.getDisplayName() + "\n";
if (this.spouseInList != null) {
Enumeration e = this.spouseInList.elements();
Family f;
s = s + "Parent of families: \n";
while (e.hasMoreElements()) {
f = (Family)(e.nextElement());
s = s + f.getDisplayName() + "\n";}
}
return s;
|
public java.lang.String | getFamilyName()return this.familyName;
|
public java.lang.String | getGivenNames()return this.givenNames;
|
public static ProblemDomain.Individual | getIndividual(int reference)
return (Individual)(Individual.All.get(new Integer(reference)));
|
public java.lang.String | getName()
return givenNames + " " + familyName;
|
protected static int | getNextReference()
return ++lastReference;
|
public java.util.Enumeration | getNotes()
return notes.elements();
|
public int | getReference()return this.reference;
|
public java.lang.String | getSex()
return this.sex;
|
public java.util.Enumeration | getSpouseInList()
return this.spouseInList.elements();
|
public java.lang.String | getTextRecordIdentifier()
return "@I" + java.lang.Integer.toString(this.reference) + "@ INDI";
|
public boolean | isParent()
if(spouseInList == null) return false;
else return true;
|
protected void | linkAsChild(ProblemDomain.Family f)
// check it has already been added at other end
if (f.hasAsChild(this)) {
// Remove this from current family if there is one
if (this.childOf != null) this.childOf.removeChild(this);
// link
this.childOf = f;}
else {
// 'this' is not a child of the family f.
throw new InvalidParameterException();}
return;
|
protected void | linkAsSpouse(ProblemDomain.Family f)
if (f.hasAsSpouse(this)) {
if (this.spouseInList == null) this.spouseInList = new Vector(1);
this.spouseInList.addElement(f);}
else {
// 'this' is not a spouse of the family f.
throw new InvalidParameterException();}
return;
|
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 | setBirth(ProblemDomain.Birth b)this.birth = b; return;
|
public void | setDeath(ProblemDomain.Death d)this.death = d; return;
|
public void | setFamilyName(java.lang.String s)this.familyName = s; return;
|
public void | setGivenNames(java.lang.String s)this.givenNames = s; return;
|
protected static void | setNextReference(int n)
if (lastReference < n) lastReference = n-1; return;
|
public void | setNoteAt(int i, ProblemDomain.Note s)
notes.setElementAt(s,i); return;
|
public void | setSex(java.lang.String s)
if (s.equals("M") || s.equals("F") || s.equals("I"))
this.sex = s;
else
throw new InvalidParameterException();
return;
|
public static ProblemDomain.Individual | testObject()
return new Individual(
1,
"Bloggs",
"Joe",
MALE,
Birth.testObject(),
null);
|
public static ProblemDomain.Individual | testObject2()
return new Individual(
2,
"Smith",
"Mary",
FEMALE,
Birth.testObject(),
null);
|
public static ProblemDomain.Individual | testObject3()
return new Individual(
3,
"Bloggs",
"John",
MALE,
Birth.testObject(),
null);
|
public static ProblemDomain.Individual | testObject4()
return new Individual(
4,
"Bloggs",
"Jane",
FEMALE,
Birth.testObject(),
null);
|
public static ProblemDomain.Individual | testObject5()
return new Individual(
5,
"Winters",
"Susan",
FEMALE,
Birth.testObject(),
null);
|
public static ProblemDomain.Individual | testObject6()
return new Individual(
6,
"Bloggs",
"Robert",
MALE,
Birth.testObject(),
null);
|
public java.lang.String | toString()
return this.toString("");
|
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 P" + Integer.toString(this.reference) + "\n";
if ((this.familyName + this.givenNames) != "")
s = s + sn + " " + "NAME " + this.givenNames + " /" + this.familyName + "/\n";
s = s + sn + " " + "SEX " + getSex() + "\n";
if (this.birth != null) s = s + this.birth.toString(sn);
if (this.death != null) s = s + this.death.toString(sn);
if (this.childOf != null) s = s + sn + " " + "FAMC @F" + Integer.toString(this.childOf.getReference()) + "@\n";
if (this.spouseInList != null) {
Enumeration e = this.spouseInList.elements();
Family f;
while (e.hasMoreElements()) {
f = (Family)(e.nextElement());
s = s + sn + " " + "FAMS @F" + Integer.toString(f.getReference()) + "@\n";}
}
return s;
|
protected void | unlinkAsChild(ProblemDomain.Family f)
if (!f.hasAsChild(this)) {
if (this.childOf == f) {
this.childOf = null;}
else
// childOf references different family
throw new InvalidParameterException();}
else {
// 'this' is still a child of the family f.
throw new InvalidParameterException();}
return;
|
protected void | unlinkAsSpouse(ProblemDomain.Family f)
// check 'this' is not still a spouse
if (!f.hasAsSpouse(this)) {
this.spouseInList.removeElement(f);}
else {
// 'this' is still a spouse of the family f.
throw new InvalidParameterException();}
return;
|