List of usage examples for java.lang Long equals
public boolean equals(Object obj)
From source file:it.jackbergus.graphdatabase.matrices.MatrixOp.java
/** * Matrix divide/*from w w w .j av a 2s .com*/ * @param left * @param right * @return */ public static IMatrix div(IMatrix left, IMatrix right) { IMatrix g = new GuavaMatrix(); left.getValueRange().stream().forEach((l) -> { right.getValueRange().stream().forEach((r) -> { Long li = l.getFirst(); Long ri = l.getSecond(); if (li.equals(ri)) { double lv = (Double) left.get(l); double rv = (Double) right.get(r); //System.out.println(lv+" "+rv+" "+lv*rv); g.incr(li, ri, lv / rv); } }); }); return g; }
From source file:org.sloth.util.ControllerUtils.java
/** * Checks whether the {@code User} who has authorized {@code s} has the * specified {@code id}.//from w w w .j ava 2 s. c o m * * @param s * the {@code HttpSession} * @param id * the {@code id} * @return {@code true} if it is the same {@code id} and otherwise {@code * false} */ public static boolean isSameId(HttpSession s, Long id) { User u = getUser(s); if (u != null) { return id.equals(u.getId()); } else { return false; } }
From source file:iddb.core.util.Functions.java
public static final String decimalToIp(Long number) { if (number == null || number.equals(0l)) return ""; StringBuilder s = new StringBuilder(); s.append(number / 256 / 65536);/*from w w w . ja v a2 s. c o m*/ s.append("."); s.append((number / 65536) % 256); s.append("."); s.append((number / 256) % 256); s.append("."); s.append(number % 256); return s.toString(); }
From source file:nl.b3p.viewer.stripes.ComponentActionBean.java
private static synchronized String getMinifiedSource(File f) throws IOException { String key = f.getCanonicalPath(); Object[] cache = minifiedSourceCache.get(key); if (cache != null) { // check last modified time Long lastModified = (Long) cache[0]; if (!lastModified.equals(f.lastModified())) { minifiedSourceCache.remove(key); cache = null;/*from w ww.j ava2 s .co m*/ } } if (cache != null) { return (String) cache[1]; } String minified = null; try { Compiler compiler = new Compiler(); CompilerOptions options = new CompilerOptions(); CompilationLevel.SIMPLE_OPTIMIZATIONS.setOptionsForCompilationLevel(options); options.setOutputCharset("UTF-8"); compiler.compile(JSSourceFile.fromCode("dummy.js", ""), JSSourceFile.fromFile(f), options); if (compiler.hasErrors()) { log.warn(compiler.getErrorCount() + " error(s) minifying source file " + f.getCanonicalPath() + "; using original source"); minified = IOUtils.toString(new FileInputStream(f)); for (int i = 0; i < compiler.getErrorCount(); i++) { JSError error = compiler.getErrors()[i]; log.warn(String.format("#%d line %d,%d: %s: %s", i + 1, error.lineNumber, error.getCharno(), error.level.toString(), error.description)); } } else { minified = compiler.toSource(); } } catch (Exception e) { log.warn(String.format("Error minifying file \"%s\" using closure compiler, sending original source\n", f.getCanonicalPath()), e); } Object[] entry = new Object[] { f.lastModified(), minified }; minifiedSourceCache.put(key, entry); return minified; }
From source file:it.jackbergus.graphdatabase.matrices.MatrixOp.java
/** * Matrix product// w w w. j a va 2s .c o m * @param left * @param right * @return */ public static IMatrix prod(IMatrix left, IMatrix right) { IMatrix g = new GuavaMatrix(); left.getValueRange().stream().forEach((l) -> { Long li = l.getSecond(); right.getValueRange().stream().forEach((r) -> { Long ri = r.getFirst(); if (li.equals(ri)) { double lv = (Double) left.get(l); double rv = (Double) right.get(r); //System.out.println(lv+" "+rv+" "+lv*rv); g.incr(l.getFirst(), r.getSecond(), lv * rv); } }); }); return g; }
From source file:jp.co.opentone.bsol.linkbinder.util.ValueFormatter.java
/** * ???????????.//from w w w . jav a 2 s . c o m * @param correspoUser * @param id ?ID * @return */ public static String formatUserNameAndEmpNoAndGroup(CorresponGroupUser correspoUser, Long id) { String str = convertNullValue(correspoUser.getUser().getNameE()) + DELIM_USER + convertNullValue(correspoUser.getUser().getEmpNo()); if (DELIM_USER.equals(str)) { return ""; } if (!id.equals(JOIN_NO_GROUP)) { str = str + BRACKETS_LEFT + convertNullValue(correspoUser.getCorresponGroup().getName()) + BRACKETS_RIGHT; } return str; }
From source file:org.unidle.test.Conditions.java
public static Condition<Object> hasExpireTime(final Long expireTime) { return new Condition<Object>(format("has expire time: %s", expireTime)) { @Override//w w w .java2 s. co m public boolean matches(final Object value) { return expireTime.equals(getField(value, "expireTime")); } }; }
From source file:jp.co.opentone.bsol.linkbinder.util.ValueFormatter.java
/** * ????????????.//from ww w . j av a2 s.co m * @param correspoUser * @param id ?ID * @return */ public static String formatUserNameAndEmpNoAndRoleAndGroup(CorresponGroupUser correspoUser, Long id) { String str = convertNullValue(correspoUser.getUser().getNameE()) + DELIM_USER + convertNullValue(correspoUser.getUser().getEmpNo()); if (DELIM_USER.equals(str)) { return ""; } if (!StringUtils.isEmpty(correspoUser.getUser().getRole())) { str += String.format(FORMAT_ROLE, correspoUser.getUser().getRole()); } if (!id.equals(JOIN_NO_GROUP)) { str = str + BRACKETS_LEFT + convertNullValue(correspoUser.getCorresponGroup().getName()) + BRACKETS_RIGHT; } return str; }
From source file:net.kamhon.ieagle.util.VoUtil.java
public static void checkVoBaseVersion(Long voVersion, Long persistVoVersion, String message) { if (voVersion == null) { throw new DevelopmentException("Version dont store in JSP hidden field"); }//from ww w. j a v a 2 s .c om if (persistVoVersion == null) { throw new DevelopmentException("Version dont has in Database"); } if (!voVersion.equals(persistVoVersion)) { if (StringUtils.isNotBlank(message)) { throw new ValidatorException(message); } else { throw new ValidatorException("Data has been modified by other user"); } } }
From source file:controllers.IssueApp.java
private static Result issuesAsJson(Project project, Page<Issue> issues) { ObjectNode listData = Json.newObject(); String exceptIdStr = request().getQueryString("exceptId"); Long exceptId = -1L;/*from w w w. j av a 2 s .c o m*/ if (!StringUtils.isEmpty(exceptIdStr)) { try { exceptId = Long.parseLong(exceptIdStr); } catch (Exception e) { return badRequest(listData); } } List<Issue> issueList = issues.getList(); for (Issue issue : issueList) { Long issueId = issue.getNumber(); if (issueId.equals(exceptId)) { continue; } ObjectNode result = Json.newObject(); result.put("id", issueId); result.put("title", issue.title); result.put("state", issue.state.toString()); result.put("createdDate", issue.createdDate.toString()); result.put("link", routes.IssueApp.issue(project.owner, project.name, issueId).toString()); listData.put(issue.id.toString(), result); } return ok(listData); }