Skip to content

Commit

Permalink
Code quality improvements surfaced by IntelliJ.
Browse files Browse the repository at this point in the history
  • Loading branch information
msqr committed Feb 3, 2025
1 parent c786597 commit 1c7a345
Show file tree
Hide file tree
Showing 52 changed files with 1,363 additions and 1,569 deletions.
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
/* ==================================================================
* AggregateDatumEntity.java - 30/10/2020 4:33:26 pm
*
*
* Copyright 2020 SolarNetwork.net Dev Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
* ==================================================================
*/

package net.solarnetwork.central.datum.v2.dao;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.Instant;
Expand All @@ -36,22 +37,23 @@
/**
* Extension of {@link DatumEntity} to support aggregated (e.g. "rollup")
* entities.
*
*
* @author matt
* @version 1.2
* @since 2.8
*/
public class AggregateDatumEntity extends DatumEntity
implements AggregateDatum, Cloneable, Serializable {

@Serial
private static final long serialVersionUID = 7976275982566577572L;

private final Aggregation aggregation;
private final DatumPropertiesStatistics statistics;

/**
* Constructor.
*
*
* @param id
* the ID
* @param aggregation
Expand All @@ -70,7 +72,7 @@ public AggregateDatumEntity(DatumPK id, Aggregation aggregation, DatumProperties

/**
* Constructor.
*
*
* @param streamId
* the stream ID
* @param timestamp
Expand Down Expand Up @@ -155,7 +157,7 @@ public Aggregation getAggregation() {

/**
* Get the property statistics.
*
*
* @return the statistics
*/
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package net.solarnetwork.central.datum.v2.dao;

import java.io.Serial;
import java.io.Serializable;
import java.time.Instant;
import java.util.UUID;
Expand All @@ -48,6 +49,7 @@
public class AuditDatumEntity extends BasicIdentity<DatumPK>
implements AuditDatum, Cloneable, Serializable {

@Serial
private static final long serialVersionUID = 8810831398503917185L;

private final Aggregation aggregation;
Expand Down Expand Up @@ -82,7 +84,7 @@ public static DatumRecordCounts datumRecordCounts(Instant timestamp, Long datumC
}

/**
* Create a hourly audit datum.
* Create an hourly audit datum.
*
* @param streamId
* the stream ID
Expand All @@ -108,7 +110,7 @@ public static AuditDatumEntity ioAuditDatum(UUID streamId, Instant timestamp, Lo
}

/**
* Create a hourly audit datum.
* Create an hourly audit datum.
*
* @param streamId
* the stream ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package net.solarnetwork.central.datum.v2.dao;

import java.io.Serial;
import java.io.Serializable;
import java.time.Instant;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
Expand All @@ -43,13 +44,14 @@
public class AuditDatumEntityRollup extends AuditDatumEntity
implements AuditDatumRollup, Cloneable, Serializable {

@Serial
private static final long serialVersionUID = -1564122596119213768L;

private final Long nodeId;
private final String sourceId;

/**
* Create a hourly audit datum.
* Create an hourly audit datum.
*
* @param nodeId
* the node ID
Expand Down Expand Up @@ -78,7 +80,7 @@ public static AuditDatumEntityRollup hourlyAuditDatumRollup(Long nodeId, String
}

/**
* Create a hourly audit datum.
* Create an hourly audit datum.
*
* @param nodeId
* the node ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,9 @@ public boolean equals(Object obj) {
if ( this == obj ) {
return true;
}
if ( !super.equals(obj) ) {
if ( !super.equals(obj) || !(obj instanceof BasicDatumCriteria other) ) {
return false;
}
if ( !(obj instanceof BasicDatumCriteria) ) {
return false;
}
BasicDatumCriteria other = (BasicDatumCriteria) obj;
return aggregation == other.aggregation && combiningType == other.combiningType
&& datumAuxiliaryType == other.datumAuxiliaryType
&& Arrays.equals(datumRollupTypes, other.datumRollupTypes)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/* ==================================================================
* CombiningConfig.java - 4/12/2020 3:06:51 pm
*
*
* Copyright 2020 SolarNetwork.net Dev Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
* ==================================================================
*/
Expand All @@ -33,7 +33,7 @@

/**
* Data structure to help with combining query execution.
*
*
* @author matt
* @version 1.0
* @since 2.8
Expand All @@ -51,7 +51,7 @@ public class CombiningConfig {

/**
* Constructor.
*
*
* @param type
* the type
* @param configs
Expand All @@ -63,7 +63,7 @@ public CombiningConfig(CombiningType type, List<CombiningIdsConfig<Object>> conf
if ( configs == null || configs.isEmpty() ) {
this.configMap = Collections.emptyMap();
} else {
this.configMap = new LinkedHashMap<String, CombiningIdsConfig<?>>(configs.size());
this.configMap = new LinkedHashMap<>(configs.size());
for ( CombiningIdsConfig<?> config : configs ) {
this.configMap.put(config.getName(), config);
}
Expand All @@ -73,7 +73,7 @@ public CombiningConfig(CombiningType type, List<CombiningIdsConfig<Object>> conf
/**
* Create a new {@link CombiningConfig} instance from an
* {@link ObjectStreamCriteria}.
*
*
* @param filter
* the criteria
* @return the config, or {@literal null} if {@code filter} is
Expand Down Expand Up @@ -109,7 +109,7 @@ public static CombiningConfig configFromCriteria(ObjectStreamCriteria filter) {

/**
* Get the combining action type.
*
*
* @return the type
*/
public CombiningType getType() {
Expand All @@ -118,7 +118,7 @@ public CombiningType getType() {

/**
* Get all available ID configuration keys.
*
*
* @return the available ID configuration keys
*/
public Set<String> getIdsConfigKeys() {
Expand All @@ -127,7 +127,7 @@ public Set<String> getIdsConfigKeys() {

/**
* Get the IDs configuration for a specific key, casting the result.
*
*
* @param <T>
* the expected IDs configuration type
* @param key
Expand All @@ -143,7 +143,7 @@ public <T> CombiningIdsConfig<T> getIdsConfig(String key) {

/**
* Get the combining IDs configurations.
*
*
* @return the IDs configurations
*/
public Collection<CombiningIdsConfig<?>> getIdsConfigs() {
Expand All @@ -152,7 +152,7 @@ public Collection<CombiningIdsConfig<?>> getIdsConfigs() {

/**
* Test if an object IDs configuration is available.
*
*
* @return {@literal true} if an IDs configuration for
* {@link #OBJECT_IDS_CONFIG} exists
*/
Expand All @@ -162,7 +162,7 @@ public boolean isWithObjectIds() {

/**
* Test if a source IDs configuration is available.
*
*
* @return {@literal true} if an IDs configuration for
* {@link #SOURCE_IDS_CONFIG} exists
*/
Expand Down
Loading

0 comments on commit 1c7a345

Please sign in to comment.