package pro.simpleproject.core.intra;

import java.util.LinkedHashMap;
import java.util.Map;

import pro.simpleproject.core.intra.server.ServerExecutor;

public class IntraModel {

	private static final Map<String, IntraContact> contacts = new LinkedHashMap<>();

	public static IntraContact setContact(IntraContact contact) {
		return contacts.put(contact.getContact(), contact);
	}

	public static IntraContact getContact(String contact) {
		return contacts.get(contact);
	}

	public static boolean hasContact(String contact) {
		return contacts.containsKey(contact);
	}

	public static void removeContact(String contact) {
		contacts.remove(contact);
	}

	public static void close() {
		for (IntraContact c : contacts.values()) {
			c.close();
		}
		ServerExecutor.close();
	}

}

@@ -36,123 +36,8 @@
 a;%0A%0A
-import java.util.LinkedHashMap;%0Aimport java.util.Map;%0A%0Aimport pro.simpleproject.core.intra.server.ServerExecutor;%0A%0A
 publ
@@ -54,13 +54,15 @@
 ntra
-Model
+Contact
  %7B%0A%0A
@@ -74,79 +74,66 @@
 ate 
-static final Map%3CString, IntraContact%3E contacts = new LinkedHashMap%3C%3E()
+String contact;%0A%09private String address;%0A%09private int port
 ;%0A%0A%09
@@ -131,39 +131,32 @@
  port;%0A%0A%09public 
-static 
 IntraContact set
@@ -155,369 +155,267 @@
 tact
- setContact(IntraContact contact) %7B%0A%09%09return contacts.put(contact.getContact(), contact);%0A%09%7D%0A%0A%09public static IntraContact getContact(String contact) %7B%0A%09%09return contacts.get(contact);%0A%09%7D%0A%0A%09public static boolean hasContact(String contact) %7B%0A%09%09return contacts.containsKey(contact);%0A%09%7D%0A%0A%09public static void removeContact(String contact) %7B%0A%09%09contacts.remove(contact)
+(String address, int port) %7B%0A%09%09this.address = address;%0A%09%09this.port = port;%0A%09%09this.contact = address + %22:%22 + port;%0A%09%7D%0A%0A%09public String getContact() %7B%0A%09%09return contact;%0A%09%7D%0A%0A%09public String getAddress() %7B%0A%09%09return address;%0A%09%7D%0A%0A%09public int getPort() %7B%0A%09%09return port
 ;%0A%09%7D
@@ -428,15 +428,8 @@
 lic 
-static 
 void
@@ -445,94 +445,8 @@
 %7B%0A%09%09
-for (IntraContact c : contacts.values()) %7B%0A%09%09%09c.close();%0A%09%09%7D%0A%09%09ServerExecutor.close();
 %0A%09%7D%0A

Update IntraContact.java