Murat Parlakisik | f95672c | 2016-12-05 00:53:17 -0800 | [diff] [blame] | 1 | |
| 2 | public List<OFBucket> insertBucketBasedOnCommandBucketId(OFBucket bucket) { |
| 3 | if(commandBucketId == null) |
| 4 | throw new IllegalStateException("CommandBucketId is null"); |
| 5 | if(commandBucketId.equals(OFGroupBucket.BUCKET_FIRST)) |
| 6 | buckets.add(0, bucket); |
| 7 | else if(commandBucketId.equals(OFGroupBucket.BUCKET_LAST)) |
| 8 | buckets.add(buckets.size(), bucket); |
| 9 | return buckets; |
| 10 | } |
| 11 | |
| 12 | |
| 13 | public List<OFBucket> insertBucketBasedOnSpecificIndex(OFBucket bucket, int index) { |
| 14 | if(index <= buckets.size()) |
| 15 | buckets.add(index,bucket); |
| 16 | else |
| 17 | throw new IllegalStateException("Index is not valid"); |
| 18 | return buckets; |
| 19 | } |