use of com.ramussoft.pb.Sector in project ramus by Vitaliy-Yakovchuk.
the class NFunction method setOwner.
public void setOwner(final Row owner) {
Function ow = null;
if (getType() == Function.TYPE_DFDS_ROLE) {
ow = (Function) owner;
if (ow == null)
ow = (Function) getOwner();
}
if (owner == null) {
setObject(OWNER_ID, null);
} else {
setObject(OWNER_ID, ((NRow) owner).getElementId());
}
Function function = (Function) getParent();
if (function.getDecompositionType() == MovingArea.DIAGRAM_TYPE_DFDS) {
HashSet<Sector> toUpdate = new HashSet<Sector>();
if (getType() == Function.TYPE_DFDS_ROLE) {
if (ow != null) {
for (Sector sector : function.getSectors()) {
if (ow.equals(sector.getStart().getFunction()) || ow.equals(sector.getEnd().getFunction()))
if (!toUpdate.contains(sector))
toUpdate.add(sector);
}
}
} else {
for (Sector sector : function.getSectors()) {
if (this.equals(sector.getStart().getFunction()) || this.equals(sector.getEnd().getFunction()))
if (!toUpdate.contains(sector))
toUpdate.add(sector);
}
}
for (Sector sector : toUpdate) SectorRefactor.fixOwners(sector, getDataPlugin());
}
for (Attribute attribute : engine.getQualifier(getElement().getQualifierId()).getAttributes()) if (attribute.getAttributeType().equals(DFDSNamePlugin.type)) {
DFDSName dfdsName = (DFDSName) engine.getAttribute(getElement(), attribute);
if (dfdsName != null)
dataPlugin.compileDFDSName(dfdsName, this);
}
}
use of com.ramussoft.pb.Sector in project ramus by Vitaliy-Yakovchuk.
the class AbstractSector method removeFromParent.
public void removeFromParent(Row[] rows, boolean start) {
final Vector<Sector> v = new Vector<Sector>();
if (start)
getParents(getStart().getCrosspoint(), v);
else
getParents(getEnd().getCrosspoint(), v);
for (int i = 0; i < v.size(); i++) {
final AbstractSector s = (AbstractSector) v.get(i);
final Stream ps = s.getStream();
if (ps != null) {
final Vector<Sector> v1 = new Vector<Sector>();
if (s.getStart().getBorderType() < 0 && !start)
s.getChilds(s.getStart().getCrosspoint(), v1);
if (s.getEnd().getBorderType() < 0 && start)
s.getChilds(s.getEnd().getCrosspoint(), v1);
// v1.remove(this);
for (int j = 0; j < v1.size(); j++) {
final Sector s1 = v1.get(j);
if (!equals(s1)) {
final Stream stream = s1.getStream();
if (stream != null) {
final Row[] rs = stream.getAdded();
rows = RowFactory.removeRows(rows, rs);
final Row[] add = RowFactory.removeRows(rs, ps.getAdded());
if (add.length > 0)
ps.addRows(add);
}
}
}
if (rows.length > 0) {
ps.removeRows(rows);
s.removeFromParent(rows, start);
}
}
}
}
use of com.ramussoft.pb.Sector in project ramus by Vitaliy-Yakovchuk.
the class AbstractSector method getConnectedOnFunction.
/**
* Метод повертає масив під’єднаних до точки секторів, при чому всі сектори
* знаходяться на одному функціональному блоці.
*
* @param crosspoint Точка перетену секторів.
* @return Масив секторів, що під’єднані до точки.
*/
private void getConnectedOnFunction(final Crosspoint crosspoint, final Vector<Sector> v) {
if (crosspoint == null)
return;
final Vector<Sector> ss = new Vector<Sector>();
crosspoint.getSectors(ss);
int i;
final int n = ss.size();
final int oLen = v.size();
Sector s;
for (i = 0; i < n; i++) if ((s = ss.get(i)).getFunction().equals(getFunction()))
if (v.indexOf(s) < 0)
v.add(s);
final int len = v.size();
for (i = oLen; i < len; i++) ((AbstractSector) v.get(i)).getConnectedOnFunction(v);
}
use of com.ramussoft.pb.Sector in project ramus by Vitaliy-Yakovchuk.
the class AbstractSector method getStreams.
/**
* Повертає масив потоків пов’язаних з масивом секторів.
*
* @param sectors Масив секторів, з якого буде виділений масив потоків.
* @return Масив потоків, виділений з масиву секторів.
*/
protected Stream[] getStreams(final Sector[] sectors) {
final Vector<Stream> v = new Vector<Stream>();
for (final Sector element : sectors) if (element.getStream() != null)
if (v.indexOf(element.getStream()) < 0)
v.add(element.getStream());
final Stream[] streams = new Stream[v.size()];
for (int i = 0; i < v.size(); i++) streams[i] = v.get(i);
return streams;
}
use of com.ramussoft.pb.Sector in project ramus by Vitaliy-Yakovchuk.
the class AbstractSector method getStreamedAllSectors.
private void getStreamedAllSectors(final Crosspoint point, final Vector<Sector> v, final boolean equalByAdded) {
if (point == null)
return;
final Vector<Sector> srs = new Vector<Sector>();
getChilds(point, srs);
for (final Sector s : srs) if (v.indexOf(s) < 0) {
if (s.getStream() == null)
v.add(s);
else if ((equalByAdded) && (s.getStream().isEmptyName()) && (equalsStreamsByAdded(s.getStream(), getStream())))
v.add(s);
else if (s.getStream().equals(this.getStream()))
v.add(s);
}
srs.clear();
getParents(point, srs);
for (final Sector s : srs) if (v.indexOf(s) < 0) {
if (s.getStream() == null)
v.add(s);
else if ((equalByAdded) && (s.getStream().isEmptyName()) && (equalsStreamsByAdded(s.getStream(), getStream())))
v.add(s);
}
}
Aggregations