本文整理汇总了Java中net.floodlightcontroller.util.MultiIterator类的典型用法代码示例。如果您正苦于以下问题:Java MultiIterator类的具体用法?Java MultiIterator怎么用?Java MultiIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MultiIterator类属于net.floodlightcontroller.util包,在下文中一共展示了MultiIterator类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: queryClassDevices
import net.floodlightcontroller.util.MultiIterator; //导入依赖的package包/类
@Override
public Iterator<? extends IDevice> queryClassDevices(@Nonnull IEntityClass entityClass,
@Nonnull MacAddress macAddress,
@Nonnull VlanVid vlan,
@Nonnull IPv4Address ipv4Address,
@Nonnull IPv6Address ipv6Address,
@Nonnull DatapathId switchDPID,
@Nonnull OFPort switchPort) {
if (macAddress == null) {
throw new IllegalArgumentException("MAC address cannot be null. Try MacAddress.NONE if intention is 'no MAC'");
}
if (ipv4Address == null) {
throw new IllegalArgumentException("IPv4 address cannot be null. Try IPv4Address.NONE if intention is 'no IPv4'");
}
if (ipv6Address == null) {
throw new IllegalArgumentException("IPv6 address cannot be null. Try IPv6Address.NONE if intention is 'no IPv6'");
}
/* VLAN can be null, which means 'don't care' */
if (switchDPID == null) {
throw new IllegalArgumentException("Switch DPID cannot be null. Try DatapathId.NONE if intention is 'no DPID'");
}
if (switchPort == null) {
throw new IllegalArgumentException("Switch port cannot be null. Try OFPort.ZERO if intention is 'no port'");
}
ArrayList<Iterator<Device>> iterators =
new ArrayList<Iterator<Device>>();
ClassState classState = getClassState(entityClass);
DeviceIndex index = null;
if (classState.secondaryIndexMap.size() > 0) {
EnumSet<DeviceField> keys =
getEntityKeys(macAddress, vlan, ipv4Address,
ipv6Address, switchDPID, switchPort);
index = classState.secondaryIndexMap.get(keys);
}
Iterator<Device> iter;
if (index == null) {
index = classState.classIndex;
if (index == null) {
// scan all devices
return new DeviceIterator(deviceMap.values().iterator(),
new IEntityClass[] { entityClass },
macAddress, vlan, ipv4Address,
ipv6Address, switchDPID, switchPort);
} else {
// scan the entire class
iter = new DeviceIndexInterator(this, index.getAll());
}
} else {
// index lookup
Entity entity =
new Entity(macAddress,
vlan,
ipv4Address,
ipv6Address,
switchDPID,
switchPort,
Entity.NO_DATE);
iter = new DeviceIndexInterator(this,
index.queryByEntity(entity));
}
iterators.add(iter);
return new MultiIterator<Device>(iterators.iterator());
}
示例2: queryClassDevices
import net.floodlightcontroller.util.MultiIterator; //导入依赖的package包/类
@Override
public Iterator<? extends IDevice> queryClassDevices(IEntityClass entityClass,
MacAddress macAddress,
VlanVid vlan,
IPv4Address ipv4Address,
DatapathId switchDPID,
OFPort switchPort) {
ArrayList<Iterator<Device>> iterators =
new ArrayList<Iterator<Device>>();
ClassState classState = getClassState(entityClass);
DeviceIndex index = null;
if (classState.secondaryIndexMap.size() > 0) {
EnumSet<DeviceField> keys =
getEntityKeys(macAddress, vlan, ipv4Address,
switchDPID, switchPort);
index = classState.secondaryIndexMap.get(keys);
}
Iterator<Device> iter;
if (index == null) {
index = classState.classIndex;
if (index == null) {
// scan all devices
return new DeviceIterator(deviceMap.values().iterator(),
new IEntityClass[] { entityClass },
macAddress, vlan, ipv4Address,
switchDPID, switchPort);
} else {
// scan the entire class
iter = new DeviceIndexInterator(this, index.getAll());
}
} else {
// index lookup
Entity entity =
new Entity(macAddress,
vlan,
ipv4Address,
switchDPID,
switchPort,
null);
iter = new DeviceIndexInterator(this,
index.queryByEntity(entity));
}
iterators.add(iter);
return new MultiIterator<Device>(iterators.iterator());
}
示例3: queryClassDevices
import net.floodlightcontroller.util.MultiIterator; //导入依赖的package包/类
@Override
public Iterator<? extends IDevice> queryClassDevices(IEntityClass entityClass,
Long macAddress,
Short vlan,
Integer ipv4Address,
Long switchDPID,
Integer switchPort) {
ArrayList<Iterator<Device>> iterators =
new ArrayList<Iterator<Device>>();
ClassState classState = getClassState(entityClass);
DeviceIndex index = null;
if (classState.secondaryIndexMap.size() > 0) {
EnumSet<DeviceField> keys =
getEntityKeys(macAddress, vlan, ipv4Address,
switchDPID, switchPort);
index = classState.secondaryIndexMap.get(keys);
}
Iterator<Device> iter;
if (index == null) {
index = classState.classIndex;
if (index == null) {
// scan all devices
return new DeviceIterator(deviceMap.values().iterator(),
new IEntityClass[] { entityClass },
macAddress, vlan, ipv4Address,
switchDPID, switchPort);
} else {
// scan the entire class
iter = new DeviceIndexInterator(this, index.getAll());
}
} else {
// index lookup
Entity entity =
new Entity((macAddress == null ? 0 : macAddress),
vlan,
ipv4Address,
switchDPID,
switchPort,
null);
iter = new DeviceIndexInterator(this,
index.queryByEntity(entity));
}
iterators.add(iter);
return new MultiIterator<Device>(iterators.iterator());
}
示例4: queryClassDevices
import net.floodlightcontroller.util.MultiIterator; //导入依赖的package包/类
@Override
public Iterator<? extends IDevice> queryClassDevices(@Nonnull IEntityClass entityClass,
@Nonnull MacAddress macAddress,
@Nonnull VlanVid vlan,
@Nonnull IPv4Address ipv4Address,
@Nonnull IPv6Address ipv6Address,
@Nonnull DatapathId switchDPID,
@Nonnull OFPort switchPort) {
if (macAddress == null) {
throw new IllegalArgumentException("MAC address cannot be null. Try MacAddress.NONE if intention is 'no MAC'");
}
if (ipv4Address == null) {
throw new IllegalArgumentException("IPv4 address cannot be null. Try IPv4Address.NONE if intention is 'no IPv4'");
}
if (ipv6Address == null) {
throw new IllegalArgumentException("IPv6 address cannot be null. Try IPv6Address.NONE if intention is 'no IPv6'");
}
/* VLAN can be null, which means 'don't care' */
if (switchDPID == null) {
throw new IllegalArgumentException("Switch DPID cannot be null. Try DatapathId.NONE if intention is 'no DPID'");
}
if (switchPort == null) {
throw new IllegalArgumentException("Switch port cannot be null. Try OFPort.ZERO if intention is 'no port'");
}
ArrayList<Iterator<Device>> iterators =
new ArrayList<Iterator<Device>>();
ClassState classState = getClassState(entityClass);
DeviceIndex index = null;
if (classState.secondaryIndexMap.size() > 0) {
EnumSet<DeviceField> keys =
getEntityKeys(macAddress, vlan, ipv4Address,
ipv6Address, switchDPID, switchPort);
index = classState.secondaryIndexMap.get(keys);
}
Iterator<Device> iter;
if (index == null) {
index = classState.classIndex;
if (index == null) {
// scan all devices
return new DeviceIterator(deviceMap.values().iterator(),
new IEntityClass[] { entityClass },
macAddress, vlan, ipv4Address,
ipv6Address, switchDPID, switchPort);
} else {
// scan the entire class
iter = new DeviceIndexInterator(this, index.getAll());
}
} else {
// index lookup
Entity entity =
new Entity(macAddress,
vlan,
ipv4Address,
ipv6Address,
switchDPID,
switchPort,
Entity.NO_DATE);
iter = new DeviceIndexInterator(this,
index.queryByEntity(entity));
}
iterators.add(iter);
return new MultiIterator<Device>(iterators.iterator());
}
示例5: queryClassDevices
import net.floodlightcontroller.util.MultiIterator; //导入依赖的package包/类
@Override
public Iterator<? extends IDevice> queryClassDevices(IDevice reference,
Long macAddress,
Short vlan,
Integer ipv4Address,
Long switchDPID,
Integer switchPort) {
IEntityClass entityClass = reference.getEntityClass();
ArrayList<Iterator<Device>> iterators =
new ArrayList<Iterator<Device>>();
ClassState classState = getClassState(entityClass);
DeviceIndex index = null;
if (classState.secondaryIndexMap.size() > 0) {
EnumSet<DeviceField> keys =
getEntityKeys(macAddress, vlan, ipv4Address,
switchDPID, switchPort);
index = classState.secondaryIndexMap.get(keys);
}
Iterator<Device> iter;
if (index == null) {
index = classState.classIndex;
if (index == null) {
// scan all devices
return new DeviceIterator(deviceMap.values().iterator(),
new IEntityClass[] { entityClass },
macAddress, vlan, ipv4Address,
switchDPID, switchPort);
} else {
// scan the entire class
iter = new DeviceIndexInterator(this, index.getAll());
}
} else {
// index lookup
Entity entity =
new Entity((macAddress == null ? 0 : macAddress),
vlan,
ipv4Address,
switchDPID,
switchPort,
null);
iter = new DeviceIndexInterator(this,
index.queryByEntity(entity));
}
iterators.add(iter);
return new MultiIterator<Device>(iterators.iterator());
}
开发者ID:vishalshubham,项目名称:Multipath-Hedera-system-in-Floodlight-controller,代码行数:50,代码来源:DeviceManagerImpl.java
示例6: queryClassDevices
import net.floodlightcontroller.util.MultiIterator; //导入依赖的package包/类
@Override
public Iterator<? extends IDevice> queryClassDevices(IEntityClass entityClass,
Long macAddress,
Short vlan,
Integer ipv4Address,
Long switchDPID,
Integer switchPort) {
ArrayList<Iterator<Device>> iterators =
new ArrayList<Iterator<Device>>();
ClassState classState = getClassState(entityClass);
DeviceIndex index = null;
if (classState.secondaryIndexMap.size() > 0) {
EnumSet<DeviceField> keys =
getEntityKeys(macAddress, vlan, ipv4Address,
switchDPID, switchPort);
index = classState.secondaryIndexMap.get(keys);
}
Iterator<Device> iter;
if (index == null) {
index = classState.classIndex;
if (index == null) {
// scan all devices
return new DeviceIterator(deviceMap.values().iterator(),
new IEntityClass[] { entityClass },
macAddress, vlan, ipv4Address,
switchDPID, switchPort);
} else {
// scan the entire class
iter = new DeviceIndexInterator(this, index.getAll());
}
} else {
// index lookup
Entity entity =
new Entity((macAddress == null ? 0 : macAddress),
vlan,
ipv4Address,
switchDPID,
switchPort,
null);
iter = new DeviceIndexInterator(this,
index.queryByEntity(entity));
}
iterators.add(iter);
return new MultiIterator<Device>(iterators.iterator());
}