Skip to content

Commit

Permalink
Added three basic conditional algorithms to compare integers, refs #23
Browse files Browse the repository at this point in the history
  • Loading branch information
romanwoessner committed Oct 24, 2014
1 parent c297e91 commit 90952ba
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 0 deletions.
6 changes: 6 additions & 0 deletions 52n-wps-webapp/src/main/webapp/config/wps_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,12 @@
<Property name="Algorithm" active="true">org.n52.wps.server.algorithm.test.MultiReferenceInputAlgorithm</Property>
<Property name="Algorithm" active="true">org.n52.wps.server.algorithm.test.MultiReferenceBinaryInputAlgorithm</Property>
<Property name="Algorithm" active="true">org.n52.wps.server.algorithm.test.EchoProcess</Property>

<!-- Conditionals -->
<Property name="Algorithm" active="true">net.disy.wps.richwps.process.conditional.CIntEqInt</Property>
<Property name="Algorithm" active="true">net.disy.wps.richwps.process.conditional.CIntGtInt</Property>
<Property name="Algorithm" active="true">net.disy.wps.richwps.process.conditional.CIntLtInt</Property>

</Repository>
<Repository name="UploadedAlgorithmRepository"
className="org.n52.wps.server.UploadedAlgorithmRepository" active="false">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package net.disy.wps.richwps.process.conditional;

import org.n52.wps.algorithm.annotation.Algorithm;
import org.n52.wps.algorithm.annotation.Execute;
import org.n52.wps.algorithm.annotation.LiteralDataInput;
import org.n52.wps.algorithm.annotation.LiteralDataOutput;
import org.n52.wps.io.data.binding.literal.LiteralBooleanBinding;
import org.n52.wps.io.data.binding.literal.LiteralIntBinding;
import org.n52.wps.server.AbstractConditionalAnnotatedAlgorithm;

@Algorithm(version = "1.0.0", title="Integer equals integer", abstrakt="Conditional process which checks if integer a equals integer b")
public class CIntEqInt extends AbstractConditionalAnnotatedAlgorithm {

int intA, intB;
boolean result;

@LiteralDataInput(identifier="intA",title="intA", binding=LiteralIntBinding.class)
public void setIntA(int a) {
intA = a;
}

@LiteralDataInput(identifier="intB",title="intB", binding=LiteralIntBinding.class)
public void setIntB(int b) {
intB = b;
}

@Override
@LiteralDataOutput(identifier="result", title="result", binding=LiteralBooleanBinding.class)
public boolean getResult() {
return this.result;
}

@Execute
public void run() {
if (this.intA == this.intB) {
this.result = true;
}
else {
this.result = false;
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package net.disy.wps.richwps.process.conditional;

import org.n52.wps.algorithm.annotation.Algorithm;
import org.n52.wps.algorithm.annotation.Execute;
import org.n52.wps.algorithm.annotation.LiteralDataInput;
import org.n52.wps.algorithm.annotation.LiteralDataOutput;
import org.n52.wps.io.data.binding.literal.LiteralBooleanBinding;
import org.n52.wps.io.data.binding.literal.LiteralIntBinding;
import org.n52.wps.server.AbstractConditionalAnnotatedAlgorithm;

@Algorithm(version = "1.0.0", title="Integer greater than integer", abstrakt="Conditional process which checks if integer a is greater than integer b")
public class CIntGtInt extends AbstractConditionalAnnotatedAlgorithm {

int intA, intB;
boolean result;

@LiteralDataInput(identifier="intA",title="intA", binding=LiteralIntBinding.class)
public void setIntA(int a) {
intA = a;
}

@LiteralDataInput(identifier="intB",title="intB", binding=LiteralIntBinding.class)
public void setIntB(int b) {
intB = b;
}

@Override
@LiteralDataOutput(identifier="result", title="result", binding=LiteralBooleanBinding.class)
public boolean getResult() {
return this.result;
}

@Execute
public void run() {
if (this.intA > this.intB) {
this.result = true;
}
else {
this.result = false;
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package net.disy.wps.richwps.process.conditional;

import org.n52.wps.algorithm.annotation.Algorithm;
import org.n52.wps.algorithm.annotation.Execute;
import org.n52.wps.algorithm.annotation.LiteralDataInput;
import org.n52.wps.algorithm.annotation.LiteralDataOutput;
import org.n52.wps.io.data.binding.literal.LiteralBooleanBinding;
import org.n52.wps.io.data.binding.literal.LiteralIntBinding;
import org.n52.wps.server.AbstractConditionalAnnotatedAlgorithm;

@Algorithm(version = "1.0.0", title="Integer less than integer", abstrakt="Conditional process which checks if integer a is less than integer b")
public class CIntLtInt extends AbstractConditionalAnnotatedAlgorithm {

int intA, intB;
boolean result;

@LiteralDataInput(identifier="intA",title="intA", binding=LiteralIntBinding.class)
public void setIntA(int a) {
intA = a;
}

@LiteralDataInput(identifier="intB",title="intB", binding=LiteralIntBinding.class)
public void setIntB(int b) {
intB = b;
}

@Override
@LiteralDataOutput(identifier="result", title="result", binding=LiteralBooleanBinding.class)
public boolean getResult() {
return this.result;
}

@Execute
public void run() {
if (this.intA < this.intB) {
this.result = true;
}
else {
this.result = false;
}
}

}

0 comments on commit 90952ba

Please sign in to comment.