use of com.ramussoft.pb.Stream in project ramus by Vitaliy-Yakovchuk.
the class MatrixProjectionStreams method getLeft.
/**
* Повертає набір класифікаторів пов’язаних з елементом класифікатора
* потоків, атрибут обов’язково має бети елементом класифікатора потоків.
*/
public Vector<Row> getLeft(final Row row) {
final Row[] rows = ((Stream) row).getAdded();
final Vector<Row> res = new Vector<Row>();
for (final Row row2 : rows) res.add(row2);
return res;
}
use of com.ramussoft.pb.Stream in project ramus by Vitaliy-Yakovchuk.
the class DFDSRole method onProcessEndBoundsChange.
@Override
public void onProcessEndBoundsChange() {
final FRectangle oldRec = function.getBounds();
myBounds.setTransformNetBounds(MovingArea.NET_LENGTH);
List<PaintSector> list = new ArrayList<PaintSector>();
final SectorRefactor refactor = movingArea.getRefactor();
boolean sectorReplaced = false;
DFDSFunction function = movingArea.findDFDSFunction(this.getBounds());
if (function != null) {
getFunction().setOwner(function.getFunction());
for (int i = 0; i < refactor.getSectorsCount(); i++) {
PaintSector ps = refactor.getSector(i);
Function function2 = ps.getSector().getStart().getFunction();
if (function2 != null && function2.equals(this.function)) {
replaceFunction(ps.getSector().getStart(), ps, list, ps.getStartPoint(), ps.getSector().getStart().getFunctionType(), function, refactor, true);
}
Function function3 = ps.getSector().getEnd().getFunction();
if (function3 != null && function3.equals(this.function)) {
replaceFunction(ps.getSector().getEnd(), ps, list, ps.getEndPoint(), ps.getSector().getEnd().getFunctionType(), function, refactor, false);
}
}
function.justifyRoles();
sectorReplaced = true;
} else {
if (this.getFunction().getOwner() != null) {
DFDSFunction function2 = movingArea.findDFDSFunction(this.getFunction().getOwner());
if (function2 != null && function2.getBounds().intersects(this.getBounds())) {
function2.justifyRoles();
} else
this.function.setBounds(new FRectangle(myBounds));
} else
this.function.setBounds(new FRectangle(myBounds));
}
MemoryData memoryData = new MemoryData();
if (!sectorReplaced) {
for (int i = 0; i < refactor.getSectorsCount(); i++) {
PaintSector sector = refactor.getSector(i);
setAddedSectorPos(oldRec, sector, list);
}
}
for (PaintSector ps : list) PaintSector.save(ps, memoryData, ((NFunction) this.function).getEngine());
long l = this.function.getLink();
if (l >= 0l) {
Stream stream = (Stream) movingArea.getDataPlugin().findRowByGlobalId(l);
if (stream != null) {
Row[] rows = stream.getAdded();
RectangleVisualOptions ops = new RectangleVisualOptions();
ops.bounds = this.function.getBounds();
ops.background = this.function.getBackground();
ops.font = this.function.getFont();
ops.foreground = this.function.getForeground();
for (Row row : rows) if (row != null) {
IDEF0Plugin.setDefaultRectangleVisualOptions(movingArea.getDataPlugin().getEngine(), row.getElement(), ops);
}
}
}
}
use of com.ramussoft.pb.Stream in project ramus by Vitaliy-Yakovchuk.
the class NFunction method getOwners.
public Row[] getOwners() {
Function function = (Function) getParentRow();
if (function.getDecompositionType() == MovingArea.DIAGRAM_TYPE_DFDS) {
if (function != null) {
List<Row> res = new ArrayList<Row>();
int c = function.getChildCount();
for (int i = 0; i < c; i++) {
Function function2 = (Function) function.getChildAt(i);
if (function2.getType() == Function.TYPE_DFDS_ROLE && this.equals(function2.getOwner())) {
Stream stream = (Stream) dataPlugin.findRowByGlobalId(function2.getLink());
if (stream != null) {
for (Row row : stream.getAdded()) if (!res.contains(row))
res.add(row);
}
}
}
Row[] rows = res.toArray(new Row[res.size()]);
RowFactory.sortByName(rows);
return rows;
}
}
String s = dataPlugin.getProperty(DataPlugin.PROPERTY_OUNERS);
if (s == null)
s = "";
final StringTokenizer st = new StringTokenizer(s);
final Vector<GlobalId> ids = new Vector<GlobalId>();
while (st.hasMoreTokens()) {
ids.add(GlobalId.convert(st.nextToken()));
}
final MatrixProjection projection = dataPlugin.getProjection(MatrixProjection.TYPE_IDEF0, "BOTTOM");
final Vector left = projection.getLeft(this);
final Vector<Row> res = new Vector<Row>();
Row[] rows;
for (int i = 0; i < left.size(); i++) {
final Stream r = (Stream) left.get(i);
if ((rows = r.getAdded()).length == 0)
addRow(res, ids, r);
else
for (final Row element2 : rows) addRow(res, ids, element2);
}
rows = res.toArray(new Row[res.size()]);
RowFactory.sortByName(rows);
return rows;
}
use of com.ramussoft.pb.Stream 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.Stream 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;
}
Aggregations