public class Context
extends java.lang.Object
implements java.io.Serializable
Family
and Individual
objects, domain theories,
etc.
Class-level (static) fields act as global variables.
Most file operations are centered im this class.Modifier and Type | Class and Description |
---|---|
static class |
Context.AcceptedDefPtr
This inner class represents a pointer to a KinTermDef
that was accepted by the User and added to the domain theory.
|
static class |
Context.AcceptedOverlap
This inner class documents User's acceptance of a proposed Overlap
|
static class |
Context.AcceptedSynonym
This inner class documents User's acceptance of a proposed Synonym pair
|
static class |
Context.AcceptedUmbrella
This inner class documents User's acceptance of a proposed Umbrella
|
static class |
Context.CB_Ptr
This inner class is a compact pointer
to a
ClauseBody . |
static class |
Context.FilePicker
This inner class provides a file name filter for sorting through the
Prior Versions directory.
|
static class |
Context.RejectedOverlap
This inner class documents User's rejection of a proposed Overlap
|
static class |
Context.RejectedPropDefPtr
This inner class represents a pointer to a KinTermDef
(or EQC of them) that was proposed to User but rejected.
|
static class |
Context.RejectedSynonym
This inner class documents User's rejection of a proposed Synonym pair
|
static class |
Context.RejectedUmbrella
This inner class documents User's rejection of a proposed Umbrella
|
static class |
Context.SpecRelTriple
This convenience class (a Special Relationship Triple) has 3 named fields:
parent, child, and udpName.
|
static class |
Context.UmbrellaIntoSyns
This inner class documents User's conversion of a proposed Umbrella
into one or more Synonyms
|
Modifier and Type | Field and Description |
---|---|
boolean |
adoptionHelp |
java.awt.Dimension |
area |
java.util.TreeMap<java.lang.String,java.util.ArrayList<Context.CB_Ptr>> |
autoDefAdr |
java.util.TreeMap<java.lang.String,java.util.ArrayList<Context.CB_Ptr>> |
autoDefRef
The autoDef (Ref or Adr) is a TreeMap from kinType -> ArrayList
|
boolean |
birthDateNormallyCaptured |
java.lang.String |
comments
Comments hold special comment from (or about) the author of the data about this culture.
|
java.util.TreeMap<java.lang.String,java.util.TreeMap<java.lang.String,java.util.ArrayList<Individual>>> |
connectingUDPValueLists |
java.lang.String |
createDate
Comments hold special comment from (or about) the author of the data about this culture.
|
java.lang.String |
currentChart |
java.lang.String |
dateOfLastDataChange |
java.lang.String |
dateOfLastSuggestion |
java.lang.String[] |
defaultKinTypeOrder |
java.lang.String[] |
defaultKinTypePriority |
boolean |
displayGEDCOM |
boolean |
distinctAdrTerms |
boolean |
doBaseCBs |
boolean |
doInduction |
boolean |
editable |
java.util.ArrayList<Family> |
familyCensus
List of all families in this culture, in serialNmbr order (beginning with 0).
|
boolean |
featuresHaveChanged
True if polygamy is accepted in this culture (regardless of whether it has ever happened).
|
java.util.TreeMap<java.lang.String,ParserGEDCOM.GEDCOMitem> |
gedcomExtra |
java.util.TreeMap<java.lang.String,ParserGEDCOM.GEDCOMitem> |
gedcomHeaderItems |
java.util.TreeMap<java.lang.String,ParserGEDCOM.GEDCOMitem> |
gedcomNotes |
java.util.TreeMap<java.lang.String,ParserGEDCOM.GEDCOMitem> |
gedcomSources |
int |
ignorableP |
java.util.ArrayList<Individual> |
individualCensus
List of all persons in this culture, in serialNmbr order (beginning with 0).
|
int |
infoMarriage |
int |
infoPerson |
java.util.TreeMap<Individual,java.util.TreeMap<java.lang.String,java.util.ArrayList<Individual>>> |
inverseSpecialRelationships |
java.util.ArrayList<java.lang.String> |
kinTypeOrder |
java.util.ArrayList<java.lang.String> |
kinTypePriority |
java.util.TreeMap<java.lang.String,java.lang.String> |
kinTypePriorityTMap |
KinTypeIndex |
kti
Index of all
Node str according to their kin type. |
int |
ktLabelChoice |
KinTermMatrix |
ktm
Two-dimensional matrix of all kin terms known for pairs of persons.
|
int |
labelChoice |
java.lang.String |
languageName
Name of the language spoken in this culture.
|
java.util.TreeMap<java.lang.String,java.util.ArrayList<Context.HistoryItem>> |
learningHistoryAdr |
java.util.TreeMap<java.lang.String,java.util.ArrayList<Context.HistoryItem>> |
learningHistoryRef
The learningHistory (Ref or Adr) is a TreeMap from kinTerm -> ArrayList
|
boolean |
libraryBrowsing
The
saveState boolean flag determines whether this instance of Context has its complete state
saved to disk at shut-down. |
java.util.ArrayList<Link> |
linkCensus |
boolean |
maleFirst
The
saveState boolean flag determines whether this instance of Context has its complete state
saved to disk at shut-down. |
int |
maxNoiseP |
java.awt.Point |
origin |
boolean |
polygamyPermit
True if polygamy is accepted in this culture (regardless of whether it has ever happened).
|
static java.lang.String[] |
priorVersions |
boolean |
saveState
The
saveState boolean flag determines whether this instance of Context has its complete state
saved to disk at shut-down. |
boolean |
simDataGen
The
saveState boolean flag determines whether this instance of Context has its complete state
saved to disk at shut-down. |
java.util.TreeMap<java.lang.String,java.util.ArrayList<Context.SpecRelTriple>> |
specialRelationships
A list of all the Special Relationships in this context,
recorded in SpecRelTriples.
|
boolean |
surnameNormallyCaptured |
java.util.TreeMap |
userDefinedProperties
Optional extra fields, defined by user.
|
Constructor and Description |
---|
Context()
This zero-arg constructor is for use by Serialization ONLY.
|
Context(DomainTheory dt)
Constructor with only a
DomainTheory as argument. |
Context(DomainTheory dt,
java.lang.String cmts)
Constructor with a
DomainTheory and comments-string. |
Modifier and Type | Method and Description |
---|---|
void |
addDomainTheory(DomainTheory theory)
Add a Domain Theory to this context.
|
void |
addDyads(Individual ego)
Start from ego and create a
Dyad for each named relationship encountered on a breadth-first
walk of ego's family tree. |
boolean |
addDyads2(Individual ego,
java.util.TreeMap bioDyads,
boolean onlyBioLinks) |
void |
addFamily(Family fam)
Add a family (stored by serial number) to this context.
|
void |
addIndividual(Individual indiv)
Add an individual (stored by serial number) to this context.
|
static void |
breakpoint() |
void |
changeEgoTo(Individual ego)
Designate a new Ego (interview subject).
|
static java.lang.String |
convertDoubleQuotes(java.lang.String s)
Converts double quotes to single quotes, using the
FamilyPanel
method. |
static java.lang.String |
craftBackupMsg(java.lang.String msg,
java.io.File silkFile)
Modify msg to inform the User whether a Prior Version is available.
|
DomainTheory |
domTheoryAdr()
Returns the Domain Theory for Terms of Address in this context.
|
boolean |
domTheoryAdrExists()
Returns true if a domain theory for Terms of Address exists.
|
boolean |
domTheoryAdrLoaded() |
DomainTheory |
domTheoryRef()
Returns the Domain Theory for Terms of Reference in this context.
|
boolean |
domTheoryRefExists()
Returns true if a domain theory for Terms of Reference exists.
|
boolean |
domTheoryRefLoaded() |
ContextEditor |
editFields() |
void |
exportGEDCOM(java.io.PrintWriter outFile,
java.lang.String fileName,
boolean realData,
java.lang.String destination,
java.lang.String includeAuxs)
Write output file in GEDCOM (v 5.5) format, containing all individuals and
families in this context.
|
void |
exportKTM(java.io.PrintWriter out,
java.lang.String typ)
Write a tab-delimited file that formats the Kin Term Matrix
as a spreadsheet.
|
void |
generateDyads(Individual current,
int egoLevel,
boolean onlyBioLinks,
java.util.TreeMap bioDyads)
Generate one Dyad for each kinTerm found in any of the six lists on this Individual's Node.
|
java.lang.String |
getChartDescription(java.lang.String chart) |
int |
getChartIndex(java.lang.String chartLtr) |
java.lang.String |
getChartLtr(int n) |
java.lang.String |
getNextChartLtr() |
java.util.ArrayList<java.lang.Object> |
getPair() |
static java.lang.String[] |
getPriors(java.io.File priorDir,
java.io.File silkFile)
Create an array of the names of prior versions of this file.
|
boolean |
hasIssues() |
boolean |
hasNonChartables(java.util.ArrayList miniPreds) |
static java.lang.String |
hornClauseFormatter(java.lang.String in) |
void |
insertAdoptionPriority(java.lang.String newUDPname) |
boolean |
isAdoptionPred(java.lang.String pred) |
boolean |
isInverseAdoptionPred(java.lang.String pred) |
boolean |
isNonChartable(java.lang.String pred) |
static java.util.ArrayList<java.lang.String> |
makeLines(java.lang.String in) |
static void |
makePriorVersion(java.io.File silkFile)
To prevent data loss in case of a crash, move the SILK file from which
the current session was launched to the Library/Prior_Versions folder,
giving it the lowest version number not already used.
|
boolean |
notRejected(Library.KTD_EQC eqc,
boolean adr) |
void |
printCensus(java.io.PrintWriter file)
Write to a file a complete census of Families and Individuals for this context.
|
void |
printSuggestions(java.io.PrintWriter pw,
DomainTheory dt,
java.lang.String typ) |
void |
printTheory(java.io.PrintWriter file)
Write out a domain theory for Terms of Reference to a file.
|
void |
printTheory(java.io.PrintWriter file,
java.lang.String type)
Write out a domain theory to a file.
|
void |
rebuildLinkMethods()
Rarely, if the various indexes and pre-computed tables get out of synch,
it is necessary to rebuild the KinTermMatrix and all the other indexes
from scratch.
|
void |
removeAdoptionPriority(java.lang.String udName) |
void |
removeChartableUDP(java.lang.String udpName) |
void |
removeDomainTheory(DomainTheory dt)
Remove this domain theory from this context.
|
void |
renameChartableUDP(java.lang.String oldName,
java.lang.String newName) |
void |
resetTo(int nmbrIndivs,
int nmbrFams)
Restore this context to a prior state, ELIMINATING all persons and families
created with serial numbers greater-or-equal-to these.
|
static void |
revertToPrior()
Find the most recent (highest numbered) prior version, rename it
with the base file name (removing the version number) and move it
to the User's edit directory.
|
static Context |
tempCtxt(DomainTheory dt) |
java.lang.String |
toString()
Build a string with a brief summary of this context.
|
DomainTheory |
updateDomTheoryAdr()
This method is intended for use only on contexts already in the Library;
use on a context under construction may have harmful effects.
|
DomainTheory |
updateDomTheoryRef()
This method is intended for use only on contexts already in the Library;
use on a context under construction may have harmful effects.
|
void |
writeSILKFile(java.io.File f)
Write output file in _.silk format, containing all parameters, dyads,
individuals and families in this context.
|
void |
writeSILKFile(java.io.File f,
java.lang.String params)
Accept a new parameter string, then call main writeSILKFile method.
|
void |
writeSILKGuts(java.io.PrintWriter silk,
java.lang.String directory)
This method writes the entire saved state of the SIL_Edit session in XML-like format.
|
public java.lang.String comments
public java.lang.String createDate
public java.lang.String dateOfLastSuggestion
public java.lang.String dateOfLastDataChange
public java.lang.String currentChart
public java.lang.String languageName
public java.util.ArrayList<Individual> individualCensus
public java.util.ArrayList<Family> familyCensus
public java.util.ArrayList<Link> linkCensus
public KinTermMatrix ktm
Node
with the kinTerms
Row
(Ego) could use to refer to Column
(Alter).public KinTypeIndex kti
Node
str according to their kin type. Used to create
named-data-requests.public boolean polygamyPermit
public boolean featuresHaveChanged
public boolean doBaseCBs
public boolean doInduction
public boolean adoptionHelp
public java.util.TreeMap userDefinedProperties
public java.util.TreeMap<java.lang.String,java.util.TreeMap<java.lang.String,java.util.ArrayList<Individual>>> connectingUDPValueLists
public boolean saveState
saveState
boolean flag determines whether this instance of Context has its complete state
saved to disk at shut-down. The context in which Data_Gathering is done (the 'target culture') MUST be
saved between sessions. Other contexts can be saved by the User's explicit menu choice.public boolean simDataGen
saveState
boolean flag determines whether this instance of Context has its complete state
saved to disk at shut-down. The context in which Data_Gathering is done (the 'target culture') MUST be
saved between sessions. Other contexts can be saved by the User's explicit menu choice.public boolean maleFirst
saveState
boolean flag determines whether this instance of Context has its complete state
saved to disk at shut-down. The context in which Data_Gathering is done (the 'target culture') MUST be
saved between sessions. Other contexts can be saved by the User's explicit menu choice.public boolean libraryBrowsing
saveState
boolean flag determines whether this instance of Context has its complete state
saved to disk at shut-down. The context in which Data_Gathering is done (the 'target culture') MUST be
saved between sessions. Other contexts can be saved by the User's explicit menu choice.public java.util.TreeMap<java.lang.String,java.util.ArrayList<Context.HistoryItem>> learningHistoryRef
public java.util.TreeMap<java.lang.String,java.util.ArrayList<Context.HistoryItem>> learningHistoryAdr
public java.util.TreeMap<java.lang.String,java.util.ArrayList<Context.CB_Ptr>> autoDefRef
public java.util.TreeMap<java.lang.String,java.util.ArrayList<Context.CB_Ptr>> autoDefAdr
public java.lang.String[] defaultKinTypeOrder
public java.lang.String[] defaultKinTypePriority
public java.util.ArrayList<java.lang.String> kinTypeOrder
public java.util.ArrayList<java.lang.String> kinTypePriority
public java.util.TreeMap<java.lang.String,java.lang.String> kinTypePriorityTMap
public java.util.TreeMap<java.lang.String,java.util.ArrayList<Context.SpecRelTriple>> specialRelationships
public java.util.TreeMap<Individual,java.util.TreeMap<java.lang.String,java.util.ArrayList<Individual>>> inverseSpecialRelationships
public java.util.TreeMap<java.lang.String,ParserGEDCOM.GEDCOMitem> gedcomHeaderItems
public java.util.TreeMap<java.lang.String,ParserGEDCOM.GEDCOMitem> gedcomNotes
public java.util.TreeMap<java.lang.String,ParserGEDCOM.GEDCOMitem> gedcomSources
public java.util.TreeMap<java.lang.String,ParserGEDCOM.GEDCOMitem> gedcomExtra
public java.awt.Point origin
public java.awt.Dimension area
public int infoPerson
public int infoMarriage
public int labelChoice
public int ktLabelChoice
public int maxNoiseP
public int ignorableP
public boolean editable
public boolean distinctAdrTerms
public boolean birthDateNormallyCaptured
public boolean surnameNormallyCaptured
public boolean displayGEDCOM
public static java.lang.String[] priorVersions
public Context()
public Context(DomainTheory dt)
DomainTheory
as argument.dt
- a (possibly empty) domain theory for a Kinship Systempublic Context(DomainTheory dt, java.lang.String cmts)
DomainTheory
and comments-string.dt
- a (possibly empty) domain theory for a Kinship Systemcmts
- string to begin the Comments field of this instance.public static void breakpoint()
public static java.lang.String convertDoubleQuotes(java.lang.String s)
FamilyPanel
method.s
- the string, perhaps containing some double quotes.public static Context tempCtxt(DomainTheory dt)
public void addDomainTheory(DomainTheory theory) throws KSInternalErrorException
theory
- new theory to be added, covering kinship terms of Reference or Address.KSInternalErrorException
- if the new theory will over-write an existing onepublic DomainTheory updateDomTheoryRef() throws KSParsingErrorException, JavaSystemException, KSBadHornClauseException, KSInternalErrorException, KSConstraintInconsistency
KSParsingErrorException
JavaSystemException
KSBadHornClauseException
KSInternalErrorException
KSConstraintInconsistency
public DomainTheory updateDomTheoryAdr() throws KSParsingErrorException, JavaSystemException, KSBadHornClauseException, KSInternalErrorException, KSConstraintInconsistency
KSParsingErrorException
JavaSystemException
KSBadHornClauseException
KSInternalErrorException
KSConstraintInconsistency
public DomainTheory domTheoryRef() throws KSParsingErrorException, JavaSystemException, KSBadHornClauseException, KSInternalErrorException, KSConstraintInconsistency
public DomainTheory domTheoryAdr() throws KSParsingErrorException, JavaSystemException, KSBadHornClauseException, KSInternalErrorException, KSConstraintInconsistency
public boolean hasIssues()
public boolean domTheoryAdrLoaded()
public boolean domTheoryRefLoaded()
public boolean domTheoryAdrExists()
public boolean domTheoryRefExists()
public void removeDomainTheory(DomainTheory dt)
dt
- theory to be removed.public java.util.ArrayList<java.lang.Object> getPair() throws KSInternalErrorException
KSInternalErrorException
public void addIndividual(Individual indiv)
indiv
- person to be addedpublic void addFamily(Family fam)
fam
- family to be addedpublic java.lang.String toString()
toString
in class java.lang.Object
public void printTheory(java.io.PrintWriter file, java.lang.String type) throws KSInternalErrorException
file
- name of file to hold a complete theory.type
- if type = 'address' the Terms of Address are written. Else Terms of Reference.an
- internal error if the chosen domain theory does not exist or can't be written.KSInternalErrorException
public void printTheory(java.io.PrintWriter file) throws KSInternalErrorException
file
- name of file to hold a complete theory.an
- internal error if the chosen domain theory does not exist or can't be written.KSInternalErrorException
public void printCensus(java.io.PrintWriter file)
file
- name of file to hold the census.public void exportGEDCOM(java.io.PrintWriter outFile, java.lang.String fileName, boolean realData, java.lang.String destination, java.lang.String includeAuxs)
Write output file in GEDCOM (v 5.5) format, containing all individuals and families in this context.
File will contain:outFile
- a PrintWriter
to write to.fileName
- direct filename; required extension is '.ged'public void rebuildLinkMethods()
SIL_Edit
.
they will change if, for example, a new UDP is created or an old one
is deleted.public boolean hasNonChartables(java.util.ArrayList miniPreds)
public boolean isNonChartable(java.lang.String pred)
public boolean isAdoptionPred(java.lang.String pred)
public boolean isInverseAdoptionPred(java.lang.String pred)
public void insertAdoptionPriority(java.lang.String newUDPname)
public void removeAdoptionPriority(java.lang.String udName)
public void renameChartableUDP(java.lang.String oldName, java.lang.String newName)
public void removeChartableUDP(java.lang.String udpName)
public java.lang.String getChartDescription(java.lang.String chart)
public int getChartIndex(java.lang.String chartLtr)
public java.lang.String getChartLtr(int n)
public java.lang.String getNextChartLtr()
public void exportKTM(java.io.PrintWriter out, java.lang.String typ)
out
- a PrintWriter onto which we writetyp
- either "Reference" or "Address"public void writeSILKFile(java.io.File f, java.lang.String params) throws java.io.FileNotFoundException, KSInternalErrorException, KSDateParseException
f
- output fileparams
- new parametersjava.io.FileNotFoundException
KSInternalErrorException
KSDateParseException
public void writeSILKFile(java.io.File f) throws java.io.FileNotFoundException, KSInternalErrorException, KSDateParseException
File will contain:
f
- a file to write to.java.io.FileNotFoundException
KSInternalErrorException
KSDateParseException
public static void makePriorVersion(java.io.File silkFile)
silkFile
- the file from which the current session was launched,
or else the previous version saved.public static java.lang.String[] getPriors(java.io.File priorDir, java.io.File silkFile)
priorDir
- the directory (folder) in the Library where priors are storedsilkFile
- the file for which priors are soughtpublic static java.lang.String craftBackupMsg(java.lang.String msg, java.io.File silkFile)
msg
- The text of the exception's message re: the errorsilkFile
- The file we are trying to open or savepublic static void revertToPrior()
public void writeSILKGuts(java.io.PrintWriter silk, java.lang.String directory) throws java.io.FileNotFoundException, KSInternalErrorException, KSDateParseException
silk
- the file to be writtendirectory
- the directory containing 'silk', or nullsug
- true = writing a Suggestion file. false = a SILK filejava.io.FileNotFoundException
- if there's a file system errorKSInternalErrorException
- if SILKin code crashesKSDateParseException
public void printSuggestions(java.io.PrintWriter pw, DomainTheory dt, java.lang.String typ)
public void changeEgoTo(Individual ego)
ego
- the new person whose data is being gathered (being interviewed).public void resetTo(int nmbrIndivs, int nmbrFams) throws KSInternalErrorException
nmbrIndivs
- lowest individual serial number to be removed.nmbrFams
- lowest family serial number to be removed.KSInternalErrorException
- if the population counts do not add up
to the proper figures after purging.public void addDyads(Individual ego) throws KSInternalErrorException
Dyad
for each named relationship encountered on a breadth-first
walk of ego's family tree. We do the walk in 2 passes: the first pass uses ONLY biological links (i.e.
spousal links and birth links). The second pass adds any Star-Links (based on UDPs) which add new relatives
of Ego. This 2-pass method is required because kinship defined in terms of biological relationships almost
always takes precedence over a relationship based on UDPs (e.g. clan membership).
This method is only called on individuals created in the Data-Gathering
Module and graphed on-screen. Therefore, we assume that each person has a non-null Node
attached,
which contains all the relationship information, levels, etc. Generate a complete PC_String for each dyad,
containing a fully-reduced (i.e. has Stfa or Hbro where appropriate) exact string.
When posting dyads (Undefined) created by Example Generation, not all nodes on Ego's relatives document kinship to her; some document the kinship of some alternate ego. Test for that on the node.
ego
- the focus person, to whom all others are related in this family tree.KSInternalErrorException
public boolean addDyads2(Individual ego, java.util.TreeMap bioDyads, boolean onlyBioLinks) throws KSInternalErrorException
KSInternalErrorException
public void generateDyads(Individual current, int egoLevel, boolean onlyBioLinks, java.util.TreeMap bioDyads) throws KSInternalErrorException, java.lang.NumberFormatException
current
- the Individual whose kinTerms we are recording in dyadsUndefined.egoLevel
- the treeLevel assigned to ego in this set of Nodes. We normalize the treeLevels for use
in indexing, with ego's level = 0.onlyBioLinks
- is true when we are in 1st pass, and must post to bioDyads.bioDyads
- has structure Alter.serialNmbr => ArrayListKSInternalErrorException
java.lang.NumberFormatException
public ContextEditor editFields() throws KSInternalErrorException
KSInternalErrorException
public boolean notRejected(Library.KTD_EQC eqc, boolean adr)
public static java.lang.String hornClauseFormatter(java.lang.String in)
public static java.util.ArrayList<java.lang.String> makeLines(java.lang.String in)