Example usage for java.lang Long equals

List of usage examples for java.lang Long equals

Introduction

In this page you can find the example usage for java.lang Long equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Compares this object to the specified object.

Usage

From source file:org.bozzo.ipplan.web.ZoneController.java

@RequestMapping(value = "/{zoneId}", method = RequestMethod.PUT, produces = {
        MediaType.APPLICATION_JSON_VALUE })
public HttpEntity<ZoneResource> updateZone(@PathVariable Integer infraId, @PathVariable Long zoneId,
        @RequestBody @NotNull Zone zone) {
    Preconditions.checkArgument(infraId.equals(zone.getInfraId()));
    Preconditions.checkArgument(zoneId.equals(zone.getId()));
    logger.info("update zone: {}", zone);
    Zone zon = repository.save(zone);/* ww  w  . j  a v a 2  s .com*/
    return new ResponseEntity<>(assembler.toResource(zon), HttpStatus.CREATED);
}

From source file:com.act.reachables.CladeTraversal.java

/**
 * The function creates a ordered list of chemicals from src to dst.
 *
 * @param src - The src id/*from w w w.  jav a2 s .  com*/
 * @param dst - The dst id
 * @return Returns a list of ids from src to dst.
 */
public LinkedList<Long> pathFromSrcToDerivativeOfSrc(Long src, Long dst) {
    LinkedList<Long> result = new LinkedList<>();
    Long id = dst;
    result.add(id);

    while (!id.equals(src)) {
        Long newId = this.actData.getActTree().parents.get(id);
        result.add(newId);
        id = newId;
    }

    Collections.reverse(result);
    return result;
}

From source file:com.alibaba.otter.shared.arbitrate.impl.setl.monitor.MainstemMonitor.java

private boolean isMine(Long targetNid) {
    return targetNid.equals(ArbitrateConfigUtils.getCurrentNid());
}

From source file:ome.services.scripts.test.ScriptRepoHelperTest.java

public void testFileModificationsCanBeFoundOnLoad() throws Exception {
    testLoadAddsObjects();/* www  .ja  v  a 2 s .  co  m*/
    Long fileID = files.get(0).getId();
    helper.write(path, "changed");
    files = helper.loadAll(true);
    assertFalse(fileID.equals(files.get(0).getId()));
}

From source file:org.thingsboard.server.msa.AbstractContainerTest.java

protected boolean verify(WsTelemetryResponse wsTelemetryResponse, String key, Long expectedTs,
        String expectedValue) {//from ww w. ja  v a2  s  .  co  m
    List<Object> list = wsTelemetryResponse.getDataValuesByKey(key);
    return expectedTs.equals(list.get(0)) && expectedValue.equals(list.get(1));
}

From source file:org.apache.hadoop.hashtable.HashTableBenchmark.java

public void testMultiHashing(int mode) {
    LOG.info("+++++++++++++++++++++++++++++++++++++++++++++++++++++");
    LOG.info("-------------------->MULTIHASHING------------------->");
    long start, stop;
    THashSet c = null;//from   w w w  .j  a va 2s  .  co m
    if (mode == 0) {
        c = new QuadHash(capacity, 0);
        LOG.info("LINEAR COLLISION RESOLUTION");
    } else if (mode == 1) {
        c = new QuadHash(capacity, 1);
        LOG.info("QUAD COLLISION RESOLUTION");
    } else if (mode == 2) {
        c = new DoubleHash(capacity);
        LOG.info("DOUBLE HASH COLLISION RESOLUTION");
    } else if (mode == 3) {
        c = new CuckooHash(capacity);
        LOG.info("CUCKOO HASH COLLISION RESOLUTION");
    }

    start = System.currentTimeMillis();
    for (int i = 0; i < NUM_NODES; i++) {
        c.put(ids[i]);
    }
    stop = System.currentTimeMillis();

    LOG.info("--------------->MULTIHASHING PUT DONE--------------->");
    LOG.info(" TIME: " + ((stop - start) / 1000.0));
    LOG.info(" FAILED : " + c.getFailed());

    start = System.currentTimeMillis();
    int present = 0;
    for (int i = 0; i < NUM_NODES; i++) {
        Long getElem = c.get(ids[i]);
        if (getElem != null && getElem.equals(ids[i])) {
            present++;
        }
    }

    stop = System.currentTimeMillis();
    LOG.info("--------------->MULTIHASHING GET DONE--------------->");
    LOG.info(" TIME: " + ((stop - start) / 1000.0));
    LOG.info(" NOT PRESENT: " + (NUM_NODES - present));
}

From source file:ome.security.basic.BasicACLVoter.java

/**
 * @param iObject/* www.j  ava2s  . c  o m*/
 * @param uid
 * @return
 * @DEV.TODO this is less problematic than linking.
 */
private boolean objectBelongsToUser(IObject iObject, Long uid) {
    Long oid = iObject.getDetails().getOwner().getId();
    return uid.equals(oid); // Only allow own objects!
}

From source file:org.bozzo.ipplan.web.RangeController.java

@RequestMapping(method = RequestMethod.POST, produces = { MediaType.APPLICATION_JSON_VALUE })
public HttpEntity<RangeResource> addRange(@PathVariable Integer infraId, @PathVariable Long zoneId,
        @RequestBody @NotNull Range range) {
    Preconditions.checkArgument(infraId.equals(range.getInfraId()));
    Preconditions.checkArgument(zoneId.equals(range.getZoneId()));

    if (!Netmask.isValidNetmask(range.getSize())) {
        throw new ApiException(ApiError.BAD_NETMASK);
    } else if (!IpAddress.isNetworkAddress(range.getIp(), range.getSize())) {
        throw new ApiException(ApiError.BAD_NETWORK);
    }/*from  w w w .j a va 2s  .co m*/

    logger.info("add new range: {}", range);
    Range rang = service.save(range);
    return new ResponseEntity<>(assembler.toResource(rang), HttpStatus.CREATED);
}

From source file:Cursling.deleteMonitor.java

public boolean deleteOutput(String monitor_name) {
    isdeleted1 = false;//from w ww . j av  a 2 s .com
    try {
        File inFile = new File(output_file_del);

        if (!inFile.isFile()) {
            logger.info("Parameter is not an existing file");
            return false;
        }

        storeUpdate1 = new File(output_file_del);

        File tempFile = new File(inFile.getAbsolutePath() + ".tmp");
        BufferedReader br = new BufferedReader(new FileReader(output_file_del));
        PrintWriter pw = new PrintWriter(new FileWriter(tempFile));

        String line = null;

        while ((line = br.readLine()) != null) {
            if (!line.equalsIgnoreCase("")) {
                if (line.startsWith("[\"" + monitor_name + "\"")) {

                    line = line.replaceAll(monitor_name, "hide");
                    pw.println(line);
                    pw.flush();
                    isdeleted1 = true;
                } else {
                    pw.println(line);
                    pw.flush();
                }
            } else {
            }
        }
        pw.close();
        br.close();

        //Rename the new file to the filename the original file had.
        if (tempFile.canRead()) {
            Long before = storeUpdate1.lastModified();
            FileUtils.copyFile(tempFile, storeUpdate1);
            Long after = storeUpdate1.lastModified();
            if (before.equals(after)) {
                return false;
            } else if (isdeleted1) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }

    } catch (FileNotFoundException ex) {
        logger.error("Error1 : " + ex);
        return false;

    } catch (IOException ex) {
        logger.error("Error2 : " + ex);
        return false;
    }
}

From source file:org.activiti.app.service.runtime.PermissionService.java

public boolean canDeleteProcessInstance(User currentUser, HistoricProcessInstance processInstance) {
    boolean canDelete = false;
    if (processInstance.getStartUserId() != null) {
        try {//from www  .  j  a  v  a2  s . c o  m
            Long starterId = Long.parseLong(processInstance.getStartUserId());
            canDelete = starterId.equals(currentUser.getId());
        } catch (NumberFormatException nfe) {
            // Ignore illegal starter id value
        }
    }

    return canDelete;
}