You are here

public function UnitsEntity::isLinear in Units of Measurement 7.2

Whether this expression is linearly decomposable.

Return value

bool Whether this expression is linearly decomposable, i.e. its decomposition can be plugged in into another mathematical expression via multiplication without losing sense

Overrides UnitsMathematicalExpression::isLinear

2 calls to UnitsEntity::isLinear()
UnitsEntity::formatQuantity in includes/UnitsEntity.class.inc
Format a certain amount of quantity within this mathematical expression.
UnitsEntity::inverseDecompose in includes/UnitsEntity.class.inc
Create inverse decomposition mathematical expression.

File

includes/UnitsEntity.class.inc, line 154
Definition of UnitsEntity class.

Class

UnitsEntity
Units of measurement entity class.

Code

public function isLinear() {
  $result = db_select('units_mathematical_expression_postfix', 'e')
    ->fields('e', array(
    'value_string',
  ))
    ->condition('mathematical_expression_id', $this->decomposition_mathematical_expression_id)
    ->condition('type', UNITS_TOKEN_TYPE_CONSTANT)
    ->condition('value_string', UNITS_QUANTITY)
    ->execute();
  return $result
    ->rowCount() == 0;
}