Internal method used in setDimensions to reuse dimension objects with the same name/value pair.

@param NodeDimension $dimensionToBeSet
@return NodeDimension|null
@see setDimensions
962038
protected function findExistingDimensionMatching(NodeDimension $dimensionToBeSet)
    {
        return array_reduce($this->dimensions->toArray(), function ($found, NodeDimension $dimension) use ($dimensionToBeSet) {
            if ($found === null && $dimension->getName() === $dimensionToBeSet->getName() && $dimensionToBeSet->getValue() === $dimension->getValue()) {
                $found = $dimension;
            }

            return $found;
        }, null);
    }
263724
protected function itemLabel(string $pinnedDimensionName = null, NodeInterface $nodeInDimensions = null, array $targetDimensions = null): string
    {
        if ($nodeInDimensions === null && $pinnedDimensionName === null) {
            $itemLabel = '';
            foreach ($targetDimensions as $item) {
                $itemLabel .= $item['label'] . ' - ';
            }

            return trim($itemLabel, ' -');
        } elseif ($nodeInDimensions instanceof NodeInterface && $pinnedDimensionName === null) {
            return $nodeInDimensions->getLabel();
        }

        return $targetDimensions[$pinnedDimensionName]['label'];
    }
994990
private Map<String, String> toMetadata( NodeList blocks ) {
        Map<String, String> dimensions = new HashMap<String, String>();

        for( int i = 0; i < blocks.getLength(); i++ ) {
            Node dimensionNode = blocks.item(i);

            if( dimensionNode.getNodeName().equals("member") ) {
                String dimensionName = null;
                String dimensionValue = null;

                NodeList dimensionAttributes = dimensionNode.getChildNodes();
                for( int j = 0; j < dimensionAttributes.getLength(); j++ ) {
                    Node attribute = dimensionAttributes.item(j);
                    String name = attribute.getNodeName();

                    if( name.equals("Name") ) {
                        dimensionName = provider.getTextValue(attribute);
                    }
                    else if( name.equals("Value") ) {
                        dimensionValue = provider.getTextValue(attribute);
                    }
                }
                if( dimensionName != null ) {
                    dimensions.put(dimensionName, dimensionValue);
                }
            }
        }

        if( dimensions.size() == 0 ) {
            return null;
        }
        return dimensions;
    }
1315905
protected function nodesToArray($locale, $rootNodes, $depth = 2)
    {
        /** @var DomainConfiguration $domainconfig */
        $domainconfig = $this->get('kunstmaan_admin.domain_configuration');
        $isMultiDomain = $domainconfig->isMultiDomainHost();
        $switchedHost = $domainconfig->getHostSwitched();
        $switched = $domainconfig->getHost() == $switchedHost['host'];

        $results = [];

        /** @var Node $rootNode */
        foreach ($rootNodes as $rootNode) {
            if ($nodeTranslation = $rootNode->getNodeTranslation($locale, true)) {
                if ($isMultiDomain && !$switched) {
                    $slug = sprintf('[%s:%s]', $switchedHost['id'], 'NT'.$nodeTranslation->getId());
                } else {
                    $slug = sprintf('[%s]', 'NT'.$nodeTranslation->getId());
                }

                switch (true) {
                    case !$nodeTranslation->isOnline():
                        $type = 'offline';
                        break;
                    case $rootNode->isHiddenFromNav():
                        $type = 'hidden-from-nav';
                        break;
                    default:
                        $type = 'default';
                }

                $root = [
                    'id' => $rootNode->getId(),
                    'type' => $type,
                    'text' => $nodeTranslation->getTitle(),
                    'li_attr' => ['class' => 'js-url-chooser-link-select', 'data-slug' => $slug, 'data-id' => $rootNode->getId()],
                ];

                if ($rootNode->getChildren()->count()) {
                    if ($depth - 1) {
                        $root['children'] = $this->nodesToArray($locale, $rootNode->getChildren(), --$depth);
                    } else {
                        $root['children'] = true;
                    }
                }
                $results[] = $root;
            }
        }

        return $results;
    }
1221822
protected function setFreightDimensionsOnPayload()
    {
        if ($this->items) {
            $this->payload['nVlLargura'] = $this->width();
            $this->payload['nVlAltura'] = $this->height();
            $this->payload['nVlComprimento'] = $this->length();
            $this->payload['nVlDiametro'] = 0;
            $this->payload['nVlPeso'] = $this->useWeightOrVolume();
        }

        return $this;
    }
1121813
public function setAxis($dimension, $labels)
    {
        foreach ($labels as $label) {
            $this->addLabel($dimension, $label);
        }

        return $this;
    }
621505
protected function calculateTargetDimensionsForCombination(array $dimensionCombination)
    {
        $targetDimensions = [];
        foreach ($dimensionCombination as $dimensionName => $dimensionValues) {
            $targetDimensions[$dimensionName] = reset($dimensionValues);
        }

        return $targetDimensions;
    }
263262
public Dimension getDimension()
    {
        Dimension ret = null;
        try {
            ret = Dimension.get(UUID.fromString(this.dimensionUUID));
        } catch (final CacheReloadException e) {
            Attribute.LOG.error("Catched CacheReloadException", e);
        }
        return ret;
    }
176533
public function depthLimit($depthLimit = null)
    {
        if($depthLimit !== null) {
            $this->depthLimit = (int) $depthLimit;
        }

        return $this->depthLimit;
    }
688186
public function dot(Vector $b)
    {
        if ($this->n !== $b->size()) {
            throw new DimensionalityMismatchException('Vector A'
                . " requires $this->n elements but B has {$b->size()}.");
        }

        $sigma = 0.;

        foreach ($this->a as $i => $value) {
            $sigma += $value * $b[$i];
        }

        return $sigma;
    }
425077
protected function setDimensions(\PHPExcel_Worksheet $excelWorksheet, $excelElement, $documentElement)
    {
        $dimensions = $this->getDimensionsArray($documentElement);

        if (isset($dimensions['column']) && $excelElement instanceof \PHPExcel_Cell) {
            foreach($dimensions['column'] as $columnKey => $columnValue) {
                $method = 'set'.ucfirst($columnKey);
                $excelWorksheet->getColumnDimension($excelElement->getColumn())->$method($columnValue);
            }
        }

        if (isset($dimensions['row'])) {
            foreach($dimensions['row'] as $rowKey => $rowValue) {
                $method = 'set'.ucfirst($rowKey);
                if ($excelElement instanceof \PHPExcel_Cell) {
                    $excelWorksheet->getRowDimension($excelElement->getRow())->$method($rowValue);
                } elseif ($excelElement instanceof \PHPExcel_Worksheet_Row) {
                    $excelWorksheet->getRowDimension($excelElement->getRowIndex())->$method($rowValue);
                }

            }
        }
    }
115610
public function matchesWorkspaceAndDimensions($workspace, array $dimensions = null)
    {
        if ($this->workspace->getName() !== $workspace->getName()) {
            return false;
        }
        if ($dimensions !== null) {
            $nodeDimensionValues = $this->dimensionValues;
            foreach ($dimensions as $dimensionName => $dimensionValues) {
                if (isset($nodeDimensionValues[$dimensionName]) && $nodeDimensionValues[$dimensionName] !== [] && array_intersect($nodeDimensionValues[$dimensionName], $dimensionValues) === []) {
                    return false;
                }
            }
        }

        return true;
    }
514769
public function flatten(array $toFlat, $preserveKeys = self::NO_PRESERVE_KEYS)
    {
        if ($preserveKeys === self::PRESERVE_KEYS) {
            $flatten = $this->flattenPreservingKeys($toFlat);
        } elseif ($preserveKeys === self::PRESERVE_ASSOCIATIVE_KEYS) {
            $flatten = $this->flattenPreservingAssociativeKeys($toFlat);
        } else {
            $flatten = $this->flattenNotPreservingKeys($toFlat);
        }

        return $flatten;
    }
622775
public function execute(NodeData $nodeData)
    {
        $dimensions = $nodeData->getDimensions();
        if ($dimensions !== []) {
            $hasChanges = false;
            $newDimensions  = [];
            foreach ($dimensions as $dimension) {
                /** @var NodeDimension $dimension */
                if ($dimension->getName() === $this->oldDimensionName) {
                    $dimension = new NodeDimension($dimension->getNodeData(), $this->newDimensionName, $dimension->getValue());
                    $hasChanges = true;
                } else {
                    $dimension = new NodeDimension($dimension->getNodeData(), $dimension->getName(), $dimension->getValue());
                }
                $newDimensions[] = $dimension;
            }
            if ($hasChanges) {
                $nodeData->setDimensions($newDimensions);
            }
        }
    }
722137
public function setNode(NodeInterface $node)
    {
        $this->nodeIdentifier = $node->getIdentifier();
        $this->workspaceName = $node->getContext()->getWorkspaceName();
        $this->dimension = $node->getContext()->getDimensions();

        $context = $node->getContext();
        if ($context instanceof ContentContext && $context->getCurrentSite() !== null) {
            $siteIdentifier = $this->persistenceManager->getIdentifierByObject($context->getCurrentSite());
        } else {
            $siteIdentifier = null;
        }
        $this->data = Arrays::arrayMergeRecursiveOverrule($this->data, [
            'nodeContextPath' => $node->getContextPath(),
            'nodeLabel' => $node->getLabel(),
            'nodeType' => $node->getNodeType()->getName(),
            'site' => $siteIdentifier
        ]);

        $node = self::getClosestAggregateNode($node);

        if ($node !== null) {
            $this->documentNodeIdentifier = $node->getIdentifier();
            $this->data = Arrays::arrayMergeRecursiveOverrule($this->data, [
                'documentNodeContextPath' => $node->getContextPath(),
                'documentNodeLabel' => $node->getLabel(),
                'documentNodeType' => $node->getNodeType()->getName()
            ]);
        }
    }
685464
public ResponsePartitionKey withDimensions(java.util.Map<String, String> dimensions) {
        setDimensions(dimensions);
        return this;
    }
891308
public static int getMemberDimension() throws XDocletException
    {
        if (getCurrentField() != null) {
            return getCurrentField().getDimension();
        }
        else if (getCurrentMethod() != null) {
            XMethod method = getCurrentMethod();

            if (MethodTagsHandler.isGetterMethod(method)) {
                return method.getReturnType().getDimension();
            }
            else if (MethodTagsHandler.isSetterMethod(method)) {
                XParameter param = (XParameter)method.getParameters().iterator().next();

                return param.getDimension();
            }
        }
        return 0;
    }