[8780cbec] | 1 | package com.nailabs.abac.process; |
---|
| 2 | |
---|
| 3 | import com.nailabs.abac.trust.*; |
---|
| 4 | import com.nailabs.abac.test.*; |
---|
| 5 | |
---|
| 6 | public class IntersectionEdge extends EdgeOperation { |
---|
| 7 | |
---|
| 8 | /** Jared: Added this method to make XML processing easier */ |
---|
| 9 | public IntersectionEdge() { |
---|
| 10 | super(); |
---|
| 11 | type = new String("Intersection"); |
---|
| 12 | } |
---|
| 13 | |
---|
| 14 | public IntersectionEdge(Goal parent, Goal child, ProcessingState state) { |
---|
| 15 | super(parent, child, state, null); |
---|
| 16 | //TBD: add extra type checking--verify child is a part of the and-ing |
---|
| 17 | type = new String("Intersection"); |
---|
| 18 | Debug.debug("intersection", toString()); |
---|
| 19 | } |
---|
| 20 | |
---|
| 21 | public void performAdditional(TTG graph) { |
---|
| 22 | IntersectionTTNode parent = |
---|
| 23 | (IntersectionTTNode)graph.getNodeByHash(getParent()); |
---|
| 24 | TargetNode child = (TargetNode)graph.getNodeByHash(getChild()); |
---|
| 25 | |
---|
| 26 | parent.addIntersectionChild(child); |
---|
| 27 | child.addImplicationParent(parent); |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | public void performNewAdditional(TTG graph) { |
---|
| 31 | TargetNode child = (TargetNode)graph.getNodeByHash(getChild()); |
---|
| 32 | if(child == null) { |
---|
| 33 | Debug.debug("intersection", "child = " + child); |
---|
| 34 | child = (TargetNode)TTGNode.createNode(getChild()); |
---|
| 35 | child.getProcessingState().update(state); |
---|
| 36 | graph.putNodeByHash(child); |
---|
| 37 | } |
---|
| 38 | performAdditional(graph); |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | public String toString() { |
---|
| 42 | StringBuffer buff = new StringBuffer("["); |
---|
| 43 | buff.append(type).append("Edge "); |
---|
| 44 | buff.append(getParent()).append(" <<=== "); |
---|
| 45 | buff.append(getChild()).append(", state = "); |
---|
| 46 | buff.append(state).append("]"); |
---|
| 47 | return buff.toString(); |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | } |
---|