|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openstreetmap.josm.data.osm.User
public class User
A simple class to keep a list of user names. Instead of storing user names as strings with every OSM primitive, we store a reference to an user object, and make sure that for each username there is only one user object.
| Field Summary | |
|---|---|
private static User |
anonymous
|
private java.util.HashSet<java.lang.String> |
names
the user name |
private long |
uid
the user id |
private static java.util.concurrent.atomic.AtomicLong |
uidCounter
|
private static java.util.HashMap<java.lang.Long,User> |
userMap
the map of known users |
| Constructor Summary | |
|---|---|
private |
User(long uid,
java.lang.String name)
private constructor, only called from get method. |
| Method Summary | |
|---|---|
void |
addName(java.lang.String name)
Adds a user name to the list if it is not there, yet. |
static void |
clearUserMap()
clears the static map of user ids to user objects |
static User |
createLocalUser(java.lang.String name)
Creates a local user with the given name |
static User |
createOsmUser(long uid,
java.lang.String name)
Creates a user known to the OSM server |
boolean |
equals(java.lang.Object obj)
|
static User |
getAnonymous()
|
static User |
getById(long uid)
Returns the user with user id uid or null if this user doesn't exist |
static java.util.List<User> |
getByName(java.lang.String name)
Returns the list of users with name name or the empty list if
no such users exist |
long |
getId()
Replies the user id. |
java.lang.String |
getName()
Replies the user name |
java.util.ArrayList<java.lang.String> |
getNames()
Returns the list of user names |
private static long |
getNextLocalUid()
|
int |
hashCode()
|
boolean |
hasName(java.lang.String name)
Returns true if the name is in the names list |
boolean |
isLocalUser()
|
boolean |
isOsmUser()
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static java.util.concurrent.atomic.AtomicLong uidCounter
private static java.util.HashMap<java.lang.Long,User> userMap
private static final User anonymous
private final java.util.HashSet<java.lang.String> names
private final long uid
| Constructor Detail |
|---|
private User(long uid,
java.lang.String name)
| Method Detail |
|---|
private static long getNextLocalUid()
public static User createLocalUser(java.lang.String name)
name - the name
public static User createOsmUser(long uid,
java.lang.String name)
uid - the user idname - the namepublic static void clearUserMap()
public static User getById(long uid)
uid or null if this user doesn't exist
uid - the user id
public static java.util.List<User> getByName(java.lang.String name)
name or the empty list if
no such users exist
name - the user name
name or the empty list if
no such users existpublic static User getAnonymous()
public java.lang.String getName()
public java.util.ArrayList<java.lang.String> getNames()
public void addName(java.lang.String name)
name - public boolean hasName(java.lang.String name)
name - public long getId()
public boolean isOsmUser()
public boolean isLocalUser()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||