55 lines
1.4 KiB
C#
55 lines
1.4 KiB
C#
using JD.TeaBoxAddinSystem.Addins.Description.Conditions;
|
|
using JD.TeaBoxAddinSystem.Addins.Internal;
|
|
|
|
namespace JD.TeaBoxAddinSystem.Addins
|
|
{
|
|
/// <summary>
|
|
/// A condition node is an object that evaluates to true or false.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Implementors must call <see cref="NotifyChanged"/> if the result of the evaluation could have changed.
|
|
/// </remarks>
|
|
public abstract class ConditionNode : Node
|
|
{
|
|
#region Properties
|
|
|
|
/// <summary>
|
|
/// Type of this condition node.
|
|
/// </summary>
|
|
public new ConditionType Type
|
|
{
|
|
get
|
|
{
|
|
return (ConditionType)base.Type;
|
|
}
|
|
}
|
|
|
|
internal virtual bool Polled
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Methods
|
|
|
|
/// <summary>
|
|
/// Returns true if the condition is satisfied.
|
|
/// </summary>
|
|
/// <returns>True if the condition is satisfied, false otherwise.</returns>
|
|
public abstract bool Evaluate();
|
|
|
|
/// <summary>
|
|
/// This method should be called when the result of <see cref="Evaluate"/> could have changed.
|
|
/// </summary>
|
|
protected void NotifyChanged()
|
|
{
|
|
AddinManager.SessionService.ConditionManager.OnConditionChanged(this);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|