/**
  * Returns the values of wizard-components. Should return an array if children are involved,
  * otherwise a whatever type of object is expected.
  * @access public
  * @return mixed
  */
 function getAllValues()
 {
     $obj = Integer::withValue($this->_value ? intval($this->_value) : 0);
     return $obj;
 }
 /**
  * creates appropriate object from given ids
  * 
  * @param Id $structureId
  * @param Id $partStructureId
  * @param String $part
  * @return object mixed
  * @access public
  * @since 7/21/05
  */
 function getPartObject($structureId, $partStructureId, $part)
 {
     $structure = $this->_destinationRepository->getRecordStructure($structureId);
     $partStructure = $structure->getPartStructure($partStructureId);
     $type = $partStructure->getType();
     $typeString = $type->getKeyword();
     switch ($typeString) {
         case "shortstring":
         case "string":
             $obj = String::withValue($part);
             return $obj;
             break;
         case "integer":
             $obj = Integer::withValue($part);
             return $obj;
             break;
         case "boolean":
             $obj = Boolean::withValue($part);
             return $obj;
             break;
         case "float":
             $obj = Float::withValue($part);
             return $obj;
             break;
         case "datetime":
             $obj = DateAndTime::fromString($part);
             return $obj;
             break;
         case "type":
             $obj = HarmoniType::fromString($part);
             return $obj;
             break;
         default:
             $this->addError("Unsupported PartStructure DataType: " . HarmoniType::typeToString($type) . ".");
             $false = false;
             return $false;
     }
 }
Пример #3
0
 /**
  * Answer a new object with the value specified
  * 
  * @param integer $value Integer number of Bytes
  * @param optional string $class The class to instantiate. Do NOT use outside 
  *		of this package.
  * @return object ByteSize
  * @access public
  * @static
  * @since 7/14/05
  */
 static function withValue($value, $class = 'ByteSize')
 {
     return parent::withValue($value, $class);
 }
Пример #4
0
 /**
  * Answer the result of multiplying the receiver and aNumber.
  * 
  * @param object Number $aNumber
  * @return object Number
  * @access public
  * @since 7/14/05
  */
 function multipliedBy($aNumber)
 {
     if (!(strtolower($class) == strtolower('Integer') || is_subclass_of(new $class(), 'Integer'))) {
         $obj = Integer::withValue($this->value() * $aNumber->value());
         return $obj;
     } else {
         $obj = Float::withValue($this->value() * $aNumber->value());
         return $obj;
     }
 }
Пример #5
0
 /**
  * Convert this object to a StorableInteger
  * 
  * @return object
  * @access public
  * @since 6/9/06
  */
 function asAInteger()
 {
     return Integer::withValue($this->getValue() ? 1 : 0);
 }
Пример #6
0
 /**
  * Answer an integer nearest the receiver toward zero.
  * 
  * @return object Number
  * @access public
  * @since 7/14/05
  */
 function truncated()
 {
     return $this->remIntegerQuotient(Integer::withValue(1));
 }
Пример #7
0
 /**
  * Convert this object to a StorableInteger
  * 
  * @return object
  * @access public
  * @since 6/9/06
  */
 function asAInteger()
 {
     $tstamp = $this->asTimestamp();
     return Integer::withValue($tstamp->asUnixTimeStamp());
 }