Author: kono
Date: 2012-06-19 15:52:07 -0700 (Tue, 19 Jun 2012)
New Revision: 29627
Modified:
core3/impl/trunk/layout-prefuse-impl/src/main/java/org/cytoscape/prefuse/layouts/internal/ForceDirectedLayout.java
Log:
Minor source code cleanup only.
Modified:
core3/impl/trunk/layout-prefuse-impl/src/main/java/org/cytoscape/prefuse/layouts/internal/ForceDirectedLayout.java
===================================================================
---
core3/impl/trunk/layout-prefuse-impl/src/main/java/org/cytoscape/prefuse/layouts/internal/ForceDirectedLayout.java
2012-06-19 22:45:12 UTC (rev 29626)
+++
core3/impl/trunk/layout-prefuse-impl/src/main/java/org/cytoscape/prefuse/layouts/internal/ForceDirectedLayout.java
2012-06-19 22:52:07 UTC (rev 29627)
@@ -1,9 +1,6 @@
package org.cytoscape.prefuse.layouts.internal;
-
-import java.util.ArrayList;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import org.cytoscape.model.CyNode;
@@ -17,18 +14,27 @@
import prefuse.util.force.Integrator;
import prefuse.util.force.RungeKuttaIntegrator;
-
public class ForceDirectedLayout extends AbstractLayoutAlgorithm {
+ private static final String ALGORITHM_ID = "force-directed";
+ private static final String ALGORITHM_DISPLAY_NAME = "Force Directed
Layout";
+
private Integrators integrator = Integrators.RUNGEKUTTA;
-
+
public enum Integrators {
- RUNGEKUTTA ("Runge-Kutta"),
- EULER ("Euler");
+ RUNGEKUTTA("Runge-Kutta"), EULER("Euler");
private String name;
- private Integrators(String str) { name=str; }
- public String toString() { return name; }
+
+ private Integrators(String str) {
+ name = str;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+
public Integrator getNewIntegrator() {
if (this == EULER)
return new EulerIntegrator();
@@ -37,36 +43,34 @@
}
}
-
- /**
- * Creates a new GridNodeLayout object.
- */
public ForceDirectedLayout(UndoSupport undo) {
- super("force-directed", "Force Directed Layout",undo);
+ super(ALGORITHM_ID, ALGORITHM_DISPLAY_NAME, undo);
}
@Override
- public TaskIterator createTaskIterator(CyNetworkView networkView,
Object context, Set<View<CyNode>> nodesToLayOut, String attrName) {
- return new TaskIterator(new ForceDirectedLayoutTask(getName(),
networkView, nodesToLayOut, (ForceDirectedLayoutContext)context, integrator,
attrName,undoSupport));
+ public TaskIterator createTaskIterator(CyNetworkView networkView,
Object context, Set<View<CyNode>> nodesToLayOut,
+ String attrName) {
+ return new TaskIterator(new ForceDirectedLayoutTask(getName(),
networkView, nodesToLayOut,
+ (ForceDirectedLayoutContext) context,
integrator, attrName, undoSupport));
}
-
+
@Override
public Object createLayoutContext() {
return new ForceDirectedLayoutContext();
}
-
+
+ @Override
public Set<Class<?>> getSupportedEdgeAttributeTypes() {
- Set<Class<?>> ret = new HashSet<Class<?>>();
+ final Set<Class<?>> ret = new HashSet<Class<?>>();
- ret.add( Integer.class );
- ret.add( Double.class );
+ ret.add(Integer.class);
+ ret.add(Double.class);
return ret;
}
-
+
@Override
public boolean getSupportsSelectedOnly() {
return true;
}
-
-}
+}
\ No newline at end of file
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.