1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-06-02 00:20:49 +00:00
plantuml/src/net/sourceforge/plantuml/nwdiag/core/Network.java

153 lines
3.2 KiB
Java
Raw Normal View History

2018-11-26 18:46:50 +00:00
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
2019-01-16 18:34:41 +00:00
* (C) Copyright 2009-2020, Arnaud Roques
2018-11-26 18:46:50 +00:00
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* 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.
*
*
* Original Author: Arnaud Roques
*
*/
2021-06-27 16:50:40 +00:00
package net.sourceforge.plantuml.nwdiag.core;
2018-11-26 18:46:50 +00:00
2021-06-27 16:50:40 +00:00
import net.sourceforge.plantuml.nwdiag.next.NStage;
2020-03-18 10:50:02 +00:00
import net.sourceforge.plantuml.ugraphic.color.HColor;
2018-11-26 18:46:50 +00:00
public class Network {
private final String name;
2021-08-30 17:13:54 +00:00
private String description;
2020-03-18 10:50:02 +00:00
private HColor color;
2020-09-19 15:43:24 +00:00
private boolean visible = true;
2018-11-26 18:46:50 +00:00
private String ownAdress;
2021-06-27 16:50:40 +00:00
private double y;
2020-09-19 15:43:24 +00:00
private boolean fullWidth;
2021-08-30 17:13:54 +00:00
private final NStage up;
2021-06-27 16:50:40 +00:00
private final NStage nstage;
2018-11-26 18:46:50 +00:00
@Override
public String toString() {
2021-06-27 16:50:40 +00:00
return name;
2018-11-26 18:46:50 +00:00
}
2021-08-30 17:13:54 +00:00
private boolean isEven() {
return nstage.getNumber() % 2 == 0;
}
public double magicDelta() {
if (isVisible() == false)
return 0;
if (isEven())
return 2;
else
return -2;
}
public NStage getUp() {
return up;
}
public Network(NStage up, NStage nstage, String name, Object... unused) {
this.up = up;
2018-11-26 18:46:50 +00:00
this.name = name;
2021-06-27 16:50:40 +00:00
this.nstage = nstage;
2018-11-26 18:46:50 +00:00
}
public final String getOwnAdress() {
return ownAdress;
}
public final void setOwnAdress(String ownAdress) {
this.ownAdress = ownAdress;
}
2021-08-30 17:13:54 +00:00
public final String getDisplayName() {
if (this.description == null) {
return name;
}
return this.description;
}
public void setDescription(String description) {
this.description = description;
2018-11-26 18:46:50 +00:00
}
2020-03-18 10:50:02 +00:00
public final HColor getColor() {
2018-11-26 18:46:50 +00:00
return color;
}
2020-03-18 10:50:02 +00:00
public final void setColor(HColor color) {
2018-11-26 18:46:50 +00:00
this.color = color;
}
2021-06-27 16:50:40 +00:00
public final void goInvisible() {
2020-09-19 15:43:24 +00:00
this.visible = false;
}
public final boolean isVisible() {
return visible;
}
2021-06-27 16:50:40 +00:00
public final double getY() {
return y;
2020-12-19 21:21:54 +00:00
}
2021-06-27 16:50:40 +00:00
public final void setY(double y) {
this.y = y;
2020-12-19 21:21:54 +00:00
}
2021-06-27 16:50:40 +00:00
public void setFullWidth(boolean fullWidth) {
this.fullWidth = fullWidth;
2020-12-19 21:21:54 +00:00
}
2021-06-27 16:50:40 +00:00
public final boolean isFullWidth() {
return fullWidth;
2020-12-19 21:21:54 +00:00
}
2021-06-27 16:50:40 +00:00
public final NStage getNstage() {
return nstage;
2020-12-19 21:21:54 +00:00
}
2021-08-30 17:13:54 +00:00
private double xmin;
private double xmax;
public void setMinMax(double xmin, double xmax) {
this.xmin = xmin;
this.xmax = xmax;
}
public final double getXmin() {
return xmin;
}
public final double getXmax() {
return xmax;
}
2018-11-26 18:46:50 +00:00
}