1/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.accounts;
18
19/**
20 * Used to store the Account and the UserId this account is associated with.
21 *
22 * @hide
23 */
24public class AccountAndUser {
25    public Account account;
26    public int userId;
27
28    public AccountAndUser(Account account, int userId) {
29        this.account = account;
30        this.userId = userId;
31    }
32
33    public boolean equals(Object o) {
34        if (this == o) return true;
35        if (!(o instanceof AccountAndUser)) return false;
36        final AccountAndUser other = (AccountAndUser) o;
37        return this.account.equals(other.account)
38                && this.userId == other.userId;
39    }
40
41    @Override
42    public int hashCode() {
43        return account.hashCode() + userId;
44    }
45
46    public String toString() {
47        return account.toString() + " u" + userId;
48    }
49}
50