Convert neutron service base classes to unix line delimiters.
[controller.git] / opendaylight / networkconfiguration / neutron / src / main / java / org / opendaylight / controller / networkconfig / neutron / NeutronSubnet_IPAllocationPool.java
index b4bbd11704c5f36f97bfa6ca89541022b93988f0..7829ba2199aac43b5e7ac99c2fa730d656436562 100644 (file)
-/*\r
- * Copyright IBM Corporation, 2013.  All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.controller.networkconfig.neutron;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import javax.xml.bind.annotation.XmlAccessType;\r
-import javax.xml.bind.annotation.XmlAccessorType;\r
-import javax.xml.bind.annotation.XmlElement;\r
-import javax.xml.bind.annotation.XmlRootElement;\r
-\r
-@XmlRootElement\r
-@XmlAccessorType(XmlAccessType.NONE)\r
-public class NeutronSubnet_IPAllocationPool {\r
-    // See OpenStack Network API v2.0 Reference for description of\r
-    // annotated attributes\r
-\r
-    @XmlElement(name="start")\r
-    String poolStart;\r
-\r
-    @XmlElement(name="end")\r
-    String poolEnd;\r
-\r
-    public NeutronSubnet_IPAllocationPool() { }\r
-\r
-    public NeutronSubnet_IPAllocationPool(String lowAddress, String highAddress) {\r
-        poolStart = lowAddress;\r
-        poolEnd = highAddress;\r
-    }\r
-\r
-    public String getPoolStart() {\r
-        return poolStart;\r
-    }\r
-\r
-    public void setPoolStart(String poolStart) {\r
-        this.poolStart = poolStart;\r
-    }\r
-\r
-    public String getPoolEnd() {\r
-        return poolEnd;\r
-    }\r
-\r
-    public void setPoolEnd(String poolEnd) {\r
-        this.poolEnd = poolEnd;\r
-    }\r
-\r
-    /**\r
-     * This method determines if this allocation pool contains the\r
-     * input IPv4 address\r
-     *\r
-     * @param inputString\r
-     *            IPv4 address in dotted decimal format\r
-     * @returns a boolean on whether the pool contains the address or not\r
-     */\r
-\r
-    public boolean contains(String inputString) {\r
-        long inputIP = convert(inputString);\r
-        long startIP = convert(poolStart);\r
-        long endIP = convert(poolEnd);\r
-        return (inputIP >= startIP && inputIP <= endIP);\r
-    }\r
-\r
-    /**\r
-     * This static method converts the supplied IPv4 address to a long\r
-     * integer for comparison\r
-     *\r
-     * @param inputString\r
-     *            IPv4 address in dotted decimal format\r
-     * @returns high-endian representation of the IPv4 address as a long\r
-     */\r
-\r
-    static long convert(String inputString) {\r
-        long ans = 0;\r
-        String[] parts = inputString.split("\\.");\r
-        for (String part: parts) {\r
-            ans <<= 8;\r
-            ans |= Integer.parseInt(part);\r
-        }\r
-        return ans;\r
-    }\r
-\r
-    /**\r
-     * This static method converts the supplied high-ending long back\r
-     * into a dotted decimal representation of an IPv4 address\r
-     *\r
-     * @param l\r
-     *            high-endian representation of the IPv4 address as a long\r
-     * @returns IPv4 address in dotted decimal format\r
-     */\r
-    static String longtoIP(long l) {\r
-        int i;\r
-        String[] parts = new String[4];\r
-        for (i=0; i<4; i++) {\r
-            parts[3-i] = String.valueOf(l & 255);\r
-            l >>= 8;\r
-        }\r
-        return join(parts,".");\r
-    }\r
-\r
-    /*\r
-     * helper routine used by longtoIP\r
-     */\r
-    public static String join(String r[],String d)\r
-    {\r
-        if (r.length == 0) return "";\r
-        StringBuilder sb = new StringBuilder();\r
-        int i;\r
-        for(i=0;i<r.length-1;i++) {\r
-            sb.append(r[i]+d);\r
-        }\r
-        return sb.toString()+r[i];\r
-    }\r
-\r
-    /*\r
-     * This method splits the current instance by removing the supplied\r
-     * parameter.\r
-     *\r
-     * If the parameter is either the low or high address,\r
-     * then that member is adjusted and a list containing just this instance\r
-     * is returned.\r
-     *\r
-     * If the parameter is in the middle of the pool, then\r
-     * create two new instances, one ranging from low to parameter-1\r
-     * the other ranging from parameter+1 to high\r
-     */\r
-    public List<NeutronSubnet_IPAllocationPool> splitPool(String ipAddress) {\r
-        List<NeutronSubnet_IPAllocationPool> ans = new ArrayList<NeutronSubnet_IPAllocationPool>();\r
-        long gIP = NeutronSubnet_IPAllocationPool.convert(ipAddress);\r
-        long sIP = NeutronSubnet_IPAllocationPool.convert(poolStart);\r
-        long eIP = NeutronSubnet_IPAllocationPool.convert(poolEnd);\r
-        long i;\r
-        NeutronSubnet_IPAllocationPool p = new NeutronSubnet_IPAllocationPool();\r
-        boolean poolStarted = false;\r
-        for (i=sIP; i<=eIP; i++) {\r
-            if (i == sIP) {\r
-                if (i != gIP) {\r
-                    p.setPoolStart(poolStart);\r
-                    poolStarted = true;\r
-                }\r
-            }\r
-            if (i == eIP) {\r
-                if (i != gIP) {\r
-                    p.setPoolEnd(poolEnd);\r
-                } else {\r
-                    p.setPoolEnd(NeutronSubnet_IPAllocationPool.longtoIP(i-1));\r
-                }\r
-                ans.add(p);\r
-            }\r
-            if (i != sIP && i != eIP) {\r
-                if (i != gIP) {\r
-                    if (!poolStarted) {\r
-                        p.setPoolStart(NeutronSubnet_IPAllocationPool.longtoIP(i));\r
-                        poolStarted = true;\r
-                    }\r
-                } else {\r
-                    p.setPoolEnd(NeutronSubnet_IPAllocationPool.longtoIP(i-1));\r
-                    poolStarted = false;\r
-                    ans.add(p);\r
-                    p = new NeutronSubnet_IPAllocationPool();\r
-                }\r
-            }\r
-        }\r
-        return ans;\r
-    }\r
-}\r
+/*
+ * Copyright IBM Corporation, 2013.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.controller.networkconfig.neutron;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+public class NeutronSubnet_IPAllocationPool {
+    // See OpenStack Network API v2.0 Reference for description of
+    // annotated attributes
+
+    @XmlElement(name="start")
+    String poolStart;
+
+    @XmlElement(name="end")
+    String poolEnd;
+
+    public NeutronSubnet_IPAllocationPool() { }
+
+    public NeutronSubnet_IPAllocationPool(String lowAddress, String highAddress) {
+        poolStart = lowAddress;
+        poolEnd = highAddress;
+    }
+
+    public String getPoolStart() {
+        return poolStart;
+    }
+
+    public void setPoolStart(String poolStart) {
+        this.poolStart = poolStart;
+    }
+
+    public String getPoolEnd() {
+        return poolEnd;
+    }
+
+    public void setPoolEnd(String poolEnd) {
+        this.poolEnd = poolEnd;
+    }
+
+    /**
+     * This method determines if this allocation pool contains the
+     * input IPv4 address
+     *
+     * @param inputString
+     *            IPv4 address in dotted decimal format
+     * @returns a boolean on whether the pool contains the address or not
+     */
+
+    public boolean contains(String inputString) {
+        long inputIP = convert(inputString);
+        long startIP = convert(poolStart);
+        long endIP = convert(poolEnd);
+        return (inputIP >= startIP && inputIP <= endIP);
+    }
+
+    /**
+     * This static method converts the supplied IPv4 address to a long
+     * integer for comparison
+     *
+     * @param inputString
+     *            IPv4 address in dotted decimal format
+     * @returns high-endian representation of the IPv4 address as a long
+     */
+
+    static long convert(String inputString) {
+        long ans = 0;
+        String[] parts = inputString.split("\\.");
+        for (String part: parts) {
+            ans <<= 8;
+            ans |= Integer.parseInt(part);
+        }
+        return ans;
+    }
+
+    /**
+     * This static method converts the supplied high-ending long back
+     * into a dotted decimal representation of an IPv4 address
+     *
+     * @param l
+     *            high-endian representation of the IPv4 address as a long
+     * @returns IPv4 address in dotted decimal format
+     */
+    static String longtoIP(long l) {
+        int i;
+        String[] parts = new String[4];
+        for (i=0; i<4; i++) {
+            parts[3-i] = String.valueOf(l & 255);
+            l >>= 8;
+        }
+        return join(parts,".");
+    }
+
+    /*
+     * helper routine used by longtoIP
+     */
+    public static String join(String r[],String d)
+    {
+        if (r.length == 0) {
+            return "";
+        }
+        StringBuilder sb = new StringBuilder();
+        int i;
+        for(i=0;i<r.length-1;i++) {
+            sb.append(r[i]+d);
+        }
+        return sb.toString()+r[i];
+    }
+
+    /*
+     * This method splits the current instance by removing the supplied
+     * parameter.
+     *
+     * If the parameter is either the low or high address,
+     * then that member is adjusted and a list containing just this instance
+     * is returned.
+     *
+     * If the parameter is in the middle of the pool, then
+     * create two new instances, one ranging from low to parameter-1
+     * the other ranging from parameter+1 to high
+     */
+    public List<NeutronSubnet_IPAllocationPool> splitPool(String ipAddress) {
+        List<NeutronSubnet_IPAllocationPool> ans = new ArrayList<NeutronSubnet_IPAllocationPool>();
+        long gIP = NeutronSubnet_IPAllocationPool.convert(ipAddress);
+        long sIP = NeutronSubnet_IPAllocationPool.convert(poolStart);
+        long eIP = NeutronSubnet_IPAllocationPool.convert(poolEnd);
+        long i;
+        NeutronSubnet_IPAllocationPool p = new NeutronSubnet_IPAllocationPool();
+        boolean poolStarted = false;
+        for (i=sIP; i<=eIP; i++) {
+            if (i == sIP) {
+                if (i != gIP) {
+                    p.setPoolStart(poolStart);
+                    poolStarted = true;
+                }
+            }
+            if (i == eIP) {
+                if (i != gIP) {
+                    p.setPoolEnd(poolEnd);
+                } else {
+                    p.setPoolEnd(NeutronSubnet_IPAllocationPool.longtoIP(i-1));
+                }
+                ans.add(p);
+            }
+            if (i != sIP && i != eIP) {
+                if (i != gIP) {
+                    if (!poolStarted) {
+                        p.setPoolStart(NeutronSubnet_IPAllocationPool.longtoIP(i));
+                        poolStarted = true;
+                    }
+                } else {
+                    p.setPoolEnd(NeutronSubnet_IPAllocationPool.longtoIP(i-1));
+                    poolStarted = false;
+                    ans.add(p);
+                    p = new NeutronSubnet_IPAllocationPool();
+                }
+            }
+        }
+        return ans;
+    }
+}