code: public boolean isValidPolyRef(long ref, QueryFilter filter) {
          Result<Tupple2<MeshTile, Poly>> tileAndPolyResult = m_nav.getTileAndPolyByRef(ref);
          if (tileAndPolyResult.failed()) {
              return false;
          }
          Tupple2<MeshTile, Poly> tileAndPoly = tileAndPolyResult.result;
          // If cannot pass filter, assume flags has changed and boundary is invalid.
          if (!filter.passFilter(ref, tileAndPoly.first, tileAndPoly.second)) {
              return false;
          }
          return true;
      }
docs: / @param[in] filter The filter to apply.