Example usage for java.util Arrays hashCode

List of usage examples for java.util Arrays hashCode

Introduction

In this page you can find the example usage for java.util Arrays hashCode.

Prototype

public static int hashCode(Object a[]) 

Source Link

Document

Returns a hash code based on the contents of the specified array.

Usage

From source file:com.syncnapsis.websockets.service.rpc.RPCCall.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + Arrays.hashCode(args);
    result = prime * result + ((method == null) ? 0 : method.hashCode());
    result = prime * result + ((object == null) ? 0 : object.hashCode());
    return result;
}

From source file:org.jboss.aerogear.android.pipe.loader.LoaderAdapter.java

@Override
public void read(Callback<List<T>> callback) {
    int id = Arrays.hashCode(new Object[] { name, callback });
    Bundle bundle = new Bundle();
    bundle.putSerializable(CALLBACK, callback);
    bundle.putSerializable(FILTER, null);
    bundle.putSerializable(METHOD, Methods.READ);
    manager.initLoader(id, bundle, this);
}

From source file:com.ongtonnesoup.permissions.PerMissions.java

@Override
public void onRequestPermissionsResult(String[] permissions, int[] grantResults) {
    PerMissionsFlows flows = this.flows.get(Arrays.hashCode(permissions));
    this.flows.remove(Arrays.hashCode(permissions));

    if (PermissionUtil.verifyPermissions(grantResults)) {
        Log.d(TAG, "Permission request granted.");
        callback.onPermissionGranted(permissions, flows.getContinueFlow());
    } else {//from  www . j a  v a 2 s.  co  m
        Log.d(TAG, "Permission request was NOT granted.");
        callback.onPermissionDenied(PermissionUtil.deniedPermissions(permissions, grantResults),
                flows.getDeniedFlow());
    }
}

From source file:com.thetechwarriors.cidrutils.Subnet.java

public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + maskSize;/*from   w  w w.  j  ava  2  s. c om*/
    result = prime * result + Arrays.hashCode(octets);
    return result;
}

From source file:com.smartitengineering.cms.api.impl.content.ContentIdImpl.java

@Override
public int hashCode() {
    int hash = 3;
    hash = 89 * hash + (this.workspaceId != null ? this.workspaceId.hashCode() : 0);
    hash = 89 * hash + Arrays.hashCode(this.id);
    return hash;//from  www  .j av  a  2 s  .  co  m
}

From source file:com.opengamma.maths.highlevelapi.datatypes.primitive.OGIndexType.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + _cols;/*from   w  ww  .java2s.  c o m*/
    result = prime * result + Arrays.hashCode(_data);
    result = prime * result + Arrays.hashCode(_rowPtr);
    result = prime * result + _rows;
    return result;
}

From source file:com.graphaware.common.representation.DetachedNode.java

/**
 * {@inheritDoc}//from  ww  w. ja  v a2  s . co m
 */
@Override
public int hashCode() {
    int result = super.hashCode();
    result = 31 * result + Arrays.hashCode(labels);
    return result;
}

From source file:com.opengamma.financial.analytics.model.volatility.local.deprecated.ForexLocalVolatilityPDEPresentValueResultCollection.java

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + _pvDataMap.hashCode();
    result = prime * result + Arrays.hashCode(_strikes);
    return result;
}

From source file:org.loklak.api.iot.NetmonPushServlet.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;/* w  ww . ja  v  a  2s  . c o  m*/
    }

    String url = post.get("url", "");
    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;
    }

    JSONArray nodesList = new JSONArray();
    byte[] xmlText;
    try {
        xmlText = ClientConnection.download(url);
        DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
        Document document = builder.parse(new InputSource(new StringReader(new String(xmlText))));
        NodeList routerList = document.getElementsByTagName("router");
        for (int i = 0; i < routerList.getLength(); i++) {
            JSONObject node = convertDOMNodeToMap(routerList.item(i));
            if (node != null)
                nodesList.put(node);
        }
    } catch (Exception e) {
        Log.getLog().warn(e);
        response.sendError(400, "error reading json file from url");
        return;
    }

    JsonFieldConverter converter = new JsonFieldConverter(
            JsonFieldConverter.JsonConversionSchemaEnum.NETMON_NODE);
    JSONArray nodes = converter.convert(nodesList);

    for (Object node_obj : nodes) {
        JSONObject node = (JSONObject) node_obj;
        if (!node.has("text")) {
            node.put("text", "");
        }
        node.put("source_type", SourceType.NETMON.toString());
        if (!node.has("user")) {
            node.put("user", new JSONObject());
        }

        List<Object> location_point = new ArrayList<>();
        location_point.add(0, Double.parseDouble((String) node.get("latitude")));
        location_point.add(1, Double.parseDouble((String) node.get("longitude")));
        node.put("location_point", location_point);
        node.put("location_mark", location_point);
        node.put("location_source", LocationSource.USER.name());
        try {
            node.put("id_str", PushServletHelper.computeMessageId(node, SourceType.NETMON));
        } catch (Exception e) {
            DAO.log("Problem computing id" + e.getMessage());
            continue;
        }
        try {
            JSONObject user = (JSONObject) node.get("user");
            user.put("screen_name", computeUserId(user.get("update_date"), user.get("id"), SourceType.NETMON));
        } catch (Exception e) {
            DAO.log("Problem computing user id : " + e.getMessage());
        }
    }

    PushReport pushReport = PushServletHelper.saveMessagesAndImportProfile(nodes, Arrays.hashCode(xmlText),
            post, SourceType.NETMON, screen_name);

    String res = PushServletHelper.buildJSONResponse(post.get("callback", ""), pushReport);
    response.getOutputStream().println(res);
    DAO.log(request.getServletPath() + " -> records = " + pushReport.getRecordCount() + ", new = "
            + pushReport.getNewCount() + ", known = " + pushReport.getKnownCount() + ", from host hash "
            + remoteHash);

}

From source file:org.diorite.nbt.NbtTagByteArray.java

@Override
public int hashCode() {
    int result = super.hashCode();
    result = (31 * result) + Arrays.hashCode(this.value);
    return result;
}