net.sourceforge.plantuml.plasma.Plasma Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plantuml-mit Show documentation
Show all versions of plantuml-mit Show documentation
PlantUML is a component that allows to quickly write diagrams from text.
// 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;
}
}