cds.simbad.data
Class Zone

java.lang.Object
  extended bycds.simbad.data.Zone

public class Zone
extends java.lang.Object

Class managing a zone from +90 .. +00,-00 .. -90. This class manages an internal codage of zones from 0 =>+90 to 181 => -90
It considers increasing zones from the north pole to the south pole

Version:
22 janv. 2004
Author:
Marc Wenger/CDS

Field Summary
(package private)  boolean minus
           
(package private)  int zone
           
 
Constructor Summary
Zone(int zona)
          Constructor from an absolute zone number
Zone(int z, boolean min)
          Constructor from a zone number (+90 to -90)
Zone(java.lang.String str)
          Constructor from a string.
Zone(Zone z)
          Copy constructor
 
Method Summary
 int compareTo(Zone z)
          Compares two zone values. zone A is higher than zone B if it is closer to the North Pole.
 int getAbsZone()
          The value of the absolute zone number (0=90, 90=+0, 91=-0, 180=-89, 181=-90)
 int getZone()
          The zone value (+90 to -90).
 boolean isNegative()
          Get the sign of the zone. true if negative
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

zone

int zone

minus

boolean minus
Constructor Detail

Zone

public Zone(java.lang.String str)
Constructor from a string. Quite the only way to analyze +00 and -00

Parameters:
str - String containing a zone value. No sign means +. No more digits are taken than needed to build a number <= 90.

Zone

public Zone(Zone z)
Copy constructor

Parameters:
z - Zone object

Zone

public Zone(int zona)
Constructor from an absolute zone number

Parameters:
zona - zone number (from 0 to 181)

Zone

public Zone(int z,
            boolean min)
Constructor from a zone number (+90 to -90)

Parameters:
z - the zone value
min - true if the zone is negative. This parameter is used only for a zone value >= 0. If it is negative, the zone IS considererd as negative.
Method Detail

getAbsZone

public int getAbsZone()
The value of the absolute zone number (0=90, 90=+0, 91=-0, 180=-89, 181=-90)

Returns:
the zone number (always positive, between 0 and 181)

getZone

public int getZone()
The zone value (+90 to -90). Be carefull: 0 can be +00 or -00. to decide, you must get also the sign (isNegative() method)

Returns:
the zone between -90 and +90

isNegative

public boolean isNegative()
Get the sign of the zone. true if negative

Returns:
true if the zone is negative

compareTo

public int compareTo(Zone z)
Compares two zone values. zone A is higher than zone B if it is closer to the North Pole.

Parameters:
z - the second zone for the comparizon
Returns:
a positive value if this > z, 0 if this == z and a negative value if this < z

toString

public java.lang.String toString()