Commit afcb94b7 authored by Klaus Hamberger's avatar Klaus Hamberger
Browse files

Debugged and improved sequence analysis report (member lists).

git-svn-id: svn+ssh://svn.code.sf.net/p/tip-puck/code/trunk@2314 fbf60bc9-78ff-467a-80f5-d9f1d8e511fc
parent d69ee70e
......@@ -337,7 +337,6 @@ public class RelationWorker {
}
result = new int[]{maxDepth,width};
System.out.println(tree+" "+depth+" "+width);
//
return result;
......
......@@ -2774,6 +2774,8 @@ public class SequenceReporter {
// Relations relations = slices.relations();
String empty = "\t\t\t\t\t";
result = new Report(criteria.getRelationModelName()+" Slices");
StringList list = new StringList();
......@@ -2786,7 +2788,6 @@ public class SequenceReporter {
// for (String idValue : slices.idValues()){
list.appendln(sequence.getId());
// list.appendln(idValue);
list.appendln();
List<Individual> members = ((Populatable)sequence).getIndividuals().toSortedList(Sorting.BIRT_YEAR);
......@@ -2794,43 +2795,64 @@ public class SequenceReporter {
list.append("Year\t");
for (Ordinal time : Ordinal.getOrdinals(criteria.getDates())){
list.append(time+"\t\t");
list.append(time+"\tNote\tReferent\tRelation\tChain\t");
}
list.appendln();
for (Individual member : members){
StringList additionalList = new StringList();
list.append(member.signature()+" ("+IndividualValuator.lifeStatusAtYear(member, criteria.getReferenceYear())+")\t");
String emptyCumul = "---\t";
for (Ordinal time : Ordinal.getOrdinals(criteria.getDates())){
// for (Ordinal time : slices.getTimes()){
String status = SequenceWorker.getStatus(slices, member, time, criteria);
// String status = slices.getById(id).statusByIndividuals().get(member);
List<String> statusLines = SequenceWorker.getStatus(slices, member, time, criteria);
if (!statusLines.isEmpty()){
list.append(statusLines.get(0)+"\t");
for (int i=1;i<statusLines.size();i++){
additionalList.append(emptyCumul+statusLines.get(i));
}
if (StringUtils.isNotEmpty(status)){
list.append(status+"\t");
} else {
Integer deathYear = IndividualValuator.getDeathYear(member);
Integer birthYear = IndividualValuator.getBirthYear(member);
if (deathYear!=null && deathYear<=time.getYear()){
list.append("+"+deathYear+"\t\t");
list.append("+"+deathYear);
} else if (birthYear!=null && birthYear>=time.getYear()){
list.append("*"+birthYear+"\t\t");
list.append("*"+birthYear);
} else {
list.append("?\t\t");
list.append("?");
}
list.append(empty);
}
emptyCumul += empty;
}
list.appendln();
for (String additionalLine : additionalList){
list.appendln(additionalLine);
}
}
//
list.appendln();
}
//
result.outputs().append(list);
logger.debug("Member report created for "+slices);
} else {
......
......@@ -7,9 +7,6 @@ import java.util.Set;
import java.util.TreeMap;
import org.tip.puck.PuckException;
import org.tip.puck.geo.GeoLevel;
import org.tip.puck.geo.Geography;
import org.tip.puck.geo.Place;
import org.tip.puck.graphs.Graph;
import org.tip.puck.net.Individual;
import org.tip.puck.net.Individuals;
......@@ -19,7 +16,9 @@ import org.tip.puck.net.relations.Actors;
import org.tip.puck.net.relations.Relation;
import org.tip.puck.net.relations.Relations;
import org.tip.puck.net.relations.Roles;
import org.tip.puck.net.relations.workers.RelationWorker;
import org.tip.puck.net.workers.IndividualValuator;
import org.tip.puck.net.workers.NetUtils;
import org.tip.puck.partitions.Cluster;
import org.tip.puck.partitions.Partition;
import org.tip.puck.report.ReportTable;
......@@ -32,6 +31,7 @@ import org.tip.puck.sequences.Sequence;
import org.tip.puck.sequences.Sequenceable;
import org.tip.puck.sequences.Sequenceables;
import org.tip.puck.util.MathUtils;
import org.tip.puck.util.ToolBox;
import org.tip.puck.util.Value;
/**
......@@ -549,37 +549,32 @@ public class SequenceWorker {
return result;
}
static <S extends Sequenceable<E>,E extends Populatable> String getStatus(Sequenceables<S,E> slices, Individual individual, Ordinal time, SequenceCriteria criteria){
String result;
static <S extends Sequenceable<E>,E extends Populatable> List<String> getStatus(Sequenceables<S,E> slices, Individual individual, Ordinal time, SequenceCriteria criteria){
List<String> result;
result = "";
// Relations slice = slices.getStation(time);
List<E> relations = slices.getStations(time);
result = new ArrayList<String>();
for (Relation relation : individual.relations()){
if (relations.contains(relation)){
/* if (slice!=null){
Relation relation = null;
Relations relations = slice.getByIndividual(individual);
if (relations != null){
relation = relations.getFirst();
}
// Relation relation = slice.relationsByIndividuals().get(individual);
if (relation!=null){*/
Integer thisTime = relation.getTime(criteria.getDateLabel());
String thisRelationModelName = relation.getModel().getName();
if (time.getYear().equals(thisTime) && criteria.getRelationModelName().equals(thisRelationModelName)){
String line = "";
String idValue = relation.getAttributeValue(criteria.getLocalUnitLabel());
String placeValue = relation.getAttributeValue(criteria.getPlaceLabel());
System.out.println(criteria.getPlaceLabel()+" "+placeValue);
if (idValue!=null){
result += idValue;
line += idValue;
} else if (placeValue!=null){
result += placeValue;
line += placeValue;
}
Actors actors = relation.actors().getById(individual.getId());
......@@ -588,25 +583,49 @@ public class SequenceWorker {
Actor actor = actors.get(0);
if (actor.getAttributeValue("MODE")!=null){
result += " "+actor.getAttributeValue("MODE");
line += " "+actor.getAttributeValue("MODE");
}
result+="\t";
line+="\t";
String startDate = actor.getAttributeValue(criteria.getStartDateLabel());
String endDate = actor.getAttributeValue(criteria.getEndDateLabel());
String note = actor.getAttributeValue("NOTE");
if (startDate!=null){
result += startDate;
line += startDate;
}
if (endDate!=null){
result += "-"+endDate;
line += "-"+endDate;
}
if (note!=null){
result += " ["+note+"]";
line += " ["+note+"]";
}
line+="\t";
Individual referent = actor.getReferent();
if (referent!=null){
line += referent + "\t" + NetUtils.getAlterRoles(individual, referent, ToolBox.stringsToInts(criteria.getPattern()), criteria.getRelationModelNames(), criteria.getChainClassification());
} else {
line+="\t";
}
line+="\t";
String chain = RelationWorker.getReferentChainGenderString(actor, criteria.getGroupAffiliationLabel(), criteria.getReferentRelationLabel(), relation);
if (chain!=null){
line += chain;
}
}
//
result.add(line);
}
}
......
......@@ -4682,7 +4682,6 @@ public class MainWindow {
criteria.setGeography(MainWindow.this.netGUI.getSegmentation().getGeography());
// Optionalize via input dialog
criteria.setThreshold(20);
criteria.setPlaceLabel("END_PLACE");
criteria.setGroupAffiliationLabel("PATRIL_ID");
criteria.setImpersonalAlterLabel("NOHOST");
criteria.setReferentRelationLabel("REFREL");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment