1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-24 13:57:33 +00:00

Document purpose of shared methods

This commit is contained in:
Benjamin Davies 2024-03-20 16:08:43 +13:00
parent 90a88ce4ee
commit 83255431f7
No known key found for this signature in database
GPG Key ID: 9FFDE0674336C460

View File

@ -50,10 +50,22 @@ public class ChenEerDiagram extends AbstractEntityDiagram {
private final Stack<Entity> ownerStack = new Stack<Entity>(); private final Stack<Entity> ownerStack = new Stack<Entity>();
/**
* Pushes the owner of the following attributes.
*
* @see #peekOwner()
* @param group the entity that owns the following attributes
*/
public void pushOwner(Entity group) { public void pushOwner(Entity group) {
ownerStack.push(group); ownerStack.push(group);
} }
/**
* Pops an attribute owner from the stack. See also {@link #peekOwner()}.
*
* @see #peekOwner()
* @return true if an owner was popped, false if the stack was empty
*/
public boolean popOwner() { public boolean popOwner() {
if (ownerStack.isEmpty()) { if (ownerStack.isEmpty()) {
return false; return false;
@ -62,6 +74,17 @@ public class ChenEerDiagram extends AbstractEntityDiagram {
return true; return true;
} }
/**
* Returns the owner of the current attribute.
*
* <p>
* This is used to link attributes based on their lexical position (how they
* appear in sources) without nesting the entities (like how packages are
* done). It is for this reason that we can't use CucaDiagram.getCurrentGroup,
* as that method nests the entities.
*
* @return the owner of the current attribute, or null if there is no owner
*/
public Entity peekOwner() { public Entity peekOwner() {
if (ownerStack.isEmpty()) { if (ownerStack.isEmpty()) {
return null; return null;