• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LearnLib / learnlib / 6433387082

06 Oct 2023 03:10PM UTC coverage: 92.296% (-0.007%) from 92.303%
6433387082

push

github

mtf90
update Falk's developer id

11573 of 12539 relevant lines covered (92.3%)

1.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/oracles/filters/statistics/src/main/java/de/learnlib/filter/statistic/oracle/HistogramOracle.java
1
/* Copyright (C) 2013-2023 TU Dortmund
2
 * This file is part of LearnLib, http://www.learnlib.de/.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package de.learnlib.filter.statistic.oracle;
17

18
import java.util.Collection;
19

20
import de.learnlib.api.oracle.MembershipOracle;
21
import de.learnlib.api.query.Query;
22
import de.learnlib.api.statistic.StatisticOracle;
23
import de.learnlib.filter.statistic.HistogramDataSet;
24

25
/**
26
 * Collects a histogram of passed query lengths.
27
 *
28
 * @param <I>
29
 *         input symbol class
30
 * @param <D>
31
 *         output symbol class
32
 */
33
public class HistogramOracle<I, D> implements StatisticOracle<I, D> {
34

35
    /**
36
     * dataset to be collected.
37
     */
38
    private final HistogramDataSet dataSet;
39

40
    /**
41
     * oracle used to answer queries.
42
     */
43
    private MembershipOracle<I, D> nextOracle;
44

45
    /**
46
     * @param next
47
     *         real oracle
48
     * @param name
49
     *         name of the collected data set
50
     */
51
    public HistogramOracle(MembershipOracle<I, D> next, String name) {
2✔
52
        this.nextOracle = next;
2✔
53
        this.dataSet = new HistogramDataSet(name, "query length");
2✔
54
    }
2✔
55

56
    @Override
57
    public final void processQueries(Collection<? extends Query<I, D>> queries) {
58
        for (Query<I, D> q : queries) {
2✔
59
            this.dataSet.addDataPoint((long) q.getInput().size());
2✔
60
        }
2✔
61
        nextOracle.processQueries(queries);
2✔
62
    }
2✔
63

64
    /**
65
     * @return the data set collected by this oracle.
66
     */
67
    @Override
68
    public final HistogramDataSet getStatisticalData() {
69
        return this.dataSet;
2✔
70
    }
71

72
    /**
73
     * set used oracle.
74
     *
75
     * @param next
76
     *         oracle to be used
77
     */
78
    @Override
79
    public final void setNext(MembershipOracle<I, D> next) {
80
        this.nextOracle = next;
×
81
    }
×
82
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc