Files
esengine/source/src/Utils/Pair.ts

24 lines
588 B
TypeScript
Raw Normal View History

2020-07-23 11:00:46 +08:00
module es {
/**
* DTO
*/
2020-10-27 18:08:49 +08:00
export class Pair<T> implements IEquatable<Pair<T>> {
2020-07-23 11:00:46 +08:00
public first: T;
public second: T;
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-07-28 16:25:20 +08:00
public clear() {
2020-07-23 11:00:46 +08:00
this.first = this.second = null;
}
2020-10-27 18:08:49 +08:00
public equals(other: Pair<T>): boolean {
// 这两种方法在功能上应该是等价的
2020-07-23 11:00:46 +08:00
return this.first == other.first && this.second == other.second;
}
}
2020-07-23 11:00:46 +08:00
}