?? portfolio.java
字號:
package trader;
import java.io.Serializable;
import java.util.*;
public class Portfolio implements Serializable{
private Customer cust;
private ArrayList shares;
public Portfolio(Customer cust, ArrayList shares) {
this.cust = cust;
this.shares = shares;
}
public Portfolio(Customer cust) {
this.cust = cust;
this.shares = null;
}
//accessor methods
public Customer getCustomer(){
return cust;
}
public Share[] getShares(){
Share[] s = new Share[shares.size()];
for (int i=0;i<shares.size();i++){
s[i]=(Share)shares.get(i);
}
return s;
}
public String toString() {
return "Portfolio: " + cust.getId() + " " + cust.getName() ;
}
// other methods
// public void addShare(Share s){} -- should not have this
// public void removeShare(Share s){} -- should not have this
// public double getValue() {} -- should not have this
// public String toString() {}
// public boolean equals(Object o) {}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -