Skip to content

Commit

Permalink
Create a tree map from lowercase built-in function name to ID number
Browse files Browse the repository at this point in the history
- BuiltinUsage#summaryText(String) doesn't require F.await() anymore,
which leads to performance issue in Android UI thread.
  • Loading branch information
axkr committed Sep 30, 2023
1 parent a3fbf5d commit a136716
Show file tree
Hide file tree
Showing 3 changed files with 453 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.concurrent.atomic.AtomicBoolean;
import org.matheclipse.core.interfaces.IBuiltInSymbol;
import org.matheclipse.core.interfaces.ISymbol;

public class BuiltinUsage {
private static final String[] USAGE = new String[ID.Zeta + 10];
Expand Down Expand Up @@ -607,12 +606,9 @@ public static synchronized void init() {
}

public static String summaryText(String symbolStr) {
if (!IS_INITIALIZED.get()) {
init();
}
ISymbol symbol = F.symbol(symbolStr);
if (symbol.isBuiltInSymbol()) {
String str = USAGE[symbol.ordinal()];
Integer ordinalId = ID.STRING_TO_ID_MAP.get(symbolStr);
if (ordinalId != null) {
String str = USAGE[ordinalId];
return str != null ? str : "";
}
return "";
Expand Down
Loading

0 comments on commit a136716

Please sign in to comment.