Rename Bandwidth to BandwidthResource
To distinguish unit of bandwidth and resource of bandwidth
Change-Id: Ice52538f0c00f6d7743ca247d0f9bab3febdc94b
diff --git a/core/api/src/main/java/org/onosproject/net/resource/Bandwidth.java b/core/api/src/main/java/org/onosproject/net/resource/BandwidthResource.java
similarity index 66%
rename from core/api/src/main/java/org/onosproject/net/resource/Bandwidth.java
rename to core/api/src/main/java/org/onosproject/net/resource/BandwidthResource.java
index 15fe820..b74c2eb 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/Bandwidth.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/BandwidthResource.java
@@ -20,7 +20,7 @@
/**
* Representation of bandwidth resource in bps.
*/
-public final class Bandwidth extends LinkResource {
+public final class BandwidthResource extends LinkResource {
private final double bandwidth;
@@ -29,12 +29,12 @@
*
* @param bandwidth bandwidth value to be assigned
*/
- private Bandwidth(double bandwidth) {
+ private BandwidthResource(double bandwidth) {
this.bandwidth = bandwidth;
}
// Constructor for serialization
- private Bandwidth() {
+ private BandwidthResource() {
this.bandwidth = 0;
}
@@ -42,10 +42,10 @@
* Creates a new instance with given bandwidth in bps.
*
* @param bandwidth bandwidth value to be assigned
- * @return {@link Bandwidth} instance with given bandwidth
+ * @return {@link BandwidthResource} instance with given bandwidth
*/
@Deprecated
- public static Bandwidth valueOf(double bandwidth) {
+ public static BandwidthResource valueOf(double bandwidth) {
return bps(bandwidth);
}
@@ -53,40 +53,40 @@
* Creates a new instance with given bandwidth in bps.
*
* @param bandwidth bandwidth value to be assigned
- * @return {@link Bandwidth} instance with given bandwidth
+ * @return {@link BandwidthResource} instance with given bandwidth
*/
- public static Bandwidth bps(double bandwidth) {
- return new Bandwidth(bandwidth);
+ public static BandwidthResource bps(double bandwidth) {
+ return new BandwidthResource(bandwidth);
}
/**
* Creates a new instance with given bandwidth in Kbps.
*
* @param bandwidth bandwidth value to be assigned
- * @return {@link Bandwidth} instance with given bandwidth
+ * @return {@link BandwidthResource} instance with given bandwidth
*/
- public static Bandwidth kbps(double bandwidth) {
- return new Bandwidth(bandwidth * 1_000L);
+ public static BandwidthResource kbps(double bandwidth) {
+ return new BandwidthResource(bandwidth * 1_000L);
}
/**
* Creates a new instance with given bandwidth in Mbps.
*
* @param bandwidth bandwidth value to be assigned
- * @return {@link Bandwidth} instance with given bandwidth
+ * @return {@link BandwidthResource} instance with given bandwidth
*/
- public static Bandwidth mbps(double bandwidth) {
- return new Bandwidth(bandwidth * 1_000_000L);
+ public static BandwidthResource mbps(double bandwidth) {
+ return new BandwidthResource(bandwidth * 1_000_000L);
}
/**
* Creates a new instance with given bandwidth in Gbps.
*
* @param bandwidth bandwidth value to be assigned
- * @return {@link Bandwidth} instance with given bandwidth
+ * @return {@link BandwidthResource} instance with given bandwidth
*/
- public static Bandwidth gbps(double bandwidth) {
- return new Bandwidth(bandwidth * 1_000_000_000L);
+ public static BandwidthResource gbps(double bandwidth) {
+ return new BandwidthResource(bandwidth * 1_000_000_000L);
}
/**
@@ -100,8 +100,8 @@
@Override
public boolean equals(Object obj) {
- if (obj instanceof Bandwidth) {
- Bandwidth that = (Bandwidth) obj;
+ if (obj instanceof BandwidthResource) {
+ BandwidthResource that = (BandwidthResource) obj;
return Objects.equals(this.bandwidth, that.bandwidth);
}
return false;
diff --git a/core/api/src/main/java/org/onosproject/net/resource/BandwidthResourceAllocation.java b/core/api/src/main/java/org/onosproject/net/resource/BandwidthResourceAllocation.java
index b2628aa..7260536 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/BandwidthResourceAllocation.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/BandwidthResourceAllocation.java
@@ -29,12 +29,12 @@
}
/**
- * Creates a new {@link BandwidthResourceAllocation} with {@link Bandwidth}
+ * Creates a new {@link BandwidthResourceAllocation} with {@link BandwidthResource}
* object.
*
* @param bandwidth allocated bandwidth
*/
- public BandwidthResourceAllocation(Bandwidth bandwidth) {
+ public BandwidthResourceAllocation(BandwidthResource bandwidth) {
super(bandwidth);
}
diff --git a/core/api/src/main/java/org/onosproject/net/resource/BandwidthResourceRequest.java b/core/api/src/main/java/org/onosproject/net/resource/BandwidthResourceRequest.java
index 4e012fc..bf72d42 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/BandwidthResourceRequest.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/BandwidthResourceRequest.java
@@ -23,15 +23,15 @@
* Representation of a request for bandwidth resource.
*/
public class BandwidthResourceRequest implements ResourceRequest {
- private final Bandwidth bandwidth;
+ private final BandwidthResource bandwidth;
/**
- * Creates a new {@link BandwidthResourceRequest} with {@link Bandwidth}
+ * Creates a new {@link BandwidthResourceRequest} with {@link BandwidthResource}
* object.
*
- * @param bandwidth {@link Bandwidth} object to be requested
+ * @param bandwidth {@link BandwidthResource} object to be requested
*/
- public BandwidthResourceRequest(Bandwidth bandwidth) {
+ public BandwidthResourceRequest(BandwidthResource bandwidth) {
this.bandwidth = bandwidth;
}
@@ -40,7 +40,7 @@
*
* @return the bandwidth resource
*/
- public Bandwidth bandwidth() {
+ public BandwidthResource bandwidth() {
return bandwidth;
}
diff --git a/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceRequest.java b/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceRequest.java
index 0c6f4bf..1ec1fc4 100644
--- a/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceRequest.java
+++ b/core/api/src/main/java/org/onosproject/net/resource/DefaultLinkResourceRequest.java
@@ -137,7 +137,7 @@
*/
@Override
public Builder addBandwidthRequest(double bandwidth) {
- resources.add(new BandwidthResourceRequest(Bandwidth.bps(bandwidth)));
+ resources.add(new BandwidthResourceRequest(BandwidthResource.bps(bandwidth)));
return this;
}