From c3a9b71e935c182d9e5ba010392ceaf89ec8b5ee Mon Sep 17 00:00:00 2001 From: mkpaz Date: Fri, 10 Feb 2023 14:05:26 +0400 Subject: [PATCH] Checkstyle: fix naming convention issues Fixed warnings: AbbreviationAsWordInName, ClassTypeParameterName, LocalVariableName, MemberName, MethodName. --- .../atlantafx/base/controls/Breadcrumbs.java | 8 +-- checkstyle.xml | 2 +- .../atlantafx/sampler/layout/Sidebar.java | 4 +- ...TMLEditorPage.java => HtmlEditorPage.java} | 4 +- .../sampler/page/general/ContrastChecker.java | 16 +++--- .../page/showcase/musicplayer/ColorThief.java | 52 +++++++++---------- 6 files changed, 43 insertions(+), 43 deletions(-) rename sampler/src/main/java/atlantafx/sampler/page/components/{HTMLEditorPage.java => HtmlEditorPage.java} (97%) diff --git a/base/src/main/java/atlantafx/base/controls/Breadcrumbs.java b/base/src/main/java/atlantafx/base/controls/Breadcrumbs.java index 36a0a52..f9a862e 100755 --- a/base/src/main/java/atlantafx/base/controls/Breadcrumbs.java +++ b/base/src/main/java/atlantafx/base/controls/Breadcrumbs.java @@ -298,7 +298,7 @@ public class Breadcrumbs extends Control { /** * Represents an Event which is fired when a bread crumb was activated. */ - public static class BreadCrumbActionEvent extends Event { + public static class BreadCrumbActionEvent extends Event { /** * The event type that should be listened to by people interested in @@ -308,17 +308,17 @@ public class Breadcrumbs extends Control { public static final EventType> CRUMB_ACTION = new EventType<>("CRUMB_ACTION" + UUID.randomUUID()); - private final BreadCrumbItem selectedCrumb; + private final BreadCrumbItem selectedCrumb; /** * Creates a new event that can subsequently be fired. */ - public BreadCrumbActionEvent(BreadCrumbItem selectedCrumb) { + public BreadCrumbActionEvent(BreadCrumbItem selectedCrumb) { super(CRUMB_ACTION); this.selectedCrumb = selectedCrumb; } - public BreadCrumbItem getSelectedCrumb() { + public BreadCrumbItem getSelectedCrumb() { return selectedCrumb; } } diff --git a/checkstyle.xml b/checkstyle.xml index 85d2c1d..0a25a59 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -336,7 +336,7 @@ - + diff --git a/sampler/src/main/java/atlantafx/sampler/layout/Sidebar.java b/sampler/src/main/java/atlantafx/sampler/layout/Sidebar.java index 456cac1..527346f 100644 --- a/sampler/src/main/java/atlantafx/sampler/layout/Sidebar.java +++ b/sampler/src/main/java/atlantafx/sampler/layout/Sidebar.java @@ -18,7 +18,7 @@ import atlantafx.sampler.page.components.ComboBoxPage; import atlantafx.sampler.page.components.CustomTextFieldPage; import atlantafx.sampler.page.components.DatePickerPage; import atlantafx.sampler.page.components.DialogPage; -import atlantafx.sampler.page.components.HTMLEditorPage; +import atlantafx.sampler.page.components.HtmlEditorPage; import atlantafx.sampler.page.components.InputGroupPage; import atlantafx.sampler.page.components.LabelPage; import atlantafx.sampler.page.components.ListPage; @@ -239,7 +239,7 @@ class Sidebar extends StackPane { navLink(CustomTextFieldPage.NAME, CustomTextFieldPage.class), navLink(DatePickerPage.NAME, DatePickerPage.class), navLink(DialogPage.NAME, DialogPage.class), - navLink(HTMLEditorPage.NAME, HTMLEditorPage.class), + navLink(HtmlEditorPage.NAME, HtmlEditorPage.class), navLink(LabelPage.NAME, LabelPage.class), navLink(ListPage.NAME, ListPage.class), navLink(MenuPage.NAME, MenuPage.class), diff --git a/sampler/src/main/java/atlantafx/sampler/page/components/HTMLEditorPage.java b/sampler/src/main/java/atlantafx/sampler/page/components/HtmlEditorPage.java similarity index 97% rename from sampler/src/main/java/atlantafx/sampler/page/components/HTMLEditorPage.java rename to sampler/src/main/java/atlantafx/sampler/page/components/HtmlEditorPage.java index 4a6f6f1..649be0f 100644 --- a/sampler/src/main/java/atlantafx/sampler/page/components/HTMLEditorPage.java +++ b/sampler/src/main/java/atlantafx/sampler/page/components/HtmlEditorPage.java @@ -19,7 +19,7 @@ import javafx.scene.text.Text; import javafx.scene.text.TextFlow; import javafx.scene.web.HTMLEditor; -public class HTMLEditorPage extends AbstractPage { +public class HtmlEditorPage extends AbstractPage { private static final PseudoClass USE_LOCAL_URL = PseudoClass.getPseudoClass("use-local-url"); @@ -32,7 +32,7 @@ public class HTMLEditorPage extends AbstractPage { private HTMLEditor editor = createEditor(); - public HTMLEditorPage() { + public HtmlEditorPage() { super(); setUserContent(new VBox(editorSample())); diff --git a/sampler/src/main/java/atlantafx/sampler/page/general/ContrastChecker.java b/sampler/src/main/java/atlantafx/sampler/page/general/ContrastChecker.java index 73c0ba5..fd40cf9 100644 --- a/sampler/src/main/java/atlantafx/sampler/page/general/ContrastChecker.java +++ b/sampler/src/main/java/atlantafx/sampler/page/general/ContrastChecker.java @@ -56,8 +56,8 @@ class ContrastChecker extends GridPane { private String bgColorName; private String fgColorName; - private final ObservableHSLAColor bgColor = new ObservableHSLAColor(Color.WHITE); - private final ObservableHSLAColor fgColor = new ObservableHSLAColor(Color.BLACK); + private final ObservableHslaColor bgColor = new ObservableHslaColor(Color.WHITE); + private final ObservableHslaColor fgColor = new ObservableHslaColor(Color.BLACK); private final ReadOnlyObjectProperty bgBaseColor; private final DoubleBinding contrastRatio; @@ -418,15 +418,15 @@ class ContrastChecker extends GridPane { /////////////////////////////////////////////////////////////////////////// - private static class ObservableHSLAColor { + private static class ObservableHslaColor { private final ObservableList values = FXCollections.observableArrayList(0f, 0f, 0f, 0f); private final ReadOnlyObjectWrapper color = new ReadOnlyObjectWrapper<>() { }; - public ObservableHSLAColor(Color initialColor) { + public ObservableHslaColor(Color initialColor) { values.addListener((ListChangeListener) c -> { - float[] rgb = getRGBAArithmeticColor(); + float[] rgb = getRgbaArithmeticColor(); color.set(Color.color(rgb[0], rgb[1], rgb[2], getAlpha())); }); setColor(initialColor); @@ -477,7 +477,7 @@ class ContrastChecker extends GridPane { values.set(3, value); } - public float[] getRGBAArithmeticColor() { + public float[] getRgbaArithmeticColor() { float[] hsl = new float[] {getHue(), getSaturation(), getLightness()}; var color = JColor.color(hsl, getAlpha()); return new float[] { @@ -496,9 +496,9 @@ class ContrastChecker extends GridPane { private static class RightClickMenu extends ContextMenu { - private final ObservableHSLAColor color; + private final ObservableHslaColor color; - public RightClickMenu(ObservableHSLAColor color) { + public RightClickMenu(ObservableHslaColor color) { super(); this.color = color; diff --git a/sampler/src/main/java/atlantafx/sampler/page/showcase/musicplayer/ColorThief.java b/sampler/src/main/java/atlantafx/sampler/page/showcase/musicplayer/ColorThief.java index 4e773e3..87d602c 100644 --- a/sampler/src/main/java/atlantafx/sampler/page/showcase/musicplayer/ColorThief.java +++ b/sampler/src/main/java/atlantafx/sampler/page/showcase/musicplayer/ColorThief.java @@ -185,9 +185,9 @@ final class ColorThief { private final int[] histo; - private int[] _avg; - private Integer _volume; - private Integer _count; + private int[] gAvg; + private Integer gVolume; + private Integer gCount; public VBox(int r1, int r2, int g1, int g2, int b1, int b2, int[] histo) { this.r1 = r1; @@ -205,14 +205,14 @@ final class ColorThief { } public int volume(boolean force) { - if (_volume == null || force) { - _volume = ((r2 - r1 + 1) * (g2 - g1 + 1) * (b2 - b1 + 1)); + if (gVolume == null || force) { + gVolume = ((r2 - r1 + 1) * (g2 - g1 + 1) * (b2 - b1 + 1)); } - return _volume; + return gVolume; } public int count(boolean force) { - if (_count == null || force) { + if (gCount == null || force) { int npix = 0; int i, j, k, index; @@ -225,10 +225,10 @@ final class ColorThief { } } - _count = npix; + gCount = npix; } - return _count; + return gCount; } @Override @@ -238,7 +238,7 @@ final class ColorThief { } public int[] avg(boolean force) { - if (_avg == null || force) { + if (gAvg == null || force) { int ntot = 0; int rsum = 0; int gsum = 0; @@ -259,14 +259,14 @@ final class ColorThief { } if (ntot > 0) { - _avg = new int[] {(rsum / ntot), (gsum / ntot), (bsum / ntot)}; + gAvg = new int[] {(rsum / ntot), (gsum / ntot), (bsum / ntot)}; } else { - _avg = new int[] {(MULT * (r1 + r2 + 1) / 2), (MULT * (g1 + g2 + 1) / 2), + gAvg = new int[] {(MULT * (r1 + r2 + 1) / 2), (MULT * (g1 + g2 + 1) / 2), (MULT * (b1 + b2 + 1) / 2)}; } } - return _avg; + return gAvg; } public boolean contains(int[] pixel) { @@ -457,36 +457,36 @@ final class ColorThief { int[] lookAheadSum, int total ) { - int vbox_dim1; - int vbox_dim2; + int vboxDim1; + int vboxDim2; if (color == 'r') { - vbox_dim1 = vbox.r1; - vbox_dim2 = vbox.r2; + vboxDim1 = vbox.r1; + vboxDim2 = vbox.r2; } else if (color == 'g') { - vbox_dim1 = vbox.g1; - vbox_dim2 = vbox.g2; + vboxDim1 = vbox.g1; + vboxDim2 = vbox.g2; } else { - vbox_dim1 = vbox.b1; - vbox_dim2 = vbox.b2; + vboxDim1 = vbox.b1; + vboxDim2 = vbox.b2; } int left, right; VBox vbox1, vbox2; int d2, count2; - for (int i = vbox_dim1; i <= vbox_dim2; i++) { + for (int i = vboxDim1; i <= vboxDim2; i++) { if (partialSum[i] > total / 2) { vbox1 = vbox.clone(); vbox2 = vbox.clone(); - left = i - vbox_dim1; - right = vbox_dim2 - i; + left = i - vboxDim1; + right = vboxDim2 - i; if (left <= right) { - d2 = Math.min(vbox_dim2 - 1, (i + right / 2)); + d2 = Math.min(vboxDim2 - 1, (i + right / 2)); } else { - d2 = Math.max(vbox_dim1, ((int) (i - 1 - left / 2.0))); + d2 = Math.max(vboxDim1, ((int) (i - 1 - left / 2.0))); } while (d2 < 0 || partialSum[d2] <= 0) {