MCPcopy Create free account
hub / github.com/Frontrooms/3.0-GC / SparseSet

Method SparseSet

src/main/java/emu/grasscutter/utils/SparseSet.java:33–50  ·  view source on GitHub ↗
(String csv)

Source from the content-addressed store, hash-verified

31 private final Set<Integer> denseEntries;
32
33 public SparseSet(String csv) {
34 this.rangeEntries = new ArrayList<>();
35 this.denseEntries = new TreeSet<>();
36
37 for (String token : csv.replace("\n", "").replace(" ", "").split(",")) {
38 String[] tokens = token.split("-");
39 switch (tokens.length) {
40 case 1:
41 this.denseEntries.add(Integer.parseInt(tokens[0]));
42 break;
43 case 2:
44 this.rangeEntries.add(new Range(Integer.parseInt(tokens[0]), Integer.parseInt(tokens[1])));
45 break;
46 default:
47 throw new IllegalArgumentException("Invalid token passed to SparseSet initializer - " + token + " (split length " + Integer.toString(tokens.length) + ")");
48 }
49 }
50 }
51
52 public boolean contains(int i) {
53 for (Range range : this.rangeEntries) {

Callers

nothing calls this directly

Calls 2

addMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected