• 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

0.0
/drivers/mapper/src/main/java/de/learnlib/mapper/ContextExecutableInputSUL.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.mapper;
17

18
import de.learnlib.api.SUL;
19
import de.learnlib.mapper.api.ContextExecutableInput;
20

21
/**
22
 * A {@link SUL} that executes {@link ContextExecutableInput} symbols.
23
 * <p>
24
 * The creation and disposal of contexts is delegated to an external {@link ContextHandler}.
25
 *
26
 * @param <I>
27
 *         input symbol type
28
 * @param <O>
29
 *         output symbol type
30
 * @param <C>
31
 *         context type
32
 */
33
public class ContextExecutableInputSUL<I extends ContextExecutableInput<? extends O, ? super C>, O, C>
34
        extends AbstractContextExecutableInputSUL<I, O, C> {
35

36
    private final ContextHandler<C> contextHandler;
37

38
    public ContextExecutableInputSUL(ContextHandler<C> contextHandler) {
×
39
        this.contextHandler = contextHandler;
×
40
    }
×
41

42
    @Override
43
    protected C createContext() {
44
        return contextHandler.createContext();
×
45
    }
46

47
    @Override
48
    protected void disposeContext(C context) {
49
        contextHandler.disposeContext(context);
×
50
    }
×
51

52
    @Override
53
    public boolean canFork() {
54
        return true;
×
55
    }
56

57
    @Override
58
    public SUL<I, O> fork() {
59
        return new ContextExecutableInputSUL<>(contextHandler);
×
60
    }
61

62
    /**
63
     * Facility for creating and disposing of contexts on which {@link ContextExecutableInput}s operate.
64
     * <p>
65
     * An implementation of this interface must be thread-safe, i.e., both the {@link #createContext()} and {@link
66
     * #disposeContext(Object)} methods must be reentrant. Furthermore, it must not make any assumptions as to the
67
     * particular sequence in which these methods are called.
68
     *
69
     * @param <C>
70
     *         context type
71
     */
72
    public interface ContextHandler<C> {
73

74
        C createContext();
75

76
        void disposeContext(C context);
77
    }
78
}
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