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

CyclopsMC / IntegratedDynamics / 20210191346

14 Dec 2025 03:32PM UTC coverage: 19.514% (-33.5%) from 53.061%
20210191346

push

github

rubensworks
Remove deprecations

663 of 8728 branches covered (7.6%)

Branch coverage included in aggregate %.

6786 of 29445 relevant lines covered (23.05%)

1.09 hits per line

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

0.0
/src/main/java/org/cyclops/integrateddynamics/api/network/IPositionedAddonsNetwork.java
1
package org.cyclops.integrateddynamics.api.network;
2

3
import com.google.common.collect.Iterables;
4
import org.cyclops.integrateddynamics.api.part.PartPos;
5
import org.cyclops.integrateddynamics.api.part.PrioritizedPartPos;
6

7
import javax.annotation.Nullable;
8
import java.util.Collection;
9
import java.util.stream.Collectors;
10

11
/**
12
 * A network that can hold prioritized positions.
13
 * @author rubensworks
14
 */
15
public interface IPositionedAddonsNetwork {
16

17
    /**
18
     * The channel that should be used for anything that doesn't allow the player to select a channel.
19
     */
20
    public static final int DEFAULT_CHANNEL = 0;
21

22
    /**
23
     * Specifying this channel will allow interaction with all channels.
24
     */
25
    public static final int WILDCARD_CHANNEL = -1;
26

27
    /**
28
     * Whether two parts on the given channels may interact.
29
     * @param first The id of the first channel.
30
     * @param second The id of the second channel.
31
     * @return If the two channels match.
32
     */
33
    public static boolean channelsMatch(int first, int second) {
34
        return first == second || first == WILDCARD_CHANNEL || second == WILDCARD_CHANNEL;
×
35
    }
36

37
    /**
38
     * @return The channels that have at least one active position.
39
     */
40
    public int[] getChannels();
41

42
    /**
43
     * @return If any positioned addons are present in this network.
44
     */
45
    public boolean hasPositions();
46

47
    /**
48
     * @param channel The channel id.
49
     * @return The stored positions, sorted by priority.
50
     */
51
    public Collection<PrioritizedPartPos> getPrioritizedPositions(int channel);
52

53
    /**
54
     * Get the channel this position is present in.
55
     * -1 if it is not present in any channel.
56
     * @param pos A position.
57
     * @return A channel.
58
     */
59
    public int getPositionChannel(PartPos pos);
60

61
    /**
62
     * @param channel The channel id.
63
     * @return The stored positions, sorted by priority.
64
     */
65
    public default Collection<PartPos> getPositions(int channel) {
66
        return getPrioritizedPositions(channel).stream().map(PrioritizedPartPos::getPartPos).collect(Collectors.toList());
×
67
    }
68

69
    /**
70
     * @return All stored positions, order is undefined.
71
     */
72
    public Collection<PrioritizedPartPos> getPrioritizedPositions();
73

74
    /**
75
     * @return All stored positions, order is undefined.
76
     */
77
    public default Iterable<PartPos> getPositions() {
78
        return Iterables.transform(getPrioritizedPositions(), PrioritizedPartPos::getPartPos);
×
79
    }
80

81
    /**
82
     * @return The part positions iterator handler for this network.
83
     */
84
    @Nullable
85
    public IPartPosIteratorHandler getPartPosIteratorHandler();
86

87
    /**
88
     * Set a part positions iterator handler for this network.
89
     * @param iteratorHandler An iterator handler or null if it should be reset.
90
     */
91
    public void setPartPosIteratorHandler(@Nullable IPartPosIteratorHandler iteratorHandler);
92

93
    /**
94
     * Add the given position.
95
     * @param pos The position.
96
     * @param priority The priority.
97
     * @param channel The channel id.
98
     * @return If the position was added, otherwise it was already present.
99
     */
100
    public boolean addPosition(PartPos pos, int priority, int channel);
101

102
    /**
103
     * Remove the given position.
104
     * @param pos The position.
105
     */
106
    public void removePosition(PartPos pos);
107

108
    /**
109
     * Check if the given position is disabled.
110
     * @param pos The position.
111
     * @return If it is disabled.
112
     */
113
    public boolean isPositionDisabled(PartPos pos);
114

115
    /**
116
     * Disable a position.
117
     * @param pos The position.
118
     */
119
    public void disablePosition(PartPos pos);
120

121
    /**
122
     * Enable a position.
123
     * @param pos The position.
124
     */
125
    public void enablePosition(PartPos pos);
126

127
}
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

© 2026 Coveralls, Inc