congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
OSQLFilterCondition
Code IndexAdd Tabnine to your IDE (free)

How to use
OSQLFilterCondition
in
com.orientechnologies.orient.core.sql.filter

Best Java code snippets using com.orientechnologies.orient.core.sql.filter.OSQLFilterCondition (Showing top 20 results out of 315)

origin: orientechnologies/orientdb-lucene

public static OIndexSearchResult createIndexedProperty(final OSQLFilterCondition iCondition, final Object iItem) {
 if (iItem == null || !(iItem instanceof OSQLFilterItemField))
  return null;
 if (iCondition.getLeft() instanceof OSQLFilterItemField && iCondition.getRight() instanceof OSQLFilterItemField)
  return null;
 final OSQLFilterItemField item = (OSQLFilterItemField) iItem;
 if (item.hasChainOperators() && !item.isFieldChain())
  return null;
 final Object origValue = iCondition.getLeft() == iItem ? iCondition.getRight() : iCondition.getLeft();
 if (iCondition.getOperator() instanceof OQueryOperatorBetween || iCondition.getOperator() instanceof OQueryOperatorIn) {
  return new OIndexSearchResult(iCondition.getOperator(), item.getFieldChain(), origValue);
 }
 final Object value = OSQLHelper.getValue(origValue);
 if (value == null)
  return null;
 return new OIndexSearchResult(iCondition.getOperator(), item.getFieldChain(), value);
}
origin: com.orientechnologies/orientdb-core

public Object evaluate(final OIdentifiable iRecord, final ODocument iCurrentResult, final OCommandContext iContext) {
 if (rootCondition == null) {
  return true;
 }
 return rootCondition.evaluate(iRecord, iCurrentResult, iContext);
}
origin: com.orientechnologies/orientdb-core

public List<String> getInvolvedFields(final List<String> list) {
 extractInvolvedFields(getLeft(), list);
 extractInvolvedFields(getRight(), list);
 return list;
}
origin: com.orientechnologies/orientdb-core

@Override
public ORID getBeginRidRange(Object iLeft, Object iRight) {
 if (iLeft instanceof OSQLFilterCondition) {
  final ORID beginRange = ((OSQLFilterCondition) iLeft).getBeginRidRange();
  final ORID endRange = ((OSQLFilterCondition) iLeft).getEndRidRange();
  if (beginRange == null && endRange == null)
   return null;
  else if (beginRange == null)
   return endRange;
  else if (endRange == null)
   return null;
  else
   return null;
 }
 return null;
}
origin: com.orientechnologies/orientdb-core

@Override
protected boolean evaluateExpression(final OIdentifiable iRecord, final OSQLFilterCondition iCondition, final Object iLeft,
  final Object iRight, final OCommandContext iContext) {
 final OSQLFilterCondition condition;
 final Object target;
 if (iCondition.getLeft() instanceof OSQLFilterCondition) {
  condition = (OSQLFilterCondition) iCondition.getLeft();
  target = iRight;
 } else {
  condition = (OSQLFilterCondition) iCondition.getRight();
  target = iLeft;
 }
 final Set<ORID> evaluatedRecords = new HashSet<ORID>();
 return traverse(target, condition, 0, evaluatedRecords, iContext);
}
origin: com.orientechnologies/orientdb-core

OQueryOperator operator = condition.getOperator();
while (operator == null) {
 if (condition.getRight() == null && condition.getLeft() instanceof OSQLFilterCondition) {
  condition = (OSQLFilterCondition) condition.getLeft();
  operator = condition.getOperator();
 } else {
  return condition;
final OIndexReuseType reuseType = operator.getIndexReuseType(condition.getLeft(), condition.getRight());
switch (reuseType) {
case INDEX_METHOD:
 if (isCovered(indexMatch, operator, condition.getLeft(), condition.getRight())
   || isCovered(indexMatch, operator, condition.getRight(), condition.getLeft())) {
  return null;
 if (condition.getLeft() instanceof OSQLFilterCondition)
  condition.setLeft(optimize((OSQLFilterCondition) condition.getLeft(), indexMatch));
 if (condition.getRight() instanceof OSQLFilterCondition)
  condition.setRight(optimize((OSQLFilterCondition) condition.getRight(), indexMatch));
 if (condition.getLeft() == null)
  return (OSQLFilterCondition) condition.getRight();
 if (condition.getRight() == null)
  return (OSQLFilterCondition) condition.getLeft();
 return condition;
 if (isCovered(indexMatch, operator, condition.getLeft(), condition.getRight())
   || isCovered(indexMatch, operator, condition.getRight(), condition.getLeft())) {
origin: com.orientechnologies/orientdb-core

final OSQLFilterCondition condition;
if (iCondition.getLeft() instanceof OSQLFilterCondition)
  condition = (OSQLFilterCondition) iCondition.getLeft();
else if (iCondition.getRight() instanceof OSQLFilterCondition)
  condition = (OSQLFilterCondition) iCondition.getRight();
else
  condition = null;
      if ((Boolean) condition.evaluate(o, null, iContext) == Boolean.FALSE)
        return false;
      if ((Boolean) condition.evaluate(o, null, iContext) == Boolean.FALSE)
        return false;
origin: com.orientechnologies/orientdb-core

final Object right = condition.getRight();
final Object left = condition.getLeft();
final OQueryOperator operator = condition.getOperator();
if (!(operator instanceof OQueryOperatorAnd)) {
 return null;
if (rightCondition.getLeft() instanceof OSQLFilterItemField && rightCondition.getRight() instanceof OSQLFilterItemField) {
 return null;
if (!(rightCondition.getLeft() instanceof OSQLFilterItemField) && !(rightCondition.getRight() instanceof OSQLFilterItemField)) {
 return null;
if (leftCondition.getLeft() instanceof OSQLFilterItemField && leftCondition.getRight() instanceof OSQLFilterItemField) {
 return null;
if (!(leftCondition.getLeft() instanceof OSQLFilterItemField) && !(leftCondition.getRight() instanceof OSQLFilterItemField)) {
 return null;
if (rightCondition.getLeft() instanceof OSQLFilterItemField) {
 final OSQLFilterItemField itemField = (OSQLFilterItemField) rightCondition.getLeft();
 if (!itemField.isFieldChain()) {
  return null;
 betweenBoundaries.add(rightCondition.getRight());
} else if (rightCondition.getRight() instanceof OSQLFilterItemField) {
 final OSQLFilterItemField itemField = (OSQLFilterItemField) rightCondition.getRight();
 if (!itemField.isFieldChain()) {
  return null;
origin: com.orientechnologies/orientdb-core

Object l = evaluate(iCurrentRecord, iCurrentResult, left, iContext, binaryEvaluation);
Object r = evaluate(iCurrentRecord, iCurrentResult, right, iContext, binaryEvaluation);
 final OCollate collate = operator instanceof OQueryOperatorMatches ? null : getCollate(iCurrentRecord);
 final Object[] convertedValues = checkForConversion(iCurrentRecord, l, r, collate);
 if (convertedValues != null) {
  l = convertedValues[0];
} catch (Exception e) {
 if (OLogManager.instance().isDebugEnabled())
  OLogManager.instance().debug(this, "Error on evaluating expression (%s)", e, toString());
 result = Boolean.FALSE;
origin: orientechnologies/orientdb-lucene

 protected Collection<String> fields(OSQLFilterCondition iCondition) {

  Object left = iCondition.getLeft();

  if (left instanceof String) {
   String fName = (String) left;
   return Arrays.asList(fName);
  }
  if (left instanceof Collection) {
   Collection<OSQLFilterItemField> f = (Collection<OSQLFilterItemField>) left;

   List<String> fields = new ArrayList<String>();
   for (OSQLFilterItemField field : f) {
    fields.add(field.toString());
   }
   return fields;
  }
  if (left instanceof OSQLFilterItemField) {

   OSQLFilterItemField fName = (OSQLFilterItemField) left;
   return Arrays.asList(fName.toString());
  }
  return Collections.emptyList();
 }
}
origin: com.orientechnologies/orientdb-core

 } else if (!(l instanceof OQueryRuntimeValueMulti) && !(l instanceof Collection<?>) && !l.getClass().isArray()
   && !(l instanceof Map)) {
  result = new Object[] { getInteger(l), r };
 } else if (!(r instanceof OQueryRuntimeValueMulti) && !(r instanceof Collection<?>) && !r.getClass().isArray()
   && !(r instanceof Map)) {
  result = new Object[] { l, getInteger(r) };
 result = new Object[] { getDate(l), r };
} else if (l instanceof Date && !(r instanceof Collection || r instanceof Date)) {
 result = new Object[] { l, getDate(r) };
 result = new Object[] { getFloat(l), r };
} else if (l instanceof Float && !(r instanceof Float || r instanceof Collection)) {
 result = new Object[] { l, getFloat(r) };
origin: com.orientechnologies/orientdb-core

 return currentCondition;
if (nextOperator.precedence > currentCondition.getOperator().precedence) {
 final OSQLFilterCondition subCondition = new OSQLFilterCondition(currentCondition.right, nextOperator);
 currentCondition.right = subCondition;
 subCondition.right = extractConditionItem(false, 1);
} else {
 final OSQLFilterCondition parentCondition = new OSQLFilterCondition(currentCondition, nextOperator);
 parentCondition.right = extractConditions(parentCondition);
 currentCondition = parentCondition;
origin: com.orientechnologies/orientdb-core

private OIndexSearchResult analyzeOperator(OClass iSchemaClass, OSQLFilterCondition condition,
  List<OIndexSearchResult> iIndexSearchResults, OCommandContext iContext) {
 return condition.getOperator().getOIndexSearchResult(iSchemaClass, condition, iIndexSearchResults, iContext);
}
origin: com.orientechnologies/orientdb-core

private OSQLFilterCondition resetOperatorPrecedence(OSQLFilterCondition iCondition) {
 if (iCondition == null) {
  return iCondition;
 }
 if (iCondition.left != null && iCondition.left instanceof OSQLFilterCondition) {
  iCondition.left = resetOperatorPrecedence((OSQLFilterCondition) iCondition.left);
 }
 if (iCondition.right != null && iCondition.right instanceof OSQLFilterCondition) {
  OSQLFilterCondition right = (OSQLFilterCondition) iCondition.right;
  iCondition.right = resetOperatorPrecedence(right);
  if (iCondition.operator != null) {
   if (!right.inBraces && right.operator != null && right.operator.precedence < iCondition.operator.precedence) {
    OSQLFilterCondition newLeft = new OSQLFilterCondition(iCondition.left, iCondition.operator, right.left);
    right.setLeft(newLeft);
    resetOperatorPrecedence(right);
    return right;
   }
  }
 }
 return iCondition;
}
origin: com.orientechnologies/orientdb-lucene

@Override
public Object evaluateRecord(OIdentifiable iRecord, ODocument iCurrentResult, OSQLFilterCondition iCondition, Object iLeft,
  Object iRight, OCommandContext iContext, final ODocumentSerializer serializer) {
 OSQLFunction function = OSQLEngine.getInstance().getFunction(keyword);
 return function.execute(this, iRecord, iCurrentResult, new Object[] { iLeft, iCondition.getRight() }, iContext);
}
origin: com.orientechnologies/orientdb-core

@Override
public ORID getBeginRidRange(final Object iLeft, final Object iRight) {
 final ORID leftRange;
 final ORID rightRange;
 if (iLeft instanceof OSQLFilterCondition)
  leftRange = ((OSQLFilterCondition) iLeft).getBeginRidRange();
 else
  leftRange = null;
 if (iRight instanceof OSQLFilterCondition)
  rightRange = ((OSQLFilterCondition) iRight).getBeginRidRange();
 else
  rightRange = null;
 if (leftRange == null || rightRange == null)
  return null;
 else
  return leftRange.compareTo(rightRange) <= 0 ? leftRange : rightRange;
}
origin: com.orientechnologies/orientdb-core

protected OSQLFilterCondition extractCondition() {
 if (!parserSkipWhiteSpaces())
  // END OF TEXT
  return null;
 // EXTRACT ITEMS
 Object left = extractConditionItem(true, 1);
 if (left != null && checkForEnd(left.toString()))
  return null;
 OQueryOperator oper;
 final Object right;
 if (left instanceof OQueryOperator && ((OQueryOperator) left).isUnary()) {
  oper = (OQueryOperator) left;
  left = extractConditionItem(false, 1);
  right = null;
 } else {
  oper = extractConditionOperator();
  if (oper instanceof OQueryOperatorNot)
   // SPECIAL CASE: READ NEXT OPERATOR
   oper = new OQueryOperatorNot(extractConditionOperator());
  if(oper instanceof OQueryOperatorAnd || oper instanceof OQueryOperatorOr){
   right = extractCondition();
  }else {
   right = oper != null ? extractConditionItem(false, oper.expectedRightWords) : null;
  }
 }
 // CREATE THE CONDITION OBJECT
 return new OSQLFilterCondition(left, oper, right);
}
origin: com.orientechnologies/orientdb-core

private void mergeRangeConditionsToBetweenOperators(OSQLFilterCondition condition) {
 if (condition == null) {
  return;
 }
 OSQLFilterCondition newCondition;
 if (condition.getLeft() instanceof OSQLFilterCondition) {
  OSQLFilterCondition leftCondition = (OSQLFilterCondition) condition.getLeft();
  newCondition = convertToBetweenClause(leftCondition);
  if (newCondition != null) {
   condition.setLeft(newCondition);
   metricRecorder.recordRangeQueryConvertedInBetween();
  } else {
   mergeRangeConditionsToBetweenOperators(leftCondition);
  }
 }
 if (condition.getRight() instanceof OSQLFilterCondition) {
  OSQLFilterCondition rightCondition = (OSQLFilterCondition) condition.getRight();
  newCondition = convertToBetweenClause(rightCondition);
  if (newCondition != null) {
   condition.setRight(newCondition);
   metricRecorder.recordRangeQueryConvertedInBetween();
  } else {
   mergeRangeConditionsToBetweenOperators(rightCondition);
  }
 }
}
origin: com.orientechnologies/orientdb-core

private List<List<OIndexSearchResult>> analyzeUnion(OClass iSchemaClass, OSQLFilterCondition condition,
  OCommandContext iContext) {
 List<List<OIndexSearchResult>> result = new ArrayList<List<OIndexSearchResult>>();
 result.addAll(analyzeOrFilterBranch(iSchemaClass, (OSQLFilterCondition) condition.getLeft(), iContext));
 result.addAll(analyzeOrFilterBranch(iSchemaClass, (OSQLFilterCondition) condition.getRight(), iContext));
 return result;
}
origin: com.orientechnologies/orientdb-core

 final Object iRight, OCommandContext iContext) {
final OSQLFilterCondition condition;
if (iCondition.getLeft() instanceof OSQLFilterCondition)
 condition = (OSQLFilterCondition) iCondition.getLeft();
else if (iCondition.getRight() instanceof OSQLFilterCondition)
 condition = (OSQLFilterCondition) iCondition.getRight();
else
 condition = null;
    continue;
   if ((Boolean) condition.evaluate(id, null, iContext) == Boolean.TRUE)
    return true;
  if(iCondition.getLeft() instanceof OSQLFilterItemField && ((OSQLFilterItemField) iCondition.getLeft()).isFieldChain() && ((OSQLFilterItemField) iCondition.getLeft()).getFieldChain().getItemCount()==1){
   String fieldName = ((OSQLFilterItemField) iCondition.getLeft()).getFieldChain().getItemName(0);
   if(fieldName!=null) {
    Object record = iRecord.getRecord();
   if ((Boolean) condition.evaluate(o, null, iContext) == Boolean.TRUE)
    return true;
com.orientechnologies.orient.core.sql.filterOSQLFilterCondition

Javadoc

Run-time query condition evaluator.

Most used methods

  • getLeft
  • getOperator
  • getRight
  • <init>
  • checkForConversion
  • evaluate
  • extractInvolvedFields
  • getBeginRidRange
  • getCollate
  • getDate
  • getEndRidRange
  • getFloat
  • getEndRidRange,
  • getFloat,
  • getInteger,
  • getInvolvedFields,
  • setLeft,
  • setRight,
  • toString

Popular in Java

  • Finding current android device location
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getSystemService (Context)
  • getResourceAsStream (ClassLoader)
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now