mirror of
https://github.com/octoleo/plantuml.git
synced 2024-06-08 03:10:53 +00:00
76 lines
2.0 KiB
Java
76 lines
2.0 KiB
Java
|
/* ========================================================================
|
||
|
* PlantUML : a free UML diagram generator
|
||
|
* ========================================================================
|
||
|
*
|
||
|
* (C) Copyright 2009-2014, Arnaud Roques
|
||
|
*
|
||
|
* Project Info: http://plantuml.sourceforge.net
|
||
|
*
|
||
|
* This file is part of PlantUML.
|
||
|
*
|
||
|
* PlantUML is free software; you can redistribute it and/or modify it
|
||
|
* under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation, either version 3 of the License, or
|
||
|
* (at your option) any later version.
|
||
|
*
|
||
|
* PlantUML distributed in the hope that it will be useful, but
|
||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||
|
* License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public
|
||
|
* License along with this library; if not, write to the Free Software
|
||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||
|
* USA.
|
||
|
*
|
||
|
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
||
|
* in the United States and other countries.]
|
||
|
*
|
||
|
* Original Author: Arnaud Roques
|
||
|
*
|
||
|
* Revision $Revision: 4636 $
|
||
|
*
|
||
|
*/
|
||
|
package net.sourceforge.plantuml.real;
|
||
|
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.List;
|
||
|
|
||
|
class RealLine {
|
||
|
|
||
|
private final List<PositiveForce> forces = new ArrayList<PositiveForce>();
|
||
|
|
||
|
public void addForce(PositiveForce force) {
|
||
|
this.forces.add(force);
|
||
|
}
|
||
|
|
||
|
static private int CPT;
|
||
|
|
||
|
public void compile() {
|
||
|
int cpt = 0;
|
||
|
do {
|
||
|
boolean done = true;
|
||
|
for (PositiveForce f : forces) {
|
||
|
// System.err.println("force=" + f);
|
||
|
final boolean change = f.apply();
|
||
|
if (change) {
|
||
|
// System.err.println("changed! " + f);
|
||
|
done = false;
|
||
|
}
|
||
|
}
|
||
|
if (done) {
|
||
|
// System.err.println("cpt=" + cpt + " size=" + forces.size());
|
||
|
CPT += cpt;
|
||
|
// System.err.println("CPT=" + CPT);
|
||
|
return;
|
||
|
}
|
||
|
cpt++;
|
||
|
if (cpt > 99999) {
|
||
|
throw new IllegalStateException("Inifinite Loop?");
|
||
|
}
|
||
|
} while (true);
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|