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