Added MultivaluedExpression
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@92810 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
74d17d8b1c
commit
f449a97903
|
@ -7,6 +7,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.data.analysis.tabulardata.expression.Expression;
|
||||
import org.gcube.data.analysis.tabulardata.expression.MultivaluedExpression;
|
||||
import org.gcube.data.analysis.tabulardata.expression.composite.comparable.Equals;
|
||||
import org.gcube.data.analysis.tabulardata.expression.composite.comparable.GreaterOrEquals;
|
||||
import org.gcube.data.analysis.tabulardata.expression.composite.comparable.GreaterThan;
|
||||
|
@ -45,6 +46,7 @@ import org.gcube.data.analysis.tabulardata.model.datatype.value.TDNumeric;
|
|||
import org.gcube.data.analysis.tabulardata.model.datatype.value.TDText;
|
||||
import org.gcube.data.analysis.tabulardata.model.datatype.value.TDTypeValue;
|
||||
import org.gcube.data.analysis.tabulardata.model.table.TableId;
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.expression.C_MultivaluedExpression;
|
||||
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_GreaterOrEquals;
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.composite.comparable.C_GreaterThan;
|
||||
|
@ -163,10 +165,28 @@ public class C_ExpressionParser {
|
|||
return ex;
|
||||
}
|
||||
|
||||
public MultivaluedExpression parseMultivalued(C_MultivaluedExpression exp) {
|
||||
MultivaluedExpression ex = null;
|
||||
switch (exp.getIdMulti()) {
|
||||
case "ConstantList":
|
||||
ex = getConstantlist(exp);
|
||||
break;
|
||||
case "Range":
|
||||
ex = getRange(exp);
|
||||
break;
|
||||
case "ExternalReferenceExpression":
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ex;
|
||||
}
|
||||
|
||||
private Expression getValueIsIn(C_Expression exp) {
|
||||
C_ValueIsIn v = (C_ValueIsIn) exp;
|
||||
ValueIsIn valueIsIn = new ValueIsIn(parse(v.getLeftArgument()),
|
||||
parse(v.getRightArgument()));
|
||||
MultivaluedExpression multivalued=parseMultivalued(v.getRightArgument());
|
||||
ValueIsIn valueIsIn = new ValueIsIn(parse(v.getLeftArgument()),multivalued
|
||||
);
|
||||
return valueIsIn;
|
||||
}
|
||||
|
||||
|
@ -203,8 +223,11 @@ public class C_ExpressionParser {
|
|||
|
||||
private Expression getBetween(C_Expression exp) {
|
||||
C_Between bet = (C_Between) exp;
|
||||
Between between = new Between(parse(bet.getLeftArgument()),
|
||||
parse(bet.getRightArgument()));
|
||||
C_Range crange = bet.getRightArgument();
|
||||
Range range = new Range(getExpressionValue(crange.getMinimum()),
|
||||
getExpressionValue(crange.getMaximum()));
|
||||
Between between = new Between(parse(bet.getLeftArgument()), range);
|
||||
|
||||
return between;
|
||||
}
|
||||
|
||||
|
@ -382,6 +405,19 @@ public class C_ExpressionParser {
|
|||
return constList;
|
||||
}
|
||||
|
||||
protected MultivaluedExpression getConstantlist(C_MultivaluedExpression exp) {
|
||||
List<TDTypeValue> l = new ArrayList<TDTypeValue>();
|
||||
C_ConstantList c = (C_ConstantList) exp;
|
||||
List<TD_Value> arguments = c.getArguments();
|
||||
TDTypeValue tdv;
|
||||
for (TD_Value value : arguments) {
|
||||
tdv = getExpressionValue(value);
|
||||
l.add(tdv);
|
||||
}
|
||||
ConstantList constList = new ConstantList(l);
|
||||
return constList;
|
||||
}
|
||||
|
||||
protected Expression getColumnReferencePlaceholder(C_Expression exp) {
|
||||
C_ColumnReferencePlaceholder c = (C_ColumnReferencePlaceholder) exp;
|
||||
ColumnReferencePlaceholder col = new ColumnReferencePlaceholder(
|
||||
|
@ -395,6 +431,13 @@ public class C_ExpressionParser {
|
|||
getExpressionValue(c.getMaximum()));
|
||||
return range;
|
||||
}
|
||||
|
||||
protected MultivaluedExpression getRange(C_MultivaluedExpression exp) {
|
||||
C_Range c = (C_Range) exp;
|
||||
Range range = new Range(getExpressionValue(c.getMinimum()),
|
||||
getExpressionValue(c.getMaximum()));
|
||||
return range;
|
||||
}
|
||||
|
||||
protected Expression getTypedColumnReference(C_Expression exp) {
|
||||
C_TypedColumnReference c = (C_TypedColumnReference) exp;
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package org.gcube.portlets.user.td.expressionwidget.shared.expression;
|
||||
|
||||
public interface C_MultivaluedExpression {
|
||||
|
||||
public String getIdMulti();
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite;
|
||||
|
||||
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.expression.C_MultivaluedExpression;
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.leaf.C_Leaf;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
||||
|
||||
public class C_ExternalReferenceExpression extends C_Expression implements C_MultivaluedExpression{
|
||||
|
||||
private static final long serialVersionUID = 1260894239836974010L;
|
||||
protected C_Leaf leftArgument;
|
||||
protected C_Expression rightArgument;
|
||||
|
||||
protected String id="ExternalReferenceExpression";
|
||||
|
||||
|
||||
public C_ExternalReferenceExpression() {
|
||||
|
||||
}
|
||||
|
||||
public C_ExternalReferenceExpression(C_Leaf leftArgument, C_Expression rightArgument) {
|
||||
this.leftArgument = leftArgument;
|
||||
this.rightArgument = rightArgument;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdMulti() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public C_Leaf getLeftArgument() {
|
||||
return leftArgument;
|
||||
}
|
||||
|
||||
public void setLeftArgument(C_Leaf leftArgument) {
|
||||
this.leftArgument = leftArgument;
|
||||
}
|
||||
|
||||
public C_Expression getRightArgument() {
|
||||
return rightArgument;
|
||||
}
|
||||
|
||||
public void setRightArgument(C_Expression rightArgument) {
|
||||
this.rightArgument = rightArgument;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "C_ExternalReferenceExpression [ id=" + id+", leftArgument=" + leftArgument
|
||||
+ ", rightArgument=" + rightArgument + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -2,7 +2,9 @@ package org.gcube.portlets.user.td.expressionwidget.shared.model.leaf;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class C_ConstantList extends C_Leaf {
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.expression.C_MultivaluedExpression;
|
||||
|
||||
public class C_ConstantList extends C_Leaf implements C_MultivaluedExpression {
|
||||
private static final long serialVersionUID = 222662008523199480L;
|
||||
|
||||
protected String id = "ConstantList";
|
||||
|
@ -19,6 +21,11 @@ public class C_ConstantList extends C_Leaf {
|
|||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdMulti() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public List<TD_Value> getArguments() {
|
||||
return arguments;
|
||||
|
@ -35,5 +42,6 @@ public class C_ConstantList extends C_Leaf {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package org.gcube.portlets.user.td.expressionwidget.shared.model.leaf;
|
||||
|
||||
public class C_Range extends C_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";
|
||||
|
@ -21,6 +23,12 @@ public class C_Range extends C_Leaf {
|
|||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdMulti() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public TD_Value getMinimum() {
|
||||
return minimum;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
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.leaf.C_Range;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
||||
|
||||
/**
|
||||
|
@ -14,13 +15,13 @@ public class C_Between extends C_Expression {
|
|||
private static final long serialVersionUID = 5367101215792568854L;
|
||||
protected String id = "Between";
|
||||
protected C_Expression leftArgument;
|
||||
protected C_Expression rightArgument;
|
||||
protected C_Range rightArgument;
|
||||
|
||||
public C_Between(){
|
||||
|
||||
}
|
||||
|
||||
public C_Between(C_Expression leftArgument, C_Expression rightArgument) {
|
||||
public C_Between(C_Expression leftArgument, C_Range rightArgument) {
|
||||
this.leftArgument = leftArgument;
|
||||
this.rightArgument = rightArgument;
|
||||
}
|
||||
|
@ -46,11 +47,11 @@ public class C_Between extends C_Expression {
|
|||
this.leftArgument = leftArgument;
|
||||
}
|
||||
|
||||
public C_Expression getRightArgument() {
|
||||
public C_Range getRightArgument() {
|
||||
return rightArgument;
|
||||
}
|
||||
|
||||
public void setRightArgument(C_Expression rightArgument) {
|
||||
public void setRightArgument(C_Range rightArgument) {
|
||||
this.rightArgument = rightArgument;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.gcube.portlets.user.td.expressionwidget.shared.model.logical;
|
||||
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.expression.C_MultivaluedExpression;
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
||||
|
||||
|
@ -13,13 +14,14 @@ public class C_ValueIsIn extends C_Expression {
|
|||
private static final long serialVersionUID = 739569588958197726L;
|
||||
protected String id = "IsNull";
|
||||
protected C_Expression leftArgument;
|
||||
protected C_Expression rightArgument;
|
||||
protected C_MultivaluedExpression rightArgument;
|
||||
|
||||
public C_ValueIsIn(){
|
||||
|
||||
}
|
||||
|
||||
public C_ValueIsIn(C_Expression leftArgument, C_Expression rightArgument) {
|
||||
|
||||
public C_ValueIsIn(C_Expression leftArgument, C_MultivaluedExpression rightArgument) {
|
||||
this.leftArgument = leftArgument;
|
||||
this.rightArgument = rightArgument;
|
||||
}
|
||||
|
@ -46,11 +48,11 @@ public class C_ValueIsIn extends C_Expression {
|
|||
this.leftArgument = leftArgument;
|
||||
}
|
||||
|
||||
public C_Expression getRightArgument() {
|
||||
public C_MultivaluedExpression getRightArgument() {
|
||||
return rightArgument;
|
||||
}
|
||||
|
||||
public void setRightArgument(C_Expression rightArgument) {
|
||||
public void setRightArgument(C_MultivaluedExpression rightArgument) {
|
||||
this.rightArgument = rightArgument;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue