Exemple #1
0
        /// <summary>
        /// Add a specified to this rank.
        /// </summary>
        ///
        /// <param name="state">KState object to add to the rank</param>
        ///
        /// <returns>True if the state was added successfully</returns>
        public bool addState(KState state)
        {
            if (this.RankIndex == 0)
            {
                return(false);
            }

            if (this.RankIndex != state.getCategoryCount())
            {
                return(false);
            }

            // [SC] verify that the same state does not already exist; verification is done at PCategory reference level
            foreach (KState stateOne in this.states)
            {
                if (state.getCategoryCount() == stateOne.getCategoryCount() &&
                    state.getCategories().Intersect(stateOne.getCategories()).Count() == state.getCategoryCount())
                {
                    return(false);
                }
            }

            this.states.Add(state);

            return(true);
        }
Exemple #2
0
 /// <summary>
 /// Returns true if the state is subset of a state specified as parameter
 /// </summary>
 ///
 /// <param name="state">KState object</param>
 ///
 /// <returns>boolean</returns>
 public bool isSubsetOf(KState state)
 {
     return(this.categories.Intersect(state.getCategories()).Count() == this.categories.Count);
 }