Updated Replace by Expression

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@100026 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-09-18 15:46:32 +00:00
parent 33cefe2f32
commit 0d1d8c0e78
1 changed files with 219 additions and 265 deletions

View File

@ -1,6 +1,5 @@
package org.gcube.portlets.user.td.expressionwidget.shared.model; package org.gcube.portlets.user.td.expressionwidget.shared.model;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable.C_Equals; import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable.C_Equals;
@ -16,7 +15,6 @@ import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_TextEndsWith; import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_TextEndsWith;
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_TextMatchSQLRegexp; import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C_TextMatchSQLRegexp;
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_ColumnReferencePlaceholder; import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_ColumnReferencePlaceholder;
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_ConstantList;
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_Range; import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_Range;
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_TypedColumnReference; import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_TypedColumnReference;
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.TD_Value; import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.TD_Value;
@ -33,50 +31,50 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeM
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
/** /**
* OperatorTypeMap creates a C_Expression usable client-side * OperatorTypeMap creates a C_Expression usable client-side
* *
* @author "Giancarlo Panichi" * @author "Giancarlo Panichi" <a
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> * href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* *
*/ */
public class OperatorTypeMap { public class OperatorTypeMap {
private String readableExpression; private String readableExpression;
public OperatorTypeMap(){ public OperatorTypeMap() {
} }
public C_Expression map(ColumnData column,C_OperatorType operatorType, String firstArg, String secondArg){ public C_Expression map(ColumnData column, C_OperatorType operatorType,
String firstArg, String secondArg) {
Log.debug("OperatorTypeMap Map"); Log.debug("OperatorTypeMap Map");
C_Expression exp=null; C_Expression exp = null;
readableExpression=new String(); readableExpression = new String();
if(column.getTrId()==null){ if (column.getTrId() == null) {
exp=mapPlaceHolder(column,operatorType,firstArg,secondArg); exp = mapPlaceHolder(column, operatorType, firstArg, secondArg);
} else { } else {
exp=mapTypedColumnReference(column,operatorType,firstArg,secondArg); exp = mapTypedColumnReference(column, operatorType, firstArg,
secondArg);
} }
return exp; return exp;
} }
public C_Expression mapPlaceHolder(ColumnData column,C_OperatorType operatorType, String firstArg, String secondArg){ public C_Expression mapPlaceHolder(ColumnData column,
C_OperatorType operatorType, String firstArg, String secondArg) {
Log.debug("OperatorTypeMap Map Place Holder"); Log.debug("OperatorTypeMap Map Place Holder");
C_Expression exp = null; C_Expression exp = null;
Log.debug("Column Data Type Name:"+column.getDataTypeName()); Log.debug("Column Data Type Name:" + column.getDataTypeName());
ColumnDataType dataType=ColumnTypeMap.getColumnDataType(column.getDataTypeName()); ColumnDataType dataType = ColumnTypeMap.getColumnDataType(column
Log.debug("Data Type:"+dataType); .getDataTypeName());
C_ColumnReferencePlaceholder placeHolder=new C_ColumnReferencePlaceholder(dataType Log.debug("Data Type:" + dataType);
, column.getColumnId()); C_ColumnReferencePlaceholder placeHolder = new C_ColumnReferencePlaceholder(
Log.debug("placeHolder:"+placeHolder); dataType, column.getColumnId());
String readablePlaceHolder=column.getColumnId(); Log.debug("placeHolder:" + placeHolder);
String readablePlaceHolder = column.getColumnId();
List<TD_Value> arguments=new ArrayList<TD_Value>();
TD_Value fArg; TD_Value fArg;
TD_Value sArg; TD_Value sArg;
C_Range range; C_Range range;
int separator;
switch (operatorType) { switch (operatorType) {
case ADDITION: case ADDITION:
@ -88,90 +86,81 @@ public class OperatorTypeMap {
case ANY: case ANY:
break; break;
case BEGINS_WITH: case BEGINS_WITH:
exp=new C_TextBeginsWith(placeHolder,new TD_Value(dataType,firstArg)); exp = new C_TextBeginsWith(placeHolder, new TD_Value(dataType,
readableExpression="Begins("+readablePlaceHolder+", "+firstArg+")"; firstArg));
readableExpression = "Begins(" + readablePlaceHolder + ", "
+ firstArg + ")";
break; break;
case BETWEEN: case BETWEEN:
fArg=new TD_Value(dataType,firstArg); fArg = new TD_Value(dataType, firstArg);
sArg=new TD_Value(dataType,secondArg); sArg = new TD_Value(dataType, secondArg);
range=new C_Range(fArg,sArg); range = new C_Range(fArg, sArg);
exp=new C_Between(placeHolder,range); exp = new C_Between(placeHolder, range);
readableExpression="Between("+readablePlaceHolder+", Range("+firstArg+", "+secondArg+"))"; readableExpression = "Between(" + readablePlaceHolder + ", Range("
+ firstArg + ", " + secondArg + "))";
break; break;
case CONTAINS: case CONTAINS:
separator=firstArg.indexOf(","); fArg = new TD_Value(dataType, firstArg);
if(separator==-1|| firstArg.length()==1){ exp = new C_TextContains(placeHolder, fArg);
arguments.add(new TD_Value(dataType,firstArg)); readableExpression = "Contains(" + readablePlaceHolder + ", "
} else { + firstArg + ")";
String arg;
boolean end=false;
while(!end){
arg=firstArg.substring(0, separator);
arguments.add(new TD_Value(dataType,arg));
separator++;
if(separator<firstArg.length()){
firstArg=firstArg.substring(separator,firstArg.length());
separator=firstArg.indexOf(",");
if(separator==-1){
arguments.add(new TD_Value(dataType,firstArg));
end=true;
}
} else {
end=true;
}
}
}
exp=new C_TextContains(placeHolder,new C_ConstantList(arguments));
readableExpression="Contains("+readablePlaceHolder;
for(TD_Value v:arguments){
readableExpression+=", "+v.getValue();
}
readableExpression+=")";
break; break;
case DIVISION: case DIVISION:
break; break;
case ENDS_WITH: case ENDS_WITH:
exp=new C_TextEndsWith(placeHolder,new TD_Value(dataType,firstArg)); exp = new C_TextEndsWith(placeHolder, new TD_Value(dataType,
readableExpression="TextEndsWith("+readablePlaceHolder+","+firstArg+")"; firstArg));
readableExpression = "TextEndsWith(" + readablePlaceHolder + ","
+ firstArg + ")";
break; break;
case EQUALS: case EQUALS:
exp=new C_Equals(placeHolder,new TD_Value(dataType,firstArg)); exp = new C_Equals(placeHolder, new TD_Value(dataType, firstArg));
readableExpression="Equals("+readablePlaceHolder+","+firstArg+")"; readableExpression = "Equals(" + readablePlaceHolder + ","
+ firstArg + ")";
break; break;
case EXISTS: case EXISTS:
//exp=new C_Exi(placeHolder,new C_ConstantList(arguments)); // exp=new C_Exi(placeHolder,new C_ConstantList(arguments));
break; break;
case GREATER: case GREATER:
exp=new C_GreaterThan(placeHolder,new TD_Value(dataType,firstArg)); exp = new C_GreaterThan(placeHolder, new TD_Value(dataType,
readableExpression="GreaterThan("+readablePlaceHolder+","+firstArg+")"; firstArg));
readableExpression = "GreaterThan(" + readablePlaceHolder + ","
+ firstArg + ")";
break; break;
case GREATER_OR_EQUALS: case GREATER_OR_EQUALS:
exp=new C_GreaterOrEquals(placeHolder,new TD_Value(dataType,firstArg)); exp = new C_GreaterOrEquals(placeHolder, new TD_Value(dataType,
readableExpression="GreaterOrEquals("+readablePlaceHolder+","+firstArg+")"; firstArg));
readableExpression = "GreaterOrEquals(" + readablePlaceHolder + ","
+ firstArg + ")";
break; break;
case IN: case IN:
break; break;
case IS_NOT_NULL: case IS_NOT_NULL:
exp=new C_IsNotNull(placeHolder); exp = new C_IsNotNull(placeHolder);
readableExpression="IsNotNull("+readablePlaceHolder+")"; readableExpression = "IsNotNull(" + readablePlaceHolder + ")";
break; break;
case IS_NULL: case IS_NULL:
exp=new C_IsNull(placeHolder); exp = new C_IsNull(placeHolder);
readableExpression="IsNull("+readablePlaceHolder+")"; readableExpression = "IsNull(" + readablePlaceHolder + ")";
break; break;
case LESSER: case LESSER:
exp=new C_LessThan(placeHolder,new TD_Value(dataType,firstArg)); exp = new C_LessThan(placeHolder, new TD_Value(dataType, firstArg));
readableExpression="LessThan("+readablePlaceHolder+","+firstArg+")"; readableExpression = "LessThan(" + readablePlaceHolder + ","
+ firstArg + ")";
break; break;
case LESSER_OR_EQUALS: case LESSER_OR_EQUALS:
exp=new C_LessOrEquals(placeHolder,new TD_Value(dataType,firstArg)); exp = new C_LessOrEquals(placeHolder, new TD_Value(dataType,
readableExpression="LessOrEquals("+readablePlaceHolder+","+firstArg+")"; firstArg));
readableExpression = "LessOrEquals(" + readablePlaceHolder + ","
+ firstArg + ")";
break; break;
case LIKE: case LIKE:
break; break;
case MATCH_REGEX: case MATCH_REGEX:
exp=new C_TextMatchSQLRegexp(placeHolder,new TD_Value(dataType,firstArg)); exp = new C_TextMatchSQLRegexp(placeHolder, new TD_Value(dataType,
readableExpression="TextMatchSQLRegexp("+readablePlaceHolder+","+firstArg+")"; firstArg));
readableExpression = "TextMatchSQLRegexp(" + readablePlaceHolder
+ "," + firstArg + ")";
break; break;
case MODULUS: case MODULUS:
break; break;
@ -180,74 +169,61 @@ public class OperatorTypeMap {
case NOT: case NOT:
break; break;
case NOT_BEGINS_WITH: case NOT_BEGINS_WITH:
exp=new C_TextBeginsWith(placeHolder, new TD_Value(dataType,firstArg)); exp = new C_TextBeginsWith(placeHolder, new TD_Value(dataType,
exp=new C_Not(exp); firstArg));
readableExpression="Not(TextBeginsWith("+readablePlaceHolder+","+firstArg+"))"; exp = new C_Not(exp);
readableExpression = "Not(TextBeginsWith(" + readablePlaceHolder
+ "," + firstArg + "))";
break; break;
case NOT_BETWEEN: case NOT_BETWEEN:
fArg=new TD_Value(dataType,firstArg); fArg = new TD_Value(dataType, firstArg);
sArg=new TD_Value(dataType,secondArg); sArg = new TD_Value(dataType, secondArg);
range=new C_Range(fArg,sArg); range = new C_Range(fArg, sArg);
exp=new C_Between(placeHolder,range); exp = new C_Between(placeHolder, range);
exp=new C_Not(exp); exp = new C_Not(exp);
readableExpression="Not(Between("+readablePlaceHolder+", Range("+firstArg+", "+secondArg+")))"; readableExpression = "Not(Between(" + readablePlaceHolder
+ ", Range(" + firstArg + ", " + secondArg + ")))";
break; break;
case NOT_CONTAINS: case NOT_CONTAINS:
separator=firstArg.indexOf(","); fArg = new TD_Value(dataType, firstArg);
if(separator==-1|| firstArg.length()==1){ exp = new C_TextContains(placeHolder, fArg);
arguments.add(new TD_Value(dataType,firstArg)); exp = new C_Not(exp);
} else { readableExpression = "Not(Contains(" + readablePlaceHolder + ", "
String arg; + firstArg + "))";
boolean end=false;
while(!end){
arg=firstArg.substring(0, separator);
arguments.add(new TD_Value(dataType,arg));
separator++;
if(separator<firstArg.length()){
firstArg=firstArg.substring(separator,firstArg.length());
separator=firstArg.indexOf(",");
if(separator==-1){
arguments.add(new TD_Value(dataType,firstArg));
end=true;
}
} else {
end=true;
}
}
}
exp=new C_TextContains(placeHolder,new C_ConstantList(arguments));
exp=new C_Not(exp);
readableExpression="Not(Contains("+readablePlaceHolder;
for(TD_Value v:arguments){
readableExpression+=", "+v.getValue();
}
readableExpression+="))";
break; break;
case NOT_ENDS_WITH: case NOT_ENDS_WITH:
exp=new C_TextEndsWith(placeHolder,new TD_Value(dataType,firstArg)); exp = new C_TextEndsWith(placeHolder, new TD_Value(dataType,
exp=new C_Not(exp); firstArg));
readableExpression="Not(TextEndsWith("+readablePlaceHolder+","+firstArg+"))"; exp = new C_Not(exp);
readableExpression = "Not(TextEndsWith(" + readablePlaceHolder
+ "," + firstArg + "))";
break; break;
case NOT_EQUALS: case NOT_EQUALS:
exp=new C_NotEquals(placeHolder,new TD_Value(dataType,firstArg)); exp = new C_NotEquals(placeHolder, new TD_Value(dataType, firstArg));
readableExpression="NotEquals("+readablePlaceHolder+","+firstArg+")"; readableExpression = "NotEquals(" + readablePlaceHolder + ","
+ firstArg + ")";
break; break;
case NOT_GREATER: case NOT_GREATER:
exp=new C_NotGreater(placeHolder,new TD_Value(dataType,firstArg)); exp = new C_NotGreater(placeHolder,
readableExpression="NotGreater("+readablePlaceHolder+","+firstArg+")"; new TD_Value(dataType, firstArg));
readableExpression = "NotGreater(" + readablePlaceHolder + ","
+ firstArg + ")";
break; break;
case NOT_IN: case NOT_IN:
break; break;
case NOT_LESSER: case NOT_LESSER:
exp=new C_NotLess(placeHolder,new TD_Value(dataType,firstArg)); exp = new C_NotLess(placeHolder, new TD_Value(dataType, firstArg));
readableExpression="NotLess("+readablePlaceHolder+","+firstArg+")"; readableExpression = "NotLess(" + readablePlaceHolder + ","
+ firstArg + ")";
break; break;
case NOT_LIKE: case NOT_LIKE:
break; break;
case NOT_MATCH_REGEX: case NOT_MATCH_REGEX:
exp=new C_TextMatchSQLRegexp(placeHolder,new TD_Value(dataType,firstArg)); exp = new C_TextMatchSQLRegexp(placeHolder, new TD_Value(dataType,
exp=new C_Not(exp); firstArg));
readableExpression="Not(TextMatchSQLRegexp("+readablePlaceHolder+","+firstArg+"))"; exp = new C_Not(exp);
readableExpression = "Not(TextMatchSQLRegexp("
+ readablePlaceHolder + "," + firstArg + "))";
break; break;
case OR: case OR:
break; break;
@ -264,26 +240,23 @@ public class OperatorTypeMap {
return exp; return exp;
} }
public C_Expression mapTypedColumnReference(ColumnData column,
C_OperatorType operatorType, String firstArg, String secondArg) {
public C_Expression mapTypedColumnReference(ColumnData column,C_OperatorType operatorType, String firstArg, String secondArg){
Log.debug("OperatorTypeMap Map Typed Column Reference"); Log.debug("OperatorTypeMap Map Typed Column Reference");
C_Expression exp = null; C_Expression exp = null;
Log.debug("Column Data Type Name:"+column.getDataTypeName()); Log.debug("Column Data Type Name:" + column.getDataTypeName());
ColumnDataType dataType=ColumnTypeMap.getColumnDataType(column.getDataTypeName()); ColumnDataType dataType = ColumnTypeMap.getColumnDataType(column
Log.debug("Data Type:"+dataType); .getDataTypeName());
C_TypedColumnReference columnReference=new C_TypedColumnReference(column.getTrId(), dataType Log.debug("Data Type:" + dataType);
, column.getColumnId()); C_TypedColumnReference columnReference = new C_TypedColumnReference(
Log.debug("Typed Column Reference:"+columnReference); column.getTrId(), dataType, column.getColumnId());
String readableColumnReference=column.getLabel(); Log.debug("Typed Column Reference:" + columnReference);
String readableColumnReference = column.getLabel();
List<TD_Value> arguments=new ArrayList<TD_Value>();
TD_Value fArg; TD_Value fArg;
TD_Value sArg; TD_Value sArg;
C_Range range; C_Range range;
int separator;
switch (operatorType) { switch (operatorType) {
case ADDITION: case ADDITION:
@ -295,90 +268,83 @@ public class OperatorTypeMap {
case ANY: case ANY:
break; break;
case BEGINS_WITH: case BEGINS_WITH:
exp=new C_TextBeginsWith(columnReference,new TD_Value(dataType,firstArg)); exp = new C_TextBeginsWith(columnReference, new TD_Value(dataType,
readableExpression="TextBeginsWith("+readableColumnReference+","+firstArg+")"; firstArg));
readableExpression = "TextBeginsWith(" + readableColumnReference
+ "," + firstArg + ")";
break; break;
case BETWEEN: case BETWEEN:
fArg=new TD_Value(dataType,firstArg); fArg = new TD_Value(dataType, firstArg);
sArg=new TD_Value(dataType,secondArg); sArg = new TD_Value(dataType, secondArg);
range=new C_Range(fArg,sArg); range = new C_Range(fArg, sArg);
exp=new C_Between(columnReference,range); exp = new C_Between(columnReference, range);
readableExpression="Between("+readableColumnReference+", Range("+firstArg+", "+secondArg+"))"; readableExpression = "Between(" + readableColumnReference
+ ", Range(" + firstArg + ", " + secondArg + "))";
break; break;
case CONTAINS: case CONTAINS:
separator=firstArg.indexOf(","); fArg = new TD_Value(dataType, firstArg);
if(separator==-1|| firstArg.length()==1){ exp = new C_TextContains(columnReference, fArg);
arguments.add(new TD_Value(dataType,firstArg)); readableExpression = "Contains(" + columnReference + ", "
} else { + firstArg + ")";
String arg;
boolean end=false;
while(!end){
arg=firstArg.substring(0, separator);
arguments.add(new TD_Value(dataType,arg));
separator++;
if(separator<firstArg.length()){
firstArg=firstArg.substring(separator,firstArg.length());
separator=firstArg.indexOf(",");
if(separator==-1){
arguments.add(new TD_Value(dataType,firstArg));
end=true;
}
} else {
end=true;
}
}
}
exp=new C_TextContains(columnReference,new C_ConstantList(arguments));
readableExpression="Contains("+readableColumnReference;
for(TD_Value v:arguments){
readableExpression+=", "+v.getValue();
}
readableExpression+=")";
break; break;
case DIVISION: case DIVISION:
break; break;
case ENDS_WITH: case ENDS_WITH:
exp=new C_TextEndsWith(columnReference,new TD_Value(dataType,firstArg)); exp = new C_TextEndsWith(columnReference, new TD_Value(dataType,
readableExpression="TextEndsWith("+readableColumnReference+", "+firstArg+")"; firstArg));
readableExpression = "TextEndsWith(" + readableColumnReference
+ ", " + firstArg + ")";
break; break;
case EQUALS: case EQUALS:
exp=new C_Equals(columnReference,new TD_Value(dataType,firstArg)); exp = new C_Equals(columnReference,
readableExpression="Equals("+readableColumnReference+", "+firstArg+")"; new TD_Value(dataType, firstArg));
readableExpression = "Equals(" + readableColumnReference + ", "
+ firstArg + ")";
break; break;
case EXISTS: case EXISTS:
//exp=new C_Exi(placeHolder,new C_ConstantList(arguments)); // exp=new C_Exi(placeHolder,new C_ConstantList(arguments));
break; break;
case GREATER: case GREATER:
exp=new C_GreaterThan(columnReference,new TD_Value(dataType,firstArg)); exp = new C_GreaterThan(columnReference, new TD_Value(dataType,
readableExpression="GreaterThan("+readableColumnReference+", "+firstArg+")"; firstArg));
readableExpression = "GreaterThan(" + readableColumnReference
+ ", " + firstArg + ")";
break; break;
case GREATER_OR_EQUALS: case GREATER_OR_EQUALS:
exp=new C_GreaterOrEquals(columnReference,new TD_Value(dataType,firstArg)); exp = new C_GreaterOrEquals(columnReference, new TD_Value(dataType,
readableExpression="GreaterOrEquals("+readableColumnReference+", "+firstArg+")"; firstArg));
readableExpression = "GreaterOrEquals(" + readableColumnReference
+ ", " + firstArg + ")";
break; break;
case IN: case IN:
break; break;
case IS_NOT_NULL: case IS_NOT_NULL:
exp=new C_IsNotNull(columnReference); exp = new C_IsNotNull(columnReference);
readableExpression="IsNotNull("+readableColumnReference+")"; readableExpression = "IsNotNull(" + readableColumnReference + ")";
break; break;
case IS_NULL: case IS_NULL:
exp=new C_IsNull(columnReference); exp = new C_IsNull(columnReference);
readableExpression="IsNull("+readableColumnReference+")"; readableExpression = "IsNull(" + readableColumnReference + ")";
break; break;
case LESSER: case LESSER:
exp=new C_LessThan(columnReference,new TD_Value(dataType,firstArg)); exp = new C_LessThan(columnReference, new TD_Value(dataType,
readableExpression="LessThan("+readableColumnReference+", "+firstArg+")"; firstArg));
readableExpression = "LessThan(" + readableColumnReference + ", "
+ firstArg + ")";
break; break;
case LESSER_OR_EQUALS: case LESSER_OR_EQUALS:
exp=new C_LessOrEquals(columnReference,new TD_Value(dataType,firstArg)); exp = new C_LessOrEquals(columnReference, new TD_Value(dataType,
readableExpression="LessOrEquals("+readableColumnReference+", "+firstArg+")"; firstArg));
readableExpression = "LessOrEquals(" + readableColumnReference
+ ", " + firstArg + ")";
break; break;
case LIKE: case LIKE:
break; break;
case MATCH_REGEX: case MATCH_REGEX:
exp=new C_TextMatchSQLRegexp(columnReference,new TD_Value(dataType,firstArg)); exp = new C_TextMatchSQLRegexp(columnReference, new TD_Value(
readableExpression="TextMatchSQLRegexp("+readableColumnReference+", "+firstArg+")"; dataType, firstArg));
readableExpression = "TextMatchSQLRegexp("
+ readableColumnReference + ", " + firstArg + ")";
break; break;
case MODULUS: case MODULUS:
break; break;
@ -387,74 +353,63 @@ public class OperatorTypeMap {
case NOT: case NOT:
break; break;
case NOT_BEGINS_WITH: case NOT_BEGINS_WITH:
exp=new C_TextBeginsWith(columnReference,new TD_Value(dataType,firstArg)); exp = new C_TextBeginsWith(columnReference, new TD_Value(dataType,
exp=new C_Not(exp); firstArg));
readableExpression="Not(TextBeginsWith("+readableColumnReference+", "+firstArg+"))"; exp = new C_Not(exp);
readableExpression = "Not(TextBeginsWith("
+ readableColumnReference + ", " + firstArg + "))";
break; break;
case NOT_BETWEEN: case NOT_BETWEEN:
fArg=new TD_Value(dataType,firstArg); fArg = new TD_Value(dataType, firstArg);
sArg=new TD_Value(dataType,secondArg); sArg = new TD_Value(dataType, secondArg);
range=new C_Range(fArg,sArg); range = new C_Range(fArg, sArg);
exp=new C_Between(columnReference,range); exp = new C_Between(columnReference, range);
exp=new C_Not(exp); exp = new C_Not(exp);
readableExpression="Not(Between("+readableColumnReference+", Range("+firstArg+", "+secondArg+")))"; readableExpression = "Not(Between(" + readableColumnReference
+ ", Range(" + firstArg + ", " + secondArg + ")))";
break; break;
case NOT_CONTAINS: case NOT_CONTAINS:
separator=firstArg.indexOf(","); fArg = new TD_Value(dataType, firstArg);
if(separator==-1|| firstArg.length()==1){ exp = new C_TextContains(columnReference, fArg);
arguments.add(new TD_Value(dataType,firstArg)); exp = new C_Not(exp);
} else { readableExpression = "Not(Contains(" + columnReference + ", "
String arg; + firstArg + "))";
boolean end=false;
while(!end){
arg=firstArg.substring(0, separator);
arguments.add(new TD_Value(dataType,arg));
separator++;
if(separator<firstArg.length()){
firstArg=firstArg.substring(separator,firstArg.length());
separator=firstArg.indexOf(",");
if(separator==-1){
arguments.add(new TD_Value(dataType,firstArg));
end=true;
}
} else {
end=true;
}
}
}
exp=new C_TextContains(columnReference,new C_ConstantList(arguments));
exp=new C_Not(exp);
readableExpression="Not(Contains("+readableColumnReference;
for(TD_Value v:arguments){
readableExpression+=", "+v.getValue();
}
readableExpression+="))";
break; break;
case NOT_ENDS_WITH: case NOT_ENDS_WITH:
exp=new C_TextEndsWith(columnReference,new TD_Value(dataType,firstArg)); exp = new C_TextEndsWith(columnReference, new TD_Value(dataType,
exp=new C_Not(exp); firstArg));
readableExpression="Not(TextEndsWith("+readableColumnReference+","+firstArg+"))"; exp = new C_Not(exp);
readableExpression = "Not(TextEndsWith(" + readableColumnReference
+ "," + firstArg + "))";
break; break;
case NOT_EQUALS: case NOT_EQUALS:
exp=new C_NotEquals(columnReference,new TD_Value(dataType,firstArg)); exp = new C_NotEquals(columnReference, new TD_Value(dataType,
readableExpression="NotEquals("+readableColumnReference+","+firstArg+")"; firstArg));
readableExpression = "NotEquals(" + readableColumnReference + ","
+ firstArg + ")";
break; break;
case NOT_GREATER: case NOT_GREATER:
exp=new C_NotGreater(columnReference,new TD_Value(dataType,firstArg)); exp = new C_NotGreater(columnReference, new TD_Value(dataType,
readableExpression="NotGreater("+readableColumnReference+","+firstArg+")"; firstArg));
readableExpression = "NotGreater(" + readableColumnReference + ","
+ firstArg + ")";
break; break;
case NOT_IN: case NOT_IN:
break; break;
case NOT_LESSER: case NOT_LESSER:
exp=new C_NotLess(columnReference,new TD_Value(dataType,firstArg)); exp = new C_NotLess(columnReference, new TD_Value(dataType,
readableExpression="NotLess("+readableColumnReference+","+firstArg+")"; firstArg));
readableExpression = "NotLess(" + readableColumnReference + ","
+ firstArg + ")";
break; break;
case NOT_LIKE: case NOT_LIKE:
break; break;
case NOT_MATCH_REGEX: case NOT_MATCH_REGEX:
exp=new C_TextMatchSQLRegexp(columnReference,new TD_Value(dataType,firstArg)); exp = new C_TextMatchSQLRegexp(columnReference, new TD_Value(
exp=new C_Not(exp); dataType, firstArg));
readableExpression="Not(TextMatchSQLRegexp("+readableColumnReference+","+firstArg+"))"; exp = new C_Not(exp);
readableExpression = "Not(TextMatchSQLRegexp("
+ readableColumnReference + "," + firstArg + "))";
break; break;
case OR: case OR:
break; break;
@ -471,13 +426,13 @@ public class OperatorTypeMap {
return exp; return exp;
} }
public C_Expression createC_Or(List<C_Expression> arguments){ public C_Expression createC_Or(List<C_Expression> arguments) {
C_Or or=new C_Or(arguments); C_Or or = new C_Or(arguments);
return or; return or;
} }
public C_Expression createC_And(List<C_Expression> arguments){ public C_Expression createC_And(List<C_Expression> arguments) {
C_And or=new C_And(arguments); C_And or = new C_And(arguments);
return or; return or;
} }
@ -485,5 +440,4 @@ public class OperatorTypeMap {
return readableExpression; return readableExpression;
} }
} }