当前位置: 首页 > news >正文

济南建手机网站哪家好医疗器械软件开发流程

济南建手机网站哪家好,医疗器械软件开发流程,百度收录教程,企业高端wordpress主题文章目录 一、解释器模式定义二、例子2.1 菜鸟教程例子2.1.1 定义一个表达式接口2.1.2 实现Expression接口2.1.3 定义解析规则2.1.4 使用 2.2 JDK源码——Pattern2.3 Spring源码——ExpressionParser 三、其他设计模式 一、解释器模式定义 类型#xff1a; 行为型模式 目的 行为型模式 目的 实现了一个表达式接口该接口解释一个特定的上下文。这种模式被用在 SQL 解析、符号处理引擎等 二、例子 2.1 菜鸟教程例子 2.1.1 定义一个表达式接口 public interface Expression {public boolean interpret(String context); } 2.1.2 实现Expression接口 public class TerminalExpression implements Expression {private String data;public TerminalExpression(String data){this.data data; }Overridepublic boolean interpret(String context) {if(context.contains(data)){return true;}return false;} }public class OrExpression implements Expression {private Expression expr1 null;private Expression expr2 null;public OrExpression(Expression expr1, Expression expr2) { this.expr1 expr1;this.expr2 expr2;}Overridepublic boolean interpret(String context) { return expr1.interpret(context) || expr2.interpret(context);} }public class AndExpression implements Expression {private Expression expr1 null;private Expression expr2 null;public AndExpression(Expression expr1, Expression expr2) { this.expr1 expr1;this.expr2 expr2;}Overridepublic boolean interpret(String context) { return expr1.interpret(context) expr2.interpret(context);} }2.1.3 定义解析规则 public class Expressions {//规则Robert 和 John 是男性public static Expression getMaleExpression(){Expression robert new TerminalExpression(Robert);Expression john new TerminalExpression(John);return new OrExpression(robert, john); }//规则Julie 是一个已婚的女性public static Expression getMarriedWomanExpression(){Expression julie new TerminalExpression(Julie);Expression married new TerminalExpression(Married);return new AndExpression(julie, married); } }2.1.4 使用 public class InterpreterPatternDemo {public static void main(String[] args) {Expression isMale Expressions.getMaleExpression();System.out.println(John is male? isMale.interpret(John));Expression isMarriedWoman Expressions.getMarriedWomanExpression();System.out.println(Julie is a married women? isMarriedWoman.interpret(Married Julie));} }2.2 JDK源码——Pattern public final class Pattern implements java.io.Serializable {public static Pattern compile(String regex) {return new Pattern(regex, 0);}public static Pattern compile(String regex, int flags) {return new Pattern(regex, flags);}private String pattern;public String pattern() {return pattern;}private Pattern(String p, int f) {if ((f ~ALL_FLAGS) ! 0) {throw new IllegalArgumentException(Unknown flag 0x Integer.toHexString(f));}pattern p;flags f;// to use UNICODE_CASE if UNICODE_CHARACTER_CLASS presentif ((flags UNICODE_CHARACTER_CLASS) ! 0)flags | UNICODE_CASE;// flags for compilingflags0 flags;// Reset group index countcapturingGroupCount 1;localCount 0;localTCNCount 0;if (!pattern.isEmpty()) {try {compile();} catch (StackOverflowError soe) {throw error(Stack overflow during pattern compilation);}} else {root new Start(lastAccept);matchRoot lastAccept;}} private void compile() {.....} }static class Start extends Node {int minLength;Start(Node node) {this.next node;TreeInfo info new TreeInfo();next.study(info);minLength info.minLength;}...... }static final class StartS extends Start {StartS(Node node) {super(node);} }static final class Begin extends Node {boolean match(Matcher matcher, int i, CharSequence seq) {.......} }static final class End extends Node {boolean match(Matcher matcher, int i, CharSequence seq) {...} }2.3 Spring源码——ExpressionParser public interface ExpressionParser {Expression parseExpression(String expressionString) throws ParseException;Expression parseExpression(String expressionString, ParserContext context) throws ParseException; } public class SpelExpressionParser extends TemplateAwareExpressionParser {private final SpelParserConfiguration configuration;public SpelExpressionParser() {this.configuration new SpelParserConfiguration();}public SpelExpressionParser(SpelParserConfiguration configuration) {Assert.notNull(configuration, SpelParserConfiguration must not be null);this.configuration configuration;}public SpelExpression parseRaw(String expressionString) throws ParseException {Assert.hasText(expressionString, expressionString must not be null or blank);return this.doParseExpression(expressionString, (ParserContext)null);}protected SpelExpression doParseExpression(String expressionString, Nullable ParserContext context) throws ParseException {return (new InternalSpelExpressionParser(this.configuration)).doParseExpression(expressionString, context);} } class InternalSpelExpressionParser extends TemplateAwareExpressionParser {private final DequeSpelNodeImpl constructedNodes new ArrayDeque();protected SpelExpression doParseExpression(String expressionString, Nullable ParserContext context) throws ParseException {this.checkExpressionLength(expressionString);try {this.expressionString expressionString;Tokenizer tokenizer new Tokenizer(expressionString);this.tokenStream tokenizer.process();this.tokenStreamLength this.tokenStream.size();this.tokenStreamPointer 0;this.constructedNodes.clear();SpelNodeImpl ast this.eatExpression();if (ast null) {throw new SpelParseException(this.expressionString, 0, SpelMessage.OOD, new Object[0]);} else {Token t this.peekToken();if (t ! null) {throw new SpelParseException(this.expressionString, t.startPos, SpelMessage.MORE_INPUT, new Object[]{this.toString(this.nextToken())});} else {return new SpelExpression(expressionString, ast, this.configuration);}}} catch (InternalParseException var6) {throw var6.getCause();}}}三、其他设计模式 创建型模式 结构型模式 1、设计模式——装饰器模式Decorator Pattern Spring相关源码 行为型模式 1、设计模式——访问者模式Visitor Pattern Spring相关源码2、设计模式——中介者模式Mediator Pattern JDK相关源码3、设计模式——策略模式Strategy Pattern Spring相关源码4、设计模式——状态模式State Pattern5、设计模式——命令模式Command Pattern Spring相关源码6、设计模式——观察者模式Observer Pattern Spring相关源码7、设计模式——备忘录模式Memento Pattern8、设计模式——模板方法模式Template Pattern Spring相关源码9、设计模式——迭代器模式Iterator Pattern Spring相关源码10、设计模式——责任链模式Chain of Responsibility Pattern Spring相关源码11、设计模式——解释器模式Interpreter Pattern Spring相关源码
http://www.yutouwan.com/news/298787/

相关文章:

  • php网站免费模板市场营销数字营销
  • 万网网站后台留言在哪外贸公司销售渠道
  • 戴尔网站建设目标会员制网站建设教程
  • 长治网站制作厂家君哥摄影设计
  • 单位网站等级保护必须做吗上海恒鑫网站建设
  • 购物商城网站的制作网站注册地址
  • dedecms 安防监控行业网站模板濮阳新闻综合频道回看
  • 成都网站建设哪家唐山哪里有建设网站的
  • 世纪购网站开发招聘国家重大项目建设库网站打不开
  • 亚马逊建站服务前端前景怎么样
  • 企业网站托管费用适合推广的网站有哪些
  • 网站建设专题页面wordpress 多层分类
  • 深圳网站建设怎样做网站注册理由
  • 哪个网站用户体验较好建设企业网站的原因
  • 柯林wap建站程序个人版c 可以做网站吗
  • 中山市建设信息网站网站推广的策略方法
  • 佛山找企业的网站wordpress is ssl
  • 屏蔽阿里云网站网上书城网站开发背景
  • 武安市网站建设百度搜图片功能
  • 网站建设一般分为几个步骤微网站开发协议
  • 安福网站制作苏州知名网站建设开发
  • 网站建设技术公司排名wordpress做文学网
  • 龙华网站建设全包瑞安网站设计
  • 大港建站公司手机自己制作表白网站
  • 佛山医疗网站建设中山市网站制作
  • 东莞网络营销外包杭州网站优化体验
  • 网站建设开发的条件博客网站首页设计
  • 网站模板样式修改app软件开发公司哪家好
  • 茂名网站建设公司科学小制作小发明
  • 建设企业网站登录901wordpress 站内搜索 慢