annotate api/Requirements/RequirementOR.cs @ 218:a1a6b527cd70

Re #226 * Fix missing "using" import caused by r419 no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Sat, 28 Nov 2009 16:22:11 +0000
parents 2f3cafb69799
children 6083010a005c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
104
2f3cafb69799 Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents: 82
diff changeset
1 // This file (RequirementOR.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2008, 2009 IBBoard.
15
306558904c2a Re #1 - LGPL license all code
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
2 //
104
2f3cafb69799 Re #121: Migrate to AGPL license
IBBoard <dev@ibboard.co.uk>
parents: 82
diff changeset
3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.
15
306558904c2a Re #1 - LGPL license all code
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
4
82
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
5 using System;
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 using System.Collections.Generic;
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 using IBBoard.Lang;
82
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
8 using IBBoard.WarFoundry.API.Objects;
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
9
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
10 namespace IBBoard.WarFoundry.API.Requirements
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
11 {
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
12 /// <summary>
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
13 /// Summary description for UnitRequirementOR.
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
14 /// </summary>
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
15 public class RequirementOR : AbstractRequirement
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
16 {
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
17 private static string or;
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
18
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
19 static RequirementOR()
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
20 {
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
21 or = Translation.GetTranslation("requirement_or", true);
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
22
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
23 if (or == null)
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
24 {
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
25 or = "{0} or {1}";
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
26 }
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
27 }
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
28
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
29 private AbstractRequirement reqA, reqB;
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
30
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
31 public RequirementOR(AbstractRequirement requirementA, AbstractRequirement requirementB)
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
32 {
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
33 reqA = requirementA;
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
34 reqB = requirementB;
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
35 }
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
36
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
37 public override AbstractFailedRequirement CanAddToWarFoundryObject(WarFoundryObject obj)
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
38 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
39 FailedRequirement failed = null;
82
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
40
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
41 if (reqA.CanAddToWarFoundryObject(obj) !=null && reqB.CanAddToWarFoundryObject(obj)!=null)
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
42 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
43 failed = new FailedRequirement(this);
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
44 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
45
82
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
46 return failed;
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
47 }
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
48
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
49 public override AbstractFailedRequirement CanRemoveFromWarFoundryObject(WarFoundryObject obj)
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
50 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
51 FailedRequirement failed = null;
82
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
52
0
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
53 if (reqA.CanRemoveFromWarFoundryObject(obj)!=null && reqB.CanRemoveFromWarFoundryObject(obj)!=null)
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
54 {
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
55 failed = new FailedRequirement(this);
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
56 }
520818033bb6 Initial commit of WarFoundry code
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
57
82
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
58 return failed;
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
59 }
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
60
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
61 public override string Description
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
62 {
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
63 get { return String.Format(or, reqA.Description, reqB.Description); }
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
64 }
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
65 }
3ea0ab04352b * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 15
diff changeset
66 }