Skip to content

Commit

Permalink
Use javastyle array brackets
Browse files Browse the repository at this point in the history
  • Loading branch information
yichen88 committed Sep 12, 2017
1 parent 424bb13 commit be4e243
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 23 deletions.
1 change: 1 addition & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
</module>

<module name="TreeWalker">
<module name="ArrayTypeStyle"/>
<module name="EmptyCatchBlock">
<property name="exceptionVariableName" value="ignored"/>
</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class CFPFFuzzyNumber {

private int numPoints = 3;
private double fuzzyNumber[];
private double[] fuzzyNumber;

// Empty constructor
public CFPFFuzzyNumber() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public class Converter {
private static String idT3W = "T3W_";

// Seasons
private static final String seasons[] = {
private static final String[] seasons = {
"Winter", "Winter", "Spring", "Spring", "Summer", "Summer",
"Summer", "Summer", "Fall", "Fall", "Winter", "Winter"
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public static void dump(ModelTemplateContainer m, Logger log) {
}


static Class jaxbClasses[] = {Equipment.class, Parameter.class,
static Class[] jaxbClasses = {Equipment.class, Parameter.class,
Internal.class, SimulatorInst.class, ModelTemplateContainer.class,
ParametersContainer.class, ParameterString.class,
ParameterInteger.class, ParameterFloat.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class DdbDtaImpExp implements DynamicDatabaseClient {
static Logger log = LoggerFactory.getLogger(DdbDtaImpExp.class);


String estg[][] = new String[][] {
String[][] estg = new String[][] {
{"M1U", "Unsaturated generator defined by its internal parameters - full model", },
{"M1DU", "Unsaturated generator defined by its internal parameters - full model - type Fortescue"},
{"M2U", "Unsaturated generator defined by its external parameters - full model"},
Expand Down Expand Up @@ -242,7 +242,7 @@ public void loadEurostagTemplatesCatalog(DDBManager ddbmanager) {
}
}
private void feedDDBWithEurostagModelTemplates(
String keyNamesAndDescriptions[][],
String[][] keyNamesAndDescriptions,
SimulatorInst eurostagSimulator, DDBManager ddbmanager) {
ModelTemplateContainer mtc = null;
ModelTemplate mt = null;
Expand Down Expand Up @@ -2257,7 +2257,7 @@ public void unloadEurostagTemplatesCatalog(DDBManager ddbmanager, String eurosta
}
}
private void removeFromDDBEurostagModelTemplates(
String keyNamesAndDescriptions[][],
String[][] keyNamesAndDescriptions,
SimulatorInst eurostagSimulator, DDBManager ddbmanager) {
log.debug("Removing eurostag catalog (Eurostag 5.1.1)");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ public static String getRealTypeVar(String varTypes, int num) {
}

public static String getVarFType(String componentName, String varName) {
String varNames[] = componentsVariablesNames.get(componentName);
String varTypes[] = componentsDescriptors.get(componentName);
String[] varNames = componentsVariablesNames.get(componentName);
String[] varTypes = componentsDescriptors.get(componentName);
if ((varNames == null) || (varTypes == null)) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ private ForecastErrorsHistoricalData loadHistoricalDataFromCsvFile(Path historic
ArrayList<StochasticVariable> stochasticVariables) throws IOException {
ForecastErrorsHistoricalData forecastErrorsHistoricalData = null;

Integer rowsIndexes[] = getRowsIndexes(historicalDataCsvFile);
String columnsIndexes[] = getColumnsIndexes(generatorsIds, loadsIds);
Integer[] rowsIndexes = getRowsIndexes(historicalDataCsvFile);
String[] columnsIndexes = getColumnsIndexes(generatorsIds, loadsIds);
ArrayTable<Integer, String, Float> forecastsData = ArrayTable.create(Arrays.asList(rowsIndexes), Arrays.asList(columnsIndexes));
ArrayTable<Integer, String, Float> snapshotsData = ArrayTable.create(Arrays.asList(rowsIndexes), Arrays.asList(columnsIndexes));

Expand Down Expand Up @@ -155,7 +155,7 @@ private ForecastErrorsHistoricalData loadHistoricalDataFromCsvFile(Path historic
protected Integer[] getRowsIndexes(Path csvFilePath) throws IOException {
int csvLength = Utils.countLines(csvFilePath);
int rowsIndex = (csvLength - 1) / 2;
Integer rowsIndexes[] = new Integer[rowsIndex];
Integer[] rowsIndexes = new Integer[rowsIndex];
for (int i = 0; i < rowsIndexes.length; i++) {
rowsIndexes[i] = i;
}
Expand All @@ -164,7 +164,7 @@ protected Integer[] getRowsIndexes(Path csvFilePath) throws IOException {

protected String[] getColumnsIndexes(ArrayList<String> generatorsIds, ArrayList<String> loadsIds) {
int columnsNumber = 2 + ( ( generatorsIds.size() + loadsIds.size() ) * 2 );
String columnsIndexes[] = new String[columnsNumber];
String[] columnsIndexes = new String[columnsNumber];
int count = 0;
// datetime
columnsIndexes[count] = "datetime";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class EurostagEngine extends SourceEngine {
* Machines params between Eurostag and Modelica <ModelicaParam>;<EurostagParam>
*/
private String pwGeneratorM1S = "iPSL.Electrical.Machines.Eurostag.PwGeneratorM1S";
private String m1sParams[][] = new String[][] {
private String[][] m1sParams = new String[][] {
{"rRotIn", "RF"},
{"mD0Pu", "WLMQ"},
{"mq", "RMQ"},
Expand Down Expand Up @@ -52,7 +52,7 @@ public class EurostagEngine extends SourceEngine {


private String pwGeneratorM2S = "iPSL.Electrical.Machines.Eurostag.PwGeneratorM2S";
private String m2sParams[][] = new String[][] {
private String[][] m2sParams = new String[][] {
{"SNREF", ""},
{"SN", "SN"},
{"PN", "PN"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class PsseEngine extends SourceEngine {
* Machines params between PSSE and Modelica <ModelicaParam>;<PSSEParam>
*/
private String GENROU = PsseModDefaultTypes.GENROU;
private String genrouParams[][] = new String[][] {
private String[][] genrouParams = new String[][] {
{"Tpd0", "Tpd0"},
{"Tppd0", "Tppd0"},
{"Tpq0", "Tpq0"},
Expand All @@ -38,7 +38,7 @@ public class PsseEngine extends SourceEngine {
{"S20", "S20"}};

private String GENSAL = PsseModDefaultTypes.GENSAL;
private String gensalParams[][] = new String[][] {
private String[][] gensalParams = new String[][] {
{"Tpd0", "Tpd0"},
{"Tppd0", "Tppd0"},
{"Tppq0", "Tppq0"},
Expand All @@ -54,7 +54,7 @@ public class PsseEngine extends SourceEngine {
{"S20", "S20"}};

private String GENCLS = PsseModDefaultTypes.GENCLS;
private String genclsParams[][] = new String[][] {
private String[][] genclsParams = new String[][] {
{"Tpd0", "Tpd0"},
{"Tppd0", "Tppd0"},
{"Tppq0", "Tppq0"},
Expand All @@ -70,7 +70,7 @@ public class PsseEngine extends SourceEngine {
{"S20", "S20"}};

private String WT4G1 = PsseModDefaultTypes.WT4G1;
private String wt4g1Params[][] = new String[][] {
private String[][] wt4g1Params = new String[][] {
{"T_IQCmd", "T_IQCmd"},
{"T_IPCmd", "T_IPCmd"},
{"V_LVPL1", "V_LVPL1"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ private static File[] getOmcBinaryPaths() throws ConnectException {
* Start a new OMC server.
*/
private static void startServer() throws ConnectException {
File tmp[] = getOmcBinaryPaths();
File[] tmp = getOmcBinaryPaths();

File omcBinary = tmp[0];
File workingDirectory = new File(".");
Expand All @@ -257,7 +257,7 @@ private static void startServer() throws ConnectException {
logOMCStatus("OMC object reference file is already on disk, but is old, start a new server.");
}

String command[] = {omcBinary.getAbsolutePath(), "+c=" + corbaSessionName, "+d=interactiveCorba"};
String[] command = {omcBinary.getAbsolutePath(), "+c=" + corbaSessionName, "+d=interactiveCorba"};
try {
logOMCStatus("Running command " + command[0] + " " + command[1] + " " + command[2]);
logOMCStatus("Setting working directory to " + workingDirectory.getAbsolutePath());
Expand Down Expand Up @@ -303,7 +303,7 @@ private static void startServer() throws ConnectException {
*/
private static void setupOmcc(String stringifiedObjectReference) {
/* Can't remember why this is needed. But it is. */
String args[] = {null};
String[] args = {null};

ORB orb;
orb = ORB.init(args, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public static double[][] histoDataAsDoubleMatrixNew(ArrayTable<Integer, String,
}

public static float[][] doubleToFloatMatrix(double[][] matrix) {
float retMatrix[][] = new float[matrix.length][matrix[0].length];
float[][] retMatrix = new float[matrix.length][matrix[0].length];
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix[0].length; j++) {
retMatrix[i][j] = (float) matrix[i][j];
Expand Down Expand Up @@ -444,7 +444,7 @@ public static void writeWp41ContModule1Params(Path outputfile, Module1Params par
writer.write(outputfile.toFile(), mlarray);
}
*/
public static void writeWp41ContModule1Mat(Path outputfile, double matrix[][]) throws IOException {
public static void writeWp41ContModule1Mat(Path outputfile, double[][] matrix) throws IOException {
LOGGER.debug("writeWp41ContModule1Mat - writing wp41 input X matrix data to file {}", outputfile );
MLDouble data = Utils.matToMLDouble(matrix, "X");
List<MLArray> mlarray = new ArrayList<>();
Expand Down

0 comments on commit be4e243

Please sign in to comment.