15
|
1 // This file (RequirementAND.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2009 IBBoard.
|
|
2 //
|
|
3 // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license.
|
|
4
|
0
|
5 using System;
|
|
6 using System.Collections.Generic;
|
|
7 using IBBoard.Lang;
|
|
8 using IBBoard.WarFoundry.API.Objects;
|
|
9
|
|
10 namespace IBBoard.WarFoundry.API.Requirements
|
|
11 {
|
|
12 /// <summary>
|
|
13 /// Summary description for RequirementAND.
|
|
14 /// </summary>
|
|
15 public class RequirementAND : AbstractRequirement
|
|
16 {
|
|
17 private static string and;
|
|
18
|
|
19 static RequirementAND()
|
|
20 {
|
|
21 and = Translation.GetTranslation("requirement_and", true);
|
|
22
|
|
23 if (and == null)
|
|
24 {
|
|
25 and = "{0}; and {1}";
|
|
26 }
|
|
27 }
|
|
28
|
|
29 private AbstractRequirement reqA, reqB;
|
|
30
|
|
31 public RequirementAND(AbstractRequirement requirementA, AbstractRequirement requirementB)
|
|
32 {
|
|
33 reqA = requirementA;
|
|
34 reqB = requirementB;
|
|
35 }
|
|
36
|
|
37 public override AbstractFailedRequirement CanAddToWarFoundryObject(WarFoundryObject obj)
|
|
38 {
|
|
39 FailedRequirement failed = null;
|
|
40
|
|
41 if (reqA.CanAddToWarFoundryObject(obj) !=null || reqB.CanAddToWarFoundryObject(obj)!=null)
|
|
42 {
|
|
43 failed = new FailedRequirement(this);
|
|
44 }
|
|
45
|
|
46 return failed;
|
|
47 }
|
|
48
|
|
49 public override AbstractFailedRequirement CanRemoveFromWarFoundryObject(WarFoundryObject obj)
|
|
50 {
|
|
51 FailedRequirement failed = null;
|
|
52
|
|
53 if (reqA.CanRemoveFromWarFoundryObject(obj) !=null || reqB.CanRemoveFromWarFoundryObject(obj)!=null)
|
|
54 {
|
|
55 failed = new FailedRequirement(this);
|
|
56 }
|
|
57
|
|
58 return failed;
|
|
59 }
|
|
60
|
|
61 public override string Description
|
|
62 {
|
|
63 get { return String.Format(and, reqA.Description, reqB.Description); }
|
|
64 }
|
|
65 }
|
|
66 }
|