Skip to content

Commit

Permalink
style application
Browse files Browse the repository at this point in the history
  • Loading branch information
matakleo authored and haileyajohnson committed Jul 17, 2024
1 parent 5324639 commit bfbc4ff
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 47 deletions.
10 changes: 5 additions & 5 deletions cdm/core/src/main/java/ucar/nc2/dataset/VariableDS.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @author caron
* @see NetcdfDataset
*/
public class VariableDS extends Variable implements VariableEnhanced, EnhanceScaleMissingUnsigned{
public class VariableDS extends Variable implements VariableEnhanced, EnhanceScaleMissingUnsigned {



Expand Down Expand Up @@ -287,7 +287,7 @@ Array convert(Array data, Set<NetcdfDataset.Enhance> enhancements) {
toApply.add(scaleOffset);
convertedType = scaleOffset.getScaledOffsetType();
}
/** this == variableDS */
/** this == variableDS */
for (Enhance enhance : enhancements) {
for (EnhancementProvider service : ServiceLoader.load(EnhancementProvider.class)) {
if (service.appliesTo(enhance, this)) {
Expand Down Expand Up @@ -939,15 +939,15 @@ private void createEnhancements() {
}
this.dataType = scaleOffset != null ? scaleOffset.getScaledOffsetType() : this.dataType;
}
/** how oh how ??? */
/** how oh how ??? */
for (Enhance enhance : this.enhanceMode) {
for (EnhancementProvider service : ServiceLoader.load(EnhancementProvider.class)) {
/** Stand and Norm require floatingpoint, buc classifier can do just numeric? */
if (service.appliesTo(enhance,this.attributes())&& dataType.isFloatingPoint()) {
if (service.appliesTo(enhance, this.attributes()) && dataType.isFloatingPoint()) {
service.Create(this);
}
}
}
}

}

Expand Down
26 changes: 13 additions & 13 deletions cdm/core/src/main/java/ucar/nc2/filter/Classifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.io.IOException;
import java.io.OutputStream;
import java.util.*;

public class Classifier implements Enhancement {


Expand Down Expand Up @@ -147,8 +148,8 @@ public static int[] stringToIntArray(String str) {
public static class Provider implements EnhancementProvider {

@Override
public void Create(VariableDS var){
var.classifier=Classifier.createFromVariable(var);
public void Create(VariableDS var) {
var.classifier = Classifier.createFromVariable(var);
}


Expand All @@ -157,26 +158,28 @@ public void Create(VariableDS var){
public String getName() {
return name;
}

@Override
public boolean canDo (Set<Enhance> enhancements){
public boolean canDo(Set<Enhance> enhancements) {
if (enhancements.contains(Enhance.ApplyClassifier)) {
return true;
}
return false;
}

// Attribute findAttribute(String attName);
// Attribute findAttribute(String attName);

@Override
public boolean appliesTo(Enhance enhance, AttributeContainer attributes) {
return enhance == Enhance.ApplyClassifier && attributes.findAttribute(CDM.CLASSIFY)!= null;
public boolean appliesTo(Enhance enhance, AttributeContainer attributes) {
return enhance == Enhance.ApplyClassifier && attributes.findAttribute(CDM.CLASSIFY) != null;
}

@Override
public boolean appliesTo(Enhance enhance,VariableDS var){
return enhance == Enhance.ApplyClassifier && var.classifier!=null;
public boolean appliesTo(Enhance enhance, VariableDS var) {
return enhance == Enhance.ApplyClassifier && var.classifier != null;
}

public Classifier returnObject( VariableDS var){
public Classifier returnObject(VariableDS var) {
return var.classifier;
}

Expand All @@ -186,9 +189,6 @@ public Classifier returnObject( VariableDS var){




}


}


17 changes: 9 additions & 8 deletions cdm/core/src/main/java/ucar/nc2/filter/EnhancementProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
package ucar.nc2.filter;

import java.util.Map;
//package ucar.nc2.dataset;
// package ucar.nc2.dataset;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.Sets;
Expand All @@ -30,19 +30,20 @@
*/
public interface EnhancementProvider {

String getName();
String getName();

boolean canDo (Set<ucar.nc2.dataset.NetcdfDataset.Enhance> enhancements);
boolean canDo(Set<ucar.nc2.dataset.NetcdfDataset.Enhance> enhancements);

boolean appliesTo(Enhance enhance, AttributeContainer attributes);
boolean appliesTo(Enhance enhance, AttributeContainer attributes);

boolean appliesTo(Enhance enhance, VariableDS var);
boolean appliesTo(Enhance enhance, VariableDS var);

void Create(VariableDS var);
Enhancement returnObject(VariableDS var);
void Create(VariableDS var);

Enhancement returnObject(VariableDS var);

// void applyEnhancement(Object instance);

// void applyEnhancement(Object instance);

}

Expand Down
23 changes: 14 additions & 9 deletions cdm/core/src/main/java/ucar/nc2/filter/Normalizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class Normalizer implements Enhancement {
private final double minimum;
private final double range; // maximum - minimum
private static String name = "Normalizer";

public static Normalizer createFromVariable(VariableDS var) {
try {
Array arr = var.read();
Expand Down Expand Up @@ -75,19 +76,22 @@ public double getMinimum() {
public double getRange() {
return range;
}

public static class Provider implements EnhancementProvider {

@Override
public void Create(VariableDS var){
var.normalizer=Normalizer.createFromVariable(var);
public void Create(VariableDS var) {
var.normalizer = Normalizer.createFromVariable(var);

}

@Override
public String getName() {
return name;
}

@Override
public boolean canDo (Set<Enhance> enhancements){
public boolean canDo(Set<Enhance> enhancements) {
if (enhancements.contains(Enhance.ApplyNormalizer)) {
return true;
}
Expand All @@ -96,20 +100,21 @@ public boolean canDo (Set<Enhance> enhancements){

@Override
public boolean appliesTo(Enhance enhance, AttributeContainer attributes) {
return enhance == Enhance.ApplyNormalizer && attributes.findAttribute(CDM.NORMALIZE)!= null;
return enhance == Enhance.ApplyNormalizer && attributes.findAttribute(CDM.NORMALIZE) != null;
}

@Override
public boolean appliesTo(Enhance enhance,VariableDS var){
return enhance == Enhance.ApplyNormalizer && var.normalizer!= null;
public boolean appliesTo(Enhance enhance, VariableDS var) {
return enhance == Enhance.ApplyNormalizer && var.normalizer != null;
}
@Override
public Normalizer returnObject( VariableDS var){

@Override
public Normalizer returnObject(VariableDS var) {
return var.normalizer;
}




}

}
10 changes: 5 additions & 5 deletions cdm/core/src/main/java/ucar/nc2/filter/ScaleOffset.java
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ private Number convertUnsigned(Number value, Signedness signedness) {
}


public static class Provider implements FilterProvider{
public static class Provider implements FilterProvider {

@Override
public String getName() {
Expand All @@ -291,10 +291,10 @@ public Filter create(Map<String, Object> properties) {
return new ScaleOffset(properties);
}

// @Override
// public void doSomething(double val) {
// System.out.println("SCALEOFFSET ! "+val);
// }
// @Override
// public void doSomething(double val) {
// System.out.println("SCALEOFFSET ! "+val);
// }


}
Expand Down
17 changes: 10 additions & 7 deletions cdm/core/src/main/java/ucar/nc2/filter/Standardizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,18 @@ public double getStdDev() {
public static class Provider implements EnhancementProvider {

@Override
public void Create(VariableDS var){
var.standardizer=Standardizer.createFromVariable(var);
public void Create(VariableDS var) {
var.standardizer = Standardizer.createFromVariable(var);

}

@Override
public String getName() {
return name;
}

@Override
public boolean canDo (Set<Enhance> enhancements){
public boolean canDo(Set<Enhance> enhancements) {
if (enhancements.contains(Enhance.ApplyStandardizer)) {
return true;
}
Expand All @@ -100,15 +102,16 @@ public boolean canDo (Set<Enhance> enhancements){

@Override
public boolean appliesTo(Enhance enhance, AttributeContainer attributes) {
return enhance == Enhance.ApplyStandardizer && attributes.findAttribute(CDM.STANDARDIZE)!= null;
return enhance == Enhance.ApplyStandardizer && attributes.findAttribute(CDM.STANDARDIZE) != null;
}

@Override
public boolean appliesTo(Enhance enhance,VariableDS var){
return enhance == Enhance.ApplyStandardizer && var.standardizer!= null;
public boolean appliesTo(Enhance enhance, VariableDS var) {
return enhance == Enhance.ApplyStandardizer && var.standardizer != null;
}

@Override
public Standardizer returnObject( VariableDS var){
public Standardizer returnObject(VariableDS var) {
return var.standardizer;
}
}
Expand Down

0 comments on commit bfbc4ff

Please sign in to comment.