@param $range

@return tao_helpers_form_elements_xhtml_Combobox
@throws common_Exception
430882
protected function getTreeElement( $range )
	{

		$dataService = TreeService::singleton();
		/**
		 * @var tao_helpers_form_elements_xhtml_Combobox $element
		 */
		$element     = tao_helpers_form_FormFactory::getElement( "{$this->getIndex()}_range_tree", 'Combobox' );
		$element->setDescription( __( 'Tree values' ) );
		$element->addAttribute( 'class', 'property-template tree-template' );
		$element->addAttribute( 'disabled', 'disabled' );
		$element->setEmptyOption( ' --- ' . __( 'select' ) . ' --- ' );
		$treeOptions = array();
		foreach ($dataService->getTrees() as $tree) {
			$treeOptions[tao_helpers_Uri::encode( $tree->getUri() )] = $tree->getLabel();
			if (null !== $range && $range->getUri() === $tree->getUri()) {
				$element->setValue( $tree->getUri() );
			}
		}
		$element->setOptions( $treeOptions );

		return $element;
	}
155200
public function addRange($from = null, $to = null)
    {
        $range = array_filter(
            [
                'from' => $from,
                'to' => $to,
            ],
            function ($v) {
                return !is_null($v);
            }
        );

        $this->ranges[] = $range;

        return $this;
    }
715946
private static function cast(DateTimeRange $range)
	{
		$start = new Date($range->start());
		$end   = new Date($range->end());

		return new DateRange($start, $end);
	}
986151
public function validate()
    {
        $report = common_report_Report::createInfo();

        foreach ($this->formProperties as $property) {

            try {
                $value = $property['formValue'];

                if (isset($property['validators'])) {
                    foreach ($property['validators'] as $validatorName) {
                        $validatorClass = 'tao_helpers_form_validators_' . $validatorName;
                        if (!class_exists($validatorClass)) {
                            throw new common_Exception('Validator is not correctly set (unknown)');
                        }
                        /** @var ValidatorInterface $validator */
                        $validator = new $validatorClass();
                        if (!$validator->evaluate($value)) {
                            throw new common_exception_ValidationFailed(
                                $property['uri'], $validator->getMessage()
                            );
                        }
                    }
                }

                if (isset($property['range'])) {
                    if (!isset($this->ranges[$property['range']])) {
                        throw new common_Exception($property['label'] . ' : Range is unknown');
                    }
                    $rangeValidated = false;
                    foreach ($this->ranges[$property['range']] as $rangeData) {

                        if (is_array($value)) {
                            foreach ($value as $k => $v) {
                                if ($rangeData['uri'] == $v) {
                                    unset($value[$k]);
                                }
                            }
                            if (empty($value)) {
                                $rangeValidated = true;
                                break;
                            }
                        } else {
                            if ($rangeData['uri'] == $value) {
                                $rangeValidated = true;
                                break;
                            }
                        }

                    }
                    if (!$rangeValidated) {
                        throw new common_exception_ValidationFailed(
                            $property['uri'], 'Range "' . $value . '" for field "' . $property['label'] . '" is not recognized.'
                        );
                    }

                }
            } catch (common_exception_ValidationFailed $e) {
                $subReport = common_report_Report::createFailure($e->getMessage());
                $subReport->setData($property['uri']);
                $report->add($subReport);
            }
        }

        return $report;
    }
1155801
public function get($table, $hash, $range = null, Context\Get $context = null)
    {
        if (null !== $this->logger) {
            $this->log('Get on table '.$table);
        }

        // Primary key
        $hash = new Attribute($hash);

        $parameters = array(
            'TableName' => $table,
            'Key'       => array(
                'HashKeyElement' => $hash->getForDynamoDB()
            )
        );

        // Range key
        if (null !== $range) {
            $range = new Attribute($range);
            $parameters['Key']['RangeKeyElement'] = $range->getForDynamoDB();
        }

        if (null !== $context) {
            $parameters += $context->getForDynamoDB();
        }

        if (null !== $this->logger) {
            $this->log('Get request paramaters : '.print_r($parameters, true), Logger::DEBUG);
        }

        $response = $this->connector->getItem($parameters);

        if (null !== $this->logger) {
            $this->log('Get request response : '.print_r($response, true), Logger::DEBUG);
        }

        $this->addConsumedReadUnits($table, floatval($response['ConsumedCapacityUnits']));

        if (isset($response['Item'])) {
            $item = new Item($table);
            $item->populateFromDynamoDB($response['Item']);
            return $item;
        } else {
            if (null !== $this->logger) {
                $this->log('Didn\'t find item');
            }
            return null;
        }
    }
1347773
function getRangeTextNodes(range) {
  var container = range.commonAncestorContainer
    , nodes = getTextNodes(container.parentNode || container)

  return nodes.filter(function (node) {
    return rangeIntersectsNode(range, node) && isNonEmptyTextNode(node)
  })
}
1334000
public function delete($table, $hash, $range = null, Context\Delete $context = null)
    {
        if (null !== $this->logger) {
            $this->log('Delete on table '.$table);
        }

        // Primary key
        $hash = new Attribute($hash);
        $key = array(
            'HashKeyElement' => $hash->getForDynamoDB()
        );

        // Range key
        if (null !== $range) {
            $range = new Attribute($range);
            $key['RangeKeyElement'] = $range->getForDynamoDB();
        }

        $parameters = array(
            'TableName' => $table,
            'Key'       => $key
        );

        if (null !== $context) {
            $parameters += $context->getForDynamoDB();
        }

        if (null !== $this->logger) {
            $this->log('Delete request paramaters : '.print_r($parameters, true), Logger::DEBUG);
        }

        $response = $this->connector->deleteItem($parameters);

        if (null !== $this->logger) {
            $this->log('Delete request response : '.print_r($response, true), Logger::DEBUG);
        }

        // Update write counter
        $this->addConsumedWriteUnits($table, floatval($response['ConsumedCapacityUnits']));

        return $this->populateAttributes($response);
    }
800911
public function deleteRange($range)
    {
        if ($range instanceof IPRange) {
            $id = $range->getID();
        } else {
            $id = (int) $range;
        }
        if ($id) {
            $this->connection->executeQuery('DELETE FROM LoginControlIpRanges WHERE lcirID = ? LIMIT 1', [$id]);
        }
    }
682903
public function setRange($range)
    {
        Argument::i()->test(1, 'int');
        
        if ($range < 0) {
            $range = 25;
        }
        
        $this->range = $range;
        
        return $this;
    }
909763
public function range($from, $to, $condition = true) {
		$range = new Range($this, !$condition);
		$range->setFrom($from);
		$range->setTo($to);
		return $range;
	}
154022
public function asDatespan(DatespanRange $range = null)
    {
        return $this->handleFilter(
                function() use($range)
                {
                    return filter\RangeFilter::wrap(
                            filter\DatespanFilter::instance(),
                            $range
                    );
                }
        );
    }
130158
public static function combination(array $ranges)
	{
		if (!self::isContiguous($ranges))
		{
			throw new \InvalidArgumentException('Unable to combine date ranges');
		}

		return new DateTimeRange($ranges[0]->start, $ranges[count($ranges) - 1]->end, $ranges[0]->interval);
	}
1048326
protected function cleanRange($range)
    {
        foreach (array('<', '>', '=', '~', '^', '||', '&&') as $character) {
            $range = str_replace($character.' ', $character, $range);
        }

        $range = preg_replace('/(?:[vV])(\d+)/', '${1}', $range);
        $range = str_replace(' ||', '||', $range);

        return str_replace(array(' &&', '&&'), ',', $range);
    }
1005412
protected function matchRange($range)
    {
        $pattern = '/(\ -\ )|(<)|(>)|(=)|(\|\|)|(\ )|(,)|(\~)|(\^)/';
        $matches = preg_split($pattern, $range, -1, PREG_SPLIT_DELIM_CAPTURE);
        $special = null;
        $replace = null;
        $first = true;

        foreach ($matches as $i => $match) {
            if ($first && '' !== $match) {
                $first = false;
                $match = '=' === $match ? 'EQUAL' : $match;
            }

            $this->matchRangeToken($i, $match, $matches, $special, $replace);
        }

        return implode('', $matches);
    }
956847
public function getNextLinks($range = 5)
    {
        $total = $this->getTotalPages();
        $start = $this->getPage() + 1;
        $end = $this->getPage() + $range;
        $last = $this->getLastPage();
        $links = array();
        for ($i = $start; $i < $end; $i++) {
            if ($i > $last) {
                break;
            }
            $links[] = $i;
        }

        return $links;
    }
983311
public Query range(ByteStringRange range) {
    RowRange.Builder rangeBuilder = RowRange.newBuilder();

    switch (range.getStartBound()) {
      case OPEN:
        rangeBuilder.setStartKeyOpen(range.getStart());
        break;
      case CLOSED:
        rangeBuilder.setStartKeyClosed(range.getStart());
        break;
      case UNBOUNDED:
        rangeBuilder.clearStartKey();
        break;
      default:
        throw new IllegalStateException("Unknown start bound: " + range.getStartBound());
    }

    switch (range.getEndBound()) {
      case OPEN:
        rangeBuilder.setEndKeyOpen(range.getEnd());
        break;
      case CLOSED:
        rangeBuilder.setEndKeyClosed(range.getEnd());
        break;
      case UNBOUNDED:
        rangeBuilder.clearEndKey();
        break;
      default:
        throw new IllegalStateException("Unknown end bound: " + range.getEndBound());
    }

    builder.getRowsBuilder().addRowRanges(rangeBuilder.build());

    return this;
  }
558958
public function containsRange(RangeInterface $range)
    {
        $result = false;
        if ($range->getAddressType() === $this->getAddressType()) {
            if ($range->toString(false) === $this->toString(false)) {
                $result = true;
            }
        }

        return $result;
    }