Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/Lifecycle.java @ 217:e39cf474ef94
Experimental support to mix-in start and end events for inspectors. Additionally, Lifecycle may serve as iteration control
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Tue, 17 May 2011 03:40:52 +0200 |
| parents | |
| children | d3ab16739736 |
comparison
equal
deleted
inserted
replaced
| 216:c251bbc979cf | 217:e39cf474ef94 |
|---|---|
| 1 /* | |
| 2 * Copyright (c) 2011 TMate Software Ltd | |
| 3 * | |
| 4 * This program is free software; you can redistribute it and/or modify | |
| 5 * it under the terms of the GNU General Public License as published by | |
| 6 * the Free Software Foundation; version 2 of the License. | |
| 7 * | |
| 8 * This program is distributed in the hope that it will be useful, | |
| 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 11 * GNU General Public License for more details. | |
| 12 * | |
| 13 * For information on how to redistribute this software under | |
| 14 * the terms of a license other than GNU General Public License | |
| 15 * contact TMate Software at support@hg4j.com | |
| 16 */ | |
| 17 package org.tmatesoft.hg.internal; | |
| 18 | |
| 19 /** | |
| 20 * EXPERIMENTAL. | |
| 21 * Mix-in for RevlogStream.Inspector to get informed about start and end of the iteration | |
| 22 * | |
| 23 * @author Artem Tikhomirov | |
| 24 * @author TMate Software Ltd. | |
| 25 */ | |
| 26 public interface Lifecycle { | |
| 27 | |
| 28 public void start(int count, Callback callback, Object token); | |
| 29 public void finish(Object token); | |
| 30 | |
| 31 interface Callback { | |
| 32 void stop(); | |
| 33 } | |
| 34 | |
| 35 class BasicCallback implements Callback { | |
| 36 private boolean done = false; | |
| 37 | |
| 38 public void stop() { | |
| 39 done = true; | |
| 40 } | |
| 41 public boolean isStopped() { | |
| 42 return done; | |
| 43 } | |
| 44 } | |
| 45 } |
