001/*
002// $Id: NamedList.java 482 2012-01-05 23:27:27Z jhyde $
003//
004// Licensed to Julian Hyde under one or more contributor license
005// agreements. See the NOTICE file distributed with this work for
006// additional information regarding copyright ownership.
007//
008// Julian Hyde licenses this file to you under the Apache License,
009// Version 2.0 (the "License"); you may not use this file except in
010// compliance with the License. You may obtain a copy of the License at:
011//
012// http://www.apache.org/licenses/LICENSE-2.0
013//
014// Unless required by applicable law or agreed to in writing, software
015// distributed under the License is distributed on an "AS IS" BASIS,
016// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017// See the License for the specific language governing permissions and
018// limitations under the License.
019*/
020package org.olap4j.metadata;
021
022import java.util.List;
023
024/**
025 * Extension to {@link java.util.List} which allows access to members of the
026 * list by name as well as by ordinal.
027 *
028 * @author jhyde
029 * @version $Id: NamedList.java 482 2012-01-05 23:27:27Z jhyde $
030 * @since Aug 22, 2006
031 */
032public interface NamedList<E> extends List<E> {
033    /**
034     * Retrieves a member by name.
035     *
036     * @param name name of the element to return
037     *
038     * @see #get(int)
039     *
040     * @return the element of the list with the specified name, or null if
041     * there is no such element
042     */
043    E get(String name);
044
045    /**
046     * Returns the position where a member of a given name is found, or -1
047     * if the member is not present.
048     *
049     * @param name name of the element to return
050     *
051     * @return the index of element of the list with the specified name, or -1
052     * if there is no such element
053     *
054     * @see #indexOf(Object)
055     */
056    int indexOfName(String name);
057}
058
059// End NamedList.java