jsdsi
Class Name

java.lang.Object
  extended byjsdsi.Obj
      extended byjsdsi.Name
All Implemented Interfaces:
java.io.Serializable, Subject

public class Name
extends Obj
implements Subject

A SDSI name: a principal and a sequence of strings. If the sequence contains just one string, this is a local name; otherwise this is an extended name.

Version:
$Revision: 1.3.2.1 $ $Date: 2005/11/08 03:12:52 $
Author:
Sameer Ajmani, Sean Radford
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class jsdsi.Subject
Subject.Default
 
Field Summary
 
Fields inherited from class jsdsi.Obj
_obj
 
Constructor Summary
Name(Principal i, java.lang.String n)
          Creates a new local name from a given principal and name-string.
Name(Principal i, java.lang.String[] n)
          Creates a new Name for a given principal and an array of name-strings.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 Principal getIssuer()
          Returns the principal of the Name.
 java.lang.String[] getNames()
          Returns an array of name-strings of this Name (the array has a length of one in the case of a local name, and greater then 1 for extended names).
 int hashCode()
           
 Name prefix()
          Returns the local name of this name, that is a Name for this Names issuer with the first name-string of the list of names.
 Name prefix(int i)
          Creates a new Name from this Name using only the first i name-strings.
 boolean prefixOf(Name n)
          Checks if a given Name has the same issuer (principal) as this Name and if the name-strings are equal to this name's name-strings (a smaller number of name-strings are okay).
 SexpList toSexp()
          Creates an SexpList -representation from this SDSI-object.
 SexpList toSexp(Principal iss)
          Returns an SexpList-representation of the given Principal.
 
Methods inherited from class jsdsi.Obj
parseObj, parseObj, readResolve, toByteArray, toString, toString, toTransport
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Name

public Name(Principal i,
            java.lang.String[] n)
Creates a new Name for a given principal and an array of name-strings.

Parameters:
i - principal to create the Name for.
n - array of string-names for this Name (if the length of n is greater than 1, an extended name will be created).

Name

public Name(Principal i,
            java.lang.String n)
Creates a new local name from a given principal and name-string.

Parameters:
i - principal to create the Name for.
n - name-string to create the Name for.
Method Detail

getIssuer

public Principal getIssuer()
Returns the principal of the Name.

Returns:
the principal of this Name.

getNames

public java.lang.String[] getNames()
Returns an array of name-strings of this Name (the array has a length of one in the case of a local name, and greater then 1 for extended names).

Returns:
an array of strings containing the name-string(s) of this name (more than one string for an extended string).

prefixOf

public boolean prefixOf(Name n)
Checks if a given Name has the same issuer (principal) as this Name and if the name-strings are equal to this name's name-strings (a smaller number of name-strings are okay).

Parameters:
n - Name to compare with this Name.
Returns:
false if n has another issuer, a greater number of name-strings or if one name-string is not equal if a name-string from this Name, returns true otherwise.

prefix

public Name prefix(int i)
Creates a new Name from this Name using only the first i name-strings.

Parameters:
i - number of name-strings of this Name to use for creating a new Name.
Returns:
the new Name for the same principal as this Name using only the first i name-strings.

prefix

public Name prefix()
Returns the local name of this name, that is a Name for this Names issuer with the first name-string of the list of names.

Returns:
the new local name for this Name.

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in class Obj
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Specified by:
hashCode in class Obj
See Also:
Object.hashCode()

toSexp

public SexpList toSexp()
Description copied from class: Obj
Creates an SexpList -representation from this SDSI-object.

Specified by:
toSexp in interface Subject
Specified by:
toSexp in class Obj
Returns:
an SexpList that represents this SDSI-object.

toSexp

public SexpList toSexp(Principal iss)
Returns an SexpList-representation of the given Principal.

Parameters:
iss - the Principal to create an SexpList from.
Returns:
an SexpList-representation of iss.


Copyright © 2002-2006 JSDSI. All Rights Reserved.