ComputableAnalisys.java
No OneTemporary

File Metadata

Created
Sat, Nov 21, 5:24 AM

ComputableAnalisys.java

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.xreate;
import java.util.List;
import java.util.Map;
/**
*
* @author pgess
*/
class ComputableAnalysis{
protected Map<ASTVar, ASTNode> computedStore;
public ASTNode ifComputable (ASTNode node){
return node;
}
/*
* null - если не переменная не вычислима
*/
public ASTNode ifComputable (ASTVar node){
return computedStore.get(node);
/*
Optional<ASTValue> value = Optional.of ();
return false;
*/
}
/*
* null - если выражение не вычислимо
*/
/*
public ASTNode ifComputable (ASTExpression node){
List<ASTVar> vars = node.getUsedVars();
Map<ASTVar, ASTValue> subs = ASTVar.substitute(vars);
if (computedStore.keySet().containsAll(vars)){
//computedStore.
ASTNode result = node.eval(subs);
return result;
}
return null;
}
*/
public ASTNode ifComputable (ASTAssignment node) throws NoSuchMethodException, IllegalAccessException, Throwable{
ASTNode value = node.value.acceptComputableVisitor(this);
if (value != null){
computedStore.put(node.var, value);
}
return value;
}
}

Event Timeline