// 计算总容量 capacity 与 r 的差值,赋给 this 对应的维度 // 即 this = capacity - r public Resource DiffOf(Resource capacity, Resource r) { Cpu.DiffOf(capacity.Cpu, r.Cpu); Mem.DiffOf(capacity.Mem, r.Mem); Disk = capacity.Disk - r.Disk; P = capacity.P - r.P; M = capacity.M - r.M; Pm = capacity.Pm - r.Pm; return(this); }