private SimpleAddress getNextELPHop(ExplicitLocatorPath elp, List<ItrRloc> itrRlocs) { SimpleAddress nextHop = null; List<Hop> hops = elp.getExplicitLocatorPath().getHop(); if (hops != null && hops.size() > 0) { // By default we return the first hop nextHop = hops.get(0).getAddress(); for (Hop hop : hops) { Address hopAddress = LispAddressUtil.addressFromSimpleAddress(hop.getAddress()); for (ItrRloc itrRloc : itrRlocs) { if (itrRloc.getRloc().getAddress().equals(hopAddress)) { int iterator = hops.indexOf(hop); if (iterator < hops.size() - 1) { nextHop = hops.get(iterator + 1).getAddress(); return nextHop; } } } } } return nextHop; }
public HopBuilder(Hop base) { this.key = base.key(); this._hopId = base.getHopId(); this._address = base.getAddress(); this._lrsBits = base.getLrsBits(); if (base instanceof HopImpl) { HopImpl impl = (HopImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") Map<Class<? extends Augmentation<Hop>>, Augmentation<Hop>> aug =((AugmentationHolder<Hop>) base).augmentations(); if (!aug.isEmpty()) { this.augmentation = new HashMap<>(aug); } } }
if (!Objects.equals(_address, other.getAddress())) { return false;
if (!Objects.equals(_address, other.getAddress())) { return false;
public HopBuilder(Hop base) { if (base.key() == null) { this.key = new HopKey( base.getHopId() ); this._hopId = base.getHopId(); } else { this.key = base.key(); this._hopId = key.getHopId(); } this._address = base.getAddress(); this._lrsBits = base.getLrsBits(); if (base instanceof HopImpl) { HopImpl impl = (HopImpl) base; if (!impl.augmentation.isEmpty()) { this.augmentation = new HashMap<>(impl.augmentation); } } else if (base instanceof AugmentationHolder) { @SuppressWarnings("unchecked") AugmentationHolder<Hop> casted =(AugmentationHolder<Hop>) base; if (!casted.augmentations().isEmpty()) { this.augmentation = new HashMap<>(casted.augmentations()); } } }
SimpleAddress nextHop = hops.get(index).getAddress(); LocatorRecordBuilder lrb = new LocatorRecordBuilder(locatorRecord); lrb.setRloc(LispAddressUtil.toRloc(nextHop));