|
|
|
package org.poopki.duckdns.user_db;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
public class Group {
|
|
|
|
private String m_Name;
|
|
|
|
private List<UUID> m_MemberList = new ArrayList<>();
|
|
|
|
UUID ZERO_UUID = UUID.fromString("00000000-0000-0000-0000-000000000000");
|
|
|
|
int MAX_FARM_NUM = 13;
|
|
|
|
|
|
|
|
public Group(String Name, List<UUID> uuid_list){
|
|
|
|
int index = 0;
|
|
|
|
for(UUID key: uuid_list){
|
|
|
|
m_MemberList.add(index,key);
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
m_Name = Name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void SignUp(UUID uuid){
|
|
|
|
m_MemberList.add((UUID)uuid);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Expulsion(UUID uuid){
|
|
|
|
m_MemberList.remove(uuid);
|
|
|
|
m_MemberList.add(ZERO_UUID);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isMember(UUID uuid){
|
|
|
|
return m_MemberList.contains(uuid);
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<UUID> getGroupMembers(){ return m_MemberList;}
|
|
|
|
|
|
|
|
|
|
|
|
public String getGroupName(){ return m_Name; }
|
|
|
|
public int isEmpty(){return m_MemberList.size();}
|
|
|
|
public boolean isOwner(UUID uuid){
|
|
|
|
if(m_MemberList.get(0).equals(uuid)){
|
|
|
|
return true;
|
|
|
|
}else{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|