use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class NDataPlugin method getChilds.
public Vector getChilds(Row row, final boolean element) {
assert row == null && element == false || row != null;
final Vector res = new Vector();
Row tmp;
if (row == null)
for (com.ramussoft.database.common.Row r : qualifiers.getAllRows()) {
tmp = (Row) r;
if ((tmp.isElement() == element) && (tmp.getParent().equals(qualifiers.getRoot())))
res.add(tmp);
}
else {
row = replaceParent(row, element);
for (int i = 0; i < row.getChildCount(); i++) {
tmp = (Row) row.getChildAt(i);
if (tmp.isElement() == element)
res.add(tmp);
}
}
return res;
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class AbstractMatrixProjection method getRightParent.
private void getRightParent(final Row row, final Vector<Row[]> add) {
if (row.isElement()) {
final Vector v = getRight(row);
Row[] v1;
for (int i = 0; i < v.size(); i++) {
v1 = new Row[2];
v1[0] = row;
v1[1] = (Row) v.get(i);
add.add(v1);
}
getRightParent((Row) row.getParent(), add);
}
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class AbstractSector method setStream.
public void setStream(final Stream stream, ReplaceStreamType type) {
synchronized (dataPlugin) {
if (sRec)
return;
if (rec || stream == null)
return;
sRec = true;
if (stream != null) {
final Vector<Sector> v = new Vector<Sector>();
if (!stream.isEmptyName()) {
v.add(this);
getNullStreamedSectors(v);
addPart(v, getStart().getCrosspoint());
addPart(v, getEnd().getCrosspoint());
if (type.equals(ReplaceStreamType.SIMPLE)) {
getStreamChilds(v);
for (int i = v.size() - 1; i >= 0; i--) {
Sector s = v.get(i);
((AbstractSector) s).getStreamChilds(v);
}
} else if (type.equals(ReplaceStreamType.CHILDREN)) {
for (int i = v.size() - 1; i >= 0; i--) {
Sector s = v.get(i);
((AbstractSector) s).getRecEndChilds(v);
}
} else if (type.equals(ReplaceStreamType.ALL)) {
for (int i = v.size() - 1; i >= 0; i--) {
Sector s = v.get(i);
((AbstractSector) s).getConnected(v);
}
}
for (Sector s : v) ((AbstractSector) s).setThisStream(stream);
} else {
getStreamChilds(v);
addPart(v, getStart().getCrosspoint());
addPart(v, getEnd().getCrosspoint());
for (final Sector s : v) {
setPersonalStream(s, stream);
}
}
v.clear();
getConnected(v);
for (Sector s : v) if (s.getStream() != null) {
Row[] rows2 = s.getStream().getAdded();
Row[] rows = stream.getAdded();
boolean changed = false;
for (int i = 0; i < rows2.length; i++) {
Row r2 = rows2[i];
for (Row r : rows) if (r.getElement().getId() == r2.getElement().getId()) {
rows2[i] = r;
changed = true;
}
}
if (changed) {
s.getStream().addRows(rows2);
((NStream) s.getStream()).saveAdded();
}
}
}
setThisStream(stream);
sRec = false;
}
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class AbstractSector method setRows.
public void setRows(final Row[] rows) {
synchronized (dataPlugin) {
sRec = true;
if (getStream() != null) {
final Row[] dels = RowFactory.removeRows(getStream().getAdded(), rows);
if (dels.length > 0)
removeFromParent(dels);
getStream().setRows(rows);
}
final Vector<Sector> v = new Vector();
getRecParents(v);
final Sector[] sectors = toArray(v);
final Stream[] streams = getStreams(sectors);
for (final Stream element : streams) element.addRows(rows);
for (Sector s : sectors) {
if (s.getStream() == null) {
Stream stream = (Stream) dataPlugin.createRow(dataPlugin.getBaseStream(), true);
stream.addRows(rows);
((NSector) s).setThisStream(stream);
}
}
sRec = false;
}
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class MatrixProjectionIDEF0 method getLeft.
/**
* Метод повертає вектор елементів класифікатора потоків, які пов’язані з
* відповідним елементом класифікатора робіт.
*/
public Vector<Row> getLeft(final Row row) {
Function parent;
if ((parent = (Function) row.getParentRow()) == null)
return new Vector<Row>();
final Vector<Row> res = new Vector<Row>();
final Function f = (Function) row;
final Vector sectors = parent.getSectors();
Sector sector;
Stream stream;
final int l = sectors.size();
for (int i = 0; i < l; i++) {
sector = (Sector) sectors.get(i);
if ((stream = sector.getStream()) != null) {
if (type == MovingPanel.RIGHT) {
if (f.equals(sector.getStart().getFunction()))
res.add(stream);
} else {
if (f.equals(sector.getEnd().getFunction()) && sector.getEnd().getFunctionType() == type)
res.add(stream);
}
}
}
return res;
}
Aggregations