public static GHDirectory createGHDirectory(String graphHopperFolder) { return new GHDirectory(graphHopperFolder, DAType.RAM_STORE); }
public AbstractNodeContractor(CHGraph prepareGraph, Weighting weighting) { this.prepareGraph = prepareGraph; this.encoder = weighting.getFlagEncoder(); originalEdges = new GHDirectory("", DAType.RAM_INT).find(""); originalEdges.create(1000); }
@Override public String toString() { return getLocation(); }
@Override public void remove(DataAccess da) { removeFromMap(da.getName()); removeDA(da, da.getName(), true); }
public GHDirectory(String _location, DAType defaultType) { this.defaultType = defaultType; if (isEmpty(_location)) _location = new File("").getAbsolutePath(); if (!_location.endsWith("/")) _location += "/"; location = _location; File dir = new File(location); if (dir.exists() && !dir.isDirectory()) throw new RuntimeException("file '" + dir + "' exists but is not a directory"); // set default access to integer based // improves performance on server side, 10% faster for queries and preparation if (this.defaultType.isInMemory()) { if (isStoring()) { put("location_index", DAType.RAM_INT_STORE); put("edges", DAType.RAM_INT_STORE); put("nodes", DAType.RAM_INT_STORE); } else { put("location_index", DAType.RAM_INT); put("edges", DAType.RAM_INT); put("nodes", DAType.RAM_INT); } } }
@Override public Directory create() { if (isStoring()) new File(location).mkdirs(); return this; }
@Override public DataAccess find(String name) { DAType type = types.get(name); if (type == null) type = defaultType; return find(name, type); }
@Override public void clear() { // If there is at least one MMap DA then do not apply the cleanHack // for every single mmap DA as this is very slow if lots of DataAccess objects were collected // => forceClean == false MMapDataAccess mmapDA = null; for (DataAccess da : map.values()) { if (da instanceof MMapDataAccess) mmapDA = (MMapDataAccess) da; removeDA(da, da.getName(), false); } if (mmapDA != null) cleanHack(); map.clear(); }
@Override public void remove(DataAccess da) { removeFromMap(da.getName()); removeDA(da, da.getName(), true); }
public GHDirectory(String _location, DAType defaultType) { this.defaultType = defaultType; if (Helper.isEmpty(_location)) _location = new File("").getAbsolutePath(); if (!_location.endsWith("/")) _location += "/"; location = _location; File dir = new File(location); if (dir.exists() && !dir.isDirectory()) throw new RuntimeException("file '" + dir + "' exists but is not a directory"); // set default access to integer based // improves performance on server side, 10% faster for queries and preparation if (this.defaultType.isInMemory()) { if (isStoring()) { put("location_index", DAType.RAM_INT_STORE); put("edges", DAType.RAM_INT_STORE); put("nodes", DAType.RAM_INT_STORE); } else { put("location_index", DAType.RAM_INT); put("edges", DAType.RAM_INT); put("nodes", DAType.RAM_INT); } } }
static Directory guessDirectory(GraphStorage store) { if (store.getDirectory() instanceof MMapDirectory) { throw new IllegalStateException("not supported yet: mmap will overwrite existing storage at the same location"); } String location = store.getDirectory().getLocation(); boolean isStoring = ((GHDirectory) store.getDirectory()).isStoring(); return new RAMDirectory(location, isStoring); }
@Override public DataAccess find( String name ) { DAType type = types.get(name); if (type == null) type = defaultType; return find(name, type); }
@Override public void clear() { // If there is at least one MMap DA then do not apply the cleanHack // for every single mmap DA as this is very slow if lots of DataAccess objects were collected // => forceClean == false MMapDataAccess mmapDA = null; for (DataAccess da : map.values()) { if (da instanceof MMapDataAccess) mmapDA = (MMapDataAccess) da; removeDA(da, da.getName(), false); } if (mmapDA != null) cleanHack(); map.clear(); }
protected Directory getDirectory() { if (dir != null) return dir; logger.info(this.toString() + " Elevation Provider, from: " + baseUrl + ", to: " + cacheDir + ", as: " + daType + " using calcmean: " + calcMean); return dir = new GHDirectory(cacheDir.getAbsolutePath(), daType); }
@Override public void remove( DataAccess da ) { removeFromMap(da.getName()); removeDA(da, da.getName(), true); }
public GHDirectory( String _location, DAType defaultType ) { this.defaultType = defaultType; if (Helper.isEmpty(_location)) _location = new File("").getAbsolutePath(); if (!_location.endsWith("/")) _location += "/"; location = _location; File dir = new File(location); if (dir.exists() && !dir.isDirectory()) throw new RuntimeException("file '" + dir + "' exists but is not a directory"); // set default access to integer based // improves performance on server side, 10% faster for queries and preparation if (this.defaultType.isInMemory()) { if (isStoring()) { put("location_index", DAType.RAM_INT_STORE); put("edges", DAType.RAM_INT_STORE); put("nodes", DAType.RAM_INT_STORE); } else { put("location_index", DAType.RAM_INT); put("edges", DAType.RAM_INT); put("nodes", DAType.RAM_INT); } } }
@Override public Directory create() { if (isStoring()) new File(location).mkdirs(); return this; }
@Override public DataAccess find(String name) { DAType type = types.get(name); if (type == null) type = defaultType; return find(name, type); }
@Override public String toString() { return getLocation(); }
@Override public void clear() { // If there is at least one MMap DA then do not apply the cleanHack // for every single mmap DA as this is very slow if lots of DataAccess objects were collected // => forceClean == false MMapDataAccess mmapDA = null; for (DataAccess da : map.values()) { if (da instanceof MMapDataAccess) mmapDA = (MMapDataAccess) da; removeDA(da, da.getName(), false); } if (mmapDA != null) Helper.cleanHack(); map.clear(); }