KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ant > internal > ui > antsupport > logger > debug > RemoteAntBreakpoint


1 /*******************************************************************************
2  * Copyright (c) 2004, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ant.internal.ui.antsupport.logger.debug;
12
13 import java.io.File JavaDoc;
14 import org.eclipse.ant.internal.ui.antsupport.logger.util.DebugMessageIds;
15
16 public class RemoteAntBreakpoint {
17     
18     private File JavaDoc fFile;
19     private int fLineNumber;
20     private String JavaDoc fFileName;
21     
22     public RemoteAntBreakpoint(String JavaDoc breakpointRepresentation) {
23         String JavaDoc[] data= breakpointRepresentation.split(DebugMessageIds.MESSAGE_DELIMITER);
24         String JavaDoc fileName= data[1];
25         String JavaDoc lineNumber= data[2];
26         fFileName= fileName;
27         fFile= new File JavaDoc(fileName);
28         fLineNumber= Integer.parseInt(lineNumber);
29     }
30
31     public boolean isAt(String JavaDoc fileName, int lineNumber) {
32         return fLineNumber == lineNumber && fileName != null && fFile.equals(new File JavaDoc(fileName));
33     }
34     
35     public String JavaDoc toMarshallString() {
36         StringBuffer JavaDoc buffer= new StringBuffer JavaDoc(DebugMessageIds.BREAKPOINT);
37         buffer.append(DebugMessageIds.MESSAGE_DELIMITER);
38         buffer.append(fFileName);
39         buffer.append(DebugMessageIds.MESSAGE_DELIMITER);
40         buffer.append(fLineNumber);
41         return buffer.toString();
42     }
43     
44     /* (non-Javadoc)
45      * @see java.lang.Object#equals(java.lang.Object)
46      */

47     public boolean equals(Object JavaDoc obj) {
48         if (!(obj instanceof RemoteAntBreakpoint)) {
49             return false;
50         }
51         RemoteAntBreakpoint other= (RemoteAntBreakpoint) obj;
52         return other.getLineNumber() == fLineNumber && other.getFile().equals(fFile);
53     }
54     
55     /* (non-Javadoc)
56      * @see java.lang.Object#hashCode()
57      */

58     public int hashCode() {
59         return fFileName.hashCode() + fLineNumber;
60     }
61     
62     public int getLineNumber() {
63         return fLineNumber;
64     }
65
66     public String JavaDoc getFileName() {
67         return fFileName;
68     }
69     
70     public File JavaDoc getFile() {
71         return fFile;
72     }
73 }
74
Popular Tags