Search in sources :

Example 71 with Row

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

the class Adder method getLeftRows.

@Override
public Row[] getLeftRows() {
    Row[] rows = a.getLeftRows();
    final Vector<Row> res = new Vector();
    for (final Row r : rows) res.add(r);
    rows = b.getLeftRows();
    for (final Row r : rows) if (res.indexOf(r) < 0)
        res.add(r);
    rows = new Row[res.size()];
    for (int i = 0; i < rows.length; i++) rows[i] = res.get(i);
    return rows;
}
Also used : Row(com.ramussoft.pb.Row) Vector(java.util.Vector)

Example 72 with Row

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

the class AbstractRow method compareTo.

public int compareTo(final Object o) {
    final Row row = (Row) o;
    int level1 = dataPlugin.getLevel(this);
    int level2 = dataPlugin.getLevel(row);
    final int maxLevel = level2 > level1 ? level2 : level1;
    for (int i = 0; i <= maxLevel; i++) {
        level1 = getId(i);
        level2 = ((AbstractRow) row).getId(i);
        if (level1 > level2)
            return 1;
        if (level1 < level2)
            return -1;
    }
    return level1 - level2;
}
Also used : Row(com.ramussoft.pb.Row)

Example 73 with Row

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

the class RowFactory method addRows.

/**
 * Медод, який об’днує два масива класифікаторів в один, всі елементи, які
 * повторються, виклучаються.
 *
 * @param a Масив А.
 * @param b Масив Б.
 * @return Об’єднані масиви А і Б.
 */
public static Row[] addRows(final Row[] a, final Row[] b) {
    for (Row r1 : a) {
        for (Row r2 : b) if (r1 != null && r2 != null) {
            if (r1.equals(r2)) {
                r1.setAttachedStatus(r2.getAttachedStatus());
            }
        }
    }
    int n = a.length + b.length;
    Row[] res;
    int i, j = 0;
    for (i = 0; i < b.length; i++) if (isPresent(a, b[i]))
        n--;
    res = new Row[n];
    for (i = 0; i < a.length; i++) {
        res[i] = a[i];
        j++;
    }
    for (i = 0; i < b.length; i++) if (!isPresent(a, b[i])) {
        res[j] = b[i];
        j++;
    }
    return res;
}
Also used : Row(com.ramussoft.pb.Row)

Example 74 with Row

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

the class MatrixProjectionIDEF0 method getRight.

/**
 * Метод повертає вектор елементів класифікатора робіт, які пов’язані з
 * відповідним елементом класифікатора потоків.
 */
public Vector<Row> getRight(final Row row) {
    final Vector<Row> res = new Vector<Row>();
    final Object[] functions = Main.dataPlugin.getRecChilds(Main.dataPlugin.getBaseFunction(), true).toArray();
    Function f;
    Function pF;
    final Vector<Function> softs = new Vector<Function>();
    if (functionType == -1)
        for (final Object element : functions) {
            boolean add = true;
            f = (Function) element;
            for (int j = 0; j < softs.size(); j++) if (Main.dataPlugin.isParent(f, softs.get(j))) {
                res.add(f);
                add = false;
                break;
            }
            if (add) {
                pF = (Function) f.getParentRow();
                final Vector v = pF.getSectors();
                for (int j = 0; j < v.size(); j++) {
                    final Sector sector = (Sector) v.get(j);
                    if (type == MovingPanel.RIGHT) {
                        if (f.equals(sector.getStart().getFunction()) && row.equals(sector.getStream())) {
                            res.add(f);
                            if (sector.getStart().getTunnelSoft() == Crosspoint.TUNNEL_SOFT)
                                softs.add(f);
                        }
                    } else {
                        if (sector.getEnd().getFunctionType() == type && f.equals(sector.getStart().getFunction()) && row.equals(sector.getStream())) {
                            res.add(f);
                            if (sector.getEnd().getTunnelSoft() == Crosspoint.TUNNEL_SOFT)
                                softs.add(f);
                        }
                    }
                }
            }
        }
    else
        for (final Object element : functions) {
            f = (Function) element;
            if (f.getType() == functionType) {
                boolean add = true;
                for (int j = 0; j < softs.size(); j++) if (Main.dataPlugin.isParent(f, softs.get(j))) {
                    res.add(f);
                    add = false;
                    break;
                }
                if (add) {
                    pF = (Function) f.getParentRow();
                    final Vector v = pF.getSectors();
                    for (int j = 0; j < v.size(); j++) {
                        final Sector sector = (Sector) v.get(j);
                        if (type == MovingPanel.RIGHT) {
                            if (f.equals(sector.getStart().getFunction()) && row.equals(sector.getStream())) {
                                res.add(f);
                                if (sector.getStart().getTunnelSoft() == Crosspoint.TUNNEL_SOFT)
                                    softs.add(f);
                            }
                        } else {
                            if (sector.getEnd().getFunctionType() == type && f.equals(sector.getStart().getFunction()) && row.equals(sector.getStream())) {
                                res.add(f);
                                if (sector.getEnd().getTunnelSoft() == Crosspoint.TUNNEL_SOFT)
                                    softs.add(f);
                            }
                        }
                    }
                }
            }
        }
    return res;
}
Also used : Function(com.ramussoft.pb.Function) Sector(com.ramussoft.pb.Sector) Row(com.ramussoft.pb.Row) Vector(java.util.Vector)

Example 75 with Row

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

the class NDataPlugin method compileDFDSName.

@Override
public void compileDFDSName(DFDSName name, Function function) {
    Row row2 = function.getOwner();
    String string = "";
    if (row2 != null)
        string = row2.toString();
    String sName = name.getShortNameSource();
    String lName = name.getLongNameSource();
    if (sName == null || lName == null)
        return;
    lName = compileLinks(lName);
    sName = compileLinks(sName);
    lName = lName.replace(DFDSNamePlugin.ROLE, string);
    name.setLongName(lName);
    sName = sName.replace(DFDSNamePlugin.ROLE, string);
    name.setShortName(sName);
    String term = function.getTerm();
    if (term != null && term.trim().length() > 0) {
        if (name.getLongName() != null)
            name.setLongName(lName.replace(DFDSNamePlugin.TERM, term));
        if (name.getShortName() != null)
            name.setShortName(sName.replace(DFDSNamePlugin.TERM, term));
    }
}
Also used : Row(com.ramussoft.pb.Row)

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