source: fedd/abac-src/ttg/trust/TTGNodeSet.java @ c2dbca8

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

ABAC sources from Cobham

  • Property mode set to 100644
File size: 1.2 KB
Line 
1package com.nailabs.abac.trust;
2
3import edu.stanford.peer.rbtm.credential.*;
4import java.util.*;
5
6/**
7 * Place holder for sets of nodes. An internal index keeps track of nodes
8 * as new ones are added to the set. Future versions may implement a sorting
9 * algorithm for nodes.
10 */
11public class TTGNodeSet extends HashMap {
12   
13    /** index of nodes that have been enqueued for processing */
14    protected LinkedList index = new LinkedList();
15
16    /** add a single trust target graph node to the set */
17    public boolean add(TTGNode node) {
18        boolean isNew = containsValue(node);
19
20        if(node == null) {
21            System.out.println("Attempting to add null node!!");
22            return false;
23        }
24        if(isNew) {
25            System.out.println("Duplicate node in set. " + node.getGoal());
26            index.add(node);
27        } 
28        put(node.getGoal(), node);
29        return isNew;
30    }
31
32    /** adds a set of nodes to the set */
33    public boolean addAll(TTGNodeSet set) {
34        boolean result = false;
35        Iterator i = set.values().iterator();
36        while(i.hasNext()) {
37            TTGNode node = (TTGNode)i.next();
38            result = (result || add(node));
39        }
40        return result;
41    }
42
43    public Object getFirst() {
44        return index.getFirst();
45    }
46
47    public Object getLast() {
48        return index.getLast();
49    }
50}
51
52
53
54
Note: See TracBrowser for help on using the repository browser.