Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • evoal/source/evoal-core
1 result
Show changes
Commits on Source (7)
...@@ -43,5 +43,10 @@ ...@@ -43,5 +43,10 @@
<version>${project.version}</version> <version>${project.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>net.objecthunter</groupId>
<artifactId>exp4j</artifactId>
<version>0.4.8</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
package de.evoal.pipeline.components;
import java.util.Iterator;
import javax.enterprise.context.Dependent;
import org.eclipse.emf.ecore.EStructuralFeature;
import de.evoal.pipeline.api.model.TypedEObject;
import de.evoal.pipeline.api.model.ComponentImpl;
import lombok.extern.slf4j.Slf4j;
import javax.inject.Named;
import lombok.NonNull;
//import net.objecthunter.exp4j.Expression;
//import net.objecthunter.exp4j.ExpressionBuilder;
@Dependent
@Named("de.evoal.pipeline.components.Sequence")
@Slf4j
public class Sequence extends ComponentImpl implements Visitable{
private double start_value;
private String sequence;
private String params;
private double step_size;
private double current_value;
public double getNextValueOfSequence()
{
System.out.println("Next calculated Value of "+ this.sequence + " we started at "+ this.start_value +" the new value we plugged in is "+ this.current_value +" the result is " + (this.current_value+1.0));
current_value = current_value+1.0;
return current_value;
}
@Override
public void accept(Visitor visitor)
{
visitor.visit(this);
}
@Override
public @NonNull TypedEObject apply(@NonNull TypedEObject object) {
//Currently I want to do the BEAR MINIMUM just get a number back
final Iterator<EStructuralFeature> iterator = getWrites().iterator(); //iterator that lets us walk over variable that we need to write
while(iterator.hasNext())
{
final EStructuralFeature feature = iterator.next();
double value= this.getNextValueOfSequence();
object.eSet(feature, value);
}
return object;
}
}
\ No newline at end of file
package de.evoal.pipeline.components;
public class SequenceVisistor implements Visitor {
@Override
public void visit(Sequence sequence) {
sequence.getNextValueOfSequence();
}
}
package de.evoal.pipeline.components;
public interface Visitable {
void accept(Visitor visitor);
}
package de.evoal.pipeline.components;
public interface Visitor {
void visit(Sequence sequence);
}
...@@ -52,4 +52,5 @@ module de.evoal.generator.main { ...@@ -52,4 +52,5 @@ module de.evoal.generator.main {
opens de.evoal.pipeline.impl.components.distributions to weld.core.impl; opens de.evoal.pipeline.impl.components.distributions to weld.core.impl;
opens de.evoal.pipeline.impl.internal to weld.core.impl; opens de.evoal.pipeline.impl.internal to weld.core.impl;
opens de.evoal.pipeline.api.model.dynamic to weld.core.impl; opens de.evoal.pipeline.api.model.dynamic to weld.core.impl;
opens de.evoal.pipeline.components to weld.core.impl;
} }
import "definitions" from de.evoal.core.math;
import "definitions" from 'de.evoal.pipeline.base';
import "definitions" from de.evoal.core.constraints;
module de.evoal.pipeline.timeseries {
/**
* Base type for all sequences.
*/
abstract type timeseries {}
/**
* smallest sequence which only consists of a time point and a value
*/
type 'data-time-series' extends timeseries
{
time: real;
value: real;
}
}
\ No newline at end of file