Skip to content

Commit

Permalink
style: improve a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Dec 15, 2024
1 parent 7c22853 commit c2dcb82
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/io/github/the_flx/flx_java/Flx.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ private static void incVec(LinkedList<Integer> vec, Integer inc, Integer beg, In
* Return hash-table for string where keys are characters.
* Value is a sorted list of indexes for character occurrences.
*/
private static void getHashForString(HashMap<Integer, LinkedList<Integer>> result, String str) {
result.clear();
private static HashMap<Integer, LinkedList<Integer>> getHashForString(String str) {
HashMap<Integer, LinkedList<Integer>> result = new HashMap();

int strLen = str.length();
int index = strLen - 1;
Expand All @@ -96,6 +96,8 @@ private static void getHashForString(HashMap<Integer, LinkedList<Integer>> resul

--index;
}

return result;
}

/**
Expand Down Expand Up @@ -266,8 +268,7 @@ public static void findBestMatch(LinkedList<Result> imatch,
Integer hashKey = qIndex + (greaterNum * queryLength);
LinkedList<Result> hashValue = Util.dictGet(matchCache, hashKey);

if (hashValue != null) // Process matchCache here
{
if (hashValue != null) { // Process matchCache here
imatch.clear();
imatch.addAll(hashValue);
} else {
Expand Down Expand Up @@ -340,8 +341,7 @@ public static Result score(String str, String query) {
if (str.isEmpty() || query.isEmpty())
return null;

var strInfo = new HashMap<Integer, LinkedList<Integer>>();
getHashForString(strInfo, str);
HashMap<Integer, LinkedList<Integer>> strInfo = getHashForString(str);

var heatmap = new LinkedList<Integer>();
getHeatmapStr(heatmap, str, null);
Expand Down

0 comments on commit c2dcb82

Please sign in to comment.