From e2ca379fb7117663f8046128003cefefe14d3b3a Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Sun, 17 May 2015 16:20:58 -0400 Subject: [PATCH] following syntax guidelines --- .../mode/java/pdex/CompletionCandidate.java | 51 ++++++++++--------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/java/src/processing/mode/java/pdex/CompletionCandidate.java b/java/src/processing/mode/java/pdex/CompletionCandidate.java index 0e2f2d355..2a9d9f936 100644 --- a/java/src/processing/mode/java/pdex/CompletionCandidate.java +++ b/java/src/processing/mode/java/pdex/CompletionCandidate.java @@ -31,21 +31,22 @@ import org.eclipse.jdt.core.dom.SingleVariableDeclaration; import org.eclipse.jdt.core.dom.TypeDeclaration; import org.eclipse.jdt.core.dom.VariableDeclarationFragment; + public class CompletionCandidate implements Comparable{ - - private String elementName; // - + private String elementName; private String label; // the toString value - private String completionString; - private Object wrappedObject; - private int type; - public static final int PREDEF_CLASS = 0, PREDEF_FIELD = 1, - PREDEF_METHOD = 2, LOCAL_CLASS = 3, LOCAL_METHOD = 4, LOCAL_FIELD = 5, - LOCAL_VAR = 6; + static final int PREDEF_CLASS = 0; + static final int PREDEF_FIELD = 1; + static final int PREDEF_METHOD = 2; + static final int LOCAL_CLASS = 3; + static final int LOCAL_METHOD = 4; + static final int LOCAL_FIELD = 5; + static final int LOCAL_VAR = 6; + public CompletionCandidate(Method method) { method.getDeclaringClass().getName(); @@ -72,7 +73,7 @@ public class CompletionCandidate implements Comparable{ type = PREDEF_METHOD; wrappedObject = method; } - + public Object getWrappedObject() { return wrappedObject; } @@ -87,7 +88,7 @@ public class CompletionCandidate implements Comparable{ label = svd.getName() + " : " + svd.getType(); wrappedObject = svd; } - + public CompletionCandidate(VariableDeclarationFragment vdf) { completionString = vdf.getName().toString(); elementName = vdf.getName().toString(); @@ -98,16 +99,16 @@ public class CompletionCandidate implements Comparable{ label = vdf.getName() + " : " + ASTGenerator.extracTypeInfo2(vdf); wrappedObject = vdf; } - + public CompletionCandidate(MethodDeclaration method) { // log("ComCan " + method.getName()); elementName = method.getName().toString(); type = LOCAL_METHOD; - + @SuppressWarnings("unchecked") - List params = (List) + List params = (List) method.getStructuralProperty(MethodDeclaration.PARAMETERS_PROPERTY); - + StringBuilder label = new StringBuilder(elementName + "("); StringBuilder cstr = new StringBuilder(method.getName() + "("); for (int i = 0; i < params.size(); i++) { @@ -145,18 +146,18 @@ public class CompletionCandidate implements Comparable{ // + matchedClass + " : " + "" // + matchedClass2.substring(0, d) + "", matchedClass // + "" - label = "" + f.getName() + " : " + f.getType().getSimpleName() + - " - " + f.getDeclaringClass().getSimpleName() + + label = "" + f.getName() + " : " + f.getType().getSimpleName() + + " - " + f.getDeclaringClass().getSimpleName() + ""; completionString = elementName; wrappedObject = f; } - public CompletionCandidate(String name, String labelStr, String completionStr, int type) { + public CompletionCandidate(String name, String labelStr, String completionStr, int type) { elementName = name; label = labelStr; completionString = completionStr; - this.type = type; + this.type = type; } public CompletionCandidate(String name, int type) { @@ -181,11 +182,11 @@ public class CompletionCandidate implements Comparable{ public int getType() { return type; } - + public String getLabel() { return label; } - + public String getNoHtmlLabel(){ if(!label.contains("")) { return label; @@ -217,15 +218,15 @@ public class CompletionCandidate implements Comparable{ } return (elementName.compareTo(cc.getElementName())); } - + public void regenerateCompletionString(){ if (wrappedObject instanceof MethodDeclaration) { MethodDeclaration method = (MethodDeclaration)wrappedObject; - + @SuppressWarnings("unchecked") - List params = (List) + List params = (List) method.getStructuralProperty(MethodDeclaration.PARAMETERS_PROPERTY); - + StringBuilder label = new StringBuilder(elementName + "("); StringBuilder cstr = new StringBuilder(method.getName() + "("); for (int i = 0; i < params.size(); i++) {