orderedrelationshiplist.java

来自「数据仓库展示程序」· Java 代码 · 共 57 行

JAVA
57
字号
/*
// $Id: //open/mondrian/src/main/mondrian/jolap/OrderedRelationshipList.java#4 $
// This software is subject to the terms of the Common Public License
// Agreement, available at the following URL:
// http://www.opensource.org/licenses/cpl.html.
// (C) Copyright 2002-2005 Kana Software, Inc. and others.
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
//
// jhyde, Dec 24, 2002
*/
package mondrian.jolap;

import mondrian.olap.Util;

/**
 * Represents instances of a relationship where the participants have an order.
 *
 * @author jhyde
 * @since Dec 24, 2002
 * @version $Id: //open/mondrian/src/main/mondrian/jolap/OrderedRelationshipList.java#4 $
 **/
class OrderedRelationshipList extends RelationshipList {

    public OrderedRelationshipList(Relationship relationship) {
        super(relationship);
    }

    public Object addBefore(Object before, Object o) {
        Util.assertTrue(relationship.toClass.isInstance(o));
        int i = indexOf(before);
        add(i, o);
        return o;
    }

    public Object addAfter(Object after, Object o) {
        Util.assertTrue(relationship.toClass.isInstance(o));
        int i = indexOf(after);
        add(i + 1, o);
        return o;
    }

    public void moveBefore(Object before, Object o) {
        int i = indexOf(before);
        Util.assertTrue(remove(o));
        add(i, o);
    }

    public void moveAfter(Object after, Object o) {
        int i = indexOf(after);
        Util.assertTrue(remove(o));
        add(i + 1, o);
    }
}

// End OrderedRelationshipList.java

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?