Packages/com.github.homuler.mediapipe/Runtime/Scripts/Unity/Annotation/ListAnnotation.cs
/// <summary>
///   Zip <see cref="children" /> and <paramref name="argumentList" />, and call <paramref name="action" /> with each pair.
///   If <paramref name="argumentList" /> has more elements than <see cref="children" />, <see cref="children" /> elements will be initialized with <see cref="InstantiateChild" />.
/// </summary>
/// <param name="action">
///   This will receive 2 arguments and return void.
///   The 1st argument is <typeparamref name="T" />, that is an ith element in <see cref="children" />.
///   The 2nd argument is <typeparamref name="S" />, that is also an ith element in <paramref name="argumentList" />.
/// </param>
Zip  and , and call  with each pair.
If  has more elements than ,  elements will be initialized with .
Zip and and call with each pair . If has more elements than elements will be initialized with .
protected void CallActionForAll<S>(IList<S> argumentList, Action<T, S> action) {
      for (var i = 0; i < Mathf.Max(children.Count, argumentList.Count); i++) {
        if (i >= argumentList.Count) {
          action(children[i], default(S));
          continue;
        }
        if (i >= children.Count) {
          children.Add(InstantiateChild());
        } else if (children[i] == null) {
          children[i] = InstantiateChild();
        }
        action(children[i], argumentList[i]);
      }
    }
protected void CallActionForAll < S > ( IList < S > argumentList , Action < T , S > action ) { for ( var i = 0 ; i < Mathf . Max ( children . Count , argumentList . Count ) ; i ++ ) { if ( i >= argumentList . Count ) { action ( children [ i ] , default ( S ) ) ; continue ; } if ( i >= children . Count ) { children . Add ( InstantiateChild ( ) ) ; } else if ( children [ i ] == null ) { children [ i ] = InstantiateChild ( ) ; } action ( children [ i ] , argumentList [ i ] ) ; } }
Zip  and , and call  with each pair.
Zip and and call with each pair .
// children.Count > argumentList.Count // reset annotations // children.Count < argumentList.Count // child is not initialized yet
argumentList
IList<S>
action
Action<T, S>
This will receive 2 arguments and return void.
The 1st argument is , that is an ith element in .
The 2nd argument is , that is also an ith element in .
This will receive 2 arguments and return void . The 1st argument is that is an ith element in . The 2nd argument is that is also an ith element in .