SMWDINumber Class Reference
[SMWDataItems]

This class implements number data items. More...

Inherits SMWDataItem.

List of all members.

Public Member Functions

 __construct ($number)
 getDIType ()
 Convenience method that returns a constant that defines the concrete class that implements this data item.
 getNumber ()
 getSortKey ()
 Return a value that can be used for sorting data of this type.
 getSortKeyDataItem ()
 getSerialization ()
 Get a UTF-8 encoded string serialization of this data item.

Static Public Member Functions

static doUnserialize ($serialization)
 Create a data item from the provided serialization string and type ID.

Protected Attributes

 $m_number


Detailed Description

This class implements number data items.

Since:
1.6
Author:
Markus Krötzsch

Definition at line 15 of file SMW_DI_Number.php.


Constructor & Destructor Documentation

SMWDINumber::__construct ( number  ) 

Definition at line 23 of file SMW_DI_Number.php.


Member Function Documentation

SMWDINumber::getDIType (  ) 

Convenience method that returns a constant that defines the concrete class that implements this data item.

Used to switch when processing data items.

Returns:
integer that specifies the basic type of data item

Reimplemented from SMWDataItem.

Definition at line 30 of file SMW_DI_Number.php.

References SMWDataItem::TYPE_NUMBER.

SMWDINumber::getNumber (  ) 

Definition at line 34 of file SMW_DI_Number.php.

SMWDINumber::getSortKey (  ) 

Return a value that can be used for sorting data of this type.

If the data is of a numerical type, the sorting must be done in numerical order. If the data is a string, the data must be sorted alphabetically.

Note:
Every data item returns a sort key, even if there is no natural linear order for the type. SMW must order listed data in some way in any case. If there is a natural order (e.g. for Booleans where false < true), then the sortkey must agree with this order (e.g. for Booleans where false maps to 0, and true maps to 1).

Wiki pages are a special case in SMW. They are ordered by a sortkey that is assigned to them as a property value. When pages are sorted, this data should be used if possible.

Returns:
float or string

Reimplemented from SMWDataItem.

Definition at line 38 of file SMW_DI_Number.php.

SMWDINumber::getSortKeyDataItem (  ) 

See also:
SMWDataItem::getSortKeyDataItem()
Returns:
SMWDataItem

Reimplemented from SMWDataItem.

Definition at line 46 of file SMW_DI_Number.php.

SMWDINumber::getSerialization (  ) 

Get a UTF-8 encoded string serialization of this data item.

The serialisation should be concise and need not be pretty, but it must allow unserialization. Each subclass of SMWDataItem implements a static method doUnserialize() for this purpose.

Returns:
string

Reimplemented from SMWDataItem.

Definition at line 50 of file SMW_DI_Number.php.

static SMWDINumber::doUnserialize ( serialization  )  [static]

Create a data item from the provided serialization string and type ID.

Note:
PHP can convert any string to some number, so we do not do validation here (because this would require less efficient parsing).
Returns:
SMWDINumber

Definition at line 61 of file SMW_DI_Number.php.

Referenced by SMWCompatibilityHelpers::dataItemFromDBKeys().


Member Data Documentation

SMWDINumber::$m_number [protected]

Definition at line 21 of file SMW_DI_Number.php.


The documentation for this class was generated from the following file:

Generated on Sun Mar 18 07:15:43 2012 for Semantic MediaWiki by  doxygen 1.5.6