Search in sources :

Example 6 with Sector

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

the class SectorRefactor method getStartRoles.

private static void getStartRoles(Sector sector, HashSet<Function> roles, DataPlugin dataPlugin) {
    Function function2 = sector.getStart().getFunction();
    if (function2 != null && function2.getType() == Function.TYPE_DFDS_ROLE)
        if (!roles.contains(function2))
            roles.add(function2);
    function2 = sector.getEnd().getFunction();
    if (function2 != null && function2.getType() == Function.TYPE_DFDS_ROLE)
        if (!roles.contains(function2))
            roles.add(function2);
    if (sector.getStart().getCrosspoint() != null) {
        for (Sector sector2 : sector.getStart().getCrosspoint().getOppozite(sector)) getStartRoles(sector2, roles, dataPlugin);
    }
}
Also used : Function(com.ramussoft.pb.Function) NFunction(com.ramussoft.pb.data.negine.NFunction) Sector(com.ramussoft.pb.Sector) NSector(com.ramussoft.pb.data.negine.NSector)

Example 7 with Sector

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

the class SectorRefactor method fixStartOwners.

private static void fixStartOwners(Sector sector, DataPlugin dataPlugin) {
    Function function2 = sector.getEnd().getFunction();
    if (function2 != null && function2.getType() == Function.TYPE_DFDS_ROLE)
        fillFromOwners(function2, dataPlugin);
    Crosspoint crosspoint = sector.getStart().getCrosspoint();
    if (crosspoint != null) {
        for (Sector sector2 : crosspoint.getOppozite(sector)) fixStartOwners(sector2, dataPlugin);
    }
}
Also used : Function(com.ramussoft.pb.Function) NFunction(com.ramussoft.pb.data.negine.NFunction) Sector(com.ramussoft.pb.Sector) NSector(com.ramussoft.pb.data.negine.NSector) Crosspoint(com.ramussoft.pb.Crosspoint)

Example 8 with Sector

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

the class SectorRefactor method fillEndFromOwners.

private static void fillEndFromOwners(Sector sector, HashSet<Row> owners, DataPlugin dataPlugin, boolean[] hasFunctionOwners) {
    Crosspoint crosspoint = sector.getEnd().getCrosspoint();
    Function function2 = sector.getEnd().getFunction();
    if (function2 != null) {
        if (function2.getType() != Function.TYPE_DFDS_ROLE) {
            Row row = function2.getOwner();
            if (row != null && !owners.contains(row)) {
                owners.add(row);
                hasFunctionOwners[0] = true;
            }
        } else {
            Stream stream = (Stream) dataPlugin.findRowByGlobalId(function2.getLink());
            if (stream != null)
                for (Row row : stream.getAdded()) {
                    if (row != null && !owners.contains(row))
                        owners.add(row);
                }
        }
    }
    if (crosspoint != null)
        for (Sector sector2 : crosspoint.getOppozite(sector)) fillEndFromOwners(sector2, owners, dataPlugin, hasFunctionOwners);
}
Also used : Function(com.ramussoft.pb.Function) NFunction(com.ramussoft.pb.data.negine.NFunction) Sector(com.ramussoft.pb.Sector) NSector(com.ramussoft.pb.data.negine.NSector) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) Stream(com.ramussoft.pb.Stream) Row(com.ramussoft.pb.Row) Crosspoint(com.ramussoft.pb.Crosspoint)

Example 9 with Sector

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

the class SectorRefactor method getEndRoles.

private static void getEndRoles(Sector sector, HashSet<Function> roles, DataPlugin dataPlugin) {
    Function function2 = sector.getEnd().getFunction();
    if (function2 != null && function2.getType() == Function.TYPE_DFDS_ROLE)
        if (!roles.contains(function2))
            roles.add(function2);
    function2 = sector.getStart().getFunction();
    if (function2 != null && function2.getType() == Function.TYPE_DFDS_ROLE)
        if (!roles.contains(function2))
            roles.add(function2);
    if (sector.getEnd().getCrosspoint() != null) {
        for (Sector sector2 : sector.getEnd().getCrosspoint().getOppozite(sector)) getEndRoles(sector2, roles, dataPlugin);
    }
}
Also used : Function(com.ramussoft.pb.Function) NFunction(com.ramussoft.pb.data.negine.NFunction) Sector(com.ramussoft.pb.Sector) NSector(com.ramussoft.pb.data.negine.NSector)

Example 10 with Sector

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

the class DFDSRole method setStream.

public void setStream(Stream stream, ReplaceStreamType replaceStreamType) {
    function.setLink((stream == null) ? -1 : stream.getElement().getId());
    Function function = (Function) this.function.getOwner();
    if (function != null) {
        HashSet<Sector> toUpdate = new HashSet<Sector>();
        for (Sector sector : ((Function) this.function.getParent()).getSectors()) {
            if (function.equals(sector.getStart().getFunction()) || function.equals(sector.getEnd().getFunction()))
                if (!toUpdate.contains(sector))
                    toUpdate.add(sector);
        }
        for (Sector sector : toUpdate) SectorRefactor.fixOwners(sector, movingArea.dataPlugin);
    } else {
        SectorRefactor.copyOwnersFrom(this.function, movingArea.dataPlugin);
    }
}
Also used : Function(com.ramussoft.pb.Function) NFunction(com.ramussoft.pb.data.negine.NFunction) Sector(com.ramussoft.pb.Sector) PaintSector(com.ramussoft.pb.idef.elements.PaintSector) HashSet(java.util.HashSet)

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