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

org.eclipse.epsilon.egl.patch.LineMap Maven / Gradle / Ivy

The newest version!
/*********************************************************************
* Copyright (c) 2008 The University of York.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
package org.eclipse.epsilon.egl.patch;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;

import java.util.Map;

/**
 * 
 * @since 1.6
 */
public class LineMap {
	
	protected Map> map = new HashMap<>();
	
	public void put(Line source, Line target) {
		List lines = map.get(source);
		if (lines == null) {
			lines = new ArrayList<>();
			map.put(source, lines);
		}
		lines.add(target);
	}
	
	public List get(Line souce) {
		List lines = map.get(souce);
		if (lines == null) lines = Collections.emptyList();
		return lines;
	}
	
	@Override
	public String toString() {
		return map.toString();
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy