Index: fedd/abac-src/ttg/trust/TrustTarget.java
===================================================================
--- fedd/abac-src/ttg/trust/TrustTarget.java	(revision 8780cbecc6db2bdc2b9ef31eec6e5209ad3bff15)
+++ fedd/abac-src/ttg/trust/TrustTarget.java	(revision 8780cbecc6db2bdc2b9ef31eec6e5209ad3bff15)
@@ -0,0 +1,135 @@
+package com.nailabs.abac.trust;
+
+import com.nailabs.abac.process.*;
+import edu.stanford.peer.rbtm.credential.*;
+import java.util.*;
+
+/**
+ * An instance of this class repsent a trust target of the form: <BR>
+ * <CENTER> &lt;V: e &lt;-- S &gt; </CENTER> <BR>
+ * where V is on the negotiators; 
+ * e is a role expression called the target role; and
+ * S is a role expression called the subject role. S is frequently the 
+ * opponent negotiator of V.
+ */
+public class TrustTarget extends Goal {
+
+    /** The target expression of this trust target */
+    protected EntityExpression targetRole;
+
+
+    /** Itemized default constructor */
+    public TrustTarget(Entity v, EntityExpression e, EntityExpression s) 
+	throws TrustTargetParsingException, CredentialParsingException {
+	verifier = v;
+	targetRole = e;
+	subject = s;
+    }
+
+    /** Construct a new trust target from a string */
+    public TrustTarget(String s) 
+	throws TrustTargetParsingException, CredentialParsingException {
+	StringTokenizer st = new StringTokenizer(s, ":<?-");
+	if(st.countTokens() < 3) 
+	    throw new TrustTargetParsingException("Too few elements!", s);
+	verifier = (Entity)	    
+	    StaticCredential.getEntityExpression(st.nextToken().trim());
+	targetRole = 
+	    StaticCredential.getEntityExpression(st.nextToken().trim());
+	subject = 
+	    StaticCredential.getEntityExpression(st.nextToken().trim());
+    }
+
+    /** Unique hash function based on a verifier-target-subject triplet */
+    public int hashCode() {
+	return verifier.hashCode() * 4 + targetRole.hashCode() * 2 + 
+	    subject.hashCode();
+    }
+
+
+    /** accessor method for the target role expressin of this target */
+    public EntityExpression getTargetRole() { return targetRole; }
+
+
+    public String getType() {
+        if(targetRole instanceof Role) {
+            return new String("RoleTarget");
+        }
+        else if(targetRole instanceof LinkedRole) {
+            return new String("LinkedRoleTarget");
+        }
+        else if(targetRole instanceof Intersection) {
+            return new String("IntersectionTarget");
+        }
+        else if(targetRole instanceof Entity) {
+            return new String("TrivialTarget");
+        }
+        return new String("TrustTarget");
+    }
+
+    public ProcessingState getInitialProcessingState(NegotiationContext ctx) {
+        if(targetRole instanceof Entity) { // trivial trust target
+            return new ProcessingState(true, true);
+        }
+        else if(targetRole instanceof Role) { // simple trust target
+            RoleName r = ((Role)targetRole).getName();
+            if(ctx.subjectTracesAll(r))
+                return new ProcessingState(true, false);
+            else
+                return new ProcessingState(false, true);
+        }
+        else if(targetRole instanceof LinkedRole) { // linked role trust target
+            RoleName r1 = ((LinkedRole)targetRole).getFirstRole().getName();
+            RoleName r2 = ((LinkedRole)targetRole).getSecondRoleName();
+            if(ctx.subjectTracesAll(r1) && ctx.subjectTracesAll(r2)) {
+                return new ProcessingState(true, false);
+            }
+            else {
+                return new ProcessingState(false, true);
+            }
+        }
+        else if(targetRole instanceof Intersection) { // intersection TT
+            if(ctx.getSelf().equals(getVerifier())) {
+                return new ProcessingState(false, true);
+            } else {
+                return new ProcessingState(true, false);
+            }
+        }
+        return new ProcessingState();
+    }
+
+    public String toString() {
+	StringBuffer buff = new StringBuffer();
+	buff.append(getVerifier().toString()).append(": ");
+	buff.append(getTargetRole().toString());
+	buff.append(" <<-?- ").append(getSubject().toString());
+	//buff.append("]");
+	return buff.toString();
+    }
+
+    public String toXML() {
+    /*    
+	StringBuffer buff = new StringBuffer("<TrustTarget>\n");
+	buff.append("\t<Verifier>");
+	buff.append(getVerifier().toString());
+	buff.append("</Verifier>\n");
+	buff.append("\t<Target>");
+	buff.append(getTargetRole().toString());
+	buff.append("</Target>\n");
+	buff.append("\t<Subject>");
+	buff.append(getSubject().toString());
+	buff.append("</Subject>\n");
+	buff.append("</TrustTarget>\n");
+	return buff.toString();	
+    */
+        return toString().replaceAll("<","&lt;");
+    }
+}
+
+
+
+
+
+
+
+
