All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.patternity.graphic.layout.FlowLayout Maven / Gradle / Ivy

Go to download

Extensions of the RestFixture. An extension is a RestFixture with some specific/bespoke behaviour not generic enough to make it to the RestFixture itself.

The newest version!
package com.patternity.graphic.layout;

import com.patternity.graphic.Position;
import com.patternity.graphic.dag.Node;

/**
 * A simple hierarchy layout
 * 
 * @author cyrille martraire
 */
public class FlowLayout implements Layout {

	private final int modulo;
	private int i;

	public FlowLayout(int modulo) {
		this.modulo = modulo;
	}

	public Position position(Node node) {
		final int row = i / modulo;
		final int col = i % modulo;
		final Position position = new Position(col, row);
		i++;
		return position;
	}

	public String toString() {
		return "FlowLayout modulo=" + modulo;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy