Release v3.0

This commit is contained in:
Koen Yskout
2018-04-17 13:54:17 +02:00
parent 295c510d73
commit d5cbb646ed
81 changed files with 5752 additions and 15 deletions

View File

@@ -0,0 +1,61 @@
package worms.programs;
import be.kuleuven.cs.som.annotate.Value;
/**
* A source location represents a position in a source file,
* denoted by the line and column (position in the line) of
* a certain character in the file.
*
* This class is a value class.
*/
@Value
public final class SourceLocation {
private final int line;
private final int column;
public SourceLocation(int line, int column) {
this.line = line;
this.column = column;
}
public int getLine() {
return line;
}
public int getColumn() {
return column;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + column;
result = prime * result + line;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SourceLocation other = (SourceLocation) obj;
if (column != other.column)
return false;
if (line != other.line)
return false;
return true;
}
@Override
public String toString() {
return String.format("@%d,%d", line, column);
}
}