Mercurial > repos > IBDev-IBBoard.WarFoundry.API
diff api/Requirements/RequirementAND.cs @ 0:520818033bb6
Initial commit of WarFoundry code
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Fri, 19 Dec 2008 15:57:51 +0000 |
parents | |
children | 306558904c2a |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/api/Requirements/RequirementAND.cs Fri Dec 19 15:57:51 2008 +0000 @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using IBBoard.Lang; +using IBBoard.WarFoundry.API.Objects; + +namespace IBBoard.WarFoundry.API.Requirements +{ + /// <summary> + /// Summary description for RequirementAND. + /// </summary> + public class RequirementAND : AbstractRequirement + { + private static string and; + + static RequirementAND() + { + and = Translation.GetTranslation("requirement_and", true); + + if (and == null) + { + and = "{0}; and {1}"; + } + } + + private AbstractRequirement reqA, reqB; + + public RequirementAND(AbstractRequirement requirementA, AbstractRequirement requirementB) + { + reqA = requirementA; + reqB = requirementB; + } + + public override AbstractFailedRequirement CanAddToWarFoundryObject(WarFoundryObject obj) + { + FailedRequirement failed = null; + + if (reqA.CanAddToWarFoundryObject(obj) !=null || reqB.CanAddToWarFoundryObject(obj)!=null) + { + failed = new FailedRequirement(this); + } + + return failed; + } + + public override AbstractFailedRequirement CanRemoveFromWarFoundryObject(WarFoundryObject obj) + { + FailedRequirement failed = null; + + if (reqA.CanRemoveFromWarFoundryObject(obj) !=null || reqB.CanRemoveFromWarFoundryObject(obj)!=null) + { + failed = new FailedRequirement(this); + } + + return failed; + } + + public override string Description + { + get { return String.Format(and, reqA.Description, reqB.Description); } + } + } +}