81: Allow the creation and use of expressions on multi column in TDM portlet
Task-Url: https://support.d4science.org/issues/81 Updated Expression to support Between on column git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@114836 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
21cfb22d0c
commit
a6c1afeaef
|
@ -36,7 +36,7 @@ public class ColumnTypeCodeElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return code.getColumnTypeCodeLabel();
|
return code.getLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,6 @@ import org.gcube.data.analysis.tabulardata.expression.composite.text.Upper;
|
||||||
import org.gcube.data.analysis.tabulardata.expression.functions.Cast;
|
import org.gcube.data.analysis.tabulardata.expression.functions.Cast;
|
||||||
import org.gcube.data.analysis.tabulardata.expression.leaf.ColumnReferencePlaceholder;
|
import org.gcube.data.analysis.tabulardata.expression.leaf.ColumnReferencePlaceholder;
|
||||||
import org.gcube.data.analysis.tabulardata.expression.leaf.ConstantList;
|
import org.gcube.data.analysis.tabulardata.expression.leaf.ConstantList;
|
||||||
import org.gcube.data.analysis.tabulardata.expression.leaf.Range;
|
|
||||||
import org.gcube.data.analysis.tabulardata.expression.logical.And;
|
import org.gcube.data.analysis.tabulardata.expression.logical.And;
|
||||||
import org.gcube.data.analysis.tabulardata.expression.logical.Between;
|
import org.gcube.data.analysis.tabulardata.expression.logical.Between;
|
||||||
import org.gcube.data.analysis.tabulardata.expression.logical.IsNotNull;
|
import org.gcube.data.analysis.tabulardata.expression.logical.IsNotNull;
|
||||||
|
@ -118,7 +117,6 @@ import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_ColumnReference;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_ColumnReference;
|
||||||
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_ConstantList;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_Range;
|
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.TD_Value;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.TD_Value;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.logical.C_And;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.logical.C_And;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.logical.C_Between;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.logical.C_Between;
|
||||||
|
@ -334,10 +332,6 @@ public class C_ExpressionParser {
|
||||||
return getColumnReference(exp);
|
return getColumnReference(exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exp instanceof Range) {
|
|
||||||
return getRange(exp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (exp instanceof ConstantList) {
|
if (exp instanceof ConstantList) {
|
||||||
return getConstantList(exp);
|
return getConstantList(exp);
|
||||||
}
|
}
|
||||||
|
@ -414,9 +408,6 @@ public class C_ExpressionParser {
|
||||||
return getConstantList((ConstantList) exp);
|
return getConstantList((ConstantList) exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exp instanceof Range) {
|
|
||||||
return getRange((Range)exp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (exp instanceof ExternalReferenceExpression) {
|
if (exp instanceof ExternalReferenceExpression) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -472,12 +463,9 @@ public class C_ExpressionParser {
|
||||||
private C_Expression getBetween(Expression exp)
|
private C_Expression getBetween(Expression exp)
|
||||||
throws ExpressionParserException {
|
throws ExpressionParserException {
|
||||||
Between bet = (Between) exp;
|
Between bet = (Between) exp;
|
||||||
C_Expression crange = parse(bet.getRightArgument());
|
C_Between between=new C_Between(parse(bet.getLeftArgument()),
|
||||||
C_Between between = null;
|
parse(bet.getMinRangeArgument()),
|
||||||
if (crange instanceof C_Range) {
|
parse(bet.getMaxRangeArgument()));
|
||||||
C_Range range = (C_Range) crange;
|
|
||||||
between = new C_Between(parse(bet.getLeftArgument()), range);
|
|
||||||
}
|
|
||||||
return between;
|
return between;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -700,22 +688,6 @@ public class C_ExpressionParser {
|
||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
private C_Expression getRange(Expression exp)
|
|
||||||
throws ExpressionParserException {
|
|
||||||
Range c = (Range) exp;
|
|
||||||
C_Range range = new C_Range(getExpressionValue(c.getMinimum()),
|
|
||||||
getExpressionValue(c.getMaximum()));
|
|
||||||
return range;
|
|
||||||
}
|
|
||||||
|
|
||||||
private C_MultivaluedExpression getRange(Range range)
|
|
||||||
throws ExpressionParserException {
|
|
||||||
|
|
||||||
C_Range r = new C_Range(getExpressionValue(range.getMinimum()),
|
|
||||||
getExpressionValue(range.getMaximum()));
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
private C_Expression getColumnReference(Expression exp) {
|
private C_Expression getColumnReference(Expression exp) {
|
||||||
ColumnReference c = (ColumnReference) exp;
|
ColumnReference c = (ColumnReference) exp;
|
||||||
String tableId = String.valueOf(c.getTableId().getValue());
|
String tableId = String.valueOf(c.getTableId().getValue());
|
||||||
|
@ -958,9 +930,6 @@ public class C_ExpressionParser {
|
||||||
case "ConstantList":
|
case "ConstantList":
|
||||||
ex = getConstantlist(exp);
|
ex = getConstantlist(exp);
|
||||||
break;
|
break;
|
||||||
case "Range":
|
|
||||||
ex = getRange(exp);
|
|
||||||
break;
|
|
||||||
case "ColumnReference":
|
case "ColumnReference":
|
||||||
ex = getColumnReference(exp);
|
ex = getColumnReference(exp);
|
||||||
break;
|
break;
|
||||||
|
@ -1111,9 +1080,6 @@ public class C_ExpressionParser {
|
||||||
case "ConstantList":
|
case "ConstantList":
|
||||||
ex = getConstantlist(exp);
|
ex = getConstantlist(exp);
|
||||||
break;
|
break;
|
||||||
case "Range":
|
|
||||||
ex = getRange(exp);
|
|
||||||
break;
|
|
||||||
case "ExternalReferenceExpression":
|
case "ExternalReferenceExpression":
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -1169,10 +1135,8 @@ public class C_ExpressionParser {
|
||||||
private Expression getBetween(C_Expression exp)
|
private Expression getBetween(C_Expression exp)
|
||||||
throws ExpressionParserException {
|
throws ExpressionParserException {
|
||||||
C_Between bet = (C_Between) exp;
|
C_Between bet = (C_Between) exp;
|
||||||
C_Range crange = bet.getRightArgument();
|
Between between = new Between(parse(bet.getLeftArgument()),
|
||||||
Range range = new Range(getExpressionValue(crange.getMinimum()),
|
parse(bet.getMinRangeArgument()), parse(bet.getMaxRangeArgument()));
|
||||||
getExpressionValue(crange.getMaximum()));
|
|
||||||
Between between = new Between(parse(bet.getLeftArgument()), range);
|
|
||||||
|
|
||||||
return between;
|
return between;
|
||||||
}
|
}
|
||||||
|
@ -1415,21 +1379,6 @@ public class C_ExpressionParser {
|
||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Expression getRange(C_Expression exp)
|
|
||||||
throws ExpressionParserException {
|
|
||||||
C_Range c = (C_Range) exp;
|
|
||||||
Range range = new Range(getExpressionValue(c.getMinimum()),
|
|
||||||
getExpressionValue(c.getMaximum()));
|
|
||||||
return range;
|
|
||||||
}
|
|
||||||
|
|
||||||
private MultivaluedExpression getRange(C_MultivaluedExpression exp)
|
|
||||||
throws ExpressionParserException {
|
|
||||||
C_Range c = (C_Range) exp;
|
|
||||||
Range range = new Range(getExpressionValue(c.getMinimum()),
|
|
||||||
getExpressionValue(c.getMaximum()));
|
|
||||||
return range;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Expression getColumnReference(C_Expression exp) {
|
private Expression getColumnReference(C_Expression exp) {
|
||||||
C_ColumnReference c = (C_ColumnReference) exp;
|
C_ColumnReference c = (C_ColumnReference) exp;
|
||||||
|
|
|
@ -134,7 +134,7 @@ public class RuleTypeMap {
|
||||||
Class<? extends DataType> dataType = entry.getValue();
|
Class<? extends DataType> dataType = entry.getValue();
|
||||||
ColumnDataType columnDataType = ColumnDataTypeMap
|
ColumnDataType columnDataType = ColumnDataTypeMap
|
||||||
.mapFromDataTypeClass(dataType);
|
.mapFromDataTypeClass(dataType);
|
||||||
RuleColumnPlaceHolderDescriptor ruleColumnPlaceHolderDescriptor = new RuleColumnPlaceHolderDescriptor(
|
RuleColumnPlaceHolderDescriptor ruleColumnPlaceHolderDescriptor = new RuleColumnPlaceHolderDescriptor(id,
|
||||||
id, columnDataType);
|
id, columnDataType);
|
||||||
descriptors.add(ruleColumnPlaceHolderDescriptor);
|
descriptors.add(ruleColumnPlaceHolderDescriptor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_ColumnRef
|
||||||
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_ConstantList;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_Leaf;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_Leaf;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_Range;
|
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.TD_Value;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.TD_Value;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.logical.C_And;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.logical.C_And;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.logical.C_Between;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.logical.C_Between;
|
||||||
|
@ -665,7 +664,6 @@ public class ConditionOnMultiColumnTypeMap {
|
||||||
C_Expression exp = null;
|
C_Expression exp = null;
|
||||||
C_Leaf fArg;
|
C_Leaf fArg;
|
||||||
C_Leaf sArg;
|
C_Leaf sArg;
|
||||||
C_Range range;
|
|
||||||
|
|
||||||
switch (firstArgType) {
|
switch (firstArgType) {
|
||||||
case COLUMN:
|
case COLUMN:
|
||||||
|
@ -700,9 +698,8 @@ public class ConditionOnMultiColumnTypeMap {
|
||||||
"No valid second argument type selected!");
|
"No valid second argument type selected!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO need Range on ColumnReference e ColumnPlaceHolder
|
|
||||||
// range = new C_Range(fArg, sArg);
|
exp = new C_Between(placeHolder, fArg, sArg);
|
||||||
// exp = new C_Between(placeHolder, range);
|
|
||||||
return exp;
|
return exp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1372,9 +1369,7 @@ public class ConditionOnMultiColumnTypeMap {
|
||||||
"No valid second argument type selected!");
|
"No valid second argument type selected!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
exp = new C_Between(columnReference, fArg, sArg);
|
||||||
// C_Range range = new C_Range(fArg, sArg);
|
|
||||||
// exp = new C_Between(columnReference, range);
|
|
||||||
return exp;
|
return exp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.text.C
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_ColumnReference;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_ColumnReference;
|
||||||
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_ConstantList;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_Range;
|
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.TD_Value;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.TD_Value;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.logical.C_And;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.logical.C_And;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.logical.C_Between;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.logical.C_Between;
|
||||||
|
@ -85,7 +84,6 @@ public class ConditionTypeMap {
|
||||||
|
|
||||||
TD_Value fArg;
|
TD_Value fArg;
|
||||||
TD_Value sArg;
|
TD_Value sArg;
|
||||||
C_Range range;
|
|
||||||
|
|
||||||
List<TD_Value> arguments = new ArrayList<TD_Value>();
|
List<TD_Value> arguments = new ArrayList<TD_Value>();
|
||||||
int separator;
|
int separator;
|
||||||
|
@ -111,8 +109,7 @@ public class ConditionTypeMap {
|
||||||
checkTypeArgument(column, secondArg);
|
checkTypeArgument(column, secondArg);
|
||||||
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);
|
exp = new C_Between(placeHolder, fArg, sArg);
|
||||||
exp = new C_Between(placeHolder, range);
|
|
||||||
readableExpression = "Between(" + readablePlaceHolder + ", Range("
|
readableExpression = "Between(" + readablePlaceHolder + ", Range("
|
||||||
+ firstArg + ", " + secondArg + "))";
|
+ firstArg + ", " + secondArg + "))";
|
||||||
break;
|
break;
|
||||||
|
@ -239,8 +236,7 @@ public class ConditionTypeMap {
|
||||||
|
|
||||||
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);
|
exp = new C_Between(placeHolder, fArg, sArg);
|
||||||
exp = new C_Between(placeHolder, range);
|
|
||||||
exp = new C_Not(exp);
|
exp = new C_Not(exp);
|
||||||
readableExpression = "Not(Between(" + readablePlaceHolder
|
readableExpression = "Not(Between(" + readablePlaceHolder
|
||||||
+ ", Range(" + firstArg + ", " + secondArg + ")))";
|
+ ", Range(" + firstArg + ", " + secondArg + ")))";
|
||||||
|
@ -397,7 +393,6 @@ public class ConditionTypeMap {
|
||||||
|
|
||||||
TD_Value fArg;
|
TD_Value fArg;
|
||||||
TD_Value sArg;
|
TD_Value sArg;
|
||||||
C_Range range;
|
|
||||||
|
|
||||||
List<TD_Value> arguments = new ArrayList<TD_Value>();
|
List<TD_Value> arguments = new ArrayList<TD_Value>();
|
||||||
int separator;
|
int separator;
|
||||||
|
@ -423,8 +418,7 @@ public class ConditionTypeMap {
|
||||||
checkTypeArgument(column, secondArg);
|
checkTypeArgument(column, secondArg);
|
||||||
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);
|
exp = new C_Between(columnReference, fArg, sArg);
|
||||||
exp = new C_Between(columnReference, range);
|
|
||||||
readableExpression = "Between(" + readableColumnReference
|
readableExpression = "Between(" + readableColumnReference
|
||||||
+ ", Range(" + firstArg + ", " + secondArg + "))";
|
+ ", Range(" + firstArg + ", " + secondArg + "))";
|
||||||
break;
|
break;
|
||||||
|
@ -553,8 +547,7 @@ public class ConditionTypeMap {
|
||||||
checkTypeArgument(column, secondArg);
|
checkTypeArgument(column, secondArg);
|
||||||
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);
|
exp = new C_Between(columnReference, fArg, sArg);
|
||||||
exp = new C_Between(columnReference, range);
|
|
||||||
exp = new C_Not(exp);
|
exp = new C_Not(exp);
|
||||||
readableExpression = "Not(Between(" + readableColumnReference
|
readableExpression = "Not(Between(" + readableColumnReference
|
||||||
+ ", Range(" + firstArg + ", " + secondArg + ")))";
|
+ ", Range(" + firstArg + ", " + secondArg + ")))";
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class C_Cast extends C_Expression {
|
||||||
if (leftArgument != null && rightArgument != null) {
|
if (leftArgument != null && rightArgument != null) {
|
||||||
this.readableExpression = "Cast("
|
this.readableExpression = "Cast("
|
||||||
+ leftArgument.getReadableExpression() + ","
|
+ leftArgument.getReadableExpression() + ","
|
||||||
+ rightArgument.getColumnDataTypeLabel() + ")";
|
+ rightArgument.getLabel() + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ public class C_ColumnReference extends C_Leaf {
|
||||||
}
|
}
|
||||||
if (tableId != null && columnId != null && dataType != null) {
|
if (tableId != null && columnId != null && dataType != null) {
|
||||||
this.readableExpression = "ColumnReference(" + tableId + ","
|
this.readableExpression = "ColumnReference(" + tableId + ","
|
||||||
+ dataType.getColumnDataTypeLabel() + "," + columnId + ")";
|
+ dataType.getLabel() + "," + columnId + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class C_ColumnReferencePlaceholder extends C_Leaf {
|
||||||
this.columnId = columnId;
|
this.columnId = columnId;
|
||||||
if (dataType != null && columnId != null) {
|
if (dataType != null && columnId != null) {
|
||||||
this.readableExpression = "$"+columnId+"["
|
this.readableExpression = "$"+columnId+"["
|
||||||
+ dataType.getColumnDataTypeLabel() + "]";
|
+ dataType.getLabel() + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,64 +0,0 @@
|
||||||
package org.gcube.portlets.user.td.expressionwidget.shared.model.leaf;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.expression.C_MultivaluedExpression;
|
|
||||||
|
|
||||||
public class C_Range extends C_Leaf implements C_MultivaluedExpression {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = -2328040312495639444L;
|
|
||||||
protected String id = "Range";
|
|
||||||
|
|
||||||
protected TD_Value minimum;
|
|
||||||
protected TD_Value maximum;
|
|
||||||
|
|
||||||
public C_Range() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public C_Range(TD_Value minimum, TD_Value maximum) {
|
|
||||||
this.minimum = minimum;
|
|
||||||
this.maximum = maximum;
|
|
||||||
if (minimum != null && maximum != null) {
|
|
||||||
this.readableExpression = "Range("
|
|
||||||
+ minimum.getReadableExpression() + ","
|
|
||||||
+ maximum.getReadableExpression() + ")";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getIdMulti() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TD_Value getMinimum() {
|
|
||||||
return minimum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMinimum(TD_Value minimum) {
|
|
||||||
this.minimum = minimum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TD_Value getMaximum() {
|
|
||||||
return maximum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaximum(TD_Value maximum) {
|
|
||||||
this.maximum = maximum;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getReadableMultivaluedString() {
|
|
||||||
return readableExpression;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Range [id=" + id + ", minimum=" + minimum + ", maximum="
|
|
||||||
+ maximum + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,13 +1,12 @@
|
||||||
package org.gcube.portlets.user.td.expressionwidget.shared.model.logical;
|
package org.gcube.portlets.user.td.expressionwidget.shared.model.logical;
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_Range;
|
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @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 C_Between extends C_Expression {
|
public class C_Between extends C_Expression {
|
||||||
|
@ -15,24 +14,30 @@ public class C_Between extends C_Expression {
|
||||||
private static final long serialVersionUID = 5367101215792568854L;
|
private static final long serialVersionUID = 5367101215792568854L;
|
||||||
protected String id = "Between";
|
protected String id = "Between";
|
||||||
protected C_Expression leftArgument;
|
protected C_Expression leftArgument;
|
||||||
protected C_Range rightArgument;
|
protected C_Expression minRangeArgument;
|
||||||
|
protected C_Expression maxRangeArgument;
|
||||||
|
|
||||||
public C_Between(){
|
public C_Between() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public C_Between(C_Expression leftArgument, C_Range rightArgument) {
|
public C_Between(C_Expression leftArgument, C_Expression minRangeArgument,
|
||||||
|
C_Expression maxRangeArgument
|
||||||
|
|
||||||
|
) {
|
||||||
this.leftArgument = leftArgument;
|
this.leftArgument = leftArgument;
|
||||||
this.rightArgument = rightArgument;
|
this.minRangeArgument = minRangeArgument;
|
||||||
if (leftArgument != null && rightArgument != null) {
|
this.maxRangeArgument = maxRangeArgument;
|
||||||
|
|
||||||
|
if (leftArgument != null && minRangeArgument != null
|
||||||
|
&& maxRangeArgument != null) {
|
||||||
this.readableExpression = "Between("
|
this.readableExpression = "Between("
|
||||||
+ leftArgument.getReadableExpression() + ","
|
+ leftArgument.getReadableExpression() + ","
|
||||||
+ rightArgument.getReadableExpression() + ")";
|
+ minRangeArgument.getReadableExpression() + ","
|
||||||
|
+ maxRangeArgument.getReadableExpression() + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public C_OperatorType getOperator() {
|
public C_OperatorType getOperator() {
|
||||||
return C_OperatorType.BETWEEN;
|
return C_OperatorType.BETWEEN;
|
||||||
}
|
}
|
||||||
|
@ -54,18 +59,27 @@ public class C_Between extends C_Expression {
|
||||||
this.leftArgument = leftArgument;
|
this.leftArgument = leftArgument;
|
||||||
}
|
}
|
||||||
|
|
||||||
public C_Range getRightArgument() {
|
public C_Expression getMinRangeArgument() {
|
||||||
return rightArgument;
|
return minRangeArgument;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRightArgument(C_Range rightArgument) {
|
public void setMinRangeArgument(C_Expression minRangeArgument) {
|
||||||
this.rightArgument = rightArgument;
|
this.minRangeArgument = minRangeArgument;
|
||||||
|
}
|
||||||
|
|
||||||
|
public C_Expression getMaxRangeArgument() {
|
||||||
|
return maxRangeArgument;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxRangeArgument(C_Expression maxRangeArgument) {
|
||||||
|
this.maxRangeArgument = maxRangeArgument;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Between [id=" + id + ", leftArgument=" + leftArgument
|
return "C_Between [id=" + id + ", leftArgument=" + leftArgument
|
||||||
+ ", rightArgument=" + rightArgument + "]";
|
+ ", minRangeArgument=" + minRangeArgument
|
||||||
|
+ ", maxRangeArgument=" + maxRangeArgument + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue