Commit 36122b2d authored by Piotr Gawron's avatar Piotr Gawron
Browse files

parameter name standard enforced

parent ec6e65ca
......@@ -167,12 +167,12 @@
<message key="name.invalidPattern"
value="Member name ''{0}'' must match pattern ''{1}''."/>
</module>
<!-- <module name="ParameterName">
<module name="ParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="LambdaParameterName">
<!-- <module name="LambdaParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
value="Lambda parameter name ''{0}'' must match pattern ''{1}''."/>
......
......@@ -303,12 +303,12 @@ public final class Configuration {
}
/**
* @param xFrametDomains
* @param domains
* the xFrametDomain to set
* @see #xFrametDomain
*/
public static void setxFrameDomain(List<String> xFrametDomains) {
Configuration.xFrametDomain = xFrametDomains;
public static void setxFrameDomain(List<String> domains) {
Configuration.xFrametDomain = domains;
}
/**
......
......@@ -52,11 +52,11 @@ public class SystemClipboard implements ClipboardOwner {
* Place a String on the clipboard, and make this class the owner of the
* Clipboard's contents.
*
* @param aString
* @param string
* what we want to put into clipboard
*/
public void setClipboardContents(String aString) {
StringSelection stringSelection = new StringSelection(aString);
public void setClipboardContents(String string) {
StringSelection stringSelection = new StringSelection(string);
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(stringSelection, this);
}
......
......@@ -318,16 +318,16 @@ public class RestAnnotationParser {
*
* @param type
* - relationtype of the annotaion ids
* @param mType
* @param miriamType
* {@link MiriamType type} of the reference resource
* @param ids
* - list of ids
* @return set of miriam data
*/
private Set<MiriamData> idsToData(MiriamRelationType type, MiriamType mType, ArrayList<String> ids) {
private Set<MiriamData> idsToData(MiriamRelationType type, MiriamType miriamType, ArrayList<String> ids) {
Set<MiriamData> result = new HashSet<MiriamData>();
for (String id : ids) {
MiriamData md = new MiriamData(type, mType, id);
MiriamData md = new MiriamData(type, miriamType, id);
result.add(md);
}
return result;
......
......@@ -31,12 +31,12 @@ public class MiriamData implements Comparable<MiriamData>, Serializable {
*
*/
private static final long serialVersionUID = 1L;
/**
* Default class logger.
*/
private static Logger logger = LogManager.getLogger();
/**
* Unique database identifier.
*/
......@@ -199,27 +199,17 @@ public class MiriamData implements Comparable<MiriamData>, Serializable {
}
@Override
public boolean equals(Object aThat) {
// check for self-comparison
if (this == aThat) {
public boolean equals(Object o) {
if (this == o) {
return true;
}
// use instanceof instead of getClass here for two reasons
// 1. if need be, it can match any supertype, and not just one class;
// 2. it renders an explict check for "that == null" redundant, since
// it does the check for null already - "null instanceof [type]" always
// returns false. (See Effective Java by Joshua Bloch.)
if (!(aThat instanceof MiriamData)) {
if (!(o instanceof MiriamData)) {
return false;
}
// Alternative to the above line :
// if ( aThat == null || aThat.getClass() != this.getClass() ) return false;
// cast to native object is now safe
MiriamData that = (MiriamData) aThat;
MiriamData that = (MiriamData) o;
// now a proper field-by-field evaluation can be made
return this.compareTo(that) == 0;
}
......
......@@ -131,12 +131,12 @@ public class OverviewModelLink extends OverviewLink {
}
/**
* @param xCoord
* @param x
* the xCoord to set
* @see #xCoord
*/
public void setxCoord(Integer xCoord) {
this.xCoord = xCoord;
public void setxCoord(Integer x) {
this.xCoord = x;
}
/**
......@@ -163,12 +163,12 @@ public class OverviewModelLink extends OverviewLink {
}
/**
* @param yCoord
* @param y
* the yCoord to set
* @see #yCoord
*/
public void setyCoord(Integer yCoord) {
this.yCoord = yCoord;
public void setyCoord(Integer y) {
this.yCoord = y;
}
/**
......
......@@ -132,17 +132,17 @@ public class DataNode extends GraphicalPathwayElement {
* @return the vAlign
* @see #verticalAlign
*/
public String getvAlign() {
public String getVerticalAlign() {
return verticalAlign;
}
/**
* @param vAlign
* @param verticalAlign
* the vAlign to set
* @see #verticalAlign
*/
public void setvAlign(String vAlign) {
this.verticalAlign = vAlign;
public void setVerticalAlign(String verticalAlign) {
this.verticalAlign = verticalAlign;
}
/**
......
......@@ -454,12 +454,12 @@ public class Edge implements Serializable {
}
/**
* @param zOrder
* @param z
* the zOrder to set
* @see #zOrder
*/
public void setzOrder(Integer zOrder) {
this.zOrder = zOrder;
public void setzOrder(Integer z) {
this.zOrder = z;
}
/**
......
......@@ -112,17 +112,17 @@ public class Label extends GraphicalPathwayElement {
* @return the vAlign
* @see #verticalAlign
*/
public String getvAlign() {
public String getVerticalAlign() {
return verticalAlign;
}
/**
* @param vAlign
* @param verticalAlign
* the vAlign to set
* @see #verticalAlign
*/
public void setvAlign(String vAlign) {
this.verticalAlign = vAlign;
public void setVerticalAlign(String verticalAlign) {
this.verticalAlign = verticalAlign;
}
/**
......
......@@ -127,12 +127,12 @@ public abstract class PathwayElement implements Serializable {
}
/**
* @param zOrder
* @param z
* the zOrder to set
* @see #zOrder
*/
public void setzOrder(Integer zOrder) {
this.zOrder = zOrder;
public void setzOrder(Integer z) {
this.zOrder = z;
}
/**
......
......@@ -163,17 +163,17 @@ public class Shape extends GraphicalPathwayElement {
* @return the vAlign
* @see #verticalAlign
*/
public String getvAlign() {
public String getVerticalAlign() {
return verticalAlign;
}
/**
* @param vAlign
* @param verticalAlign
* the vAlign to set
* @see #verticalAlign
*/
public void setvAlign(String vAlign) {
this.verticalAlign = vAlign;
public void setVerticalAlign(String verticalAlign) {
this.verticalAlign = verticalAlign;
}
/**
......
......@@ -47,12 +47,12 @@ public class DataNodeParser extends GraphicalPathwayElementParser<DataNode> {
}
@Override
public DataNode parse(Element eElement) throws UnknownTypeException {
if (!eElement.getNodeName().equals("DataNode")) {
public DataNode parse(Element element) throws UnknownTypeException {
if (!element.getNodeName().equals("DataNode")) {
throw new InvalidArgumentException(ShapeParser.class.getSimpleName() + " can parse only DataNode xml nodes");
}
String id = eElement.getAttribute("GraphId");
String id = element.getAttribute("GraphId");
if (id == null || id.isEmpty()) {
id = "gen_dn_" + counter++;
logger.warn(new LogMarker(ProjectLogEntryType.PARSING_ISSUE, "DataNode", null, getMapName()),
......@@ -60,7 +60,7 @@ public class DataNodeParser extends GraphicalPathwayElementParser<DataNode> {
}
DataNode node = new DataNode(id, getMapName());
for (Pair<String, String> entry : getAttributes(eElement)) {
for (Pair<String, String> entry : getAttributes(element)) {
switch (entry.getLeft()) {
case ("GraphId"):
break;
......@@ -79,7 +79,7 @@ public class DataNodeParser extends GraphicalPathwayElementParser<DataNode> {
}
}
NodeList tmpList = eElement.getChildNodes();
NodeList tmpList = element.getChildNodes();
for (int j = 0; j < tmpList.getLength(); j++) {
Node tmpNode = tmpList.item(j);
if (tmpNode.getNodeType() == Node.ELEMENT_NODE) {
......@@ -105,7 +105,7 @@ public class DataNodeParser extends GraphicalPathwayElementParser<DataNode> {
break;
default:
logger.warn(node.getLogMarker(),
"Unknown sub-node of " + eElement.getNodeName() + " node: " + eTmp.getNodeName());
"Unknown sub-node of " + element.getNodeName() + " node: " + eTmp.getNodeName());
break;
}
}
......@@ -127,19 +127,19 @@ public class DataNodeParser extends GraphicalPathwayElementParser<DataNode> {
/**
* Parse graphics xml node in the shape node.
*
* @param eTmp
* @param element
* xml node with graphics
* @param shape
* shape where data should be added
* @throws UnknownTypeException
* thrown when node contains unknown types
*/
private void parseGraphics(Element eTmp, DataNode shape) throws UnknownTypeException {
private void parseGraphics(Element element, DataNode shape) throws UnknownTypeException {
Double centerX = null;
Double centerY = null;
Double width = null;
Double height = null;
for (Pair<String, String> entry : getAttributes(eTmp)) {
for (Pair<String, String> entry : getAttributes(element)) {
if (!parseCommonGraphicAttributes(shape, entry)) {
switch (entry.getLeft()) {
case ("CenterX"):
......@@ -178,10 +178,10 @@ public class DataNodeParser extends GraphicalPathwayElementParser<DataNode> {
shape.setFontWeight(entry.getRight());
break;
case ("Valign"):
shape.setvAlign(entry.getRight());
shape.setVerticalAlign(entry.getRight());
break;
default:
logger.warn("Unknown attribute of " + eTmp.getNodeName() + " node: " + entry.getLeft());
logger.warn("Unknown attribute of " + element.getNodeName() + " node: " + entry.getLeft());
break;
}
}
......@@ -192,14 +192,14 @@ public class DataNodeParser extends GraphicalPathwayElementParser<DataNode> {
/**
* Method that parses {@link DataNode} xml attribute.
*
* @param eTmp
* @param element
* xml node with attribute
* @param shape
* shape where data should be added
*/
private void parseAttribute(Element eTmp, DataNode shape) {
String key = eTmp.getAttribute("Key");
String value = eTmp.getAttribute("Value");
private void parseAttribute(Element element, DataNode shape) {
String key = element.getAttribute("Key");
String value = element.getAttribute("Value");
switch (key) {
case ("org.pathvisio.model.BackpageHead"):
// it's deprecated in PathVisio so we can skip it
......
......@@ -46,14 +46,14 @@ public class EdgeLineParser extends ElementGpmlParser<Edge> {
* @throws ConverterException
*/
@Override
public Edge parse(Element eElement) throws ConverterException {
if (!eElement.getNodeName().equals("GraphicalLine")) {
public Edge parse(Element element) throws ConverterException {
if (!element.getNodeName().equals("GraphicalLine")) {
throw new InvalidArgumentException(
ShapeParser.class.getSimpleName() + " can parse only GraphicalLine xml nodes. But " + eElement.getNodeName());
ShapeParser.class.getSimpleName() + " can parse only GraphicalLine xml nodes. But " + element.getNodeName());
}
Edge line = edgeParser.createEmpty();
NodeList nodes = eElement.getChildNodes();
for (Pair<String, String> entry : getAttributes(eElement)) {
NodeList nodes = element.getChildNodes();
for (Pair<String, String> entry : getAttributes(element)) {
switch (entry.getLeft()) {
case ("GraphId"):
line.setGraphId(entry.getRight());
......@@ -62,7 +62,7 @@ public class EdgeLineParser extends ElementGpmlParser<Edge> {
line.setGroupRef(entry.getRight());
break;
default:
logger.warn("Unknown attribute of " + eElement.getNodeName() + " node: " + entry.getLeft());
logger.warn("Unknown attribute of " + element.getNodeName() + " node: " + entry.getLeft());
}
}
......
......@@ -87,15 +87,15 @@ public class EdgeParser extends ElementGpmlParser<Edge> {
* thrown when there is a problem with parsing edge
*/
@Override
public Edge parse(Element eElement) throws ConverterException {
public Edge parse(Element parentElement) throws ConverterException {
String graphId = eElement.getAttribute("GraphId");
String graphId = parentElement.getAttribute("GraphId");
if (graphId == null || graphId.equals("")) {
graphId = getNewId();
}
Edge edge = new Edge(graphId, getMapName());
for (Pair<String, String> entry : getAttributes(eElement)) {
for (Pair<String, String> entry : getAttributes(parentElement)) {
switch (entry.getLeft()) {
case ("GraphId"):
break;
......@@ -103,12 +103,12 @@ public class EdgeParser extends ElementGpmlParser<Edge> {
edge.setGroupRef(entry.getRight());
break;
default:
logger.warn("Unknown attribute of " + eElement.getNodeName() + " node: " + entry.getLeft());
logger.warn("Unknown attribute of " + parentElement.getNodeName() + " node: " + entry.getLeft());
break;
}
}
NodeList nodes = eElement.getChildNodes();
NodeList nodes = parentElement.getChildNodes();
boolean graphicsParsed = false;
for (int i = 0; i < nodes.getLength(); i++) {
Node node = nodes.item(i);
......@@ -581,14 +581,14 @@ public class EdgeParser extends ElementGpmlParser<Edge> {
/**
* Method that parses {@link Edge} xml attribute.
*
* @param eTmp
* @param element
* xml node with attribute
* @param edge
* edge where data should be added
*/
private void parseAttribute(Element eTmp, Edge edge) {
String key = eTmp.getAttribute("Key");
String value = eTmp.getAttribute("Value");
private void parseAttribute(Element element, Edge edge) {
String key = element.getAttribute("Key");
String value = element.getAttribute("Value");
switch (key) {
case ("org.pathvisio.core.ds"):
// skip for now (no idea what does it mean)
......
......@@ -698,11 +698,11 @@ public class GpmlParser {
return result;
}
private PolylineData parseLine(Node lNode) throws UnknownTypeException {
private PolylineData parseLine(Node parentNode) throws UnknownTypeException {
int refs = 0;
PolylineData line = new PolylineData();
List<Point2D> points = new ArrayList<>();
NodeList nodes = lNode.getChildNodes();
NodeList nodes = parentNode.getChildNodes();
for (int i = 0; i < nodes.getLength(); i++) {
Node node = nodes.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
......
......@@ -41,13 +41,13 @@ public class LabelParser extends GraphicalPathwayElementParser<Label> {
}
@Override
public Label parse(Element eElement) throws UnknownTypeException {
if (!eElement.getNodeName().equals("Label")) {
public Label parse(Element element) throws UnknownTypeException {
if (!element.getNodeName().equals("Label")) {
throw new InvalidArgumentException(ShapeParser.class.getSimpleName() + " can parse only Label xml nodes");
}
Label label = new Label(eElement.getAttribute("GraphId"), getMapName());
Label label = new Label(element.getAttribute("GraphId"), getMapName());
for (Pair<String, String> entry : getAttributes(eElement)) {
for (Pair<String, String> entry : getAttributes(element)) {
switch (entry.getLeft()) {
case ("GraphId"):
break;
......@@ -70,12 +70,12 @@ public class LabelParser extends GraphicalPathwayElementParser<Label> {
label.setGroupRef(entry.getRight());
break;
default:
logger.warn("Unknown attribute of " + eElement.getNodeName() + " node: " + entry.getLeft());
logger.warn("Unknown attribute of " + element.getNodeName() + " node: " + entry.getLeft());
break;
}
}
NodeList tmpList = eElement.getChildNodes();
NodeList tmpList = element.getChildNodes();
for (int j = 0; j < tmpList.getLength(); j++) {
Node tmpNode = tmpList.item(j);
if (tmpNode.getNodeType() == Node.ELEMENT_NODE) {
......@@ -94,7 +94,7 @@ public class LabelParser extends GraphicalPathwayElementParser<Label> {
parseAttribute(eTmp, label);
break;
default:
logger.warn("Unknown sub-node of " + eElement.getNodeName() + " node: " + eTmp.getNodeName());
logger.warn("Unknown sub-node of " + element.getNodeName() + " node: " + eTmp.getNodeName());
break;
}
}
......@@ -116,19 +116,19 @@ public class LabelParser extends GraphicalPathwayElementParser<Label> {
/**
* Parse graphics xml node in the shape node.
*
* @param eTmp
* @param element
* xml node with graphics
* @param shape
* shape where data should be added
* @throws UnknownTypeException
* thrown when some elements contain unknown typevalues
*/
protected void parseGraphics(Element eTmp, Label shape) throws UnknownTypeException {
protected void parseGraphics(Element element, Label shape) throws UnknownTypeException {
Double centerX = null;
Double centerY = null;
Double width = null;
Double height = null;
for (Pair<String, String> entry : getAttributes(eTmp)) {
for (Pair<String, String> entry : getAttributes(element)) {
if (!parseCommonGraphicAttributes(shape, entry)) {
switch (entry.getLeft()) {
case ("CenterX"):
......@@ -159,13 +159,13 @@ public class LabelParser extends GraphicalPathwayElementParser<Label> {
shape.setFontWeight(entry.getRight());
break;
case ("Valign"):
shape.setvAlign(entry.getRight());
shape.setVerticalAlign(entry.getRight());
break;
case ("ShapeType"):
shape.setShape(entry.getRight());
break;
default:
logger.warn("Unknown attribute of " + eTmp.getNodeName() + " node: " + entry.getLeft() + "; value: "
logger.warn("Unknown attribute of " + element.getNodeName() + " node: " + entry.getLeft() + "; value: "
+ entry.getRight());
break;
}
......@@ -177,14 +177,14 @@ public class LabelParser extends GraphicalPathwayElementParser<Label> {
/**
* Method that parses {@link Label} xml attribute.
*
* @param eTmp
* @param element
* xml node with attribute
* @param shape
* shape where data should be added
*/
private void parseAttribute(Element eTmp, Label shape) {
String key = eTmp.getAttribute("Key");
String value = eTmp.getAttribute("Value");
private void parseAttribute(Element element, Label shape) {
String key = element.getAttribute("Key");
String value = element.getAttribute("Value");
switch (key) {
case ("org.pathvisio.model.GenMAPP-Xref"):
// skip it when it's empty
......
......@@ -39,12 +39,12 @@ public class ShapeParser extends GraphicalPathwayElementParser<Shape> {
}
@Override
public Shape parse(Element eElement) throws ConverterException {
if (!eElement.getNodeName().equals("Shape")) {
public Shape parse(Element element) throws ConverterException {
if (!element.getNodeName().equals("Shape")) {
throw new InvalidArgumentException(ShapeParser.class.getSimpleName() + " can parse only Shape xml nodes");
}
Shape shape = new Shape(eElement.getAttribute("GraphId"), getMapName());
for (Pair<String, String> entry : getAttributes(eElement)) {
Shape shape = new Shape(element.getAttribute("GraphId"), getMapName());
for (Pair<String, String> entry : getAttributes(element)) {
switch (entry.getLeft()) {
case ("GraphId"):
break;
......@@ -55,12 +55,12 @@ public class ShapeParser extends GraphicalPathwayElementParser<Shape> {
shape.setGroupRef(entry.getRight());
break;
default:
logger.warn("Unknown attribute of " + eElement.getNodeName() + " node: " + entry.getLeft());
logger.warn("Unknown attribute of " + element.getNodeName() + " node: " + entry.getLeft());
break;
}
}
NodeList tmpList = eElement.getChildNodes();
NodeList tmpList = element.getChildNodes();
for (int j = 0; j < tmpList.getLength(); j++) {
Node tmpNode = tmpList.item(j);
if (tmpNode.getNodeType() == Node.ELEMENT_NODE) {
......@@ -79,7 +79,7 @@ public class ShapeParser extends GraphicalPathwayElementParser<Shape> {
shape.addBiopaxReference(eTmp.getTextContent());
break;