Added ArithmeticExpression
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@111701 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ba59a8a438
commit
b22d4598fc
|
@ -0,0 +1,40 @@
|
|||
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.arithmetic;
|
||||
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class C_Addition extends C_ArithmeticExpression {
|
||||
|
||||
private static final long serialVersionUID = 3148009575987859751L;
|
||||
|
||||
private String id="Addition";
|
||||
|
||||
|
||||
public C_Addition() {
|
||||
|
||||
}
|
||||
|
||||
public C_Addition(C_Expression leftArgument, C_Expression rightArgument) {
|
||||
this.leftArgument = leftArgument;
|
||||
this.rightArgument = rightArgument;
|
||||
}
|
||||
|
||||
public C_OperatorType getOperator() {
|
||||
return C_OperatorType.ADDITION;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.arithmetic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class C_ArithmeticExpression extends C_Expression {
|
||||
|
||||
private static final long serialVersionUID = 897961910530874376L;
|
||||
|
||||
|
||||
private String id="ArithmeticExpression";
|
||||
|
||||
protected static final ArrayList<ColumnDataType> ACCEPTED_DATA_TYPES=new ArrayList<ColumnDataType>();
|
||||
|
||||
protected C_Expression leftArgument;
|
||||
protected C_Expression rightArgument;
|
||||
|
||||
public C_ArithmeticExpression() {
|
||||
|
||||
}
|
||||
|
||||
public C_ArithmeticExpression(C_Expression leftArgument, C_Expression rightArgument) {
|
||||
this.leftArgument = leftArgument;
|
||||
this.rightArgument = rightArgument;
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
ACCEPTED_DATA_TYPES.add(ColumnDataType.Numeric);
|
||||
ACCEPTED_DATA_TYPES.add(ColumnDataType.Integer);
|
||||
ACCEPTED_DATA_TYPES.add(ColumnDataType.Date);
|
||||
ACCEPTED_DATA_TYPES.add(ColumnDataType.Geometry);
|
||||
}
|
||||
|
||||
|
||||
public String getReturnedDataType() {
|
||||
return "DataType";
|
||||
}
|
||||
|
||||
public ArrayList<ColumnDataType> allowedLeftDataTypes() {
|
||||
return ACCEPTED_DATA_TYPES;
|
||||
}
|
||||
|
||||
public ArrayList<ColumnDataType> allowedRightDataTypes() {
|
||||
return ACCEPTED_DATA_TYPES;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public C_Expression getLeftArgument() {
|
||||
return leftArgument;
|
||||
}
|
||||
|
||||
public void setLeftArgument(C_Expression 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_ArithmeticExpression [id=" + id + ", leftArgument="
|
||||
+ leftArgument + ", rightArgument=" + rightArgument + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.arithmetic;
|
||||
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class C_Division extends C_ArithmeticExpression {
|
||||
|
||||
private static final long serialVersionUID = 6678032753615890456L;
|
||||
private String id="Division";
|
||||
|
||||
|
||||
public C_Division() {
|
||||
|
||||
}
|
||||
|
||||
public C_Division(C_Expression leftArgument, C_Expression rightArgument) {
|
||||
this.leftArgument = leftArgument;
|
||||
this.rightArgument = rightArgument;
|
||||
}
|
||||
|
||||
public C_OperatorType getOperator() {
|
||||
return C_OperatorType.DIVISION;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.arithmetic;
|
||||
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class C_Modulus extends C_ArithmeticExpression {
|
||||
|
||||
private static final long serialVersionUID = -4068595785080246810L;
|
||||
private String id="Modulus";
|
||||
|
||||
|
||||
public C_Modulus() {
|
||||
|
||||
}
|
||||
|
||||
public C_Modulus(C_Expression leftArgument, C_Expression rightArgument) {
|
||||
this.leftArgument = leftArgument;
|
||||
this.rightArgument = rightArgument;
|
||||
}
|
||||
|
||||
public C_OperatorType getOperator() {
|
||||
return C_OperatorType.MODULUS;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.arithmetic;
|
||||
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class C_Multiplication extends C_ArithmeticExpression {
|
||||
|
||||
private static final long serialVersionUID = 4822682666900687606L;
|
||||
private String id="Multiplication";
|
||||
|
||||
|
||||
public C_Multiplication() {
|
||||
|
||||
}
|
||||
|
||||
public C_Multiplication(C_Expression leftArgument, C_Expression rightArgument) {
|
||||
this.leftArgument = leftArgument;
|
||||
this.rightArgument = rightArgument;
|
||||
}
|
||||
|
||||
public C_OperatorType getOperator() {
|
||||
return C_OperatorType.MULTIPLICATION;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package org.gcube.portlets.user.td.expressionwidget.shared.model.composite.arithmetic;
|
||||
|
||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.C_OperatorType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author giancarlo
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class C_Subtraction extends C_ArithmeticExpression {
|
||||
|
||||
private static final long serialVersionUID = 3148009575987859751L;
|
||||
|
||||
private String id="Subtraction";
|
||||
|
||||
|
||||
public C_Subtraction() {
|
||||
|
||||
}
|
||||
|
||||
public C_Subtraction(C_Expression leftArgument, C_Expression rightArgument) {
|
||||
this.leftArgument = leftArgument;
|
||||
this.rightArgument = rightArgument;
|
||||
}
|
||||
|
||||
public C_OperatorType getOperator() {
|
||||
return C_OperatorType.SUBTRACTION;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue