version-1.30
Last change
on this file since 4adc697 was
8780cbec,
checked in by Jay Jacobs <Jay.Jacobs@…>, 15 years ago
|
ABAC sources from Cobham
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[8780cbec] | 1 | package edu.stanford.peer.rbtm.engine; |
---|
| 2 | |
---|
| 3 | import java.util.*; |
---|
| 4 | import edu.stanford.peer.rbtm.credential.*; |
---|
| 5 | /** |
---|
| 6 | * A map which keeps track of how many partial solutions reach a proof node, |
---|
| 7 | * using a decrementing counter, which is initialized to k for each |
---|
| 8 | * intersection. |
---|
| 9 | */ |
---|
| 10 | public class PartialSolutionMap |
---|
| 11 | { |
---|
| 12 | /** table of decrementing counters, one per intersection */ |
---|
| 13 | HashMap counters = new HashMap(); |
---|
| 14 | |
---|
| 15 | /** get the count of outstanding partial solutions */ |
---|
| 16 | public int getPartialSolutionCount(Intersection inter) { |
---|
| 17 | return ((Integer)counters.get(inter)).intValue(); |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | /** |
---|
| 21 | * decrement the counter by 1 for the specified intersect, creating a |
---|
| 22 | * new counter, if necessary |
---|
| 23 | */ |
---|
| 24 | public boolean addPartialSolution(Intersection inter,EntityExpression expr) |
---|
| 25 | { |
---|
| 26 | int partialSolutionCount = -1; |
---|
| 27 | try { |
---|
| 28 | partialSolutionCount = getPartialSolutionCount(inter); |
---|
| 29 | } catch(NullPointerException nullEx) { |
---|
| 30 | partialSolutionCount = inter.getPartsCount(); |
---|
| 31 | } catch(Exception ex) { |
---|
| 32 | ex.printStackTrace(); |
---|
| 33 | } |
---|
| 34 | counters.put(inter, new Integer(--partialSolutionCount)); |
---|
| 35 | return (partialSolutionCount == 0)? true: false; |
---|
| 36 | } |
---|
| 37 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.