2013-12-10 19:36:50 +00:00
|
|
|
/* ========================================================================
|
|
|
|
* PlantUML : a free UML diagram generator
|
|
|
|
* ========================================================================
|
|
|
|
*
|
2016-01-09 12:15:40 +00:00
|
|
|
* (C) Copyright 2009-2017, Arnaud Roques
|
2013-12-10 19:36:50 +00:00
|
|
|
*
|
2016-03-06 16:47:34 +00:00
|
|
|
* Project Info: http://plantuml.com
|
2013-12-10 19:36:50 +00:00
|
|
|
*
|
|
|
|
* This file is part of PlantUML.
|
|
|
|
*
|
|
|
|
* PlantUML is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* PlantUML 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 General Public
|
|
|
|
* License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
|
|
|
* USA.
|
|
|
|
*
|
|
|
|
* [Java is a trademark or registered trademark of Sun Microsystems, Inc.
|
|
|
|
* in the United States and other countries.]
|
|
|
|
*
|
|
|
|
* Original Author: Arnaud Roques
|
|
|
|
*
|
|
|
|
* Revision $Revision: 9786 $
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
package net.sourceforge.plantuml.activitydiagram3;
|
|
|
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
|
|
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
|
|
|
|
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
|
|
|
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
|
|
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
|
|
|
import net.sourceforge.plantuml.graphic.HtmlColor;
|
|
|
|
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
|
|
|
|
|
|
|
public class Branch {
|
|
|
|
|
|
|
|
private final InstructionList list;
|
|
|
|
private final Display labelTest;
|
|
|
|
private final Display labelPositive;
|
2015-04-07 18:18:37 +00:00
|
|
|
private final HtmlColor color;
|
2013-12-10 19:36:50 +00:00
|
|
|
private LinkRendering inlinkRendering;
|
|
|
|
|
|
|
|
private Ftile ftile;
|
|
|
|
|
2015-04-07 18:18:37 +00:00
|
|
|
public boolean isOnlySingleStop() {
|
|
|
|
return list.isOnlySingleStop();
|
|
|
|
}
|
|
|
|
|
|
|
|
public Branch(Swimlane swimlane, Display labelPositive, Display labelTest, HtmlColor color) {
|
2015-07-11 09:32:49 +00:00
|
|
|
if (labelPositive == null) {
|
|
|
|
throw new IllegalArgumentException();
|
|
|
|
}
|
|
|
|
if (labelTest == null) {
|
|
|
|
throw new IllegalArgumentException();
|
|
|
|
}
|
2013-12-10 19:36:50 +00:00
|
|
|
this.list = new InstructionList(swimlane);
|
|
|
|
this.labelTest = labelTest;
|
|
|
|
this.labelPositive = labelPositive;
|
2015-04-07 18:18:37 +00:00
|
|
|
this.color = color;
|
2013-12-10 19:36:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void add(Instruction ins) {
|
|
|
|
list.add(ins);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean kill() {
|
|
|
|
return list.kill();
|
|
|
|
}
|
|
|
|
|
2015-08-05 20:17:01 +00:00
|
|
|
public boolean addNote(Display note, NotePosition position) {
|
|
|
|
return list.addNote(note, position);
|
2013-12-10 19:36:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public final void setInlinkRendering(LinkRendering inlinkRendering) {
|
|
|
|
this.inlinkRendering = inlinkRendering;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void updateFtile(FtileFactory factory) {
|
|
|
|
this.ftile = factory.decorateOut(list.createFtile(factory), inlinkRendering);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Collection<? extends Swimlane> getSwimlanes() {
|
|
|
|
return list.getSwimlanes();
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Display getLabelPositive() {
|
2015-04-07 18:18:37 +00:00
|
|
|
final LinkRendering in = ftile.getInLinkRendering();
|
2015-07-11 09:32:49 +00:00
|
|
|
if (in != null && Display.isNull(in.getDisplay()) == false) {
|
2015-04-07 18:18:37 +00:00
|
|
|
return in.getDisplay();
|
|
|
|
}
|
2013-12-10 19:36:50 +00:00
|
|
|
return labelPositive;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Display getLabelTest() {
|
|
|
|
return labelTest;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final HtmlColor getInlinkRenderingColor() {
|
|
|
|
return inlinkRendering == null ? null : inlinkRendering.getColor();
|
|
|
|
}
|
|
|
|
|
|
|
|
public final Ftile getFtile() {
|
|
|
|
return ftile;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean shadowing() {
|
|
|
|
return ftile.shadowing();
|
|
|
|
}
|
2015-04-07 18:18:37 +00:00
|
|
|
|
|
|
|
public final HtmlColor getColor() {
|
|
|
|
return color;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isEmpty() {
|
|
|
|
return list.isEmpty();
|
|
|
|
}
|
|
|
|
|
2015-09-06 17:28:59 +00:00
|
|
|
public Instruction getLast() {
|
|
|
|
return list.getLast();
|
|
|
|
}
|
|
|
|
|
2013-12-10 19:36:50 +00:00
|
|
|
}
|