style: include ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD
(#5129)
This commit is contained in:
parent
5d00889291
commit
dc47e0aa42
@ -5,9 +5,6 @@
|
||||
<Match>
|
||||
<Bug pattern="EI_EXPOSE_REP2" />
|
||||
</Match>
|
||||
<Match>
|
||||
<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD" />
|
||||
</Match>
|
||||
<Match>
|
||||
<Bug pattern="DMI_RANDOM_USED_ONLY_ONCE" />
|
||||
</Match>
|
||||
|
@ -137,7 +137,7 @@ class Node {
|
||||
|
||||
class Task {
|
||||
|
||||
static int[] a;
|
||||
private int[] a;
|
||||
|
||||
public Node sortByMergeSort(Node head) {
|
||||
if (head == null || head.next == null) return head;
|
||||
@ -245,7 +245,7 @@ class Task1 {
|
||||
|
||||
class Task2 {
|
||||
|
||||
static int[] a;
|
||||
private int[] a;
|
||||
|
||||
public Node sortByHeapSort(Node head) {
|
||||
if (head == null || head.next == null) return head;
|
||||
|
@ -9,7 +9,7 @@ import static com.thealgorithms.sorts.SortUtils.less;
|
||||
*/
|
||||
class MergeSort implements SortAlgorithm {
|
||||
|
||||
@SuppressWarnings("rawtypes") private static Comparable[] aux;
|
||||
private Comparable[] aux;
|
||||
|
||||
/**
|
||||
* Generic merge sort algorithm implements.
|
||||
@ -30,7 +30,7 @@ class MergeSort implements SortAlgorithm {
|
||||
* @param left the first index of the array.
|
||||
* @param right the last index of the array.
|
||||
*/
|
||||
private static <T extends Comparable<T>> void doSort(T[] arr, int left, int right) {
|
||||
private <T extends Comparable<T>> void doSort(T[] arr, int left, int right) {
|
||||
if (left < right) {
|
||||
int mid = (left + right) >>> 1;
|
||||
doSort(arr, left, mid);
|
||||
@ -49,7 +49,7 @@ class MergeSort implements SortAlgorithm {
|
||||
* increasing order.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <T extends Comparable<T>> void merge(T[] arr, int left, int mid, int right) {
|
||||
private <T extends Comparable<T>> void merge(T[] arr, int left, int mid, int right) {
|
||||
int i = left, j = mid + 1;
|
||||
System.arraycopy(arr, left, aux, left, right + 1 - left);
|
||||
|
||||
|
@ -9,7 +9,7 @@ import static com.thealgorithms.sorts.SortUtils.less;
|
||||
*/
|
||||
class TimSort implements SortAlgorithm {
|
||||
private static final int SUB_ARRAY_SIZE = 32;
|
||||
@SuppressWarnings("rawtypes") private static Comparable[] aux;
|
||||
private Comparable[] aux;
|
||||
|
||||
@Override
|
||||
public <T extends Comparable<T>> T[] sort(T[] a) {
|
||||
@ -30,8 +30,7 @@ class TimSort implements SortAlgorithm {
|
||||
return a;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <T extends Comparable<T>> void merge(T[] a, int lo, int mid, int hi) {
|
||||
private <T extends Comparable<T>> void merge(T[] a, int lo, int mid, int hi) {
|
||||
int i = lo, j = mid + 1;
|
||||
System.arraycopy(a, lo, aux, lo, hi + 1 - lo);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user