1 /* |
|
2 * Copyright (c) 2007-2008 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 the License "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 */ |
|
17 |
|
18 package com.nokia.ant.listener.internaldata; |
|
19 |
|
20 import org.apache.tools.ant.Task; |
|
21 import java.util.Date; |
|
22 /** |
|
23 * Object to set end time for a task. |
|
24 * |
|
25 */ |
|
26 public class TaskNode extends DataNode { |
|
27 |
|
28 private String name; |
|
29 |
|
30 // location |
|
31 private String filename; |
|
32 private int line = -1; |
|
33 |
|
34 public TaskNode(DataNode parent, Task task) { |
|
35 super(parent, task); |
|
36 this.setFilename(task.getLocation().getFileName()); |
|
37 this.setLine(task.getLocation().getLineNumber()); |
|
38 name = task.getTaskName(); |
|
39 } |
|
40 |
|
41 public String getName() { |
|
42 return name; |
|
43 } |
|
44 |
|
45 public String getFilename() { |
|
46 return filename; |
|
47 } |
|
48 |
|
49 public void setFilename(String filename) { |
|
50 this.filename = filename; |
|
51 } |
|
52 |
|
53 public int getLine() { |
|
54 return line; |
|
55 } |
|
56 |
|
57 public void setLine(int line) { |
|
58 this.line = line; |
|
59 } |
|
60 |
|
61 public void setEndTime(Date endTime) { |
|
62 super.setEndTime(endTime); |
|
63 if ((endTime.getTime() - getStartTime().getTime() < 1000) && isEmpty() && getParent() != null) { |
|
64 getParent().remove(this); |
|
65 } |
|
66 } |
|
67 |
|
68 } |
|