模式动机在很多情况下,一个对象的行为取决于一个或多个动态变化的属性,这样的属性叫做状态,这样的对象叫做有状态的 (stateful)对象,这样的对象状态是从事先定义好的一系列值中取出的。当一个这样的对象与外部事件产生互动时,其内部状态就会改变,从而使得系统的行为也随之发生变化。在UML中可以使用状态...
分类:
其他好文 时间:
2015-01-04 11:58:39
阅读次数:
210
模式动机建立一种对象与对象之间的依赖关系,一个对象发生改变时将自动通知其他对象,其他对象将相应做出反应。在此,发生改变的对象称为观察目标,而被通知的对象称为观察者,一个观察目标可以对应多个观察者,而且这些观察者之间没有相互联系,可以根据需要增加和删除观察者,使得系统更易于扩展,这就是观察者模式的模式...
分类:
其他好文 时间:
2015-01-04 11:12:48
阅读次数:
258
1.grep命令简介 grep命令是Linux系统中非常强大的文本搜索工具,全名Global Regular Expression Print,表示全局正则表达式版本,它的使用权限是所有用户.根据某种模式(Pattern)搜索文本,并将符合模式的文本行显示出来.其中模式:由文本字符和正则表达式的元字...
分类:
其他好文 时间:
2015-01-03 23:40:42
阅读次数:
206
Head First Design Pattern 读书笔记(3) Decorator Pattern 装饰者模式 ========= ##Decorator Pattern 类图 ![装饰者模式类图][2] ##定义 装饰者模式:通过让组件类与装饰者类实现相同的接口,装饰类可以在不修...
分类:
其他好文 时间:
2015-01-03 21:12:09
阅读次数:
292
题目描述:
Finding all occurrences of a pattern in a text is a problem that arises frequently in text-editing programs.
Typically,the text is a document being edited,and the pattern searched f...
分类:
其他好文 时间:
2015-01-03 11:59:34
阅读次数:
157
Head First Design Pattern 读书笔记(2) Observer Pattern 观察者模式 ========= ##Observer Pattern 类图 ![观察者模式类图][1] ##定义 观察者模式:在对象间定义一个一对多的关系,当其中一个的对象发生改变时...
分类:
其他好文 时间:
2015-01-02 22:31:15
阅读次数:
302
Head First Design Pattern 读书笔记(1) Strategy Pattern 策略模式 ========= 这几天为了锻炼看英语文档的能力,开着有道硬着头皮看 《Head First Desgin Pattern》的原版书,顺便做下笔记,把里面提到的每个模...
分类:
其他好文 时间:
2015-01-02 21:10:14
阅读次数:
300
方法1
try {
Integer.parseInt(str);
return true;
} catch (NumberFormatException e) {
return false;
}
方法2
Pattern pattern = Pattern.compile("^[0-9]*$");
Matcher matcher = pattern.matcher(str);
return matcher.matches();...
分类:
编程语言 时间:
2015-01-01 14:51:26
阅读次数:
225
题目1094:String Matching
时间限制:1 秒
内存限制:32 兆
特殊判题:否
提交:1098
解决:587
题目描述:
Finding all occurrences of a pattern in a text is a problem that arises frequently in text-editin...
分类:
其他好文 时间:
2015-01-01 07:54:41
阅读次数:
217