public static void collectInfo(ExpressionInfo info, MExpression exp) { if (!(exp instanceof MCoreExpression)) { return; } MCoreExpression expr = (MCoreExpression) exp; Expression ref = null; if (expr.getCoreExpression() instanceof Expression) { ref = (Expression) expr.getCoreExpression(); } else { ref = new ReferenceExpression(expr.getCoreExpressionId()); expr.setCoreExpression(ref); } ref.collectExpressionInfo(info); }
@Override public int hashCode() { if (hc == -1) { Object exp1 = vexp == null ? null : vexp.getCoreExpression(); hc = Util.hashCode(parentId); hc = hc * 87 + Util.hashCode(position); hc = hc * 87 + getSchemeTag(); hc = hc * 87 + Util.hashCode(exp1); hc = hc * 87 + Util.hashCode(factory); } return hc; }
public static boolean isVisible(MCoreExpression exp, ExpressionContext eContext) { Expression ref = null; if (exp.getCoreExpression() instanceof Expression) { ref = (Expression) exp.getCoreExpression(); } else { ref = new ReferenceExpression(exp.getCoreExpressionId()); exp.setCoreExpression(ref); } try { // Creates dependency on a predefined value that can be "poked" by the evaluation // service ExpressionInfo info = ref.computeExpressionInfo(); String[] names = info.getAccessedPropertyNames(); for (String name : names) { eContext.getVariable(name + ".evaluationServiceLink"); // $NON-NLS-1$ } return ref.evaluate(eContext) != EvaluationResult.FALSE; } catch (CoreException e) { trace("isVisible exception", e); // $NON-NLS-1$ } return false; }
/* * (non-Javadoc) * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (!(obj instanceof Key)) { return false; } Key other = (Key) obj; Object exp1 = vexp == null ? null : vexp.getCoreExpression(); Object exp2 = other.vexp == null ? null : other.vexp.getCoreExpression(); return Util.equals(parentId, other.parentId) && Util.equals(position, other.position) && getSchemeTag() == other.getSchemeTag() && Util.equals(exp1, exp2) && Util.equals(factory, other.factory); }