/**
   * Construct a new instance from the given {@link VtnFlowCondConfig} instance.
   *
   * @param vfconf A {@link VtnFlowCondConfig} instance.
   * @throws RpcException An error occurred.
   */
  public VTNFlowCondition(VtnFlowCondConfig vfconf) throws RpcException {
    nodeName = vfconf.getName();
    name = FlowCondUtils.checkName(nodeName);

    List<VtnFlowMatch> list = vfconf.getVtnFlowMatch();
    matches = new VtnFlowMatchConverter().initialize(list);
  }
  /**
   * Construct a new instance from the given name and {@link FlowCondition} instance.
   *
   * @param nm The name of the flow condition.
   * @param fcond A {@link FlowCondition} instance.
   * @throws RpcException An error occurred.
   */
  public VTNFlowCondition(String nm, FlowCondition fcond) throws RpcException {
    nodeName = FlowCondUtils.checkName(nm);
    name = nm;

    List<FlowMatch> list = (fcond == null) ? null : fcond.getMatches();
    matches = new FlowMatchConverter().initialize(list);
  }
    /**
     * Initialize the list of {@link VTNFlowMatch} instances.
     *
     * @param srcList A list of objects used to create a list of {@link VTNFlowMatch} instances.
     * @return A list of {@link VTNFlowMatch} instance.
     * @throws RpcException An error occurred.
     */
    protected final List<VTNFlowMatch> initialize(List<T> srcList) throws RpcException {
      if (srcList == null || srcList.isEmpty()) {
        return Collections.<VTNFlowMatch>emptyList();
      }

      // Ensure that all match indices are unique.
      List<VTNFlowMatch> list = newList(srcList);
      Set<Integer> indices = new HashSet<>();
      for (T obj : srcList) {
        VTNFlowMatch vfmatch = convert(obj);
        Integer index = vfmatch.getIdentifier();
        FlowCondUtils.verifyMatchIndex(indices, index);
        add(list, vfmatch);
      }

      // Sort matches by index.
      VTNIdentifiableComparator<Integer> comparator =
          new VTNIdentifiableComparator<>(Integer.class);
      Collections.sort(list, comparator);

      return list;
    }
 /**
  * Verify the contents of this instance.
  *
  * @throws RpcException Verifycation failed.
  */
 public void verify() throws RpcException {
   nodeName = FlowCondUtils.checkName(name);
   matches = new MatchVerifier().initialize(matches);
 }