|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 * Base class for document monitors |
|
17 * |
|
18 */ |
|
19 package com.nokia.tracecompiler.utils; |
|
20 |
|
21 import java.util.ArrayList; |
|
22 import java.util.Iterator; |
|
23 |
|
24 import com.nokia.tracecompiler.source.SourceDocumentFactory; |
|
25 import com.nokia.tracecompiler.source.SourceDocumentInterface; |
|
26 import com.nokia.tracecompiler.source.SourceDocumentMonitor; |
|
27 import com.nokia.tracecompiler.source.SourceDocumentProcessor; |
|
28 |
|
29 /** |
|
30 * Base class for document monitors. |
|
31 * |
|
32 */ |
|
33 public class DocumentMonitorBase implements SourceDocumentMonitor { |
|
34 |
|
35 /** |
|
36 * Document factory adapter |
|
37 */ |
|
38 private DocumentFactoryBase factory; |
|
39 |
|
40 /** |
|
41 * List of sources |
|
42 */ |
|
43 private ArrayList<SourceDocumentInterface> sources = new ArrayList<SourceDocumentInterface>(); |
|
44 |
|
45 /* |
|
46 * (non-Javadoc) |
|
47 * |
|
48 * @see com.nokia.tracecompiler.source.SourceDocumentMonitor#getFactory() |
|
49 */ |
|
50 public SourceDocumentFactory getFactory() { |
|
51 if (factory == null) { |
|
52 factory = new DocumentFactoryBase(); |
|
53 } |
|
54 return factory; |
|
55 } |
|
56 |
|
57 /* |
|
58 * (non-Javadoc) |
|
59 * |
|
60 * @see java.lang.Iterable#iterator() |
|
61 */ |
|
62 public Iterator<SourceDocumentInterface> iterator() { |
|
63 return sources.iterator(); |
|
64 } |
|
65 |
|
66 /* |
|
67 * (non-Javadoc) |
|
68 * |
|
69 * @see com.nokia.tracecompiler.source.SourceDocumentMonitor# |
|
70 * startMonitor(com.nokia.tracecompiler.source.SourceDocumentProcessor) |
|
71 */ |
|
72 public void startMonitor(SourceDocumentProcessor processor) throws Exception { |
|
73 } |
|
74 |
|
75 /* |
|
76 * (non-Javadoc) |
|
77 * |
|
78 * @see com.nokia.tracecompiler.source.SourceDocumentMonitor#stopMonitor() |
|
79 */ |
|
80 public void stopMonitor() { |
|
81 sources.clear(); |
|
82 } |
|
83 |
|
84 } |