Babelsberg/JS Demo World
Un-minimize any window. The ConverterExample and RegionExample are implementations of code examples from the ECOOP'14 paper Babelsberg/JS - A Browser-based Implementation of an Object Constraint Language. What they demonstrate is explained in their help texts. Click also on the links in the text to open ObjectEditors on relevant code. The other windows are further examples. Each window has a help button to explain what the example is about.
Circuits
X

Menu
ColorGameZ3
X

Menu
sNAKE
X

Menu
NaCLZ3
X

Menu
Z3Engine
X

Menu
RegionExample
X

Menu
Thermometer Demo
X

Menu
ConverterExample
X

Menu
System Console
X
M

G
C
layout.js
X

Menu
N
users/timfelgentreff/layout/
...
../
layout.js
LayoutConstraint
LayoutConstraintSameExtent
LayoutConstraintVariable
LayoutObject
LayoutSolver
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
        }
    });
    LayoutObject.subclass('LayoutConstraint', {
        enable: function (strength) {
            // TODO: consider strength
            this.solver.addConstraint(this);
        },
    
        disable: function () {
            this.solver.removeConstraint(this);
        }
    });
    LayoutConstraint.subclass('LayoutConstraintSameExtent', {
        initialize: function(leftrightsolver) {
            this.left = left;
            this.right = right;
            this.solver = solver;
        }
    });
}) // end of module
X
>
<
constraintinterpreter.js
X

Menu
N
users/timfelgentreff/babelsberg/
...
../
cassowary_ext.js (not parsed)
constraintinterpreter.js
core_ext.js (not parsed)
deltablue_ext.js (not parsed)
PerformanceTests.js (not parsed)
src_transform.js (not parsed)
tests.js (not parsed)
uglify.js (not parsed)
Babelsberg
ConstrainedVariable
ConstrainedVariable (extension)
Constraint
Constraint (extension)
ConstraintConstructionLayer
ConstraintInterpreterVisitor
DoNotSerializeConstraintPlugin
Global (extension)
MorphSetConstrainedPositionLayer
Send (extension)
-----
-----
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
    enable: function() {
        if (!this._enabled) {
            this.constraintobjects.each(function (ea) {
                this.enableConstraintObject(ea);
            }.bind(this));
            this._enabled = true;
            this.solver.solve();
        }
    },
    enableConstraintObject: function(objoptPriority) {
        if (obj === true) {
            alertOK("Warning: Constraint expression returned true. Re-running whenever the value changes");
        } else if (obj === false) {
            throw "Error: Constraint expression returned false, no solver available to fix it";
        } else if (!obj.enable) {
            throw "Error: Constraint expression returned an object that does not respond to #enable";
        } else {
            obj.solver = this.solver; // XXX: Bit of a hack, should really write it so
                                      // this gets passed through from the variables
            obj.enable(optPriority || this._priority);
X
>
<
// changed at Tue Apr 29 2014 10:50:05 GMT+0200 (W. Europe Daylight Time) by stefanlehma
nn  
this.addScript(function sameExtentExample() {
    this.layoutSolver = new LayoutSolver();
    
    this.child1 = this.get("Rectangle1");
    this.child2 = this.get("Rectangle2");
    // clean up
    bbb.unconstrain(this, "child1")
    bbb.unconstrain(this, "child2")
    always: { solver: this.layoutSolver
        this.child1.sameExtent(this.child2)
    }
}).tag([]);
X
<lively.morphic.Box#3EBC0... - Rectangle>
Tag:
run
save
Tests

-- ALL --
sameExtentExample
Scripts
-
+
-
Connections
+
-- ALL --
all
ObjectEditor
X

Menu
ServerZ3.js:ServerZ3:-- all --
X

Menu
N
users/timfelgentreff/z3/
...
../
lib32/
lib64/
CommandLineZ3.js (not parsed)
NaClZ3.js
ServerZ3.js
Z3Server.js
Z3ServerInterface.js (not parsed)
NaCLZ3Constraint (extension)
ServerZ3
-- all --
default category
addConstraint (proto)
addVariable (proto)
initialize (proto)
loadModule (proto)
postMessage (proto)
removeConstraint (proto)
reset (proto)
solve (proto)
solveOnce (proto)
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
        this.newVariables.push(v);
        return $super(v, cvar);
    },
    removeConstraint: function($superc) {
        this.activeConstraints.remove(c);
        this.newVariables = this.variables.clone();
        this.newConstraints = this.activeConstraints.clone();
        Z3ServerInterface.eval(true, "(reset)", function (err, result) {}
);
        return $super(c);
    },
    solve: function () {
        var decls = this.newVariables.inject("", function (acc, v) {
            return acc + "\n" + v.printDeclaration();
        });
        this.newVariables.clear();
        
        var constraints = this.newConstraints.inject("\n", function (acc, 
c) {
X
>
<