Package eu.flatworld.cstrader.data

Examples of eu.flatworld.cstrader.data.ItemLine


            wanted.addAll(p1.getWanted());
        }
        Comparator itemLineCompare = new Comparator() {

            public int compare(Object o1, Object o2) {
                ItemLine i1 = (ItemLine) o1;
                ItemLine i2 = (ItemLine) o2;
                return i1.getItem().getName().compareTo(i2.getItem().getName());
            }
        };
        Collections.sort(forSale, itemLineCompare);
        Collections.sort(wanted, itemLineCompare);
        int iwbb = 0;   // item wanted begin bracket.
        ItemLine iw;
        int iwndx;
        for (ItemLine ifs : forSale) {
            if (item != null && !itemP.matcher(ifs.getItem().getName()).find()) {
                continue;
            }
            if (fromSys != null && !fromSysP.matcher(ifs.getLocation().getSystem().name()).find()) {
                continue;
            }
            if (fromLoc != null && !fromLocP.matcher(ifs.getLocation().getName()).find()) {
                continue;
            }
            LocationProperty lpfs = locationsProperties.get(ifs.getLocation().getName());
            if (lpfs != null && lpfs.isIgnore()) {
                continue;
            }
            for (iwndx = iwbb; iwndx < wanted.size(); iwndx++) {
                iw = wanted.get(iwndx);
                if (ifs.getItem().getName().compareTo(iw.getItem().getName()) > 0) {
                    iwbb++;
                    continue;
                }
                if (ifs.getItem().getName().compareTo(iw.getItem().getName()) < 0) {
                    break;
                }
                if (item != null && !itemP.matcher(iw.getItem().getName()).find()) {
                    continue;
                }
                if (toSys != null && !toSysP.matcher(iw.getLocation().getSystem().name()).find()) {
                    continue;
                }
                if (toLoc != null && !toLocP.matcher(iw.getLocation().getName()).find()) {
                    continue;
                }
                LocationProperty lpw = locationsProperties.get(iw.getLocation().getName());
                if (lpw != null && lpw.isIgnore()) {
                    continue;
                }
                if (ifs.getItem().getName().equals(iw.getItem().getName())) {
                    Route r = new Route(ifs, iw, weightLimit, credits);
                    if ((minimumAbsoluteProfit != null) &&
                            (r.getAbsoluteProfit() < minimumAbsoluteProfit)) {
                        continue;
                    }
                    if ((minimumRelativeProfit != null) &&
                            (r.getRelativeProfit() < minimumRelativeProfit)) {
                        continue;
                    }
                    if ((minimumTotalProfit != null) &&
                            (r.getTotalProfit() < minimumTotalProfit)) {
                        continue;
                    }
                    long turns = PricelistsTools.getRouteTurns(r, currentLocation, sector, grid, hop);
                    if ((turnLimit != null) && (turns > turnLimit)) {
                        continue;
                    }
                    long tptc = r.getTotalProfit() / turns;
                    if ((minimumTPTC != null) && (tptc < minimumTPTC)) {
                        continue;
                    }
                    ifs.getConnectedItemLines().add(iw);
                    iw.getConnectedItemLines().add(ifs);
                    routes.add(new Route(ifs, iw, weightLimit, credits));
                }
            }
        }
        // here goes nothing.
View Full Code Here


    }// </editor-fold>//GEN-END:initComponents

    private void jmiWantedEditPriceWatchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiWantedEditPriceWatchActionPerformed
        ItemsTableModel model = (ItemsTableModel) jtWanted.getModel();
        int row = jtWanted.getSelectedRow();
        ItemLine i = model.getItemAtRow(jtWanted.convertRowIndexToModel(row));
        ItemProperty ip = itemsProperties.get(i.getItem().getName());
        if (ip == null) {
            ip = new ItemProperty();
            ip.setName(i.getItem().getName());
        }
        PriceWatchDialog pwd = new PriceWatchDialog(JOptionPane.getFrameForComponent(this), ip);
        pwd.setVisible(true);
        if (pwd.getItemPorperties() != null) {
            itemsProperties.put(ip.getName(), ip);
View Full Code Here

    }//GEN-LAST:event_jmiWantedEditPriceWatchActionPerformed

    private void jmicbWantedIgnoreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmicbWantedIgnoreActionPerformed
        ItemsTableModel model = (ItemsTableModel) jtWanted.getModel();
        int row = jtWanted.getSelectedRow();
        ItemLine i = model.getItemAtRow(jtWanted.convertRowIndexToModel(row));
        LocationProperty ln = locationsProperties.get(i.getLocation().getName());
        if (ln == null) {
            ln = new LocationProperty();
            ln.setName(i.getLocation().getName());
            ln.setIgnore(false);
            locationsProperties.put(ln.getName(), ln);
        }
        ln.setIgnore(jmicbWantedIgnore.isSelected());
        forceTablesUpdate();
View Full Code Here

    private void jpmWantedPopupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_jpmWantedPopupMenuWillBecomeVisible
        ItemsTableModel model = (ItemsTableModel) jtWanted.getModel();
        int row = jtWanted.getSelectedRow();
        if (row != -1) {
            jtWanted.setRowSelectionInterval(row, row);
            ItemLine i = model.getItemAtRow(jtWanted.convertRowIndexToModel(row));
            LocationProperty lp = locationsProperties.get(i.getLocation().getName());
            if (lp == null || !lp.isIgnore()) {
                jmicbWantedIgnore.setSelected(false);
            } else {
                jmicbWantedIgnore.setSelected(true);
            }
View Full Code Here

    }//GEN-LAST:event_jpmWantedPopupMenuWillBecomeVisible

    private void jmiForSaleEditPriceWatchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmiForSaleEditPriceWatchActionPerformed
        ItemsTableModel model = (ItemsTableModel) jtForSale.getModel();
        int row = jtForSale.getSelectedRow();
        ItemLine i = model.getItemAtRow(jtForSale.convertRowIndexToModel(row));
        ItemProperty ip = itemsProperties.get(i.getItem().getName());
        if (ip == null) {
            ip = new ItemProperty();
            ip.setName(i.getItem().getName());
        }
        PriceWatchDialog pwd = new PriceWatchDialog(JOptionPane.getFrameForComponent(this), ip);
        pwd.setVisible(true);
        if (pwd.getItemPorperties() != null) {
            itemsProperties.put(ip.getName(), ip);
View Full Code Here

    }//GEN-LAST:event_jmiForSaleEditPriceWatchActionPerformed

    private void jmicbForSaleIgnoreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmicbForSaleIgnoreActionPerformed
        ItemsTableModel model = (ItemsTableModel) jtForSale.getModel();
        int row = jtForSale.getSelectedRow();
        ItemLine i = model.getItemAtRow(jtForSale.convertRowIndexToModel(row));
        LocationProperty ln = locationsProperties.get(i.getLocation().getName());
        if (ln == null) {
            ln = new LocationProperty();
            ln.setName(i.getLocation().getName());
            ln.setIgnore(false);
            locationsProperties.put(ln.getName(), ln);
        }
        ln.setIgnore(jmicbForSaleIgnore.isSelected());
        forceTablesUpdate();
View Full Code Here

    private void jpmForSalePopupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_jpmForSalePopupMenuWillBecomeVisible
        ItemsTableModel model = (ItemsTableModel) jtForSale.getModel();
        int row = jtForSale.getSelectedRow();
        if (row != -1) {
            jtForSale.setRowSelectionInterval(row, row);
            ItemLine i = model.getItemAtRow(jtForSale.convertRowIndexToModel(row));
            LocationProperty lp = locationsProperties.get(i.getLocation().getName());
            if (lp == null || !lp.isIgnore()) {
                jmicbForSaleIgnore.setSelected(false);
            } else {
                jmicbForSaleIgnore.setSelected(true);
            }
View Full Code Here

        return COLUMNS;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        ItemLine i = data.get(rowIndex);
        switch (columnIndex) {
            case 0:
                return i.getItem().getName();
            case 1:
                return i.getItem().getWeight();
            case 2:
                return i.getQuantity();
            case 3:
                return i.getPrice();
            case 4:
                return i.getLocation().getName();
            case 5:
                return i.getLocation().getSystem().name();
        }
        return null;
    }
View Full Code Here

    private void jpmForSalePopupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_jpmForSalePopupMenuWillBecomeVisible
        ItemsTableModel model = (ItemsTableModel) jtForSale.getModel();
        int row = jtForSale.getSelectedRow();
        if (row != -1) {
            jtForSale.setRowSelectionInterval(row, row);
            ItemLine i = model.getItemAtRow(jtForSale.convertRowIndexToModel(row));
            LocationProperty lp = locationsProperties.get(i.getLocation().getName());
            if (lp == null || !lp.isIgnore()) {
                jmicbForSaleIgnore.setSelected(false);
            } else {
                jmicbForSaleIgnore.setSelected(true);
            }
View Full Code Here

    private void jpmWantedPopupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_jpmWantedPopupMenuWillBecomeVisible
        ItemsTableModel model = (ItemsTableModel) jtWanted.getModel();
        int row = jtWanted.getSelectedRow();
        if (row != -1) {
            jtWanted.setRowSelectionInterval(row, row);
            ItemLine i = model.getItemAtRow(jtWanted.convertRowIndexToModel(row));
            LocationProperty lp = locationsProperties.get(i.getLocation().getName());
            if (lp == null || !lp.isIgnore()) {
                jmicbWantedIgnore.setSelected(false);
            } else {
                jmicbWantedIgnore.setSelected(true);
            }
View Full Code Here

TOP

Related Classes of eu.flatworld.cstrader.data.ItemLine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.