source: trunk/autoquest-core-usageprofiles/src/main/java/de/ugoe/cs/autoquest/usageprofiles/DefaultSymbolStrategy.java @ 1282

Last change on this file since 1282 was 1282, checked in by pharms, 11 years ago
  • added support for symbol management strategy in tries, especially for storing them
  • adapted comparator approach accordingly
  • provided default implementation for symbol management strategies
  • added, extended and improved java doc
File size: 1.9 KB
Line 
1//   Copyright 2012 Georg-August-Universität Göttingen, Germany
2//
3//   Licensed under the Apache License, Version 2.0 (the "License");
4//   you may not use this file except in compliance with the License.
5//   You may obtain a copy of the License at
6//
7//       http://www.apache.org/licenses/LICENSE-2.0
8//
9//   Unless required by applicable law or agreed to in writing, software
10//   distributed under the License is distributed on an "AS IS" BASIS,
11//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//   See the License for the specific language governing permissions and
13//   limitations under the License.
14
15package de.ugoe.cs.autoquest.usageprofiles;
16
17/**
18 * <p>
19 * Default implementation of a {@link SymbolStrategy}. Uses a {@link DefaultSymbolComparator} and
20 * a {@link DefaultSymbolMap} for managing symbols.
21 * </p>
22 *
23 * @author Patrick Harms
24 *
25 * @see SymbolStrategy
26 */
27public class DefaultSymbolStrategy<T> implements SymbolStrategy<T> {
28   
29    /**
30     * default serial version id
31     */
32    private static final long serialVersionUID = 1L;
33   
34    /**
35     * the comparator used in this strategy
36     */
37    private SymbolComparator<T> comparator = new DefaultSymbolComparator<T>();
38
39    /* (non-Javadoc)
40     * @see de.ugoe.cs.autoquest.usageprofiles.SymbolStrategy#getSymbolComparator()
41     */
42    @Override
43    public SymbolComparator<T> getSymbolComparator() {
44        return comparator;
45    }
46
47    /* (non-Javadoc)
48     * @see de.ugoe.cs.autoquest.usageprofiles.SymbolStrategy#createSymbolMap()
49     */
50    @Override
51    public <V> SymbolMap<T, V> createSymbolMap() {
52        return new DefaultSymbolMap<T, V>();
53    }
54
55    /* (non-Javadoc)
56     * @see de.ugoe.cs.autoquest.usageprofiles.SymbolStrategy#copySymbolMap(de.ugoe.cs.autoquest.usageprofiles.SymbolMap)
57     */
58    @Override
59    public <V> SymbolMap<T, V> copySymbolMap(SymbolMap<T, V> other) {
60        return new DefaultSymbolMap<T, V>(other);
61    }
62
63}
Note: See TracBrowser for help on using the repository browser.