Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkstyle_parameter #297

Merged
merged 4 commits into from
Nov 5, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
checkstyle_parameter
  • Loading branch information
yichen88 committed Oct 25, 2017
commit e400d68ec681ab57862cb5e3aec2d4326903544b
4 changes: 2 additions & 2 deletions EU2Mod_MB/src/main/java/itesla/converter/Block.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public class Block {
public Integer count;
public List<Boolean> UsedInputPins = new ArrayList<Boolean>();

public Block(String[] param, String[] entries, String output, Integer GraphicalNumber, Integer idEu, Integer cont, Integer nInputPins) {
public Block(String[] param, String[] entries, String output, Integer graphicalNumber, Integer idEu, Integer cont, Integer nInputPins) {
this.param = param;
this.entries = entries;
this.output = output;
this.GraphicalNumber = GraphicalNumber;
this.GraphicalNumber = graphicalNumber;
this.idEu = idEu;
this.count = cont;
for (int i = 0; i < nInputPins; i++) {
Expand Down
4 changes: 2 additions & 2 deletions EU2Mod_MB/src/main/java/itesla/converter/EU_MBparser.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public class EU_MBparser {
* nLinks: number of links.
* link: nLinks x 3 array. Each row is a link: the output block and the input block.
*/
public EU_MBparser(File EUfile) {
this.EUfile = EUfile;
public EU_MBparser(File euFile) {
this.EUfile = euFile;
try {
parser();
} catch (IOException e) {
Expand Down
10 changes: 5 additions & 5 deletions EU2Mod_MB/src/main/java/itesla/converter/ModelicaModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ public class ModelicaModel {
* init_friParameters: string list with the name of the parameters in the .fri.
* init_InterfaceParameters: string list with the name of the initialization variables of the interface variables.
*/
public ModelicaModel(Block[] Blocks, Integer[][] Link, String pathEu, Hashtable<Integer, Element> CT, ParParser parData) {
this.Blocks = Blocks;
this.Link = Link;
public ModelicaModel(Block[] blocks, Integer[][] link, String pathEu, Hashtable<Integer, Element> correspondenceTable, ParParser parData) {
this.Blocks = blocks;
this.Link = link;
this.pathEu = pathEu;
this.CT = CT;
this.CT = correspondenceTable;
this.parData = parData;
this.outputHeading = "";
this.outputEnd = "";
Expand All @@ -80,7 +80,7 @@ public ModelicaModel(Block[] Blocks, Integer[][] Link, String pathEu, Hashtable<
this.interfaceVariables = new HashMap<String, String>();
this.init_friParameters = new ArrayList<String>();
this.init_InterfaceParameters = new ArrayList<String>();
this.LinksBlocksId1 = new int[Blocks.length][7];
this.LinksBlocksId1 = new int[blocks.length][7];

Heading();
paramDeclaration();
Expand Down
3 changes: 3 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
<module name="NeedBraces"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="OuterTypeFilename"/>
<module name="ParameterAssignment"/>
<module name="ParameterName"/>
<module name="ParenPad"/>
<module name="RedundantImport"/>
<module name="RightCurly"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ public List<MLArray> underovervoltageMLArray(Double p, Double d) {
return mlarray;
}

public List<MLArray> smallsignalMLArray(Double step_min, Double var_min, Double f1, Double f2, Double d1, Double d2, Double d3, Double nm, Double fInstant, Double fDuration) {
MLDouble mStepMin = new MLDouble("step_min", new double[]{step_min}, 1);
MLDouble mVarMin = new MLDouble("var_min", new double[]{var_min}, 1);
public List<MLArray> smallsignalMLArray(Double stepMin, Double varMin, Double f1, Double f2, Double d1, Double d2, Double d3, Double nm, Double fInstant, Double fDuration) {
MLDouble mStepMin = new MLDouble("step_min", new double[]{stepMin}, 1);
MLDouble mVarMin = new MLDouble("var_min", new double[]{varMin}, 1);
MLDouble mF = new MLDouble("f", new double[]{f1, f2}, 1);
MLDouble mD = new MLDouble("d", new double[]{d1, d2, d3}, 1);
MLDouble mNm = new MLDouble("Nm", new double[]{nm}, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@ private BranchParallelIndexes(Map<String, Character> parallelIndexes) {
}

private static char incParallelIndex(char index) {
if (index == 'Z') {
char idx = index;
if (idx == 'Z') {
throw new RuntimeException("Number max of parallel index reached");
}
if (index == '9') {
if (idx == '9') {
return 'A';
} else {
return ++index;
return ++idx;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,7 @@ private static void printPowerSystemDataCFPFFormat(String outputFilePath, String


// Main
@SuppressWarnings("checkstyle:parameterassignment")
public static void main(String[] args) {

// ********************************** Initializations ********************************** //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,26 +361,27 @@ public String updateRecord(String id, String[] headers, Object[] values) {
writer.writeHeader(headersList.toArray(new String[] {}));
writer.write(valuesList.toArray());
*/

String idNonNull = id;
try {
writer.writeHeader(headers);
writer.write(values);

writer.close();

// if no id is provided, rely on server-side auto-increment mechanism
if (id == null) {
id = "autoIncrement";

if (idNonNull == null) {
idNonNull = "autoIncrement";
}

try (InputStream is = httpClient.postHttpRequest(new HistoDbUrl(config,
"data/" + id + ".csv", // WARN here one must NOT use the itesla suffix (not supporting POST of new data)
"data/" + idNonNull + ".csv", // WARN here one must NOT use the itesla suffix (not supporting POST of new data)
Collections.emptyMap()),
sw.toString().getBytes("UTF-8"))) {
return new String(ByteStreams.toByteArray(is), StandardCharsets.UTF_8);
}
} catch (IOException e) {
throw new RuntimeException("Failed to store network values for id " + id, e);
throw new RuntimeException("Failed to store network values for id " + idNonNull, e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,20 @@ public DdExportConfig() {
}

public DdExportConfig(boolean automatonA11, boolean automatonA12, boolean automatonA14, boolean importExportRST,
boolean importExportACMC, boolean LVLoadModeling, String RSTRegulInjector,
String RSTRegulGenerator, String RSTRegulGeneratorDelete, String ACMCRegul,
String RSTPilotGenerators, float loadPatternAlpha, float loadPatternBeta, boolean gensPQfilter) {
boolean importExportACMC, boolean lvLoadModeling, String rstRegulInjector,
String rstRegulGenerator, String rstRegulGeneratorDelete, String acmcRegul,
String rstPilotGenerators, float loadPatternAlpha, float loadPatternBeta, boolean gensPQfilter) {
this.automatonA11 = automatonA11;
this.automatonA12 = automatonA12;
this.automatonA14 = automatonA14;
this.importExportRST = importExportRST;
this.importExportACMC = importExportACMC;
this.LVLoadModeling = LVLoadModeling;
this.RSTRegulInjector = RSTRegulInjector;
this.RSTRegulGenerator = RSTRegulGenerator;
this.RSTRegulGeneratorDelete = RSTRegulGeneratorDelete;
this.ACMCRegul = ACMCRegul;
this.RSTPilotGenerators = RSTPilotGenerators;
this.LVLoadModeling = lvLoadModeling;
this.RSTRegulInjector = rstRegulInjector;
this.RSTRegulGenerator = rstRegulGenerator;
this.RSTRegulGeneratorDelete = rstRegulGeneratorDelete;
this.ACMCRegul = acmcRegul;
this.RSTPilotGenerators = rstPilotGenerators;
this.loadPatternAlpha = loadPatternAlpha;
this.loadPatternBeta = loadPatternBeta;
this.gensPQfilter = gensPQfilter;
Expand Down Expand Up @@ -192,32 +192,32 @@ public void setImportExportRST(Boolean importExportRST) {
this.importExportRST = importExportRST;
}

public void setLVLoadModeling(Boolean LVLoadModeling) {
this.LVLoadModeling = LVLoadModeling;
public void setLVLoadModeling(Boolean lvLoadModeling) {
this.LVLoadModeling = lvLoadModeling;
}

public void setImportExportACMC(Boolean importExportACMC) {
this.importExportACMC = importExportACMC;
}

public void setRSTRegulInjector(String RSTRegulInjector) {
this.RSTRegulInjector = RSTRegulInjector;
public void setRSTRegulInjector(String rstRegulInjector) {
this.RSTRegulInjector = rstRegulInjector;
}

public void setRSTRegulGenerator(String RSTRegulGenerator) {
this.RSTRegulGenerator = RSTRegulGenerator;
public void setRSTRegulGenerator(String rstRegulGenerator) {
this.RSTRegulGenerator = rstRegulGenerator;
}

public void setRSTRegulGeneratorDelete(String RSTRegulGeneratorDelete) {
this.RSTRegulGeneratorDelete = RSTRegulGeneratorDelete;
public void setRSTRegulGeneratorDelete(String rstRegulGeneratorDelete) {
this.RSTRegulGeneratorDelete = rstRegulGeneratorDelete;
}

public void setACMCRegul(String ACMCRegul) {
this.ACMCRegul = ACMCRegul;
public void setACMCRegul(String acmcRegul) {
this.ACMCRegul = acmcRegul;
}

public void setRSTPilotGenerators(String RSTPilotGenerators) {
this.RSTPilotGenerators = RSTPilotGenerators;
public void setRSTPilotGenerators(String rstPilotGenerators) {
this.RSTPilotGenerators = rstPilotGenerators;
}

public void setLoadPatternAlpha(float loadPatternAlpha) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ public String format(final Unit u, final Object o, final Options options) {
}

@Override
public Object parse(final Unit u, String s, final Options options) throws IOException {
public Object parse(final Unit u, String str, final Options options) throws IOException {
Double returning = null;
String s = str;
if (s.indexOf('E') == -1) {
returning = s.length() == 0 ? null : Double.parseDouble(s) / (s.indexOf('.') == -1 ? Math.pow(10, u.getDecimalLength()) : 1);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,11 @@ int skipParameterType(ModelicaParameter param) {
return p;
}

int checkParameterName(ModelicaParameter param, int p) {
int checkParameterName(ModelicaParameter param, int position) {
// Name is obtained from current line at current position
// Ignoring a potential parenthesized expression (class modification)
// And up to an equal character, trimming trailing blanks

int p = position;
int sp = parsingLine.indexOf(ModelicaGrammar.CLASS_MODIFICATION_START, p);
int eq = parsingLine.indexOf(ModelicaGrammar.EQ, p);
// The parenthesis happens before the first equal sign, skip class modification
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,24 @@ public ModelTemplateContainer getModelTemplCont() {
return this.modelTemplCont;
}

public void setModelTemplCont(ModelTemplateContainer _mtc) {
this.modelTemplCont = _mtc;
public void setModelTemplCont(ModelTemplateContainer modelTemplateContainer) {
this.modelTemplCont = modelTemplateContainer;
}

public ModelTemplate getModelTempl() {
return this.modelTempl;
}

public void setModelTempl(ModelTemplate _mt) {
this.modelTempl = _mt;
public void setModelTempl(ModelTemplate modelTemplate) {
this.modelTempl = modelTemplate;
}

public boolean getShowNewMt() {
return this.showNewMt;
}

public void setShowNewMt(boolean _show) {
this.showNewMt = _show;
public void setShowNewMt(boolean show) {
this.showNewMt = show;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,16 @@ public ModelTemplateContainer getModelTemplateContainer() {
return this.modelTemplateContainer;
}

public void setModelTemplateContainer(ModelTemplateContainer _modelTemplateContainer) {
this.modelTemplateContainer = _modelTemplateContainer;
public void setModelTemplateContainer(ModelTemplateContainer modelTemplateContainer) {
this.modelTemplateContainer = modelTemplateContainer;
}

public ModelTemplate getModelTemplate() {
return this.modelTemplate;
}

public void setModelTemplate(ModelTemplate _modelTemplate) {
this.modelTemplate = _modelTemplate;
public void setModelTemplate(ModelTemplate modelTemplate) {
this.modelTemplate = modelTemplate;
}

public StreamedContent getFileData() {
Expand Down Expand Up @@ -447,7 +447,6 @@ public void removeModelTemplate(String ddbId, ModelTemplate modelTemplate) {
log.log(Level.INFO, " removeModelTemplate [ddbId:" + modelTemplateContainer.getDdbId() + " MTC Comment:" + modelTemplateContainer.getComment() + " MT Comment " + modelTemplate.getComment() + " " + modelTemplate.getId() + " " + modelTemplate.getSimulator() + "]");
modelTemplateContainer.getModelTemplates().remove(modelTemplate);
pmanager.save(modelTemplateContainer);
modelTemplate = new ModelTemplate();
this.modelTemplateContainer = pmanager.findModelTemplateContainer(ddbId);
FacesMessage m = new FacesMessage(FacesMessage.SEVERITY_INFO, bundle.getString("delete.operation.msg"), bundle.getString("delete.success.msg"));
facesContext.addMessage(null, m);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ public String getCurrentddbid() {
return currentddbid;
}

public void setCurrentddbid(String _containerddbid) {
this.currentddbid = _containerddbid;
public void setCurrentddbid(String containerDdbId) {
this.currentddbid = containerDdbId;
}

public String getDataName() {
Expand Down Expand Up @@ -176,8 +176,8 @@ public ModelTemplate getModelTemplate() {
return this.modelTemplate;
}

public void setModelTemplate(ModelTemplate _modelTemplate) {
this.modelTemplate = _modelTemplate;
public void setModelTemplate(ModelTemplate modelTemplate) {
this.modelTemplate = modelTemplate;
}

@PostConstruct
Expand All @@ -203,11 +203,11 @@ public void setCurrentId(Long currentId) {
buildDefParamsEditTable(modelTemplate.getDefaultParameters());
}

private void buildDefParamsEditTable(List<DefaultParameters> _defParams) {
private void buildDefParamsEditTable(List<DefaultParameters> defParams) {
log.log(Level.INFO, " buildDefParamsEditableTable enter:: ");
this.dbDefParams = new TreeMap<Integer, List<DefaultParameterWeb>>();

for (DefaultParameters dp : _defParams) {
for (DefaultParameters dp : defParams) {

List<DefaultParameterWeb> pwList = new ArrayList<DefaultParameterWeb>();
int setNum = dp.getSetNum();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ public ParametersContainer getParametersContainer() {
return this.parametersContainer;
}

public void setParametersContainer(ParametersContainer _parametersContainer) {
this.parametersContainer = _parametersContainer;
public void setParametersContainer(ParametersContainer parametersContainer) {
this.parametersContainer = parametersContainer;
}

public List<SimulatorInst> getSimulatorParamsKeys() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ public String getCurrentddbid() {
}


public void setCurrentddbid(String _containerddbid) {
this.currentddbid = _containerddbid;
public void setCurrentddbid(String containerddbid) {
this.currentddbid = containerddbid;
}


Expand Down Expand Up @@ -500,10 +500,10 @@ public String reinit() {
return null;
}

private List<ParameterWeb> buildParamsEditableTable(Parameters _params) {
private List<ParameterWeb> buildParamsEditableTable(Parameters params) {
log.log(Level.INFO, " buildParamsEditableTable enter::");
List<ParameterWeb> pwList = new ArrayList<ParameterWeb>();
for (Parameter p : _params.getParameters()) {
for (Parameter p : params.getParameters()) {
log.log(Level.INFO, " _params [Name: " + p.getName() + ", Value: " + p.getValue() + "]");
ParameterWeb pw = new ParameterWeb();
pw.setName(p.getName());
Expand Down
Loading