fiftyone.mobile.detection.entities
Class Value

java.lang.Object
  extended by fiftyone.mobile.detection.entities.BaseEntity
      extended by fiftyone.mobile.detection.entities.Value
All Implemented Interfaces:
Comparable<Value>

public class Value
extends BaseEntity
implements Comparable<Value>

A value associated with a property and component within the dataset.


Field Summary
private  Boolean asBool
           
private  Double asNumber
           
private  String description
           
private  int descriptionIndex
           
private  String name
           
private  int nameIndex
           
private  Profile[] profiles
           
private  Property property
           
(package private)  int propertyIndex
           
static int RECORD_LENGTH
           
private  Signature[] signatures
           
private  URL url
           
private  int urlIndex
           
 
Constructor Summary
Value(Dataset dataSet, int index, BinaryReader reader)
          Constructs a new instance of Value
 
Method Summary
 int compareTo(Value other)
          Compares this value to another using the index field if they're in the same list other wise the name value.
 Component getComponent()
          The component the value relates to.
 String getDescription()
          A description of the value suitable to be displayed to end users via a user interface.
 boolean getIsDefault()
          Returns true if the value is the null value for the property.
 String getName()
          The name of the value.
 Profile[] getProfiles()
          Array containing the profiles the value is associated with.
private  Profile[] GetProfiles()
          Gets all the profiles associated with the value.
 Property getProperty()
          The property the value relates to.
 Signature[] getSignatures()
          Array containing the signatures that the value is associated with.
private  Signature[] GetSignatures()
          Gets all the signatures associated with the value.
 URL getUrl()
          A url to more information about the value.
 void init()
          Called after the entire data set has been loaded to ensure any further initialisation steps that require other items in the data set can be completed.
 boolean toBool()
          Returns the value as a boolean.
 double toDouble()
          Returns the value as a number.
 String toString()
          Returns the value as a string.
 
Methods inherited from class fiftyone.mobile.detection.entities.BaseEntity
binarySearch, getDataSet, getIndex, readIntegerArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RECORD_LENGTH

public static final int RECORD_LENGTH
See Also:
Constant Field Values

name

private String name

nameIndex

private final int nameIndex

signatures

private Signature[] signatures

profiles

private Profile[] profiles

property

private Property property

propertyIndex

final int propertyIndex

description

private String description

descriptionIndex

private final int descriptionIndex

url

private URL url

urlIndex

private final int urlIndex

asNumber

private Double asNumber

asBool

private Boolean asBool
Constructor Detail

Value

public Value(Dataset dataSet,
             int index,
             BinaryReader reader)
Constructs a new instance of Value

Parameters:
dataSet - The data set the value is contained within
index - The index in the data structure to the value
reader - Reader connected to the source data structure and positioned to start reading
Method Detail

getName

public String getName()
               throws IOException
The name of the value.

Throws:
IOException

getSignatures

public Signature[] getSignatures()
                          throws IOException
Array containing the signatures that the value is associated with.

Throws:
IOException

getProfiles

public Profile[] getProfiles()
                      throws IOException
Array containing the profiles the value is associated with.

Throws:
IOException

getProperty

public Property getProperty()
                     throws IOException
The property the value relates to.

Throws:
IOException

getComponent

public Component getComponent()
                       throws IOException
The component the value relates to.

Throws:
IOException

getDescription

public String getDescription()
                      throws IOException
A description of the value suitable to be displayed to end users via a user interface.

Throws:
IOException

getUrl

public URL getUrl()
           throws IOException
A url to more information about the value.

Throws:
IOException

init

public void init()
          throws IOException
Called after the entire data set has been loaded to ensure any further initialisation steps that require other items in the data set can be completed. The Profiles and Signatures are not initialised as they are very rarely used and take a long time to initialise.

Throws:
IOException

GetProfiles

private Profile[] GetProfiles()
                       throws IOException
Gets all the profiles associated with the value.

Returns:
Returns the profiles from the component that relate to this value
Throws:
IOException

GetSignatures

private Signature[] GetSignatures()
                           throws IOException
Gets all the signatures associated with the value.

Returns:
Returns the signatures associated with the value
Throws:
IOException

compareTo

public int compareTo(Value other)
Compares this value to another using the index field if they're in the same list other wise the name value.

Specified by:
compareTo in interface Comparable<Value>
Parameters:
other - The value to be compared against
Returns:
Indication of relative value based on index field

toString

public String toString()
Returns the value as a string.

Overrides:
toString in class Object
Returns:
the value name as a string

toDouble

public double toDouble()
                throws IOException
Returns the value as a number.

Throws:
IOException

toBool

public boolean toBool()
               throws IOException
Returns the value as a boolean.

Throws:
IOException

getIsDefault

public boolean getIsDefault()
                     throws IOException
Returns true if the value is the null value for the property. If the property has no null value false is always returned.

Returns:
Throws:
IOException