Example usage for java.lang String contentEquals

List of usage examples for java.lang String contentEquals

Introduction

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

Prototype

public boolean contentEquals(CharSequence cs) 

Source Link

Document

Compares this string to the specified CharSequence .

Usage

From source file:org.jboss.forge.navigation.bookmark.api.GlobalBookmarkCacheTest.java

@Test
public void addAndOverwriteTest() throws Exception {
    String marktest = "forge" + RandomStringUtils.randomAlphanumeric(8);
    DirectoryResource currentDirectory = shell.getCurrentDirectory();
    globalBookmarkCache.addBookmark(marktest, currentDirectory.getFullyQualifiedName());
    String path1 = globalBookmarkCache.getBookmark(marktest);

    shell.execute("cd ..");

    currentDirectory = shell.getCurrentDirectory();

    globalBookmarkCache.overrideBookmark(marktest, currentDirectory.getFullyQualifiedName());

    String path2 = globalBookmarkCache.getBookmark(marktest);

    assert !path1.contentEquals(path2);

    globalBookmarkCache.delBookmark(marktest);
}

From source file:aajavafx.EmployeeController.java

@FXML
private void handleRegisterButton(ActionEvent event) throws Exception {
    labelError.setText(null);/* ww  w .  ja v a 2  s. c  om*/

    String lastName = textLastName.getText();
    textLastName.clear();
    String firstName = textFirstName.getText();
    textFirstName.clear();
    String userName = textUserName.getText();
    textUserName.clear();
    String email = textEmail.getText();
    textEmail.clear();
    String phone = textPhone.getText();
    textPhone.clear();
    String password = textPassword.getText();
    textPassword.clear();
    Boolean register = false;
    String tempValidation = textActivate.getText();
    textActivate.clear();
    if (tempValidation.contentEquals("Y")) {
        register = true;
    } else {
        register = false;
    }
    Employees employee = new Employees(1, firstName, lastName, userName, password, email, phone, manager,
            register);

    this.validate(employee);
    try {
        tableEmployees.setItems(getEmployee());
    } catch (IOException ex) {
        Logger.getLogger(EmployeeController.class.getName()).log(Level.SEVERE, null, ex);
    } catch (JSONException ex) {
        Logger.getLogger(EmployeeController.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.creationgroundmedia.popularmovies.MovieListActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_movie_list);
    mContext = this;

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);/*from ww  w .  jav a2 s.c o m*/
    toolbar.setTitle(getTitle());

    if (savedInstanceState == null) {
        Log.d(LOG_TAG, "about to call updateProviderFromInternet");
        updateProviderFromInternet(this);
    } else {
        mSelectFavorites = savedInstanceState.getString(SELECT_FAVORITES);
        mFavoritesOnly = savedInstanceState.getBoolean(FAVORITES_ONLY);
        mSelectedPosition = savedInstanceState.getInt(SELECTED_POSITION);
    }

    movieCursorLoader = getSupportLoaderManager().initLoader(URL_LOADER, null, this);

    recyclerView = (RecyclerView) findViewById(R.id.movie_list);
    assert recyclerView != null;
    setupRecyclerView(recyclerView);

    /**
     * listener on number of movies to load:
     */
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);

    mPrefListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
        public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
            if (key.contentEquals(mContext.getString(R.string.movie_list_size_name))) {
                Log.d(LOG_TAG, "about to call updateProviderFromInternet due to preference change");
                updateProviderFromInternet(mContext);
                recyclerView.getAdapter().notifyDataSetChanged();
            }
        }
    };
    prefs.registerOnSharedPreferenceChangeListener(mPrefListener);

    if (findViewById(R.id.movie_detail_container) != null) {
        // The detail container view will be present only in the
        // large-screen layouts (res/values-w900dp).
        // If this view is present, then the
        // activity should be in two-pane mode.
        mTwoPane = true;
    }

    /**
     * if we're in dual pane mode we need the share fab to show from the list activity
     * otherwise we need to hide it and let the detail activity take care of it
     */
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    if (mTwoPane) {
        if (fab != null) {
            fab.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Snackbar.make(v, "Please select a movie first", Snackbar.LENGTH_LONG)
                            .setAction("Action", null).show();
                }
            });
        }
    } else {
        fab.setVisibility(View.GONE);
    }

    MovieSyncAdapter.initializeSyncAdapter(this);
}

From source file:com.nuvolect.securesuite.data.SqlSyncTest.java

public boolean payloadValid(String encodedPayload, String md5_payload) throws UnsupportedEncodingException {

    boolean md5_payload_test = false;
    byte[] decoded = Base64.decodeBase64(encodedPayload.getBytes("utf-8"));
    String payload = new String(decoded);
    String md5_payload_i = com.squareup.okhttp.internal.Util.md5Hex(payload);

    if (md5_payload_i.contentEquals(md5_payload))
        md5_payload_test = true;/*from   w  w w  .  ja  v  a  2  s.co m*/

    LogUtil.log(LogUtil.LogType.SQL_SYNC_TEST, "payload md5_test: " + md5_payload_test);

    return md5_payload_test;
}

From source file:org.jboss.forge.navigation.GoTest.java

@Test
public void globalGoNotFoundTest() throws Exception {
    String marktest = "forge" + RandomStringUtils.randomAlphanumeric(8);
    String path = shell.getCurrentDirectory().getFullyQualifiedName();
    globalBookmarkCache.addBookmark(marktest,
            "/" + RandomStringUtils.randomAlphanumeric(8) + "/" + RandomStringUtils.randomAlphanumeric(8));

    shell.execute("cd ..");

    String path2 = shell.getCurrentDirectory().getFullyQualifiedName();

    assert !path.contentEquals(path2);

    try {// ww  w . jav  a2  s .c o  m
        shell.execute("go " + marktest);
        fail();
    } catch (Exception e) {
    }

    String path3 = shell.getCurrentDirectory().getFullyQualifiedName();

    assert path2.contains(path3);

}

From source file:com.coinblesk.client.backup.BackupDialogFragment.java

private boolean passwordsMatch() {
    final String pwd = txtPassword.getText().toString();
    final String pwdAgain = txtPasswordAgain.getText().toString();
    boolean pwdMatch = !pwd.isEmpty() && !pwdAgain.isEmpty() && pwd.contentEquals(pwdAgain);
    return pwdMatch;
}

From source file:cc.arduino.packages.discoverers.NetworkDiscovery.java

@Override
public void serviceResolved(ServiceEvent serviceEvent) {
    int sleptFor = 0;
    while (BaseNoGui.packages == null && sleptFor <= MAX_TIME_AWAITING_FOR_PACKAGES) {
        try {//from w  w w.  j av a  2 s  . c o  m
            Thread.sleep(1000);
            sleptFor += 1000;
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    ServiceInfo info = serviceEvent.getInfo();
    for (InetAddress inetAddress : info.getInet4Addresses()) {
        String address = inetAddress.getHostAddress();
        String name = serviceEvent.getName();

        BoardPort port = new BoardPort();

        String board = null;
        String description = null;
        if (info.hasData()) {
            board = info.getPropertyString("board");
            description = info.getPropertyString("description");
            port.getPrefs().put("board", board);
            port.getPrefs().put("distro_version", info.getPropertyString("distro_version"));
            port.getPrefs().put("port", "" + info.getPort());

            //Add additional fields to permit generic ota updates
            //and make sure we do not intefere with Arduino boards
            // define "ssh_upload=no" TXT property to use generic uploader
            // define "tcp_check=no" TXT property if you are not using TCP
            // define "auth_upload=yes" TXT property if you want to use authenticated generic upload
            String useSSH = info.getPropertyString("ssh_upload");
            String checkTCP = info.getPropertyString("tcp_check");
            String useAuth = info.getPropertyString("auth_upload");
            if (useSSH == null || !useSSH.contentEquals("no"))
                useSSH = "yes";
            if (checkTCP == null || !checkTCP.contentEquals("no"))
                checkTCP = "yes";
            if (useAuth == null || !useAuth.contentEquals("yes"))
                useAuth = "no";
            port.getPrefs().put("ssh_upload", useSSH);
            port.getPrefs().put("tcp_check", checkTCP);
            port.getPrefs().put("auth_upload", useAuth);
        }

        String label = name + " at " + address;
        if (board != null && BaseNoGui.packages != null) {
            String boardName = BaseNoGui.getPlatform().resolveDeviceByBoardID(BaseNoGui.packages, board);
            if (boardName != null) {
                label += " (" + boardName + ")";
            }
        } else if (description != null) {
            label += " (" + description + ")";
        }

        port.setAddress(address);
        port.setBoardName(name);
        port.setProtocol("network");
        port.setLabel(label);

        synchronized (boardPortsDiscoveredWithJmDNS) {
            removeDuplicateBoards(port);
            boardPortsDiscoveredWithJmDNS.add(port);
        }
    }
}

From source file:net.devbase.jfreesteel.EidInfo.java

/**
 * Get place of residence as multiline string. Format parameters can be used to provide better
 * output or null/empty strings can be passed for no special formating.
 *
 * For example if floorLabelFormat is "%s. sprat" returned string will contain "5. sprat" for
 * floor number 5.//from   w ww  .ja va 2 s .  c o m
 *
 * Recommended values for Serbian are "ulaz %s", "%s. sprat" and "br. %s"
 *
 * @param entranceLabelFormat String to format entrance label or null
 * @param floorLabelFormat String to format floor label or null
 * @param appartmentLabelFormat String to format apartment label or null
 * @return Nicely formatted place of residence as multiline string
 *
 * FIXME: Use one parameterized format string to allow both "Main street 11" and 
 * "11 Main street"
 * 
 * FIXME: Think about how to handle short form format with missing ENTRANCE/FLOOR 
 * label (line 298).
 */
public String getPlaceFull(String entranceLabelFormat, String floorLabelFormat, String appartmentLabelFormat) {

    StringBuilder out = new StringBuilder();

    entranceLabelFormat = sanitizeFormat(entranceLabelFormat);
    floorLabelFormat = sanitizeFormat(floorLabelFormat);
    appartmentLabelFormat = sanitizeFormat(appartmentLabelFormat);

    // Main street, Main street 11, Main street 11A
    appendTo(out, Tag.STREET);
    appendTo(out, " ", Tag.HOUSE_NUMBER);
    appendTo(out, Tag.HOUSE_LETTER);

    // For entranceLabel = "ulaz %s" gives "Main street 11A ulaz 2"
    appendTo(out, " ", entranceLabelFormat, Tag.ENTRANCE);

    // For floorLabel = "%s. sprat" gives "Main street 11 ulaz 2, 5. sprat"
    appendTo(out, ", ", floorLabelFormat, Tag.FLOOR);

    if (has(Tag.APPARTMENT_NUMBER)) {
        // For appartmentLabel "br. %s" gives "Main street 11 ulaz 2, 5. sprat, br. 4"
        if (has(Tag.ENTRANCE) || has(Tag.FLOOR)) {
            appendTo(out, ", ", appartmentLabelFormat, Tag.APPARTMENT_NUMBER);
        } else {
            // short form: Main street 11A/4
            appendTo(out, "/", Tag.APPARTMENT_NUMBER);
        }
    }

    appendTo(out, "\n", Tag.PLACE);
    appendTo(out, ", ", Tag.COMMUNITY);

    String rawState = get(Tag.STATE);

    out.append("\n");

    if (rawState.contentEquals("SRB")) {
        // small cheat for a better output
        out.append("REPUBLIKA SRBIJA");
    } else {
        out.append(rawState);
    }

    return out.toString();
}

From source file:cx.ring.fragments.MediaPreferenceFragment.java

private void addPreferenceListener(String key, Preference.OnPreferenceChangeListener listener) {
    Preference pref = findPreference(key);
    if (pref != null) {
        pref.setOnPreferenceChangeListener(listener);
        if (key.contentEquals(AccountDetailAdvanced.CONFIG_RINGTONE_PATH))
            pref.setOnPreferenceClickListener(filePickerListener);
    }/*ww w. j  a  va 2 s.c o  m*/
}

From source file:com.smash.revolance.ui.model.sitemap.SiteMap.java

private boolean isAlreadyDefined(Edge edge, List<Edge> edges) {
    String label = edge.attr("label");
    for (Edge iterator : edges) {
        String dstLabel = iterator.attr("label");
        boolean dstMatch = dstLabel.contentEquals(label);
        if (dstMatch) {
            return true;
        }/*from w w  w. jav a  2 s.  c  om*/
    }
    return false;
}