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

com.reprezen.genflow.common.graph.DirectedGraphNode Maven / Gradle / Ivy

/*******************************************************************************
 * Copyright © 2013, 2016 Modelsolv, Inc.
 * All Rights Reserved.
 *
 * NOTICE: All information contained herein is, and remains the property
 * of ModelSolv, Inc. See the file license.html in the root directory of
 * this project for further information.
 *******************************************************************************/
package com.reprezen.genflow.common.graph;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * A vertex of a directed graph.
 * 
 * @author Tatiana Fesenko 
 * 
 */
public class DirectedGraphNode {

	private List> edgesToOtherElements = new ArrayList>();
	private final T value;

	public DirectedGraphNode(T value) {
		this.value = value;
	}

	/**
	 * @param target - the destination of the newly created edge Creates an edge
	 *               from the current element to the provided target element.
	 */
	public void addEdgeTo(DirectedGraphNode target) {
		edgesToOtherElements.add(target);
	}

	/**
	 * @return all outgoing edges from the current element.
	 */
	public Collection> edgesFrom() {
		return edgesToOtherElements;
	}

	@Override
	public boolean equals(Object obj) {
		// Use default
		return super.equals(obj);
	}

	@Override
	public String toString() {
		return value.toString();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy