Eclipseplugins
GitGrepSearchResultElement.java
1 package com.proalpha.pds.gitutils.search;
2 
3 public class GitGrepSearchResultElement implements Comparable<GitGrepSearchResultElement> {
4 
5  private String objectName;
6  private String content;
7  private String lineNr;
8  private String block;
9  private String absolutePath;
10 
11  public GitGrepSearchResultElement(String objectName, String lineNr, String content, String block) {
12 
13  this.objectName = objectName;
14  this.lineNr = lineNr;
15  this.content = content;
16  this.block = block;
17  }
18 
20  }
21 
22  public String getObjectName() {
23  return objectName;
24  }
25 
26  public void setObjectName(String objectName) {
27  this.objectName = objectName;
28  }
29 
30  public String getContent() {
31  return content;
32  }
33 
34  public void setContent(String content) {
35  this.content = content;
36  }
37 
38  public String getLineNr() {
39 
40  return (lineNr != null) ? lineNr : "0";
41  }
42 
43  public void setLineNr(String lineNr) {
44  this.lineNr = lineNr;
45  }
46 
47  public String getBlock() {
48  return block;
49  }
50 
51  public void setBlock(String block) {
52  this.block = block;
53  }
54 
55  public int compareTo(GitGrepSearchResultElement o) {
56 
57  String thisValue = this.getObjectName();
58  String oValue = o.getObjectName();
59 
60  int retValue;
61 
62  if (!thisValue.equals(oValue)) {
63  retValue = thisValue.compareToIgnoreCase(oValue);
64  } else {
65  final Integer tIntObj = Integer.valueOf(this.getLineNr());
66  final Integer oLine = Integer.valueOf(o.getLineNr());
67  retValue = tIntObj.compareTo(oLine);
68  }
69  return retValue;
70  }
71 
72  public String getAbsolutePath() {
73  return absolutePath;
74  }
75 
76  public void setAbsolutePath(String absolutePath) {
77  this.absolutePath = absolutePath;
78  }
79 }