RoomValue.java
资源名称:某公司的java培训教材 [点击查看]
上传用户:dinglihq
上传日期:2013-02-04
资源大小:99958k
文件大小:1k
源码类别:
Java编程
开发平台:
Java
- package com.borland.training.meetings.sessions;
- import java.util.*;
- import com.borland.training.meetings.entities.*;
- public class RoomValue implements java.io.Serializable {
- private String name;
- private int capacity;
- Collection meetings;
- public RoomValue(String name, int capacity, Collection meetings) {
- setName(name);
- setCapacity(capacity);
- setMeetings(meetings);
- }
- public RoomValue(String name, int capacity) {
- this(name, capacity, new Vector());
- }
- private void setName(String name) {this.name = name;}
- public String getName() {return this.name;}
- public void setCapacity(int capacity) {this.capacity = capacity;}
- public int getCapacity() {return this.capacity;}
- public void setMeetings(Collection meetings) {this.meetings = meetings;}
- public Collection getMeetings() {return this.meetings;}
- public String toString() {
- String meetingIds = "";
- Iterator iterator = getMeetings().iterator();
- Long meetingId;
- if(iterator.hasNext()) {
- meetingId = (Long) iterator.next();
- meetingIds = meetingIds + meetingId;
- }
- while(iterator.hasNext()) {
- meetingId = (Long) iterator.next();
- meetingIds = meetingIds + ", " + meetingId;
- }
- return "{" + getName() + ", " + getCapacity() + ", {" + meetingIds + "}}";
- }
- }