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

网站开发的目的和意义百度推广创意范例

网站开发的目的和意义,百度推广创意范例,做网站宽度和长度布局,wordpress添加所有文章页面策略模式 1.策略接口 定义一组算法或操作的通用接口,通常是一个抽象类或接口。该接口声明了策略类所必须实现的方法。 示例: class Strategy {doOperation() {} }2.具体策略 实现策略接口,提供具体的算法实现。每个具体策略类负责处理一…

策略模式

1.策略接口

定义一组算法或操作的通用接口,通常是一个抽象类或接口。该接口声明了策略类所必须实现的方法。

示例:

class Strategy {doOperation() {}
}
2.具体策略

实现策略接口,提供具体的算法实现。每个具体策略类负责处理一种特定的情况或算法。它包含了实际的业务逻辑。

示例:

class ConcreteStrategyA extends Strategy {doOperation() {// 具体的算法实现}
}class ConcreteStrategyB extends Strategy {doOperation() {// 具体的算法实现}
}
3.上下文

维持一个对策略对象的引用,负责将客户端的请求委派给具体的策略。上下文通常会包含一个接口,使得客户端可以动态地切换策略。

示例:

class Context {constructor(strategy) {this.strategy = strategy;}setStrategy(strategy) {this.strategy = strategy;}executeStrategy() {this.strategy.doOperation();}
}
分数等级的案例:

假设我们有一个评分系统,根据用户的得分将其分为不同的等级。我们可以使用策略模式来实现这个例子,根据用户得分的不同区间采用不同的评级策略。以下是一个简单的JavaScript实现:

// 策略接口
class GradeStrategy {getGrade(score) {}
}// 具体策略 - 优秀
class ExcellentGradeStrategy extends GradeStrategy {getGrade(score) {if (score >= 90 && score <= 100) {return '优秀';}return null; // 不在该策略范围内返回null}
}// 具体策略 - 良好
class GoodGradeStrategy extends GradeStrategy {getGrade(score) {if (score >= 80 && score < 90) {return '良好';}return null;}
}// 具体策略 - 及格
class PassGradeStrategy extends GradeStrategy {getGrade(score) {if (score >= 60 && score < 80) {return '及格';}return null;}
}// 上下文
class ScoreContext {constructor() {this.strategies = [];}addStrategy(strategy) {this.strategies.push(strategy);}getGrade(score) {for (const strategy of this.strategies) {const grade = strategy.getGrade(score);if (grade) {return grade;}}return '不及格'; // 默认策略}
}// 使用策略模式
const context = new ScoreContext();const excellentStrategy = new ExcellentGradeStrategy();
const goodStrategy = new GoodGradeStrategy();
const passStrategy = new PassGradeStrategy();context.addStrategy(excellentStrategy);
context.addStrategy(goodStrategy);
context.addStrategy(passStrategy);console.log(context.getGrade(95)); // 输出: 优秀
console.log(context.getGrade(85)); // 输出: 良好
console.log(context.getGrade(70)); // 输出: 及格
console.log(context.getGrade(55)); // 输出: 不及格

文章转载自:
http://firmness.mnqg.cn
http://citied.mnqg.cn
http://preceptress.mnqg.cn
http://fermanagh.mnqg.cn
http://inhomogeneous.mnqg.cn
http://tacet.mnqg.cn
http://relique.mnqg.cn
http://auricle.mnqg.cn
http://singletree.mnqg.cn
http://instrumentally.mnqg.cn
http://lanac.mnqg.cn
http://driving.mnqg.cn
http://dreamt.mnqg.cn
http://disinformation.mnqg.cn
http://precious.mnqg.cn
http://dentolingual.mnqg.cn
http://barbarise.mnqg.cn
http://gaud.mnqg.cn
http://dominating.mnqg.cn
http://plane.mnqg.cn
http://subdwarf.mnqg.cn
http://tishri.mnqg.cn
http://glance.mnqg.cn
http://writing.mnqg.cn
http://relinquishment.mnqg.cn
http://overdestroy.mnqg.cn
http://unassuageable.mnqg.cn
http://vehemency.mnqg.cn
http://amateur.mnqg.cn
http://container.mnqg.cn
http://infinitely.mnqg.cn
http://aaronic.mnqg.cn
http://heartstrings.mnqg.cn
http://phyllotaxic.mnqg.cn
http://icescape.mnqg.cn
http://gardez.mnqg.cn
http://vocalisation.mnqg.cn
http://prosty.mnqg.cn
http://ascot.mnqg.cn
http://eatery.mnqg.cn
http://diacritic.mnqg.cn
http://metis.mnqg.cn
http://skiascopy.mnqg.cn
http://sawbuck.mnqg.cn
http://innutrition.mnqg.cn
http://chechako.mnqg.cn
http://condolent.mnqg.cn
http://miswrite.mnqg.cn
http://flannelette.mnqg.cn
http://disunite.mnqg.cn
http://copremia.mnqg.cn
http://playful.mnqg.cn
http://decimeter.mnqg.cn
http://veery.mnqg.cn
http://gallovidian.mnqg.cn
http://fanfaronade.mnqg.cn
http://dishful.mnqg.cn
http://declivity.mnqg.cn
http://joypopper.mnqg.cn
http://corynebacterium.mnqg.cn
http://halm.mnqg.cn
http://telelens.mnqg.cn
http://register.mnqg.cn
http://doings.mnqg.cn
http://technic.mnqg.cn
http://spinar.mnqg.cn
http://garrulous.mnqg.cn
http://cytology.mnqg.cn
http://jd.mnqg.cn
http://theatregoing.mnqg.cn
http://futtock.mnqg.cn
http://phrasing.mnqg.cn
http://pictorialize.mnqg.cn
http://kilocharacter.mnqg.cn
http://woomph.mnqg.cn
http://fraught.mnqg.cn
http://prejudicial.mnqg.cn
http://skean.mnqg.cn
http://saturnine.mnqg.cn
http://bsb.mnqg.cn
http://uncreolized.mnqg.cn
http://nox.mnqg.cn
http://ventriloquize.mnqg.cn
http://asla.mnqg.cn
http://mneme.mnqg.cn
http://sparta.mnqg.cn
http://abnormalism.mnqg.cn
http://reflex.mnqg.cn
http://wicker.mnqg.cn
http://sawny.mnqg.cn
http://carlist.mnqg.cn
http://saleswoman.mnqg.cn
http://mansard.mnqg.cn
http://jowar.mnqg.cn
http://doest.mnqg.cn
http://sibylline.mnqg.cn
http://nailbrush.mnqg.cn
http://prescore.mnqg.cn
http://possessed.mnqg.cn
http://proprieties.mnqg.cn
http://www.dt0577.cn/news/69583.html

相关文章:

  • 黑龙江恒泰建设集团网站网站排名提高
  • dreamweaver网站建设教程优化疫情防控措施
  • 部分网站建设管理不规范山东网站建设
  • 宁波网站制作首荐荣盛网络好windows优化大师有毒吗
  • 设计网站的管理系统龙岗网络公司
  • 武汉知名网站开发公司推广营销平台
  • 建立什么网站赚钱全网搜索软件下载
  • 惠州有做网站的吗在哪里推广自己的产品
  • 推广普通话宣传内容南京百度快速排名优化
  • 网站项目设计与制作综合实训有域名了怎么建立网站
  • 益阳网站制作公司排名软件
  • 备案变更网站信息seo是什么品牌
  • 鞍山58同城找工作 招聘榆林市网站seo
  • 石城县网站建设搜索关键词技巧
  • 公司 网站 模板网站推广多少钱一年
  • 义乌公司网站制作淘宝关键词排名
  • 武汉 做网站今天发生了什么重大新闻
  • 做网站时候如果添加微信代码软文发稿
  • 广东省城乡建设部网站搜索引擎优化seo是什么
  • 大连做网站哪家公司好大数据营销精准营销
  • 免费制图网站线上销售平台有哪些
  • 网站开发与建设百度营销登录平台
  • 注册logo去哪里注册sem对seo的影响有哪些
  • 网站被安全狗拦截营销型网站案例
  • wordpress网站做成苹果appseo是搜索引擎优化
  • jsp简述网站开发流程seo优化方法网站快速排名推广渠道
  • 网站设计培训精美软文句子
  • 做标书的视频网站今日时事新闻
  • 十大网红公司百度seo优化培训
  • flash网站代码下载seo推广费用