Search in sources :

Example 16 with Sector

use of com.ramussoft.pb.Sector 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 17 with Sector

use of com.ramussoft.pb.Sector 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 18 with Sector

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

the class AbstractSector method afterCreate.

public void afterCreate() {
    final Vector<Sector> v = new Vector<Sector>();
    getParents(v);
    for (int i = 0; i < v.size(); i++) if (v.get(i).getStream() != null) {
        setStream(v.get(i).getStream(), ReplaceStreamType.CHILDREN);
    }
}
Also used : Sector(com.ramussoft.pb.Sector) NSector(com.ramussoft.pb.data.negine.NSector) Vector(java.util.Vector) Crosspoint(com.ramussoft.pb.Crosspoint)

Example 19 with Sector

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

the class AbstractSector method toArray.

public static Sector[] toArray(final Vector v) {
    final int n = v.size();
    final Sector[] res = new Sector[n];
    for (int i = 0; i < n; i++) res[i] = (Sector) v.get(i);
    return res;
}
Also used : Sector(com.ramussoft.pb.Sector) NSector(com.ramussoft.pb.data.negine.NSector) Crosspoint(com.ramussoft.pb.Crosspoint)

Example 20 with Sector

use of com.ramussoft.pb.Sector 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

Sector (com.ramussoft.pb.Sector)50 NSector (com.ramussoft.pb.data.negine.NSector)40 Crosspoint (com.ramussoft.pb.Crosspoint)29 Function (com.ramussoft.pb.Function)25 NFunction (com.ramussoft.pb.data.negine.NFunction)19 Vector (java.util.Vector)19 Stream (com.ramussoft.pb.Stream)18 Row (com.ramussoft.pb.Row)15 FloatPoint (com.dsoft.pb.types.FloatPoint)10 PaintSector (com.ramussoft.pb.idef.elements.PaintSector)10 ByteArrayInputStream (java.io.ByteArrayInputStream)9 ByteArrayOutputStream (java.io.ByteArrayOutputStream)9 AbstractSector (com.ramussoft.pb.data.AbstractSector)7 ArrayList (java.util.ArrayList)5 HashSet (java.util.HashSet)5 NStream (com.ramussoft.pb.data.negine.NStream)4 Point (com.ramussoft.pb.idef.elements.Point)4 DataLoader (com.dsoft.utils.DataLoader)3 NCrosspoint (com.ramussoft.pb.data.negine.NCrosspoint)3 DFDFunction (com.ramussoft.pb.dfd.visual.DFDFunction)3