Commit 99aad31b authored by Piotr Gawron's avatar Piotr Gawron
Browse files

whitespace formatting enforced

parent d45494b4
......@@ -110,7 +110,7 @@ public final class ApplicationLevelCache implements QueryCacheInterface {
public synchronized void clearCache() {
logger.info("Clearing application cache");
cachedQueryNodes = new HashMap<>();
cachedQueryString= new HashMap<>();
cachedQueryString = new HashMap<>();
}
@Override
......
......@@ -69,8 +69,8 @@ public class PubmedParser extends CachableInterface implements IExternalService
private Logger logger = LogManager.getLogger();
/**
* Object that allows to serialize {@link Article} elements into xml string and
* deserialize xml into {@link Article} objects.
* Object that allows to serialize {@link Article} elements into xml string
* and deserialize xml into {@link Article} objects.
*/
private XmlSerializer<Article> articleSerializer;
......@@ -141,7 +141,7 @@ public class PubmedParser extends CachableInterface implements IExternalService
logger.debug("Pubmed article (id=" + id + ") not found in cache. Accessing WebService...");
}
result = new Article(id+"");
result = new Article(id + "");
try {
String url = API_URL + "search/resulttype=core&query="
+ java.net.URLEncoder.encode("src:med ext_id:" + id, "UTF-8");
......
......@@ -48,9 +48,9 @@ public class ChemicalTargetDtoConverter {
MiriamData md = MiriamType.getMiriamDataFromPrefixIdentifier(identifier);
result.addReference(md);
}
if (result.getGenes().size()>1) {
if (result.getGenes().size() > 1) {
result.setType(TargetType.PROTEIN_FAMILY);
} else if (result.getGenes().size()==1) {
} else if (result.getGenes().size() == 1) {
result.setType(TargetType.SINGLE_PROTEIN);
} else {
result.setType(TargetType.OTHER);
......
......@@ -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"/>
......@@ -114,7 +114,7 @@
<message key="ws.notPreceded"
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
</module>
<module name="OneStatementPerLine"/>
<!-- <module name="OneStatementPerLine"/>
<module name="MultipleVariableDeclarations"/>
<module name="ArrayTypeStyle"/>
<module name="MissingSwitchDefault"/>
......
......@@ -66,7 +66,7 @@ public class DrugCellDesignerAliasConverter extends AbstractCellDesignerAliasCon
double width = alias.getWidth();
double height = alias.getHeight();
double cutSize = width*1/5;
double cutSize = width * 1 / 5;
// CHECKSTYLE:OFF
list.add(new Point2D.Double(x, y + height / 2));
......
......@@ -56,8 +56,8 @@ public class PhenotypeCellDesignerAliasConverter extends AbstractCellDesignerAli
double y = alias.getY();
double width = alias.getWidth();
double height = alias.getHeight();
double cutSize = Math.min(width, height)/2;
double cutSize = Math.min(width, height) / 2;
// CHECKSTYLE:OFF
list.add(new Point2D.Double(x, y + height / 2));
......
......@@ -65,8 +65,8 @@ public class ReactionToXml {
private static Logger logger = LogManager.getLogger();
/**
* Helper object used for manipulation on the point coordinates in CellDesigner
* format.
* Helper object used for manipulation on the point coordinates in
* CellDesigner format.
*/
private CellDesignerPointTransformation pointTransformation = new CellDesignerPointTransformation();
......@@ -77,8 +77,8 @@ public class ReactionToXml {
private CellDesignerLineTransformation lineTransformation = new CellDesignerLineTransformation();
/**
* Collection of {@link CellDesignerElement cell designer elements} parsed from
* xml.
* Collection of {@link CellDesignerElement cell designer elements} parsed
* from xml.
*/
private CellDesignerElementCollection elements;
......@@ -528,18 +528,22 @@ public class ReactionToXml {
String getCellDesignerReactionTypeString(Reaction reaction) {
for (NodeOperator operator : reaction.getOperators()) {
// in cell designer and operator can be mapped both as boolean logic gate and
// normal reaction, but reactions with any other operator type must be exported
// in cell designer and operator can be mapped both as boolean logic gate
// and
// normal reaction, but reactions with any other operator type must be
// exported
// to BOOLEAN_LOGIC_GATE
if (!(operator instanceof AndOperator || operator instanceof AssociationOperator
|| !operator.isReactantOperator())) {
return "BOOLEAN_LOGIC_GATE";
} else if (operator instanceof AndOperator && operator.isReactantOperator()
&& reaction instanceof ReducedNotation) {
// check the geometry - we might need to use BOOLEAN_LOGIC_GATE if the joining
// check the geometry - we might need to use BOOLEAN_LOGIC_GATE if the
// joining
// point is not colinear with first reactant line and operator line
AbstractNode firstReactant = operator.getInputs().get(0);
// if we have operator then take operator as input checking colinear points
// if we have operator then take operator as input checking colinear
// points
for (AbstractNode node : operator.getInputs()) {
if (node instanceof NodeOperator) {
firstReactant = node;
......@@ -549,7 +553,7 @@ public class ReactionToXml {
PolylineData inputLine = firstReactant.getLine();
PolylineData operatorLine = operator.getLine();
double dist = lineTransformation.distBetweenPointAndLineSegment(
inputLine.getLines().get(inputLine.getLines().size() -1).getP1(), operatorLine.getLines().get(0).getP2(),
inputLine.getLines().get(inputLine.getLines().size() - 1).getP1(), operatorLine.getLines().get(0).getP2(),
operatorLine.getLines().get(0).getP1());
if (dist > Configuration.EPSILON) {
......@@ -604,7 +608,7 @@ public class ReactionToXml {
result.append("<celldesigner:connectScheme connectPolicy=\"direct\">\n");
result.append("<celldesigner:listOfLineDirection>\n");
for (int i = 0; i < product.getLine().getLines().size() ; i++) {
for (int i = 0; i < product.getLine().getLines().size(); i++) {
result.append("<celldesigner:lineDirection index=\"" + i + "\" value=\"unknown\"/>\n");
}
result.append("</celldesigner:listOfLineDirection>\n");
......@@ -747,8 +751,8 @@ public class ReactionToXml {
* Creates valid xml node with connectScheme for the set of lines.
*
* @param lines
* list of lines to be included in connectScheme. As far as I remember
* only one or three lines could be provided.
* list of lines to be included in connectScheme. As far as I
* remember only one or three lines could be provided.
* @return xml node with connectScheme
*/
String getConnectSchemeXmlStringForLines(PolylineData[] lines) {
......@@ -764,7 +768,7 @@ public class ReactionToXml {
arm = " arm\"" + armId + "\" ";
armId++;
}
for (int i = 0; i < line.getLines().size() ; i++) {
for (int i = 0; i < line.getLines().size(); i++) {
sb.append("<celldesigner:lineDirection " + arm + " index=\"" + i + "\" value=\"unknown\"/>\n");
}
}
......@@ -880,7 +884,7 @@ public class ReactionToXml {
Reactant reactant = reaction.getReactants().get(0);
Product product1 = reaction.getProducts().get(0);
Product product2 = reaction.getProducts().get(1);
for (Line2D line: reactant.getLine().getLines()) {
for (Line2D line : reactant.getLine().getLines()) {
points.add(line.getP1());
}
......@@ -902,7 +906,7 @@ public class ReactionToXml {
}
}
if (process) {
for (int i = operator.getLine().getLines().size()-1; i >= 0; i--) {
for (int i = operator.getLine().getLines().size() - 1; i >= 0; i--) {
points.add(operator.getLine().getLines().get(i).getP1());
}
}
......@@ -941,7 +945,7 @@ public class ReactionToXml {
}
}
if (process) {
for (Line2D line:operator.getLine().getLines()) {
for (Line2D line : operator.getLine().getLines()) {
points.add(line.getP1());
}
}
......@@ -949,7 +953,7 @@ public class ReactionToXml {
}
Product product = reaction.getProducts().get(0);
PolylineData productLine = getLineBeforeTrimming(product);
for (Line2D line: productLine.getLines()) {
for (Line2D line : productLine.getLines()) {
points.add(line.getP2());
}
......@@ -1000,15 +1004,15 @@ public class ReactionToXml {
testLine.addLine(reactant.getLine().getLines().get(reactant.getLine().getLines().size() - 1));
testLine.addLine(reactant.getLine().getEndPoint(), productLine.getStartPoint());
testLine.addLine(productLine.getLines().get(0));
testLine = PolylineDataFactory.removeCollinearPoints(testLine);
if (testLine.getLines().size() > 1) {
points.add(reactant.getLine().getEndPoint());
centerPosition++;
points.add(productLine.getStartPoint());
}
for (Line2D line: productLine.getLines()) {
for (Line2D line : productLine.getLines()) {
points.add(line.getP2());
}
......
......@@ -345,7 +345,7 @@ public class ComplexParserTests extends CellDesignerTestFunctions {
public void testParseCompactComplex() throws Exception {
Model model = getModelForFile("testFiles/complex_compact.xml");
assertTrue(model.getElementByElementId("sa6").getX()>218);
assertTrue(model.getElementByElementId("sa6").getX() > 218);
}
}
......@@ -38,7 +38,7 @@ public class SbmlValidationTests extends CellDesignerTestFunctions {
String filename;
public SbmlValidationTests(String filename, Model model) {
this.filename= filename;
this.filename = filename;
this.model = model;
}
......@@ -74,7 +74,7 @@ public class SbmlValidationTests extends CellDesignerTestFunctions {
public void testIsValidSbml() throws Exception {
CellDesignerXmlParser parser = new CellDesignerXmlParser();
String xml = parser.model2String(model);
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost uploadFile = new HttpPost("http://sbml.org/validator/");
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
......
......@@ -33,8 +33,8 @@ public class PhenotypeConverter extends SpeciesConverter<Phenotype> {
* Default constructor.
*
* @param colorExtractor
* Object that helps to convert {@link ColorSchema} values into colors
* when drawing elements
* Object that helps to convert {@link ColorSchema} values into
* colors when drawing elements
*
*/
public PhenotypeConverter(ColorExtractor colorExtractor) {
......@@ -69,21 +69,21 @@ public class PhenotypeConverter extends SpeciesConverter<Phenotype> {
protected GeneralPath getShape(final Phenotype phenotype) {
// CHECKSTYLE:OFF
GeneralPath path = new GeneralPath(Path2D.WIND_EVEN_ODD, 6);
double x = phenotype.getX();
double y = phenotype.getY();
double width = phenotype.getWidth();
double height = phenotype.getHeight();
double cutSize = Math.min(width, height)/2;
double cutSize = Math.min(width, height) / 2;
path.moveTo(x, y + height / 2);
path.lineTo(x + cutSize, y);
path.lineTo(x + width - cutSize, y);
path.lineTo(x + width, y + height / 2);
path.lineTo(x + width - cutSize, y + height);
path.lineTo(x + cutSize, y + height);
// CHECKSTYLE:ON
path.closePath();
return path;
......
......@@ -63,8 +63,8 @@ public class MoveCommand extends ModelCommand {
for (Element element : model.getElements()) {
element.setX(element.getX() + dx);
element.setY(element.getY() + dy);
element.setNameX(element.getNameX()+dx);
element.setNameY(element.getNameY()+dy);
element.setNameX(element.getNameX() + dx);
element.setNameY(element.getNameY() + dy);
if (element instanceof SpeciesWithModificationResidue) {
for (ModificationResidue mr : ((SpeciesWithModificationResidue) element).getModificationResidues()) {
double x = mr.getPosition().getX() + dx;
......@@ -83,12 +83,12 @@ public class MoveCommand extends ModelCommand {
}
for (Reaction reaction : model.getReactions()) {
for (AbstractNode node : reaction.getNodes()) {
for (int i=0; i< node.getLine().getLines().size();i++) {
for (int i = 0; i < node.getLine().getLines().size(); i++) {
Line2D line = node.getLine().getLines().get(i);
node.getLine().setLine(i, line.getX1() + dx, line.getY1() + dy, line.getX2() + dx, line.getY2() + dy);
}
}
for (int i=0; i< reaction.getLine().getLines().size();i++) {
for (int i = 0; i < reaction.getLine().getLines().size(); i++) {
Line2D line = reaction.getLine().getLines().get(i);
reaction.getLine().setLine(i, line.getX1() + dx, line.getY1() + dy, line.getX2() + dx, line.getY2() + dy);
}
......
......@@ -184,7 +184,7 @@ public class MoveElementsCommand extends ModelCommand {
}
private void moveNode(AbstractNode node) {
for (int i=0; i< node.getLine().getLines().size();i++) {
for (int i = 0; i < node.getLine().getLines().size(); i++) {
Line2D line = node.getLine().getLines().get(i);
node.getLine().setLine(i, line.getX1() + dx, line.getY1() + dy, line.getX2() + dx, line.getY2() + dy);
}
......
......@@ -39,8 +39,8 @@ public class MergeCommandTest extends CommandTestFunctions {
List<Model> models = new ArrayList<>();
Model result = new MergeCommand(models).execute();
assertTrue(result.getWidth()>0);
assertTrue(result.getHeight()>0);
assertTrue(result.getWidth() > 0);
assertTrue(result.getHeight() > 0);
}
}
......@@ -47,7 +47,7 @@ public abstract class FileEntry implements Serializable {
/**
* Original name of the file.
*/
@Column(length=255)
@Column(length = 255)
private String originalFileName;
/**
......
......@@ -7,7 +7,7 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(value={FIELD})
@Target(value = { FIELD })
public @interface NoMiriamUrn {
}
......@@ -39,10 +39,10 @@ public class SbmlParameter implements Serializable, SbmlArgument {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column(length=255)
@Column(length = 255)
private String parameterId;
@Column(length=255)
@Column(length = 255)
private String name;
private Double value;
......
......@@ -60,13 +60,13 @@ public class Layer implements Serializable {
/**
* Layer identifier (unique in single model).
*/
@Column(length=255)
@Column(length = 255)
private String layerId;
/**
* Layer name.
*/
@Column(length=255)
@Column(length = 255)
private String name;
/**
......
......@@ -58,32 +58,33 @@ public abstract class Species extends Element {
private Double lineWidth;
/**
* State of the element visualization (should the inside be presented in details
* or not). TODO this should be transformed into enum
* State of the element visualization (should the inside be presented in
* details or not). TODO this should be transformed into enum
*/
@Column(length = 255)
private String state;
/**
* State (free text describing element in some way) of the element is split into
* {@link #statePrefix prefix} and {@link #stateLabel label}. This value
* State (free text describing element in some way) of the element is split
* into {@link #statePrefix prefix} and {@link #stateLabel label}. This value
* represent the first part of the state.
*/
@Column(length = 255)
private String statePrefix;
/**
* State (free text describing element in some way) of the element is split into
* {@link #statePrefix prefix} and {@link #stateLabel label}. This value
* State (free text describing element in some way) of the element is split
* into {@link #statePrefix prefix} and {@link #stateLabel label}. This value
* represent the second part of the state.
*/
@Column(length = 255)
private String stateLabel;
/**
* Complex to which this element belongs to. Null if such complex doesn't exist.
* Complex to which this element belongs to. Null if such complex doesn't
* exist.
*/
@ManyToOne(fetch=FetchType.LAZY)
@ManyToOne(fetch = FetchType.LAZY)
@Cascade({ CascadeType.ALL })
@JoinColumn(name = "idcomplexdb")
private Complex complex;
......@@ -138,16 +139,17 @@ public abstract class Species extends Element {
/**
* SBML allows to store substanceUnit as either basic SI unit type or complex
* unit definition. To map it properly to database we need to separate the type
* into two properties. This property is responsible for basic SI unit type.
* unit definition. To map it properly to database we need to separate the
* type into two properties. This property is responsible for basic SI unit
* type.
*/
@Enumerated(EnumType.STRING)
private SbmlUnitType substanceUnitRawType;
/**
* SBML allows to store substanceUnit as either basic SI unit type or complex
* unit definition. To map it properly to database we need to separate the type
* into two properties. This property is responsible for complex unit
* unit definition. To map it properly to database we need to separate the
* type into two properties. This property is responsible for complex unit
* definition.
*/
@ManyToOne
......
......@@ -34,7 +34,7 @@ public class StructuralStateComparator extends Comparator<StructuralState> {
public StructuralStateComparator(double epsilon) {
super(StructuralState.class);
this.epsilon=epsilon;
this.epsilon = epsilon;
}
@Override
......
......@@ -71,16 +71,16 @@ public class User implements Serializable {
/**
* User defined color overriding system
* {@link ConfigurationElementType#NEUTRAL_COLOR_VAL}. Used for coloring neutral
* values (0) in overlays.
* {@link ConfigurationElementType#NEUTRAL_COLOR_VAL}. Used for coloring
* neutral values (0) in overlays.
*/
@Type(type = "lcsb.mapviewer.persist.mapper.ColorMapper")
private Color neutralColor;
/**
* User defined color overriding system
* {@link ConfigurationElementType#SIMPLE_COLOR_VAL}. Used for coloring overlays
* without values and colors.
* {@link ConfigurationElementType#SIMPLE_COLOR_VAL}. Used for coloring
* overlays without values and colors.
*/
@Type(type = "lcsb.mapviewer.persist.mapper.ColorMapper")
private Color simpleColor;
......@@ -188,7 +188,7 @@ public class User implements Serializable {
public void setAnnotationSchema(UserAnnotationSchema annotationSchema) {
this.annotationSchema = annotationSchema;
if (annotationSchema!=null && !this.equals(annotationSchema.getUser())) {
if (annotationSchema != null && !this.equals(annotationSchema.getUser())) {
annotationSchema.setUser(this);
}
}
......
......@@ -1160,7 +1160,7 @@ public class ReactionGpmlInputToModelTest extends WikipathwaysTestFunctions {
Reaction r = model1.getReactionByReactionId("eff08");
r.getLine().setColor(Color.BLUE);
Line2D line = r.getProducts().get(0).getLine().getLines().get(r.getProducts().get(0).getLine().getLines().size()-1);
Line2D line = r.getProducts().get(0).getLine().getLines().get(r.getProducts().get(0).getLine().getLines().size() - 1);
assertTrue("End points shouldn't be too close",
line.getP1().distance(line.getP2()) > 0);
}
......
......@@ -51,18 +51,18 @@ public class ArticleDao extends BaseDao<Article> {
for (ArticleProperty property : filter.keySet()) {
Object value = filter.get(property);
switch (property) {
case MODEL:
query.setParameter("maps", value);
break;
case TEXT:
String text = ((String) value);
query.setParameter("search_text", "%" + text.toLowerCase() + "%");
if (StringUtils.isNumeric(text)) {
query.setParameter("search_integer", Integer.valueOf(text));
}
break;
default:
throw new NotImplementedException("Filtering by property not implemented: " + property);
case MODEL:
query.setParameter("maps", value);
break;
case TEXT:
String text = ((String) value);
query.setParameter("search_text", "%" + text.toLowerCase() + "%");
if (StringUtils.isNumeric(text)) {
query.setParameter("search_integer", Integer.valueOf(text));
}
break;
default:
throw new NotImplementedException("Filtering by property not implemented: " + property);
}
}
}
......@@ -74,11 +74,11 @@ public class ArticleDao extends BaseDao<Article> {
for (ArticleProperty property : filter.keySet()) {
switch (property) {
case MODEL:
statements.add(getJoinedMapWhereClause());
break;
default:
throw new NotImplementedException("Filtering by property not implemented: " + property);
case MODEL:
statements.add(getJoinedMapWhereClause());
break;
default:
throw new NotImplementedException("Filtering by property not implemented: " + property);
}
}
......@@ -88,10 +88,10 @@ public class ArticleDao extends BaseDao<Article> {
private String getJoinsForMissingFilter(Map<ArticleProperty, Object> filter) {
for (ArticleProperty property : filter.keySet()) {
switch (property) {
case MODEL:
break;