/*******************************************************************************
 * Caleydo - Visualization for Molecular Biology - http://caleydo.org
 * Copyright (c) The Caleydo Team. All rights reserved.
 * Licensed under the new BSD license, available at http://caleydo.org/license
 *******************************************************************************/
package org.caleydo.view.domino.api.model.graph;

import java.util.EnumSet;
import java.util.Set;

import org.caleydo.view.domino.spi.model.graph.IEdge;

import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableSet;

/**
 * @author Samuel Gratzl
 *
 */
public enum EProximityMode implements Predicate<String> {
	ATTACHED("heatmap", "labels", "hbar"),
	DETACHED("distribution.hist", "boxandwhiskers", "kaplanmaier", "axis"),
	FREE(
			"distribution.pie");

	private final Set<String> include;

	private EProximityMode(String... include) {
		this.include = ImmutableSet.copyOf(include);
	}

	@Override
	public boolean apply(String input) {
		for (EProximityMode mode : EnumSet.range(EProximityMode.ATTACHED, this))
			if (mode.include.contains(input))
				return true;
		return false;
	}

	public static EProximityMode min(EProximityMode a, EProximityMode b) {
		return a.ordinal() < b.ordinal() ? a : b;
	}

	public static EProximityMode min(Iterable<IEdge> edges) {
		EProximityMode m = EProximityMode.FREE;
		for (IEdge edge : edges) {
			m = min(m, edge.asMode());
		}
		return m;
	}
}

@@ -1025,16 +1025,52 @@
 nput) %7B%0A
+%09%09if (this == FREE)%0A%09%09%09return true;%0A
 %09%09for (E

allow every vis technique in free mode