-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathDatePart.java
More file actions
72 lines (59 loc) · 1.99 KB
/
DatePart.java
File metadata and controls
72 lines (59 loc) · 1.99 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
62
63
64
65
66
67
68
69
70
71
72
/*******************************************************************************
* Copyright (c) 2009-2015 CWI
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* * Jurgen J. Vinju - Jurgen.Vinju@cwi.nl - CWI
* * Tijs van der Storm - Tijs.van.der.Storm@cwi.nl
* * Paul Klint - Paul.Klint@cwi.nl - CWI
* * Mark Hills - Mark.Hills@cwi.nl (CWI)
* * Arnold Lankamp - Arnold.Lankamp@cwi.nl
* * Michael Steindorfer - Michael.Steindorfer@cwi.nl - CWI
*******************************************************************************/
package org.rascalmpl.ast;
import io.usethesource.vallang.IConstructor;
import io.usethesource.vallang.ISourceLocation;
@SuppressWarnings(value = {"unused"})
public abstract class DatePart extends AbstractAST {
public DatePart(ISourceLocation src, IConstructor node) {
super(src /* we forget node on purpose */);
}
static public class Lexical extends DatePart {
private final java.lang.String string;
public Lexical(ISourceLocation src, IConstructor node, java.lang.String string) {
super(src, node);
this.string = string;
}
public java.lang.String getString() {
return string;
}
@Override
public int hashCode() {
return string.hashCode();
}
@Override
public boolean equals(Object o) {
return o instanceof Lexical && ((Lexical) o).string.equals(string);
}
@Override
public Object clone() {
return newInstance(getClass(), src, (IConstructor) null, string);
}
@Override
public AbstractAST findNode(int offset) {
if (src.getOffset() <= offset && offset < src.getOffset() + src.getLength()) {
return this;
}
return null;
}
public java.lang.String toString() {
return string;
}
public <T> T accept(IASTVisitor<T> v) {
return v.visitDatePartLexical(this);
}
}
}