_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q154500 | GeometryEngine.contains | train | public static boolean contains(Geometry geometry1, Geometry geometry2,
SpatialReference spatialReference) {
OperatorContains op = (OperatorContains) factory
.getOperator(Operator.Type.Contains);
boolean result = op.execute(geometry1, geometry2, spatialReference,
null);
return result;
} | java | {
"resource": ""
} |
q154501 | GeometryEngine.crosses | train | public static boolean crosses(Geometry geometry1, Geometry geometry2,
SpatialReference spatialReference) {
OperatorCrosses op = (OperatorCrosses) factory
.getOperator(Operator.Type.Crosses);
boolean result = op.execute(geometry1, geometry2, spatialReference,
null);
return result;
} | java | {
"resource": ""
} |
q154502 | GeometryEngine.touches | train | public static boolean touches(Geometry geometry1, Geometry geometry2,
SpatialReference spatialReference) {
OperatorTouches op = (OperatorTouches) factory
.getOperator(Operator.Type.Touches);
boolean result = op.execute(geometry1, geometry2, spatialReference,
null);
return result;
} | java | {
"resource": ""
} |
q154503 | GeometryEngine.overlaps | train | public static boolean overlaps(Geometry geometry1, Geometry geometry2,
SpatialReference spatialReference) {
OperatorOverlaps op = (OperatorOverlaps) factory
.getOperator(Operator.Type.Overlaps);
boolean result = op.execute(geometry1, geometry2, spatialReference,
null);
return result;
} | java | {
"resource": ""
} |
q154504 | GeometryEngine.relate | train | public static boolean relate(Geometry geometry1, Geometry geometry2,
SpatialReference spatialReference, String relation) {
OperatorRelate op = (OperatorRelate) factory
.getOperator(Operator.Type.Relate);
boolean result = op.execute(geometry1, geometry2, spatialReference,
relation, null);
return result;... | java | {
"resource": ""
} |
q154505 | GeometryEngine.distance | train | public static double distance(Geometry geometry1, Geometry geometry2,
SpatialReference spatialReference) {
OperatorDistance op = (OperatorDistance) factory
.getOperator(Operator.Type.Distance);
double result = op.execute(geometry1, geometry2, null);
return result;
} | java | {
"resource": ""
} |
q154506 | GeometryEngine.clip | train | public static Geometry clip(Geometry geometry, Envelope envelope,
SpatialReference spatialReference) {
OperatorClip op = (OperatorClip) factory
.getOperator(Operator.Type.Clip);
Geometry result = op.execute(geometry, Envelope2D.construct(
envelope.getXMin(), envelope.getYMin(), envelope.getXMax(),
en... | java | {
"resource": ""
} |
q154507 | GeometryEngine.cut | train | public static Geometry[] cut(Geometry cuttee, Polyline cutter,
SpatialReference spatialReference) {
if (cuttee == null || cutter == null)
return null;
OperatorCut op = (OperatorCut) factory.getOperator(Operator.Type.Cut);
GeometryCursor cursor = op.execute(true, cuttee, cutter,
spatialReference, null);... | java | {
"resource": ""
} |
q154508 | GeometryEngine.buffer | train | public static Polygon[] buffer(Geometry[] geometries,
SpatialReference spatialReference, double[] distances,
boolean toUnionResults) {
// initially assume distances are in unit of spatial reference
double[] bufferDistances = distances;
OperatorBuffer op = (OperatorBuffer) factory
.getOperator(Operator.... | java | {
"resource": ""
} |
q154509 | GeometryEngine.buffer | train | public static Polygon buffer(Geometry geometry,
SpatialReference spatialReference, double distance) {
double bufferDistance = distance;
OperatorBuffer op = (OperatorBuffer) factory
.getOperator(Operator.Type.Buffer);
Geometry result = op.execute(geometry, spatialReference,
bufferDistance, null);
ret... | java | {
"resource": ""
} |
q154510 | GeometryEngine.convexHull | train | public static Geometry convexHull(Geometry geometry) {
OperatorConvexHull op = (OperatorConvexHull) factory
.getOperator(Operator.Type.ConvexHull);
return op.execute(geometry, null);
} | java | {
"resource": ""
} |
q154511 | GeometryEngine.convexHull | train | public static Geometry[] convexHull(Geometry[] geometries, boolean b_merge) {
OperatorConvexHull op = (OperatorConvexHull) factory
.getOperator(Operator.Type.ConvexHull);
SimpleGeometryCursor simple_cursor = new SimpleGeometryCursor(
geometries);
GeometryCursor cursor = op.execute(simple_cursor, b_merge, ... | java | {
"resource": ""
} |
q154512 | GeometryEngine.getNearestCoordinate | train | public static Proximity2DResult getNearestCoordinate(Geometry geometry,
Point inputPoint, boolean bTestPolygonInterior) {
OperatorProximity2D proximity = (OperatorProximity2D) factory
.getOperator(com.esri.core.geometry.Operator.Type.Proximity2D);
Proximity2DResult result = proximity.getNearestCoordinate(ge... | java | {
"resource": ""
} |
q154513 | GeometryEngine.getNearestVertices | train | public static Proximity2DResult[] getNearestVertices(Geometry geometry,
Point inputPoint, double searchRadius, int maxVertexCountToReturn) {
OperatorProximity2D proximity = (OperatorProximity2D) factory
.getOperator(com.esri.core.geometry.Operator.Type.Proximity2D);
Proximity2DResult[] results = proximity.g... | java | {
"resource": ""
} |
q154514 | GeometryEngine.simplify | train | public static Geometry simplify(Geometry geometry,
SpatialReference spatialReference) {
OperatorSimplify op = (OperatorSimplify) factory
.getOperator(Operator.Type.Simplify);
Geometry result = op.execute(geometry, spatialReference, false, null);
return result;
} | java | {
"resource": ""
} |
q154515 | GeometryEngine.isSimple | train | static boolean isSimple(Geometry geometry, SpatialReference spatialReference) {
OperatorSimplify op = (OperatorSimplify) factory
.getOperator(Operator.Type.Simplify);
boolean result = op.isSimpleAsFeature(geometry, spatialReference, null);
return result;
} | java | {
"resource": ""
} |
q154516 | Proximity2DResult.setRightSide | train | public void setRightSide(boolean bRight) {
if (bRight)
m_info |= (int) OperatorProximity2D.ProxResultInfo.rightSide;
else
m_info &= ~(int) OperatorProximity2D.ProxResultInfo.rightSide;
} | java | {
"resource": ""
} |
q154517 | SegmentIteratorImpl.nextSegment | train | public Segment nextSegment() {
if (m_currentSegmentIndex != m_nextSegmentIndex)
_updateSegment();
if (m_bCirculator) {
m_nextSegmentIndex = (m_nextSegmentIndex + 1) % m_segmentCount;
} else {
if (m_nextSegmentIndex == m_segmentCount)
throw new IndexOutOfBoundsException();
m_nextSegmentIndex++;
... | java | {
"resource": ""
} |
q154518 | SegmentIteratorImpl.resetToPath | train | public void resetToPath(int pathIndex) {
if (pathIndex < 0)
throw new IndexOutOfBoundsException();
m_nextPathIndex = pathIndex;
m_currentPathIndex = -1;
m_currentSegmentIndex = -1;
m_nextSegmentIndex = -1;
m_segmentCount = -1;
m_pathBegin = -1;
} | java | {
"resource": ""
} |
q154519 | OperatorDistanceLocal.execute | train | @Override
public double execute(Geometry geom1, Geometry geom2,
ProgressTracker progressTracker) {
if (null == geom1 || null == geom2) {
throw new IllegalArgumentException();
}
Geometry geometryA = geom1;
Geometry geometryB = geom2;
if (geometryA.isEmpty() || geometryB.isEmpty())
return NumberUtil... | java | {
"resource": ""
} |
q154520 | NumberUtils.hash | train | static int hash(int n) {
int hash = 5381;
hash = ((hash << 5) + hash) + (n & 0xFF); /* hash * 33 + c */
hash = ((hash << 5) + hash) + ((n >> 8) & 0xFF);
hash = ((hash << 5) + hash) + ((n >> 16) & 0xFF);
hash = ((hash << 5) + hash) + ((n >> 24) & 0xFF);
hash &= 0x7FFFFFFF;
return hash;
} | java | {
"resource": ""
} |
q154521 | NumberUtils.hash | train | static int hash(int hashIn, int n) {
int hash = ((hashIn << 5) + hashIn) + (n & 0xFF); /* hash * 33 + c */
hash = ((hash << 5) + hash) + ((n >> 8) & 0xFF);
hash = ((hash << 5) + hash) + ((n >> 16) & 0xFF);
hash = ((hash << 5) + hash) + ((n >> 24) & 0xFF);
hash &= 0x7FFFFFFF;
return hash;
} | java | {
"resource": ""
} |
q154522 | MultiPointImpl.add | train | public void add(double x, double y) {
resize(m_pointCount + 1);
Point2D pt = new Point2D();
pt.setCoords(x, y);
setXY(m_pointCount - 1, pt);
} | java | {
"resource": ""
} |
q154523 | MultiPointImpl.add | train | public void add(double x, double y, double z) {
resize(m_pointCount + 1);
Point3D pt = new Point3D();
pt.setCoords(x, y, z);
setXYZ(m_pointCount - 1, pt);
} | java | {
"resource": ""
} |
q154524 | MultiPointImpl.add | train | public void add(MultiVertexGeometryImpl src, int beginIndex, int endIndex) {
int endIndexC = endIndex < 0 ? src.getPointCount() : endIndex;
if (beginIndex < 0 || beginIndex > src.getPointCount()
|| endIndexC < beginIndex)
throw new IllegalArgumentException();
if (beginIndex == endIndexC)
return;
mer... | java | {
"resource": ""
} |
q154525 | RasterizedGeometry2D.create | train | public static RasterizedGeometry2D create(Geometry geom,
double toleranceXY, int rasterSizeBytes) {
if (!canUseAccelerator(geom))
throw new IllegalArgumentException();
RasterizedGeometry2DImpl gc = RasterizedGeometry2DImpl.createImpl(geom,
toleranceXY, rasterSizeBytes);
return (RasterizedGeometry2D) gc... | java | {
"resource": ""
} |
q154526 | SegmentIntersector.pushSegment | train | public int pushSegment(Segment seg) {
assert (m_input_segments.size() < 2);
m_input_segments.add(newIntersectionPart_(seg));
// m_param_1.resize(15);
// m_param_2.resize(15);
return (int) m_input_segments.size() - 1;
} | java | {
"resource": ""
} |
q154527 | IndexMultiDCList.createList | train | int createList(int listData) {
int list = newList_();
// m_lists.set_field(list, 0, null_node());//head
// m_lists.set_field(list, 1, null_node());//tail
// m_lists.set_field(list, 2, null_node());//prev list
m_lists.setField(list, 3, m_list_of_lists); // next list
m_lists.setField(list, 4, 0);// node count... | java | {
"resource": ""
} |
q154528 | IndexMultiDCList.deleteList | train | int deleteList(int list) {
clear(list);
int prevList = m_lists.getField(list, 2);
int nextList = m_lists.getField(list, 3);
if (prevList != nullNode())
setNextList_(prevList, nextList);
else
m_list_of_lists = nextList;
if (nextList != nullNode())
setPrevList_(nextList, prevList);
freeList_(list... | java | {
"resource": ""
} |
q154529 | IndexMultiDCList.insertElement | train | int insertElement(int list, int beforeNode, int data) {
int node = newNode_();
int prev = -1;
if (beforeNode != nullNode()) {
prev = getPrev(beforeNode);
setPrev_(beforeNode, node);
}
setNext_(node, beforeNode);
if (prev != nullNode())
setNext_(prev, node);
int head = m_lists.getField(list, 0);... | java | {
"resource": ""
} |
q154530 | IndexMultiDCList.deleteElement | train | int deleteElement(int list, int node) {
int prev = getPrev(node);
int next = getNext(node);
if (prev != nullNode())
setNext_(prev, next);
else
m_lists.setField(list, 0, next);// change head
if (next != nullNode())
setPrev_(next, prev);
else
m_lists.setField(list, 1, prev);// change tail
freeN... | java | {
"resource": ""
} |
q154531 | IndexMultiDCList.clear | train | void clear(int list) {
int last = getLast(list);
while (last != nullNode()) {
int n = last;
last = getPrev(n);
freeNode_(n);
}
m_lists.setField(list, 0, -1);
m_lists.setField(list, 1, -1);
setListSize_(list, 0);
} | java | {
"resource": ""
} |
q154532 | Transformation3D.setZero | train | public void setZero() {
xx = 0.0;
yx = 0.0;
zx = 0.0;
xy = 0.0;
yy = 0.0;
zy = 0.0;
xz = 0.0;
yz = 0.0;
zz = 0.0;
xd = 0.0;
yd = 0.0;
zd = 0.0;
} | java | {
"resource": ""
} |
q154533 | Transformation3D.transform | train | public Envelope3D transform(Envelope3D env) {
if (env.isEmpty())
return env;
Point3D[] buf = new Point3D[8];
env.queryCorners(buf);
transform(buf, 8, buf);
env.setFromPoints(buf);
return env;
} | java | {
"resource": ""
} |
q154534 | Transformation3D.inverse | train | public static void inverse(Transformation3D src, Transformation3D result) {
double det = src.xx * (src.yy * src.zz - src.zy * src.yz) - src.yx
* (src.xy * src.zz - src.zy * src.xz) + src.zx
* (src.xy * src.yz - src.yy * src.xz);
if (det != 0) {
double xx, yx, zx;
double xy, yy, zy;
double xz, yz, z... | java | {
"resource": ""
} |
q154535 | RelationalOperationsMatrix.relationCompare_ | train | private static boolean relationCompare_(int[] matrix, String scl) {
for (int i = 0; i < 9; i++) {
switch (scl.charAt(i)) {
case 'T':
assert (matrix[i] != -2);
if (matrix[i] == -1)
return false;
break;
case 'F':
assert (matrix[i] != -2);
if (matrix[i] != -1)
return false;
br... | java | {
"resource": ""
} |
q154536 | RelationalOperationsMatrix.getPredefinedRelation_ | train | private static int getPredefinedRelation_(String scl, int dim_a, int dim_b) {
if (equals_(scl))
return RelationalOperations.Relation.equals;
if (disjoint_(scl))
return RelationalOperations.Relation.disjoint;
if (touches_(scl, dim_a, dim_b))
return RelationalOperations.Relation.touches;
if (crosses_(... | java | {
"resource": ""
} |
q154537 | RelationalOperationsMatrix.equals_ | train | private static boolean equals_(String scl) {
// Valid for all
if (scl.charAt(0) == 'T' && scl.charAt(1) == '*'
&& scl.charAt(2) == 'F' && scl.charAt(3) == '*'
&& scl.charAt(4) == '*' && scl.charAt(5) == 'F'
&& scl.charAt(6) == 'F' && scl.charAt(7) == 'F'
&& scl.charAt(8) == '*')
return true;
r... | java | {
"resource": ""
} |
q154538 | RelationalOperationsMatrix.disjoint_ | train | private static boolean disjoint_(String scl) {
if (scl.charAt(0) == 'F' && scl.charAt(1) == 'F'
&& scl.charAt(2) == '*' && scl.charAt(3) == 'F'
&& scl.charAt(4) == 'F' && scl.charAt(5) == '*'
&& scl.charAt(6) == '*' && scl.charAt(7) == '*'
&& scl.charAt(8) == '*')
return true;
return false;
} | java | {
"resource": ""
} |
q154539 | RelationalOperationsMatrix.touches_ | train | private static boolean touches_(String scl, int dim_a, int dim_b) {
// Points cant touch
if (dim_a == 0 && dim_b == 0)
return false;
if (!(dim_a == 2 && dim_b == 2)) {
// Valid for area-Line, Line-Line, area-Point, and Line-Point
if (scl.charAt(0) == 'F' && scl.charAt(1) == '*'
&& scl.charAt(2) == ... | java | {
"resource": ""
} |
q154540 | RelationalOperationsMatrix.crosses_ | train | private static boolean crosses_(String scl, int dim_a, int dim_b) {
if (dim_a > dim_b) {
// Valid for area-Line, area-Point, Line-Point
if (scl.charAt(0) == 'T' && scl.charAt(1) == '*'
&& scl.charAt(2) == '*' && scl.charAt(3) == '*'
&& scl.charAt(4) == '*' && scl.charAt(5) == '*'
&& scl.charAt(6)... | java | {
"resource": ""
} |
q154541 | RelationalOperationsMatrix.contains_ | train | private static boolean contains_(String scl) {
// Valid for all
if (scl.charAt(0) == 'T' && scl.charAt(1) == '*'
&& scl.charAt(2) == '*' && scl.charAt(3) == '*'
&& scl.charAt(4) == '*' && scl.charAt(5) == '*'
&& scl.charAt(6) == 'F' && scl.charAt(7) == 'F'
&& scl.charAt(8) == '*')
return true;
... | java | {
"resource": ""
} |
q154542 | RelationalOperationsMatrix.overlaps_ | train | private static boolean overlaps_(String scl, int dim_a, int dim_b) {
if (dim_a == dim_b) {
if (dim_a != 1) {
// Valid for area-area, Point-Point
if (scl.charAt(0) == 'T' && scl.charAt(1) == '*'
&& scl.charAt(2) == 'T' && scl.charAt(3) == '*'
&& scl.charAt(4) == '*' && scl.charAt(5) == '*'
... | java | {
"resource": ""
} |
q154543 | RelationalOperationsMatrix.setPredicates_ | train | private void setPredicates_(String scl) {
m_scl = scl;
for (int i = 0; i < 9; i++) {
if (m_scl.charAt(i) != '*') {
m_perform_predicates[i] = true;
m_predicate_count++;
} else
m_perform_predicates[i] = false;
}
} | java | {
"resource": ""
} |
q154544 | RelationalOperationsMatrix.setRemainingPredicatesToFalse_ | train | private void setRemainingPredicatesToFalse_() {
for (int i = 0; i < 9; i++) {
if (m_perform_predicates[i] && m_matrix[i] == -2) {
m_matrix[i] = -1;
m_perform_predicates[i] = false;
}
}
} | java | {
"resource": ""
} |
q154545 | RelationalOperationsMatrix.isPredicateKnown_ | train | private boolean isPredicateKnown_(int predicate) {
assert(m_scl.charAt(predicate) != '*');
if (m_matrix[predicate] == -2)
return false;
if (m_matrix[predicate] == -1)
{
m_perform_predicates[predicate] = false;
m_predicate_count--;
return ... | java | {
"resource": ""
} |
q154546 | RelationalOperationsMatrix.setAreaAreaPredicates_ | train | private void setAreaAreaPredicates_() {
m_predicates_half_edge = Predicates.AreaAreaPredicates;
m_max_dim[MatrixPredicate.InteriorInterior] = 2;
m_max_dim[MatrixPredicate.InteriorBoundary] = 1;
m_max_dim[MatrixPredicate.InteriorExterior] = 2;
m_max_dim[MatrixPredicate.BoundaryIn... | java | {
"resource": ""
} |
q154547 | RelationalOperationsMatrix.setAreaLinePredicates_ | train | private void setAreaLinePredicates_() {
m_predicates_half_edge = Predicates.AreaLinePredicates;
m_predicates_cluster = Predicates.AreaPointPredicates;
m_max_dim[MatrixPredicate.InteriorInterior] = 1;
m_max_dim[MatrixPredicate.InteriorBoundary] = 0;
m_max_dim[MatrixPredicate.Inte... | java | {
"resource": ""
} |
q154548 | RelationalOperationsMatrix.setLineLinePredicates_ | train | private void setLineLinePredicates_() {
m_predicates_half_edge = Predicates.LineLinePredicates;
m_predicates_cluster = Predicates.LinePointPredicates;
m_max_dim[MatrixPredicate.InteriorInterior] = 1;
m_max_dim[MatrixPredicate.InteriorBoundary] = 0;
m_max_dim[MatrixPredicate.Inte... | java | {
"resource": ""
} |
q154549 | RelationalOperationsMatrix.setAreaPointPredicates_ | train | private void setAreaPointPredicates_() {
m_predicates_cluster = Predicates.AreaPointPredicates;
m_max_dim[MatrixPredicate.InteriorInterior] = 0;
m_max_dim[MatrixPredicate.InteriorBoundary] = -1;
m_max_dim[MatrixPredicate.InteriorExterior] = 2;
m_max_dim[MatrixPredicate.BoundaryI... | java | {
"resource": ""
} |
q154550 | RelationalOperationsMatrix.areaAreaPredicates_ | train | private boolean areaAreaPredicates_(int half_edge, int id_a, int id_b) {
boolean bRelationKnown = true;
if (m_perform_predicates[MatrixPredicate.InteriorInterior]) {
interiorAreaInteriorArea_(half_edge, id_a, id_b);
bRelationKnown &= isPredicateKnown_(
MatrixPredicate.InteriorInterior);
}
if (m_per... | java | {
"resource": ""
} |
q154551 | RelationalOperationsMatrix.areaLinePredicates_ | train | private boolean areaLinePredicates_(int half_edge, int id_a, int id_b) {
boolean bRelationKnown = true;
if (m_perform_predicates[MatrixPredicate.InteriorInterior])
{
interiorAreaInteriorLine_(half_edge, id_a, id_b);
bRelationKnown &= isPredicateKnown_(MatrixPredicate.Int... | java | {
"resource": ""
} |
q154552 | RelationalOperationsMatrix.lineLinePredicates_ | train | private boolean lineLinePredicates_(int half_edge, int id_a, int id_b) {
boolean bRelationKnown = true;
if (m_perform_predicates[MatrixPredicate.InteriorInterior])
{
interiorLineInteriorLine_(half_edge, id_a, id_b, m_cluster_index_a, m_cluster_index_b);
bRelationKnown &=... | java | {
"resource": ""
} |
q154553 | RelationalOperationsMatrix.areaPointPredicates_ | train | private boolean areaPointPredicates_(int cluster, int id_a, int id_b) {
boolean bRelationKnown = true;
if (m_perform_predicates[MatrixPredicate.InteriorInterior])
{
interiorAreaInteriorPoint_(cluster, id_a);
bRelationKnown &= isPredicateKnown_(MatrixPredicate.InteriorInt... | java | {
"resource": ""
} |
q154554 | RelationalOperationsMatrix.linePointPredicates_ | train | private boolean linePointPredicates_(int cluster, int id_a, int id_b) {
boolean bRelationKnown = true;
if (m_perform_predicates[MatrixPredicate.InteriorInterior])
{
interiorLineInteriorPoint_(cluster, id_a, id_b, m_cluster_index_a);
bRelationKnown &= isPredicateKnown_(Ma... | java | {
"resource": ""
} |
q154555 | RelationalOperationsMatrix.pointPointPredicates_ | train | private boolean pointPointPredicates_(int cluster, int id_a, int id_b) {
boolean bRelationKnown = true;
if (m_perform_predicates[MatrixPredicate.InteriorInterior])
{
interiorPointInteriorPoint_(cluster, id_a, id_b);
bRelationKnown &= isPredicateKnown_(MatrixPredicate.Int... | java | {
"resource": ""
} |
q154556 | RelationalOperationsMatrix.interiorAreaInteriorArea_ | train | private void interiorAreaInteriorArea_(int half_edge, int id_a, int id_b) {
if (m_matrix[MatrixPredicate.InteriorInterior] == 2)
return;
int faceParentage = m_topo_graph.getHalfEdgeFaceParentage(half_edge);
if ((faceParentage & id_a) != 0 && (faceParentage & id_b) != 0)
m_matrix[MatrixPredicate.InteriorIn... | java | {
"resource": ""
} |
q154557 | RelationalOperationsMatrix.convertGeometry_ | train | private static Geometry convertGeometry_(Geometry geometry, double tolerance) {
int gt = geometry.getType().value();
if (Geometry.isSegment(gt)) {
Polyline polyline = new Polyline(geometry.getDescription());
polyline.addSegment((Segment) geometry, true);
return polyline;
}
if (gt == Geometry.Geometry... | java | {
"resource": ""
} |
q154558 | GeoDist.PE_EQ | train | static private boolean PE_EQ(double a, double b) {
return (a == b)
|| PE_ABS(a - b) <= PE_EPS * (1 + (PE_ABS(a) + PE_ABS(b)) / 2);
} | java | {
"resource": ""
} |
q154559 | ConstructOffset.addPoint | train | void addPoint(GraphicPoint offPt, int i_src) {
if (m_offsetPtCount == 0) // TODO: can we have this outside of this
// method?
{
addPoint(offPt);
return;
}
int n_src = m_srcPtCount;
GraphicPoint pt1, pt;
pt1 = m_srcPts.get(i_src == 0 ? n_src - 1 : i_src - 1);
pt = m_srcPts.get(i_src);
//... | java | {
"resource": ""
} |
q154560 | ConstructOffset.compressOffsetArray | train | void compressOffsetArray(int i0) {
int i_ = i0;
while (m_offsetPts.get(i_).m_prev < i_)
i_ = m_offsetPts.get(i_).m_prev;
int j = 0, i = i_;
do {
GraphicPoint pt = m_offsetPts.get(i);
m_offsetPts.set(j, pt);
i = pt.m_next;
j++;
} while (i != i_);
m_offsetPts.set(j, m_offsetPts.get(0)); // d... | java | {
"resource": ""
} |
q154561 | Point2D.compare | train | public int compare(Point2D other) {
return y < other.y ? -1 : (y > other.y ? 1 : (x < other.x ? -1
: (x > other.x ? 1 : 0)));
} | java | {
"resource": ""
} |
q154562 | Point2D.compareX | train | int compareX(Point2D other) {
return x < other.x ? -1 : (x > other.x ? 1 : (y < other.y ? -1
: (y > other.y ? 1 : 0)));
} | java | {
"resource": ""
} |
q154563 | Point2D._norm | train | double _norm(int metric) {
if (metric < 0 || _isNan())
return NumberUtils.NaN();
switch (metric) {
case 0: // L-infinite
return Math.abs(x) >= Math.abs(y) ? Math.abs(x) : Math.abs(y);
case 1: // L1 or Manhattan metric
return Math.abs(x) + Math.abs(y);
case 2: // L2 or Euclidean metric
return Ma... | java | {
"resource": ""
} |
q154564 | Point2D.orientationRobust | train | public static int orientationRobust(Point2D p, Point2D q, Point2D r) {
ECoordinate det_ec = new ECoordinate();
det_ec.set(q.x);
det_ec.sub(p.x);
ECoordinate rp_y_ec = new ECoordinate();
rp_y_ec.set(r.y);
rp_y_ec.sub(p.y);
ECoordinate qp_y_ec = new ECoordinate();
qp_y_ec.set(q.y);
qp_y_ec.sub(p.y);
... | java | {
"resource": ""
} |
q154565 | ECoordinate.log | train | void log(ECoordinate v) {
double d = v.m_eps / v.m_value;
m_value = Math.log(v.m_value);
m_eps = d * (1.0 + 0.5 * d) + epsCoordinate() * Math.abs(m_value);
} | java | {
"resource": ""
} |
q154566 | ECoordinate.tolEq | train | boolean tolEq(ECoordinate v, double tolerance) // ! == with tolerance
{
return Math.abs(m_value - v.m_value) <= tolerance || eq(v);
} | java | {
"resource": ""
} |
q154567 | ConvexHull.addGeometry | train | void addGeometry(Geometry geometry) {
if (geometry.isEmpty())
return;
int type = geometry.getType().value();
if (MultiVertexGeometry.isMultiVertex(type))
addMultiVertexGeometry_((MultiVertexGeometry) geometry);
else if (MultiPath.isSegment(type))
addSegment_((Segment) geometry);
else if (type == ... | java | {
"resource": ""
} |
q154568 | ConvexHull.getBoundingGeometry | train | Geometry getBoundingGeometry() {
// Extracts the convex hull from the tree. Reading the tree in order from first to last is the resulting convex hull.
Point point = new Point();
int first = m_tree_hull.getFirst(-1);
Polygon hull = new Polygon(m_shape.getVertexDescription());
if (m_tree_hull.size(-1) == 0)
... | java | {
"resource": ""
} |
q154569 | ConvexHull.construct | train | static int construct(Point2D[] points, int count, int[] out_convex_hull) {
ConvexHull convex_hull = new ConvexHull(points, count);
int t0 = 0, tm = 1;
Point2D pt_0 = points[t0];
while (tm < count && points[tm].isEqual(pt_0, NumberUtils.doubleEps()))
tm++; // We don't want to close the gap between t0 and tm... | java | {
"resource": ""
} |
q154570 | ConvexHull.isPathConvex | train | static boolean isPathConvex(MultiPath multi_path, int path_index, ProgressTracker progress_tracker) {
MultiPathImpl mimpl = (MultiPathImpl) multi_path._getImpl();
int path_start = mimpl.getPathStart(path_index);
int path_end = mimpl.getPathEnd(path_index);
boolean bxyclosed = !mimpl.isClosedPath(path_index) &&... | java | {
"resource": ""
} |
q154571 | ConvexHull.addMultiVertexGeometry_ | train | private void addMultiVertexGeometry_(MultiVertexGeometry mvg) {
Point point = new Point();
Point2D pt_p = new Point2D();
for (int i = 0; i < mvg.getPointCount(); i++) {
mvg.getXY(i, pt_p);
int p = addPoint_(pt_p);
if (p != -1) {
mvg.getPointByVal(i, point);
int tp = m_shape.addPoint(m_path_hand... | java | {
"resource": ""
} |
q154572 | Point.getXY | train | public final Point2D getXY() {
if (isEmptyImpl())
throw new GeometryException(
"This operation should not be performed on an empty geometry.");
Point2D pt = new Point2D();
pt.setCoords(m_attributes[0], m_attributes[1]);
return pt;
} | java | {
"resource": ""
} |
q154573 | Point.getXYZ | train | public Point3D getXYZ() {
if (isEmptyImpl())
throw new GeometryException(
"This operation should not be performed on an empty geometry.");
Point3D pt = new Point3D();
pt.x = m_attributes[0];
pt.y = m_attributes[1];
if (m_description.hasZ())
pt.z = m_attributes[2];
else
pt.z = VertexDescriptio... | java | {
"resource": ""
} |
q154574 | Point.setXYZ | train | public void setXYZ(Point3D pt) {
_touch();
boolean bHasZ = hasAttribute(Semantics.Z);
if (!bHasZ && !VertexDescription.isDefaultValue(Semantics.Z, pt.z)) {// add
// Z
// only
// if
// pt.z
// is
... | java | {
"resource": ""
} |
q154575 | Point.getAttributeAsInt | train | public int getAttributeAsInt(int semantics, int ordinate) {
if (isEmptyImpl())
throw new GeometryException(
"This operation was performed on an Empty Geometry.");
int ncomps = VertexDescription.getComponentCount(semantics);
if (ordinate >= ncomps)
throw new IndexOutOfBoundsException();
int attribut... | java | {
"resource": ""
} |
q154576 | Point.setAttribute | train | public void setAttribute(int semantics, int ordinate, double value) {
_touch();
int ncomps = VertexDescription.getComponentCount(semantics);
if (ncomps < ordinate)
throw new IndexOutOfBoundsException();
int attributeIndex = m_description.getAttributeIndex(semantics);
if (attributeIndex < 0) {
addAttrib... | java | {
"resource": ""
} |
q154577 | Point._setToDefault | train | void _setToDefault() {
resizeAttributes(m_description.getTotalComponentCount());
Point.attributeCopy(m_description._getDefaultPointAttributes(),
m_attributes, m_description.getTotalComponentCount());
m_attributes[0] = NumberUtils.NaN();
m_attributes[1] = NumberUtils.NaN();
} | java | {
"resource": ""
} |
q154578 | Point.setXY | train | public void setXY(double x, double y) {
_touch();
if (m_attributes == null)
_setToDefault();
m_attributes[0] = x;
m_attributes[1] = y;
} | java | {
"resource": ""
} |
q154579 | TopoGraph.removeShape | train | void removeShape() {
if (m_shape == null)
return;
if (m_geometryIDIndex != -1) {
m_shape.removeGeometryUserIndex(m_geometryIDIndex);
m_geometryIDIndex = -1;
}
if (m_clusterIndex != -1) {
m_shape.removeUserIndex(m_clusterIndex);
m_clusterIndex = -1;
}
if (m_halfEdgeIndex != -1) {
m_shape... | java | {
"resource": ""
} |
q154580 | TopoGraph.getXY | train | void getXY(int cluster, Point2D pt) {
int vindex = getClusterVertexIndex_(cluster);
m_shape.getXYWithIndex(vindex, pt);
} | java | {
"resource": ""
} |
q154581 | TopoGraph.getClusterUserIndex | train | int getClusterUserIndex(int cluster, int index) {
int i = getClusterIndex_(cluster);
AttributeStreamOfInt32 stream = m_clusterIndices.get(index);
if (stream.size() <= i)
return -1;
return stream.read(i);
} | java | {
"resource": ""
} |
q154582 | TopoGraph.setClusterUserIndex | train | void setClusterUserIndex(int cluster, int index, int value) {
int i = getClusterIndex_(cluster);
AttributeStreamOfInt32 stream = m_clusterIndices.get(index);
if (stream.size() <= i)
stream.resize(m_clusterData.size(), -1);
stream.write(i, value);
} | java | {
"resource": ""
} |
q154583 | TopoGraph.createUserIndexForClusters | train | int createUserIndexForClusters() {
if (m_clusterIndices == null) {
m_clusterIndices = new ArrayList<AttributeStreamOfInt32>(3);
}
AttributeStreamOfInt32 new_stream = new AttributeStreamOfInt32(
m_clusterData.capacity(), -1);
for (int i = 0, n = m_clusterIndices.size(); i < n; i++) {
if (m_clusterIndi... | java | {
"resource": ""
} |
q154584 | TopoGraph.getHalfEdgeUserIndex | train | int getHalfEdgeUserIndex(int half_edge, int index) {
int i = getHalfEdgeIndex_(half_edge);
AttributeStreamOfInt32 stream = m_edgeIndices.get(index);
if (stream.size() <= i)
return -1;
return stream.read(i);
} | java | {
"resource": ""
} |
q154585 | TopoGraph.setHalfEdgeUserIndex | train | void setHalfEdgeUserIndex(int half_edge, int index, int value) {
int i = getHalfEdgeIndex_(half_edge);
AttributeStreamOfInt32 stream = m_edgeIndices.get(index);
if (stream.size() <= i)
stream.resize(m_halfEdgeData.size(), -1);
stream.write(i, value);
} | java | {
"resource": ""
} |
q154586 | TopoGraph.createUserIndexForHalfEdges | train | int createUserIndexForHalfEdges() {
if (m_edgeIndices == null)
m_edgeIndices = new ArrayList<AttributeStreamOfInt32>(3);
AttributeStreamOfInt32 new_stream = new AttributeStreamOfInt32(
m_halfEdgeData.capacity(), -1);
for (int i = 0, n = m_edgeIndices.size(); i < n; i++) {
if (m_edgeIndices.get(i) == nu... | java | {
"resource": ""
} |
q154587 | TopoGraph.deleteUserIndexForHalfEdges | train | void deleteUserIndexForHalfEdges(int userIndex) {
assert (m_edgeIndices.get(userIndex) != null);
m_edgeIndices.set(userIndex, null);
} | java | {
"resource": ""
} |
q154588 | TopoGraph.deleteEdgeInternal_ | train | int deleteEdgeInternal_(int half_edge) {
int chain = getHalfEdgeChain(half_edge);
int halfEdgeTwin = getHalfEdgeTwin(half_edge);
int chainTwin = getHalfEdgeChain(halfEdgeTwin);
// This function only works for spikes. These two asserts check for that
assert (chainTwin == chain);
assert (half_edge == getHalfE... | java | {
"resource": ""
} |
q154589 | TopoGraph.deleteEdgesBreakFaces_ | train | void deleteEdgesBreakFaces_(AttributeStreamOfInt32 edgesToDelete) {
for (int i = 0, n = edgesToDelete.size(); i < n; i++) {
int half_edge = edgesToDelete.get(i);
int chain = getHalfEdgeChain(half_edge);
int halfEdgeTwin = getHalfEdgeTwin(half_edge);
int chainTwin = getHalfEdgeChain(halfEdgeTwin);
setCh... | java | {
"resource": ""
} |
q154590 | TopoGraph.getChainArea | train | double getChainArea(int chain) {
int chainIndex = getChainIndex_(chain);
double v = m_chainAreas.read(chainIndex);
if (NumberUtils.isNaN(v)) {
updateChainAreaAndPerimeter_(chain);
v = m_chainAreas.read(chainIndex);
}
return v;
} | java | {
"resource": ""
} |
q154591 | TopoGraph.getChainPerimeter | train | double getChainPerimeter(int chain) {
int chainIndex = getChainIndex_(chain);
double v = m_chainPerimeters.read(chainIndex);
if (NumberUtils.isNaN(v)) {
updateChainAreaAndPerimeter_(chain);
v = m_chainPerimeters.read(chainIndex);
}
return v;
} | java | {
"resource": ""
} |
q154592 | TopoGraph.getChainUserIndex | train | int getChainUserIndex(int chain, int index) {
int i = getChainIndex_(chain);
AttributeStreamOfInt32 stream = m_chainIndices.get(index);
if (stream.size() <= i)
return -1;
return stream.read(i);
} | java | {
"resource": ""
} |
q154593 | TopoGraph.setChainUserIndex | train | void setChainUserIndex(int chain, int index, int value) {
int i = getChainIndex_(chain);
AttributeStreamOfInt32 stream = m_chainIndices.get(index);
if (stream.size() <= i)
stream.resize(m_chainData.size(), -1);
stream.write(i, value);
} | java | {
"resource": ""
} |
q154594 | TopoGraph.createUserIndexForChains | train | int createUserIndexForChains() {
if (m_chainIndices == null) {
m_chainIndices = new ArrayList<AttributeStreamOfInt32>(3);
}
AttributeStreamOfInt32 new_stream = new AttributeStreamOfInt32(
m_chainData.capacity(), -1);
for (int i = 0, n = m_chainIndices.size(); i < n; i++) {
if (m_chainIndices.get(i) =... | java | {
"resource": ""
} |
q154595 | TopoGraph.getHalfEdgeConnector | train | int getHalfEdgeConnector(int clusterFrom, int clusterTo) {
int first_edge = getClusterHalfEdge(clusterFrom);
if (first_edge == -1)
return -1;
int edge = first_edge;
int firstEdgeTo = -1;
int eTo = -1;
// Doing two loops in parallel - one on the half-edges attached to the
// clusterFrom, another - attac... | java | {
"resource": ""
} |
q154596 | QuadTreeImpl.reset | train | void reset(Envelope2D extent, int height) {
m_quad_tree_nodes.deleteAll(false);
m_element_nodes.deleteAll(false);
m_data.clear();
m_free_data.clear(false);
reset_(extent, height);
} | java | {
"resource": ""
} |
q154597 | QuadTreeImpl.insert | train | int insert(int element, Envelope2D bounding_box) {
if (m_root == -1)
create_root_();
if (m_b_store_duplicates) {
int success = insert_duplicates_(element, bounding_box, 0, m_extent, m_root, false, -1);
if (success != -1) {
if (m_data_extent.isEmpty())
m_data_extent.setCoords(bounding_box);
e... | java | {
"resource": ""
} |
q154598 | QuadTreeImpl.insert | train | int insert(int element, Envelope2D bounding_box, int hint_index) {
if (m_root == -1)
create_root_();
if (m_b_store_duplicates) {
int success = insert_duplicates_(element, bounding_box, 0, m_extent, m_root, false, -1);
if (success != -1) {
if (m_data_extent.isEmpty())
m_data_extent.setCoords(boun... | java | {
"resource": ""
} |
q154599 | QuadTreeImpl.removeElement | train | void removeElement(int element_handle) {
if (m_b_store_duplicates)
throw new GeometryException("invalid call");
int quad_handle = get_quad_(element_handle);
disconnect_element_handle_(element_handle);
free_element_and_box_node_(element_handle);
int q = quad_handle;
while (q != -1) {
set_sub_tree_el... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.