вторник, января 16, 2007

И сново Java

ну понимаете ли... ну даже не важно для чего этот класс нужен...

package breakdowns;

import reports.TransactionReportRow;

import common.BaseBreakdown;

/**
* @author ЦЕНЗУРА class for selector by product of transaction
*/

public class ProductBreakdown extends BaseBreakdown {

    /**
     * constructor and fill products
     */

    public ProductBreakdown() {
        items.put("0", "All products");
        items.put("1", TransactionReportRow.DOLLAR_JOIN);
        items.put("2", TransactionReportRow.FREE_JOIN);
        items.put("3", TransactionReportRow.SECOND_JOIN);
        items.put("4", TransactionReportRow.SPOTCLUB_SUBSCRIPTION);
        items.put("5", TransactionReportRow.VIP_SUBSCRIPTION);
        items.put("6", TransactionReportRow.BLOCK);
        items.put("7", TransactionReportRow.REFUND);
        items.put("8", TransactionReportRow.NUDE_SHOW);
        items.put("9", TransactionReportRow.BLOCK_DISCOUNT);
    }

    /** get product name via TransactionReportRow product constants */
    public String getProduct() {
        String res = "";
        switch (getCurrent()) {
        case 0: {
            break;
        }
        case 1: {
            res = TransactionReportRow.DOLLAR_JOIN;
            break;
        }
        case 2: {
            res = TransactionReportRow.FREE_JOIN;
            break;
        }
        case 3: {
            res = TransactionReportRow.SECOND_JOIN;
            break;
        }
        case 4: {
            res = TransactionReportRow.SPOTCLUB_SUBSCRIPTION;
            break;
        }
        case 5: {
            res = TransactionReportRow.VIP_SUBSCRIPTION;
            break;
        }
        case 6: {
            res = TransactionReportRow.BLOCK;
            break;
        }
        case 7: {
            res = TransactionReportRow.REFUND;
            break;
        }
        case 8: {
            res = TransactionReportRow.NUDE_SHOW;
            break;
        }
        case 9:
            res = TransactionReportRow.BLOCK_DISCOUNT;
            break;
        }
        return res;
    }

}


где items - LinkedHashMap, проще говоря "ассоциативный массив".

Комментариев нет: