package edu.stanford.peer.rbtm.engine; import java.util.*; import edu.stanford.peer.rbtm.credential.*; /** * A proof node which respresents an entity in the credential graph. */ public class EntityProofNode extends AbstractProofNode { /** * A map for managing all the partial solutions per intersection that arrive */ static protected PartialSolutionMap partialSolutions = new PartialSolutionMap(); /** * Default constructor */ protected EntityProofNode(ProofGraph graph, Entity re, int trackType) { super(graph, re, trackType); } public void additionalBackwardProcess() { //backwardSolutionAdded(this, getRoleExp()); } public void additionalForwardProcess() { } /** * Adds a forward solution but propagating the solution backwards along * the credential chain. If s is a partial solution and all k pieces have * arrived, then add edge from this node to the intersection. */ public void forwardSolutionAdded(ProofNode s, ForwardSolution r) { super.forwardSolutionAdded(s, r); EntityExpression expr = s.getRoleExp(); System.out.println("Additional forward processing on " + getRoleExp() + " where s = " + expr); Iterator iCreds = getGraph().findCredentialsByPartialSubject(expr); while(iCreds.hasNext()) { // if s is partial solution of intersection(s) StaticCredential credential = (StaticCredential) iCreds.next(); Intersection i = (Intersection)credential.getSubject(); System.out.println(getRoleExp() + " matches partial solution " + i); if(partialSolutions.addPartialSolution(i, expr)) { ProofNode node = getGraph().addForwardNode(i); node.addParent(node, r); } } } }