Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## cnrg.itx.ds
Class Location

    java.lang.Object
      |
      +--cnrg.itx.ds.Location

public class Location
extends java.lang.Object
implements java.io.Serializable

This class provides a abstraction of where the application or system is located.
There are 3 properties:
1. Type - type of location: Telephone or Internet or User (e.g. bergmark@cs.cornell.edu, vmailsrv, etc)
2. Value - hostname:port or areacode-phonenumber or userid
3. Label - alias (standard) name of the location. E.g. "home"; "Spot"

See Also:
  Serialized Form

Field Summary
`static int` | `DEFAULT`
`static int` | `DYNAMIC`
`static java.lang.String` | `INTERNET_TYPE`
`static int` | `ROAMING`
`static java.lang.String` | `TELEPHONE_TYPE`
`static java.lang.String` | `USER_TYPE`

Constructor Summary
`Location(Location otherLoc)` Copy constructor
`Location(java.lang.String rawLocationStr)` Constructor for formatted record string retrieved from the directory database.
`Location(java.lang.String type, java.lang.String value, java.lang.String label)` Constructor For telephone: type = Location.TELEPHONE_TYPE; value = Areacode-PhoneNumber; label = "home" e.g.

Method Summary
`java.lang.String[]` | `enumerateValue()` Parses the value of location into a array of string and returns e.g.
`java.lang.String` | `getIP()` Return the hostname address if this location can be directly dialed.
`java.lang.String` | `getLabel()` Get the Location (optional) label
`int` | `getPort()` Return the port number if this location can be directly dialed.
`java.lang.String` | `getType()` Get the Location type
`UserID` | `getUID()` Return the UID of this user-type location (if this is a internet-type location, returns null).
`java.lang.String` | `getValue()` Get the Location value
`boolean` | `isDialable()` Determine if this location can be directly dialed (connected)
`boolean` | `isPhone()` Determine if the Location is destined to the telephone end
`boolean` | `isSameAs(Location otherlocation)` Compares with other location object to determine if they are identical
`void` | `setLabel(java.lang.String label)` Set the Location (optional) label
`java.lang.String` | `toString()` Convert into raw location string format.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### TELEPHONE_TYPE

    public static final java.lang.String TELEPHONE_TYPE

### INTERNET_TYPE

    public static final java.lang.String INTERNET_TYPE

### USER_TYPE

    public static final java.lang.String USER_TYPE

### ROAMING

    public static final int ROAMING

### DEFAULT

    public static final int DEFAULT

### DYNAMIC

    public static final int DYNAMIC

Constructor Detail

### Location

    public Location(Location otherLoc)

  Copy constructor
  Parameters:
    `otherLoc` - other location object

### Location

    public Location(java.lang.String rawLocationStr)

  Constructor for formatted record string retrieved from the directory database. If the record string is not in expected format, the location remains un-initialized.
  Parameters:
    `rawLocationStr` - a raw string from record entry (e.g. "pit052.cs.cornell.edu:5000+I+testapp"; "607-2775627+T"; "vmailsrv+U+voice mail server")

### Location

    public Location(java.lang.String type,
                    java.lang.String value,
                    java.lang.String label)

  Constructor
  For telephone: type = Location.TELEPHONE_TYPE; value = Areacode-PhoneNumber; label = "home"
  e.g. SetLocation(Location.TELEPHONE_TYPE, "607-2551595", "home");
  For internet: type = Location.INTERNET_TYPE; value = hostname:port; label = App. name
  e.g. SetLocation(Location.INTERNET_TYPE, "pnt01.cs.cornell.edu:5001", "Moonlight");
  For user: type = Location.USER_TYPE; value = email OR server; label = [applicable name]
  e.g. SetLocation(Location.USER_TYPE, "bergmark@cs.cornell.edu", "");
  Parameters:
    `type` - type of the location (e.g. Location.TELEPHONE_TYPE or Location.INTERNET_TYPE or Location.USER_TYPE)
    `value` - value of the location
    `label` - label of the location (can be empty)

Method Detail

### isDialable

    public boolean isDialable()

  Determine if this location can be directly dialed (connected)
  Returns:
    Ture if it can be dialied; False otherwise

### getIP

    public java.lang.String getIP()

  Return the hostname address if this location can be directly dialed. Otherwise, return null.
  Returns:
    string value containing the hostname address; null otherwise

### getPort

    public int getPort()

  Return the port number if this location can be directly dialed. Otherwise, returns -1.
  Returns:
    int value containing the port number; -1 otherwise

### getUID

    public UserID getUID()

  Return the UID of this user-type location (if this is a internet-type location, returns null).
  Returns:
    UserID object of the user-type location

### getType

    public java.lang.String getType()

  Get the Location type
  Returns:
    location type in string

### getValue

    public java.lang.String getValue()

  Get the Location value
  Returns:
    location value in string

### getLabel

    public java.lang.String getLabel()

  Get the Location (optional) label
  Returns:
    location label in string

### setLabel

    public void setLabel(java.lang.String label)

  Set the Location (optional) label
  Parameters:
    `label` - location label in string

### isPhone

    public boolean isPhone()

  Determine if the Location is destined to the telephone end
  Returns:
    true if the location is destined to the telephone end; false otherwise

### isSameAs

    public boolean isSameAs(Location otherlocation)

  Compares with other location object to determine if they are identical
  Parameters:
    `otherlocation` - other location object to be compared
  Returns:
    true if identical; false otherwise

### toString

    public java.lang.String toString()

  Convert into raw location string format. Returns empty if the location object's properties are not sufficient enough to form a string.
  Returns:
    string representation of the location object.
  Overrides:
    toString in class java.lang.Object

### enumerateValue

    public java.lang.String[] enumerateValue()

  Parses the value of location into a array of string and returns
  e.g. String[0] = "pnt01.cs.cornell.edu"; String[1] = "5001"
  e.g. String[0] = "607"; String[1] = "2551595"
  e.g. String[0] = "bergmark@cs.cornell.edu"
  Returns:
    an array of string; null if not applicable

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD