Skip to content

Commit

Permalink
Refactor: Use import of class from java.util or remove superfluous qu…
Browse files Browse the repository at this point in the history
…alification (#2135)
  • Loading branch information
sgcr authored Aug 26, 2024
1 parent 1c8bd01 commit 905acb0
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 50 deletions.
5 changes: 3 additions & 2 deletions src/main/java/core/file/ExampleFileFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.io.File;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Locale;


/**
Expand Down Expand Up @@ -187,7 +188,7 @@ public final String getExtension(File f) {
final int i = filename.lastIndexOf('.');

if ((i > 0) && (i < (filename.length() - 1))) {
return filename.substring(i + 1).toLowerCase(java.util.Locale.ENGLISH);
return filename.substring(i + 1).toLowerCase(Locale.ENGLISH);
}

}
Expand Down Expand Up @@ -256,7 +257,7 @@ public final void addExtension(String extension) {
filters = new Hashtable<>(5);
}

filters.put(extension.toLowerCase(java.util.Locale.ENGLISH), this);
filters.put(extension.toLowerCase(Locale.ENGLISH), this);
fullDescription = null;
}

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/core/file/ZipHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.Locale;
import java.util.zip.ZipEntry;
import java.util.zip.ZipException;
import java.util.zip.ZipFile;
Expand Down Expand Up @@ -48,8 +49,8 @@ public static void extractFile(ZipFile zipFile, String entryName, String destDir
while (e.hasMoreElements()) {
ZipEntry entry = (ZipEntry) e.nextElement();
String fileName = destDir + File.separatorChar + entry.getName();
if (fileName.toUpperCase(java.util.Locale.ENGLISH).endsWith(
entryName.toUpperCase(java.util.Locale.ENGLISH))) {
if (fileName.toUpperCase(Locale.ENGLISH).endsWith(
entryName.toUpperCase(Locale.ENGLISH))) {
saveEntry(zipFile, entry, fileName);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/core/file/hrf/HRFStringParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Properties;

public class HRFStringParser {
Expand Down Expand Up @@ -109,7 +110,7 @@ else if (lineString.startsWith("[youthplayer")){
properties = new HOProperties();
}
properties.setProperty(lineString.substring(0, indexEqualsSign)
.toLowerCase(java.util.Locale.ENGLISH), lineString
.toLowerCase(Locale.ENGLISH), lineString
.substring(indexEqualsSign + 1));
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/core/model/series/Liga.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import core.db.AbstractTable;

import java.util.Properties;

/**
* Enthält alle Ligadaten
*/
Expand Down Expand Up @@ -33,7 +35,7 @@ public final class Liga extends AbstractTable.Storable {
/**
* Creates a new Liga object.
*/
public Liga(java.util.Properties properties) {
public Liga(Properties properties) {
m_sLiga = properties.getProperty("serie", "");

try {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/core/net/DownloadDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -164,7 +165,7 @@ private void initComponents() {
m_jchMatchArchive.setOpaque(false);
matchArchivePanel.add(m_jchMatchArchive, BorderLayout.WEST);

m_clSpinnerModel.setCalendarField(java.util.Calendar.MONTH);
m_clSpinnerModel.setCalendarField(Calendar.MONTH);
((JSpinner.DateEditor) m_jsSpinner.getEditor()).getFormat().applyPattern("dd.MM.yyyy");
matchArchivePanel.add(m_jsSpinner, BorderLayout.EAST);

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/core/net/MyConnector.java
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,10 @@ public String getMatches(int teamId, boolean forceRefresh, boolean upcoming) thr
GregorianCalendar cal = new GregorianCalendar();
cal.setTimeInMillis(System.currentTimeMillis());
if (upcoming) {
cal.add(java.util.Calendar.MONTH, 5);
cal.add(Calendar.MONTH, 5);
}
// Paranoia against inaccurate system clock.
cal.add(java.util.Calendar.DAY_OF_MONTH, 1);
cal.add(Calendar.DAY_OF_MONTH, 1);

url += "&LastMatchDate=";
url += new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/core/net/OnlineWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,7 @@ private static Properties getProperties(String data) throws IOException {
if (indexEqualsSign > 0) {
properties.setProperty(
lineString.substring(0, indexEqualsSign).toLowerCase(
java.util.Locale.ENGLISH),
Locale.ENGLISH),
lineString.substring(indexEqualsSign + 1));
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/core/option/InitOptionsDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.util.Arrays;

import javax.swing.JButton;
import javax.swing.JComboBox;
Expand Down Expand Up @@ -61,7 +62,7 @@ private void initComponents() {
final String[] sprachdateien = Translator.getSupportedLanguages();

try {
java.util.Arrays.sort(sprachdateien);
Arrays.sort(sprachdateien);
} catch (Exception e) {
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/core/option/ReleaseChannelPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.Locale;

/**
* Controls for release channel with description
Expand Down Expand Up @@ -49,7 +50,7 @@ public void itemStateChanged(ItemEvent itemEvent) {
core.model.UserParameter.temp().ReleaseChannel = ReleaseChannelLabel;
m_jta_Description.setText(
core.model.HOVerwaltung.instance().getLanguageString("options.release_channels_" +
source.getText().toUpperCase(java.util.Locale.ENGLISH) + "_desc")
source.getText().toUpperCase(Locale.ENGLISH) + "_desc")
);
rc = Updater.ReleaseChannel.byLabel(ReleaseChannelLabel);
}
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/core/rating/RatingPredictionParameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.io.InputStreamReader;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Locale;
import java.util.Properties;

public class RatingPredictionParameter {
Expand Down Expand Up @@ -45,7 +46,7 @@ public void readFromFile (String newFilename) {
String line;
Properties curProperties = null;
while((line = br.readLine()) != null) {
line = line.toLowerCase(java.util.Locale.ENGLISH);
line = line.toLowerCase(Locale.ENGLISH);
// # begins a Comment
line = line.replaceFirst ("#.*", "");
// Trim
Expand Down Expand Up @@ -102,8 +103,8 @@ public double getParam (String section, String key) {
}

public double getParam (String section, String key, double defVal) {
key = key.toLowerCase(java.util.Locale.ENGLISH);
section = section.toLowerCase(java.util.Locale.ENGLISH);
key = key.toLowerCase(Locale.ENGLISH);
section = section.toLowerCase(Locale.ENGLISH);
if (allProps.containsKey(section)) {
Properties props = allProps.get(section);
String propString = props.getProperty(key, "" + defVal);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/core/util/Helper.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.awt.*;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Arrays;
import java.util.Vector;
import javax.swing.*;

Expand Down Expand Up @@ -284,7 +285,7 @@ public static int[][] sortintArray(int[][] toSort, int spaltenindex) {
sortSpalte[i] = toSort[i][spaltenindex];
}

java.util.Arrays.sort(sortSpalte);
Arrays.sort(sortSpalte);

// scan all entries, search value in toSort and copy the value to the result
for (int i = 0; i < toSort.length; i++) {
Expand Down
66 changes: 33 additions & 33 deletions src/main/java/module/transfer/scout/PlayerConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,27 +66,27 @@ public PlayerConverter() {
try{
// Get all skills for active language
// This should be the same language as in Hattrick
skills.add(homodel.getLanguageString("ls.player.skill.value.non-existent").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.disastrous").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.wretched").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.poor").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.weak").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.inadequate").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.passable").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.solid").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.excellent").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.formidable").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.outstanding").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.brilliant").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.magnificent").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.worldclass").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.supernatural").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.titanic").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.extra-terrestrial").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.mythical").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.magical").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.utopian").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.divine").toLowerCase(java.util.Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.non-existent").toLowerCase(Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.disastrous").toLowerCase(Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.wretched").toLowerCase(Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.poor").toLowerCase(Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.weak").toLowerCase(Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.inadequate").toLowerCase(Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.passable").toLowerCase(Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.solid").toLowerCase(Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.excellent").toLowerCase(Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.formidable").toLowerCase(Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.outstanding").toLowerCase(Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.brilliant").toLowerCase(Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.magnificent").toLowerCase(Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.worldclass").toLowerCase(Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.supernatural").toLowerCase(Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.titanic").toLowerCase(Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.extra-terrestrial").toLowerCase(Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.mythical").toLowerCase(Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.magical").toLowerCase(Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.utopian").toLowerCase(Locale.ENGLISH));
skills.add(homodel.getLanguageString("ls.player.skill.value.divine").toLowerCase(Locale.ENGLISH));

for (int k = 0; k < skills.size(); k++) {
skillvalues.add(k);
Expand Down Expand Up @@ -116,17 +116,17 @@ public PlayerConverter() {
// Get all specialities for active language
// This should be the same language as in Hattrick
specialities.add(""); // No speciality
specialities.add(homodel.getLanguageString("ls.player.speciality.technical").toLowerCase(java.util.Locale.ENGLISH));
specialities.add(homodel.getLanguageString("ls.player.speciality.quick").toLowerCase(java.util.Locale.ENGLISH));
specialities.add(homodel.getLanguageString("ls.player.speciality.powerful").toLowerCase(java.util.Locale.ENGLISH));
specialities.add(homodel.getLanguageString("ls.player.speciality.unpredictable").toLowerCase(java.util.Locale.ENGLISH));
specialities.add(homodel.getLanguageString("ls.player.speciality.head").toLowerCase(java.util.Locale.ENGLISH));
specialities.add(homodel.getLanguageString("ls.player.speciality.regainer").toLowerCase(java.util.Locale.ENGLISH));
specialities.add(homodel.getLanguageString("ls.player.speciality.support").toLowerCase(java.util.Locale.ENGLISH));
specialities.add(homodel.getLanguageString("ls.player.speciality.technical").toLowerCase(Locale.ENGLISH));
specialities.add(homodel.getLanguageString("ls.player.speciality.quick").toLowerCase(Locale.ENGLISH));
specialities.add(homodel.getLanguageString("ls.player.speciality.powerful").toLowerCase(Locale.ENGLISH));
specialities.add(homodel.getLanguageString("ls.player.speciality.unpredictable").toLowerCase(Locale.ENGLISH));
specialities.add(homodel.getLanguageString("ls.player.speciality.head").toLowerCase(Locale.ENGLISH));
specialities.add(homodel.getLanguageString("ls.player.speciality.regainer").toLowerCase(Locale.ENGLISH));
specialities.add(homodel.getLanguageString("ls.player.speciality.support").toLowerCase(Locale.ENGLISH));

for (int i = 0; i<PlayerSpeciality.ITEMS.length; i++){
for (int k = 0; k < 8; k++) {
if(PlayerSpeciality.ITEMS[i].getText().toLowerCase(java.util.Locale.ENGLISH).equals(specialities.get(k))){
if(PlayerSpeciality.ITEMS[i].getText().toLowerCase(Locale.ENGLISH).equals(specialities.get(k))){
specialitiesvalues.add(PlayerSpeciality.ITEMS[i].getId());
break;
}
Expand Down Expand Up @@ -324,7 +324,7 @@ public final Player buildHTCopyButton(String text) {
sc.close();
//Analyze Player Description
row = rows.get(indexRowExperience);
sc = new Scanner(row.toLowerCase(java.util.Locale.ENGLISH));
sc = new Scanner(row.toLowerCase(Locale.ENGLISH));
Pattern pattern = Pattern.compile(" |\\.");
sc.useDelimiter(pattern);
// Experience
Expand Down Expand Up @@ -415,7 +415,7 @@ public final Player buildHTCopyButton(String text) {


// Speciality
row = rows.get(indexRowSpecialty).toLowerCase(java.util.Locale.ENGLISH);
row = rows.get(indexRowSpecialty).toLowerCase(Locale.ENGLISH);
for (int index = 1; index < specialities.size(); index++) {
if (row.contains(specialities.get(index))) {
player.setSpeciality(specialitiesvalues.get(index));
Expand Down Expand Up @@ -986,11 +986,11 @@ public final Player buildClassicPage(String text) {

char[] cs = new char[teamname.length()];
Arrays.fill(cs, '*');
mytext = mytext.replaceAll(Pattern.quote(teamname), new String(cs)).toLowerCase(java.util.Locale.ENGLISH);
mytext = mytext.replaceAll(Pattern.quote(teamname), new String(cs)).toLowerCase(Locale.ENGLISH);

cs = new char[name.length()];
Arrays.fill(cs, '*');
mytext = mytext.replaceAll(Pattern.quote(name.toLowerCase(java.util.Locale.ENGLISH)), new String(cs)).toLowerCase(java.util.Locale.ENGLISH);
mytext = mytext.replaceAll(Pattern.quote(name.toLowerCase(Locale.ENGLISH)), new String(cs)).toLowerCase(Locale.ENGLISH);

// We can search all the skills in text now
p = skills.size() - 1;
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/tool/arenasizer/Stadium.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import core.db.AbstractTable;
import org.apache.commons.lang3.math.NumberUtils;

import java.util.Properties;

/**
* Enthält die Stadiendaten
*/
Expand Down Expand Up @@ -57,7 +59,7 @@ public Stadium() {
/**
* Creates a new Stadium object.
*/
public Stadium(java.util.Properties properties) {
public Stadium(Properties properties) {
m_sStadienname = properties.getProperty("arenaname", "");
m_iStadiumId = NumberUtils.toInt(properties.getProperty("arenaid"),0);
//m_iGesamtgroesse = NumberUtils.toInt(properties.getProperty("seattotal"),0);
Expand Down

0 comments on commit 905acb0

Please sign in to comment.