From b44beddc49dd4999aef011be83cf047019ef9e6f Mon Sep 17 00:00:00 2001 From: Alex Birkett Date: Sun, 1 Feb 2015 21:01:44 +0100 Subject: [PATCH] Update README.md Added background and example --- README.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 93b3588..45d42df 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,25 @@ # kiwi-java -A line for line Java port of the Kiwi C++ implementation of the Cassowary constraint solving algorithm +A Java port of the [Kiwi](https://github.com/nucleic/kiwi), a C++ implementation of the Cassowary constraint solving algorithm + +## Background +This project was created by porting [Kiwi](https://github.com/nucleic/kiwi) line for line to Java. The objective is to create a faster Java implementation of the Cassowary constraint solving algorithm. + +## Example usage + + Solver solver = new Solver(); + Variable x = new Variable("x"); + Variable y = new Variable("y"); + + // x = 20 + solver.addConstraint(Symbolics.equals(x, 20)); + + // x + 2 == y + 10 + solver.addConstraint(Symbolics.equals(Symbolics.add(x,2), Symbolics.add(y, 10))); + + solver.updateVariables(); + + System.out.println("x " + x.getValue() + " y " + y.getValue()); + // x == 20 + // y == 12 + +