1
0
mirror of https://github.com/DanilaFe/abacus synced 2026-01-01 13:25:19 +00:00

Switch all uses of *List, *Map to just List and Map.

This commit is contained in:
2017-07-27 18:19:12 -07:00
parent f119f19c04
commit 2cc4bd14ce
8 changed files with 27 additions and 22 deletions

View File

@@ -54,7 +54,7 @@ public class Lexer<T> {
/**
* The registered patterns.
*/
private HashMap<PatternEntry<T>, Pattern<T>> patterns;
private Map<PatternEntry<T>, Pattern<T>> patterns;
/**
* Creates a new lexer with no registered patterns.
@@ -127,7 +127,7 @@ public class Lexer<T> {
* @param compare the comparator used to sort matches by their IDs.
* @return the resulting list of matches, in order, or null on error.
*/
public ArrayList<Match<T>> lexAll(String from, int startAt, Comparator<T> compare){
public List<Match<T>> lexAll(String from, int startAt, Comparator<T> compare){
int index = startAt;
ArrayList<Match<T>> matches = new ArrayList<>();
Match<T> lastMatch = null;

View File

@@ -2,6 +2,7 @@ package org.nwapw.abacus.lexing.pattern;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Stack;
import java.util.function.Function;
@@ -32,7 +33,7 @@ public class Pattern<T> {
* A map of regex operator to functions that modify a PatternChain
* with the appropriate operation.
*/
private HashMap<Character, Function<PatternChain<T>, PatternChain<T>>> operations =
private Map<Character, Function<PatternChain<T>, PatternChain<T>>> operations =
new HashMap<Character, Function<PatternChain<T>, PatternChain<T>>>() {{
put('+', Pattern.this::transformPlus);
put('*', Pattern.this::transformStar);

View File

@@ -3,6 +3,7 @@ package org.nwapw.abacus.lexing.pattern;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
/**
* A base class for a pattern node. Provides all functions
@@ -16,7 +17,7 @@ public class PatternNode<T> {
* The set of states to which the lexer should continue
* should this node be correctly matched.
*/
protected HashSet<PatternNode<T>> outputStates;
protected Set<PatternNode<T>> outputStates;
/**
* Creates a new pattern node.