author | Subhashini Sooriarachchi <subslk@netbeans.org> |
Mon, 12 Aug 2013 11:26:54 +0530 | |
changeset 464 | e10b2e8563fc |
parent 360 | 612b49b47f2f |
permissions | -rw-r--r-- |
chrislovsund@360 | 1 |
/* |
chrislovsund@360 | 2 |
* To change this template, choose Tools | Templates |
chrislovsund@360 | 3 |
* and open the template in the editor. |
chrislovsund@360 | 4 |
*/ |
chrislovsund@360 | 5 |
package org.netbeans.modules.plsql.fold; |
chrislovsund@360 | 6 |
|
chrislovsund@360 | 7 |
import java.io.Serializable; |
subslk@464 | 8 |
import org.netbeans.api.editor.fold.FoldType; |
chrislovsund@360 | 9 |
|
chrislovsund@360 | 10 |
/** |
chrislovsund@360 | 11 |
* |
chrislovsund@360 | 12 |
* @author ChrLSE |
chrislovsund@360 | 13 |
*/ |
chrislovsund@360 | 14 |
class FoldSearchObject implements Serializable { |
chrislovsund@360 | 15 |
|
chrislovsund@360 | 16 |
private static final long serialVersionUID = 1L; |
chrislovsund@360 | 17 |
private final int startOffset; |
chrislovsund@360 | 18 |
private final int endOffset; |
subslk@464 | 19 |
private FoldType foldType; |
chrislovsund@360 | 20 |
private FoldAdapter fold; |
chrislovsund@360 | 21 |
|
subslk@464 | 22 |
FoldSearchObject(int startOffset, int endOffset, FoldType foldType) { |
chrislovsund@360 | 23 |
this.startOffset = startOffset; |
chrislovsund@360 | 24 |
this.endOffset = endOffset; |
subslk@464 | 25 |
this.foldType = foldType; |
chrislovsund@360 | 26 |
} |
chrislovsund@360 | 27 |
|
chrislovsund@360 | 28 |
FoldSearchObject(FoldAdapter fold) { |
subslk@464 | 29 |
this(-1, -1,null); |
chrislovsund@360 | 30 |
this.fold = fold; |
chrislovsund@360 | 31 |
} |
chrislovsund@360 | 32 |
|
chrislovsund@360 | 33 |
public int getStartOffset() { |
chrislovsund@360 | 34 |
if (startOffset == -1) { |
chrislovsund@360 | 35 |
return fold.getStartOffset(); |
chrislovsund@360 | 36 |
} |
chrislovsund@360 | 37 |
return startOffset; |
chrislovsund@360 | 38 |
} |
chrislovsund@360 | 39 |
|
chrislovsund@360 | 40 |
public int getEndOffset() { |
chrislovsund@360 | 41 |
if (endOffset == -1) { |
chrislovsund@360 | 42 |
return fold.getEndOffset(); |
chrislovsund@360 | 43 |
} |
chrislovsund@360 | 44 |
return endOffset; |
chrislovsund@360 | 45 |
} |
subslk@464 | 46 |
|
subslk@464 | 47 |
public FoldType getFoldType(){ |
subslk@464 | 48 |
if (foldType == null) { |
subslk@464 | 49 |
return fold.getFoldType(); |
subslk@464 | 50 |
} |
subslk@464 | 51 |
return foldType; |
subslk@464 | 52 |
} |
subslk@464 | 53 |
|
chrislovsund@360 | 54 |
@Override |
chrislovsund@360 | 55 |
public int hashCode() { |
chrislovsund@360 | 56 |
int hash = 7; |
chrislovsund@360 | 57 |
hash = 13 * hash + this.getStartOffset(); |
chrislovsund@360 | 58 |
hash = 13 * hash + this.getEndOffset(); |
chrislovsund@360 | 59 |
return hash; |
chrislovsund@360 | 60 |
} |
chrislovsund@360 | 61 |
|
chrislovsund@360 | 62 |
@Override |
chrislovsund@360 | 63 |
public boolean equals(Object obj) { |
chrislovsund@360 | 64 |
if (obj == null) { |
chrislovsund@360 | 65 |
return false; |
chrislovsund@360 | 66 |
} |
chrislovsund@360 | 67 |
if (getClass() != obj.getClass()) { |
chrislovsund@360 | 68 |
return false; |
chrislovsund@360 | 69 |
} |
chrislovsund@360 | 70 |
final FoldSearchObject other = (FoldSearchObject) obj; |
chrislovsund@360 | 71 |
if (this.getStartOffset() != other.getStartOffset()) { |
chrislovsund@360 | 72 |
return false; |
chrislovsund@360 | 73 |
} |
chrislovsund@360 | 74 |
if (this.getEndOffset() != other.getEndOffset()) { |
chrislovsund@360 | 75 |
return false; |
chrislovsund@360 | 76 |
} |
chrislovsund@360 | 77 |
return true; |
chrislovsund@360 | 78 |
} |
chrislovsund@360 | 79 |
|
chrislovsund@360 | 80 |
@Override |
chrislovsund@360 | 81 |
public String toString() { |
chrislovsund@360 | 82 |
return "FoldSearchObject{" + "startOffset=" + getStartOffset() + ", endOffset=" + getEndOffset() + '}'; |
chrislovsund@360 | 83 |
} |
chrislovsund@360 | 84 |
} |