View Javadoc

1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.jdiagnose.runtime;
17  
18  import java.util.Collections;
19  import java.util.List;
20  
21  import org.jdiagnose.DiagnosticMessage;
22  import org.jdiagnose.ResultInfo;
23  
24  /***
25   * User: jamie
26   * Date: May 30, 2004
27   * Time: 7:42:52 PM
28   */
29  public class LightWeightResult implements ResultInfo {
30  
31      private ResultState state;
32      private long startTime;
33      private long finishTime;
34      private DiagnosticMessage message;
35      private String name;
36  
37      public LightWeightResult(DiagnosticResult result) {
38          this.state = result.getState();
39          this.startTime = result.getStartTime();
40          this.finishTime = result.getFinishTime();
41          this.message = result.getMessage();
42          this.name = result.getName();
43      }
44  
45      public List getResults() {
46          return Collections.EMPTY_LIST;
47      }
48  
49      public ResultState getState() {
50          return state;
51      }
52  
53      public long getDuration() {
54          return finishTime - startTime;
55      }
56  
57      public long getFinishTime() {
58          return finishTime;
59      }
60  
61      public long getStartTime() {
62          return startTime;
63      }
64  
65      public String getName() {
66          return name;
67      }
68  
69  
70      public DiagnosticMessage getMessage() {
71          return message;
72      }
73  }