From 8b3a78f173802d9ec93c7ee6eb3559a22844aff6 Mon Sep 17 00:00:00 2001 From: Ricardo Pescuma Domenecci Date: Wed, 30 Apr 2014 14:26:45 -0300 Subject: [PATCH] FlatToHierarchicalProgressMonitor: one less field --- .../utils/FlatToHierarchicalProgressMonitor.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/csharp/ProgressMonitor/utils/FlatToHierarchicalProgressMonitor.cs b/csharp/ProgressMonitor/utils/FlatToHierarchicalProgressMonitor.cs index 0d0e96a..e15e3b1 100644 --- a/csharp/ProgressMonitor/utils/FlatToHierarchicalProgressMonitor.cs +++ b/csharp/ProgressMonitor/utils/FlatToHierarchicalProgressMonitor.cs @@ -9,7 +9,6 @@ public class FlatToHierarchicalProgressMonitor : ProgressMonitor private readonly FlatToHierarchicalProgressMonitor parent; private readonly string[] name; - private bool configured; private int[] steps; private int currentStep = -1; private string currentStepName; @@ -72,9 +71,8 @@ private FlatToHierarchicalProgressMonitor(FlatToHierarchicalProgressMonitor pare public IDisposable ConfigureSteps(params int[] aSteps) { - if (configured) + if (WasConfigured) throw new InvalidOperationException("Alteady configured"); - configured = true; if (aSteps.Length < 1) throw new ArgumentException(); @@ -99,6 +97,11 @@ public IDisposable ConfigureSteps(params int[] aSteps) }); } + private bool WasConfigured + { + get { return steps != null; } + } + private bool HasStarted { get { return currentStep >= 0; }