Replaced dynamic regular expressions with compiled pattern
This commit is contained in:
@@ -54,6 +54,7 @@ import appeng.core.localization.ButtonToolTips;
|
||||
public class GuiImgButton extends GuiButton implements ITooltip
|
||||
{
|
||||
private static final Pattern COMPILE = Pattern.compile( "%s" );
|
||||
private static final Pattern PATTERN_NEW_LINE = Pattern.compile( "\\n", Pattern.LITERAL );
|
||||
private static Map<EnumPair, ButtonAppearance> appearances;
|
||||
private final Enum buttonSetting;
|
||||
public boolean halfSize = false;
|
||||
@@ -281,7 +282,7 @@ public class GuiImgButton extends GuiButton implements ITooltip
|
||||
if ( this.fillVar != null )
|
||||
value = COMPILE.matcher( value ).replaceFirst( this.fillVar );
|
||||
|
||||
value = value.replace( "\\n", "\n" );
|
||||
value = PATTERN_NEW_LINE.matcher( value ).replaceAll( "\n" );
|
||||
StringBuilder sb = new StringBuilder( value );
|
||||
|
||||
int i = sb.lastIndexOf( "\n" );
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
package appeng.client.gui.widgets;
|
||||
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -30,6 +32,7 @@ import appeng.client.texture.ExtraBlockTextures;
|
||||
|
||||
public class GuiToggleButton extends GuiButton implements ITooltip
|
||||
{
|
||||
private static final Pattern PATTERN_NEW_LINE = Pattern.compile( "\\n", Pattern.LITERAL );
|
||||
private final int iconIdxOn;
|
||||
private final int iconIdxOff;
|
||||
|
||||
@@ -94,7 +97,7 @@ public class GuiToggleButton extends GuiButton implements ITooltip
|
||||
if ( value == null || value.isEmpty() )
|
||||
value = this.displayHint;
|
||||
|
||||
value = value.replace( "\\n", "\n" );
|
||||
value = PATTERN_NEW_LINE.matcher( value ).replaceAll( "\n" );
|
||||
StringBuilder sb = new StringBuilder( value );
|
||||
|
||||
int i = sb.lastIndexOf( "\n" );
|
||||
|
||||
Reference in New Issue
Block a user