Search in sources :

Example 66 with Function

use of com.ramussoft.pb.Function in project ramus by Vitaliy-Yakovchuk.

the class AbstractClassicTemplate method createSimpleArrow.

protected void createSimpleArrow(final Function function, final MovingArea movingArea, final int num, final int type) {
    final Function f = (Function) function.getChildAt(num);
    createStartxBorderPoint(movingArea, getX(f), 10, type);
    createInPoint(movingArea, type, f);
}
Also used : Function(com.ramussoft.pb.Function)

Example 67 with Function

use of com.ramussoft.pb.Function in project ramus by Vitaliy-Yakovchuk.

the class ClassicTemplate method createChilds.

@Override
public synchronized void createChilds(final Function function, final DataPlugin dataPlugin) {
    final MovingArea movingArea = new MovingArea(dataPlugin);
    movingArea.setDataPlugin(dataPlugin);
    movingArea.setActiveFunction(function);
    movingArea.setArrowAddingState();
    super.createChilds(function, dataPlugin, movingArea);
    int num = count / 2;
    if (2 * num == count)
        num--;
    createSimpleArrow(function, movingArea, num);
    PaintSector s;
    final Function f = (Function) function.getChildAt(num);
    createFrom(movingArea, f, top);
    createInPoint(movingArea, TOP, (Function) function.getChildAt(count - 1));
    s = movingArea.getRefactor().getSector();
    for (int i = count - 2; i > num; i--) {
        final Function fS = (Function) function.getChildAt(i);
        createFrom(movingArea, fS, s, getX(fS), POS);
        createInPoint(movingArea, TOP, fS);
    }
    createFrom(movingArea, f, bottom);
    createInPoint(movingArea, BOTTOM, (Function) function.getChildAt(count - 1));
    s = movingArea.getRefactor().getSector();
    for (int i = count - 2; i > num; i--) {
        final Function fS = (Function) function.getChildAt(i);
        createFrom(movingArea, fS, s, getX(fS), movingArea.CLIENT_HEIGHT - POS);
        createInPoint(movingArea, BOTTOM, fS);
    }
    if (num > 0) {
        createFrom(movingArea, f, top, getX(f), POS - 1);
        createInPoint(movingArea, TOP, (Function) function.getChildAt(0));
        s = movingArea.getRefactor().getSector();
        for (int i = 1; i < num; i++) {
            final Function fS = (Function) function.getChildAt(i);
            createFrom(movingArea, fS, s, getX(fS), POS);
            createInPoint(movingArea, TOP, fS);
        }
        createFrom(movingArea, f, bottom);
        createInPoint(movingArea, BOTTOM, (Function) function.getChildAt(0));
        s = movingArea.getRefactor().getSector();
        for (int i = 1; i < num; i++) {
            final Function fS = (Function) function.getChildAt(i);
            createFrom(movingArea, fS, s, getX(fS), movingArea.CLIENT_HEIGHT - POS);
            createInPoint(movingArea, BOTTOM, fS);
        }
    }
    movingArea.getRefactor().saveToFunction();
}
Also used : MovingArea(com.ramussoft.pb.idef.visual.MovingArea) Function(com.ramussoft.pb.Function) PaintSector(com.ramussoft.pb.idef.elements.PaintSector)

Example 68 with Function

use of com.ramussoft.pb.Function in project ramus by Vitaliy-Yakovchuk.

the class NFunction method getOwner.

public Row getOwner() {
    // Row row = dataPlugin.findRowByGlobalId(getLink());
    // if (row != null)
    // return row;
    Row owner = getNativeOwner();
    if (getType() >= Function.TYPE_EXTERNAL_REFERENCE)
        return owner;
    if (owner == null) {
        Function par = (Function) getParent();
        if (par == null)
            return null;
        Row ow = null;
        if (par.getDecompositionType() == MovingArea.DIAGRAM_TYPE_DFDS) {
            for (com.ramussoft.database.common.Row r : ((NFunction) par).getChildren()) {
                Function function = (Function) r;
                if (function.getType() == TYPE_DFDS_ROLE && this.equals(function.getOwner())) {
                    Stream stream = (Stream) dataPlugin.findRowByGlobalId(function.getLink());
                    if (stream != null) {
                        Row[] rows = stream.getAdded();
                        if (rows.length > 1) {
                            ow = null;
                            break;
                        } else if (rows.length == 1) {
                            if (ow != null) {
                                ow = null;
                                break;
                            } else
                                ow = rows[0];
                        }
                    }
                }
            }
        }
        if (ow != null)
            return ow;
    }
    if (owner == null && getParentRow() != null)
        return ((Function) getParentRow()).getOwner();
    return owner;
}
Also used : Function(com.ramussoft.pb.Function) Stream(com.ramussoft.pb.Stream) Row(com.ramussoft.pb.Row)

Example 69 with Function

use of com.ramussoft.pb.Function in project ramus by Vitaliy-Yakovchuk.

the class MatrixProjectionOuner method getLeft.

public Vector<Row> getLeft(final Row row) {
    final Vector<Row> res = new Vector<Row>();
    final Function f = (Function) row;
    final Row o = f.getOwner();
    if (o != null)
        res.add(o);
    return res;
}
Also used : Function(com.ramussoft.pb.Function) Row(com.ramussoft.pb.Row) Vector(java.util.Vector)

Example 70 with Function

use of com.ramussoft.pb.Function in project ramus by Vitaliy-Yakovchuk.

the class IDLExporter method rec.

private void rec(FunctionCallback callback, boolean onlyModels) throws IOException {
    Vector<Row> v = dataPlugin.getRecChilds(base, true);
    callback.call(base);
    for (Row row : v) {
        if ((row.getChildCount() == 0) && (!onlyModels))
            callback.call((Function) row);
        else if (row.getChildCount() > 0)
            callback.call((Function) row);
    }
}
Also used : Function(com.ramussoft.pb.Function) MovingFunction(com.ramussoft.pb.idef.visual.MovingFunction) Row(com.ramussoft.pb.Row)

Aggregations

Function (com.ramussoft.pb.Function)96 NFunction (com.ramussoft.pb.data.negine.NFunction)50 Row (com.ramussoft.pb.Row)36 MovingFunction (com.ramussoft.pb.idef.visual.MovingFunction)27 Crosspoint (com.ramussoft.pb.Crosspoint)25 Sector (com.ramussoft.pb.Sector)25 Stream (com.ramussoft.pb.Stream)21 FloatPoint (com.dsoft.pb.types.FloatPoint)19 NSector (com.ramussoft.pb.data.negine.NSector)18 DFDFunction (com.ramussoft.pb.dfd.visual.DFDFunction)17 PaintSector (com.ramussoft.pb.idef.elements.PaintSector)17 Vector (java.util.Vector)17 DFDSFunction (com.ramussoft.pb.dfds.visual.DFDSFunction)15 IOException (java.io.IOException)13 FRectangle (com.dsoft.pb.types.FRectangle)11 Point (com.ramussoft.pb.idef.elements.Point)11 SectorRefactor (com.ramussoft.pb.idef.elements.SectorRefactor)10 ByteArrayOutputStream (java.io.ByteArrayOutputStream)10 ArrayList (java.util.ArrayList)10 MovingArea (com.ramussoft.pb.idef.visual.MovingArea)8