@Test public void testGetIncomingEdgesNonExistentNode() { OspfNeighborConfigId n = new OspfNeighborConfigId( "h1", "vrf1", "p", "i1", ConcreteInterfaceAddress.parse("192.0.2.0/31")); assertThat(EMPTY.incomingEdges(n), empty()); }
@Nonnull public Set<EdgeId> incomingEdges(OspfNeighborConfigId head) { if (!_graph.nodes().contains(head)) { return ImmutableSet.of(); } return _graph.predecessors(head).stream() .map(tail -> makeEdge(tail, head)) .collect(ImmutableSet.toImmutableSet()); }
OspfTopology { @Nonnull public Set<EdgeId> incomingEdges(OspfNeighborConfigId head) { if (!_graph.nodes().contains(head)) { return ImmutableSet.of(); } return _graph.predecessors(head).stream() .map(tail -> makeEdge(tail, head)) .collect(ImmutableSet.toImmutableSet()); } }
OspfTopology { @Nonnull public Set<EdgeId> incomingEdges(OspfNeighborConfigId head) { if (!_graph.nodes().contains(head)) { return ImmutableSet.of(); } return _graph.predecessors(head).stream() .map(tail -> makeEdge(tail, head)) .collect(ImmutableSet.toImmutableSet()); } OspfTopology(ValueGraph<OspfNeighborConfigId, OspfSessionProperties> graph); }
OspfTopology { @Nonnull public Set<EdgeId> incomingEdges(OspfNeighborConfigId head) { if (!_graph.nodes().contains(head)) { return ImmutableSet.of(); } return _graph.predecessors(head).stream() .map(tail -> makeEdge(tail, head)) .collect(ImmutableSet.toImmutableSet()); } OspfTopology(ValueGraph<OspfNeighborConfigId, OspfSessionProperties> graph); @Nonnull Set<OspfNeighborConfigId> neighbors(OspfNeighborConfigId node); @Nonnull Set<EdgeId> edges(); @JsonProperty(PROP_NODES) @Nonnull Set<OspfNeighborConfigId> getNodes(); @Nonnull Optional<OspfSessionProperties> getSession(EdgeId id); @Nonnull Set<EdgeId> incomingEdges(OspfNeighborConfigId head); static EdgeId makeEdge(OspfNeighborConfigId tail, OspfNeighborConfigId head); @Override boolean equals(@Nullable Object o); @JsonIgnore ValueGraph<OspfNeighborConfigId, OspfSessionProperties> getGraph(); @Override int hashCode(); }
OspfTopology { @Nonnull public Set<EdgeId> incomingEdges(OspfNeighborConfigId head) { if (!_graph.nodes().contains(head)) { return ImmutableSet.of(); } return _graph.predecessors(head).stream() .map(tail -> makeEdge(tail, head)) .collect(ImmutableSet.toImmutableSet()); } OspfTopology(ValueGraph<OspfNeighborConfigId, OspfSessionProperties> graph); @Nonnull Set<OspfNeighborConfigId> neighbors(OspfNeighborConfigId node); @Nonnull Set<EdgeId> edges(); @JsonProperty(PROP_NODES) @Nonnull Set<OspfNeighborConfigId> getNodes(); @Nonnull Optional<OspfSessionProperties> getSession(EdgeId id); @Nonnull Set<EdgeId> incomingEdges(OspfNeighborConfigId head); static EdgeId makeEdge(OspfNeighborConfigId tail, OspfNeighborConfigId head); @Override boolean equals(@Nullable Object o); @JsonIgnore ValueGraph<OspfNeighborConfigId, OspfSessionProperties> getGraph(); @Override int hashCode(); static final OspfTopology EMPTY; }