modifiabletestfilter.java.svn-base

来自「cqME :java framework for TCK test.」· SVN-BASE 代码 · 共 111 行

SVN-BASE
111
字号
/* * $Id$ * * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 only, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License version 2 for more details (a copy is * included at /legal/license.txt). * * You should have received a copy of the GNU General Public License * version 2 along with this work; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa * Clara, CA 95054 or visit www.sun.com if you need additional * information or have any questions. * */package com.sun.tck.j2me.javatest;import com.sun.javatest.TestDescription;import com.sun.javatest.TestFilter;/** * Special purpose <code>TestFilter</code> that decorates another filter. * <p> * For a test, modified by * {@link com.sun.tck.j2me.javatest.TestDescriptionModifier}, the filter * calculates an original unmodified test and verifies that both, original and * modified tests are acceptable by the base filter. * <p> * For unmodified tests, the filter delegates its work to the base filter. */public class ModifiableTestFilter extends TestFilter {    private TestFilter base;    private TestDescriptionModifier tdm;    /**     * Creates a <code>TestFilter</code> instance that decorates the specified     * base filter and uses the specified <code>TestDescriptionModifier</code>.     *     * @param base     *                The base test filter.     * @param tdm     *                The modifier.     */    public ModifiableTestFilter(TestFilter base, TestDescriptionModifier tdm) {        this.base = base;        this.tdm = tdm;    }    /**     * This implementation simply delegates its work to the base filter.     */    public String getName() {        return base.getName();    }    /**     * This implementation simply delegates its work to the base filter.     */    public String getDescription() {        return base.getDescription();    }    /**     * This implementation simply delegates its work to the base filter.     */    public String getReason() {        return base.getReason();    }    /**     * For a test, modified by     * {@link com.sun.tck.j2me.javatest.TestDescriptionModifier}, the filter     * calculates an original unmodified test and verifies that both, original     * and modified tests are acceptable by the base filter.     * <p>     * For unmodified tests, the filter delegates its work to the base filter.     *     * @param td     *            The test to accept or reject.     * @return <code>true</code> if accepted, false otherwise     * @throws TestFilter.Fault     *             In case of any errors.     */    public boolean accepts(TestDescription td) throws TestFilter.Fault {        if (tdm == null) {            return base.accepts(td);        }        if (tdm.isModifiedTest(td)) {            TestDescription origTd = tdm.getOriginalDescription(td);            assert origTd != null;            return base.accepts(origTd) && base.accepts(td);        } else {            return base.accepts(td);        }    }}

⌨️ 快捷键说明

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