use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class Adder method getLeftRows.
@Override
public Row[] getLeftRows() {
Row[] rows = a.getLeftRows();
final Vector<Row> res = new Vector();
for (final Row r : rows) res.add(r);
rows = b.getLeftRows();
for (final Row r : rows) if (res.indexOf(r) < 0)
res.add(r);
rows = new Row[res.size()];
for (int i = 0; i < rows.length; i++) rows[i] = res.get(i);
return rows;
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class AbstractRow method compareTo.
public int compareTo(final Object o) {
final Row row = (Row) o;
int level1 = dataPlugin.getLevel(this);
int level2 = dataPlugin.getLevel(row);
final int maxLevel = level2 > level1 ? level2 : level1;
for (int i = 0; i <= maxLevel; i++) {
level1 = getId(i);
level2 = ((AbstractRow) row).getId(i);
if (level1 > level2)
return 1;
if (level1 < level2)
return -1;
}
return level1 - level2;
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class RowFactory method addRows.
/**
* Медод, який об’днує два масива класифікаторів в один, всі елементи, які
* повторються, виклучаються.
*
* @param a Масив А.
* @param b Масив Б.
* @return Об’єднані масиви А і Б.
*/
public static Row[] addRows(final Row[] a, final Row[] b) {
for (Row r1 : a) {
for (Row r2 : b) if (r1 != null && r2 != null) {
if (r1.equals(r2)) {
r1.setAttachedStatus(r2.getAttachedStatus());
}
}
}
int n = a.length + b.length;
Row[] res;
int i, j = 0;
for (i = 0; i < b.length; i++) if (isPresent(a, b[i]))
n--;
res = new Row[n];
for (i = 0; i < a.length; i++) {
res[i] = a[i];
j++;
}
for (i = 0; i < b.length; i++) if (!isPresent(a, b[i])) {
res[j] = b[i];
j++;
}
return res;
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class MatrixProjectionIDEF0 method getRight.
/**
* Метод повертає вектор елементів класифікатора робіт, які пов’язані з
* відповідним елементом класифікатора потоків.
*/
public Vector<Row> getRight(final Row row) {
final Vector<Row> res = new Vector<Row>();
final Object[] functions = Main.dataPlugin.getRecChilds(Main.dataPlugin.getBaseFunction(), true).toArray();
Function f;
Function pF;
final Vector<Function> softs = new Vector<Function>();
if (functionType == -1)
for (final Object element : functions) {
boolean add = true;
f = (Function) element;
for (int j = 0; j < softs.size(); j++) if (Main.dataPlugin.isParent(f, softs.get(j))) {
res.add(f);
add = false;
break;
}
if (add) {
pF = (Function) f.getParentRow();
final Vector v = pF.getSectors();
for (int j = 0; j < v.size(); j++) {
final Sector sector = (Sector) v.get(j);
if (type == MovingPanel.RIGHT) {
if (f.equals(sector.getStart().getFunction()) && row.equals(sector.getStream())) {
res.add(f);
if (sector.getStart().getTunnelSoft() == Crosspoint.TUNNEL_SOFT)
softs.add(f);
}
} else {
if (sector.getEnd().getFunctionType() == type && f.equals(sector.getStart().getFunction()) && row.equals(sector.getStream())) {
res.add(f);
if (sector.getEnd().getTunnelSoft() == Crosspoint.TUNNEL_SOFT)
softs.add(f);
}
}
}
}
}
else
for (final Object element : functions) {
f = (Function) element;
if (f.getType() == functionType) {
boolean add = true;
for (int j = 0; j < softs.size(); j++) if (Main.dataPlugin.isParent(f, softs.get(j))) {
res.add(f);
add = false;
break;
}
if (add) {
pF = (Function) f.getParentRow();
final Vector v = pF.getSectors();
for (int j = 0; j < v.size(); j++) {
final Sector sector = (Sector) v.get(j);
if (type == MovingPanel.RIGHT) {
if (f.equals(sector.getStart().getFunction()) && row.equals(sector.getStream())) {
res.add(f);
if (sector.getStart().getTunnelSoft() == Crosspoint.TUNNEL_SOFT)
softs.add(f);
}
} else {
if (sector.getEnd().getFunctionType() == type && f.equals(sector.getStart().getFunction()) && row.equals(sector.getStream())) {
res.add(f);
if (sector.getEnd().getTunnelSoft() == Crosspoint.TUNNEL_SOFT)
softs.add(f);
}
}
}
}
}
}
return res;
}
use of com.ramussoft.pb.Row in project ramus by Vitaliy-Yakovchuk.
the class NDataPlugin method compileDFDSName.
@Override
public void compileDFDSName(DFDSName name, Function function) {
Row row2 = function.getOwner();
String string = "";
if (row2 != null)
string = row2.toString();
String sName = name.getShortNameSource();
String lName = name.getLongNameSource();
if (sName == null || lName == null)
return;
lName = compileLinks(lName);
sName = compileLinks(sName);
lName = lName.replace(DFDSNamePlugin.ROLE, string);
name.setLongName(lName);
sName = sName.replace(DFDSNamePlugin.ROLE, string);
name.setShortName(sName);
String term = function.getTerm();
if (term != null && term.trim().length() > 0) {
if (name.getLongName() != null)
name.setLongName(lName.replace(DFDSNamePlugin.TERM, term));
if (name.getShortName() != null)
name.setShortName(sName.replace(DFDSNamePlugin.TERM, term));
}
}
Aggregations