Search in sources :

Example 21 with Row

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;
}
Also used : Row(com.ramussoft.pb.Row) Vector(java.util.Vector) Crosspoint(com.ramussoft.pb.Crosspoint)

Example 22 with Row

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);
    }
}
Also used : Row(com.ramussoft.pb.Row) Vector(java.util.Vector)

Example 23 with Row

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;
    }
}
Also used : Sector(com.ramussoft.pb.Sector) NSector(com.ramussoft.pb.data.negine.NSector) Row(com.ramussoft.pb.Row) Vector(java.util.Vector) Crosspoint(com.ramussoft.pb.Crosspoint)

Example 24 with Row

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;
    }
}
Also used : NSector(com.ramussoft.pb.data.negine.NSector) Sector(com.ramussoft.pb.Sector) NSector(com.ramussoft.pb.data.negine.NSector) NStream(com.ramussoft.pb.data.negine.NStream) Stream(com.ramussoft.pb.Stream) Row(com.ramussoft.pb.Row) Vector(java.util.Vector)

Example 25 with Row

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;
}
Also used : Function(com.ramussoft.pb.Function) Sector(com.ramussoft.pb.Sector) Stream(com.ramussoft.pb.Stream) Row(com.ramussoft.pb.Row) Vector(java.util.Vector) Crosspoint(com.ramussoft.pb.Crosspoint)

Aggregations

Row (com.ramussoft.pb.Row)93 Function (com.ramussoft.pb.Function)35 Stream (com.ramussoft.pb.Stream)30 Vector (java.util.Vector)28 NFunction (com.ramussoft.pb.data.negine.NFunction)19 Sector (com.ramussoft.pb.Sector)15 NRow (com.ramussoft.pb.data.negine.NRow)14 Qualifier (com.ramussoft.common.Qualifier)13 Crosspoint (com.ramussoft.pb.Crosspoint)13 NSector (com.ramussoft.pb.data.negine.NSector)13 PaintSector (com.ramussoft.pb.idef.elements.PaintSector)12 ByteArrayOutputStream (java.io.ByteArrayOutputStream)11 ArrayList (java.util.ArrayList)11 SectorRefactor (com.ramussoft.pb.idef.elements.SectorRefactor)10 Attribute (com.ramussoft.common.Attribute)9 MovingFunction (com.ramussoft.pb.idef.visual.MovingFunction)9 IOException (java.io.IOException)9 FloatPoint (com.dsoft.pb.types.FloatPoint)8 Point (com.ramussoft.pb.idef.elements.Point)8 Element (com.ramussoft.common.Element)7