use of com.ramussoft.pb.Function in project ramus by Vitaliy-Yakovchuk.
the class NDataPlugin method createRow.
public Row createRow(final Row parent, boolean element, final GlobalId globalId) {
assert parent == null && !element || parent != null;
if (parent instanceof Stream) {
return (Row) streamsRowSet.createRow(baseStream);
}
if (parent instanceof Function)
throw new RuntimeException("Method can not be called to create functions!");
Row res;
if (!element) {
res = (Row) qualifiers.createRow((com.ramussoft.database.common.Row) parent);
} else {
com.ramussoft.database.common.Row row = qualifiers.findRow(((com.ramussoft.database.common.Row) parent).getElementId());
if (row != null) {
long qId = (Long) engine.getAttribute(row.getElement(), qualifierId);
RowSet rowSet = getRowSet(qId);
res = (Row) rowSet.createRow((com.ramussoft.database.common.Row) parent);
} else {
RowSet rowSet = findRowSetByRowId(((com.ramussoft.database.common.Row) parent).getElementId());
res = (Row) rowSet.createRow((com.ramussoft.database.common.Row) parent);
}
}
return res;
}
use of com.ramussoft.pb.Function in project ramus by Vitaliy-Yakovchuk.
the class NDataPlugin method replaceParent.
private Row replaceParent(Row row, final boolean element) {
if ((!row.isElement()) && (element) && (!(row instanceof Stream)) && (!(row instanceof Function))) {
long id = (Long) ((com.ramussoft.database.common.Row) row).getAttribute(qualifierId);
RowSet rs = getRowSet(id);
row = (Row) rs.getRoot();
}
return row;
}
use of com.ramussoft.pb.Function 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;
}
use of com.ramussoft.pb.Function in project ramus by Vitaliy-Yakovchuk.
the class IDLExporter method export.
public void export(OutputStream out) throws IOException {
loadFonts();
writer = new IDLWriter(out, encoding);
writer.p1("KIT");
writer.right();
writer.p1("IDL VERSION 1.2.8");
writer.p2("TITLE {0}", base.getName());
final ProjectOptions projectOptions = base.getProjectOptions();
writer.p2("AUTHOR {0}", projectOptions.getProjectAutor());
writer.p1("CREATION DATE " + format.format(new Date()));
writer.p2("PROJECT NAME {0}", projectOptions.getProjectName());
writer.println();
writer.println("MODEL {0}", q(base.getName()));
writer.right();
writer.println("{LWI");
printFonts();
writer.println("D 0 0 0 0 0 1 0 0 2");
writer.println("G 0 1");
writer.println("T " + q(Status.STATUS_NAMES[base.getStatus().getType()].toUpperCase()));
writer.println("R 77");
writer.println("M 0 }");
writer.left();
writer.println(" ;");
writer.right();
writer.p2("AUTHOR {0}", projectOptions.getProjectAutor());
writer.p2("PROJECT NAME {0}", projectOptions.getProjectName());
rec(new FunctionCallback() {
@Override
public void call(Function f) throws IOException {
String code = MovingFunction.getIDEF0Kod((com.ramussoft.database.common.Row) f);
writer.p1("DIAGRAM GRAPHIC " + code);
writer.right();
writer.p1("CREATION DATE " + format.format(projectOptions.getDateCreateDate()));
writer.p1("REVISION DATE " + format.format(projectOptions.getDateChangeDate()));
writer.p2("TITLE {0}", f.getName());
writer.p2("STATUS " + Status.STATUS_NAMES[f.getStatus().getType()].toUpperCase());
writer.println();
for (int i = 0; i < f.getChildCount(); i++) {
Function child = (Function) f.getChildAt(i);
int j = i;
if (!f.equals(base))
j++;
writer.p1("BOX " + j);
writer.right();
int textColot = toByteTextIndex(child.getForeground());
int bkColot = toByteIndex(child.getBackground());
writer.p2("NAME {0}", "{LWI I " + uniqueFonts.indexOf(child.getFont()) + " " + textColot + " " + bkColot + " " + textColot + "}" + child.getName());
String lb = toCoortinate(child.getBounds().getLeft(), child.getBounds().getBottom());
String rt = toCoortinate(child.getBounds().getRight(), child.getBounds().getTop());
writer.p1("BOX COORDINATES " + lb + " " + rt);
writer.p1("DETAIL REFERENCE N " + MovingFunction.getIDEF0Kod((com.ramussoft.database.common.Row) child));
writer.left();
writer.p1("ENDBOX");
}
printSegments(f);
writer.left();
writer.p1("ENDDIAGRAM");
}
}, true);
writer.left();
writer.p1("ENDMODEL");
writer.left();
writer.p1("ENDKIT");
}
use of com.ramussoft.pb.Function in project ramus by Vitaliy-Yakovchuk.
the class IDLImporter method createSegment.
private void createSegment(Arrowseg seg, MovingArea area) {
SectorRefactor sr = area.getRefactor();
Sector s = plugin.createSector();
Function f = getFunction();
s.setFunction(f);
PaintSector ps = new PaintSector();
ps.setSector(s);
ps.setMovingArea(area);
sr.addSector(ps);
seg.sector = ps;
ArrayList<FloatPoint> list = new ArrayList<FloatPoint>();
StringTokenizer st = new StringTokenizer(seg.path, "() ");
while (st.hasMoreElements()) list.add(toPoint(st.nextToken()));
seg.pointsList = list;
String text = seg.getText();
if ((text != null) && (text.length() > 0)) {
s.setStream(getStream(text), ReplaceStreamType.CHILDREN);
if (seg.coordinates != null) {
MovingLabel label = new MovingLabel(area);
StringTokenizer st2 = new StringTokenizer(seg.coordinates, "()");
FloatPoint point = toPoint(st2.nextToken());
label.getBounds().setX(point.getX());
label.getBounds().setY(point.getY() - 10);
label.setText(text);
ps.setText(label);
if (seg.squiggleCoordinates != null) {
ps.setShowTilda(true);
}
}
if (seg.label.startsWith("{")) {
StringTokenizer st2 = new StringTokenizer(seg.label, " ");
st2.nextElement();
st2.nextElement();
try {
int font = Integer.parseInt(st2.nextToken());
if (font < uniqueFonts.size())
ps.setFont(uniqueFonts.get(font));
} catch (Exception e) {
}
int color = Integer.parseInt(st2.nextToken());
if (color < COLORS.length)
ps.setColor(COLORS[color]);
}
}
}
Aggregations