Commit 01079d33 authored by Klaus Hamberger's avatar Klaus Hamberger
Browse files

Debugged circuit vector retrieval for classificatory linking.

git-svn-id: svn+ssh://svn.code.sf.net/p/tip-puck/code/trunk@2339 fbf60bc9-78ff-467a-80f5-d9f1d8e511fc
parent ea94209f
......@@ -629,33 +629,53 @@ public class Chain extends ArrayList<Individual> implements Comparable<Chain>, N
int result;
result = 0;
for (int i=0;i<size();i++) {
for (int i=0;i<size();i++) {
int a = 0;
if (get(i).getGender().isMale()) {
a = 1;
} else if (get(i).getGender().isFemale()) {
a = 2;
} else if (get(i) instanceof Couple){
a = 1;
} else {
result = 0;
break;
}
//
result = result + new Double(Math.pow(2,i)*a).intValue();
}
if (getLast() instanceof Couple) {
result = -1*result;
}
//
return result;
}
public Vector getCharacteristicVector(){
if (vector == null){
int n = subchains.size();
int[] v = new int[n];
for (int i=0;i<n;i++){
v[i] = subchains.get(i).getCharacteristicNumber();
}
//
vector = new Vector(v);
}
//
......
......@@ -13,6 +13,10 @@ public class Couple extends Individual {
super(0,"",Gender.MALE);
}
public Couple(int id, String label){
super(id,label,Gender.MALE);
}
public Couple (Individual first, Individual second){
super(0,"",Gender.MALE);
this.first = first;
......
......@@ -2094,17 +2094,25 @@ public class CircuitFinder {
final Set<Individual> vertices, final int r) {
if (matches(ego, alter)) {
if (mergingPartition!=null){
if (rightChain.size()<2 || !matches(ego,rightChain.get(rightChain.size()-2))){
Cluster<Individual> cluster = mergingPartition.getCluster(ego);
Chain leftChain1 = leftChain.clone();
Chain rightChain1 = rightChain.clone();
if (cluster!=null){
Individual clusterAsAncestor = new Individual(lastId+mergingPartition.indexOf(cluster)+1,cluster.getLabel(),Gender.UNKNOWN);
Individual clusterAsAncestor = new Couple(lastId+mergingPartition.indexOf(cluster)+1,cluster.getLabel());
leftChain1.add(clusterAsAncestor,1);
rightChain1.add(clusterAsAncestor,1);
} else {
if (!ego.equals(alter)) System.err.println("Error in brige construction: "+ego+" vs "+alter);
}
bridges.add(ChainMaker.concatenateInv(leftChain1, rightChain1));
}
......@@ -2552,6 +2560,7 @@ public class CircuitFinder {
}
Value k = ChainValuator.get(cs,classification);
int dim = c.dim();
// checks whether neutralized chain contains double elements (possible if the same apical couple has four children in the chain)
......
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