Modelling flat mechanisms (java version)