List of usage examples for java.util Arrays hashCode
public static int hashCode(Object a[])
From source file:org.apache.hadoop.mapreduce.counters.FileSystemCounterGroup.java
@Override public synchronized int hashCode() { // need to be deep as counters is an array int hash = FileSystemCounter.class.hashCode(); for (Object[] counters : map.values()) { if (counters != null) hash ^= Arrays.hashCode(counters); }/*from ww w . jav a2s.c o m*/ return hash; }
From source file:org.apache.hadoop.hbase.mapreduce.TableSplit.java
@Override public int hashCode() { int result = tableName != null ? tableName.hashCode() : 0; result = 31 * result + (scan != null ? scan.hashCode() : 0); result = 31 * result + (startRow != null ? Arrays.hashCode(startRow) : 0); result = 31 * result + (endRow != null ? Arrays.hashCode(endRow) : 0); result = 31 * result + (regionLocation != null ? regionLocation.hashCode() : 0); return result; }
From source file:org.cloudgraph.hbase.graph.ParallelSliceSubgraphTask.java
/** * Assembles a given set of edges where the target is a different row, within * this table or another. Since we are assembling a graph, each edge requires * a new row reader. Each edge is a new root in the target table so need a new * row reader for each./*from w w w. j a v a 2 s. c o m*/ * * @param target * the object source to which we link edges * @param prop * the edge property * @param edges * the edges * @param rowReader * the row reader * @param childTableReader * the table reader for the child objects * @param level * the assembly level * @throws IOException */ protected void assembleExternalEdges(PlasmaDataObject target, long targetSequence, PlasmaProperty prop, EdgeReader collection, RowReader rowReader, List<CellValues> resultRows, TableReader childTableReader, int level) throws IOException { for (CellValues childValues : resultRows) { CellValues childResult = null; if (resultRows != null && !resultRows.contains(Arrays.hashCode(childValues.getRowKey()))) continue; // not found in predicate // see if this row is locked during fetch, and wait for it Object rowLock = fetchLocks.get(Arrays.hashCode(childValues.getRowKey())); if (rowLock != null) { synchronized (rowLock) { try { rowLock.wait(); } catch (InterruptedException e) { log.error(e.getMessage(), e); } } } RowReader existingChildRowReader = childTableReader.getRowReader(childValues.getRowKey()); if (existingChildRowReader != null) { // If assembled this row root before, // just link it. The data is already complete. PlasmaDataObject existingChild = (PlasmaDataObject) existingChildRowReader.getRootDataObject(); synchronized (existingChild) { synchronized (target) { link(existingChild, target, prop); } } continue; } // While fetching this node, another thread can fail to find an // existing row reader registered // above and fall through to this fetch, and therefore fetch the // same row, in addition // to attempting to create the same row reader below, causing an // error or warning // The second thread may be arriving at this node from another // property/edge and // therefore need to link from another edge above. fetchLocks.put(Arrays.hashCode(childValues.getRowKey()), new Object()); if (log.isDebugEnabled()) log.debug("fetch external row: " + prop.toString() + " (" + childValues.getRowKey() + ")"); childResult = fetchGraph(childValues.getRowKey(), childTableReader, collection.getBaseType()); if (childResult.containsColumn(rootTableReader.getTableConfig().getDataColumnFamilyNameBytes(), GraphMetaKey.TOMBSTONE.codeAsBytes())) { log.warn("ignoring toubstone result row '" + childValues.getRowKey() + "'"); continue; // ignore toumbstone edge } PlasmaType subType = collection.getSubType(); if (subType == null) subType = collection.getBaseType(); GraphColumnKeyFactory keyFactory = this.getKeyFactory(subType); byte[] uuidQual = keyFactory.createColumnKey(subType, EntityMetaKey.UUID); // need to reconstruct the original graph, so need original UUID byte[] rootUuid = childResult.getColumnValue( Bytes.toBytes(childTableReader.getTableConfig().getDataColumnFamilyName()), uuidQual); if (rootUuid == null) throw new GraphServiceException( "expected column: " + childTableReader.getTableConfig().getDataColumnFamilyName() + ":" + Bytes.toString(uuidQual)); String uuidStr = null; uuidStr = new String(rootUuid, childTableReader.getTableConfig().getCharset()); UUID uuid = UUID.fromString(uuidStr); PlasmaDataObject child = null; synchronized (target) { // create a child object using UUID from external row root child = createChild(source, sourceProperty, uuid, collection.getBaseType()); } RowReader childRowReader = null; synchronized (childTableReader) { // create a row reader for every external edge childRowReader = childTableReader.createRowReader(child, childResult); } synchronized (this.distributedReader) { this.distributedReader.mapRowReader(childValues.getRowKey(), childRowReader); } synchronized (target) { childRowReader.addDataObject(child); } // FIXME: we have the child already why is the sequence needed traversals.add(new Traversal(child, -1, collection, target, prop, childRowReader, true, level + 1)); rowLock = fetchLocks.remove(Arrays.hashCode(childValues.getRowKey())); synchronized (rowLock) { rowLock.notifyAll(); } } }
From source file:com.opengamma.maths.lowlevelapi.datatypes.primitive.SparseCoordinateFormatMatrix.java
/** * {@inheritDoc}//from ww w .ja v a 2s .c om */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + _els; result = prime * result + Arrays.hashCode(_values); result = prime * result + Arrays.hashCode(_x); result = prime * result + Arrays.hashCode(_y); return result; }
From source file:com.mawujun.util.AnnotationUtils.java
/** * Helper method for generating a hash code for an array. * * @param componentType the component type of the array * @param o the array//from ww w. jav a 2 s. c o m * @return a hash code for the specified array */ private static int arrayMemberHash(Class<?> componentType, Object o) { if (componentType.equals(Byte.TYPE)) { return Arrays.hashCode((byte[]) o); } if (componentType.equals(Short.TYPE)) { return Arrays.hashCode((short[]) o); } if (componentType.equals(Integer.TYPE)) { return Arrays.hashCode((int[]) o); } if (componentType.equals(Character.TYPE)) { return Arrays.hashCode((char[]) o); } if (componentType.equals(Long.TYPE)) { return Arrays.hashCode((long[]) o); } if (componentType.equals(Float.TYPE)) { return Arrays.hashCode((float[]) o); } if (componentType.equals(Double.TYPE)) { return Arrays.hashCode((double[]) o); } if (componentType.equals(Boolean.TYPE)) { return Arrays.hashCode((boolean[]) o); } return Arrays.hashCode((Object[]) o); }
From source file:org.jboss.forge.roaster.model.impl.PropertyImpl.java
@Override public int hashCode() { // compatible with Java 6: return Arrays.hashCode(new Object[] { getOrigin(), getName() }); }
From source file:org.jcodec.codecs.h264.io.model.PictureParameterSet.java
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Arrays.hashCode(bottom_right); result = prime * result + chroma_qp_index_offset; result = prime * result + (constrained_intra_pred_flag ? 1231 : 1237); result = prime * result + (deblocking_filter_control_present_flag ? 1231 : 1237); result = prime * result + (entropy_coding_mode_flag ? 1231 : 1237); result = prime * result + ((extended == null) ? 0 : extended.hashCode()); result = prime * result + num_ref_idx_l0_active_minus1; result = prime * result + num_ref_idx_l1_active_minus1; result = prime * result + num_slice_groups_minus1; result = prime * result + pic_init_qp_minus26; result = prime * result + pic_init_qs_minus26; result = prime * result + (pic_order_present_flag ? 1231 : 1237); result = prime * result + pic_parameter_set_id; result = prime * result + (redundant_pic_cnt_present_flag ? 1231 : 1237); result = prime * result + Arrays.hashCode(run_length_minus1); result = prime * result + seq_parameter_set_id; result = prime * result + (slice_group_change_direction_flag ? 1231 : 1237); result = prime * result + slice_group_change_rate_minus1; result = prime * result + Arrays.hashCode(slice_group_id); result = prime * result + slice_group_map_type; result = prime * result + Arrays.hashCode(top_left); result = prime * result + weighted_bipred_idc; result = prime * result + (weighted_pred_flag ? 1231 : 1237); return result; }
From source file:msi.gama.util.matrix.GamaFloatMatrix.java
@Override public int hashCode() { return Arrays.hashCode(getMatrix()); }
From source file:org.knime.al.util.noveltydetection.knfst.KNFST.java
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + Arrays.hashCode(m_betweenClassDistances); result = prime * result + ((m_kernel == null) ? 0 : m_kernel.hashCode()); result = prime * result + ((m_projection == null) ? 0 : m_projection.hashCode()); result = prime * result + ((m_targetPoints == null) ? 0 : m_targetPoints.hashCode()); return result; }
From source file:msi.gama.util.matrix.GamaIntMatrix.java
@Override public int hashCode() { return Arrays.hashCode(matrix); }