2020-07-23 11:00:46 +08:00
|
|
|
module es {
|
|
|
|
|
/**
|
|
|
|
|
* 用于管理一对对象的简单DTO
|
|
|
|
|
*/
|
|
|
|
|
export class Pair<T> {
|
|
|
|
|
public first: T;
|
|
|
|
|
public second: T;
|
2020-06-16 09:10:09 +08:00
|
|
|
|
2020-07-28 16:25:20 +08:00
|
|
|
constructor(first: T, second: T) {
|
2020-07-23 11:00:46 +08:00
|
|
|
this.first = first;
|
|
|
|
|
this.second = second;
|
|
|
|
|
}
|
2020-06-16 09:10:09 +08:00
|
|
|
|
2020-07-28 16:25:20 +08:00
|
|
|
public clear() {
|
2020-07-23 11:00:46 +08:00
|
|
|
this.first = this.second = null;
|
|
|
|
|
}
|
2020-06-16 09:10:09 +08:00
|
|
|
|
2020-07-28 16:25:20 +08:00
|
|
|
public equals(other: Pair<T>) {
|
2020-07-23 11:00:46 +08:00
|
|
|
return this.first == other.first && this.second == other.second;
|
|
|
|
|
}
|
2020-06-16 09:10:09 +08:00
|
|
|
}
|
2020-07-23 11:00:46 +08:00
|
|
|
}
|