ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilADTFloat Class Reference
+ Inheritance diagram for ilADTFloat:
+ Collaboration diagram for ilADTFloat:

Public Member Functions

 reset ()
 
 setNumber ($a_value=null)
 
 getNumber ()
 
 equals (ilADT $a_adt)
 
 isLarger (ilADT $a_adt)
 
 isSmaller (ilADT $a_adt)
 
 isNull ()
 
 isValid ()
 
 getCheckSum ()
 
 exportStdClass ()
 
 importStdClass (?stdClass $a_std)
 
- Public Member Functions inherited from ilADT
 __construct (ilADTDefinition $a_def)
 
 getType ()
 Get type (from class/instance) More...
 
 reset ()
 Init property defaults. More...
 
 getCopyOfDefinition ()
 Get copy of definition. More...
 
 equals (ilADT $a_adt)
 Check if given ADT equals self. More...
 
 isLarger (ilADT $a_adt)
 Check if given ADT is larger than self. More...
 
 isLargerOrEqual (ilADT $a_adt)
 
 isSmaller (ilADT $a_adt)
 Check if given ADT is smaller than self. More...
 
 isSmallerOrEqual (ilADT $a_adt)
 Check if given ADT is smaller or equal than self. More...
 
 isInbetween (ilADT $a_adt_from, ilADT $a_adt_to)
 Check if self is inbetween given ADTs (exclusive) More...
 
 isInbetweenOrEqual (ilADT $a_adt_from, ilADT $a_adt_to)
 Check if self is inbetween given ADTs (inclusive) More...
 
 isNull ()
 Is currently null. More...
 
 isValid ()
 
 getValidationErrors ()
 Get all validation error codes. More...
 
 translateErrorCode (string $a_code)
 Translate error-code to human-readable message. More...
 
 getCheckSum ()
 Get unique checksum. More...
 
 exportStdClass ()
 Export value as stdClass. More...
 
 importStdClass (?stdClass $a_std)
 Import value from stdClass. More...
 

Protected Member Functions

 isValidDefinition (ilADTDefinition $a_def)
 
- Protected Member Functions inherited from ilADT
 isValidDefinition (ilADTDefinition $a_def)
 Check if definition is valid for ADT. More...
 
 setDefinition (ilADTDefinition $a_def)
 Set definition. More...
 
 getDefinition ()
 Get definition. More...
 
 addValidationError (string $a_error_code)
 

Protected Attributes

float $value
 
- Protected Attributes inherited from ilADT
ilADTDefinition $definition
 
ilLanguage $lng
 
array $validation_errors = []
 

Additional Inherited Members

- Data Fields inherited from ilADT
const ADT_VALIDATION_ERROR_NULL_NOT_ALLOWED = "adt1"
 
const ADT_VALIDATION_ERROR_MAX_LENGTH = "adt2"
 
const ADT_VALIDATION_ERROR_MAX_SIZE = "adt3"
 
const ADT_VALIDATION_ERROR_MIN = "adt4"
 
const ADT_VALIDATION_ERROR_MAX = "adt5"
 
const ADT_VALIDATION_DATE = "adt6"
 
const ADT_VALIDATION_ERROR_INVALID_NODE = 'adt7'
 

Detailed Description

Definition at line 20 of file class.ilADTFloat.php.

Member Function Documentation

◆ equals()

ilADTFloat::equals ( ilADT  $a_adt)

Definition at line 52 of file class.ilADTFloat.php.

References ilADT\getDefinition(), getNumber(), and null.

52  : ?bool
53  {
54  if ($this->getDefinition()->isComparableTo($a_adt)) {
55  return ($this->getNumber() == $a_adt->getNumber());
56  }
57  return null;
58  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getDefinition()
Get definition.
+ Here is the call graph for this function:

◆ exportStdClass()

ilADTFloat::exportStdClass ( )

Definition at line 113 of file class.ilADTFloat.php.

References getNumber(), isNull(), and null.

113  : ?stdClass
114  {
115  if (!$this->isNull()) {
116  $obj = new stdClass();
117  $obj->value = $this->getNumber();
118  return $obj;
119  }
120  return null;
121  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getCheckSum()

ilADTFloat::getCheckSum ( )

Definition at line 103 of file class.ilADTFloat.php.

References getNumber(), isNull(), and null.

103  : ?string
104  {
105  if (!$this->isNull()) {
106  return (string) $this->getNumber();
107  }
108  return null;
109  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ getNumber()

ilADTFloat::getNumber ( )

Definition at line 45 of file class.ilADTFloat.php.

References $value.

Referenced by equals(), exportStdClass(), getCheckSum(), isLarger(), isNull(), isSmaller(), and isValid().

45  : ?float
46  {
47  return $this->value;
48  }
+ Here is the caller graph for this function:

◆ importStdClass()

ilADTFloat::importStdClass ( ?stdClass  $a_std)

Definition at line 123 of file class.ilADTFloat.php.

References setNumber().

123  : void
124  {
125  if (is_object($a_std)) {
126  $this->setNumber($a_std->value);
127  }
128  }
setNumber($a_value=null)
+ Here is the call graph for this function:

◆ isLarger()

ilADTFloat::isLarger ( ilADT  $a_adt)

Definition at line 60 of file class.ilADTFloat.php.

References ilADT\getDefinition(), getNumber(), and null.

60  : ?bool
61  {
62  if ($this->getDefinition()->isComparableTo($a_adt)) {
63  return ($this->getNumber() > $a_adt->getNumber());
64  }
65  return null;
66  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getDefinition()
Get definition.
+ Here is the call graph for this function:

◆ isNull()

ilADTFloat::isNull ( )

Definition at line 78 of file class.ilADTFloat.php.

References getNumber(), and null.

Referenced by exportStdClass(), and getCheckSum().

78  : bool
79  {
80  return $this->getNumber() === null;
81  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSmaller()

ilADTFloat::isSmaller ( ilADT  $a_adt)

Definition at line 68 of file class.ilADTFloat.php.

References ilADT\getDefinition(), getNumber(), and null.

68  : ?bool
69  {
70  if ($this->getDefinition()->isComparableTo($a_adt)) {
71  return ($this->getNumber() < $a_adt->getNumber());
72  }
73  return null;
74  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getDefinition()
Get definition.
+ Here is the call graph for this function:

◆ isValid()

ilADTFloat::isValid ( )

Definition at line 83 of file class.ilADTFloat.php.

References $valid, ilADT\addValidationError(), ilADT\getDefinition(), getNumber(), and null.

83  : bool
84  {
85  $valid = parent::isValid();
86  $num = $this->getNumber();
87  if ($num !== null) {
88  $min = $this->getDefinition()->getMin();
89  if ($min !== null && $num < $min) {
90  $this->addValidationError(self::ADT_VALIDATION_ERROR_MIN);
91  $valid = false;
92  }
93 
94  $max = $this->getDefinition()->getMax();
95  if ($max !== null && $num > $max) {
96  $this->addValidationError(self::ADT_VALIDATION_ERROR_MAX);
97  $valid = false;
98  }
99  }
100  return $valid;
101  }
addValidationError(string $a_error_code)
$valid
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getDefinition()
Get definition.
+ Here is the call graph for this function:

◆ isValidDefinition()

ilADTFloat::isValidDefinition ( ilADTDefinition  $a_def)
protected

Definition at line 26 of file class.ilADTFloat.php.

26  : bool
27  {
28  return $a_def instanceof ilADTFloatDefinition;
29  }

◆ reset()

ilADTFloat::reset ( )

Definition at line 31 of file class.ilADTFloat.php.

References null.

31  : void
32  {
33  parent::reset();
34 
35  $this->value = null;
36  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ setNumber()

ilADTFloat::setNumber (   $a_value = null)

Definition at line 40 of file class.ilADTFloat.php.

References ilADT\getDefinition().

Referenced by importStdClass().

41  {
42  $this->value = $this->getDefinition()->handleNumber($a_value);
43  }
getDefinition()
Get definition.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $value

float ilADTFloat::$value
protected

Definition at line 22 of file class.ilADTFloat.php.

Referenced by getNumber().


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