code: public static boolean isProjective(int[] parents) {
          for (int i=0; i<parents.length; i++) {
              int pari = (parents[i] == ParentsArray.WALL_POSITION) ? parents.length : parents[i];
              int minI = i < pari ? i : pari;
              int maxI = i > pari ? i : pari;
              for (int j=0; j<parents.length; j++) {
                  if (j == i) {
                      continue;
                  }
                  int parj = (parents[j] == ParentsArray.WALL_POSITION) ? parents.length : parents[j];
                  if (minI < j && j < maxI) {
                      if (!(minI <= parj && parj <= maxI)) {
                          return false;
                      }
                  } else {
                      if (!(parj <= minI || parj >= maxI)) {
                          return false;
                      }
                  }
              }
          }
          return true;
      }
docs: Checks that a dependency tree represented as a parents array is projective.
  
  @param parents
  A parents array where parents[i] contains the index of the
  parent of the word at position i, with parents[i] = -1
  indicating that the parent of word i is the wall node.
  @return True if the tree specified by the parents array is projective,
  False otherwise.