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

indentation issues

parent b5f1c021
......@@ -74,22 +74,22 @@ public class CopyPastePlugin extends CellDesignerPlugin {
return new KeyEventDispatcher() {
public boolean dispatchKeyEvent(final KeyEvent e) {
switch (e.getID()) {
case KeyEvent.KEY_PRESSED:
if (e.getKeyCode() == java.awt.event.KeyEvent.VK_V
&& e.isControlDown()
&& e.isAltDown()) {
getPastePluginAction().myActionPerformed(null);
return true;
} else if (e.getKeyCode() == java.awt.event.KeyEvent.VK_C
&& e.isControlDown()
&& e.isAltDown()) {
getCopyPluginAction().myActionPerformed(null);
return true;
} else {
case KeyEvent.KEY_PRESSED:
if (e.getKeyCode() == java.awt.event.KeyEvent.VK_V
&& e.isControlDown()
&& e.isAltDown()) {
getPastePluginAction().myActionPerformed(null);
return true;
} else if (e.getKeyCode() == java.awt.event.KeyEvent.VK_C
&& e.isControlDown()
&& e.isAltDown()) {
getCopyPluginAction().myActionPerformed(null);
return true;
} else {
return false;
}
default:
return false;
}
default:
return false;
}
}
};
......
......@@ -92,7 +92,8 @@ public abstract class ElementAnnotator extends CachableInterface {
* @param element
* object to be annotated
* @throws AnnotatorException
* thrown when there is a problem with annotating not related to data
* thrown when there is a problem with annotating not related to
* data
*/
public void annotateElement(final BioEntity element) throws AnnotatorException {
annotateElement(element, createAnnotatorData());
......@@ -107,7 +108,8 @@ public abstract class ElementAnnotator extends CachableInterface {
* list of parameters passed to the annotator which is expected to be
* in the same order as its {@link this#parameterDefs}
* @throws AnnotatorException
* thrown when there is a problem with annotating not related to data
* thrown when there is a problem with annotating not related to
* data
*/
public final void annotateElement(final BioEntity bioEntity, final AnnotatorData parameters) throws AnnotatorException {
if (isAnnotatable(bioEntity)) {
......@@ -161,8 +163,8 @@ public abstract class ElementAnnotator extends CachableInterface {
}
/**
* Returns <code>true</code> if this annotator can annotate the object given in
* the parameter.
* Returns <code>true</code> if this annotator can annotate the object given
* in the parameter.
*
* @param object
* object to be tested if can be annotated
......@@ -214,7 +216,8 @@ public abstract class ElementAnnotator extends CachableInterface {
}
/**
* Returns list with definitions of the parameters available for this annotator.
* Returns list with definitions of the parameters available for this
* annotator.
*
* @return the parameters {@link AnnotatorParamDefinition} list
*/
......@@ -233,8 +236,8 @@ public abstract class ElementAnnotator extends CachableInterface {
}
/**
* Returns <code>true</code> if this annotator can annotate the object of given
* class type.
* Returns <code>true</code> if this annotator can annotate the object of
* given class type.
*
* @param clazz
* class to be tested if can be annotated
......@@ -688,68 +691,68 @@ public abstract class ElementAnnotator extends CachableInterface {
return collection;
} else {
switch (output.getField()) {
case ABBREVIATION:
return originalBioEntity.getAbbreviation();
case CHARGE:
if (originalBioEntity instanceof Species) {
return ((Species) originalBioEntity).getCharge();
} else {
return null;
}
case DESCRIPTION:
return originalBioEntity.getNotes();
case FORMULA:
return originalBioEntity.getFormula();
case FULL_NAME:
if (originalBioEntity instanceof Element) {
return ((Element) originalBioEntity).getFullName();
} else {
return null;
}
case INCHI:
if (originalBioEntity instanceof Chemical) {
return ((Chemical) originalBioEntity).getInChI();
} else {
return null;
}
case INCHI_KEY:
if (originalBioEntity instanceof Chemical) {
return ((Chemical) originalBioEntity).getInChIKey();
} else {
return null;
}
case NAME:
return originalBioEntity.getName();
case MCS:
if (originalBioEntity instanceof Reaction) {
return ((Reaction) originalBioEntity).getMechanicalConfidenceScore();
} else {
return null;
}
case PREVIOUS_SYMBOLS:
if (originalBioEntity instanceof Element) {
return ((Element) originalBioEntity).getFormerSymbols();
} else {
return null;
}
case SMILE:
if (originalBioEntity instanceof Chemical) {
return ((Chemical) originalBioEntity).getSmiles();
} else {
return null;
}
case SUBSYSTEM:
if (originalBioEntity instanceof Reaction) {
return ((Reaction) originalBioEntity).getSubsystem();
} else {
return null;
}
case SYMBOL:
return originalBioEntity.getSymbol();
case SYNONYMS:
return originalBioEntity.getSynonyms();
default:
throw new NotImplementedException(output.getField() + "");
case ABBREVIATION:
return originalBioEntity.getAbbreviation();
case CHARGE:
if (originalBioEntity instanceof Species) {
return ((Species) originalBioEntity).getCharge();
} else {
return null;
}
case DESCRIPTION:
return originalBioEntity.getNotes();
case FORMULA:
return originalBioEntity.getFormula();
case FULL_NAME:
if (originalBioEntity instanceof Element) {
return ((Element) originalBioEntity).getFullName();
} else {
return null;
}
case INCHI:
if (originalBioEntity instanceof Chemical) {
return ((Chemical) originalBioEntity).getInChI();
} else {
return null;
}
case INCHI_KEY:
if (originalBioEntity instanceof Chemical) {
return ((Chemical) originalBioEntity).getInChIKey();
} else {
return null;
}
case NAME:
return originalBioEntity.getName();
case MCS:
if (originalBioEntity instanceof Reaction) {
return ((Reaction) originalBioEntity).getMechanicalConfidenceScore();
} else {
return null;
}
case PREVIOUS_SYMBOLS:
if (originalBioEntity instanceof Element) {
return ((Element) originalBioEntity).getFormerSymbols();
} else {
return null;
}
case SMILE:
if (originalBioEntity instanceof Chemical) {
return ((Chemical) originalBioEntity).getSmiles();
} else {
return null;
}
case SUBSYSTEM:
if (originalBioEntity instanceof Reaction) {
return ((Reaction) originalBioEntity).getSubsystem();
} else {
return null;
}
case SYMBOL:
return originalBioEntity.getSymbol();
case SYNONYMS:
return originalBioEntity.getSynonyms();
default:
throw new NotImplementedException(output.getField() + "");
}
}
}
......
......@@ -204,7 +204,7 @@
</module>
<module name="NoFinalizer"/>
<module name="FinalParameters"/>
<!-- <module name="GenericWhitespace">
<module name="GenericWhitespace">
<message key="ws.followed"
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
<message key="ws.preceded"
......@@ -222,7 +222,7 @@
<property name="lineWrappingIndentation" value="4"/>
<property name="arrayInitIndent" value="2"/>
</module>
<module name="AbbreviationAsWordInName">
<!-- <module name="AbbreviationAsWordInName">
<property name="ignoreFinal" value="false"/>
<property name="allowedAbbreviationLength" value="1"/>
<property name="tokens"
......
......@@ -63,24 +63,24 @@ public class LineTransformation {
last = actual;
actual = new Point2D.Double(coordinates[0], coordinates[1]);
switch (type) {
case PathIterator.SEG_MOVETO:
break;
case PathIterator.SEG_LINETO:
break;
case PathIterator.SEG_QUADTO:
break;
case PathIterator.SEG_CUBICTO:
// in case when there is an arc we define only end points of the arc
// as a border
actual = new Point2D.Double(coordinates[SEG_CUBICTO_END_X_COORDINATE_INDEX],
coordinates[SEG_CUBICTO_END_Y_COORDINATE_INDEX]);
break;
case PathIterator.SEG_CLOSE:
actual = first;
break;
default:
break;
case PathIterator.SEG_MOVETO:
break;
case PathIterator.SEG_LINETO:
break;
case PathIterator.SEG_QUADTO:
break;
case PathIterator.SEG_CUBICTO:
// in case when there is an arc we define only end points of the arc
// as a border
actual = new Point2D.Double(coordinates[SEG_CUBICTO_END_X_COORDINATE_INDEX],
coordinates[SEG_CUBICTO_END_Y_COORDINATE_INDEX]);
break;
case PathIterator.SEG_CLOSE:
actual = first;
break;
default:
break;
}
if (first == null) {
first = actual;
......@@ -155,13 +155,15 @@ public class LineTransformation {
}
/**
* Returns a point that is on the line and is as close as possible to the point.
* Returns a point that is on the line and is as close as possible to the
* point.
*
* @param line
* line on which the point should be found
* @param point
* point to which the result should be as close as possible
* @return point on the line that is as close as possible to the parameter point
* @return point on the line that is as close as possible to the parameter
* point
*/
public Point2D closestPointOnSegmentLineToPoint(final Line2D line, final Point2D point) {
Point2D result = closestPointOnSegmentLineToPoint(line.getP1(), line.getP2(), point);
......@@ -169,8 +171,8 @@ public class LineTransformation {
}
/**
* Returns a point that is on the line (v-w) and is as close as possible to the
* point.
* Returns a point that is on the line (v-w) and is as close as possible to
* the point.
*
* @param v
* start of the line segment
......@@ -178,8 +180,8 @@ public class LineTransformation {
* end of the line segment
* @param p
* point to which the result should be as close as possible
* @return point on the line (v-w) that is as close as possible to the parameter
* point
* @return point on the line (v-w) that is as close as possible to the
* parameter point
*/
public Point2D closestPointOnSegmentLineToPoint(final Point2D v, final Point2D w, final Point2D p) {
// Return minimum distance between line segment vw and point p
......
......@@ -50,9 +50,9 @@ public class PointTransformation {
}
/**
* Checks if a point given in the parameter is valid (can be used for drawing).
* The point is considered as valid if coordinates are finite (final NaN and Infinity
* are invalid - they cannot be drawn).
* Checks if a point given in the parameter is valid (can be used for
* drawing). The point is considered as valid if coordinates are finite (final
* NaN and Infinity are invalid - they cannot be drawn).
*
* @param point
* point to check
......@@ -105,24 +105,24 @@ public class PointTransformation {
last = actual;
actual = new Point2D.Double(coordinates[0], coordinates[1]);
switch (type) {
case PathIterator.SEG_MOVETO:
break;
case PathIterator.SEG_LINETO:
break;
case PathIterator.SEG_QUADTO:
break;
case PathIterator.SEG_CUBICTO:
// in case when there is an arc we define only end points of the arc
// as a border
actual = new Point2D.Double(coordinates[LineTransformation.SEG_CUBICTO_END_X_COORDINATE_INDEX],
coordinates[LineTransformation.SEG_CUBICTO_END_Y_COORDINATE_INDEX]);
break;
case PathIterator.SEG_CLOSE:
actual = first;
break;
default:
break;
case PathIterator.SEG_MOVETO:
break;
case PathIterator.SEG_LINETO:
break;
case PathIterator.SEG_QUADTO:
break;
case PathIterator.SEG_CUBICTO:
// in case when there is an arc we define only end points of the arc
// as a border
actual = new Point2D.Double(coordinates[LineTransformation.SEG_CUBICTO_END_X_COORDINATE_INDEX],
coordinates[LineTransformation.SEG_CUBICTO_END_Y_COORDINATE_INDEX]);
break;
case PathIterator.SEG_CLOSE:
actual = first;
break;
default:
break;
}
if (first == null) {
first = actual;
......
......@@ -616,13 +616,13 @@ public class SbgnmlXmlExporter {
}
/**
* Returns glyph with unit of information extracted from the alias or null if no
* unit of information was found.
* Returns glyph with unit of information extracted from the alias or null if
* no unit of information was found.
*
* @param species
* input species
* @return glyph with unit of information extracted from the alias or null if no
* unit of information was found
* @return glyph with unit of information extracted from the alias or null if
* no unit of information was found
*/
private Glyph getUnitOfInformationGlyph(final Species species) {
Glyph uoiGlyph = null;
......@@ -865,12 +865,12 @@ public class SbgnmlXmlExporter {
List<Point2D> pointList = new ArrayList<>();
pointList.add(reaction.getReactants().get(0).getLine().getStartPoint());
for (final Line2D line: reaction.getReactants().get(0).getLine().getLines()) {
for (final Line2D line : reaction.getReactants().get(0).getLine().getLines()) {
pointList.add(line.getP2());
}
pointList.add(reaction.getProducts().get(0).getLine().getStartPoint());
for (final Line2D line: reaction.getProducts().get(0).getLine().getLines()) {
for (final Line2D line : reaction.getProducts().get(0).getLine().getLines()) {
pointList.add(line.getP2());
}
......@@ -1110,7 +1110,7 @@ public class SbgnmlXmlExporter {
List<Point2D> arcPoints = new ArrayList<>();
arcPoints.add(node.getLine().getStartPoint());
for (final Line2D line: node.getLine().getLines()) {
for (final Line2D line : node.getLine().getLines()) {
arcPoints.add(line.getP2());
}
Start start = new Start();
......@@ -1206,20 +1206,20 @@ public class SbgnmlXmlExporter {
if (node instanceof NodeOperator) {
ArrowType arrowType = node.getLine().getEndAtd().getArrowType();
switch (arrowType) {
case BLANK:
return ArcClazz.STIMULATION;
case BLANK_CROSSBAR:
return ArcClazz.NECESSARY_STIMULATION;
case CIRCLE:
return ArcClazz.CATALYSIS;
case CROSSBAR:
return ArcClazz.INHIBITION;
case DIAMOND:
return ArcClazz.MODULATION;
case NONE:
return ArcClazz.LOGIC_ARC;
default:
throw new InvalidArgumentException();
case BLANK:
return ArcClazz.STIMULATION;
case BLANK_CROSSBAR:
return ArcClazz.NECESSARY_STIMULATION;
case CIRCLE:
return ArcClazz.CATALYSIS;
case CROSSBAR:
return ArcClazz.INHIBITION;
case DIAMOND:
return ArcClazz.MODULATION;
case NONE:
return ArcClazz.LOGIC_ARC;
default:
throw new InvalidArgumentException();
}
}
throw new InvalidArgumentException();
......
......@@ -221,8 +221,8 @@ public abstract class SpeciesConverter<T extends Species> extends ElementConvert
}
/**
* This method draws a string on graphics using current font. The coordinates of
* the text is given as a point. Both parameters centered described if text
* This method draws a string on graphics using current font. The coordinates
* of the text is given as a point. Both parameters centered described if text
* should be automatically centered horizontally and vertically.
*
* @param border
......@@ -244,35 +244,35 @@ public abstract class SpeciesConverter<T extends Species> extends ElementConvert
double lineHeight = graphics.getFontMetrics().getHeight();
switch (verticalAlign) {
case TOP:
y = border.getMinY() + graphics.getFontMetrics().getAscent();
break;
case MIDDLE:
y = border.getCenterY() - (textHeight / 2 - graphics.getFontMetrics().getAscent());
break;
case BOTTOM:
y = border.getMaxY() - (textHeight - graphics.getFontMetrics().getAscent());
break;
default:
throw new InvalidArgumentException("Don't know how to align text with: " + verticalAlign);
case TOP:
y = border.getMinY() + graphics.getFontMetrics().getAscent();
break;
case MIDDLE:
y = border.getCenterY() - (textHeight / 2 - graphics.getFontMetrics().getAscent());
break;
case BOTTOM:
y = border.getMaxY() - (textHeight - graphics.getFontMetrics().getAscent());
break;
default:
throw new InvalidArgumentException("Don't know how to align text with: " + verticalAlign);
}
for (final String string : lines) {
double currX;
switch (horizontalAlign) {
case LEFT:
currX = border.getX();
break;
case CENTER:
currX = border.getCenterX() - getTextWidth(string, graphics) / 2;
break;
case RIGTH:
currX = border.getMaxX() - getTextWidth(string, graphics);
break;
default:
throw new InvalidArgumentException("Don't know how to align text with: " + horizontalAlign);
case LEFT:
currX = border.getX();
break;
case CENTER:
currX = border.getCenterX() - getTextWidth(string, graphics) / 2;
break;
case RIGTH:
currX = border.getMaxX() - getTextWidth(string, graphics);
break;
default:
throw new InvalidArgumentException("Don't know how to align text with: " + horizontalAlign);
}
graphics.drawString(string, (int) currX, (int) y);
y += lineHeight;
}
......@@ -388,8 +388,8 @@ public abstract class SpeciesConverter<T extends Species> extends ElementConvert
}
/**
* Draws unit of information for the {@link Species} (rectangle in the top part
* of the alias).
* Draws unit of information for the {@link Species} (rectangle in the top
* part of the alias).
*
* @param text
* unit of information text
......@@ -453,9 +453,10 @@ public abstract class SpeciesConverter<T extends Species> extends ElementConvert
}
/**
* This method draws modification of the alias. If drawEmptyModification is set
* to false then modification is not drawn if empty. If drawDescription is set
* then also description (position) of the modification is drawn on the canvas.
* This method draws modification of the alias. If drawEmptyModification is
* set to false then modification is not drawn if empty. If drawDescription is
* set then also description (position) of the modification is drawn on the
* canvas.
*
* @param protein
* object that is 'parent' of the residue
......
......@@ -215,34 +215,34 @@ public final class FontFinder {
double lineHeight = graphics.getFontMetrics().getHeight();
double y;
switch (verticalAlign) {
case TOP:
y = border.getY() + lineHeight / 2;
break;
case MIDDLE:
y = (int) (border.getCenterY() - lineHeight * lines.size() / 2.0 + graphics.getFontMetrics().getAscent());
break;
case BOTTOM:
y = border.getMaxY() - lineHeight / 2 - lineHeight * lines.size();