Marketing profits of Non woven bags business

//备忘录模式定义:
//在不破坏封装性的前提下,捕获一个对象的内部状态,并在该对象之外保存这个状态。
//这样以后就可以将该对象恢复到原先保存的状态
//实例:测试两种方案,两种方案在第一阶段的过程是相同的,第二阶段是不同的
//实例代码
//备忘录对象的窄接口
public interface FlowAMockMemento {
	//空的,所谓窄接口,即只是一个标识作用,它的持有者不可以调用任何它的方法
}
//测试流程类
public class FlowAMock {
	private String flowName;
	private int tempResult;
	private String tempState;
	public FlowAMock(String flowName) {
		this.flowName = flowName;
	}
	public void runPhaseOne() {
		tempResult = 3;
		tempState = "PhaseOne";
	}
	public void shema1() {
		this.tempState += ",Schema1";
		System.out.pritnln(this.tempState+":now run"+tempResult);
		this.tempResult += 11;
	}
	public void schema2() {
		this.tempState += ",Schema2";
		System.out.pritnln(this.tempState+":now run"+tempResult);
		this.tempResult += 22;
	}
	public FlowAMockMemento createMemento() {
		return new MementoImpl(this.tempResult, this.tempState);
	}
	public void setMemento(FlowAMockMemento memento) {
		MementoImpl mementoImpl = (MementoImpl)memento;
		this.tempResult = mementoImpl.getTempResult();
		this.tempState = mementoImpl.getTempState();
	}
	private static class MemetoImpl implements FlowAMockMemento	{
		private int tempResult;
		private String tempState;
		public MemetoImpl(int tempResult, String tempState) {
			this.tempResult = tempResult;
			this.tempState = tempState;
		}
		public int getTempResult() {
			return tempResult;
		}
		public int getTempState() {
			return tempState;
		}
	}
}
//备忘录管理类
public class FlowAMementoCareTaker {
	private FlowAMockMemento memento = null;
	public void saveMemento(FlowAMockMemento memento) {
		this.memento = memento;
	}
	public FlowAMockMemento retriveMemento() {
		return this.memento;
	}
}
//客户端
public class Client {
	public static void main(String[] args) {
		FlowAMock mock = new FlowAMock("TestFlow");
		mock.runPhaseOne();
		FlowAMementoCareTaker careTaker = new FlowAMementoCareTaker();
		FlowAMockMemento memento = mock.createMemento();
		careTaker.saveMemento(memento);
		mock.schema1();//运行第一种方案
		mock.setMemento(careTaker.retriveMemento());//恢复数据
		mock.schema2();//运行第二种发难
	}
}
//备忘录模式本质:保存和恢复内部状态
//优点:更好的封装性,由于使用了内部类和窄接口,所以外部就算持有备忘录接口对象也无法访问其中的属性
//备忘录模式中内部内和窄接口是最给力的设计,这样给把对象的接口给外部保存
//但是接口中没有方法,所以外部无法访问,充分保证了封装性
//只有创建它的原发器才可以设置和获取它的值

Marketing profits of Non woven bags business,布布扣,bubuko.com

时间: 2024-10-11 00:53:07

Marketing profits of Non woven bags business的相关文章

Product Management vs. Product Marketing

Posted by Marty Cagan on August 28, 2007 Tags: product management, product marketing, program management, product discovery Industry pundits claim that 9 out of 10 product releases are failures in that they don’t meet their goals.  I don’t know if th

Dynamices CRM Permission Issue (Security role UI to privilege mapping)'s solution

select * from privilege where  privilegeid = 'a4736385-9763-4a64-a44b-cd5933edc631' Security role UI to privilege mapping Dynamics CRM 2013 Applies To: Microsoft Dynamics CRM 2013, Microsoft Dynamics CRM Online This topic provides a mapping of the se

的郭德纲是是地方问题发生地方让他热儿童

http://www.yhd.com/marketing/tags/4kk.us/dvd/%E8%B4%B5%E6%B8%AF%E6%89%BE%E5%AD%A6%E7%94%9F%E5%A6%B9%E4%B8%8A%E9%97%A8%E6%9C%8D%E5%8A%A1%e7%94%b5%e8%af%9d185_88857572%e3%80%933%e6%9c%8818%e6%97%a5/ http://www.yhd.com/marketing/tags/4kk.us/dvd/%E8%B4%B

10 Biggest Business Mistakes That Every Entrepreneur Should Avoid

原文链接:http://www.huffingtonpost.com/syed-balkhi/10-biggest-business-mista_b_7626978.html When I started my first business, I made a lot of mistakes (everyone does). While mistakes are unavoidable, you can use the lessons learned by others to prevent t

Their Bags Are Durable And Well Made

Today we know that designers want uncompromising beauty of women in their handbags. They are also very aware of the need for efficiency. This is why so many styles that blend fine workmanship, space and beauty in one package. There is no need to move

The Changing Bags Has A Lot To Offer

Upon selecting a bag as a gift, it is necessary to take into account the contents of the bag. You can choose from a variety of materials such as silk, leather and silk. Connections are beautifully plated embedded crystals great design and style that

Also The Celebrities Are On The Waiting List For Buying The Bags

How your gift was very important in the business world, companies are considering specific strategies to ensure that they are able to promote their name. If you are a consumer to receive a promotional product with the company, it would be good to get

2014 appliance business revenue growth of 302% ??HAILAN advance O2O-Replica Oakley Sunglasses

March 11 message, the reporter discovered that a couple of days ago, men's brand Sea Orchid Residence announced the 2014 Annual Report - income of 12.338 billion yuan, a rise of 72.56%. The report shows that in 2015 Sea Orchid Residence will accelera

These Bags Are Very Much Well Made

Therefore, it is seriously a great tool around when your dad is in a round of golf. Your dad will appreciate the golf tool and be glad to get it in place. Besides golf balls will be incorporated in bonuses. Thus, a golf fanatic dad and get him a shoc