Fix checkstyle whitespace issues - WHITESPACE ONLY
Change-Id: Ic205c1afd639c6008d61d9de95cb764eeb6238ca
diff --git a/src/main/java/net/floodlightcontroller/core/util/AppCookie.java b/src/main/java/net/floodlightcontroller/core/util/AppCookie.java
index 210823e..3ec3bd8 100644
--- a/src/main/java/net/floodlightcontroller/core/util/AppCookie.java
+++ b/src/main/java/net/floodlightcontroller/core/util/AppCookie.java
@@ -1,27 +1,26 @@
/**
-* Copyright 2011, Big Switch Networks, Inc.
-* Originally created by David Erickson, Stanford University
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you may
-* not use this file except in compliance with the License. You may obtain
-* a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-* License for the specific language governing permissions and limitations
-* under the License.
-**/
+ * Copyright 2011, Big Switch Networks, Inc.
+ * Originally created by David Erickson, Stanford University
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License. You may obtain
+ * a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ **/
package net.floodlightcontroller.core.util;
-/***
+/**
* FIXME Need a system for registering/binding applications to a unique ID
- *
- * @author capveg
*
+ * @author capveg
*/
public class AppCookie {
@@ -34,21 +33,21 @@
/**
* Encapsulate an application ID and a user block of stuff into a cookie
- *
+ *
* @param application An ID to identify the application
- * @param user Some application specific data
+ * @param user Some application specific data
* @return a cookie for use in OFFlowMod.setCookie()
*/
-
+
static public long makeCookie(int application, int user) {
return ((application & ((1L << APP_ID_BITS) - 1)) << APP_ID_SHIFT) | user;
}
-
+
static public int extractApp(long cookie) {
- return (int)((cookie>> APP_ID_SHIFT) & ((1L << APP_ID_BITS) - 1));
+ return (int) ((cookie >> APP_ID_SHIFT) & ((1L << APP_ID_BITS) - 1));
}
-
+
static public int extractUser(long cookie) {
- return (int)((cookie>> USER_SHIFT) & ((1L << USER_BITS) - 1));
+ return (int) ((cookie >> USER_SHIFT) & ((1L << USER_BITS) - 1));
}
}
diff --git a/src/main/java/net/floodlightcontroller/core/util/ListenerDispatcher.java b/src/main/java/net/floodlightcontroller/core/util/ListenerDispatcher.java
index 911284e..f716f4b 100644
--- a/src/main/java/net/floodlightcontroller/core/util/ListenerDispatcher.java
+++ b/src/main/java/net/floodlightcontroller/core/util/ListenerDispatcher.java
@@ -1,19 +1,19 @@
/**
-* Copyright 2011, Big Switch Networks, Inc.
-* Originally created by David Erickson, Stanford University
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you may
-* not use this file except in compliance with the License. You may obtain
-* a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-* License for the specific language governing permissions and limitations
-* under the License.
-**/
+ * Copyright 2011, Big Switch Networks, Inc.
+ * Originally created by David Erickson, Stanford University
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License. You may obtain
+ * a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ **/
package net.floodlightcontroller.core.util;
@@ -28,20 +28,19 @@
import org.slf4j.LoggerFactory;
/**
- * Maintain lists of listeners ordered by dependency.
- *
- * @author readams
+ * Maintain lists of listeners ordered by dependency.
*
+ * @author readams
*/
public class ListenerDispatcher<U, T extends IListener<U>> {
protected final static Logger logger = LoggerFactory.getLogger(ListenerDispatcher.class);
List<T> listeners = null;
-
- private void visit(List<T> newlisteners, U type, HashSet<T> visited,
+
+ private void visit(List<T> newlisteners, U type, HashSet<T> visited,
List<T> ordering, T listener) {
if (!visited.contains(listener)) {
visited.add(listener);
-
+
for (T i : newlisteners) {
if (ispre(type, i, listener)) {
visit(newlisteners, type, visited, ordering, i);
@@ -50,24 +49,25 @@
ordering.add(listener);
}
}
-
+
private boolean ispre(U type, T l1, T l2) {
return (l2.isCallbackOrderingPrereq(type, l1.getName()) ||
l1.isCallbackOrderingPostreq(type, l2.getName()));
}
-
+
/**
* Add a listener to the list of listeners
+ *
* @param listener
*/
- @LogMessageDoc(level="ERROR",
- message="No listener dependency solution: " +
- "No listeners without incoming dependencies",
- explanation="The set of listeners installed " +
- "have dependencies with no solution",
- recommendation="Install a different set of listeners " +
- "or install all dependencies. This is a defect in " +
- "the controller installation.")
+ @LogMessageDoc(level = "ERROR",
+ message = "No listener dependency solution: " +
+ "No listeners without incoming dependencies",
+ explanation = "The set of listeners installed " +
+ "have dependencies with no solution",
+ recommendation = "Install a different set of listeners " +
+ "or install all dependencies. This is a defect in " +
+ "the controller installation.")
public void addListener(U type, T listener) {
List<T> newlisteners = new ArrayList<T>();
if (listeners != null)
@@ -75,7 +75,7 @@
newlisteners.add(listener);
// Find nodes without outgoing edges
- List<T> terminals = new ArrayList<T>();
+ List<T> terminals = new ArrayList<T>();
for (T i : newlisteners) {
boolean isterm = true;
for (T j : newlisteners) {
@@ -88,18 +88,18 @@
terminals.add(i);
}
}
-
+
if (terminals.size() == 0) {
logger.error("No listener dependency solution: " +
- "No listeners without incoming dependencies");
+ "No listeners without incoming dependencies");
listeners = newlisteners;
return;
}
-
+
// visit depth-first traversing in the opposite order from
// the dependencies. Note we will not generally detect cycles
HashSet<T> visited = new HashSet<T>();
- List<T> ordering = new ArrayList<T>();
+ List<T> ordering = new ArrayList<T>();
for (T term : terminals) {
visit(newlisteners, type, visited, ordering, term);
}
@@ -108,6 +108,7 @@
/**
* Remove the given listener
+ *
* @param listener the listener to remove
*/
public void removeListener(T listener) {
@@ -118,16 +119,17 @@
listeners = newlisteners;
}
}
-
+
/**
* Clear all listeners
*/
public void clearListeners() {
listeners = new ArrayList<T>();
}
-
- /**
- * Get the ordered list of listeners ordered by dependencies
+
+ /**
+ * Get the ordered list of listeners ordered by dependencies
+ *
* @return
*/
public List<T> getOrderedListeners() {
diff --git a/src/main/java/net/floodlightcontroller/core/util/MutableInteger.java b/src/main/java/net/floodlightcontroller/core/util/MutableInteger.java
index 0f070fa..6ac3231 100644
--- a/src/main/java/net/floodlightcontroller/core/util/MutableInteger.java
+++ b/src/main/java/net/floodlightcontroller/core/util/MutableInteger.java
@@ -1,34 +1,34 @@
/**
-* Copyright 2011, Big Switch Networks, Inc.
-* Originally created by David Erickson, Stanford University
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you may
-* not use this file except in compliance with the License. You may obtain
-* a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-* License for the specific language governing permissions and limitations
-* under the License.
-**/
+ * Copyright 2011, Big Switch Networks, Inc.
+ * Originally created by David Erickson, Stanford University
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License. You may obtain
+ * a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ **/
package net.floodlightcontroller.core.util;
public class MutableInteger extends Number {
private static final long serialVersionUID = 1L;
int mutableInt;
-
+
public MutableInteger(int value) {
this.mutableInt = value;
}
-
+
public void setValue(int value) {
this.mutableInt = value;
}
-
+
@Override
public double doubleValue() {
return (double) mutableInt;
diff --git a/src/main/java/net/floodlightcontroller/core/util/SingletonTask.java b/src/main/java/net/floodlightcontroller/core/util/SingletonTask.java
index 0e03144..2338acc 100644
--- a/src/main/java/net/floodlightcontroller/core/util/SingletonTask.java
+++ b/src/main/java/net/floodlightcontroller/core/util/SingletonTask.java
@@ -1,19 +1,19 @@
/**
-* Copyright 2011, Big Switch Networks, Inc.
-* Originally created by David Erickson, Stanford University
-*
-* Licensed under the Apache License, Version 2.0 (the "License"); you may
-* not use this file except in compliance with the License. You may obtain
-* a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-* License for the specific language governing permissions and limitations
-* under the License.
-**/
+ * Copyright 2011, Big Switch Networks, Inc.
+ * Originally created by David Erickson, Stanford University
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License. You may obtain
+ * a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ **/
package net.floodlightcontroller.core.util;
@@ -27,26 +27,26 @@
/**
* This allows you to represent a task that should be queued for future execution
- * but where you only want the task to complete once in response to some sequence
+ * but where you only want the task to complete once in response to some sequence
* of events. For example, if you get a change notification and want to reload state,
* you only want to reload the state once, at the end, and don't want to queue
* an update for every notification that might come in.
- *
+ * <p/>
* The semantics are as follows:
* * If the task hasn't begun yet, do not queue a new task
* * If the task has begun, set a bit to restart it after the current task finishes
*/
public class SingletonTask {
protected final static Logger logger = LoggerFactory.getLogger(SingletonTask.class);
-
- protected static class SingletonTaskContext {
+
+ protected static class SingletonTaskContext {
protected boolean taskShouldRun = false;
protected boolean taskRunning = false;
protected SingletonTaskWorker waitingTask = null;
}
- protected static class SingletonTaskWorker implements Runnable {
+ protected static class SingletonTaskWorker implements Runnable {
SingletonTask parent;
boolean canceled = false;
long nextschedule = 0;
@@ -57,9 +57,9 @@
}
@Override
- @LogMessageDoc(level="ERROR",
- message="Exception while executing task",
- recommendation=LogMessageDoc.GENERIC_ACTION)
+ @LogMessageDoc(level = "ERROR",
+ message = "Exception while executing task",
+ recommendation = LogMessageDoc.GENERIC_ACTION)
public void run() {
synchronized (parent.context) {
if (canceled || !parent.context.taskShouldRun)
@@ -83,9 +83,9 @@
if ((nextschedule <= 0 || (nextschedule - now) <= 0)) {
parent.ses.execute(this);
} else {
- parent.ses.schedule(this,
- nextschedule-now,
- TimeUnit.NANOSECONDS);
+ parent.ses.schedule(this,
+ nextschedule - now,
+ TimeUnit.NANOSECONDS);
}
}
}
@@ -101,11 +101,12 @@
* Construct a new SingletonTask for the given runnable. The context
* is used to manage the state of the task execution and can be shared
* by more than one instance of the runnable.
+ *
* @param context
* @param Task
*/
public SingletonTask(ScheduledExecutorService ses,
- Runnable task) {
+ Runnable task) {
super();
this.task = task;
this.ses = ses;
@@ -117,9 +118,9 @@
* cancel that task and reschedule it to run at the given time. If the
* task is already started, it will cause the task to be rescheduled once
* it completes to run after delay from the time of reschedule.
- *
+ *
* @param delay the delay in scheduling
- * @param unit the timeunit of the delay
+ * @param unit the timeunit of the delay
*/
public void reschedule(long delay, TimeUnit unit) {
boolean needQueue = true;
@@ -131,8 +132,8 @@
// schedule to restart at the right time
if (delay > 0) {
long now = System.nanoTime();
- long then =
- now + TimeUnit.NANOSECONDS.convert(delay, unit);
+ long then =
+ now + TimeUnit.NANOSECONDS.convert(delay, unit);
context.waitingTask.nextschedule = then;
} else {
context.waitingTask.nextschedule = 0;
@@ -148,7 +149,7 @@
context.taskShouldRun = true;
if (needQueue) {
- stw = context.waitingTask = new SingletonTaskWorker(this);
+ stw = context.waitingTask = new SingletonTaskWorker(this);
}
}