Example usage for java.lang Long Long

List of usage examples for java.lang Long Long

Introduction

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

Prototype

@Deprecated(since = "9")
public Long(String s) throws NumberFormatException 

Source Link

Document

Constructs a newly allocated Long object that represents the long value indicated by the String parameter.

Usage

From source file:Main.java

public static ArrayList<long[]> getRanking(Activity activity, String mode2, long newRecord, long currentTime) {
    ArrayList<long[]> rankList = new ArrayList<long[]>();

    String rankRecord = getStoredVar(activity, "ranking_" + mode2);
    if (rankRecord.equals("") == false) {
        String[] records = rankRecord.split(",");
        boolean inserted = false;
        for (int i = 0; i < records.length; i += 2) {
            if (inserted == false && (Long.valueOf(records[i]) / 1000) > (newRecord / 1000)) {
                long[] l = { newRecord, currentTime, 1 };
                rankList.add(l);/*  w ww .j  a  v  a2s. com*/
                long[] l2 = { Long.valueOf(records[i]), Long.valueOf(records[i + 1]), 0 };
                rankList.add(l2);
                inserted = true;
            } else {
                long[] l = { Long.valueOf(records[i]), Long.valueOf(records[i + 1]), 0 };
                rankList.add(l);
            }
            if (rankList.size() == 5) {
                break;
            }
        }
        if (inserted == false && rankList.size() < 5) {
            long[] l = { newRecord, currentTime, 1 };
            rankList.add(l);
        }
    } else {
        long[] l = { newRecord, currentTime, 1 };
        rankList.add(l);
    }

    String newRank = "";
    for (int i = 0; i < rankList.size(); i++) {
        if (newRank.equals("") == false) {
            newRank += ",";
        }
        newRank += (new Long(rankList.get(i)[0])).toString() + "," + (new Long(rankList.get(i)[1])).toString();
    }
    if (newRank.equals("") == false) {
        setStoredVar(activity, "ranking_" + mode2, newRank);
    }

    return rankList;
}

From source file:br.ufac.sion.inscricao.converter.OrgaoExpedidorConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    OrgaoExpedidor retorno = null;/*from  w w  w  .  j ava 2  s .  c  o  m*/
    if (StringUtils.isNotBlank(value)) {
        retorno = this.orgaoExpedidorFacade.findById(new Long(value));

        if (retorno == null) {
            String descricaoErro = "A Orgo Expedidor no existe.";
            FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, descricaoErro, descricaoErro);
            throw new ConverterException(message);
        }
    }
    return retorno;
}

From source file:fr.syncarnet.tasks.DeletedTasks.java

public boolean add(UUID uuid) {
    timestamps.put(uuid, new Long(new Date().getTime()));
    return super.add(uuid);
}

From source file:com.expressflow.test.controller.DirectInvokeCommandTestController.java

@SuppressWarnings("unchecked")
@ModelAttribute("directinvoke")
@RequestMapping(value = "/", method = RequestMethod.GET)
public DirectInvoke directInvokeTestCase() throws Exception {
    log.info("GET /test/directinvoke/ Test start");

    // Define model
    DirectInvoke activity = new DirectInvoke();
    activity.set_header("HTTP 1.1");
    activity.set_method("GET");
    activity.set_outputvariable(new Long("123"));
    activity.set_requestBody("Test Body");
    activity.set_responseCode("404");
    activity.set_responseHeader("HTTP 1.1");
    activity.set_timeout(0);/*from w  w  w  .jav a 2s.c o m*/
    Variable endpoint = new Variable();
    endpoint.setName("endpoint");
    endpoint.setValue("http://expressflow.com");
    activity.setEndpoint(endpoint);

    // Define Command
    DirectInvokeCommand directInvokeCmd = new DirectInvokeCommand();
    directInvokeCmd.execute(activity);

    return activity;
}

From source file:org.openmeetings.test.calendar.TestDatabaseStructureGetUserStart.java

@Test
public void testAddingGroup() {
    try {/*from w  w  w .ja v  a2 s.com*/
        usersDao.getUser(new Long(1));
    } catch (Exception err) {
        log.error("[testAddingGroup]", err);
    }
}

From source file:com.fabionoth.rest.RobotRest.java

/**
 *
 * @param command/*from  w w  w  .j  av  a 2 s. com*/
 * @return
 */
@RequestMapping(value = { "rest/mars/", "/rest/mars/{command}" }, method = { RequestMethod.GET,
        RequestMethod.POST })
public ResponseEntity<String> sendCommand(@PathVariable Optional<String> command) {
    Robot robot;
    robot = new Robot(new Long(1), 0, 0, CardinalPoints.N);

    HttpHeaders responseHeaders = new HttpHeaders();
    responseHeaders.setContentType(MediaType.TEXT_HTML);

    if (command.isPresent()) {
        try {
            robot = new RobotController(robot, command.get()).getRobot();
        } catch (Exception ex) {
            Logger.getLogger(RobotRest.class.getName()).log(Level.SEVERE, null, ex);
            return new ResponseEntity<>("Erro", responseHeaders, HttpStatus.BAD_REQUEST);
        }
    }

    String response = "(" + robot.getX() + ", " + robot.getY() + ", " + robot.getC().toString() + ")";
    return new ResponseEntity<>(response, responseHeaders, HttpStatus.OK);

}

From source file:jp.primecloud.auto.api.ApiValidate.java

public static void validateComponentNo(String componentNo) {
    ValidateUtil.required(componentNo, "EAPI-000001", new Object[] { PARAM_NAME_COMPONENT_NO });
    ValidateUtil.longInRange(componentNo, new Long(1), Long.MAX_VALUE, "EAPI-000002",
            new Object[] { PARAM_NAME_COMPONENT_NO, new Long(1), Long.MAX_VALUE });
}

From source file:it.jugpadova.controllers.JuggerController.java

@RequestMapping
public ModelAndView confirmUpdateJugger(HttpServletRequest req, HttpServletResponse res) {
    Long id = new Long(req.getParameter("id"));
    Jugger jugger = juggerBo.retrieveJugger(id);
    ModelAndView mv = new ModelAndView("jugger/confirmUpdateJugger");
    mv.addObject("jugger", jugger);
    return mv;//from w  w w .j a va  2 s .com
}

From source file:com.apress.prospringintegration.serviceactivator.TicketReceiver.java

@ServiceActivator
public void handleTicket(Ticket ticket) {
    System.out.println("Received ticket - " + ticket.toString());
    counterChannel.send(MessageBuilder.withPayload(new Long(counter++)).build());
}

From source file:gumga.framework.presentation.push.GumgaNotificationsServlet.java

@RequestMapping("/notifications/viewed")
protected void viewd(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    Long l = new Long(request.getParameter("id"));
    GumgaMessage gm = new GumgaMessage(l);
    messageService.delete(gm);/*from  ww w  .j a  v  a 2 s  . c  o  m*/

}