@Test void testEmptyMapping() { String uri = "doc.cbl"; List<Token> tokens = List.of(); List<Locality> localities = List.of(); Map<Integer, Integer> shifts = Map.of(); Map<String, DocumentMapping> mappings = Map.of(uri, new DocumentMapping(localities, shifts)); Map<Token, Locality> positionMapping = LocalityMappingUtils.createPositionMapping(tokens, mappings, uri); assertTrue(positionMapping.isEmpty()); }
public Map<Token, Locality> createPositionMapping( List<Token> tokens, Map<String, DocumentMapping> documentPositions, String documentUri) { Map<Token, Locality> result = new HashMap<>(); Deque<DocumentHierarchyLevel> documentHierarchyStack = new ArrayDeque<>(); enterDocument(documentUri, documentPositions, documentHierarchyStack); tokens.forEach(mapToken(documentPositions, result, documentHierarchyStack)); return result; }
LocalityMappingUtils { public Map<Token, Locality> createPositionMapping( List<Token> tokens, Map<String, DocumentMapping> documentPositions, String documentUri) { Map<Token, Locality> result = new HashMap<>(); Deque<DocumentHierarchyLevel> documentHierarchyStack = new ArrayDeque<>(); enterDocument(documentUri, documentPositions, documentHierarchyStack); tokens.forEach(mapToken(documentPositions, result, documentHierarchyStack)); return result; } }
LocalityMappingUtils { public Map<Token, Locality> createPositionMapping( List<Token> tokens, Map<String, DocumentMapping> documentPositions, String documentUri) { Map<Token, Locality> result = new HashMap<>(); Deque<DocumentHierarchyLevel> documentHierarchyStack = new ArrayDeque<>(); enterDocument(documentUri, documentPositions, documentHierarchyStack); tokens.forEach(mapToken(documentPositions, result, documentHierarchyStack)); return result; }  }
LocalityMappingUtils { public Map<Token, Locality> createPositionMapping( List<Token> tokens, Map<String, DocumentMapping> documentPositions, String documentUri) { Map<Token, Locality> result = new HashMap<>(); Deque<DocumentHierarchyLevel> documentHierarchyStack = new ArrayDeque<>(); enterDocument(documentUri, documentPositions, documentHierarchyStack); tokens.forEach(mapToken(documentPositions, result, documentHierarchyStack)); return result; }  Map<Token, Locality> createPositionMapping(
      List<Token> tokens, Map<String, DocumentMapping> documentPositions, String documentUri); }
LocalityMappingUtils { public Map<Token, Locality> createPositionMapping( List<Token> tokens, Map<String, DocumentMapping> documentPositions, String documentUri) { Map<Token, Locality> result = new HashMap<>(); Deque<DocumentHierarchyLevel> documentHierarchyStack = new ArrayDeque<>(); enterDocument(documentUri, documentPositions, documentHierarchyStack); tokens.forEach(mapToken(documentPositions, result, documentHierarchyStack)); return result; }  Map<Token, Locality> createPositionMapping(
      List<Token> tokens, Map<String, DocumentMapping> documentPositions, String documentUri);  }