Skip to content

Commit

Permalink
csg based instrumentation seems to work! (related to issue #58)
Browse files Browse the repository at this point in the history
  • Loading branch information
miho committed Aug 10, 2015
1 parent 82da2c3 commit 83c980d
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
package eu.mihosoft.vrl.lang.model;

import eu.mihosoft.vrl.workflow.VNode;
import java.util.Map;
import javafx.collections.ObservableMap;

/**
*
Expand All @@ -60,6 +62,8 @@ public interface CodeEntity extends ObservableCode, EventSender<CodeEvent>{
public void setId(String id);
public String getId();

public ObservableMap<String,Object> getMetaData();

// public void setCode(String code);
// public String getCode();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
import eu.mihosoft.vrl.lang.model.ICodeRange;
import eu.mihosoft.vrl.lang.model.Scope;
import eu.mihosoft.vrl.workflow.VNode;
import javafx.collections.FXCollections;
import javafx.collections.ObservableMap;

/**
*
Expand All @@ -69,6 +71,7 @@ public class CommentImpl implements Comment {
private VNode node;
private ObservableCodeImpl observableCode;
private boolean textRenderingEnabled = true;
private final ObservableMap<String,Object> metadata = FXCollections.observableHashMap();

public CommentImpl(String id, ICodeRange codeRange, String comment) {
this.id = id;
Expand Down Expand Up @@ -208,4 +211,12 @@ public boolean isTextRenderingEnabled() {
return textRenderingEnabled;
}

/**
* @return the metadata
*/
@Override
public ObservableMap<String,Object> getMetaData() {
return metadata;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ public IfDeclarationImpl(String id, Scope parent, IArgument arg) {
@Override
public IArgument getCheck() {

return getMetaData().getCheck();
return getIfMetaData().getCheck();
}

private IfDeclarationMetaData getMetaData() {
private IfDeclarationMetaData getIfMetaData() {
if (metadata == null) {
metadata = (IfDeclarationMetaData) getScopeArgs()[0];
}
Expand All @@ -45,9 +45,9 @@ public void defineParameters(Invocation i) {
i.getArguments().addListener((ListChangeListener.Change<? extends IArgument> c) -> {
while (c.next()) {
if (i.getArguments().isEmpty()) {
getMetaData().setCheck(Argument.NULL);
getIfMetaData().setCheck(Argument.NULL);
} else {
getMetaData().setCheck(i.getArguments().get(0));
getIfMetaData().setCheck(i.getArguments().get(0));
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@
import eu.mihosoft.vrl.workflow.WorkflowUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.collections.ObservableMap;

/**
*
Expand All @@ -82,6 +82,8 @@ class InvocationImpl implements Invocation {
private VNode node;
private ObservableCodeImpl observableCode;
private boolean textRenderingEnabled = true;

private final ObservableMap<String,Object> metadata = FXCollections.observableHashMap();

public InvocationImpl(
Scope parent,
Expand Down Expand Up @@ -433,4 +435,12 @@ void setParent(Scope parent) {
}
}

/**
* @return the metadata
*/
@Override
public ObservableMap<String,Object> getMetaData() {
return metadata;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.collections.ObservableMap;

/**
*
Expand All @@ -88,6 +89,8 @@ class ScopeImpl implements Scope {
private VFlow flow;
private ObservableCodeImpl observableCode;
private boolean textRenderingEnabled = true;

private final ObservableMap<String,Object> metadata = FXCollections.observableHashMap();

public ScopeImpl(String id, Scope parent, ScopeType type, String name, VFlow flowParent, Object... scopeArgs) {
this.id = id;
Expand Down Expand Up @@ -585,4 +588,12 @@ public boolean isTextRenderingEnabled() {
return textRenderingEnabled;
}

/**
* @return the metadata
*/
@Override
public ObservableMap<String,Object> getMetaData() {
return metadata;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ public WhileDeclaration_Impl(String id, Scope parent, IArgument argument) {
@Override
public IArgument getCheck() {

return getMetaData().getCheck();
return getWhileMetaData().getCheck();
}

private WhileDeclarationMetaData getMetaData() {
private WhileDeclarationMetaData getWhileMetaData() {
if (metadata == null) {
metadata = (WhileDeclarationMetaData) getScopeArgs()[0];
}
Expand All @@ -85,9 +85,9 @@ public void defineParameters(Invocation i) {
i.getArguments().addListener((ListChangeListener.Change<? extends IArgument> c) -> {
while (c.next()) {
if (i.getArguments().isEmpty()) {
getMetaData().setCheck(Argument.NULL);
getWhileMetaData().setCheck(Argument.NULL);
} else {
getMetaData().setCheck(i.getArguments().get(0));
getWhileMetaData().setCheck(i.getArguments().get(0));
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
public interface CodeTransform<T extends CodeEntity> {
/**
*
* @param ce
* @return
* @param ce conde entity to transform
* @return transformed copy of the cpecified code entity
*/
public T transform(T ce);
}

0 comments on commit 83c980d

Please sign in to comment.