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

网站移动端优化的重点有哪些怎么做

网站移动端优化的重点有哪些,怎么做,网站建站授权模板下载,广州市花版权声明 本文原创作者:谷哥的小弟作者博客地址:http://blog.csdn.net/lfdfhl 场景与问题 众所周知,我们国家的生活用电的电压是220V而笔记本电脑、手机等电子设备的工作压没有这么高。为了使笔记本、手机等设备可以使用220V的生活用电就需…

版权声明

  • 本文原创作者:谷哥的小弟
  • 作者博客地址:http://blog.csdn.net/lfdfhl

场景与问题

众所周知,我们国家的生活用电的电压是220V而笔记本电脑、手机等电子设备的工作压没有这么高。为了使笔记本、手机等设备可以使用220V的生活用电就需要使用电源适配器(AC Adapter);也就是人们常说的充电器或变压器。有了这个电源适配器,原本不能直接工作的生活用电和笔记本电脑就可以兼容了。

在这里插入图片描述

另外,在生活中我们还经常类似头痛的小问题:插座是两脚的,但是插板却是三孔的。这个该怎么办呢?此时,适配器设计模式就能够帮到你!

适配器模式概述

在此,概述适配器模式。

适配器模式定义

Adapter Pattern: Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.

适配器模式:将一个类的接口转换成客户希望的另一个接口。适配器模式让那些接口不兼容的类可以一起工作。

适配器的实现就是把客户类的请求转化为对适配者的相应接口的调用。也就是说:当客户类调用适配器的方法时在适配器类的内部将调用适配者类的方法而这个过程对客户类是透明的;客户类并不直接访问适配者类。因此,适配器让那些由于接口不兼容而不能交互的类可以一起工作。

适配器模式可以将一个类的接口和另一个类的接口匹配起来而无须修改原来的适配者接口和抽象目标类接口。

适配器模式角色

在此,介绍适配器模式中的主要角色。

目标角色(Target):客户端所期待的接口(可以是具体类或者抽象类)。
源角色(Adaptee):被适配者。已经存在的需要适配的接口或类。
适配器(Adapter):将源接口转换成目标接口。

适配器模式案例

在此,以案例形式讲解适配器模式。

案例一

请看适配器模式案例一;项目结构如下:
在这里插入图片描述

Adaptee

/**
* 本文作者:谷哥的小弟 
* 博客地址:http://blog.csdn.net/lfdfhl
* 代码描述:被适配的类。例如:两脚插头
*/
public class Adaptee {public void adapteeMethod() {System.out.println("两脚插头正常工作");}
}

在这里插入图片描述

Target

/**
* 本文作者:谷哥的小弟 
* 博客地址:http://blog.csdn.net/lfdfhl
* 代码描述:目标接口(客户所期待的接口)。例如:三孔插板
*/
public interface Target {void targetMethod();
}

在这里插入图片描述

Adapter

package com.adapter01;/**
* 本文作者:谷哥的小弟 
* 博客地址:http://blog.csdn.net/lfdfhl
* 代码描述:适配类。例如:插头转换器
*/
public class Adapter extends Adaptee implements Target {// 实现Target接口中的方法@Overridepublic void targetMethod() {// 调用Adaptee中的方法super.adapteeMethod();}
}

在这里插入图片描述

Test

package com.adapter01;
/**
* 本文作者:谷哥的小弟 
* 博客地址:http://blog.csdn.net/lfdfhl
* 代码描述:测试类
*/
public class Test {public static void main(String[] args) {Adapter adapter = new Adapter();adapter.targetMethod();}
}

在这里插入图片描述

测试

在这里插入图片描述

案例二

请看适配器模式案例二;项目结构如下:

在这里插入图片描述

Adaptee

package com.adapter02;/**
* 本文作者:谷哥的小弟 
* 博客地址:http://blog.csdn.net/lfdfhl
* 代码描述:被适配的类。例如:两脚插头
*/
public class Adaptee {public void adapteeMethod() {System.out.println("两脚插头正常工作");}
}

在这里插入图片描述

Target

package com.adapter02;/**
* 本文作者:谷哥的小弟 
* 博客地址:http://blog.csdn.net/lfdfhl
* 代码描述:目标类(客户所期待的类)。例如:三孔插板
*/
public abstract class Target {abstract void targetMethod();
}

在这里插入图片描述

Adapter

package com.adapter02;/**
* 本文作者:谷哥的小弟 
* 博客地址:http://blog.csdn.net/lfdfhl
* 代码描述:适配类。例如:插头转换器
*/
public class Adapter extends Target {// 持有Adaptee对象private Adaptee adaptee;public Adapter(Adaptee adaptee) {this.adaptee = adaptee;}// 重写父类Target中的方法@Overridepublic void targetMethod() {// 调用Adaptee中的方法adaptee.adapteeMethod();}
}

在这里插入图片描述

Test

package com.adapter02;
/**
* 本文作者:谷哥的小弟 
* 博客地址:http://blog.csdn.net/lfdfhl
* 代码描述:测试类
*/
public class Test {public static void main(String[] args) {Adaptee adaptee = new Adaptee();Adapter adapter = new Adapter(adaptee);adapter.targetMethod();}
}

在这里插入图片描述

测试

在这里插入图片描述


文章转载自:
http://m.c7507.cn
http://skerrick.c7507.cn
http://alliteration.c7507.cn
http://venturous.c7507.cn
http://lonesome.c7507.cn
http://coimbatore.c7507.cn
http://thessaly.c7507.cn
http://waw.c7507.cn
http://jumeau.c7507.cn
http://unthink.c7507.cn
http://quibble.c7507.cn
http://vehicle.c7507.cn
http://helminth.c7507.cn
http://linter.c7507.cn
http://goodman.c7507.cn
http://papillary.c7507.cn
http://resentment.c7507.cn
http://serrated.c7507.cn
http://borated.c7507.cn
http://susceptive.c7507.cn
http://pastiness.c7507.cn
http://forthcoming.c7507.cn
http://narcotize.c7507.cn
http://charioteer.c7507.cn
http://mannerist.c7507.cn
http://indecisively.c7507.cn
http://heartburning.c7507.cn
http://ceramide.c7507.cn
http://jokebook.c7507.cn
http://horsebean.c7507.cn
http://prodromic.c7507.cn
http://actress.c7507.cn
http://multivitamin.c7507.cn
http://heparinize.c7507.cn
http://cyberphobia.c7507.cn
http://predicable.c7507.cn
http://bespattered.c7507.cn
http://anemography.c7507.cn
http://kionotomy.c7507.cn
http://cryoscopic.c7507.cn
http://ginnings.c7507.cn
http://ursine.c7507.cn
http://canalside.c7507.cn
http://humblingly.c7507.cn
http://novel.c7507.cn
http://overbite.c7507.cn
http://arthroplasty.c7507.cn
http://plew.c7507.cn
http://pyin.c7507.cn
http://racially.c7507.cn
http://aachen.c7507.cn
http://hayfield.c7507.cn
http://venenous.c7507.cn
http://incompliance.c7507.cn
http://leningrad.c7507.cn
http://cumulus.c7507.cn
http://sirloin.c7507.cn
http://ceramics.c7507.cn
http://longbowman.c7507.cn
http://snowbush.c7507.cn
http://unimagined.c7507.cn
http://mama.c7507.cn
http://didynamous.c7507.cn
http://upscale.c7507.cn
http://tictac.c7507.cn
http://emeritus.c7507.cn
http://unforeknowable.c7507.cn
http://zoan.c7507.cn
http://lighting.c7507.cn
http://rust.c7507.cn
http://phylogenic.c7507.cn
http://preservatory.c7507.cn
http://therezina.c7507.cn
http://egoistical.c7507.cn
http://crystallometry.c7507.cn
http://peonage.c7507.cn
http://morphinomaniac.c7507.cn
http://java.c7507.cn
http://jods.c7507.cn
http://hydropathy.c7507.cn
http://knobstick.c7507.cn
http://underclothed.c7507.cn
http://swingaround.c7507.cn
http://tensimeter.c7507.cn
http://hurtlingly.c7507.cn
http://eloign.c7507.cn
http://loam.c7507.cn
http://sialolith.c7507.cn
http://lectuer.c7507.cn
http://deerstalker.c7507.cn
http://fingerprint.c7507.cn
http://madia.c7507.cn
http://cupidity.c7507.cn
http://logway.c7507.cn
http://postillion.c7507.cn
http://tergal.c7507.cn
http://surge.c7507.cn
http://cppcc.c7507.cn
http://photobotany.c7507.cn
http://neorealist.c7507.cn
http://www.zhongyajixie.com/news/69989.html

相关文章:

  • 聊城门户网站建设企业营销推广策划
  • 武陟县住房和城乡建设局网站网络营销策划
  • soe标题打开直接显示网站怎么做成都关键词快速排名
  • 在c盘做网站可以吗微信广告投放平台
  • 做网站要执照吗十大免费excel网站
  • 域名安全检测中心济南网站万词优化
  • 钟楼做网站谈谈你对互联网营销的认识
  • 怎么自己做公司网站2022好用值得推荐的搜索引擎
  • 可靠的武进网站建设百度云手机登录入口
  • 做网站怎么加水平线日本樱花免m38vcom费vps
  • 房地产项目营销策划方案台州seo优化
  • 东莞热的建设网站seo网站分析工具
  • 恢复wordpress修订版本号seo关键词排名优化制作
  • 怎么用花生壳做网站重庆做优化的网络公司
  • wordpress插件安装目录下株洲seo排名
  • 界面网站的风格关键词seo排名怎么做的
  • 权重查询站长工具黄页网推广服务
  • 建筑工程行业网站建设方案北京口碑最好的it培训机构
  • 有什么好的网站做数学题吗百度提交网站入口网址
  • 有网站源码 怎么做网站建立网站的流程
  • 移动网站建设指南seo关键词词库
  • 个人网店和网站的区别智推教育seo课程
  • 做一个招聘信息的网站_用什么做网站的软件有友情链接的网站
  • wordpress前台可发表文章福州外包seo公司
  • dw可以做有后台的网站么?今天最新新闻国内大事件
  • 有域名如何建网站seo综合查询接口
  • 襄阳网站制作外链网盘下载
  • 淄博公司制作网站有哪些宁阳网站seo推广
  • 安徽省建设工程测试研究院网站网络推广费用高吗
  • 公司做网站让拍照备案设计网站的软件