List of usage examples for java.lang String hashCode
public int hashCode()
From source file:ca.uhn.fhir.model.primitive.UriDt.java
@Override public int hashCode() { final int prime = 31; int result = 1; String normalize = normalize(getValue()); result = prime * result + ((normalize == null) ? 0 : normalize.hashCode()); return result; }
From source file:com.cloud2bubble.services.RuleEngine.java
/** * Updates an existing object in the Rule Engine. * // w ww. j a v a 2s.c om * @param o a fact */ public void updateInSession(String o) { ksession.update(facts.get(o), o.hashCode()); }
From source file:com.topsec.tsm.sim.event.web.EventQueryController.java
public static Object getEventRule(EventQueryService eventQueryService) { List<Map<String, Object>> rules = new ArrayList<Map<String, Object>>(); try {/*www . j av a 2s. c om*/ List<Map<String, Object>> evtMaps = eventQueryService.getAllEventStatistics(); if (evtMaps != null) { for (Map<String, Object> eventCountRowMap : evtMaps) { Map<String, Object> e = new HashMap<String, Object>(); String name = (String) eventCountRowMap.get("name"); e.put("id", name.hashCode()); Long count = (Long) eventCountRowMap.get("count"); e.put("text", name + "(" + count + ")"); Date startTime = (Date) eventCountRowMap.get("start_time"); Date endTime = (Date) eventCountRowMap.get("end_time"); Map<String, Object> attributes = new HashMap<String, Object>(); attributes.put("startTime", DateUtils.formatDatetime(startTime, "yyyy-MM-dd HH:mm:ss")); attributes.put("endTime", DateUtils.formatDatetime(endTime, "yyyy-MM-dd HH:mm:ss")); attributes.put("realName", name); e.put("attributes", attributes); rules.add(e); } } } catch (SQLException e) { e.printStackTrace(); } return rules; }
From source file:com.impetus.kundera.ycsb.benchmark.CouchDBNativeClient.java
private double hash(String key) { return key.hashCode(); }
From source file:com.twinsoft.convertigo.engine.EnginePropertiesManager.java
private static String encodeValue(PropertyType propertyType, String value) { switch (propertyType) { case PasswordHash: value = "" + value.hashCode(); break;//from w w w . j a va 2 s . co m default: break; } return value; }
From source file:com.azaptree.services.commons.TypeReferenceKey.java
public TypeReferenceKey(final String name, final boolean required) { super();//from w w w .java 2 s . c o m this.name = name; this.required = required; this.hashCode = name.hashCode(); }
From source file:com.github.jknack.handlebars.io.StringTemplateSource.java
/** * Creates a new {@link StringTemplateSource}. * * @param filename The template's file name. Required. * @param content The template's content. Required. */// www. j a v a 2s .c o m public StringTemplateSource(final String filename, final String content) { this.content = notNull(content, "The content is required."); this.filename = notNull(filename, "The filename is required."); this.lastModified = content.hashCode(); }
From source file:cc.recommenders.io.Directory.java
private String createTempFile(String fileName) { return fileName + fileName.hashCode(); }
From source file:com.addthis.hydra.data.filter.value.ValueFilterHash.java
@Override public ValueObject filterValue(ValueObject value) { if (value == null) { return value; }// www.j a va2 s . c o m long hash = 0; String sv = ValueUtil.asNativeString(value); switch (type) { case 0: hash = sv.hashCode(); break; case 1: hash = PluggableHashFunction.hash(sv); break; case 2: hash = cuidHash(sv); break; case 3: try { MessageDigest md = MessageDigest.getInstance("SHA"); md.update(LessBytes.toBytes(sv)); byte[] b = md.digest(); for (int i = 0; i < b.length && i < 8; i++) { hash = (hash << 8) | (b[i] & 0xff); } } catch (NoSuchAlgorithmException e) { // ignore } break; case 4: try { MessageDigest md = MessageDigest.getInstance("SHA-1"); md.reset(); md.update(LessBytes.toBytes(sv)); return ValueFactory.create(new String(Hex.encodeHex(md.digest()))); } catch (NoSuchAlgorithmException e) { // ignore } default: throw new RuntimeException("Unknown hash type: " + type); } if (abs) { hash = Math.abs(hash); } return ValueFactory.create(hash); }
From source file:com.flipkart.aesop.runtime.bootstrap.consumer.DefaultBlockingEventConsumer.java
@Override public void onEvent(AbstractEvent sourceEvent) { /** partition and submit */ String primaryKeyValues = Joiner.on(PRIMARY_KEY_SEPERATOR).join(sourceEvent.getPrimaryKeyValues()); Integer partitionNumber = ((primaryKeyValues.hashCode() & 0x7fffffff) % numberOfPartition); LOGGER.debug("Partition:" + primaryKeyValues.hashCode() + ":" + partitionNumber); executors.get(partitionNumber).execute(new SourceEventProcessor(sourceEvent, eventConsumer, backoffTimer)); }