Back to project page bad.
The source code is released under:
Copyright (C) 2013 Madis Pink Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Softwa...
If you think the Android project bad listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.madisp.bad.expr; /* w w w.ja v a 2s .com*/ import com.madisp.bad.eval.BadConverter; import com.madisp.bad.eval.Scope; import com.madisp.bad.eval.Watcher; /** * Created with IntelliJ IDEA. * User: madis * Date: 3/27/13 * Time: 7:02 PM */ public class AssignExpression implements Expression { private final Expression expr; private final VarExpression var; public AssignExpression(VarExpression var, Expression expr) { this.var = var; this.expr = expr; } @Override public Object value(Scope scope) { Object newValue = BadConverter.object(expr.value(scope)); scope.setVar(var.getBase(scope), var.getIdentifier(), newValue); return newValue; } @Override public void addWatcher(Scope scope, Watcher w) { expr.addWatcher(scope, w); // we don't need to watch var as it will trigger re-evaluation loop when this expression is watched // var.addWatcher(scope, w); } }