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

LearnLib / automatalib / 13815628111

12 Mar 2025 03:46PM CUT coverage: 92.058% (-0.001%) from 92.059%
13815628111

push

github

mtf90
cleanup redundant type variable definitions

1 of 1 new or added line in 1 file covered. (100.0%)

16599 of 18031 relevant lines covered (92.06%)

1.7 hits per line

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

0.0
/commons/util/src/main/java/net/automatalib/common/util/mapping/Mapping.java
1
/* Copyright (C) 2013-2025 TU Dortmund University
2
 * This file is part of AutomataLib <https://automatalib.net>.
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 net.automatalib.common.util.mapping;
17

18
import java.util.Map;
19
import java.util.function.Function;
20

21
/**
22
 * An interface for mapping objects of a certain domain type to objects of a certain range type.
23
 * <p>
24
 * A mapping is very much like a {@link Map}, but the perspective is a different one: Whereas a map is a (particularly
25
 * finite) key/value collection, a mapping is more like a function: it does not support retrieval of all keys or values,
26
 * because it does not require them to be stored at all. Instead, they can be calculated on the fly upon an invocation
27
 * of {@link #get(Object)}.
28
 *
29
 * @param <D>
30
 *         domain type.
31
 * @param <R>
32
 *         range type.
33
 */
34
@FunctionalInterface
35
public interface Mapping<D, R> extends Function<D, R> {
36

37
    @Override
38
    default R apply(D elem) {
39
        return get(elem);
×
40
    }
41

42
    /**
43
     * Get the range object {@code elem} maps to. Implementations may decide how to deal with unmapped values (default
44
     * values, exceptions, etc.)
45
     *
46
     * @param elem
47
     *         object from the domain.
48
     *
49
     * @return the object from the range corresponding to {@code elem}.
50
     */
51
    R get(D elem);
52
}
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