Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 1998, 2024 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0,
* or the Eclipse Distribution License v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
// Contributors:
// Oracle - initial API and implementation from Oracle TopLink
package org.eclipse.persistence.expressions.spatial;
import org.eclipse.persistence.expressions.Expression;
import org.eclipse.persistence.expressions.ExpressionOperator;
import org.eclipse.persistence.internal.expressions.FunctionExpression;
import java.util.ArrayList;
import java.util.List;
import static org.eclipse.persistence.expressions.ExpressionOperator.SDO_FILTER;
import static org.eclipse.persistence.expressions.ExpressionOperator.SDO_NN;
import static org.eclipse.persistence.expressions.ExpressionOperator.SDO_RELATE;
import static org.eclipse.persistence.expressions.ExpressionOperator.SDO_WITHIN_DISTANCE;
/**
* This class is used to construct expressions that use Oracle Spatial operators
*
*
*
* @since Oracle TopLink 11.1.1.0.0
*/
public final class SpatialExpressionFactory {
private SpatialExpressionFactory() {
// no instance please
}
/**
* PUBLIC:
* Return an Expression for the MDSYS.SDO_WITHIN_DISTANCE Spatial Operator on the Oracle Database
* Use of this expression requires the Java spatial classes
*
*
*
* @param geom1 an Expression representing a JGeometryObject
* @param geom2 a JGeometryObject or an Expression representing a JGeometryObject
* @param params a SpatialParameters object configured with the parameters to the call
* @return a TopLink Expression
*/
public static Expression withinDistance(Expression geom1, Object geom2, SpatialParameters params) {
String stringParameters = params == null ? null : params.getParameterString();
return getSpatialExpression(SDO_WITHIN_DISTANCE, geom1, geom2, stringParameters);
}
/**
* PUBLIC:
* Return an Expression for the MDSYS.MDSYS.SDO_RELATE Spatial Operator on the Oracle Database
* Use of this operator requires the Java spatial classes
*
*
*
* @param geom1 an Expression representing a JGeometryObject
* @param geom2 a JGeometryObject or an Expression representing a JGeometryObject
* @param params a SpatialParameters object configured with the parameters to the call
* @return a TopLink Expression
*/
public static Expression relate(Expression geom1, Object geom2, SpatialParameters params) {
String stringParameters = params == null ? null : params.getParameterString();
return getSpatialExpression(SDO_RELATE, geom1, geom2, stringParameters);
}
/**
* PUBLIC:
* Return an Expression for the MDSYS.SDO_FILTER Spatial Operator on the Oracle Database
* Use of this operator requires the Java spatial classes
*
*
*
* @param geom1 an Expression representing a JGeometryObject
* @param geom2 a JGeometryObject or an Expression representing a JGeometryObject
* @param params a SpatialParameters object configured with the parameters to the call
* @return a TopLink Expression
*/
public static Expression filter(Expression geom1, Object geom2, SpatialParameters params) {
String stringParameters = params == null ? null : params.getParameterString();
return getSpatialExpression(SDO_FILTER, geom1, geom2, stringParameters);
}
/**
* PUBLIC:
* Return an Expression for the MDSYS.SDO_NN Spatial Operator on the Oracle Database
* Use of this operator requires the Java spatial classes
*
*
*
* @param geom1 an Expression representing a JGeometryObject
* @param geom2 a JGeometryObject or an Expression representing a JGeometryObject
* @param params a SpatialParameters object configured with the parameters to the call
* @return a TopLink Expression
*/
public static Expression nearestNeighbor(Expression geom1, Object geom2, SpatialParameters params) {
String stringParameters = params == null ? null : params.getParameterString();
return getSpatialExpression(SDO_NN, geom1, geom2, stringParameters);
}
/**
* INTERNAL:
* A utility method to build a SpatialExpression
*
* @param operator the ordinal of the operator
*/
public static Expression getSpatialExpression(int operator, Expression geom1, Object geom2, String params) {
List