黑马程序员:移动用户资费系统

---------------------- android培训java培训、期待与您交流! ------------------------

 

模拟实现简易的移动用户资费统计系统逻辑,具体需求如下: 

1       移动运营商A设置两种类型的用户:普通用户及VIP用户,现该运营商已有5个VIP用户和15个普通用户,共计20个用户。 

2        普通用户资费标准如下(不考虑漫游和长途): 

【基准资费】

  无月租费用。

通话费:0.6元 / 分钟(仅拨打收费,接听免费)

短信费:0.1元 / 条

数据费:5元/ M 

【优惠套餐】

话费套餐 :月功能费 20元,最多可拨打60分钟电话,超出时间按照 0.5元 / 分钟计费。

短信套餐 :月功能费10元,最多可发送200条短信,超出条按照 0.1元 / 条计费。

数据套餐 :月功能费20元,最多可获50M的流量,超出流量按照3元 / M 计费。 

注:用户可以选择多种套餐,各功能(通话、短信、数据)计费时,如已选择对应套餐,则按套餐标准计费;如未选择对应套餐,则按对应的基准资费计费。 

 VIP用户资费标准如下(不考虑漫游和长途): 

【基准资费】

月租费用:按天收取,2元 / 天

通话费:0.4元 / 分钟(仅拨打收费,接听免费)

短信费:0.1元 / 条

数据费:3元/ M 

【优惠套餐】

 套餐1 :月基本费用 100元(无月租费用),提供如下服务:

① 最多可拨打750分钟电话,超出部分按照0.3元 / 分钟计费。

② 最多可发送200条短信,超出条数按照0.1元 / 条计费。

③ 最多可获得100M数据流量,超出流量按照1元 / M计费。 

套餐2 :月基本费用 200元(无月租费用),提供如下服务:

① 最多可拨打2000分钟电话,超出部分按照0.2元 / 分钟计费。

② 最多可发送500条短信,超出条数按照0.1元 / 条计费。

③ 最多可获得300M数据流量,超出流量按照0.5元 / M计费。 

注:用户最多只能选择一种套餐,如未选择任何套餐,则按照基准资费计费。 

各类型用户只能选择提供给本类型用户的套餐。 

新用户入网。 

① 对于新入网的普通用户,入网当月赠送如下服务:免费拨打60分种电话,免费发送200条短信,免费获得50M流量。超出赠送的部分按照普通用户基准资费进行计费。

 ② 对于新入网的VIP用户,入网当月赠送如下服务:免费拨打200分钟电话,免费发送200条短信,免费获得100M数据流量。超出赠送 的部分按照VIP用户基准资费进行计费(注意:需按入网天数计算月租费用)。 

1        每月为用户计算一次账单,用户订制的套餐信息和账单信息采用文件方式进行存储(提示:可使用java中的PropertiesAPI进行文件操作)。 

2        用户可自由订制或退订所属用户类型的套餐,并从下月起生效。 

3       异步随机生成客户操作如下: 

① 拨打电话,每次拨打时长为1至10分钟不等(随机决定,以分钟为单位)。

② 发送短信,每次发送条数为1至10条不等(随机决定)。

③ 上网获取数据,每次获取数据流量可为50K,100K,200K,

    500K,1M(随机决定)。

④ 订制或退订相应套餐。

⑤ 新用户入网(随机决定用户类型)。 

注:随机生成客户操作时间间隔自定,可设置。 

不要求实现GUI,只考虑系统逻辑实现,可通过Log方式展现程序运行结果。


数据分析与统一计算公式:
统一各类用户在各种情况下的费用计算公式:
1月基本费或月租费:月基本费方式为固定值,月租费方式为当月总天数*每天费用或者(当月总天数-入网日+1)*每天费用,只有vip用户才存在此项费用,但是为了统一计算公式,可以认为普通用户也有此项费用,值为0。
2电话收费时长:等于(电话时长-免费时长),计算后的值小于0则记为0,免费时长又分为两类:新入网的免费和套餐中的免费,新入网的免费在用户对象中处理,套餐中的免费封装在套餐策略对象中处理。
3电话、短信、数据套餐月功能费:只有普通用户定了套餐才有此项费用,但是为了统一计算公式,可以认为没定此功能套餐的普通用户和vip用户也有此项费用,值为0。
4月电话费用=电话套餐月功能费+单位计费价格*电话收费时长
5按月电话费用的相同规则计算月短信费用和月数据费用
6月总计费用=月基本费或月租费 + 月电话费用 + 月短信费用 + 月数据费用

采用一种便于程序代码读取的格式:
1要存储的数据项有:功能单价费用、功能套餐免费数量、功能套餐月费用、新入网免费数量、整体月基本费或月租费。
2一些数据还要随以下类型进行区分:用户类型、套餐类型、功能类型。
3在配置文件中通过用点(.)对数据项名称进行分级的方式来区分各个数据项所属的类别和功能,如下所示:
common.normal.phone.price à表示普通用户/非套餐/电话/单价
common.pack1.phone.price à表示普通用户/套餐/电话/单价
common.pack1.phone.free à表示普通用户/套餐/电话/免费数量
common.pack1.phone.rent à表示普通用户/套餐/电话/套餐月功能费用
vip.normal.phone.price à表示VIP用户/非套餐/电话/单价
vip.pack1.phone.price à表示VIP用户/套餐1/电话/单价
vip.pack2.phone.price à表示VIP用户/套餐2/电话/单价
common.new.phone.free à表示普通用户/新开户/电话/免费数量
vip.new.phone.free à表示VIP用户/新开户/电话/免费数量
1对于值为0的数据项,不用在配置文件中存储,这样,当程序代码从配置文件中没有读取到该数据项时,即认为该值为0。
2对于vip用户的整体月基本费或月租费,由于计费单位不一样,采用配置文件方式存储将增加程序的复杂度,所以,决定直接在程序代码中硬编码
ConfigManager类中的方法:
公有:getPrice、getFree、getRent、getNewCustomerFree。
私有:makePrefix、getNumber
makePrefix方法:
private static String getPrefix(int customerType,int packType,int entryType){
String packTitles = {"normal","pack1","pack2“,”new”};
String entryTitles ={"phone","message","data"};
String customerTitle = customerType==0?"common":"vip";
String packTitle = packTitles[packType];
String entryTitle = entryTitles[entryType];
return customerTitle + "." + packTitle + "." + entryTitle;
}
getNumber方法:
private static int getNumber(String key){
String value = config.getProperty(key);
try{
return Integer.parseInt(value);
}catch(Exception e){
return 0;
}
}
代表移动公司的类:
public class MobileCorporation {
private ArrayList<Customer> customers = new ArrayList<Customer>();
public MobileCorporation(){
for(int i=1;i<=15;i++){
customers.add(new CommonCustomer(i+"号普通客户",new Date(108,10,1)));}
for(int i=1;i<=5;i++){
customers.add(new VIPCustomer(i+"号VIP客户",new Date(108,10,1)));}
System.out.println("程序创建了运营商已有的5个VIP用户和15个普通用户,并设置他们的入网日期为2008年10月1日.");
}
//模拟某个月的业务活动
public void simulateBusiness(Date month){
for(Customer customer : customers){
customer.monthBegin();}
System.out.println("--------being simulating " + DateUtil.formatDateToMonth(month) + "--------------");
for(int i=0;i<500/*30*/;i++){
randDoOneThing(month);}
System.out.println(DateUtil.formatDateToMonth(month)+"的计费汇总清单:");
//汇总所有人的账单
for(int i=0;i<customers.size();i++){
customers.get(i).countMonthMoney(month);}
}
l
移动公司类的randDoOneThing方法
private void randDoOneThing(Date month){
Calendar calendar = Calendar.getInstance();
calendar.setTime(month);
calendar.add(Calendar.MONTH, 1);
Date monthOfOrderPack = calendar.getTime();
int rand = new Random().nextInt(30);
switch(rand){
case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:
callPhone();break;
case 9: case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:
sendMessage();break;
case 18:case 19:case 20:case 21:case 22:case 23:case 24:case 25:case 26:
transferData();break;
/*让orderPack、cancelPack、joinNewCustomer的出现概率是其他操作的1/9。*/
case 27:
orderPack(monthOfOrderPack);break;
case 28:
cancelPack(monthOfOrderPack);break;
case 29:
joinNewCustomer(month);break;
}
}
移动公司类的joinNewCustomer方法
private void joinNewCustomer(Date month){
Calendar calendar = Calendar.getInstance();
calendar.setTime(month);
int maxDay = calendar.getMaximum(Calendar.DAY_OF_MONTH);
int randDay = new Random().nextInt(maxDay) + 1;
/*下面的复制过程很重要,不能直接修改date,当然最好是对Calendar直接操作
 * 这里是为了演示要注意clone而保留的。
 */
Date joinTime = (Date)month.clone();
joinTime.setDate(randDay);
int randType = (new Random().nextInt(10))%2;
Customer customer = null;
if(randType == 0){
int commonId = IdGenerator.getInstance().nextCommonId();
customer = new CommonCustomer(commonId+"号普通客户",joinTime);
customers.add(customer);
}else{
int vipId = IdGenerator.getInstance().nextVipId();
customer = new VIPCustomer(vipId+"号VIP客户",joinTime);
customers.add(customer);
}
System.out.println(DateUtil.formatDateToDay(joinTime) + "新注册了" + customer);
}
移动公司类的其他方法:
/** 随机选中一个用户,让其随机拨打的电话时长为1至10分钟不等 */
private void callPhone(){
int rand = new Random().nextInt(customers.size());
Customer customer = customers.get(rand);
int phoneTimes = new Random().nextInt(10) + 1;
customer.callPhone(phoneTimes);
System.out.println(customer + "打了" + phoneTimes + "分钟电话");}
/** 随机选中一个用户,让其随机发送的短信数目为1至10条不等 */
private void sendMessage(){
//参看callPhone,此处代码略…}
/** 随机选中一个用户,让其随机获取的数据流量为50K,100K,200K,500K,1M,下面仅列出重要代码*/
private void transferData(){
int [] dataSize = new int[]{50,100,200,500,1000};
int randSizeKey = new Random().nextInt(5);
customer.transferData(dataSize[randSizeKey]); }
/**随机选中一个用户,为其随机订购一款套餐*/
private void orderPack(Date month){
int rand = new Random().nextInt(customers.size());
customers.get(rand).randomOrderPack(month);}
/** 随机选中一个用户,并将其已经有的套餐取消*/
private void cancelPack(Date month){
int rand = new Random().nextInt(customers.size());
customers.get(rand).randomCancelPack(month);}
新用户生成新Id编号的类:
public class IdGenerator {
private IdGenerator(){}
private static IdGenerator instance = new IdGenerator();
public static IdGenerator getInstance(){
return instance;}
private int lastCommonId = 15;
private int lastVipId = 5;
public synchronized int nextCommonId(){
return ++lastCommonId;}
public synchronized int nextVipId(){
return ++lastVipId;}
}
主运行类
public static void main(String[] args) {
MobileCorporation corp = new MobileCorporation();
//设置要模拟的起始月份
Date month = new Date(109,0,1);
System.out.println("程序开始模拟从2009年1月1日开始,连续15个月的运行情况.");
//总共模拟15个连续的月份
for(int i=0;i<15/*3*/;i++){
corp.simulateBusiness(month);
Calendar calendar = Calendar.getInstance();
calendar.setTime(month);
calendar.add(Calendar.MONTH, 1);
month = calendar.getTime();
}
}
普通用户与VIP用户的抽象父类
public abstract class Customer {
protected String name; private int customerType; private Date joinTime;//用户入网的时间
//下面集合中积累的结果只表示当月的记录,不代表所有历史记录
protected List<ActionRecord> actionRecords = new ArrayList<ActionRecord>();private ArrayList phoneRecords = new ArrayList();
private ArrayList messageRecords = new ArrayList();private ArrayList dataRecords = new ArrayList();
protected PackStrategy packStrategy;
public void monthBegin(){
phoneRecords.clear();messageRecords.clear();dataRecords.clear();actionRecords.clear();
}
public Customer(String name,int customerType,Date joinTime){
this.name = name;this.customerType = customerType;this.joinTime = joinTime;
}
public String toString(){  return name;
}
public void callPhone(int times){
phoneRecords.add(times); actionRecords.add(new ActionRecord("打电话",times + "分钟"));
}
public void sendMessage(int numbers){
messageRecords.add(numbers);  actionRecords.add(new ActionRecord("发短信",numbers + "条"));
}
public  void transferData(int size){
dataRecords.add(size);  actionRecords.add(new ActionRecord("传数据",size + "k"));
}
private int gatherRecords(ArrayList records){
int sum = 0;
for(int i=0;i<records.size();i++){
sum +=  (Integer)(records.get(i));
}
return sum;
}
public abstract void randomCancelPack(Date month);
public abstract void randomOrderPack(Date month);
用户类中计算某月费用的方法
public int countMonthMoney(Date currentMonth){
boolean newcome = !joinTime.before(currentMonth);//joinTime.after(currentMonth);
int totalPhone = gatherRecords(phoneRecords);int totalMessage = gatherRecords(messageRecords);int totalData = gatherRecords(dataRecords);
int freePhone = 0;int freeMessage = 0;int freeData = 0;
if(newcome){
freePhone = ConfigManager.getNewUserFree(customerType,0);  freeMessage = ConfigManager.getNewUserFree(customerType,1);
freeData = ConfigManager.getNewUserFree(customerType,2);
}
int chargePhone = totalPhone>freePhone?totalPhone-freePhone:0;int chargeMessage = totalMessage>freeMessage?totalMessage-freeMessage:0;
int chargeData = totalData>freeData?totalData-freeData:0;
//汇总打印:包括姓名,入网日期,统计月份,通话清单,费用清单,总费用。
System.out.println(name + "," + DateUtil.formatDateToDay(joinTime) + "入网.");
System.out.println(" 操作清单如下-----");
for(int i=0;i<actionRecords.size();i++){ System.out.println("  " + actionRecords.get(i)); }
System.out.println(" 统计清单如下-----");
System.out.println("  通话:" + phoneRecords + "分钟:短信" + messageRecords + "条:数据" + dataRecords + "k");
System.out.println("  通话累计:" + totalPhone + "分钟,减除新开户" + freePhone + "分钟,实际收费" + chargePhone + "分钟");
System.out.println("  短信累计:" + totalMessage + "条,减除新开户" + freeMessage + "条,实际收费" + chargeMessage + "条");
System.out.println("  数据累计:" + totalData + "k,减除新开户" + freeData + "k,实际收费" + chargeData + "k");
ComputeStrategy phoneStrategy = packStrategy.getValidComputeStrategy(currentMonth,0);
ComputeStrategy messageStrategy = packStrategy.getValidMessageComputeStrategy(currentMonth,1);
ComputeStrategy dataStrategy = packStrategy.getValidDataComputeStrategy(currentMonth,2);
int sum = 0; Rent rent = packStrategy.getValidRent(currentMonth); //VIP用户才有月租金或基本费
if(rent != null){
int rentMoney = rent.coputeRent(joinTime,currentMonth);sum +=  rentMoney;
System.out.println("  月租费或基本费:" + rentMoney + "分钱");
}
sum += phoneStrategy.computeMoney(chargePhone)+messageStrategy.computeMoney(chargeMessage)+ dataStrategy.computeMoney(chargeData);
System.out.println("  总计:" + sum + "分钱");
return sum;
}
普通用户类的randomOrderPack方法
public void randomOrderPack(Date month){
int rand = new Random().nextInt(3);
switch(rand){
case 0:
if(packStrategy.getOrderedPack(0)==null || packStrategy.getOrderedPack(0).getPackType() == 0){
packStrategy.orderPack(month,0);
System.out.println(name + "订购了" + "电话套餐" + "(从" + DateUtil.formatDateToMonth(month) + "开始)");
actionRecords.add(new ActionRecord("定电话套餐",""));
} break;
case 1:
if(packStrategy.getOrderedPack(1) == null || packStrategy.getOrderedPack(1).getPackType() == 0){
packStrategy.orderPack(month,1);
System.out.println(name + "订购了" + "短信套餐" + "(从" + DateUtil.formatDateToMonth(month) + "开始)");
actionRecords.add(new ActionRecord("定短信套餐",""));
} break;
case 2:
if(packStrategy.getOrderedPack(2) == null || packStrategy.getOrderedPack(2).getPackType() == 0){
packStrategy.orderPack(month,2);
System.out.println(name + "订购了" + "数据套餐" + "(从" + DateUtil.formatDateToMonth(month) + "开始)");
actionRecords.add(new ActionRecord("定数据套餐",""));
} break;
}
}
普通用户类的randomCancelPack方法
public void randomCancelPack(Date orderedMonth){
int rand = new Random().nextInt(3);
switch(rand){
case 0:
if(packStrategy.getOrderedPack(0) == null || packStrategy.getOrderedPack(0).getPackType() == 0){
System.out.println(name + "试图退订根本就没有订过的电话套餐"); return;
} packStrategy.cancelPack(orderedMonth,0);
System.out.println(name + "退订了" + "电话套餐" + "(从" + DateUtil.formatDateToMonth(orderedMonth) + "开始)");
actionRecords.add(new ActionRecord("退订电话套餐","")); break;
case 1:
if(packStrategy.getOrderedPack(1) ==null || packStrategy.getOrderedPack(1).getPackType() == 0){
System.out.println(name + "试图退订根本就没有订过的短信套餐"); return;
} packStrategy.cancelPack(orderedMonth,1);
System.out.println(name + "退订了" + "短信套餐" + "(从" + DateUtil.formatDateToMonth(orderedMonth) + "开始)");
actionRecords.add(new ActionRecord("退订短信套餐",""));          break;
case 2:
if(packStrategy.getOrderedPack(2)==null || packStrategy.getOrderedPack(2).getPackType() == 0){
System.out.println(name + "试图退订根本就没有订过的数据套餐"); return;
} packStrategy.cancelPack(orderedMonth,2);
System.out.println(name + "退订了" + "数据套餐" + "(从" + DateUtil.formatDateToMonth(orderedMonth) + "开始)");
actionRecords.add(new ActionRecord("退订数据套餐","")); break;
}
}
VIP用户类的randomCancelPack方法
public class VIPCustomer extends Customer {
public VIPCustomer(String name,Date joinTime){
super(name,1,joinTime);
packStrategy = new PackStrategy(1,0,new Rent(200,RentUnit.DAY));
}
public void randomCancelPack(Date month){
if(packStrategy.getOrderedPack(0) ==null || packStrategy.getOrderedPack(0).getPackType() == 0){
System.out.println(name + "试图退订根本就没有订过的套餐");
return;
}
packStrategy.orderRent(orderedMonth,new Rent(200,RentUnit.DAY));
packStrategy.orderPack(orderedMonth,0,0);
packStrategy.orderPack(orderedMonth,0,1);
packStrategy.orderPack(orderedMonth,0,2);
System.out.println(name + "退订了" + "套餐" + "(从" + DateUtil.formatDateToMonth(orderedMonth) + "开始)");
actionRecords.add(new ActionRecord("退定套餐",""));
}
VIP用户类的randomOrderPack方法
public void orderPack1(Date month){
if(packStrategy.getOrderedPack(0)==null || packStrategy.getOrderedPack(0).getPackType() != 1){
packStrategy.orderRent(month,new Rent(10000,RentUnit.MONTH));
packStrategy.orderPack(month,1,0);packStrategy.orderPack(month,1,1);packStrategy.orderPack(month,1,2);
System.out.println(name+ "订购了套餐1" + "(从" + DateUtil.formatDateToMonth(month) + "开始)" );
actionRecords.add(new ActionRecord("订购套餐1",""));
}
}
public void orderPack2(Date month){
if(packStrategy.getOrderedPack(0) ==null || packStrategy.getOrderedPack(0).getPackType() != 2){
packStrategy.orderRent(month,new Rent(20000,RentUnit.MONTH));
packStrategy.orderPack(month,2,0);packStrategy.orderPack(month,2,1);packStrategy.orderPack(month,2,2)
System.out.println(name+ "订购了套餐2" + "(从" + DateUtil.formatDateToMonth(month) + "开始)" );
actionRecords.add(new ActionRecord("订购套餐2",""));
}
}
public void randomOrderPack(Date month){
//如果以前订购过某套餐,现在仍然可以重新订购该套餐
int randType = (new Random().nextInt(10))%2;
if(randType == 0){ orderPack1(month);
}else if(randType == 1){ orderPack2(month);
}
}
计算某项功能费用的策略类
public class ComputeStrategy {
         //此处省略成员变量的定义….
public ComputeStrategy(int customerType, int packType,int entryType) {
this.customerType = customerType;
this.packType = packType;
this.entryType = entryType;
switch(entryType){
case 0:entryName = "电话";break;
case 1:entryName = "短信";break;
case 2:entryName = "数据";break;
}
}
public int computeMoney(int quantity){
int unitPrice = ConfigManager.getUnitPrice(customerType, packType,entryType);
int freeQuantity = ConfigManager.getPackFree(customerType, packType,entryType);
int packCharge = ConfigManager.getPackCharge(customerType, packType,entryType);
int charQuantity = quantity - freeQuantity;
if(chargeQuantity < 0){
chargeQuantity = 0;
}
int money = packCharge + price * chargeQuantity;
System.out.println("  " + entryName + "月功能费为:" + packCharge + "分钱,");
System.out.println("        收费数量:" + quantity + "-" + freeQuantity + "=" + chargeQuantity + ",");
System.out.println("        使用收费:" + chargeQuantity + "*" + price + "=" + price * chargeQuantity +"分钱,");
System.out.println("        小计收费:" + packCharge + "+" + price * chargeQuantity + "分钱");
return money;
}
}
计算VIP用户月租费或月基本费的类
public class Rent {
//此处省略成员变量和构造方法的定义
public int coputeRent(Date startTime,Date currentMonth){
//首先应该想到去找开源的日期运算类
if(unit == RentUnit.DAY){
Calendar start = Calendar.getInstance();
start.setTime(startTime);
Calendar end = Calendar.getInstance();
end.setTime(currentMonth);
//将日期设置为当月的最后一天
end.set(Calendar.DAY_OF_MONTH, 1);
end.add(Calendar.MONTH, 1);
end.add(Calendar.DAY_OF_MONTH, -1);
int days = end.get(Calendar.DAY_OF_MONTH) ;
if(end.get(Calendar.MONTH) == start.get(Calendar.MONTH)){
days -= start.get(Calendar.DAY_OF_MONTH) + 1;
}
return  price*days;
}
else{
return price;
}
}
}
存储用户的各项业务套餐策略的类
public class PackStrategy {
private int customerType;
private Rent rent;
private ComputeStrategy computeStrategy[] = new  ComputeStrategy[3];
private OrderedStrategyHolder<Rent> orderedRent = new OrderedStrategyHolder<Rent>();
private OrderedStrategyHolder<ComputeStrategy>[] orderedStrategyHolder = new OrderedStrategyHolder<ComputeStrategy>[3];
public PackStrategy(int customerType,int packType,Rent rent){
this.customerType = customerType;
this.rent = rent;
for(int i=0;i<3;i++){
computeStrategy[i] = new ComputeStrategy(customerType,packType,i);
orderedStrategyHolder[i] = new OrderedStrategyHolder<ComputeStrategy>();
}
}
public Rent getValidRent(Date month){
Rent holderRent = orderedRent.getValidStrategy(month);
return holderRent==null?rent:holderRent;
}
public void orderRent(Date orderedMonth,Rent rent){
Rent oldRent = orderedRent.order(orderedMonth,rent);
if(oldRent != null){
this.rent = oldRent;
}
}
public void cancelRent(Date orderedMonth){
orderRent(orderedMonth,null);
}
public ComputeStrategy getValidComputeStrategy(Date month,int entryType){
ComputeStrategy orderedStrategy = orderedStrategyHolder[entryType].getValidStrategy(month);
return orderedStrategy==null?computeStrategy[entryType]:orderedStrategy;
}
public void orderPack(Date orderedMonth,int packType,entryType){
ComputeStrategy orderedStrategy = orderedStrategyHolder[entryType].order(
orderedMonth,new ComputeStrategy(customerType,packType,entryType));
if(orderedStrategy != null){
computeStrategy[entryType] = orderedStrategy;
}
}
public void cancelPack(Date orderedMonth,int entryType){
orderPack(orderedMonth, 0,entryType);
}
套餐订购记录类(存储一项业务套餐订购信息)
public class OrderedStrategyHolder<T> {
private Date orderedMonth;
private T strategy;
public T order(Date orderingMonth,T strategy){
T oldStrategy = null;
if((this.orderedMonth!=null) && this.orderedMonth.before(orderingMonth)){
oldStrategy = this.strategy;
}
this.orderedMonth = orderingMonth;
this.strategy = strategy;
return oldStrategy;
}
public T getValidStrategy(Date month){
if(orderedMonth!=null && (!orderedMonth.after(month))){
return strategy;
}
return null;
}
}

-------------------- android培训java培训、期待与您交流! ----------------------

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值