From 58348fba8298bf33312436c243d3c7e424b4479d Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman <jeffrey.freeman@syncleus.com> Date: Tue, 11 Nov 2014 08:28:02 -0500 Subject: [PATCH] Covered numerous technical debt issues. Change-Id: I11122aec3b8ed9905924e2b1fc847badcf20d566 --- .../grail/graph/AbstractSignalMultiplyingEdge.java | 2 +- .../grail/graph/TypedAdjacencyMethodHandler.java | 14 +++++++------- .../grail/graph/TypedIncidenceMethodHandler.java | 8 ++++---- .../grail/graph/action/AbstractActionTrigger.java | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/syncleus/grail/graph/AbstractSignalMultiplyingEdge.java b/src/main/java/com/syncleus/grail/graph/AbstractSignalMultiplyingEdge.java index 8e27cf4..b394b00 100644 --- a/src/main/java/com/syncleus/grail/graph/AbstractSignalMultiplyingEdge.java +++ b/src/main/java/com/syncleus/grail/graph/AbstractSignalMultiplyingEdge.java @@ -26,7 +26,7 @@ public abstract class AbstractSignalMultiplyingEdge implements SignalMultiplying private static final Random RANDOM = new Random(); private static final double RANGE = 2.0; private static final double OFFSET = -1.0; - private static final double SCALE = 1.0 / 10.0; + private static final double SCALE = 0.1; @Initializer public void init() { diff --git a/src/main/java/com/syncleus/grail/graph/TypedAdjacencyMethodHandler.java b/src/main/java/com/syncleus/grail/graph/TypedAdjacencyMethodHandler.java index d6e5ef3..4f6145b 100644 --- a/src/main/java/com/syncleus/grail/graph/TypedAdjacencyMethodHandler.java +++ b/src/main/java/com/syncleus/grail/graph/TypedAdjacencyMethodHandler.java @@ -52,10 +52,10 @@ public class TypedAdjacencyMethodHandler implements MethodHandler<TypedAdjacency if( ClassUtilities.isAddMethod(method) ) { if( arguments == null ) - throw new IllegalStateException("method " + method.getName() + " was annotated with @TypedAdjacency but had no arguments."); + throw new IllegalStateException(method.getName() + " was annotated with @TypedAdjacency but had no arguments."); else if( arguments.length == 1 ) { if( !(arguments[0] instanceof Class) ) - throw new IllegalStateException("method " + method.getName() + " was annotated with @TypedAdjacency, had a single argument, but that argument was not of the type Class"); + throw new IllegalStateException(method.getName() + " was annotated with @TypedAdjacency, had a single argument, but that argument was not of the type Class"); final Class type = (Class) arguments[0]; @@ -64,14 +64,14 @@ public class TypedAdjacencyMethodHandler implements MethodHandler<TypedAdjacency return TypedAdjacencyMethodHandler.addNode(type, annotation.direction(), annotation.label(), framedGraph, vertex); } else - throw new IllegalStateException("method " + method.getName() + " was annotated with @TypedAdjacency but had more than 1 arguments."); + throw new IllegalStateException(method.getName() + " was annotated with @TypedAdjacency but had more than 1 arguments."); } else if( ClassUtilities.isGetMethod(method) ) { if( arguments == null ) - throw new IllegalStateException("method " + method.getName() + " was annotated with @TypedAdjacency but had no arguments."); + throw new IllegalStateException(method.getName() + " was annotated with @TypedAdjacency but had no arguments."); else if( arguments.length == 1 ) { if( !(arguments[0] instanceof Class) ) - throw new IllegalStateException("method " + method.getName() + " was annotated with @TypedAdjacency, had a single argument, but that argument was not of the type Class"); + throw new IllegalStateException(method.getName() + " was annotated with @TypedAdjacency, had a single argument, but that argument was not of the type Class"); final Class type = (Class) arguments[0]; @@ -82,10 +82,10 @@ public class TypedAdjacencyMethodHandler implements MethodHandler<TypedAdjacency return this.getNode(type, annotation.direction(), annotation.label(), framedGraph, vertex); } else - throw new IllegalStateException("method " + method.getName() + " was annotated with @TypedAdjacency but had more than 1 arguments."); + throw new IllegalStateException(method.getName() + " was annotated with @TypedAdjacency but had more than 1 arguments."); } else - throw new IllegalStateException("method " + method.getName() + " was annotated with @TypedAdjacency but did not begin with either of the following keywords: add, get"); + throw new IllegalStateException(method.getName() + " was annotated with @TypedAdjacency but did not begin with either of the following keywords: add, get"); } private Iterable getNodes(final Class type, final Direction direction, final String label, final FramedGraph<?> framedGraph, final Vertex vertex) { diff --git a/src/main/java/com/syncleus/grail/graph/TypedIncidenceMethodHandler.java b/src/main/java/com/syncleus/grail/graph/TypedIncidenceMethodHandler.java index c2a36f1..782d45f 100644 --- a/src/main/java/com/syncleus/grail/graph/TypedIncidenceMethodHandler.java +++ b/src/main/java/com/syncleus/grail/graph/TypedIncidenceMethodHandler.java @@ -50,10 +50,10 @@ public class TypedIncidenceMethodHandler implements MethodHandler<TypedIncidence if( ClassUtilities.isGetMethod(method) ) { if( arguments == null ) - throw new IllegalStateException("method " + method.getName() + " was annotated with @TypedIncidence but had no arguments."); + throw new IllegalStateException(method.getName() + " was annotated with @TypedIncidence but had no arguments."); else if( arguments.length == 1 ) { if( !(arguments[0] instanceof Class) ) - throw new IllegalStateException("method " + method.getName() + " was annotated with @TypedIncidence, had a single argument, but that argument was not of the type Class"); + throw new IllegalStateException(method.getName() + " was annotated with @TypedIncidence, had a single argument, but that argument was not of the type Class"); final Class type = (Class) arguments[0]; @@ -66,10 +66,10 @@ public class TypedIncidenceMethodHandler implements MethodHandler<TypedIncidence return this.getEdge(type, annotation.direction(), annotation.label(), framedGraph, vertex); } else - throw new IllegalStateException("method " + method.getName() + " was annotated with @TypedIncidence but had more than 1 arguments."); + throw new IllegalStateException(method.getName() + " was annotated with @TypedIncidence but had more than 1 arguments."); } else - throw new IllegalStateException("method " + method.getName() + " was annotated with @TypedIncidence but did not begin with either of the following keywords: add, get"); + throw new IllegalStateException(method.getName() + " was annotated with @TypedIncidence but did not begin with either of the following keywords: add, get"); } private Iterable getEdges(final Class type, final Direction direction, final String label, final FramedGraph<?> framedGraph, final Vertex vertex) { diff --git a/src/main/java/com/syncleus/grail/graph/action/AbstractActionTrigger.java b/src/main/java/com/syncleus/grail/graph/action/AbstractActionTrigger.java index 16e3f35..933905d 100644 --- a/src/main/java/com/syncleus/grail/graph/action/AbstractActionTrigger.java +++ b/src/main/java/com/syncleus/grail/graph/action/AbstractActionTrigger.java @@ -22,7 +22,7 @@ import java.lang.reflect.Method; import java.util.*; public abstract class AbstractActionTrigger implements ActionTrigger { - private final static Map<Class<?>, Map<String, Set<Method>>> ACTION_METHOD_CACHE = new HashMap<>(); + private static final Map<Class<?>, Map<String, Set<Method>>> ACTION_METHOD_CACHE = new HashMap<>(); protected static final Map<String, Set<Method>> populateCache(final Class<?> parentClass) { Map<String, Set<Method>> actionMethods = AbstractActionTrigger.ACTION_METHOD_CACHE.get(parentClass); -- GitLab