命令模式把发出命令的责任和执行命令的责任分割开,委派给不同的对象。就像我们去餐厅,点菜是找服务员,然后服务员去让厨师做菜而不是我们直接找厨师做菜public interface Commend { public void execute();}public class Remoter ...
分类:
其他好文 时间:
2015-01-15 20:10:53
阅读次数:
105
适配器模式将一个类的接口,转化成客户期望的另一个接口,适配器让原本接口不兼容的类可以合作无间public interface Sheep{ public void run(); public void ho();}public class Wolf{ public void run...
分类:
其他好文 时间:
2015-01-15 20:03:30
阅读次数:
197
单例模式保证每个类只有一个实例,并提供一个全局访问点第一步 构造方法私有化第二步 公有化静态方法获取的实例懒汉式public class Bank{ private Bank(){} private static Bank bank = null; public static Ba...
分类:
其他好文 时间:
2015-01-15 19:50:02
阅读次数:
148
晓的、经过分类编目的、代码设计经验的总结。使用设计模式是为了
可重用代码、让代码更容易被他人理解、保证代 码可靠性 -->
-------------------------------------------------------------
public class WeatherData {
private int low;
privat...
分类:
其他好文 时间:
2015-01-15 18:15:51
阅读次数:
191
简单工厂Simple Factory Pattern/*首先要有一个接口和实现这个接口的很多类*/public interface Apple {}-----public class Apple1 implements Apple{}-----public class Apple2 implemen...
分类:
其他好文 时间:
2015-01-15 17:59:16
阅读次数:
120
-------------------------------------------------------------public class WeatherData { private int low; private int height; private Stri...
分类:
其他好文 时间:
2015-01-15 17:54:29
阅读次数:
161
每个任务最多有16个事件标示,任务可以同时等待几个事件,或选择等待其中的某个或某些事件.事件可由其他任务或中断处理函数触发.void os_evt_set ( U16 event_flags, /* Bit pattern of event flags to set */ OS_TID ta...
分类:
其他好文 时间:
2015-01-15 17:30:53
阅读次数:
135
BashShell有个extglob选项,开启之后Shell可以另外识别出5个模式匹配操作符,能使文件匹配更加方便。开启方法很简单,使用shopt命令:shopt-sextglob
关闭,使用shopt命令:shopt-uextglob开启之后,以下5个模式匹配操作符将被识别:?(pattern-list)-所给模式匹配0次或1次;*(p..
分类:
系统相关 时间:
2015-01-15 16:17:45
阅读次数:
4212
Syntax:
#sed -e 'command' -e 'command' filename
Note: -e option is optional for sed with single command. sed will execute the each set of command while processing input from the pattern buffer.
...
分类:
其他好文 时间:
2015-01-14 15:35:56
阅读次数:
164
“p” command prints the buffer (remember to use -n option with “p”)
“d” command is just opposite, its for deletion. ‘d’ will delete the pattern space buffer and immediately starts the next cycle.
...
分类:
其他好文 时间:
2015-01-14 15:34:14
阅读次数:
157