Revision 43987 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/impl/expressionevaluator/DefaultFeatureSymbolTable.java

View differences:

DefaultFeatureSymbolTable.java
5 5
import org.gvsig.expressionevaluator.ExpressionEvaluatorManager;
6 6
import org.gvsig.expressionevaluator.Function;
7 7
import org.gvsig.expressionevaluator.Interpreter;
8
import org.gvsig.expressionevaluator.SymbolTable;
9 8
import org.gvsig.expressionevaluator.spi.AbstractFunction;
10 9
import org.gvsig.expressionevaluator.spi.AbstractSymbolTable;
10
import org.gvsig.fmap.dal.DataManager;
11 11
import org.gvsig.fmap.dal.expressionevaluator.FeatureSymbolTable;
12 12
import org.gvsig.fmap.dal.feature.Feature;
13 13
import org.gvsig.fmap.dal.feature.FeatureSelection;
......
61 61

  
62 62
        @Override
63 63
        public Object call(Interpreter interpreter, Object[] args) throws Exception {
64
            if( feature==null ) {
65
                return null;
66
            }
64 67
            return feature.getStore();
65 68
        }
66 69

  
......
83 86

  
84 87
        @Override
85 88
        public Object call(Interpreter interpreter, Object[] args) throws Exception {
89
            if( feature==null ) {
90
                return false;
91
            }
86 92
            FeatureStore store = feature.getStore();
87 93
            FeatureSelection selection = store.getFeatureSelection();
88 94
            return selection.isSelected(feature);
......
93 99
    private Feature feature;
94 100
    private FeatureType type;
95 101

  
102
    @SuppressWarnings("OverridableMethodCallInConstructor")
96 103
    public DefaultFeatureSymbolTable() {
97
        super("DAL.FeatureSymbolTable");
104
        super(DataManager.FEATURE_SYMBOL_TABLE);
98 105

  
99 106
        this.addFunction(new FeatureFunction());
100 107
        this.addFunction(new FeatureStoreFunction());
......
114 121
        }
115 122
    }
116 123

  
117
    public final void addFunction(Function function) {
118
        if (function == null) {
119
            throw new IllegalArgumentException("function can't be null");
120
        }
121
        this.getFunctions().put(function.name().toUpperCase(), function);
122
    }
123

  
124 124
    @Override
125 125
    public FeatureSymbolTable clone() throws CloneNotSupportedException {
126 126
        DefaultFeatureSymbolTable other = (DefaultFeatureSymbolTable) super.clone();
......
129 129

  
130 130
    @Override
131 131
    public boolean exists(String name) {
132
        if (type.get(name) != null) {
132
        if (type!=null && type.get(name) != null) {
133 133
            return true;
134 134
        }
135 135
        return false;
......
137 137

  
138 138
    @Override
139 139
    public Object value(String name) {
140
        if( feature==null ) {
141
            return null;
142
        }
140 143
        return this.feature.get(name);
141 144
    }
142 145

  
......
148 151

  
149 152
    public static void selfRegister() {
150 153
        ExpressionEvaluatorManager manager = ExpressionEvaluatorLocator.getManager();
151
        manager.registerSymbolTable(new DefaultFeatureSymbolTable());
154
        manager.registerSymbolTable(new DefaultFeatureSymbolTable(), false);
152 155
    }
153 156
}

Also available in: Unified diff