Skip to content
Snippets Groups Projects
Commit 77204f9f authored by Nikolaus Krismer's avatar Nikolaus Krismer
Browse files

using java7 diamond operator

parent af5659ec
No related branches found
No related tags found
No related merge requests found
Showing
with 23 additions and 23 deletions
......@@ -45,7 +45,7 @@ public abstract class Isochrone {
public Isochrone(final ConfigDataset config, final Database db, final Query query) throws AlgorithmException {
this.database = db;
this.query = query;
this.queue = new PriorityQueue<Node>();
this.queue = new PriorityQueue<>();
if (database == null) {
database = new Database(config, query.getMode(), query.getDir());
......@@ -218,7 +218,7 @@ public abstract class Isochrone {
final Node adjacentNode = getNode(link.getOppositeOf(node));
adjacentNode.visitNrAdjacentLinks((short) 1);
if (!adjacentNode.isClosed()) {
final Set<Short> routes = new HashSet<Short>();
final Set<Short> routes = new HashSet<>();
routes.add((short) link.getRoute());
final double newDistance = getAdjNodeCost(node, adjacentNode, routes, codes, fromTime, toTime);
......
......@@ -131,7 +131,7 @@ public class MrneX extends Isochrone {
final Point p = node.getCoordinates();
final double r = node.getRadius();
final Collection<Node> intersectionNodes = new ArrayList<Node>();
final Collection<Node> intersectionNodes = new ArrayList<>();
for (final Node loadedNode : loadedNodes) {
final double distance = DistanceAlgorithm.euclideanDistance(p, loadedNode.getCoordinates());
if (distance < r + loadedNode.getRadius()) {
......
......@@ -458,7 +458,7 @@ public class ConfigDataset {
LOGGER.info("Filtering invalid datasets (e.g. which have no database tables)");
final ConfigIsochrone config = ConfigIsochrone.getInstance();
final Collection<String> filteredList = new ArrayList<String>(datasets.size());
final Collection<String> filteredList = new ArrayList<>(datasets.size());
final Collection<String> allTables = config.getAllTables();
for (final String ds : datasets) {
final ConfigDataset c = ConfigDataset.createInstance(ds);
......
......@@ -197,7 +197,7 @@ public class Database {
*/
public Collection<Link> getAdjLinks(final int nodeId, final Map<Integer, Node> nodes) {
final PreparedStatement stmt = getPstmt((mode == Mode.UNIMODAL) ? queryGetAdjContinuousLinks : queryGetAdjLinks);
final Collection<Link> adjLinks = new ArrayList<Link>();
final Collection<Link> adjLinks = new ArrayList<>();
ResultSet rs = null;
try {
......@@ -306,7 +306,7 @@ public class Database {
*/
public Set<Integer> getDateCodes(final Calendar time) {
final PreparedStatement stmt = getPstmt(queryGetDateCodes);
final Set<Integer> codes = new HashSet<Integer>();
final Set<Integer> codes = new HashSet<>();
ResultSet rs = null;
try {
......@@ -634,7 +634,7 @@ public class Database {
protected PreparedStatement getPstmt(final String query) {
initConnection();
if (pstmtsCacheMap == null) {
pstmtsCacheMap = new HashMap<String, PreparedStatement>();
pstmtsCacheMap = new HashMap<>();
}
try {
......
......@@ -16,8 +16,8 @@ public class MemoryOutput implements Output {
// Constructor
public MemoryOutput() {
links = new HashMap<Integer, Link>();
nodes = new HashSet<Node>();
links = new HashMap<>();
nodes = new HashSet<>();
}
// Getter
......
......@@ -46,7 +46,7 @@ public class Node implements Comparable<Node> {
public void addAdjLink(final Link link) {
if (adjLinks == null) {
adjLinks = new ArrayList<Link>();
adjLinks = new ArrayList<>();
}
adjLinks.add(link);
......@@ -54,7 +54,7 @@ public class Node implements Comparable<Node> {
public void addRoute(final int routeId) {
if (routes == null) {
routes = new Hashtable<Integer, Schedule>();
routes = new Hashtable<>();
}
if (!routes.containsKey(routeId)) {
......
......@@ -35,8 +35,8 @@ public class Query {
* locations. Remember to set them afterward!!
*/
public Query(final Direction dir, final double walkingSpeed, final long duration, final Calendar time, final boolean expireNodes, final Mode mode) {
startNodes = new HashSet<Integer>();
startLocations = new HashSet<Location>();
startNodes = new HashSet<>();
startLocations = new HashSet<>();
this.dir = dir;
this.walkingSpeed = walkingSpeed;
......
......@@ -39,7 +39,7 @@ public final class ResourceHelper {
* @throws IOException if an I/O error occurs
*/
public static Collection<String> getResources(final Pattern pattern) throws IOException {
final Collection<String> retval = new ArrayList<String>();
final Collection<String> retval = new ArrayList<>();
final String classPath = System.getProperty("java.class.path", ".");
final String[] classPathElements = classPath.split(File.pathSeparator);
for (final String element : classPathElements) {
......@@ -52,7 +52,7 @@ public final class ResourceHelper {
// Private static methods
private static Collection<String> getResources(final String element, final Pattern pattern) throws IOException {
final Collection<String> retval = new ArrayList<String>();
final Collection<String> retval = new ArrayList<>();
final File file = new File(element);
if (file.isDirectory()) {
......@@ -65,7 +65,7 @@ public final class ResourceHelper {
}
private static Collection<String> getResourcesFromJarFile(final File file, final Pattern pattern) throws IOException {
final Collection<String> retval = new ArrayList<String>();
final Collection<String> retval = new ArrayList<>();
try (final ZipFile zf = new ZipFile(file)) {
final Enumeration<? extends ZipEntry> e = zf.entries();
while (e.hasMoreElements()) {
......@@ -84,7 +84,7 @@ public final class ResourceHelper {
}
private static Collection<String> getResourcesFromDirectory(final File directory, final Pattern pattern) throws IOException {
final Collection<String> retval = new ArrayList<String>();
final Collection<String> retval = new ArrayList<>();
final File[] fileList = directory.listFiles();
for (final File file : fileList) {
......
......@@ -28,8 +28,8 @@ public class DatabaseTest {
@BeforeTest
public void setUp() {
nodes = new HashMap<Integer, Node>();
links = new LinkedHashMap<Integer, Link>();
nodes = new HashMap<>();
links = new LinkedHashMap<>();
}
@AfterTest
......@@ -51,8 +51,8 @@ public class DatabaseTest {
@Test
public void testReadNetwork() {
final Map<Integer, Node> compareNodes = new HashMap<Integer, Node>();
final Map<Integer, Link> compareLinks = new LinkedHashMap<Integer, Link>();
final Map<Integer, Node> compareNodes = new HashMap<>();
final Map<Integer, Link> compareLinks = new LinkedHashMap<>();
fillHashMaps(compareNodes, compareLinks);
final Database db = initDb();
......@@ -88,7 +88,7 @@ public class DatabaseTest {
private void fillHashMaps(final Map<Integer, Node> nodeHashMap, final Map<Integer, Link> linkHashMap) {
final Node n1 = new Node(NODE_ID);
final Link l1 = new Link(LINK_ID, 5172, 885, 15);
final List<Link> ll1 = new ArrayList<Link>();
final List<Link> ll1 = new ArrayList<>();
n1.setAdjLinks(ll1);
n1.addAdjLink(l1);
......
......@@ -169,7 +169,7 @@ public final class AlgorithmRuntimeTest {
return;
}
times = new TreeSet<Integer>();
times = new TreeSet<>();
for (int i = 0; i < RUNTIME_OFFSETS.length; ++i) {
int offset = RUNTIME_OFFSETS[i];
int stepWidth = RUNTIME_POINTS_PER_OFFSET[i];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment