001    /*
002    // $Id: //open/mondrian/src/main/mondrian/olap/SetBase.java#21 $
003    // This software is subject to the terms of the Common Public License
004    // Agreement, available at the following URL:
005    // http://www.opensource.org/licenses/cpl.html.
006    // Copyright (C) 2001-2002 Kana Software, Inc.
007    // Copyright (C) 2001-2008 Julian Hyde and others
008    // All Rights Reserved.
009    // You must accept the terms of that agreement to use this software.
010    //
011    // jhyde, 6 August, 2001
012    */
013    
014    package mondrian.olap;
015    
016    import mondrian.olap.type.Type;
017    
018    import org.apache.log4j.Logger;
019    
020    /**
021     * Skeleton implementation of {@link NamedSet} interface.
022     *
023     * @author jhyde
024     * @since 6 August, 2001
025     * @version $Id: //open/mondrian/src/main/mondrian/olap/SetBase.java#21 $
026     */
027    class SetBase extends OlapElementBase implements NamedSet {
028    
029        private static final Logger LOGGER = Logger.getLogger(SetBase.class);
030    
031        private String name;
032        private final String uniqueName;
033        private final Exp exp;
034    
035        SetBase(String name, Exp exp) {
036            this.name = name;
037            this.exp = exp;
038            this.uniqueName = "[" + name + "]";
039        }
040    
041        public Object clone() {
042            return new SetBase(name, (Exp) exp.clone());
043        }
044    
045        protected Logger getLogger() {
046            return LOGGER;
047        }
048    
049        public String getUniqueName() {
050            return uniqueName;
051        }
052    
053        public String getName() {
054            return name;
055        }
056    
057        public String getQualifiedName() {
058            return null;
059        }
060    
061        public String getDescription() {
062            return null;
063        }
064    
065        public Hierarchy getHierarchy() {
066            return exp.getType().getHierarchy();
067        }
068    
069        public Dimension getDimension() {
070            return getHierarchy().getDimension();
071        }
072    
073        public OlapElement lookupChild(SchemaReader schemaReader, Id.Segment s) {
074            return null;
075        }
076    
077        public OlapElement lookupChild(
078            SchemaReader schemaReader, Id.Segment s, MatchType matchType) {
079            return null;
080        }
081    
082        public void setName(String name) {
083            this.name = name;
084        }
085    
086        public Exp getExp() {
087            return exp;
088        }
089    
090        public NamedSet validate(Validator validator) {
091            Exp exp2 = validator.validate(exp, false);
092            return new SetBase(name, exp2);
093        }
094    
095        public Type getType() {
096            return exp.getType();
097        }
098    }
099    
100    // End SetBase.java