List of usage examples for java.util Arrays hashCode
public static int hashCode(Object a[])
From source file:com.mapr.hbase.support.objects.MHRegionInfo.java
private void setHashCode() { int result = Arrays.hashCode(this.regionName); result ^= this.regionId; result ^= Arrays.hashCode(this.startKey); result ^= Arrays.hashCode(this.endKey); result ^= Boolean.valueOf(this.offLine).hashCode(); result ^= Arrays.hashCode(this.tableName); this.hashCode = result; }
From source file:org.nuclos.common2.LangUtils.java
/** * Generates a hash code for a sequence of input values. *///from w w w.j a v a 2 s . co m public static int hash(Object... values) { return Arrays.hashCode(values); }
From source file:org.apache.pdfbox.cos.COSString.java
@Override public int hashCode() { int result = Arrays.hashCode(bytes); return result + (forceHexForm ? 17 : 0); }
From source file:com.opengamma.analytics.financial.model.finitedifference.PDEGrid1D.java
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Arrays.hashCode(_dt); result = prime * result + Arrays.hashCode(_dx); result = prime * result + _nSpaceNodes; result = prime * result + Arrays.hashCode(_tNodes); result = prime * result + Arrays.hashCode(_x1st); result = prime * result + Arrays.hashCode(_x1stBkd); result = prime * result + Arrays.hashCode(_x1stFwd); result = prime * result + Arrays.hashCode(_x2nd); result = prime * result + Arrays.hashCode(_xNodes); return result; }
From source file:svnserver.repository.git.prop.GitIgnore.java
@Override public int hashCode() { int result = rules.hashCode(); result = 31 * result + Arrays.hashCode(global); result = 31 * result + Arrays.hashCode(local); return result; }
From source file:com.quartercode.disconnected.sim.comp.file.FileRights.java
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Arrays.hashCode(groupRights); result = prime * result + Arrays.hashCode(othersRights); result = prime * result + Arrays.hashCode(ownerRights); return result; }
From source file:org.loklak.api.iot.GeoJsonPushServlet.java
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Query post = RemoteAccess.evaluate(request); String remoteHash = Integer.toHexString(Math.abs(post.getClientHost().hashCode())); // manage DoS if (post.isDoS_blackout()) { response.sendError(503, "your request frequency is too high"); return;//from w ww .j av a 2 s . c om } String url = post.get("url", ""); String map_type = post.get("map_type", ""); String source_type_str = post.get("source_type", ""); if ("".equals(source_type_str) || !SourceType.isValid(source_type_str)) { DAO.log("invalid or missing source_type value : " + source_type_str); source_type_str = SourceType.GEOJSON.toString(); } SourceType sourceType = SourceType.GEOJSON; if (url == null || url.length() == 0) { response.sendError(400, "your request does not contain an url to your data object"); return; } String screen_name = post.get("screen_name", ""); if (screen_name == null || screen_name.length() == 0) { response.sendError(400, "your request does not contain required screen_name parameter"); return; } // parse json retrieved from url final JSONArray features; byte[] jsonText; try { jsonText = ClientConnection.download(url); JSONObject map = new JSONObject(new String(jsonText, StandardCharsets.UTF_8)); features = map.getJSONArray("features"); } catch (Exception e) { response.sendError(400, "error reading json file from url"); return; } if (features == null) { response.sendError(400, "geojson format error : member 'features' missing."); return; } // parse maptype Map<String, List<String>> mapRules = new HashMap<>(); if (!"".equals(map_type)) { try { String[] mapRulesArray = map_type.split(","); for (String rule : mapRulesArray) { String[] splitted = rule.split(":", 2); if (splitted.length != 2) { throw new Exception("Invalid format"); } List<String> valuesList = mapRules.get(splitted[0]); if (valuesList == null) { valuesList = new ArrayList<>(); mapRules.put(splitted[0], valuesList); } valuesList.add(splitted[1]); } } catch (Exception e) { response.sendError(400, "error parsing map_type : " + map_type + ". Please check its format"); return; } } JSONArray rawMessages = new JSONArray(); ObjectWriter ow = new ObjectMapper().writerWithDefaultPrettyPrinter(); PushReport nodePushReport = new PushReport(); for (Object feature_obj : features) { JSONObject feature = (JSONObject) feature_obj; JSONObject properties = feature.has("properties") ? (JSONObject) feature.get("properties") : new JSONObject(); JSONObject geometry = feature.has("geometry") ? (JSONObject) feature.get("geometry") : new JSONObject(); JSONObject message = new JSONObject(true); // add mapped properties JSONObject mappedProperties = convertMapRulesProperties(mapRules, properties); message.putAll(mappedProperties); if (!"".equals(sourceType)) { message.put("source_type", sourceType); } else { message.put("source_type", SourceType.GEOJSON); } message.put("provider_type", ProviderType.IMPORT.name()); message.put("provider_hash", remoteHash); message.put("location_point", geometry.get("coordinates")); message.put("location_mark", geometry.get("coordinates")); message.put("location_source", LocationSource.USER.name()); message.put("place_context", PlaceContext.FROM.name()); if (message.get("text") == null) { message.put("text", ""); } // append rich-text attachment String jsonToText = ow.writeValueAsString(properties); message.put("text", message.get("text") + MessageEntry.RICH_TEXT_SEPARATOR + jsonToText); if (properties.get("mtime") == null) { String existed = PushServletHelper.checkMessageExistence(message); // message known if (existed != null) { nodePushReport.incrementKnownCount(existed); continue; } // updated message -> save with new mtime value message.put("mtime", Long.toString(System.currentTimeMillis())); } try { message.put("id_str", PushServletHelper.computeMessageId(message, sourceType)); } catch (Exception e) { DAO.log("Problem computing id : " + e.getMessage()); nodePushReport.incrementErrorCount(); } rawMessages.put(message); } PushReport report = PushServletHelper.saveMessagesAndImportProfile(rawMessages, Arrays.hashCode(jsonText), post, sourceType, screen_name); String res = PushServletHelper.buildJSONResponse(post.get("callback", ""), report); post.setResponse(response, "application/javascript"); response.getOutputStream().println(res); DAO.log(request.getServletPath() + " -> records = " + report.getRecordCount() + ", new = " + report.getNewCount() + ", known = " + report.getKnownCount() + ", error = " + report.getErrorCount() + ", from host hash " + remoteHash); }
From source file:com.graphaware.common.policy.fluent.BaseIncludeRelationships.java
/** * {@inheritDoc}/* w ww. j av a 2s . c om*/ */ @Override public int hashCode() { int result = super.hashCode(); result = 31 * result + direction.hashCode(); result = 31 * result + Arrays.hashCode(relationshipTypes); return result; }
From source file:org.nmdp.hmlfhirconvertermodels.domain.fhir.Patient.java
@Override public int hashCode() { int result = getIdentifier() != null ? getIdentifier().hashCode() : 0; result = 31 * result + (getActive() != null ? getActive().hashCode() : 0); result = 31 * result + (getName() != null ? getName().hashCode() : 0); result = 31 * result + (getTelecom() != null ? getTelecom().hashCode() : 0); result = 31 * result + (getGender() != null ? getGender().hashCode() : 0); result = 31 * result + (getBirthDate() != null ? getBirthDate().hashCode() : 0); result = 31 * result + (getDeceased() != null ? getDeceased().hashCode() : 0); result = 31 * result + (getAddress() != null ? getAddress().hashCode() : 0); result = 31 * result + (getMaritalStatus() != null ? getMaritalStatus().hashCode() : 0); result = 31 * result + (getMultipleBirth() != null ? getMultipleBirth().hashCode() : 0); result = 31 * result + Arrays.hashCode(getPhoto()); result = 31 * result + (getGeneralPractitioner() != null ? getGeneralPractitioner().hashCode() : 0); result = 31 * result + (getManagingOrganization() != null ? getManagingOrganization().hashCode() : 0); result = 31 * result + (getSpecimens() != null ? getSpecimens().hashCode() : 0); result = 31 * result + (getDiagnosticReport() != null ? getDiagnosticReport().hashCode() : 0); return result; }
From source file:com.nridge.core.base.field.FieldRow.java
/** * Returns a hash code value for the object. This method is * supported for the benefit of hash tables such as those provided by * {@link java.util.HashMap}.// ww w . j a va 2 s . c o m * * @return A hash code value for this object. */ @Override public int hashCode() { return mCells != null ? Arrays.hashCode(mCells) : 0; }