資源簡介
javaweb在線聊天網(wǎng)站,數(shù)據(jù)庫表:
create table tbUser
(
name varchar(10) not null,
keyword char(20) not null,
primary key(name)
)CHARACTER SET 'utf8'
COLLATE 'utf8_general_ci';
其實還有另外一個表(存儲聊天信息),不過后面寫的時候忘記把聊天信息保存進(jìn)數(shù)據(jù)庫,所以其實可以不用管(程序里沒用到),另一個表信息是:
create table tbConnection
(
id int not null,
orignName varchar(10) not null,
targetName varchar(10) not null,
content varchar(255) not null,
date datetime not null,
primary key(id),
foreign key(orignName) references tbUser(name),
foreign key(targetName) references tbUser(name)
)CHARACTER SET 'utf8'
COLLATE 'utf8_general_ci';
代碼片段和文件信息
package?connection;
import?java.util.ArrayList;
public?class?ConnectionManager?{
public?ArrayList?words;
public?ConnectionManager()
{
words?=?new?ArrayList();
}
public?void?addWord(Word?word)
{
this.words.add(word);
}
public?ArrayList?getWords(String?name)
{
ArrayList?result?=?new?ArrayList();
for(Word?word:this.words)
{
if(word.isIncluded(name))
result.add(word);
}
return?result;
}
}
評論
共有 條評論