HiRISE

HiRISE.HiVali
Class Tag

java.lang.Object
  extended by HiRISE.HiVali.Tag
All Implemented Interfaces:
Comparable<Tag>

public class Tag
extends Object
implements Comparable<Tag>

Represents a tag. A tag has a particular path in the tagsonomy tree (demarked by forward slashes), may contain one or more areas, and may have a plain text comment attached. The only type of area currently supported by this class is a Polygon. Multiple polygons may be added to a tag with the addPolygon method. It is likely that future versions of this class will add circular areas. The default username is determined from the java system property "user.name" but may be overridden with the setUsername method.


Field Summary
static String ID
          CVS ID
 
Constructor Summary
Tag(long id)
          Create a tag with the given database ID.
Tag(String path)
          Create a tag with the given path.
Tag(String path, long id)
          Create a tag with the given path and database ID.
 
Method Summary
 void addPolygon(Polygon polygon)
          Add a polygon to be associated with this Tag.
 int compareTo(Tag tag)
          Compares this tag to another for proper sorting of tag collections.
 boolean equals(Object obj)
          Tests this tag with another Object for equality.
 String getComment()
          Get the comment for this tag.
 long getId()
          Returns the ID, which will be zero if the tag is not in the database
 String getName()
          Return the name portion of this tag, with the leading path removed.
 String getPath()
          Returns the PVL path of this tag.
 List<Polygon> getPolygons()
          Get all the polygons that have been added.
 String getUsername()
          Get the username.
 void setComment(String comment)
          Set the comment for this tag.
 void setId(long id)
          Set the database ID, if known
 void setUsername(String username)
          Override the default username, defined by the system property user.name.
 String toString()
          Returns the string representation of a Tag, which is its PVL path.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ID

public static final String ID
CVS ID

See Also:
Constant Field Values
Constructor Detail

Tag

public Tag(String path)
Create a tag with the given path.

Parameters:
path - The PVL path

Tag

public Tag(long id)
Create a tag with the given database ID.

Parameters:
id - The database ID

Tag

public Tag(String path,
           long id)
Create a tag with the given path and database ID.

Parameters:
id - The database ID
Method Detail

setComment

public void setComment(String comment)
Set the comment for this tag.

Parameters:
comment - Text of comment

getComment

public String getComment()
Get the comment for this tag.

Returns:
comment

getUsername

public String getUsername()
Get the username.

Returns:
username

setUsername

public void setUsername(String username)
Override the default username, defined by the system property user.name.

Parameters:
username - New username

addPolygon

public void addPolygon(Polygon polygon)
Add a polygon to be associated with this Tag.

Parameters:
polygon - Points with x=sample, y=line

getPolygons

public List<Polygon> getPolygons()
Get all the polygons that have been added.

Returns:
list of Polygons

toString

public String toString()
Returns the string representation of a Tag, which is its PVL path.

Overrides:
toString in class Object
Returns:
PVL path

getPath

public String getPath()
Returns the PVL path of this tag.

Returns:
PVL path

getName

public String getName()
Return the name portion of this tag, with the leading path removed.

Returns:
name

getId

public long getId()
Returns the ID, which will be zero if the tag is not in the database

Returns:
tag ID

setId

public void setId(long id)
Set the database ID, if known

Parameters:
id - index value

equals

public boolean equals(Object obj)
Tests this tag with another Object for equality. If the object is a tag with the same path, then they are equal.

Overrides:
equals in class Object
Parameters:
obj - Any object
Returns:
True of object is a tag with the same path

compareTo

public int compareTo(Tag tag)
Compares this tag to another for proper sorting of tag collections.

Specified by:
compareTo in interface Comparable<Tag>
Parameters:
tag - another
Returns:
delegates to string comparison on paths

HiRISE

Copyright (C) Arizona Board of Regents on behalf of the Planetary Image Research Laboratory, Lunar and Planetary Laboratory at the University of Arizona