List of usage examples for java.lang CharSequence toString
public String toString();
From source file:com.sawyer.advadapters.app.adapters.jsonadapter.UnitTestMovieAdapter.java
protected boolean isFilteredOut(MovieItem movie, CharSequence constraint) { return !movie.title.toLowerCase(Locale.US).contains(constraint.toString().toLowerCase(Locale.US)); }
From source file:com.sentinel.security.PasswordEncoderDecoder.java
@Override public String encode(CharSequence rawPassword) { LOG.trace("Method: encode called."); return encoderdecoder.encrypt(rawPassword.toString().trim()); }
From source file:se.rapid.security.BCryptPasswordEncoder.java
public boolean matches(CharSequence rawPassword, String encodedPassword) { return BCrypt.checkpw(rawPassword.toString(), encodedPassword); }
From source file:com.sawyer.advadapters.app.adapters.jsonadapter.UnitTestMovieAdapter.java
@Override //Default isFilteredOut, required by all subclasses to implement protected boolean isFilteredOut(Object item, CharSequence constraint) { return !item.toString().toLowerCase(Locale.US).contains(constraint.toString().toLowerCase(Locale.US)); }
From source file:net.dontdrinkandroot.utils.lang.StringUtilsTest.java
@Test public void testIterableJoin() { List<String> parts = new ArrayList<String>(); parts.add("a"); parts.add("bee"); parts.add("cee"); Transformer<String, String> transformer = NOPTransformer.getInstance(); CharSequence result = StringUtils.join(parts, ",", transformer); Assert.assertEquals("a,bee,cee", result.toString()); }
From source file:net.dontdrinkandroot.utils.lang.StringUtilsTest.java
@Test public void testArrayJoin() { String[] parts = new String[3]; parts[0] = "a"; parts[1] = "bee"; parts[2] = "cee"; Transformer<String, String> transformer = NOPTransformer.getInstance(); CharSequence result = StringUtils.join(parts, ",", transformer); Assert.assertEquals("a,bee,cee", result.toString()); }
From source file:com.heliosapm.aa4h.parser.JSONQueryParser.java
public void parse(final CharSequence query) throws ParseException { parser.parse(query.toString(), this); }
From source file:com.sawyer.advadapters.app.adapters.jsonadapter.UnitTestMovieAdapter.java
@Override //Predefined isFilteredOut, optionally overridden here to change the built in logic protected boolean isFilteredOut(Long item, CharSequence constraint) { return !String.valueOf(item).toLowerCase(Locale.US).contains(constraint.toString().toLowerCase(Locale.US)); }
From source file:org.yamj.core.database.dao.MediaDao.java
@SuppressWarnings("unchecked") public List<QueueDTO> getMediaQueue(final CharSequence sql, final int maxResults) { SQLQuery query = getSession().createSQLQuery(sql.toString()); query.setReadOnly(true);//w ww.j av a 2 s.c om query.setCacheable(true); if (maxResults > 0) { query.setMaxResults(maxResults); } List<QueueDTO> queueElements = new ArrayList<QueueDTO>(); List<Object[]> objects = query.list(); for (Object[] object : objects) { QueueDTO queueElement = new QueueDTO(); queueElement.setId(convertRowElementToLong(object[0])); queueElement.setDate(convertRowElementToDate(object[2])); if (queueElement.getDate() == null) { queueElement.setDate(convertRowElementToDate(object[1])); } queueElements.add(queueElement); } Collections.sort(queueElements, new QueueDTOComparator()); return queueElements; }
From source file:HSqlManager.java
private static void commonInitialize(int bps, Connection connection) throws SQLException, IOException { String base = new File("").getAbsolutePath(); CSV.makeDirectory(new File(base + "/PhageData")); INSTANCE = ImportPhagelist.getInstance(); INSTANCE.parseAllPhages(bps);/*from w w w . j a v a2 s . com*/ written = true; Connection db = connection; db.setAutoCommit(false); Statement stat = db.createStatement(); stat.execute("SET FILES LOG FALSE\n"); PreparedStatement st = db.prepareStatement("Insert INTO Primerdb.Primers" + "(Bp,Sequence, CommonP, UniqueP, Picked, Strain, Cluster)" + " Values(?,?,true,false,false,?,?)"); ResultSet call = stat.executeQuery("Select * From Primerdb.Phages;"); List<String[]> phages = new ArrayList<>(); while (call.next()) { String[] r = new String[3]; r[0] = call.getString("Strain"); r[1] = call.getString("Cluster"); r[2] = call.getString("Name"); phages.add(r); } phages.parallelStream().map(x -> x[0]).collect(Collectors.toSet()).parallelStream().forEach(x -> { phages.stream().filter(y -> y[0].equals(x)).map(y -> y[1]).collect(Collectors.toSet()).forEach(z -> { try { List<String> clustphages = phages.stream().filter(a -> a[0].equals(x) && a[1].equals(z)) .map(a -> a[2]).collect(Collectors.toList()); Set<String> primers = Collections.synchronizedSet(CSV .readCSV(base + "/PhageData/" + Integer.toString(bps) + clustphages.get(0) + ".csv")); clustphages.remove(0); clustphages.parallelStream().forEach(phage -> { primers.retainAll( CSV.readCSV(base + "/PhageData/" + Integer.toString(bps) + phage + ".csv")); }); int i = 0; for (CharSequence a : primers) { try { //finish update st.setInt(1, bps); st.setString(2, a.toString()); st.setString(3, x); st.setString(4, z); st.addBatch(); } catch (SQLException e) { e.printStackTrace(); System.out.println("Error occurred at " + x + " " + z); } i++; if (i == 1000) { i = 0; st.executeBatch(); db.commit(); } } if (i > 0) { st.executeBatch(); db.commit(); } } catch (SQLException e) { e.printStackTrace(); System.out.println("Error occurred at " + x + " " + z); } }); }); stat.execute("SET FILES LOG TRUE\n"); st.close(); stat.close(); System.out.println("Common Updated"); }