Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kuronekochomusuke committed Nov 11, 2024
1 parent cf84c96 commit b4aba7e
Showing 1 changed file with 1 addition and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class BoardTableModel extends AbstractTableModel {

private List<String> data;
private List<String> tags;
private List<String> size;
private List<Integer> width;
private List<Integer> height;

Expand All @@ -59,7 +58,6 @@ public int getRowCount() {
public void clearData() {
data = new ArrayList<>();
tags = new ArrayList<>();
size = new ArrayList<>();
width = new ArrayList<>();
height = new ArrayList<>();
fireTableDataChanged();
Expand All @@ -81,14 +79,12 @@ public int getPreferredWidth(int col) {
public void setData(BoardClassifier bc) {
data = bc.getBoardPaths().values().stream().toList();;
tags = new ArrayList<>();
size = new ArrayList<>();
width = new ArrayList<>();
height = new ArrayList<>();

for (String path : data) {
String key = Configuration.boardsDir() + path;
tags.add(bc.getBoardTags().get(key));
size.add(bc.getBoardWidth().get(key) + "x" + bc.getBoardHeigth().get(key));
width.add(bc.getBoardWidth().get(key));
height.add(bc.getBoardHeigth().get(key));
}
Expand Down Expand Up @@ -121,20 +117,18 @@ public boolean isCellEditable(int row, int col) {
@Override
public Object getValueAt(int row, int col) {
String path = getPathAt(row);
String size = getSizeAt(row);
Integer width = getWidthAt(row);
Integer height = getHeightAt(row);

if (path== null) {
return "?";
}

String value = "";

if (col == COL_NAME) {
value = path.substring(path.lastIndexOf("\\") + 1, path.length());
value = value.substring(0, value.lastIndexOf(".board"));
value = value.replace(size, "").trim();
value = value.replace(width + "x" + height, "").trim();
} else if (col == COL_SIZE) {
value = String.format("%03dx%03d", width, height);
}
Expand All @@ -150,14 +144,6 @@ public String getPathAt(int row) {
return data.get(row);
}

public String getSizeAt(int row) {
if (size.size() <= row) {
return null;
}

return size.get(row);
}

public Integer getWidthAt(int row) {
if (width.size() <= row) {
return null;
Expand Down

0 comments on commit b4aba7e

Please sign in to comment.