/// <summary>
        ///     Creates an <see cref="InterestQuery"/>.
        /// </summary>
        /// <param name="constraint">
        ///     A <see cref="Constraint"/> object defining the constraints of the query.
        /// </param>
        /// <remarks>
        ///     Returns the full snapshot result by default.
        /// </remarks>
        /// <returns>
        ///     An <see cref="InterestQuery"/> object.
        /// </returns>
        public static InterestQuery Query(Constraint constraint)
        {
            var interest = new InterestQuery
            {
                query =
                {
                    Constraint         = constraint.AsQueryConstraint(),
                    FullSnapshotResult = true,
                    ResultComponentId  = new List <uint>()
                }
            };

            return(interest);
        }
Beispiel #2
0
        private static List <ComponentInterest.Query> InterestQueryParamsToQueries(
            InterestQuery interestQuery,
            params InterestQuery[] interestQueries)
        {
            var output = new List <ComponentInterest.Query>(interestQueries.Length + 1)
            {
                interestQuery.AsComponentInterestQuery()
            };

            foreach (var constraintParam in interestQueries)
            {
                output.Add(constraintParam.AsComponentInterestQuery());
            }

            return(output);
        }
Beispiel #3
0
 /// <summary>
 ///     Replaces a component's InterestQueries in the Interest component.
 /// </summary>
 /// <param name="componentId">
 ///     Component ID of the authoritative component to replace InterestQueries of.
 /// </param>
 /// <param name="interestQuery">
 ///     First <see cref="InterestQuery"/> to add for a given authoritative component.
 /// </param>
 /// <param name="interestQueries">
 ///     Further InterestQueries to add for a given authoritative component.
 /// </param>
 /// <remarks>
 ///     At least one <see cref="InterestQuery"/> must be provided to replace a component's interest.
 /// </remarks>
 /// <returns>
 ///     An <see cref="InterestTemplate"/> object.
 /// </returns>
 public InterestTemplate ReplaceQueries(uint componentId,
                                        InterestQuery interestQuery,
                                        params InterestQuery[] interestQueries)
 {
     return(ReplaceQueries(componentId, InterestQueryParamsToQueries(interestQuery, interestQueries)));
 }
Beispiel #4
0
 /// <summary>
 ///     Replaces a component's InterestQueries in the Interest component.
 /// </summary>
 /// <param name="interestQuery">
 ///     First <see cref="InterestQuery"/> to add for a given authoritative component.
 /// </param>
 /// <param name="interestQueries">
 ///     Further InterestQueries to add for a given authoritative component.
 /// </param>
 /// <typeparam name="T">
 ///     Type of the authoritative component to replace InterestQueries of.
 /// </typeparam>
 /// <remarks>
 ///     At least one <see cref="InterestQuery"/> must be provided to replace a component's interest.
 /// </remarks>
 /// <returns>
 ///     An <see cref="InterestTemplate"/> object.
 /// </returns>
 public InterestTemplate ReplaceQueries <T>(InterestQuery interestQuery,
                                            params InterestQuery[] interestQueries)
     where T : ISpatialComponentData
 {
     return(ReplaceQueries(Dynamic.GetComponentId <T>(), interestQuery, interestQueries));
 }
 /// <summary>
 ///     Add InterestQueries to the Interest component.
 /// </summary>
 /// <param name="interestQuery">
 ///     First <see cref="InterestQuery"/> to add for a given authoritative component.
 /// </param>
 /// <param name="interestQueries">
 ///     Further InterestQueries to add for a given authoritative component.
 /// </param>
 /// <typeparam name="T">
 ///     Type of the authoritative component to add the InterestQueries to.
 /// </typeparam>
 /// <remarks>
 ///     At least one <see cref="InterestQuery"/> must be provided to update the Interest component.
 /// </remarks>
 /// <returns>
 ///     An <see cref="InterestTemplate"/> object.
 /// </returns>
 public InterestTemplate AddQueries <T>(InterestQuery interestQuery,
                                        params InterestQuery[] interestQueries)
     where T : ISpatialComponentData
 {
     return(AddQueries(ComponentDatabase.GetComponentId <T>(), interestQuery, interestQueries));
 }