You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

SafeValue.cs 22 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. using System;
  2. using System.Threading;
  3. namespace Preparation.Utility
  4. {
  5. //理论上结构体最好不可变,这里采用了可变结构。
  6. //其对应属性不应当有set访问器,避免不安全的=赋值
  7. public class AtomicInt
  8. {
  9. private int v;
  10. public AtomicInt(int x)
  11. {
  12. v = x;
  13. }
  14. public override string ToString() => Interlocked.CompareExchange(ref v, -1, -1).ToString();
  15. public int Get() => Interlocked.CompareExchange(ref v, -1, -1);
  16. public static implicit operator int(AtomicInt aint) => Interlocked.CompareExchange(ref aint.v, -1, -1);
  17. /// <returns>返回操作前的值</returns>
  18. public int SetReturnOri(int value) => Interlocked.Exchange(ref v, value);
  19. public int Add(int x) => Interlocked.Add(ref v, x);
  20. public int Sub(int x) => Interlocked.Add(ref v, -x);
  21. public int Inc() => Interlocked.Increment(ref v);
  22. public int Dec() => Interlocked.Decrement(ref v);
  23. /// <returns>返回操作前的值</returns>
  24. public int CompareExReturnOri(int newV, int compareTo) => Interlocked.CompareExchange(ref v, newV, compareTo);
  25. }
  26. public class AtomicLong
  27. {
  28. private long v;
  29. public AtomicLong(long x)
  30. {
  31. v = x;
  32. }
  33. public override string ToString() => Interlocked.Read(ref v).ToString();
  34. public long Get() => Interlocked.Read(ref v);
  35. public static implicit operator long(AtomicLong aint) => Interlocked.Read(ref aint.v);
  36. /// <returns>返回操作前的值</returns>
  37. public long SetReturnOri(long value) => Interlocked.Exchange(ref v, value);
  38. public long Add(long x) => Interlocked.Add(ref v, x);
  39. public long Sub(long x) => Interlocked.Add(ref v, -x);
  40. public long Inc() => Interlocked.Increment(ref v);
  41. public long Dec() => Interlocked.Decrement(ref v);
  42. /// <returns>返回操作前的值</returns>
  43. public long CompareExReturnOri(long newV, long compareTo) => Interlocked.CompareExchange(ref v, newV, compareTo);
  44. }
  45. public class AtomicBool
  46. {
  47. private int v;//v==0为false,v==1为true
  48. public AtomicBool(bool x)
  49. {
  50. v = x ? 1 : 0;
  51. }
  52. public override string ToString() => (Interlocked.CompareExchange(ref v, -2, -2) == 0) ? "false" : "true";
  53. public bool Get() => (Interlocked.CompareExchange(ref v, -1, -1) != 0);
  54. public static implicit operator bool(AtomicBool abool) => (Interlocked.CompareExchange(ref abool.v, -1, -1) != 0);
  55. /// <returns>返回操作前的值</returns>
  56. public bool SetReturnOri(bool value) => (Interlocked.Exchange(ref v, value ? 1 : 0) != 0);
  57. /// <returns>赋值前的值是否与将赋予的值不相同</returns>
  58. public bool TrySet(bool value)
  59. {
  60. return (Interlocked.CompareExchange(ref v, value ? 1 : 0, value ? 0 : 1) ^ (value ? 1 : 0)) != 0;
  61. }
  62. public bool And(bool x) => Interlocked.And(ref v, x ? 1 : 0) != 0;
  63. public bool Or(bool x) => Interlocked.Or(ref v, x ? 1 : 0) != 0;
  64. }
  65. /// <summary>
  66. /// 根据时间推算Start后完成多少进度的进度条(long)。
  67. /// 只允许Start时修改needTime(请确保大于0);
  68. /// 支持TrySet0使未完成的进度条终止清零;支持Set0使进度条强制终止清零;
  69. /// 通过原子操作实现。
  70. /// </summary>
  71. public class LongProgressByTime
  72. {
  73. private long endT = long.MaxValue;
  74. private long needT;
  75. public LongProgressByTime(long needTime)
  76. {
  77. if (needTime <= 0) Debugger.Output("Bug:LongProgressByTime.needTime (" + needTime.ToString() + ") is less than 0.");
  78. this.needT = needTime;
  79. }
  80. public LongProgressByTime()
  81. {
  82. this.needT = long.MaxValue;
  83. }
  84. public long GetEndTime() => Interlocked.CompareExchange(ref endT, -2, -2);
  85. public long GetNeedTime() => Interlocked.CompareExchange(ref needT, -2, -2);
  86. public override string ToString() => "EndTime:" + Interlocked.CompareExchange(ref endT, -2, -2).ToString() + " ms, NeedTime:" + Interlocked.CompareExchange(ref needT, -2, -2).ToString() + " ms";
  87. public bool IsFinished()
  88. {
  89. return Interlocked.CompareExchange(ref endT, -2, -2) <= Environment.TickCount64;
  90. }
  91. /// <summary>
  92. /// GetProgress<0则表明未开始
  93. /// </summary>
  94. public long GetProgress()
  95. {
  96. long cutime = Interlocked.CompareExchange(ref endT, -2, -2) - Environment.TickCount64;
  97. if (cutime <= 0) return Interlocked.CompareExchange(ref needT, -2, -2);
  98. return Interlocked.CompareExchange(ref needT, -2, -2) - cutime;
  99. }
  100. /// <summary>
  101. /// GetProgress<0则表明未开始
  102. /// </summary>
  103. public long GetProgress(long time)
  104. {
  105. long cutime = Interlocked.CompareExchange(ref endT, -2, -2) - time;
  106. if (cutime <= 0) return Interlocked.CompareExchange(ref needT, -2, -2);
  107. return Interlocked.CompareExchange(ref needT, -2, -2) - cutime;
  108. }
  109. /// <summary>
  110. /// <0则表明未开始
  111. /// </summary>
  112. public static implicit operator long(LongProgressByTime pLong) => pLong.GetProgress();
  113. /// <summary>
  114. /// GetProgressDouble<0则表明未开始
  115. /// </summary>
  116. public double GetProgressDouble()
  117. {
  118. long cutime = Interlocked.CompareExchange(ref endT, -2, -2) - Environment.TickCount64;
  119. if (cutime <= 0) return 1;
  120. return 1.0 - ((double)cutime / Interlocked.CompareExchange(ref needT, -2, -2));
  121. }
  122. public bool Start(long needTime)
  123. {
  124. if (needTime <= 0)
  125. {
  126. Debugger.Output("Warning:Start LongProgressByTime with the needTime (" + needTime.ToString() + ") which is less than 0.");
  127. return false;
  128. }
  129. //规定只有Start可以修改needT,且需要先访问endTime,从而避免锁(某种程度上endTime可以认为是needTime的锁)
  130. if (Interlocked.CompareExchange(ref endT, Environment.TickCount64 + needTime, long.MaxValue) != long.MaxValue) return false;
  131. if (needTime <= 2) Debugger.Output("Warning:the field of LongProgressByTime is " + needTime.ToString() + ",which is too small.");
  132. Interlocked.Exchange(ref needT, needTime);
  133. return true;
  134. }
  135. public bool Start()
  136. {
  137. long needTime = Interlocked.CompareExchange(ref needT, -2, -2);
  138. if (Interlocked.CompareExchange(ref endT, Environment.TickCount64 + needTime, long.MaxValue) != long.MaxValue) return false;
  139. return true;
  140. }
  141. /// <summary>
  142. /// 使进度条强制终止清零
  143. /// </summary>
  144. public void Set0() => Interlocked.Exchange(ref endT, long.MaxValue);
  145. /// <summary>
  146. /// 使未完成的进度条终止清零
  147. /// </summary>
  148. public bool TrySet0()
  149. {
  150. if (Environment.TickCount64 < Interlocked.CompareExchange(ref endT, -2, -2))
  151. {
  152. Interlocked.Exchange(ref endT, long.MaxValue);
  153. return true;
  154. }
  155. return false;
  156. }
  157. //增加其他新的写操作可能导致不安全
  158. }
  159. /*
  160. /// <summary>
  161. /// 记录(不是根据时间)完成多少进度的进度条(long)。
  162. /// </summary>
  163. public struct IntProgressByAdding
  164. {
  165. private int completedProgress = -1;
  166. private int requiredProgress;
  167. public IntProgressByAdding(int completedProgress, int requiredProgress)
  168. {
  169. this.completedProgress = completedProgress;
  170. this.requiredProgress = requiredProgress;
  171. }
  172. public IntProgressByAdding(int requiredProgress)
  173. {
  174. this.requiredProgress = requiredProgress;
  175. }
  176. public IntProgressByAdding()
  177. {
  178. this.requiredProgress=int.MaxValue;
  179. }
  180. }
  181. */
  182. /// <summary>
  183. /// 一个保证在[0,maxValue]的可变int,支持可变的maxValue(请确保大于0)
  184. /// </summary>
  185. public class IntWithVariableRange
  186. {
  187. private int v;
  188. private int maxV;
  189. private readonly object vLock = new();
  190. public IntWithVariableRange(int value, int maxValue)
  191. {
  192. if (maxValue < 0)
  193. {
  194. Debugger.Output("Warning:Try to set IntWithVariableRange.maxValue to " + maxValue.ToString() + ".");
  195. maxValue = 0;
  196. }
  197. v = value < maxValue ? value : maxValue;
  198. this.maxV = maxValue;
  199. }
  200. /// <summary>
  201. /// 默认使Value=maxValue
  202. /// </summary>
  203. public IntWithVariableRange(int maxValue)
  204. {
  205. if (maxValue < 0)
  206. {
  207. Debugger.Output("Warning:Try to set IntWithVariableRange.maxValue to " + maxValue.ToString() + ".");
  208. maxValue = 0;
  209. }
  210. v = this.maxV = maxValue;
  211. }
  212. public IntWithVariableRange()
  213. {
  214. v = this.maxV = int.MaxValue;
  215. }
  216. public override string ToString()
  217. {
  218. lock (vLock)
  219. {
  220. return "value:" + v.ToString() + " ,maxValue:" + maxV.ToString();
  221. }
  222. }
  223. public int GetValue() { lock (vLock) return v; }
  224. public static implicit operator int(IntWithVariableRange aint) => aint.GetValue();
  225. public int GetMaxV() { lock (vLock) return maxV; }
  226. /// <summary>
  227. /// 若maxValue<=0则maxValue设为0并返回False
  228. /// </summary>
  229. public bool SetMaxV(int maxValue)
  230. {
  231. if (maxValue < 0) maxValue = 0;
  232. lock (vLock)
  233. {
  234. maxV = maxValue;
  235. if (v > maxValue) v = maxValue;
  236. }
  237. return maxValue > 0;
  238. }
  239. /// <summary>
  240. /// 应当保证该maxValue>=0
  241. /// </summary>
  242. public void SetPositiveMaxV(int maxValue)
  243. {
  244. lock (vLock)
  245. {
  246. maxV = maxValue;
  247. if (v > maxValue) v = maxValue;
  248. }
  249. }
  250. /// <summary>
  251. /// 应当保证该value>=0
  252. /// </summary>
  253. public int SetPositiveV(int value)
  254. {
  255. lock (vLock)
  256. {
  257. return v = (value > maxV) ? maxV : value;
  258. }
  259. }
  260. public int SetV(int value)
  261. {
  262. if (value < 0) value = 0;
  263. lock (vLock)
  264. {
  265. return v = (value > maxV) ? maxV : value;
  266. }
  267. }
  268. /// <summary>
  269. /// 返回实际改变量
  270. /// </summary>
  271. public int AddV(int addV)
  272. {
  273. lock (vLock)
  274. {
  275. int previousV = v;
  276. v += addV;
  277. if (v < 0) v = 0;
  278. if (v > maxV) v = maxV;
  279. return v - previousV;
  280. }
  281. }
  282. /// <summary>
  283. /// 应当保证该增加值大于0,返回实际改变量
  284. /// </summary>
  285. public int AddPositiveV(int addPositiveV)
  286. {
  287. lock (vLock)
  288. {
  289. addPositiveV = Math.Min(addPositiveV, maxV - v);
  290. v += addPositiveV;
  291. }
  292. return addPositiveV;
  293. }
  294. /// <summary>
  295. /// 应当保证该减少值大于0,返回实际改变量
  296. /// </summary>
  297. public int SubPositiveV(int subPositiveV)
  298. {
  299. lock (vLock)
  300. {
  301. subPositiveV = Math.Min(subPositiveV, v);
  302. v -= subPositiveV;
  303. }
  304. return subPositiveV;
  305. }
  306. /// <summary>
  307. /// 试图加到满,如果无法加到maxValue则不加并返回-1
  308. /// </summary>
  309. public int TryAddAll(int addV)
  310. {
  311. lock (vLock)
  312. {
  313. if (maxV - v <= addV)
  314. {
  315. addV = maxV - v;
  316. v = maxV;
  317. return addV;
  318. }
  319. return 0;
  320. }
  321. }
  322. }
  323. /// <summary>
  324. /// 一个保证在[0,maxValue]的可变long,支持可变的maxValue(请确保大于0)
  325. /// </summary>
  326. public class LongWithVariableRange
  327. {
  328. private long v;
  329. private long maxV;
  330. private readonly object vLock = new();
  331. public LongWithVariableRange(long value, long maxValue)
  332. {
  333. if (maxValue < 0)
  334. {
  335. Debugger.Output("Warning:Try to set SafaValues.LongWithVariableRange.maxValue to " + maxValue.ToString() + ".");
  336. maxValue = 0;
  337. }
  338. v = value < maxValue ? value : maxValue;
  339. this.maxV = maxValue;
  340. }
  341. /// <summary>
  342. /// 默认使Value=maxValue
  343. /// </summary>
  344. public LongWithVariableRange(long maxValue)
  345. {
  346. if (maxValue < 0)
  347. {
  348. Debugger.Output("Warning:Try to set SafaValues.LongWithVariableRange.maxValue to " + maxValue.ToString() + ".");
  349. maxValue = 0;
  350. }
  351. v = this.maxV = maxValue;
  352. }
  353. public LongWithVariableRange()
  354. {
  355. v = this.maxV = long.MaxValue;
  356. }
  357. public override string ToString()
  358. {
  359. lock (vLock)
  360. {
  361. return "value:" + v.ToString() + " ,maxValue:" + maxV.ToString();
  362. }
  363. }
  364. public long GetValue() { lock (vLock) return v; }
  365. public static implicit operator long(LongWithVariableRange aint) => aint.GetValue();
  366. public long GetMaxV() { lock (vLock) return maxV; }
  367. /// <summary>
  368. /// 若maxValue<=0则maxValue设为0并返回False
  369. /// </summary>
  370. public bool SetMaxV(long maxValue)
  371. {
  372. if (maxValue < 0) maxValue = 0;
  373. lock (vLock)
  374. {
  375. maxV = maxValue;
  376. if (v > maxValue) v = maxValue;
  377. }
  378. return maxValue > 0;
  379. }
  380. /// <summary>
  381. /// 应当保证该maxValue>=0
  382. /// </summary>
  383. public void SetPositiveMaxV(long maxValue)
  384. {
  385. lock (vLock)
  386. {
  387. maxV = maxValue;
  388. if (v > maxValue) v = maxValue;
  389. }
  390. }
  391. /// <summary>
  392. /// 应当保证该value>=0
  393. /// </summary>
  394. public long SetPositiveV(long value)
  395. {
  396. lock (vLock)
  397. {
  398. return v = (value > maxV) ? maxV : value;
  399. }
  400. }
  401. public long SetV(long value)
  402. {
  403. if (value < 0) value = 0;
  404. lock (vLock)
  405. {
  406. return v = (value > maxV) ? maxV : value;
  407. }
  408. }
  409. /// <summary>
  410. /// 返回实际改变量
  411. /// </summary>
  412. public long AddV(long addV)
  413. {
  414. lock (vLock)
  415. {
  416. long previousV = v;
  417. v += addV;
  418. if (v < 0) v = 0;
  419. if (v > maxV) v = maxV;
  420. return v - previousV;
  421. }
  422. }
  423. /// <summary>
  424. /// 应当保证该增加值大于0,返回实际改变量
  425. /// </summary>
  426. public long AddPositiveV(long addPositiveV)
  427. {
  428. lock (vLock)
  429. {
  430. addPositiveV = Math.Min(addPositiveV, maxV - v);
  431. v += addPositiveV;
  432. }
  433. return addPositiveV;
  434. }
  435. /// <summary>
  436. /// 应当保证该减少值大于0,返回实际改变量
  437. /// </summary>
  438. public long SubPositiveV(long subPositiveV)
  439. {
  440. lock (vLock)
  441. {
  442. subPositiveV = Math.Min(subPositiveV, v);
  443. v -= subPositiveV;
  444. }
  445. return subPositiveV;
  446. }
  447. /// <summary>
  448. /// 试图加到满,如果无法加到maxValue则不加并返回-1
  449. /// </summary>
  450. public long TryAddAll(long addV)
  451. {
  452. lock (vLock)
  453. {
  454. if (maxV - v <= addV)
  455. {
  456. addV = maxV - v;
  457. v = maxV;
  458. return addV;
  459. }
  460. return -1;
  461. }
  462. }
  463. }
  464. /// <summary>
  465. /// 一个保证在[0,maxNum],每CDms自动更新的可变int,支持可变的CD、maxNum(请确保大于0)
  466. /// </summary>
  467. public class IntNumUpdateByCD
  468. {
  469. private int num;
  470. private int maxNum;
  471. private int cd;
  472. private long updateTime = 0;
  473. private readonly object numLock = new();
  474. public IntNumUpdateByCD(int num, int maxNum, int cd)
  475. {
  476. if (num < 0) Debugger.Output("Bug:IntNumUpdateByCD.num (" + num.ToString() + ") is less than 0.");
  477. if (maxNum < 0) Debugger.Output("Bug:IntNumUpdateByCD.maxNum (" + maxNum.ToString() + ") is less than 0.");
  478. if (cd <= 0) Debugger.Output("Bug:IntNumUpdateByCD.cd (" + cd.ToString() + ") is less than 0.");
  479. this.num = (num < maxNum) ? num : maxNum;
  480. this.maxNum = maxNum;
  481. this.cd = cd;
  482. this.updateTime = Environment.TickCount64;
  483. }
  484. /// <summary>
  485. /// 默认使num=maxNum
  486. /// </summary>
  487. public IntNumUpdateByCD(int maxNum, int cd)
  488. {
  489. if (maxNum < 0) Debugger.Output("Bug:IntNumUpdateByCD.maxNum (" + maxNum.ToString() + ") is less than 0.");
  490. if (cd <= 0) Debugger.Output("Bug:IntNumUpdateByCD.cd (" + cd.ToString() + ") is less than 0.");
  491. this.num = this.maxNum = maxNum;
  492. this.cd = cd;
  493. }
  494. public IntNumUpdateByCD()
  495. {
  496. this.num = this.maxNum = 0;
  497. this.cd = int.MaxValue;
  498. }
  499. public int GetMaxNum() { lock (numLock) return maxNum; }
  500. public int GetCD() { lock (numLock) return cd; }
  501. public int GetNum(long time)
  502. {
  503. lock (numLock)
  504. {
  505. if (num < maxNum && time - updateTime >= cd)
  506. {
  507. int add = (int)Math.Min(maxNum - num, (time - updateTime) / cd);
  508. updateTime += add * cd;
  509. return (num += add);
  510. }
  511. return num;
  512. }
  513. }
  514. public static implicit operator int(IntNumUpdateByCD aint) => aint.GetNum(Environment.TickCount64);
  515. /// <summary>
  516. /// 应当保证该subV>=0
  517. /// </summary>
  518. public int TrySub(int subV)
  519. {
  520. if (subV < 0) Debugger.Output("Bug:IntNumUpdateByCD Try to sub " + subV.ToString() + ", which is less than 0.");
  521. long time = Environment.TickCount64;
  522. lock (numLock)
  523. {
  524. if (num < maxNum && time - updateTime >= cd)
  525. {
  526. int add = (int)Math.Min(maxNum - num, (time - updateTime) / cd);
  527. updateTime += add * cd;
  528. num += add;
  529. }
  530. if (num == maxNum) updateTime = time;
  531. num -= subV = Math.Min(subV, num);
  532. }
  533. return subV;
  534. }
  535. /// <summary>
  536. /// 应当保证该addV>=0
  537. /// </summary>
  538. public void TryAdd(int addV)
  539. {
  540. if (addV < 0) Debugger.Output("Bug:IntNumUpdateByCD Try to add " + addV.ToString() + ", which is less than 0.");
  541. lock (numLock)
  542. {
  543. num += Math.Min(addV, maxNum - num);
  544. }
  545. }
  546. /// <summary>
  547. /// 若maxNum<=0则maxNum及Num设为0并返回False
  548. /// </summary>
  549. public bool SetMaxNumAndNum(int maxNum)
  550. {
  551. if (maxNum < 0) maxNum = 0;
  552. lock (numLock)
  553. {
  554. this.num = this.maxNum = maxNum;
  555. }
  556. return maxNum > 0;
  557. }
  558. /// <summary>
  559. /// 应当保证该maxnum>=0
  560. /// </summary>
  561. public void SetPositiveMaxNumAndNum(int maxNum)
  562. {
  563. lock (numLock)
  564. {
  565. this.num = this.maxNum = maxNum;
  566. }
  567. }
  568. /// <summary>
  569. /// 应当保证该maxnum>=0
  570. /// </summary>
  571. public void SetPositiveMaxNum(int maxNum)
  572. {
  573. lock (numLock)
  574. {
  575. if ((this.maxNum = maxNum) < num)
  576. num = maxNum;
  577. }
  578. }
  579. /// <summary>
  580. /// 若maxNum<=0则maxNum及Num设为0并返回False
  581. /// </summary>
  582. public bool SetMaxNum(int maxNum)
  583. {
  584. if (maxNum < 0) maxNum = 0;
  585. lock (numLock)
  586. {
  587. if ((this.maxNum = maxNum) < num)
  588. num = maxNum;
  589. }
  590. return maxNum > 0;
  591. }
  592. /// <summary>
  593. /// 若num<0则num设为0并返回False
  594. /// </summary>
  595. public bool SetNum(int num)
  596. {
  597. lock (numLock)
  598. {
  599. if (num < 0)
  600. {
  601. this.num = 0;
  602. updateTime = Environment.TickCount64;
  603. return false;
  604. }
  605. if (num < maxNum)
  606. {
  607. if (this.num == maxNum) updateTime = Environment.TickCount64;
  608. this.num = num;
  609. }
  610. else this.num = maxNum;
  611. return true;
  612. }
  613. }
  614. /// <summary>
  615. /// 应当保证该num>=0
  616. /// </summary>
  617. public void SetPositiveNum(int num)
  618. {
  619. lock (numLock)
  620. {
  621. if (num < maxNum)
  622. {
  623. if (this.num == maxNum) updateTime = Environment.TickCount64;
  624. this.num = num;
  625. }
  626. else this.num = maxNum;
  627. }
  628. }
  629. public void SetCD(int cd)
  630. {
  631. lock (numLock)
  632. {
  633. if (cd <= 0) Debugger.Output("Bug:SetReturnOri IntNumUpdateByCD.cd to " + cd.ToString() + ".");
  634. this.cd = cd;
  635. }
  636. }
  637. }
  638. }