Skip to content

Commit

Permalink
chore: #101 Remove kefir's StringUtils.concat usage from kgparser-srv…
Browse files Browse the repository at this point in the history
… module.
  • Loading branch information
dmitry-weirdo committed Nov 22, 2024
1 parent b22af04 commit 7f4a4df
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public static int getDictionaryId(String code) {
*/
@Json(exclude = true)
public static String getDictionaryCode(int dictionaryId) {
return StringUtils.concat( NON_STANDARD_DICTIONARY_ID_PREFIX, Integer.toString(dictionaryId) );
return NON_STANDARD_DICTIONARY_ID_PREFIX + dictionaryId;
}

@Json(exclude = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

import java.util.Date;

import static su.opencode.kefir.util.StringUtils.concat;

/**
* Результат игрока в конкретном заезде.
*/
Expand Down Expand Up @@ -39,13 +37,13 @@ public Integer getPlace() {
return null;

if (place < FIRST_PLACE)
throw new IllegalArgumentException( concat("Incorrect place: ", place) );
throw new IllegalArgumentException( String.format("Incorrect place: %d.", place) );

return place;
}
public void setPlace(Integer place) {
if (place < FIRST_PLACE)
throw new IllegalArgumentException( concat("Incorrect place: ", place) );
throw new IllegalArgumentException( String.format("Incorrect place: %d.", place) );

this.place = place;
}
Expand All @@ -69,7 +67,7 @@ public Integer getSpeed() {
}
public void setSpeed(Integer speed) {
if (speed <= 0)
throw new IllegalArgumentException( concat("Incorrect speed: ", speed) );
throw new IllegalArgumentException( String.format("Incorrect speed: %d.", speed) );

this.speed = speed;
}
Expand All @@ -79,7 +77,7 @@ public Integer getCharsTotal() {
}
public void setCharsTotal(Integer charsTotal) {
if (charsTotal <= 0)
throw new IllegalArgumentException( concat("Incorrect charsTotal: ", charsTotal) );
throw new IllegalArgumentException( String.format("Incorrect charsTotal: %d.", charsTotal) );

this.charsTotal = charsTotal;
}
Expand All @@ -89,7 +87,7 @@ public Integer getErrorsCount() {
}
public void setErrorsCount(Integer errorsCount) {
if (errorsCount < 0)
throw new IllegalArgumentException( concat("Incorrect errorsCount: ", errorsCount) );
throw new IllegalArgumentException( String.format("Incorrect errorsCount: %d.", errorsCount) );

this.errorsCount = errorsCount;
}
Expand All @@ -99,7 +97,7 @@ public Double getErrorPercentage() {
}
public void setErrorPercentage(Double errorPercentage) {
if (errorPercentage < 0)
throw new IllegalArgumentException( concat("Incorrect errorPercentage: ", errorPercentage) );
throw new IllegalArgumentException( String.format("Incorrect errorPercentage: %s.", errorPercentage) );

this.errorPercentage = errorPercentage;
}
Expand All @@ -116,7 +114,7 @@ public Float getTime() {
}
public void setTime(Float time) {
if (time < 0)
throw new IllegalArgumentException( concat("Incorrect time: ", time) );
throw new IllegalArgumentException( String.format("Incorrect time: %s.", time) );

this.time = time;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import java.util.Comparator;

import static su.opencode.kefir.util.StringUtils.concat;

/**
* Copyright 2014 <a href="mailto:[email protected]">Dmitriy Popov</a>.
* $HeadURL$
Expand All @@ -24,11 +22,11 @@ public int compare(PlayerRoundResult o1, PlayerRoundResult o2) {

// check place1 validity
if ( (place1 != null) && (!PlayerRoundResult.isCorrectPlace(place1)) )
throw new IllegalArgumentException( concat("Incorrect player1 place: ", place1) );
throw new IllegalArgumentException( String.format("Incorrect player1 place: %d.", place1) );

// check place2 validity
if ( (place2 != null) && (!PlayerRoundResult.isCorrectPlace(place2)) )
throw new IllegalArgumentException( concat("Incorrect player2 place: ", place2) );
throw new IllegalArgumentException( String.format("Incorrect player2 place: %d.", place2) );

if ( (place1 == null) && (place2 == null) )
return 0; // undefined order
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import java.nio.charset.StandardCharsets;

import static su.opencode.kefir.util.StringUtils.concat;

/**
* Copyright 2014 <a href="mailto:[email protected]">Dmitriy Popov</a>.
* $HeadURL$
Expand All @@ -16,7 +14,7 @@
public class ConfigurationLoader
{
public String readConfigurationFile(String filePath) {
String path = concat( System.getProperty("jboss.server.home.dir"), "/conf/", filePath);
String path = System.getProperty("jboss.server.home.dir") + "/conf/" + filePath;
byte[] bytes = FileUtils.readFile(path);
return new String(bytes, StandardCharsets.UTF_8);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import ru.klavogonki.kgparser.Competition;
import ru.klavogonki.kgparser.Player;
import ru.klavogonki.kgparser.PlayerRoundResult;
import ru.klavogonki.kgparser.Rank;
import ru.klavogonki.kgparser.Round;
import su.opencode.kefir.srv.json.JsonObject;
import su.opencode.kefir.util.StringUtils;
Expand All @@ -14,8 +13,6 @@
import java.util.List;
import java.util.Set;

import static su.opencode.kefir.util.StringUtils.concat;

/**
* Результирующая таблица игроков.
* Присутствуют все {@linkplain ru.klavogonki.kgparser.Player игроки},
Expand All @@ -41,7 +38,7 @@ private void fillHeaderRows(Competition competition) {
// rounds data
for (Round round : competition.getRounds())
{
firstRow.addCell( concat(sb, "Заезд № ", round.getNumber()), 3 );
firstRow.addCell( String.format("Заезд № %d", round.getNumber()), 3 );
}

// total
Expand Down

0 comments on commit 7f4a4df

Please sign in to comment.