forked from spullara/mustache.java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTemplateContext.java
More file actions
61 lines (51 loc) · 1.44 KB
/
TemplateContext.java
File metadata and controls
61 lines (51 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.github.mustachejava;
public final class TemplateContext {
private final String sm;
private final String em;
private final String file;
private final int line;
private final boolean startOfLine;
public TemplateContext(String sm, String em, String file, int line, boolean startOfLine) {
this.sm = sm;
this.em = em;
this.file = file;
this.line = line;
this.startOfLine = startOfLine;
}
public boolean startOfLine() {
return startOfLine;
}
public String startChars() {
return sm;
}
public String endChars() {
return em;
}
public String file() {
return file;
}
public int line() {
return line;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TemplateContext that = (TemplateContext) o;
return line == that.line &&
!(em != null ? !em.equals(that.em) : that.em != null) &&
!(file != null ? !file.equals(that.file) : that.file != null) &&
!(sm != null ? !sm.equals(that.sm) : that.sm != null);
}
@Override
public int hashCode() {
int result = sm != null ? sm.hashCode() : 0;
result = 31 * result + (em != null ? em.hashCode() : 0);
result = 31 * result + (file != null ? file.hashCode() : 0);
result = 31 * result + line;
return result;
}
public String toString() {
return "[" + file + ":" + line + "]";
}
}