added simple storage to SimpleFlowRuleManager

Change-Id: I7f9117c534673b00f2822cf90bd63d52b95d2704
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/DefaultFlowEntry.java b/core/api/src/main/java/org/onlab/onos/net/flow/DefaultFlowEntry.java
new file mode 100644
index 0000000..3f86697
--- /dev/null
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/DefaultFlowEntry.java
@@ -0,0 +1,88 @@
+package org.onlab.onos.net.flow;
+
+import org.onlab.onos.net.DeviceId;
+
+public class DefaultFlowEntry extends DefaultFlowRule implements FlowEntry {
+
+    private final int priority;
+    private final long created;
+    private final FlowId id;
+
+    public DefaultFlowEntry(DefaultFlowEntry entry) {
+        super(entry.deviceId(), entry.selector(), entry.treatment());
+        this.priority = entry.priority;
+        this.created = entry.created;
+        this.id = entry.id;
+    }
+
+    public DefaultFlowEntry(DeviceId deviceId, TrafficSelector selector,
+            TrafficTreatment treatment, int priority) {
+        super(deviceId, selector, treatment);
+        this.priority = priority;
+        this.created = System.currentTimeMillis();
+        this.id = FlowId.valueOf(this.hashCode());
+    }
+
+    @Override
+    public FlowId id() {
+        return null;
+    }
+
+    @Override
+    public int priority() {
+        return priority;
+    }
+
+    @Override
+    public long lifeMillis() {
+        return (created - System.currentTimeMillis());
+    }
+
+    @Override
+    public long idleMillis() {
+        return 0;
+    }
+
+    @Override
+    public long packets() {
+        return 0;
+    }
+
+    @Override
+    public long bytes() {
+        return 0;
+    }
+
+    @Override
+    /*
+     * currently uses the parts that definitely have a defined hashcode...
+     *
+     * (non-Javadoc)
+     * @see java.lang.Object#hashCode()
+     */
+    public int hashCode() {
+        final int prime = 31;
+        int result = prime * this.deviceId().hashCode();
+        result = prime * result + Long.valueOf(this.created).hashCode();
+        return result;
+    }
+
+    @Override
+    /*
+     * The priority and statistics can change on a given treatment and selector
+     *
+     * (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals(Object obj) {
+        if (obj instanceof DefaultFlowEntry) {
+            DefaultFlowEntry that = (DefaultFlowEntry) obj;
+            if (!this.id.equals(that.id())) {
+                return false;
+            }
+            return super.equals(obj);
+        }
+        return false;
+    }
+
+}
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/DefaultFlowRule.java b/core/api/src/main/java/org/onlab/onos/net/flow/DefaultFlowRule.java
index 801e8f9..9a24091 100644
--- a/core/api/src/main/java/org/onlab/onos/net/flow/DefaultFlowRule.java
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/DefaultFlowRule.java
@@ -35,4 +35,37 @@
         return treatment;
     }
 
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = prime * this.deviceId().hashCode();
+        result = prime * result + selector.hashCode();
+        result = prime * result + treatment.hashCode();
+        return result;
+    }
+
+    @Override
+    /*
+     * The priority and statistics can change on a given treatment and selector
+     *
+     * (non-Javadoc)
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    public boolean equals(Object obj) {
+        if (obj instanceof FlowRule) {
+            DefaultFlowRule that = (DefaultFlowRule) obj;
+            if (!this.deviceId().equals(that.deviceId())) {
+                return false;
+            }
+            if (!this.treatment().equals(that.treatment())) {
+                return false;
+            }
+            if (!this.selector().equals(that.selector())) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+
 }
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/FlowEntry.java b/core/api/src/main/java/org/onlab/onos/net/flow/FlowEntry.java
index 7bef2c8..7fee1c1 100644
--- a/core/api/src/main/java/org/onlab/onos/net/flow/FlowEntry.java
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/FlowEntry.java
@@ -5,7 +5,11 @@
  */
 public interface FlowEntry extends FlowRule {
 
-
+    /**
+     * Returns the ID of this flow.
+     *
+     * @return the flow ID
+     */
     FlowId id();
 
     /**
diff --git a/core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleService.java b/core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleService.java
index 85d5680..71434c7 100644
--- a/core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleService.java
+++ b/core/api/src/main/java/org/onlab/onos/net/flow/FlowRuleService.java
@@ -1,5 +1,7 @@
 package org.onlab.onos.net.flow;
 
+import java.util.List;
+
 import org.onlab.onos.net.DeviceId;
 
 /**
@@ -30,7 +32,7 @@
      * throws SomeKindOfException that indicates which ones were applied and
      *                  which ones failed
      */
-    void applyFlowRules(FlowRule... flowRules);
+    List<FlowEntry> applyFlowRules(FlowRule... flowRules);
 
     /**
      * Removes the specified flow rules from their respective devices. If the