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

com.sqlapp.graphviz.GraphCollection Maven / Gradle / Ivy

There is a newer version: 0.12.37
Show newest version
/**
 * Copyright (C) 2007-2017 Tatsuo Satoh 
 *
 * This file is part of sqlapp-graphviz.
 *
 * sqlapp-graphviz is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * sqlapp-graphviz is 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with sqlapp-graphviz.  If not, see .
 */

package com.sqlapp.graphviz;

import java.util.LinkedHashMap;
import java.util.Map;

import lombok.Getter;

public class GraphCollection extends AbstractElementCollection{

	/**
	 * 
	 */
	private static final long serialVersionUID = 6685111479972906357L;

	protected GraphCollection(Graph parent){
		this.parent=parent;
	}
	
	@Getter(value=lombok.AccessLevel.PUBLIC)
	private final Graph parent;
	
	private Map map=new LinkedHashMap<>();

	@Override
	protected void renew(){
		map.clear();
		this.getList().forEach(c->{
			if (map.containsKey(c.getName())){
				throw new DuplicateGraphException(c);
			}
			map.put(c.getName(), c);
			c.setParent(this);
		});
	}
	
	@SuppressWarnings("unchecked")
	public  T get(String name){
		return (T)map.get(name);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy