Unit
Inheritance: java.lang.Object
public class Unit
Represents a length measurement
Constructors
| Constructor | Description |
|---|---|
| Unit() | the default constructor |
| Unit(double value, int type) | Initializes a new instance of the Unit structure with the specified double precision floating point number and UnitType. |
| Unit(double value) | Initializes a new instance of the Unit structure with the specified double precision floating point number. |
| Unit(int value) | Initializes a new instance of the Unit structure with the specified 32-bit signed integer. |
| Unit(String value) | Initializes a new instance of the Unit structure with the specified length. |
Methods
| Method | Description |
|---|---|
| equals(Object arg0) | |
| getClass() | |
| getExtension(int type) | get string by the type,may get “px” “pt” “%” and so one; |
| getType() | Gets the unit type of the Unit. |
| getValue() | Gets the length of the Unit. |
| hashCode() | |
| isEmpty() | Gets a value indicating whether the Unit is empty. |
| notify() | |
| notifyAll() | |
| parse(String s) | Converts the specified string to a Unit. |
| percentage(double n) | Creates a Unit of type Percentage from the specified double-precision floating-point number. |
| pixel(int n) | Creates a Unit of type Pixel from the specified 32-bit signed integer. |
| point(int n) | Creates a Unit of type Point from the specified 32-bit signed integer. |
| toString() | get string representation of the unit. |
| wait() | |
| wait(long arg0) | |
| wait(long arg0, int arg1) |
Unit()
public Unit()
the default constructor
Unit(double value, int type)
public Unit(double value, int type)
Initializes a new instance of the Unit structure with the specified double precision floating point number and UnitType.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | double | |
| type | int |
Unit(double value)
public Unit(double value)
Initializes a new instance of the Unit structure with the specified double precision floating point number.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | double |
Unit(int value)
public Unit(int value)
Initializes a new instance of the Unit structure with the specified 32-bit signed integer.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | int |
Unit(String value)
public Unit(String value)
Initializes a new instance of the Unit structure with the specified length.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | java.lang.String |
equals(Object arg0)
public boolean equals(Object arg0)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| arg0 | java.lang.Object |
Returns: boolean
getClass()
public final native Class<?> getClass()
Returns: java.lang.Class
getExtension(int type)
public static String getExtension(int type)
get string by the type,may get “px” “pt” “%” and so one;
Parameters:
| Parameter | Type | Description |
|---|---|---|
| type | int |
Returns: java.lang.String
getType()
public int getType()
Gets the unit type of the Unit.
Returns: int
getValue()
public double getValue()
Gets the length of the Unit.
Returns: double
hashCode()
public native int hashCode()
Returns: int
isEmpty()
public boolean isEmpty()
Gets a value indicating whether the Unit is empty.
Returns: boolean -
notify()
public final native void notify()
notifyAll()
public final native void notifyAll()
parse(String s)
public static Unit parse(String s)
Converts the specified string to a Unit.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| s | java.lang.String |
Returns: Unit
percentage(double n)
public static Unit percentage(double n)
Creates a Unit of type Percentage from the specified double-precision floating-point number.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| n | double |
Returns: Unit
pixel(int n)
public static Unit pixel(int n)
Creates a Unit of type Pixel from the specified 32-bit signed integer.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| n | int |
Returns: Unit
point(int n)
public static Unit point(int n)
Creates a Unit of type Point from the specified 32-bit signed integer.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| n | int |
Returns: Unit
toString()
public String toString()
get string representation of the unit.
Returns: java.lang.String
wait()
public final void wait()
wait(long arg0)
public final native void wait(long arg0)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| arg0 | long |
wait(long arg0, int arg1)
public final void wait(long arg0, int arg1)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| arg0 | long | |
| arg1 | int |