Contents of Strategy Pattern: 概念;组成;应用场景;意义;实现;编写步骤;优缺点;简单实现。概念: The Strategy Pattern defines a family of algorithms, encapsulates each one, and mak.....
分类:
其他好文 时间:
2014-09-20 15:13:27
阅读次数:
187
一、引言 在上一篇博文中分享了责任链模式,责任链模式主要应用在系统中的某些功能需要多个对象参与才能完成的场景。在这篇博文中,我将为大家分享我对访问者模式的理解。二、访问者模式介绍2.1 访问者模式的定义 访问者模式是封装一些施加于某种数据结构之上的操作。一旦这些操作需要修改的话,接受这个操作的数.....
分类:
其他好文 时间:
2014-09-20 15:07:29
阅读次数:
259
import java.io.*;import java.util.ArrayList;import java.util.HashSet;import java.util.regex.Pattern; import java.util.regex.Matcher; public class Re.....
分类:
其他好文 时间:
2014-09-19 22:29:26
阅读次数:
325
//DataViewer.cs using System; namespace TemplateMethodSample { abstract class DataViewer { //抽象方法:获取数据 public abstrac...
分类:
其他好文 时间:
2014-09-19 19:13:35
阅读次数:
211
参考资料:[1]Lazebnik S, Schmid C, Ponce J. Beyond bags of features: Spatial pyramid matching for recognizing natural scene categories[C]//Computer Vision ...
分类:
其他好文 时间:
2014-09-18 23:44:04
阅读次数:
304
外观模式是一种使用频率非常高的设计模式,它通过引入一个外观角色来简化客户端与子系统之间的交互,为复杂的子系统调用提供一个统一的入口,使子系统与客户端的耦合度降低,且客户端调用非常方便。外观模式并不给系统增加任何新功能,它仅仅是简化调用接口。在几乎所有的软件中都能够找到外观模式的应用,如绝大多数...
分类:
其他好文 时间:
2014-09-18 21:57:34
阅读次数:
234
对象适配器9.7 适配器模式总结 适配器模式将现有接口转化为客户类所期望的接口,实现了对现有类的复用,它是一种使用频率非常高的设计模式,在软件开发中得以广泛应用,在Spring等开源框架、驱动程序设计(如JDBC中的数据库驱动程序)中也使用了适配器模式。 1.主要优点 无论是对象适配器模式还是类适配...
分类:
其他好文 时间:
2014-09-18 21:57:24
阅读次数:
164
<scripttype="text/javascript">varurl=window.location.search;//定义变量window.location.hreffunctionparse_url(_url){//定义函数varpattern=/(\w+)=(\w+)/ig;//定义正则表达式varparames={};//定义数组url.replace(pattern,function(a,b,c){parames[b]=c;});/*这是最..
分类:
Web程序 时间:
2014-09-18 19:09:25
阅读次数:
212
HTML:JS: 1 window.onload=function(e){ 2 var text=document.getElementById("only"),pattern=/\d/,//pattern匹配字母上的数字键 3 pattern2=/(...
分类:
其他好文 时间:
2014-09-18 18:14:34
阅读次数:
266
Binary String Matching
时间限制:3000 ms | 内存限制:65535 KB
难度:3
描述
Given two strings A and B, whose alphabet consist only ‘0’ and ‘1’. Your task is only to tell how many times does A appear as ...
分类:
其他好文 时间:
2014-09-18 11:34:53
阅读次数:
178