wtanaka.praya.gale
Class Location

java.lang.Object
  |
  +--wtanaka.praya.gale.Location

public class Location
extends java.lang.Object

Represents the "Location" concept, introduced as the "Gale New World Order" with the 0.99danger "dangermouse" release. The brief introduction to the New World Order Gale at http://gale.org/revolution/nwo has some relevant information. Tessa Lau has also created some notes on the so-called Gale NWO at http://fugu.gale.org/protocol.

Return to Sourceforge or the Praya Homepage

Version:
$Name: $ $Date: 2002/03/25 02:09:03 $
Author:
$Author: wtanaka $

Field Summary
 char LOCAL_PART_SEPARATOR
           
private  java.lang.String m_domainPart
           
private  java.lang.String m_fullString
           
private  java.lang.String m_localPart
           
private  java.lang.String[] m_localPieces
           
private  java.lang.String m_originalString
           
 
Constructor Summary
Location(java.lang.String locationString)
          Constructor takes a fully qualified location
Location(java.lang.String locationString, java.lang.String defaultDomain)
          Constructor takes the string representation of a location.
 
Method Summary
 Location[] candidateKeyNames()
          Given this location, for instance "pub.gale@ofb.net", construct the list of candidate key names for this location: pub.gale@ofb.net pub.*@ofb.net *@ofb.net There will always be N+1 candidate key names for a location with N local parts (e.g., "pub" and "gale").
 boolean equals(java.lang.Object o)
           
 java.lang.String getBackwardString()
          Joins the local pieces in reverse order (with the most specific part first), separated by dots, and adds "@domain" to the end.
 java.lang.String getDomainPart()
           
(package private)  java.lang.String getFullString()
           
 java.lang.String getLocalPart()
           
 java.lang.String getLocalPieceAt(int index)
           
 int getNumLocalPieces()
           
 java.lang.String getNWOKeyName()
           
 java.lang.String getOriginalString()
           
 java.lang.String getReversedString()
          Deprecated. use getBackwardString() instead
 int hashCode()
           
private  void makeLocalPieces()
          Helper method for constructors
 Category toCategory()
          Gets the category corresponding to this location.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

m_fullString

private java.lang.String m_fullString

m_domainPart

private java.lang.String m_domainPart

m_localPart

private java.lang.String m_localPart

m_originalString

private java.lang.String m_originalString

m_localPieces

private java.lang.String[] m_localPieces

LOCAL_PART_SEPARATOR

public final char LOCAL_PART_SEPARATOR
Constructor Detail

Location

public Location(java.lang.String locationString)
Constructor takes a fully qualified location
Parameters:
locationString - a string containing exactly one '@' character

Location

public Location(java.lang.String locationString,
                java.lang.String defaultDomain)
Constructor takes the string representation of a location. Assumes that everything after the last '@' symbol is the domain part, and everything before is a dot-separated local part.
Parameters:
locationString - a non-null string representing a location
defaultDomain - a non-null string representing the default domain for locations omitting the domain part.
Method Detail

makeLocalPieces

private void makeLocalPieces()
Helper method for constructors

getOriginalString

public java.lang.String getOriginalString()

getFullString

java.lang.String getFullString()

getBackwardString

public java.lang.String getBackwardString()
Joins the local pieces in reverse order (with the most specific part first), separated by dots, and adds "@domain" to the end. This was the old world order key name, and is still used inside the key for storage.
Returns:
the key name in OWO format.

getReversedString

public java.lang.String getReversedString()
Deprecated. use getBackwardString() instead


getNWOKeyName

public java.lang.String getNWOKeyName()

getLocalPart

public java.lang.String getLocalPart()

getLocalPieceAt

public java.lang.String getLocalPieceAt(int index)

getNumLocalPieces

public int getNumLocalPieces()

getDomainPart

public java.lang.String getDomainPart()

candidateKeyNames

public Location[] candidateKeyNames()
Given this location, for instance "pub.gale@ofb.net", construct the list of candidate key names for this location: There will always be N+1 candidate key names for a location with N local parts (e.g., "pub" and "gale").

toCategory

public Category toCategory()
Gets the category corresponding to this location.
Returns:
a Category corresponding to this location.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object