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

LearnLib / learnlib / 13181815301

06 Feb 2025 03:00PM CUT coverage: 94.368%. Remained the same
13181815301

push

github

mtf90
[maven-release-plugin] prepare for next development iteration

12484 of 13229 relevant lines covered (94.37%)

1.72 hits per line

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

0.0
/oracles/membership-oracles/src/main/java/de/learnlib/oracle/membership/MappedOracle.java
1
/* Copyright (C) 2013-2025 TU Dortmund University
2
 * This file is part of LearnLib <https://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.oracle.membership;
17

18
import de.learnlib.Mapper.AsynchronousMapper;
19
import de.learnlib.oracle.QueryAnswerer;
20
import de.learnlib.oracle.SingleQueryOracle;
21
import net.automatalib.word.Word;
22

23
/**
24
 * A utility class that allows to lift a membership oracle of concrete input/output symbols to a membership oracle of
25
 * abstract input/output symbols, given a corresponding mapper.
26
 *
27
 * @param <AI>
28
 *         abstract input symbol type.
29
 * @param <AO>
30
 *         abstract output symbol type.
31
 * @param <CI>
32
 *         concrete input symbol type.
33
 * @param <CO>
34
 *         concrete output symbol type.
35
 */
36
public class MappedOracle<AI, AO, CI, CO> implements SingleQueryOracle<AI, AO> {
37

38
    private final QueryAnswerer<CI, CO> delegate;
39

40
    private final AsynchronousMapper<AI, AO, CI, CO> mapper;
41

42
    public MappedOracle(QueryAnswerer<CI, CO> delegate, AsynchronousMapper<AI, AO, CI, CO> mapper) {
×
43
        this.delegate = delegate;
×
44
        this.mapper = mapper;
×
45
    }
×
46

47
    @Override
48
    public AO answerQuery(Word<AI> prefix, Word<AI> suffix) {
49
        mapper.pre();
×
50

51
        final CO output = delegate.answerQuery(prefix.transform(mapper::mapInput), suffix.transform(mapper::mapInput));
×
52
        final AO result = mapper.mapOutput(output);
×
53

54
        mapper.post();
×
55

56
        return result;
×
57
    }
58
}
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