Changeset 6148 in josm for trunk/src/org/openstreetmap/josm/gui/preferences/SourceEntry.java
- Timestamp:
- 2013-08-14T13:12:50+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEntry.java
r6070 r6148 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.gui.preferences; 3 4 import static org.openstreetmap.josm.tools.Utils.equal; 3 5 4 6 import java.io.File; 5 7 import java.util.regex.Matcher; 6 8 import java.util.regex.Pattern; 7 8 import static org.openstreetmap.josm.tools.Utils.equal;9 9 10 10 /** … … 19 19 */ 20 20 public String url; 21 22 /** 23 * Indicates, that {@link #url} is a zip file and the resource is 24 * inside the zip file. 25 */ 26 public boolean isZip; 27 28 /** 29 * If {@link #isZip} is true, denotes the path inside the zip file. 30 */ 31 public String zipEntryPath; 21 32 22 33 /** … … 42 53 public boolean active; 43 54 44 public SourceEntry(String url, String name, String title, Boolean active) {55 public SourceEntry(String url, boolean isZip, String zipEntryPath, String name, String title, boolean active) { 45 56 this.url = url; 57 this.isZip = isZip; 58 this.zipEntryPath = equal(zipEntryPath, "") ? null : zipEntryPath; 46 59 this.name = equal(name, "") ? null : name; 47 60 this.title = equal(title, "") ? null : title; … … 49 62 } 50 63 64 public SourceEntry(String url, String name, String title, Boolean active) { 65 this(url, false, null, name, title, active); 66 } 67 51 68 public SourceEntry(SourceEntry e) { 52 69 this.url = e.url; 70 this.isZip = e.isZip; 71 this.zipEntryPath = e.zipEntryPath; 53 72 this.name = e.name; 54 73 this.title = e.title; … … 62 81 final SourceEntry other = (SourceEntry) obj; 63 82 return equal(other.url, url) && 83 other.isZip == isZip && 84 equal(other.zipEntryPath, zipEntryPath) && 64 85 equal(other.name, name) && 65 86 equal(other.title, title) && … … 71 92 int hash = 5; 72 93 hash = 89 * hash + (this.url != null ? this.url.hashCode() : 0); 94 hash = 89 * hash + (this.isZip ? 1 : 0); 95 hash = 89 * hash + (this.zipEntryPath != null ? this.zipEntryPath.hashCode() : 0); 73 96 hash = 89 * hash + (this.name != null ? this.name.hashCode() : 0); 74 97 hash = 89 * hash + (this.title != null ? this.title.hashCode() : 0); … … 133 156 return dir.getPath(); 134 157 } 158 159 /** 160 * Returns the parent directory of the resource inside the zip file. 161 * @return null, if zipEntryPath is null, otherwise the parent directory of 162 * the resource inside the zip file 163 */ 164 public String getZipEntryDirName() { 165 if (zipEntryPath == null) return null; 166 return new File(zipEntryPath).getParent().toString(); 167 } 135 168 }
Note:
See TracChangeset
for help on using the changeset viewer.