source: trunk/autoquest-plugin-usability2/src/main/java/de/ugoe/cs/autoquest/plugin/usability2/rules/results/SingleMatchResult.java @ 1326

Last change on this file since 1326 was 1326, checked in by khartmann, 10 years ago

Moved alexanders code into a new plugin project.
First commit of my experimental code (needs a lot of cleanup).

File size: 1.7 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.plugin.usability2.rules.results;
16
17import java.util.Iterator;
18
19/**
20 * <p>
21 * TODO comment
22 * </p>
23 *
24 * @author Konni Hartmann
25 */
26public class SingleMatchResult extends AbstractResult {
27
28    final IMatch match;
29   
30    public SingleMatchResult(IMatch task) {
31        super(true);
32        this.match = task;
33    }
34
35    /* (non-Javadoc)
36     * @see java.lang.Iterable#iterator()
37     */
38    @Override
39    public Iterator<IMatch> iterator() {
40        return new Iterator<IMatch>() {
41            boolean first = true;
42           
43            @Override
44            public void remove() {
45                throw new UnsupportedOperationException();
46            }
47           
48            @Override
49            public IMatch next() {
50                return match;
51            }
52           
53            @Override
54            public boolean hasNext() {
55                if(first) {
56                    first = false;
57                    return true;
58                }
59
60                return false;
61            }
62        };
63    }
64
65}
Note: See TracBrowser for help on using the repository browser.