source: fedd/abac-src/rbtm/engine/old/IntersectionProofNode.java1 @ 55c074c

axis_examplecompt_changesinfo-opsversion-1.30version-2.00version-3.01version-3.02
Last change on this file since 55c074c was 8780cbec, checked in by Jay Jacobs <Jay.Jacobs@…>, 15 years ago

ABAC sources from Cobham

  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[8780cbec]1class IntersectionProofNode extends ProofNode
2{
3    private SolutionListener watcher = new IntersectionMonitor();
4    private int numOfParts;
5
6    IntersectionProofNode(Intersection re) {
7        super(re);
8        numOfParts = re.numOfParts();
9    }
10
11    void backwardProcess() {
12        super.backwardProcess();
13        Iterator it = (Intersection)roleExp.getParts();
14        while (it.hasNext()) {
15            EntityExpression re = (EntityExpression)it.next();
16            ProofNode node = addBackwardNode(firstRole);
17            node.backwardMgr.addListener(watcher);
18        }
19    }
20
21    class IntersectionMonitor implements SolutionListener
22    {
23        // Maps a solution to a counter, no source is needed
24        private HashMap  solutions;
25
26        public void solutionAdded(ProofNode s, ProofSolution r) {
27            debugInfo("Solution added: "+roleExp+"; "+s.roleExp+"; "+r);
28            if (! solutions.containsKey(r)) {   // first piece
29                solutions.put(r, new Integer(1)); 
30            } else {
31                int n = ((Integer)solutions.get(r)).intValue();
32                n ++;
33                solutions.put(r, new Integer(n));
34                if (n == numOfParts) {  // all pieces are found
35                    backwardMgr.solutionAdded(IntersectionProofNode.this, r);
36                }
37            }
38        }
39    }
40
41    /* forwardProcess has nothing special
42    void forwardProcess() {
43        super.forwardProcess();
44       
45    } */
46} // End of class IntersectionProofNode
47
Note: See TracBrowser for help on using the repository browser.