コード例 #1
0
    /**
     * Adds all ports of given {@link LoopSide} of this component-holder to the current position of
     * the {@link ListIterator}. The ports are placed, so that source and target ports of an edge
     * are placed next to each other. The source port of an edge will be places before the target
     * port of an edge.
     *
     * <p>FIXME: This method doesn't seem to be used anywhere. Remove?
     *
     * @param loopSide The components of this {@link LoopSide} will be added.
     * @param itr The {@link ListIterator} to add the ports into.
     */
    public void addInlineSourcesFirst(final LoopSide loopSide, final ListIterator<LPort> itr) {
      final List<LPort> firstPart = Lists.newArrayList();
      final List<LPort> secondPart = Lists.newArrayList();

      final Iterator<ConnectedSelfLoopComponent> compItr =
          LISTS_OF_COMPONENTS.get(loopSide).iterator();

      while (compItr.hasNext()) {
        ConnectedSelfLoopComponent component = compItr.next();
        firstPart.addAll(0, component.getTargetLoopPorts());
        firstPart.addAll(0, component.getSourceLoopPortsReversed());

        if (compItr.hasNext()) {
          component = compItr.next();
          secondPart.addAll(component.getSourceLoopPortsReversed());
          secondPart.addAll(component.getTargetLoopPorts());
        }
      }

      setSideOfPorts(firstPart, loopSide.getSourceSide());
      setSideOfPorts(secondPart, loopSide.getTargetSide());

      for (final LPort port : firstPart) {
        itr.add(port);
      }
      for (final LPort port : secondPart) {
        itr.add(port);
      }
    }
コード例 #2
0
    /**
     * Adds all target ports and than all source ports of the components of given {@link LoopSide}
     * of this component-holder to the current position of the {@link ListIterator}. The source
     * ports will be added in reversed order.
     *
     * @param loopSide The components of this {@link LoopSide} will be added.
     * @param itr The {@link ListIterator} to add the ports into.
     */
    public void addAllPorts(
        final LoopSide loopSide, final ListIterator<LPort> itr, final boolean sourceFirst) {

      final List<LPort> secondPart = Lists.newArrayList();
      PortSide secondPartSide = null;

      if (sourceFirst) {
        for (final ConnectedSelfLoopComponent component : LISTS_OF_COMPONENTS.get(loopSide)) {
          for (final LPort port : component.getSourceLoopPorts()) {
            itr.add(port);
            setSideOfPort(port, loopSide.getSourceSide());
          }
          secondPart.addAll(component.getTargetLoopPorts());
          secondPartSide = loopSide.getTargetSide();
        }
      } else {
        for (final ConnectedSelfLoopComponent component : LISTS_OF_COMPONENTS.get(loopSide)) {
          for (final LPort port : component.getTargetLoopPorts()) {
            itr.add(port);
            setSideOfPort(port, loopSide.getTargetSide());
          }
          secondPart.addAll(component.getSourceLoopPorts());
          secondPartSide = loopSide.getSourceSide();
        }
      }

      Collections.reverse(secondPart);
      setSideOfPorts(secondPart, secondPartSide);
      for (final LPort port : secondPart) {
        itr.add(port);
      }
    }
コード例 #3
0
 /**
  * Adds all target ports of the components of given {@link LoopSide} of this component-holder to
  * the current position of the {@link ListIterator}.
  *
  * @param loopSide The components of this {@link LoopSide} will be added.
  * @param itr The {@link ListIterator} to add the ports into.
  */
 public void addTargetPorts(final LoopSide loopSide, final ListIterator<LPort> itr) {
   final PortSide portSide = loopSide.getTargetSide();
   for (final ConnectedSelfLoopComponent component : LISTS_OF_COMPONENTS.get(loopSide)) {
     for (final LPort port : component.getTargetLoopPorts()) {
       itr.add(port);
       setSideOfPort(port, portSide);
     }
   }
 }