Force the dimension of the LinearRing and update correctly the coordinate
dimension
@param linearRing
@param dimension
@return
189329
public static LinearRing convert(LinearRing linearRing,int dimension) {
        return gf.createLinearRing(convertSequence(linearRing.getCoordinates(),dimension));
    }
1351139
public Geometry execute(Geometry geometry) {
		if (geometry == null) {
			return null;
		}
		if (geometry instanceof LinearRing) {
			if (coordIndex <= 0) {
				coordIndex = 0;
			} else if (coordIndex > geometry.getNumPoints() - 1) {
				coordIndex = geometry.getNumPoints() - 1;
			}
			Coordinate[] coordinates = new Coordinate[geometry.getNumPoints() + 1];
			int count = 0;
			for (int i = 0; i < coordinates.length; i++) {
				if (i == coordIndex) {
					coordinates[i] = coordinate;
				} else if (i == coordinates.length - 1) {
					coordinates[i] = coordinates[0];
				} else {
					coordinates[i] = geometry.getCoordinates()[count++];
				}
			}
			return geometry.getGeometryFactory().createLinearRing(coordinates);
		} else if (geometry instanceof LineString) {
			if (coordIndex <= 0) {
				coordIndex = 0;
			} else if (coordIndex > geometry.getNumPoints()) {
				coordIndex = geometry.getNumPoints();
			}
			Coordinate[] coordinates = new Coordinate[geometry.getNumPoints() + 1];
			int count = 0;
			for (int i = 0; i < coordinates.length; i++) {
				if (i == coordIndex) {
					coordinates[i] = coordinate;
				} else {
					coordinates[i] = geometry.getCoordinates()[count++];
				}
			}
			return geometry.getGeometryFactory().createLineString(coordinates);
		}
		return null;
	}
773759
public ResponseResourceMetricKey withDimensions(java.util.Map<String, String> dimensions) {
        setDimensions(dimensions);
        return this;
    }
597024
public void add(int dimension, float value) {
        if(this.map.containsKey(dimension))
            this.map.put(dimension, this.map.get(dimension) + value);
        else
            this.map.put(dimension, value);
    }
410121
public static Geometry force2D(Geometry geom) {
        if (geom == null) {
            return null;
        }        
        return GeometryCoordinateDimension.force(geom, 2);        
    }
1127929
public static LinearRing removeCoordinates(LinearRing g) {
        Coordinate[] coords = CoordinateUtils.removeDuplicatedCoordinates(g.getCoordinates(),false);
        return FACTORY.createLinearRing(coords);
    }
498430
public function setSize(Dimension $dimension)
    {
        return $this->setWidth($dimension->getWidth())
                        ->setHeight($dimension->getHeight());
    }
500467
private void addSubDimension(final Facets _facets,
                                 final DimValue _dimValue,
                                 final String _dim,
                                 final String _path)
        throws IOException
    {
        final FacetResult result = _facets.getTopChildren(1000, _dim, _path);
        if (result != null) {
            LOG.debug("FacetResult {}.", result);
            for (final LabelAndValue labelValue : result.labelValues) {
                final DimValue dimValue = new DimValue().setLabel(labelValue.label)
                                .setValue(labelValue.value.intValue());
                dimValue.setPath(ArrayUtils.addAll(_dimValue.getPath(), result.path));
                _dimValue.getChildren().add(dimValue);
                addSubDimension(_facets, dimValue, _dim, _path + "/" + labelValue.label);
            }
        }
    }
1024170
public static int dimension(Class clazz) {
        checkArrayType(clazz);

        int result = 0;
        while (clazz.isArray()) {
            result++;
            clazz = clazz.getComponentType();
        }

        return result;
    }
85562
def with_dimensions(self, *dimensions):
    """"""
    self.dimensions = tuple(
        self._maybe_make_dimension(dim) for dim in dimensions)
    self._cached = None
    return self
1282805
public static Vector createVector(int dimension) {
		if (dimension<=0) throw new IllegalArgumentException();
		switch (dimension) {
			case 2: return createVector2();
			case 3: return createVector3();
			case 4: return createVector4();
			default: return new VectorImpl(dimension);
		}
	}
59175
public static Version getProvisionalVersionForDimension(int dimension) throws FormatException {
    if (dimension % 4 != 1) {
      throw FormatException.getFormatInstance();
    }
    try {
      return getVersionForNumber((dimension - 17) / 4);
    } catch (IllegalArgumentException ignored) {
      throw FormatException.getFormatInstance();
    }
  }
884419
public static int[] dimensions(Object arr) {
        int[] dims = new int[Types.arrayDimensions(arr.getClass())];
        if ( 0 == dims.length || 0 == (dims[0] = Array.getLength(arr)) )
            return dims;
        for ( int i = 1; i < dims.length; i++ )
            if ( null != (arr = Array.get(arr, 0)) )
                dims[i] = Array.getLength(arr);
            else break;
        return dims;
    }
840656
def _valid_dimensions(self, dimensions):
        """"""
        if dimensions is None:
            dimensions = self.kdims
        elif not isinstance(dimensions, list):
            dimensions = [dimensions]

        valid_dimensions = []
        for dim in dimensions:
            if isinstance(dim, Dimension): dim = dim.name
            if dim not in self.kdims:
                raise Exception("Supplied dimensions %s not found." % dim)
            valid_dimensions.append(dim)
        return valid_dimensions
966455
def get_dimension_index(self, dimension):
        
        if isinstance(dimension, int):
            if (dimension < (self.ndims + len(self.vdims)) or
                dimension < len(self.dimensions())):
                return dimension
            else:
                return IndexError('Dimension index out of bounds')
        dim = dimension_name(dimension)
        try:
            dimensions = self.kdims+self.vdims
            return [i for i, d in enumerate(dimensions) if d == dim][0]
        except IndexError:
            raise Exception("Dimension %s not found in %s." %
                            (dim, self.__class__.__name__))
745156
public static Dimension dimensionsToFit(Dimension target, Dimension source) {

        // if target width/height is zero then we have no preference for that, so set it to the original value,
        // since it cannot be any larger
        int maxWidth;
        if (target.getX() == 0) {
            maxWidth = source.getX();
        } else {
            maxWidth = target.getX();
        }

        int maxHeight;
        if (target.getY() == 0) {
            maxHeight = source.getY();
        } else {
            maxHeight = target.getY();
        }

        double wscale = maxWidth / (double) source.getX();
        double hscale = maxHeight / (double) source.getY();

        if (wscale < hscale)
            return new Dimension((int) (source.getX() * wscale), (int) (source.getY() * wscale));
        else
            return new Dimension((int) (source.getX() * hscale), (int) (source.getY() * hscale));
    }
1215695
public final void addRing(double xy[]) {
		for (int i = 2; i < xy.length; i += 2) {
			addEdge(xy[i-2], xy[i - 1], xy[i], xy[i + 1]);
		}
	}