@@ -0,0 +1,1452 @@
+package com.xlythe.textmanager.text;%0A%0Aimport com.xlythe.textmanager.User;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0A/**%0A * Represents a phone number.%0A */%0Apublic class TextUser implements User %7B%0A    // Keeps track of users. We don't want to make a new user very often - that wastes memory!%0A    // So we have 1 user for every 1 phone number, and map them together.%0A    private static final Map%3CString, TextUser%3E USERS = new HashMap%3CString, TextUser%3E();%0A%0A    /**%0A     * Get a User for a phone number%0A     * */%0A    public static TextUser getUser(String phoneNumber) %7B%0A        if(!USERS.containsKey(phoneNumber)) %7B%0A            USERS.put(phoneNumber, new TextUser(phoneNumber));%0A        %7D%0A        return USERS.get(phoneNumber);%0A    %7D%0A%0A    private final String phoneNumber;%0A    private String name;%0A%0A    /**%0A     * This method is the constructor. It it called when we call %22new TextUser()%22.%0A     * We make it private because we want to force coders to use %22TextUser.getUser(number)%22.%0A     * */%0A    private TextUser(String phoneNumber) %7B%0A        this.phoneNumber = phoneNumber;%0A    %7D%0A%0A    public String getPhoneNumber() %7B%0A        return phoneNumber;%0A    %7D%0A%0A    public String getName() %7B%0A        return name == null ? phoneNumber : name;%0A    %7D%0A%0A    public void setName(String name) %7B%0A        this.name = name;%0A    %7D%0A%0A    /**%0A     * Returns true if a custom name has been set%0A     * */%0A    public boolean hasName() %7B%0A        return name != null;%0A    %7D%0A%7D%0A

add a user