Skip to content

Commit

Permalink
Merge remote-tracking branch 'hiroscho/feature/sort-interfaces-alphan…
Browse files Browse the repository at this point in the history
…um-order' into dev
  • Loading branch information
Dream-Master committed Aug 31, 2024
2 parents b02f7e9 + f7ca1eb commit 8da27f9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/main/java/appeng/api/config/StringOrder.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public enum StringOrder {

NATURAL(Comparator.naturalOrder()),

ALPHANUM(new AlphanumComparator());
ALPHANUM(AlphanumComparator.INSTANCE);

public final Comparator<String> comparator;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/appeng/client/gui/widgets/GuiImgButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ public GuiImgButton(final int x, final int y, final Enum idx, final Enum val) {
ButtonToolTips.StringOrder,
ButtonToolTips.StringOrderNatural);
this.registerApp(
65,
16,
Settings.INTERFACE_TERMINAL_SECTION_ORDER,
StringOrder.ALPHANUM,
ButtonToolTips.StringOrder,
Expand Down
17 changes: 4 additions & 13 deletions src/main/java/appeng/util/AlphanumComparator.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package appeng.util;
// This code is copied from the library https://github.com/metamx/alphanum
// spotless:off
/*
* The Alphanum Algorithm is an improved sorting algorithm for strings
Expand Down Expand Up @@ -27,23 +28,13 @@

import java.util.Comparator;

// spotless:off
/**
* This is an updated version with enhancements made by Daniel Migowski,
* Andre Bogus, and David Koelle
* <p/>
* To convert to use Templates (Java 1.5+):
* - Change "implements Comparator" to "implements Comparator<String>"
* - Change "compare(Object o1, Object o2)" to "compare(String s1, String s2)"
* - Remove the type checking and casting in compare().
* <p/>
* To use this class:
* Use the static "sort" method from the java.util.Collections class:
* Collections.sort(your list, new AlphanumComparator());
* This is an updated version with enhancements made by Daniel Migowski, Andre Bogus, and David Koelle
*/
// spotless:on
public class AlphanumComparator implements Comparator<String> {

public final static AlphanumComparator INSTANCE = new AlphanumComparator();

private final boolean isDigit(char ch) {
return ch >= 48 && ch <= 57;
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/assets/appliedenergistics2/lang/zh_CN.lang
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,10 @@ gui.tooltips.appliedenergistics2.MultiplyOrDividePatternHint=如果是正数,就
gui.tooltips.appliedenergistics2.ToFollow=当前并未订阅该合成的消息\n当该合成完成时将不会接收到消息提示\n点击即可订阅
gui.tooltips.appliedenergistics2.ToUnfollow=当前已经订阅该合成的消息\n当该合成完成时将会接收到消息提示\n点击即可取消

gui.tooltips.appliedenergistics2.StringOrder=排序方式
gui.tooltips.appliedenergistics2.StringOrderNatural=默认排序
gui.tooltips.appliedenergistics2.StringOrderAlphanum=自然数序

# Units
gui.appliedenergistics2.units.appliedenergstics=AE
gui.appliedenergistics2.units.ic2=EU
Expand Down

0 comments on commit 8da27f9

Please sign in to comment.