class ReferenceInterfaceGroupInterfaceSpecifier implements InterfaceSpecifier {

  @Override
  public Set<NodeInterfacePair> resolve(Set<String> nodes, SpecifierContext ctxt) {
    InterfaceGroup interfaceGroup =
        ctxt.getReferenceBook(_bookName)
            .orElseThrow(
                () -> new NoSuchElementException("ReferenceBook '" + _bookName + "' not found"))
            .getInterfaceGroup(_interfaceGroupName)
            .orElseThrow(
                () ->
                    new NoSuchElementException(
                        "InterfaceGroup '"
                            + _interfaceGroupName
                            + "' not found in ReferenceBook '"
                            + _bookName
                            + "'"));
    return nodes.stream()
        .map(n -> ctxt.getConfigs().get(n).getAllInterfaces().values())
        .flatMap(Collection::stream)
        .map(NodeInterfacePair::of)
        .filter(interfaceGroup.getInterfaces()::contains)
        .collect(ImmutableSet.toImmutableSet());
  }

  public  ReferenceInterfaceGroupInterfaceSpecifier(String interfaceGroupName, String bookName);

}