Beispiel #1
0
 /// <summary>
 /// Checks the equality with other assigned value.
 /// </summary>
 /// <param name="other">Other assigned value.</param>
 /// <returns>True if the objects are equal, false otherwise.</returns>
 public bool Equals(IAssignment other)
 {
     if (other == this)
     {
         return(true);
     }
     return(Variable == other.GetVariable() && Value == other.GetValue());
 }
Beispiel #2
0
 /// <summary>
 /// Checks whether the specified variable is actually affected by the operator effects. If the check is positive, returns
 /// also the effect application value.
 /// </summary>
 /// <param name="variable">Variable to be checked.</param>
 /// <param name="value">Applied value.</param>
 /// <returns>True if the given variable is affected by the effects, false otherwise.</returns>
 public bool IsVariableAffected(int variable, out int value)
 {
     foreach (var effect in this)
     {
         IAssignment assignment = effect.GetAssignment();
         if (assignment.GetVariable() == variable)
         {
             value = assignment.GetValue();
             return(true);
         }
     }
     value = Assignment.InvalidValue;
     return(false);
 }
Beispiel #3
0
 /// <summary>
 /// Checks whether the state has the specified assignment.
 /// </summary>
 /// <param name="assignment">Assignment ot be checked.</param>
 /// <returns>True if the state has the given assignment, false otherwise.</returns>
 public bool HasValue(IAssignment assignment)
 {
     return(HasValue(assignment.GetVariable(), assignment.GetValue()));
 }
Beispiel #4
0
 /// <summary>
 /// Sets the specified assignment in the state.
 /// </summary>
 /// <param name="assignment">Assignment ot be checked.</param>
 public void SetValue(IAssignment assignment)
 {
     SetValue(assignment.GetVariable(), assignment.GetValue());
 }