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

net.sourceforge.plantuml.plasma.Plasma Maven / Gradle / Ivy

There is a newer version: 1.2024.8
Show newest version
// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
package net.sourceforge.plantuml.plasma;

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

public class Plasma {

	private String separator = "\u0000";
	private final Quark root;
	private final List> quarks = new ArrayList<>();
	private final Map> stats = new HashMap>();

	public Plasma() {
		this.root = new Quark(this, null, "");
	}

	protected void register(Quark quark) {
		quarks.add(quark);
		PEntry ent = stats.get(quark.getName());
		if (ent == null) {
			ent = new PEntry(quark);
			stats.put(quark.getName(), ent);
		} else {
			ent.counter++;
		}
	}

	public Quark root() {
		return root;
	}

	public final String getSeparator() {
		return separator;
	}

	public final void setSeparator(String separator) {
		if (separator == null)
			separator = "\u0000";
		this.separator = separator;
	}

	public final boolean hasSeparator() {
		return this.separator.equals("\u0000") == false;
	}

	public Collection> quarks() {
		return Collections.unmodifiableCollection(quarks);
	}

	public Quark firstWithName(String name) {
		final PEntry ent = stats.get(name);
		if (ent == null)
			return null;
		return ent.first;
	}

	public int countByName(String name) {
		final PEntry ent = stats.get(name);
		if (ent == null)
			return 0;
		return ent.counter;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy