List of usage examples for java.lang CharSequence toString
public String toString();
From source file:edu.cornell.med.icb.learning.tools.svmlight.EvaluationMeasure.java
public void addValue(final CharSequence performanceValueName, final double value) { DoubleList values = name2Values.get(performanceValueName.toString()); if (values == null) { values = new DoubleArrayList(); name2Values.put(performanceValueName.toString().intern(), values); }//from w w w . jav a 2 s. co m if (value != value) { // ignore NaN contributions.. LOG.debug(String.format("Ignoring NaN contribution to measure %s", performanceValueName)); return; } //System.out.printf("Adding %s = %f%n", performanceValueName, value); values.add(value); }
From source file:fr.landel.utils.commons.StringUtils.java
/** * Injects all arguments in the specified char sequence. The arguments are * injected by replacement of keys between braces. To exclude keys, just * double braces (like {{key}} will return {key}). If some keys aren't * found, they are ignored.//from w ww . j a v a 2 s. c o m * * <p> * precondition: {@code charSequence} cannot be {@code null} * </p> * * <pre> * StringUtils.injectKeys(Pair.of("${", "}"), Pair.of("${{", "}}"), "", Collections.singletonMap("key", "test")); * // => "" * * StringUtils.injectKeys(Pair.of("${", "}"), Pair.of("${{", "}}"), "I'll go to the ${where} this {when}", * MapUtils2.newHashMap(Pair.of("where", "beach"), Pair.of("when", "afternoon"))); * // => "I'll go to the beach this afternoon" * * StringUtils.injectKeys(Pair.of("${", "}"), Pair.of("${{", "}}"), "I'll go to ${key}${{key}}${key}", * Collections.singletonMap("key", "beach")); * // => "I'll go to beach${key}beach" * </pre> * * @param include * the characters that surround the property key to replace * @param exclude * the characters that surround the property key to exclude of * replacement * @param charSequence * the input char sequence * @param arguments * the map of pairs to inject * @return the result with replacements */ public static String injectKeys(final Pair<String, String> include, final Pair<String, String> exclude, final CharSequence charSequence, final Map<String, Object> arguments) { if (charSequence == null) { throw new IllegalArgumentException("The input char sequence cannot be null"); } else if (isEmpty(charSequence) || MapUtils.isEmpty(arguments)) { return charSequence.toString(); } return injectKeys(include, exclude, charSequence, arguments.entrySet().toArray(CastUtils.cast(new Map.Entry[arguments.size()]))); }
From source file:edu.cornell.med.icb.geo.tools.FileGeneList.java
private boolean matchesProbesetId(final CharSequence probesetValue, boolean add) { for (final String probeId : probeIDsSet) { // for each probe in the gene list file... if (probeId.length() >= 1 && probesetValue.equals(probeId)) { matchingGeneIds.add(probesetValue.toString()); add = true;//from w w w . ja va2 s.c o m } } return add; }
From source file:com.google.android.testing.nativedriver.server.AndroidNativeDriver.java
@Override public String getTitle() { Activity activity = context.getActivities().current(); if (activity == null) { return ""; }/*w w w .j av a 2 s. c o m*/ CharSequence title = getActivityTitle(activity); return (title != null) ? title.toString() : ""; }
From source file:br.msf.commons.util.CharSequenceUtils.java
public static boolean matches(final CharSequence regex, final CharSequence sequence, final int flags) { return matches(Pattern.compile(regex.toString(), flags), sequence); }
From source file:fr.landel.utils.commons.StringUtils.java
/** * Injects all arguments in the specified char sequence. The arguments are * injected by replacement of keys between braces. To exclude keys, just * double braces (like {{key}} will return {key}). If some keys aren't * found, they are ignored./* w w w.j ava 2 s. co m*/ * * <p> * precondition: {@code charSequence} cannot be {@code null} * </p> * * <pre> * Properties properties = new Properties(); * properties.setProperty("where", "beach"); * properties.setProperty("when", "afternoon"); * * StringUtils.injectKeys(Pair.of("${", "}"), Pair.of("${{", "}}"), "", properties); * // => "" * * StringUtils.injectKeys(Pair.of("${", "}"), Pair.of("${{", "}}"), "I'll go to the ${where} this ${when}", properties); * // => "I'll go to the beach this afternoon" * * StringUtils.injectKeys(Pair.of("${", "}"), Pair.of("${{", "}}"), "I'll go to ${where}${{where}}${where}", properties); * // => "I'll go to beach${where}beach" * </pre> * * @param include * the characters that surround the property key to replace * @param exclude * the characters that surround the property key to exclude of * replacement * @param charSequence * the input char sequence * @param properties * the properties to inject * @return the result with replacements */ public static String injectKeys(final Pair<String, String> include, final Pair<String, String> exclude, final CharSequence charSequence, final Properties properties) { if (charSequence == null) { throw new IllegalArgumentException("The input char sequence cannot be null"); } else if (isEmpty(charSequence) || properties == null || properties.isEmpty()) { return charSequence.toString(); } return injectKeys(include, exclude, charSequence, properties.entrySet().toArray(CastUtils.cast(new Map.Entry[properties.size()]))); }
From source file:eu.andreschepers.authservice.domain.bcrypt.BCryptPasswordEncoder.java
public boolean matches(CharSequence rawPassword, String encodedPassword) { if (encodedPassword == null || encodedPassword.length() == 0) { logger.warn("Empty encoded password"); return false; }//from w w w .j a v a 2s . co m if (!BCRYPT_PATTERN.matcher(encodedPassword).matches()) { logger.warn("Encoded password does not look like BCrypt"); return false; } return BCrypt.checkpw(rawPassword.toString(), encodedPassword); }
From source file:org.matrix.security.crypto.bcrypt.BCryptPasswordEncoder.java
public boolean matches(CharSequence rawPassword, String encodedPassword) { if (encodedPassword == null || encodedPassword.length() == 0) { throw new IllegalArgumentException("Encoded password cannot be null or empty"); }//from www . ja v a 2 s. c om if (!BCRYPT_PATTERN.matcher(encodedPassword).matches()) { throw new IllegalArgumentException("Encoded password does not look like BCrypt"); } return BCrypt.checkpw(rawPassword.toString(), encodedPassword); }
From source file:edu.cornell.med.icb.geo.tools.FileGeneList.java
private boolean matchesPlatform(final CharSequence probesetValue, boolean add) { if (add) {/*from w w w. j a v a 2s.c o m*/ return true; } for (final GEOPlatform platform : platforms) { // check for match on each platform: final String[] genbankIDs = platform.getGenbankList(probesetValue.toString()); // GEO GB_LIST contains RefSeq and Genbank IDs indifferentially. for (final String genbankID : genbankIDs) { if (genbankID.length() >= 1 && (genbankIDsSet.contains(genbankID) || refseqIDsSet.contains(genbankID))) { // we found at least one Genbank ID in the genelist: // keep this probeset matchingGeneIds.add(genbankID); add = true; } } } return add; }
From source file:fi.tuukka.weather.view.FragmentStations.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.inflate(R.layout.asemat, container, false); rg = (RadioGroup) view.findViewById(R.id.radioGroup1); rg.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override//from ww w .j a va 2 s.c om public void onCheckedChanged(RadioGroup rg, int id) { if (listenCheck) { for (int i = 0; i < rg.getChildCount(); i++) { RadioButton btn = (RadioButton) rg.getChildAt(i); if (btn.getId() == id) { String text = (String) btn.getText(); Station station = new Station(text, null); changeStation(station); refreshStations(); return; } } } } }); EditText searchBox = (EditText) view.findViewById(R.id.stationSearchBox); searchBox.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { String string = s.toString(); if (query == null || !query.equals(string)) { query = s.toString(); stationStrings = null; // mark as not finished ((ActivityMain) getActivity()).queryStations(); } } }); Activity activity = getActivity(); header = (TextView) view.findViewById(R.id.stationsHeader); int fontsize = Utils.getScaledFont(activity); int pad = Utils.dpToPx(5, activity); header.setTextAppearance(activity, R.style.TextStyle); header.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontsize); header.setPadding(0, pad, 0, pad); header.setText("Syt kunta/kunnanosa:"); super.onCreateView(inflater, container, savedInstanceState); return view; }