@Override public final int hashCode() { if (file == null) { return 0; } return file.hashCode(); }
/** * Converts the inputFile into a JUnit output file * * @param tusarToolInfo the tusar tool info wrapper object * @param inputFile the input file to be converted * @param workspace the workspace * @param outputDirectory the output parent directory that contains the TUSAR output file * @return the converted file * @throws com.thalesgroup.hudson.plugins.tusarnotifier.exception.TusarNotifierException an * XUnitException is thrown if there is a conversion error. */ @SuppressWarnings("ResultOfMethodCallIgnored") public File convert( TusarToolInfo tusarToolInfo, File inputFile, File workspace, File outputDirectory) throws TusarNotifierException { // Prepare the conversion when there is a custom type prepareConversion(tusarToolInfo, workspace); MetricsType metricsType = tusarToolInfo.getMetricsType(); InputMetric inputMetric = metricsType.getInputMetric(); final String TUSAR_FILE_POSTFIX = ".xml"; final String TUSAR_FILE_PREFIX = "TUSAR-"; File junitTargetFile = new File(outputDirectory, TUSAR_FILE_PREFIX + inputFile.hashCode() + TUSAR_FILE_POSTFIX); xUnitLog.info("Converting '" + inputFile + "' ."); try { // Set the XSL for custom type if (metricsType instanceof CustomType) { ((CustomInputMetric) inputMetric).setCustomXSLFile(tusarToolInfo.getCusXSLFile()); } inputMetric.convert(inputFile, junitTargetFile); } catch (ConversionException ce) { throw new TusarNotifierException("Conversion error", ce); } return junitTargetFile; }
private static HttpResponse addEtag( HttpRequest nettyRequest, HttpResponse httpResponse, File file) { if (Play.mode == Play.Mode.DEV) { httpResponse.setHeader(CACHE_CONTROL, "no-cache"); } else { String maxAge = Play.configuration.getProperty("http.cacheControl", "3600"); if (maxAge.equals("0")) { httpResponse.setHeader(CACHE_CONTROL, "no-cache"); } else { httpResponse.setHeader(CACHE_CONTROL, "max-age=" + maxAge); } } boolean useEtag = Play.configuration.getProperty("http.useETag", "true").equals("true"); long last = file.lastModified(); final String etag = "\"" + last + "-" + file.hashCode() + "\""; if (!isModified(etag, last, nettyRequest)) { if (nettyRequest.getMethod().equals(HttpMethod.GET)) { httpResponse.setStatus(HttpResponseStatus.NOT_MODIFIED); } if (useEtag) { httpResponse.setHeader(ETAG, etag); } } else { httpResponse.setHeader(LAST_MODIFIED, Utils.getHttpDateFormatter().format(new Date(last))); if (useEtag) { httpResponse.setHeader(ETAG, etag); } } return httpResponse; }
@Override public int hashCode() { int result = androidManifestFile != null ? androidManifestFile.hashCode() : 0; result = 31 * result + (getResourceDirectory() != null ? getResourceDirectory().hashCode() : 0); result = 31 * result + (getAssetsDirectory() != null ? getAssetsDirectory().hashCode() : 0); return result; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((file == null) ? 0 : file.hashCode()); return result; }
@Override public int hashCode() { int result = name.hashCode(); result = 31 * result + value.hashCode(); result = 31 * result + (file != null ? file.hashCode() : 0); return result; }
@Override public int hashCode() { int result = pluginJar.hashCode(); result = 31 * result + (pluginProviderDefs != null ? pluginProviderDefs.hashCode() : 0); result = 31 * result + (mainAttributes != null ? mainAttributes.hashCode() : 0); result = 31 * result + (classCache != null ? classCache.hashCode() : 0); return result; }
@Override public int hashCode() { int result = status != null ? status.hashCode() : 0; result = 31 * result + (int) (inReplyToStatusId ^ inReplyToStatusId >>> 32); result = 31 * result + (location != null ? location.hashCode() : 0); result = 31 * result + (placeId != null ? placeId.hashCode() : 0); result = 31 * result + (displayCoordinates ? 1 : 0); result = 31 * result + (possiblySensitive ? 1 : 0); result = 31 * result + (mediaName != null ? mediaName.hashCode() : 0); result = 31 * result + (mediaBody != null ? mediaBody.hashCode() : 0); result = 31 * result + (mediaFile != null ? mediaFile.hashCode() : 0); return result; }
/** {@inheritDoc} */ @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((directory == null) ? 0 : directory.hashCode()); return result; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((dbType == null) ? 0 : dbType.hashCode()); result = prime * result + ((descriptor == null) ? 0 : descriptor.hashCode()); result = prime * result + ((file == null) ? 0 : file.hashCode()); result = prime * result + ((modes == null) ? 0 : modes.hashCode()); return result; }
/** Retrieve a servable file by its hashcode. */ public File getFile(String hash) { try { int h = Integer.valueOf(hash); for (File f : files) { if (f.hashCode() == h) { return f; } } } catch (NumberFormatException e) { } return null; }
@Override public Cursor query( Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { MatrixCursor matrixCursor = new MatrixCursor(new String[] {"_id", "gitdir"}); for (File repoDir : reposDir.listFiles()) { File gitdir = RepositoryCache.FileKey.resolve(repoDir, FS.detect()); if (gitdir != null) { matrixCursor.newRow().add(gitdir.hashCode()).add(gitdir); } } return matrixCursor; }
/** * Construct from path * * @param path can point to a file or a folder. Whichever type can be convert to folder path * only. */ public FolderItem(String path) { File f = new File(path); // Try to make it a directory if (f.isFile()) { String fdPath = f.getParent(); f = new File(fdPath); numberOfSongs = 1; } else numberOfSongs = 0; fullPath = f.getPath(); name = f.getName(); id = f.hashCode(); }
@Override public int hashCode() { int result = realmFolder.hashCode(); result = 31 * result + realmFileName.hashCode(); result = 31 * result + canonicalPath.hashCode(); result = 31 * result + (key != null ? Arrays.hashCode(key) : 0); result = 31 * result + (int) schemaVersion; result = 31 * result + (migration != null ? migration.hashCode() : 0); result = 31 * result + (deleteRealmIfMigrationNeeded ? 1 : 0); result = 31 * result + schemaMediator.hashCode(); result = 31 * result + durability.hashCode(); return result; }
/* (non-Javadoc) * @see java.lang.Object#hashCode() */ public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (featureId == null ? 0 : featureId.hashCode()); result = prime * result + (featureVersion == null ? 0 : featureVersion.hashCode()); if (this.getURL() == null) return result; if ("file".equalsIgnoreCase(getURL().getProtocol())) { // $NON-NLS-1$ // If the URL is a file, then create the HashCode from the file File f = new File(getURL().getFile()); if (f != null) result = prime * result + f.hashCode(); } else // Otherwise create it from the External form of the URL (in lower case) result = prime * result + getExternalForm(this.getURL()).hashCode(); return result; }
public int hashCode() { return (file.hashCode() + 1073) * 37 + (int)(modified % 0x7fffffffL); }
private void uploadPhoto( @Nullable String title, @Nullable String description, @NonNull String filePath) { final File file = new File(filePath); if (!FileUtil.isFileValid(file)) { LogUtil.w(TAG, "File is invalid, bailing"); return; } LogUtil.v(TAG, "Received File to upload"); ApiClient client = new ApiClient(Endpoints.UPLOAD.getUrl(), ApiClient.HttpRequest.POST); MediaType type; if (file.getAbsolutePath().endsWith("png")) { type = MediaType.parse("image/png"); } else if (file.getAbsolutePath().endsWith("gif")) { type = MediaType.parse("image/gif"); } else { type = MediaType.parse("image/jpeg"); } MultipartBuilder builder = new MultipartBuilder() .type(MultipartBuilder.FORM) .addPart( Headers.of("Content-Disposition", "form-data; name=\"image\""), new ProgressRequestBody(file, type, this)); builder.addPart( Headers.of("Content-Disposition", "form-data; name=\"type\""), RequestBody.create(null, "file")); if (!TextUtils.isEmpty(title)) { builder.addPart( Headers.of("Content-Disposition", "form-data; name=\"title\""), RequestBody.create(null, title)); } if (!TextUtils.isEmpty(description)) { builder.addPart( Headers.of("Content-Disposition", "form-data; name=\"description\""), RequestBody.create(null, description)); } RequestBody body = builder.build(); try { if (mNotificationId <= 0) mNotificationId = file.hashCode(); onUploadStarted(); JSONObject json = client.doWork(body); int status = json.getInt(ApiClient.KEY_STATUS); if (status == ApiClient.STATUS_OK) { handleResponse(json.getJSONObject(ApiClient.KEY_DATA)); } else { onUploadFailed(title, description, filePath, true); } } catch (IOException | JSONException e) { LogUtil.e(TAG, "Error uploading file", e); onUploadFailed(title, description, filePath, true); } }
@Override public int hashCode() { return file.hashCode() * 13; }
@Override public int hashCode() { int result = file != null ? file.hashCode() : 0; result = 31 * result + (type != null ? type.hashCode() : 0); return result; }
public int hashCode() { return file.hashCode(); }
@Override public int hashCode() { return artifactFile.hashCode(); }
@Override public int hashCode() { return (name == null ? 0 : name.hashCode() * 13) + (parentFile == null ? 0 : parentFile.hashCode()); }
@Override public int hashCode() { int result = dir.hashCode(); result = 31 * result + fileFilter.hashCode(); return result; }
/** * Calculates a integer hash-code for the Property that's unique inside the Item containing the * Property. Two different Properties inside the same Item contained in the same list always * have different hash-codes, though Properties in different Items may have identical * hash-codes. * * @return A locally unique hash-code as integer */ @Override public int hashCode() { return file.hashCode() ^ GitRepositoryContainer.this.hashCode(); }
/** Constructs a FileItem from a existing file. */ private FileItem(File file) { if (logger.isTraceEnabled()) { logger.trace("FileItem constructor: " + file.hashCode() + " " + file.getName()); } this.file = file; }
@Override public int hashCode() { return location.hashCode(); }
public int hashCode() { return parent != null ? parent.hashCode() + name.hashCode() : name.hashCode(); }
public OpenSlide(File file) throws IOException { if (!file.exists()) { throw new FileNotFoundException(file.toString()); } // vartika on 5 august filePath = file.getPath(); osr = OpenSlideJNI.openslide_open(file.getPath()); if (osr == 0) { throw new IOException(file + ": Not a file that OpenSlide can recognize"); } // dispose on error, we are in the constructor try { checkError(); } catch (IOException e) { dispose(); throw e; } // store level count levelCount = OpenSlideJNI.openslide_get_level_count(osr); // store dimensions levelWidths = new long[levelCount]; levelHeights = new long[levelCount]; levelDownsamples = new double[levelCount]; for (int i = 0; i < levelCount; i++) { long dim[] = new long[2]; OpenSlideJNI.openslide_get_level_dimensions(osr, i, dim); levelWidths[i] = dim[0]; levelHeights[i] = dim[1]; levelDownsamples[i] = OpenSlideJNI.openslide_get_level_downsample(osr, i); } // properties HashMap<String, String> props = new HashMap<String, String>(); for (String s : OpenSlideJNI.openslide_get_property_names(osr)) { props.put(s, OpenSlideJNI.openslide_get_property_value(osr, s)); } properties = Collections.unmodifiableMap(props); // associated images HashMap<String, AssociatedImage> associated = new HashMap<String, AssociatedImage>(); for (String s : OpenSlideJNI.openslide_get_associated_image_names(osr)) { associated.put(s, new AssociatedImage(s, this)); } associatedImages = Collections.unmodifiableMap(associated); // store info for hash and equals canonicalFile = file.getCanonicalFile(); String quickhash1 = getProperties().get(PROPERTY_NAME_QUICKHASH1); if (quickhash1 != null) { hashCodeVal = (int) Long.parseLong(quickhash1.substring(0, 8), 16); } else { hashCodeVal = canonicalFile.hashCode(); } // dispose on error, we are in the constructor try { checkError(); } catch (IOException e) { dispose(); throw e; } }
@Override public int hashCode() { return 7 * file.hashCode() * ObjectUtils.hashCode(lastModified); }
public int hashCode() { return matrixFile.hashCode() ^ format.hashCode(); }