`
文章列表
package com.ks.tools; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @author 李英夫 * @ClassName AntiCopy * @Version * @ModifiedBy ...
/** * 判断浏览器类型是否是IE,是则返回true,不是返回false * ServletActionContext是struts2上下文对象 * @author 李英夫(2010-6-20 上午09:36:48) * @return boolean */ public static boolean isIE(){ return ServletActionContext.getRequest().getHeader("USER-AGENT").toLowerCase().indexOf("msie") &g ...
package com.ks.tools; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @author 李英夫 * @ClassName KSValidate * @Version * @ModifiedBy * @Copyright @ 2009 H&L Technology Inc. * @date 2009-12-31 下午02:16:25 * @description 正则验证,只要是包含就返回true */ public class ...
package com.ks.tools; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.font.FontRenderContext; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; import java.io.File; import java.util.ArrayList; import java.util.List; import ...
1. Stop complaining! 别发牢骚! 2. You make me sick! 你真让我恶心! 3. What’s wrong with you? 你怎么回事? 4. You shouldn’t have done that! 你真不应该那样做! 5. You’re a jerk! 你是个废物/混球! 6. Don’t talk to me like that! 别那样和我说话! 7. Who do you think you are? 你以为你是谁? 8. What’s your problem? 你怎么回事啊? 9. I hate you! 我讨厌你! 10 ...
package com.ks.tools; import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; /** * @author 李英夫 * @ClassName PropertiesLoader * @Version * @ModifiedBy * @Copyright @ 2010 H&L Technology Inc. * @date 2010-1-18 上午09:17:13 * @description 资源文件 ...
一、call 方法 调用一个对象的一个方法,以另一个对象替换当前对象(其实就是更改对象的内部指针,即改变对象的this指向的内容)。 call([thisObj[,arg1[, arg2[, [,.argN]]]]]) 参数 thisObj 可选项。将被用作当前对象的对象。 arg1, arg2, , ...
var Mixin = function(){}; Mixin.prototype = { serialize : function(){ var output = []; for(key in this){ output.push(key + ':' + this[key]); } return output.join(","); } } func ...
var book = { name : "Twilight", author : "Unkonw" } function myClone(object){ var f = function(){}; f.prototype = object; return new f; } var b = myClone(book); alert(b.name = "New moon"); alert(book.name)
/** * 使用二分法时,首要条件是数组本身是排序的. */ function binarySearch(arr, value){ var startIndex = 0, endIndex = arr.length - 1, middleIndex = Math.floor((endIndex+startIndex)/2); while(arr[middleIndex]!= value && startIndex < endIndex){ if(value < arr[midd ...
function extend(subClass, superClass){ var F = function(){}; F.prototype = superClass.prototype; subClass.prototype = new F(); subClass.prototype.contructor = subClass; subClass.superclass = superClass.prototype; if(superClass.prototype.constr ...
var Book = (function() { // Private static attributes. var numOfBooks = 0; // Private static method. function checkIsbn(isbn) { ... } // Return the constructor. return function(newIsbn, newTitle, newAuthor) { // implements Publication // Private attributes. var isb ...
// Constructor.接口对象 var Interface = function(name, methods) { if(arguments.length != 2) { throw new Error("Interface constructor called with " + arguments.length + "arguments, but expected exactly 2."); } this.name = name; this.meth ...

简单工厂

通过实现简单的计算机功能来应用简单工厂 /****************************************************************************************************** 个人理解:工厂的主要作用就是用于生产对象,之所以叫简单工厂,就是因为由客户端来发出指令,来指定所需要的对象。而这种指令是用参数来进行传递的。然后通过继承抽象类或接口,将对象的公共功能抽象出来。使其更加易于扩展。 ***************************************************************** ...
设计模式是解决问题的方案。通过设计模式来找到“封装变化”,“对象间松散耦合”,“针对接口编程”的感觉,从而设计出“易维护”,“易扩展”,“易复用”,“灵活性好”的程序。 面向对象: 对象:是一个实体(类 ...
Global site tag (gtag.js) - Google Analytics