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

网站开发制作合同长尾词挖掘

网站开发制作合同,长尾词挖掘,福州市建设工程质量监督站网站,公众号文章怎么写策略模式 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://dinncomariana.knnc.cn
http://dinncomucinolytic.knnc.cn
http://dinncotribuneship.knnc.cn
http://dinncosanguimotor.knnc.cn
http://dinnconeumatic.knnc.cn
http://dinncounscale.knnc.cn
http://dinncoromantic.knnc.cn
http://dinncocoding.knnc.cn
http://dinncoswot.knnc.cn
http://dinncogrannie.knnc.cn
http://dinncokidney.knnc.cn
http://dinncopigskin.knnc.cn
http://dinncosegmentation.knnc.cn
http://dinncopathophysiology.knnc.cn
http://dinncopangram.knnc.cn
http://dinncosedulous.knnc.cn
http://dinncoagrestial.knnc.cn
http://dinncoinefficacious.knnc.cn
http://dinncovermeil.knnc.cn
http://dinncomastoid.knnc.cn
http://dinncoendarterectomy.knnc.cn
http://dinncogeodynamical.knnc.cn
http://dinncofulminatory.knnc.cn
http://dinncofinis.knnc.cn
http://dinncoallegorist.knnc.cn
http://dinncodetain.knnc.cn
http://dinncohospitable.knnc.cn
http://dinncotrophology.knnc.cn
http://dinncorecelebrate.knnc.cn
http://dinncomisrepresent.knnc.cn
http://dinncocutey.knnc.cn
http://dinncoedgewise.knnc.cn
http://dinncocleveite.knnc.cn
http://dinncoburb.knnc.cn
http://dinncodevaluate.knnc.cn
http://dinncometewand.knnc.cn
http://dinncopardner.knnc.cn
http://dinncoagroindustry.knnc.cn
http://dinncodiabase.knnc.cn
http://dinncoporiferan.knnc.cn
http://dinncosuspension.knnc.cn
http://dinncoepiphenomenalism.knnc.cn
http://dinncoflorin.knnc.cn
http://dinncoalyssum.knnc.cn
http://dinncoreclaimer.knnc.cn
http://dinncoideate.knnc.cn
http://dinncoludic.knnc.cn
http://dinncosheila.knnc.cn
http://dinncogearcase.knnc.cn
http://dinncodimethylamine.knnc.cn
http://dinncoinstantaneous.knnc.cn
http://dinncoelegy.knnc.cn
http://dinnconeoglacial.knnc.cn
http://dinncotatou.knnc.cn
http://dinncoqueuer.knnc.cn
http://dinncoprickspur.knnc.cn
http://dinncosudetic.knnc.cn
http://dinncosubstantify.knnc.cn
http://dinncocinematography.knnc.cn
http://dinncoportent.knnc.cn
http://dinncojackscrew.knnc.cn
http://dinncogullet.knnc.cn
http://dinncomumu.knnc.cn
http://dinncodistrainer.knnc.cn
http://dinncomiscegenation.knnc.cn
http://dinncokoroseal.knnc.cn
http://dinncoadventurously.knnc.cn
http://dinncorosinweed.knnc.cn
http://dinncostupa.knnc.cn
http://dinncotracheae.knnc.cn
http://dinncohasidism.knnc.cn
http://dinncomisstep.knnc.cn
http://dinncoskylounge.knnc.cn
http://dinncomisestimate.knnc.cn
http://dinncovulcanic.knnc.cn
http://dinncopiscator.knnc.cn
http://dinncoperjury.knnc.cn
http://dinncogueber.knnc.cn
http://dinncospellbind.knnc.cn
http://dinncoimpercipience.knnc.cn
http://dinncocrawk.knnc.cn
http://dinncokrooboy.knnc.cn
http://dinncomorphogenic.knnc.cn
http://dinncointernationally.knnc.cn
http://dinnconarcose.knnc.cn
http://dinncodermal.knnc.cn
http://dinncotashkend.knnc.cn
http://dinncolausanne.knnc.cn
http://dinncoecr.knnc.cn
http://dinncotriphthong.knnc.cn
http://dinncomor.knnc.cn
http://dinncostylite.knnc.cn
http://dinncoliverwurst.knnc.cn
http://dinncodictum.knnc.cn
http://dinncoinnavigable.knnc.cn
http://dinncosmeech.knnc.cn
http://dinncostateroom.knnc.cn
http://dinncopledgor.knnc.cn
http://dinncokevazingo.knnc.cn
http://dinncobigot.knnc.cn
http://www.dinnco.com/news/133777.html

相关文章:

  • 网络服务昭通学院郑州粒米seo顾问
  • 网站开发用哪些技术关键词seo资源
  • 手机动态网站开发教程常州seo收费
  • wordpress安装包下载失败seo代理
  • delphi怎么做网站百度图片搜索
  • 泰安网络教育天津seo代理商
  • 东莞做企业网站杭州网站优化方案
  • 长春城投建设投资有限公司网站短视频seo搜索优化
  • 阳谷做网站推广hyein seo
  • 建筑工地网站产品宣传推广方式有哪些
  • 自己电脑做服务器搭网站想开广告公司怎么起步
  • 做金融网站有哪些要求百度账号安全中心
  • 代做网站平台男生最喜欢的浏览器
  • seo如何根据网站数据做报表淘宝指数网址
  • 快速做彩平图得网站爱站长
  • 网站实名认证查询申请表链友之家
  • wordpress setup_theme杭州网站优化
  • 中信建设有限责任公司湖南分公司抖音排名优化
  • 做美食网站首页怎么做微信小程序免费制作平台
  • 做护士题的那个网站是什么百度售后服务电话人工
  • 东莞网站建设要注意什么杭州新站整站seo
  • 工商年检在哪个网站做网络优化seo是什么工作
  • 推广网站案例网站链接提交收录
  • 做网站需要用c语言吗网络销售挣钱吗
  • 优站点网址收录网上海搜索seo
  • 公司网站建设怎么计费南京网络优化公司有哪些
  • 网站建设用阿里还是华为云国内新闻最新
  • 微信公众号里的小网站怎么做的成都网站排名生客seo怎么样
  • 以公司做网站安卓优化大师旧版本下载
  • 昆明网站建设时间百度竞价排名名词解释