PDF function, static version.

@param x Value
@param location Location (x0)
@param shape Shape (gamma)
@return PDF value
172921
public static double pdf(double x, double location, double shape) {
    final double v = (x - location) / shape;
    return 1. / (Math.PI * shape * (1 + v * v));
  }
594367
Shape atLocation(float x, float y) {
        start.setLocation(x, y);                              // Store new start
        p.reset();                                            // Erase current path
        createStar();                                         // create new path
        return p;                                             // Return the path
    }
64230
public static GeometryLocation getVertexToSnap(Geometry g, Point p, double tolerance) {
        DistanceOp distanceOp = new DistanceOp(g, p);
        GeometryLocation snapedPoint = distanceOp.nearestLocations()[0];
        if (tolerance == 0 || snapedPoint.getCoordinate().distance(p.getCoordinate()) <= tolerance) {
            return snapedPoint;
        }
        return null;

    }
641474
public String form( double x ) {
        String r;

        if (precision < 0) {
            precision = 6;
        }

        int s = 1;

        if (x < 0) {
            x = -x;
            s = -1;
        }
        if (fmt == 'f') {
            r = fixedFormat(x);
        } else if (fmt == 'e' || fmt == 'E' || fmt == 'g' || fmt == 'G') {
            r = expFormat(x);
        } else {
            throw new java.lang.IllegalArgumentException();
        }

        return pad(sign(s, r));
    }
642398
def _makeLocationElement(self, locationObject, name=None):
        

        locElement = ET.Element("location")
        if name is not None:
           locElement.attrib['name'] = name
        for dimensionName, dimensionValue in locationObject.items():
           dimElement = ET.Element('dimension')
           dimElement.attrib['name'] = dimensionName
           if type(dimensionValue)==tuple:
               dimElement.attrib['xvalue'] = "%f"%dimensionValue[0]
               dimElement.attrib['yvalue'] = "%f"%dimensionValue[1]
           else:
               dimElement.attrib['xvalue'] = "%f"%dimensionValue
           locElement.append(dimElement)
        return locElement
667967
public static double pdf(double val, double loc, double scale, double shape) {
    val = (val - loc) / scale;
    if(shape != 0.) {
      val = -FastMath.log(1 - shape * val) / shape;
    }
    double f = 1. + FastMath.exp(-val);
    return FastMath.exp(-val * (1 - shape)) / (scale * f * f);
  }
197279
@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity"})
	private E readPolyElement(int elementIndex, ShapeElementType type) throws IOException {
		final boolean hasZ = type.hasZ();
		final boolean hasM = type.hasM();

		// Ignore the bounds stored inside the file
		skipBytes(8 * 4);

		// Count of parts
		final int numParts;
		if (type == ShapeElementType.MULTIPOINT || type == ShapeElementType.MULTIPOINT_Z
				|| type == ShapeElementType.MULTIPOINT_M) {
			numParts = 0;
		} else {
			numParts = readLEInt();
		}

		// Count of points
		final int numPoints = readLEInt();

		// Read the parts' indexes
		final int[] parts = new int[numParts];
		for (int idxParts = 0; idxParts < numParts; ++idxParts) {
			parts[idxParts] = readLEInt();
		}

		// Read the points
		final ESRIPoint[] points = new ESRIPoint[numPoints];

		for (int idxPoints = 0; idxPoints < numPoints; ++idxPoints) {
			// Read coordinates
			final double x = fromESRI_x(readLEDouble());
			final double y = fromESRI_y(readLEDouble());

			// Create point
			if (!Double.isNaN(x) && !Double.isNaN(y)) {
				points[idxPoints] = new ESRIPoint(x, y);
			} else {
				throw new ShapeFileException("invalid (x,y) coordinates"); //$NON-NLS-1$
			}
		} // for i= 0 to numPoints

		if (hasZ) {
			// Zmin and Zmax: 2*Double - ignored
			skipBytes(2 * 8);
			// Z array: numpoints*Double
			double z;
			for (int i = 0; i < numPoints; ++i) {
				z = fromESRI_z(readLEDouble());
				if (!Double.isNaN(z)) {
					points[i].setZ(z);
				}
			}
		}

		if (hasM) {
			// Mmin and Mmax: 2*Double - ignored
			skipBytes(2 * 8);
			// M array: numpoints*Double
			double measure;
			for (int i = 0; i < numPoints; ++i) {
				measure = fromESRI_m(readLEDouble());
				if (!Double.isNaN(measure)) {
					points[i].setM(measure);
				}
			}
		}

		// Create the instance of the element
		E newElement = null;
		switch (type) {
		case POLYGON_Z:
		case POLYGON_M:
		case POLYGON:
			newElement = createPolygon(createAttributeCollection(elementIndex), elementIndex, parts, points, hasZ);
			break;
		case POLYLINE_Z:
		case POLYLINE_M:
		case POLYLINE:
			newElement = createPolyline(createAttributeCollection(elementIndex), elementIndex, parts, points, hasZ);
			break;
		case MULTIPOINT:
		case MULTIPOINT_M:
		case MULTIPOINT_Z:
			newElement = createMultiPoint(createAttributeCollection(elementIndex), elementIndex, points, hasZ);
			break;
			//$CASES-OMITTED$
		default:
		}

		return newElement;
	}
526051
@Override
    @Deprecated
    public void copyforward(AllocationPoint point, AllocationShape shape) {
        /*
            Technically that's just a case for relocate, with source as HOST and target point.getAllocationStatus()
         */
        log.info("copyforward() called on tp[" + point.getObjectId() + "], shape: " + point.getShape());
        //relocate(AllocationStatus.HOST, point.getAllocationStatus(), point, shape);
        throw new UnsupportedOperationException("Deprecated call");
    }
562768
private Shape createButtonPath(CornerSize size, int x, int y, int w, int h) {
        return shapeGenerator.createRoundRectangle(x, y, w, h, size, CornerStyle.SQUARE, CornerStyle.SQUARE, CornerStyle.ROUNDED,
                                                   CornerStyle.ROUNDED);
    }
932961
private static Point getShapeIntersection(Shape shape,
                                              Line2D.Double line) {
        PathIterator it = shape.getPathIterator(null);
        double[] coords = new double[6];
        double[] pos = new double[2];
        Line2D.Double l = new Line2D.Double();
        while (!it.isDone()) {
            int type = it.currentSegment(coords);
            switch (type) {
                case PathIterator.SEG_MOVETO:
                    pos[0] = coords[0];
                    pos[1] = coords[1];
                    break;
                case PathIterator.SEG_LINETO:
                    l = new Line2D.Double(pos[0],
                                          pos[1],
                                          coords[0],
                                          coords[1]);
                    if (line.intersectsLine(l)) {
                        return getLinesIntersection(line,
                                                    l);
                    }
                    pos[0] = coords[0];
                    pos[1] = coords[1];
                    break;
                case PathIterator.SEG_CLOSE:
                    break;
                default:
                    // whatever
            }
            it.next();
        }
        return null;
    }
295621
def _pdf(self, xloc, dist, length, cache):
        
        output = evaluation.evaluate_density(
            dist, xloc.reshape(1, -1)).reshape(length, -1)
        assert xloc.shape == output.shape
        return output
1150709
public static double pdf(double x, double k, double theta, double shift) {
    if(x == Double.POSITIVE_INFINITY || x == Double.NEGATIVE_INFINITY) {
      return 0.;
    }
    if(x != x) {
      return Double.NaN;
    }
    x = (x - shift) * theta;
    final double ex = FastMath.exp(x);
    return ex < Double.POSITIVE_INFINITY ? FastMath.exp(k * x - ex - GammaDistribution.logGamma(k)) * theta : 0.;
  }
1278709
@ExportInstanceMethod
	public static void setShape(PointSymbolizerShapeAndSize instance, String shape) {
		if ("circle".equals(shape)) {
			instance.setShape(PointSymbolizerShapeAndSize.Shape.CIRCLE);
		} else if ("square".equals(shape)) {
			instance.setShape(PointSymbolizerShapeAndSize.Shape.SQUARE);
		} else {
			//default value
			instance.setShape(PointSymbolizerShapeAndSize.Shape.SQUARE);
		}
	}
247218
public Shape getPlaceSubtitleShape (int type, Rectangle r)
    {
        switch (modeOf(type)) {
        default:
        case SPEAK: {
            // rounded rectangle subtitle
            Area a = new Area(r);
            a.add(new Area(new Ellipse2D.Float(r.x - PAD, r.y, PAD * 2, r.height)));
            a.add(new Area(new Ellipse2D.Float(r.x + r.width - PAD, r.y, PAD * 2, r.height)));
            return a;
        }

        case THINK: {
            r.grow(PAD / 2, 0);
            Area a = new Area(r);
            int dia = 8;
            int num = (int) Math.ceil(r.height / ((float) dia));
            int leftside = r.x - dia/2;
            int rightside = r.x + r.width - dia/2 - 1;

            int maxh = r.height - dia;
            for (int ii=0; ii < num; ii++) {
                int ypos = r.y + Math.min((r.height * ii) / num, maxh);
                a.add(new Area(new Ellipse2D.Float(leftside, ypos, dia, dia)));
                a.add(new Area(new Ellipse2D.Float(rightside, ypos, dia, dia)));
            }
            return a;
        }

        case SHOUT: {
            r.grow(PAD / 2, 0);
            Area a = new Area(r);
            Polygon left = new Polygon();
            Polygon right = new Polygon();

            int spikehei = 8;
            int num = (int) Math.ceil(r.height / ((float) spikehei));
            left.addPoint(r.x, r.y);
            left.addPoint(r.x - PAD, r.y + spikehei / 2);
            left.addPoint(r.x, r.y + spikehei);
            right.addPoint(r.x + r.width , r.y);
            right.addPoint(r.x + r.width + PAD, r.y + spikehei / 2);
            right.addPoint(r.x + r.width, r.y + spikehei);

            int ypos = 0;
            int maxpos = r.y + r.height - spikehei + 1;
            for (int ii=0; ii < num; ii++) {
                int newpos = Math.min((r.height * ii) / num, maxpos);
                left.translate(0, newpos - ypos);
                right.translate(0, newpos - ypos);
                a.add(new Area(left));
                a.add(new Area(right));
                ypos = newpos;
            }

            return a;
        }

        case EMOTE: {
            // a box that curves inward on the left and right
            r.grow(PAD, 0);
            Area a = new Area(r);
            a.subtract(new Area(new Ellipse2D.Float(r.x - PAD / 2, r.y, PAD, r.height)));
            a.subtract(new Area(new Ellipse2D.Float(r.x + r.width - PAD / 2, r.y, PAD, r.height)));
            return a;
        }
        }
    }
654382
public static double quantile(double val, double shape, double location, double scale) {
    return val < 0 || val > 1 ? Double.NaN : scale * FastMath.pow(val / (1. - val), 1. / shape) + location;
  }
1278119
protected int getInternalDayFromLocation(float x, float y) {
        int dayStart = mEdgePadding;
        if (x < dayStart || x > mWidth - mEdgePadding) {
            return -1;
        }
        // Selection is (x - start) / (pixels/day) == (x -s) * day / pixels
        int row = (int) (y - getMonthHeaderSize()) / mRowHeight;
        int column = (int) ((x - dayStart) * mNumDays / (mWidth - dayStart - mEdgePadding));

        int day = column - findDayOffset() + 1;
        day += row * mNumDays;
        return day;
    }
925643
def _find_form_xobject_images(pdf, container, contentsinfo):
    
    if '/Resources' not in container:
        return
    resources = container['/Resources']
    if '/XObject' not in resources:
        return
    xobjs = resources['/XObject'].as_dict()
    for xobj in xobjs:
        candidate = xobjs[xobj]
        if candidate['/Subtype'] != '/Form':
            continue

        form_xobject = candidate
        for settings in contentsinfo.xobject_settings:
            if settings.name != xobj:
                continue

            # Find images once for each time this Form XObject is drawn.
            # This could be optimized to cache the multiple drawing events
            # but in practice both Form XObjects and multiple drawing of the
            # same object are both very rare.
            ctm_shorthand = settings.shorthand
            yield from _process_content_streams(
                pdf=pdf, container=form_xobject, shorthand=ctm_shorthand
            )