source: fedd/abac-src/ttg/process/ImplicationEdge.java @ 79b6596

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

ABAC sources from Cobham

  • Property mode set to 100644
File size: 2.7 KB
RevLine 
[8780cbec]1package com.nailabs.abac.process;
2
3import com.nailabs.abac.trust.*;
4import com.nailabs.abac.test.*;
5import java.util.*;
6
7/**
8 * An implication edge represents an edge in a trust target graph
9 * (<CODE>TTG</CODE>) with accompanying evidence. An implication edge
10 * is proved by a set of credentials (i.e. a chain).
11 */
12public class ImplicationEdge extends EdgeOperation {
13   
14    /** Jared: Added this method to make XML processing easier */
15    public ImplicationEdge() {
16        super();
17        type = new String("Implication");
18    }
19   
20    /**
21     * Default constructor
22     * @param parent an upcast StandardTTNode
23     * @param child an upcast TargetNode
24     */
25    public ImplicationEdge(Goal parent, Goal child, ProcessingState state,
26                           HashSet evidence) {
27        super(parent, child, state, evidence);
28        type = new String("Implication");
29        debug("edge", "state = " + state );
30    }
31
32    public void performAdditional(TTG graph) {
33        StandardTTNode parent=(StandardTTNode)graph.getNodeByHash(getParent());
34        TargetNode child = (TargetNode)graph.getNode(getChild());
35        debug("perform", "performing " + toString(parent, child));
36        parent.addImplicationChild(child);
37        child.addImplicationParent(parent);
38        //propagate satisfaction for all nodes
39        int satisfaction = child.getSatisfactionValue();
40        debug("perform",  "child is satified =  " + 
41                           (satisfaction == SatisfactionState.SATISFIED));
42        //if(child instanceof TrivialTTNode)
43        //parent.receive((TrustTarget)child.getGoal(),
44        //new SatisfactionState(satisfaction));
45    }
46
47    public void performNewAdditional(TTG graph) {
48        TTGNode child = graph.getNodeByHash(getChild());
49        if(child == null) {
50            child = TTGNode.createNode(getChild());
51            debug("newop", performNewInfo());
52            // set processing if necessary here
53            if(state != null) {
54                child.getProcessingState().update(state);
55            } else {
56                debug("newop", "warning perform new additional has no state");
57            }
58            graph.putNodeByHash(child);
59        }
60        performAdditional(graph);
61    }
62   
63    /** Friendly debugging convenience method */
64    protected void debug(String level, String message) {
65        StringBuffer buff = new StringBuffer("ImplicationEdge: ");
66        buff.append(message);
67        Debug.debug(level, buff.toString());
68    }
69
70
71    public String toString(StandardTTNode parent, TargetNode child) {
72        StringBuffer buff = new StringBuffer("[ImplicationEdge  ");
73        buff.append(parent).append(" <<=== ");
74        buff.append(child);
75        return buff.toString();
76    }
77
78    public String toString() {
79        StringBuffer buff = new StringBuffer("[ImplicationEdge  ");
80        buff.append(getParent()).append(" <<=== ");
81        buff.append(getChild()).append(", state = ");
82        buff.append(state).append(", evidence = ");
83    buff.append(getEvidence());
84        return buff.toString();
85    }
86
87}
88
Note: See TracBrowser for help on using the repository browser.