Commit d45494b4 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

curly braces are required in for/if statements

parent d7d2e99a
Pipeline #46991 failed with stage
in 63 minutes and 39 seconds
...@@ -158,7 +158,7 @@ public abstract class ElementAnnotator extends CachableInterface { ...@@ -158,7 +158,7 @@ public abstract class ElementAnnotator extends CachableInterface {
*/ */
public List<Class<? extends BioEntity>> getValidClasses() { public List<Class<? extends BioEntity>> getValidClasses() {
return validClasses; return validClasses;
}; }
/** /**
* Returns <code>true</code> if this annotator can annotate the object given in * Returns <code>true</code> if this annotator can annotate the object given in
......
...@@ -203,8 +203,9 @@ public abstract class AnnotationTestFunctions extends AbstractTransactionalJUnit ...@@ -203,8 +203,9 @@ public abstract class AnnotationTestFunctions extends AbstractTransactionalJUnit
} }
protected String nodeToString(Node node, boolean includeHeadNode) { protected String nodeToString(Node node, boolean includeHeadNode) {
if (node == null) if (node == null) {
return null; return null;
}
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
try { try {
Transformer t = TransformerFactory.newInstance().newTransformer(); Transformer t = TransformerFactory.newInstance().newTransformer();
......
...@@ -96,8 +96,9 @@ public class MiriamConnectorTest extends AnnotationTestFunctions { ...@@ -96,8 +96,9 @@ public class MiriamConnectorTest extends AnnotationTestFunctions {
boolean deprecated = false; boolean deprecated = false;
try { try {
Field f = MiriamType.class.getField(mt.name()); Field f = MiriamType.class.getField(mt.name());
if (f.isAnnotationPresent(Deprecated.class)) if (f.isAnnotationPresent(Deprecated.class)) {
deprecated = true; deprecated = true;
}
} catch (NoSuchFieldException | SecurityException e) { } catch (NoSuchFieldException | SecurityException e) {
} }
......
...@@ -127,10 +127,11 @@ public class ModelAnnotatorTest extends AnnotationTestFunctions { ...@@ -127,10 +127,11 @@ public class ModelAnnotatorTest extends AnnotationTestFunctions {
modelAnnotator.copyAnnotationFromOtherSpecies(model, updater); modelAnnotator.copyAnnotationFromOtherSpecies(model, updater);
for (Species element : model.getSpeciesList()) { for (Species element : model.getSpeciesList()) {
if (element.getName().equals("s4")) if (element.getName().equals("s4")) {
assertEquals(0, element.getMiriamData().size()); assertEquals(0, element.getMiriamData().size());
else if (element.getName().equals("hello")) } else if (element.getName().equals("hello")) {
assertEquals(1, element.getMiriamData().size()); assertEquals(1, element.getMiriamData().size());
}
} }
} }
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
<property name="tokens" <property name="tokens"
value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/> value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
</module> </module>
<!-- <module name="NeedBraces"> <module name="NeedBraces">
<property name="tokens" <property name="tokens"
value="LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_IF, LITERAL_WHILE"/> value="LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_IF, LITERAL_WHILE"/>
</module> </module>
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT,
INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF"/> INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF"/>
</module> </module>
<module name="WhitespaceAround"> <!-- <module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/> <property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyLambdas" value="true"/> <property name="allowEmptyLambdas" value="true"/>
<property name="allowEmptyMethods" value="true"/> <property name="allowEmptyMethods" value="true"/>
......
...@@ -121,8 +121,9 @@ public class XmlParserTest extends CommonTestFunctions { ...@@ -121,8 +121,9 @@ public class XmlParserTest extends CommonTestFunctions {
@Test @Test
public void testConcurrencyParse() throws Exception { public void testConcurrencyParse() throws Exception {
StringBuilder builder = new StringBuilder("<doc>"); StringBuilder builder = new StringBuilder("<doc>");
for (int i = 0; i < 30000; i++) for (int i = 0; i < 30000; i++) {
builder.append("<test_node>test_x</test_node>"); builder.append("<test_node>test_x</test_node>");
}
builder.append("</doc>"); builder.append("</doc>");
final String xml = builder.toString(); final String xml = builder.toString();
threadSucceded = false; threadSucceded = false;
......
...@@ -921,8 +921,9 @@ public class RestAnnotationParser { ...@@ -921,8 +921,9 @@ public class RestAnnotationParser {
boolean isFieldAnnotated(NoteField field, Class<? extends Annotation> annotationClass) { boolean isFieldAnnotated(NoteField field, Class<? extends Annotation> annotationClass) {
try { try {
Field f = field.getClass().getField(field.name()); Field f = field.getClass().getField(field.name());
if (f.isAnnotationPresent(annotationClass)) if (f.isAnnotationPresent(annotationClass)) {
return true; return true;
}
} catch (NoSuchFieldException | SecurityException e) { } catch (NoSuchFieldException | SecurityException e) {
} }
return false; return false;
......
...@@ -111,8 +111,9 @@ public class ReactionCollectionXmlParser { ...@@ -111,8 +111,9 @@ public class ReactionCollectionXmlParser {
for (Reaction reaction : collection) { for (Reaction reaction : collection) {
boolean reactionToCompartment = false; boolean reactionToCompartment = false;
for (ReactionNode node : reaction.getReactionNodes()) { for (ReactionNode node : reaction.getReactionNodes()) {
if (node.getElement() instanceof Compartment) if (node.getElement() instanceof Compartment) {
reactionToCompartment = true; reactionToCompartment = true;
}
} }
if (reactionToCompartment) { if (reactionToCompartment) {
logger.warn(new LogMarker(ProjectLogEntryType.EXPORT_ISSUE, reaction), logger.warn(new LogMarker(ProjectLogEntryType.EXPORT_ISSUE, reaction),
......
...@@ -165,8 +165,9 @@ public abstract class CellDesignerTestFunctions { ...@@ -165,8 +165,9 @@ public abstract class CellDesignerTestFunctions {
} }
protected String nodeToString(Node node, boolean includeHeadNode) { protected String nodeToString(Node node, boolean includeHeadNode) {
if (node == null) if (node == null) {
return null; return null;
}
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
try { try {
Transformer t = TransformerFactory.newInstance().newTransformer(); Transformer t = TransformerFactory.newInstance().newTransformer();
......
...@@ -66,14 +66,18 @@ public class AliasCollectionXmlParserTest extends CellDesignerTestFunctions { ...@@ -66,14 +66,18 @@ public class AliasCollectionXmlParserTest extends CellDesignerTestFunctions {
Species aliasSa10 = null; Species aliasSa10 = null;
Species aliasSa11 = null; Species aliasSa11 = null;
for (Species alias : list) { for (Species alias : list) {
if (alias.getElementId().equals("sa8")) if (alias.getElementId().equals("sa8")) {
aliasSa8 = alias; aliasSa8 = alias;
if (alias.getElementId().equals("sa9")) }
if (alias.getElementId().equals("sa9")) {
aliasSa9 = alias; aliasSa9 = alias;
if (alias.getElementId().equals("sa10")) }
if (alias.getElementId().equals("sa10")) {
aliasSa10 = alias; aliasSa10 = alias;
if (alias.getElementId().equals("sa11")) }
if (alias.getElementId().equals("sa11")) {
aliasSa11 = alias; aliasSa11 = alias;
}
} }
assertNotNull(aliasSa8); assertNotNull(aliasSa8);
assertNotNull(aliasSa9); assertNotNull(aliasSa9);
...@@ -165,12 +169,15 @@ public class AliasCollectionXmlParserTest extends CellDesignerTestFunctions { ...@@ -165,12 +169,15 @@ public class AliasCollectionXmlParserTest extends CellDesignerTestFunctions {
Complex aliasSa2 = null; Complex aliasSa2 = null;
Complex aliasSa3 = null; Complex aliasSa3 = null;
for (Complex alias : list) { for (Complex alias : list) {
if (alias.getElementId().equals("csa1")) if (alias.getElementId().equals("csa1")) {
aliasSa1 = alias; aliasSa1 = alias;
if (alias.getElementId().equals("csa2")) }
if (alias.getElementId().equals("csa2")) {
aliasSa2 = alias; aliasSa2 = alias;
if (alias.getElementId().equals("csa3")) }
if (alias.getElementId().equals("csa3")) {
aliasSa3 = alias; aliasSa3 = alias;
}
} }
assertNotNull(aliasSa1); assertNotNull(aliasSa1);
assertNotNull(aliasSa2); assertNotNull(aliasSa2);
...@@ -196,12 +203,15 @@ public class AliasCollectionXmlParserTest extends CellDesignerTestFunctions { ...@@ -196,12 +203,15 @@ public class AliasCollectionXmlParserTest extends CellDesignerTestFunctions {
Complex aliasSa2 = null; Complex aliasSa2 = null;
Complex aliasSa3 = null; Complex aliasSa3 = null;
for (Complex alias : list) { for (Complex alias : list) {
if (alias.getElementId().equals("csa1")) if (alias.getElementId().equals("csa1")) {
aliasSa1 = alias; aliasSa1 = alias;
if (alias.getElementId().equals("csa2")) }
if (alias.getElementId().equals("csa2")) {
aliasSa2 = alias; aliasSa2 = alias;
if (alias.getElementId().equals("csa3")) }
if (alias.getElementId().equals("csa3")) {
aliasSa3 = alias; aliasSa3 = alias;
}
} }
assertNotNull(aliasSa1); assertNotNull(aliasSa1);
assertNotNull(aliasSa2); assertNotNull(aliasSa2);
...@@ -243,12 +253,15 @@ public class AliasCollectionXmlParserTest extends CellDesignerTestFunctions { ...@@ -243,12 +253,15 @@ public class AliasCollectionXmlParserTest extends CellDesignerTestFunctions {
Compartment aliasCa2 = null; Compartment aliasCa2 = null;
Compartment aliasCa3 = null; Compartment aliasCa3 = null;
for (Compartment alias : list) { for (Compartment alias : list) {
if (alias.getElementId().equals("ca1")) if (alias.getElementId().equals("ca1")) {
aliasCa1 = alias; aliasCa1 = alias;
if (alias.getElementId().equals("ca2")) }
if (alias.getElementId().equals("ca2")) {
aliasCa2 = alias; aliasCa2 = alias;
if (alias.getElementId().equals("ca3")) }
if (alias.getElementId().equals("ca3")) {
aliasCa3 = alias; aliasCa3 = alias;
}
} }
assertNotNull(aliasCa1); assertNotNull(aliasCa1);
assertNotNull(aliasCa2); assertNotNull(aliasCa2);
......
...@@ -239,8 +239,9 @@ public class ReactionParserTests extends CellDesignerTestFunctions { ...@@ -239,8 +239,9 @@ public class ReactionParserTests extends CellDesignerTestFunctions {
assertEquals(1, reactant.getLine().getLines().size()); assertEquals(1, reactant.getLine().getLines().size());
NodeOperator operator = null; NodeOperator operator = null;
for (NodeOperator operator2 : reaction.getOperators()) { for (NodeOperator operator2 : reaction.getOperators()) {
if (operator2 instanceof SplitOperator) if (operator2 instanceof SplitOperator) {
operator = operator2; operator = operator2;
}
} }
assertEquals(LineType.DASH_DOT_DOT, operator.getLine().getType()); assertEquals(LineType.DASH_DOT_DOT, operator.getLine().getType());
...@@ -361,8 +362,9 @@ public class ReactionParserTests extends CellDesignerTestFunctions { ...@@ -361,8 +362,9 @@ public class ReactionParserTests extends CellDesignerTestFunctions {
assertEquals(2, model.getReactions().size()); assertEquals(2, model.getReactions().size());
Reaction reaction = null; Reaction reaction = null;
for (Reaction reaction2 : model.getReactions()) { for (Reaction reaction2 : model.getReactions()) {
if (reaction2.getIdReaction().equals("re1")) if (reaction2.getIdReaction().equals("re1")) {
reaction = reaction2; reaction = reaction2;
}
} }
assertTrue(reaction instanceof DissociationReaction); assertTrue(reaction instanceof DissociationReaction);
assertEquals(1, reaction.getReactants().size()); assertEquals(1, reaction.getReactants().size());
...@@ -396,8 +398,9 @@ public class ReactionParserTests extends CellDesignerTestFunctions { ...@@ -396,8 +398,9 @@ public class ReactionParserTests extends CellDesignerTestFunctions {
assertEquals(2, model.getReactions().size()); assertEquals(2, model.getReactions().size());
Reaction reaction = null; Reaction reaction = null;
for (Reaction reaction2 : model.getReactions()) { for (Reaction reaction2 : model.getReactions()) {
if (reaction2.getIdReaction().equals("re1")) if (reaction2.getIdReaction().equals("re1")) {
reaction = reaction2; reaction = reaction2;
}
} }
assertTrue(reaction instanceof DissociationReaction); assertTrue(reaction instanceof DissociationReaction);
assertEquals(2, reaction.getReactants().size()); assertEquals(2, reaction.getReactants().size());
...@@ -548,10 +551,12 @@ public class ReactionParserTests extends CellDesignerTestFunctions { ...@@ -548,10 +551,12 @@ public class ReactionParserTests extends CellDesignerTestFunctions {
Reaction reaction1 = null; Reaction reaction1 = null;
Reaction reaction2 = null; Reaction reaction2 = null;
for (Reaction reaction : model.getReactions()) { for (Reaction reaction : model.getReactions()) {
if (reaction.getIdReaction().equals("re2")) if (reaction.getIdReaction().equals("re2")) {
reaction1 = reaction; reaction1 = reaction;
if (reaction.getIdReaction().equals("re3")) }
if (reaction.getIdReaction().equals("re3")) {
reaction2 = reaction; reaction2 = reaction;
}
} }
Reactant reactant = reaction1.getReactants().get(0); Reactant reactant = reaction1.getReactants().get(0);
Element alias1 = reaction1.getReactants().get(0).getElement(); Element alias1 = reaction1.getReactants().get(0).getElement();
...@@ -577,8 +582,9 @@ public class ReactionParserTests extends CellDesignerTestFunctions { ...@@ -577,8 +582,9 @@ public class ReactionParserTests extends CellDesignerTestFunctions {
Model model = getModelForFile("testFiles/reactions/problemWithAnchors3.xml"); Model model = getModelForFile("testFiles/reactions/problemWithAnchors3.xml");
Reaction reaction = null; Reaction reaction = null;
for (Reaction reaction2 : model.getReactions()) { for (Reaction reaction2 : model.getReactions()) {
if (reaction2.getIdReaction().equals("re3")) if (reaction2.getIdReaction().equals("re3")) {
reaction = reaction2; reaction = reaction2;
}
} }
Point2D point = new Point2D.Double(164.85583789974368, 86.060142902597); Point2D point = new Point2D.Double(164.85583789974368, 86.060142902597);
Point2D point2 = new Point2D.Double(397.06477630152193, 284.99999999999994); Point2D point2 = new Point2D.Double(397.06477630152193, 284.99999999999994);
......
...@@ -257,10 +257,12 @@ public class SpeciesCollectionXmlParserTest extends CellDesignerTestFunctions { ...@@ -257,10 +257,12 @@ public class SpeciesCollectionXmlParserTest extends CellDesignerTestFunctions {
int complexes = 0; int complexes = 0;
int proteins = 0; int proteins = 0;
for (Pair<String, ? extends CellDesignerSpecies<?>> species : list) { for (Pair<String, ? extends CellDesignerSpecies<?>> species : list) {
if (species.getRight() instanceof CellDesignerComplexSpecies) if (species.getRight() instanceof CellDesignerComplexSpecies) {
complexes++; complexes++;
if (species.getRight() instanceof CellDesignerProtein) }
if (species.getRight() instanceof CellDesignerProtein) {
proteins++; proteins++;
}
} }
assertEquals(1, complexes); assertEquals(1, complexes);
assertEquals(2, proteins); assertEquals(2, proteins);
......
...@@ -82,7 +82,7 @@ public abstract class CompartmentConverter<T extends Compartment> extends Elemen ...@@ -82,7 +82,7 @@ public abstract class CompartmentConverter<T extends Compartment> extends Elemen
*/ */
protected CompartmentConverter(ColorExtractor colorExtractor) { protected CompartmentConverter(ColorExtractor colorExtractor) {
super(colorExtractor); super(colorExtractor);
}; }
/** /**
* @return the alphaLevel * @return the alphaLevel
......
...@@ -123,7 +123,7 @@ public abstract class SpeciesConverter<T extends Species> extends ElementConvert ...@@ -123,7 +123,7 @@ public abstract class SpeciesConverter<T extends Species> extends ElementConvert
*/ */
protected SpeciesConverter(ColorExtractor colorExtractor) { protected SpeciesConverter(ColorExtractor colorExtractor) {
super(colorExtractor); super(colorExtractor);
}; }
/** /**
* Returns default shape of the {@link Species}. * Returns default shape of the {@link Species}.
......
...@@ -142,8 +142,9 @@ public abstract class ConverterTestFunctions { ...@@ -142,8 +142,9 @@ public abstract class ConverterTestFunctions {
} }
protected String nodeToString(Node node, boolean includeHeadNode) { protected String nodeToString(Node node, boolean includeHeadNode) {
if (node == null) if (node == null) {
return null; return null;
}
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
try { try {
Transformer t = TransformerFactory.newInstance().newTransformer(); Transformer t = TransformerFactory.newInstance().newTransformer();
......
...@@ -62,10 +62,12 @@ public class Privilege implements Serializable { ...@@ -62,10 +62,12 @@ public class Privilege implements Serializable {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o) {
return true; return true;
if (!(o instanceof Privilege)) }
if (!(o instanceof Privilege)) {
return false; return false;
}
Privilege that = (Privilege) o; Privilege that = (Privilege) o;
return type == that.type return type == that.type
&& Objects.equals(objectId, that.objectId); && Objects.equals(objectId, that.objectId);
......
...@@ -53,8 +53,9 @@ public class MiriamTypeGenericTest extends ModelTestFunctions { ...@@ -53,8 +53,9 @@ public class MiriamTypeGenericTest extends ModelTestFunctions {
boolean deprecated = false; boolean deprecated = false;
try { try {
Field f = MiriamType.class.getField(mt.name()); Field f = MiriamType.class.getField(mt.name());
if (f.isAnnotationPresent(clazz)) if (f.isAnnotationPresent(clazz)) {
deprecated = true; deprecated = true;
}
} catch (NoSuchFieldException | SecurityException e) { } catch (NoSuchFieldException | SecurityException e) {
} }
return deprecated; return deprecated;
......
...@@ -86,8 +86,9 @@ public class ElementUtilsTest extends ModelTestFunctions { ...@@ -86,8 +86,9 @@ public class ElementUtilsTest extends ModelTestFunctions {
throw new InvalidArgumentException(); throw new InvalidArgumentException();
} }
String tmp = ""; String tmp = "";
for (int i = 0; i < indent; i++) for (int i = 0; i < indent; i++) {
tmp += " "; tmp += " ";
}
logger.debug(tmp + top.getCommonName()); logger.debug(tmp + top.getCommonName());
for (ClassTreeNode node : top.getChildren()) { for (ClassTreeNode node : top.getChildren()) {
print(node, indent + 1); print(node, indent + 1);
......
...@@ -1129,8 +1129,9 @@ public class ModelContructor { ...@@ -1129,8 +1129,9 @@ public class ModelContructor {
Integer result = null; Integer result = null;
for (Species species : allChildren) { for (Species species : allChildren) {
if (species.getZ() != null) { if (species.getZ() != null) {
if (result == null) if (result == null) {
result = species.getZ(); result = species.getZ();
}
result = Math.min(result, species.getZ()); result = Math.min(result, species.getZ());
} }
} }
......
...@@ -333,8 +333,9 @@ class ReactionLayoutFinder { ...@@ -333,8 +333,9 @@ class ReactionLayoutFinder {
private boolean pointOnPolyline(PolylineData line, Point2D point) { private boolean pointOnPolyline(PolylineData line, Point2D point) {
// point cannot be on the edge // point cannot be on the edge
if (line.getStartPoint().distance(point) <= Configuration.EPSILON || if (line.getStartPoint().distance(point) <= Configuration.EPSILON ||
line.getEndPoint().distance(point) <= Configuration.EPSILON) line.getEndPoint().distance(point) <= Configuration.EPSILON) {
return false; return false;
}
for (Line2D l : line.getLines()) { for (Line2D l : line.getLines()) {
if (lt.distBetweenPointAndLineSegment(l, point) <= Configuration.EPSILON) { if (lt.distBetweenPointAndLineSegment(l, point) <= Configuration.EPSILON) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment