360day(this)

《2018年9月28日》【连续360天】

标题:this;

内容:
 

// this
// 函数预编译过程 this --> window
// 全局作用域里 this --> window
// call/apply 可以改变函数运行时this指向
// obj.func();    func()里面的this指向obj

var obj =
{
	a :function()
	{
		console.log(this.name)
	},
	name : "abc"
}
obj.a();


var name ="222";
var a =
{
	name :"111",
	say : function ()
	{
		console.log(this.name);
	}
}
var fun = a.say;
fun();
a.say();
var b = 
{
	name : "333",
	say : function(fun)
	{
		fun();
	}
}
b.say(a.say);
b.say = a.say;

package com; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.hadoop.io.WritableComparable; /**封装对象*/ public class Weather implements WritableComparable<Weather> { //年 private String year; //月 private String month; //日 private String day; //小时 private String hour; //温度 private int temperature; //湿度 private String dew; //气压/压强 private int pressure; //风向 private String wind_direction; //风速 private int wind_speed; //天气情况 private String sky_condition; //1小时降雨量 private String rain_1h; //6小时降雨量 private String rain_6h; public String getYear() { return year; } public void setYear(String year) { this.year = year; } public String getMonth() { return month; } public void setMonth(String month) { this.month = month; } public String getDay() { return day; } public void setDay(String day) { this.day = day; } public String getHour() { return hour; } public void setHour(String hour) { this.hour = hour; } public int getTemperature() { return temperature; } public void setTemperature(int temperature) { this.temperature = temperature; } public String getDew() { return dew; } public void setDew(String dew) { this.dew = dew; } public int getPressure() { return pressure; } public void setPressure(int pressure) { this.pressure = pressure; } public String getWind_direction() { return wind_direction; } public void setWind_direction(String wind_direction) { this.wind_direction = wind_direction; } public int getWind_speed() { return wind_speed; } public void setWind_speed(int wind_speed) { this.wind_speed = wind_speed; } public String getSky_condition() { return sky_condition; } public void setSky_condition(String sky_condition) { this.sky_condition = sky_condition; } public String getRain_1h() { return rain_1h; } public void setRain_1h(String rain_1h) { this.rain_1h = rain_1h; } public String getRain_6h() { return rain_6h; } public void setRain_6h(String rain_6h) { this.rain_6h = rain_6h; } @Override public String toString() { return year + "," + month + "," + day + "," + hour + "," + temperature + "," + dew + "," + pressure + "," + wind_direction + "," + wind_speed + "," + sky_condition + "," + rain_1h + "," + rain_6h; } public Weather() { } public Weather(String year, String month, String day, String hour, int temperature, String dew, int pressure, String wind_direction, int wind_speed, String sky_condition, String rain_1h, String rain_6h) { this.year = year; this.month = month; this.day = day; this.hour = hour; this.temperature = temperature; this.dew = dew; this.pressure = pressure; this.wind_direction = wind_direction; this.wind_speed = wind_speed; this.sky_condition = sky_condition; this.rain_1h = rain_1h; this.rain_6h = rain_6h; } public void readFields(DataInput in) throws IOException { year = in.readUTF(); month = in.readUTF(); day = in.readUTF(); hour = in.readUTF(); temperature = in.readInt(); dew = in.readUTF(); pressure = in.readInt(); wind_direction = in.readUTF(); wind_speed = in.readInt(); sky_condition = in.readUTF(); rain_1h = in.readUTF(); rain_6h = in.readUTF(); } public void write(DataOutput out) throws IOException { out.writeUTF(year); out.writeUTF(month); out.writeUTF(day); out.writeUTF(hour); out.writeInt(temperature); out.writeUTF(dew); out.writeInt(pressure); out.writeUTF(wind_direction); out.writeInt(wind_speed); out.writeUTF(sky_condition); out.writeUTF(rain_1h); out.writeUTF(rain_6h); } public int compareTo(Weather o) { // 首先比较年份 int tmp = this.year.compareTo(o.year); if (tmp != 0) { return tmp; } // 年份相同,比较月份 tmp = this.month.compareTo(o.month); if (tmp != 0) { return tmp; } // 月份相同,比较日期 tmp = this.day.compareTo(o.day); if (tmp != 0) { return tmp; } // 年月日都相同,比较温度(升序) tmp = Integer.compare(this.temperature, o.temperature); if (tmp != 0) { return tmp; } // 温度相同,比较风速(升序) tmp = Integer.compare(this.wind_speed, o.wind_speed); if (tmp != 0) { return tmp; } // 风速相同,比较压强(降序) return Integer.compare(o.pressure, this.pressure); } }package com; import java.io.*; import java.util.HashMap; import java.util.Map.Entry; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Mapper; import javax.sound.midi.Soundbank; /**map端操作*/ public class WeatherMap{ /********** begin **********/ /********** end **********/ } 填写空白部分
10-12
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值