public Template(string name, float length, float heightAboveFloor, float height, ComponentType type) { if (!(type.Equals(ComponentType.DOOR) || type.Equals(ComponentType.WINDOW))) { throw new InvalidTemplateTypeException(); } if (String.IsNullOrEmpty(name)) { throw new EmptyTemplateNameException(); } if (heightAboveFloor < 0 || heightAboveFloor > Constants.MAX_HEIGHT_ABOVE_FLOOR) { throw new InvalidTemplateDimensionException("Height above floor must be between " + 0 + " and " + Constants.MAX_HEIGHT_ABOVE_FLOOR); } if (height <= 0 || (height + heightAboveFloor) >= Constants.WALL_HEIGHT) { throw new InvalidTemplateDimensionException("Height must be more than " + 0 + " and less than" + Constants.WALL_HEIGHT); } if (length <= 0 || length > Constants.MAX_OPENING_LENGTH) { throw new InvalidTemplateDimensionException("Length must be more than " + 0 + " and less than" + Constants.MAX_OPENING_LENGTH); } if (type.Equals(ComponentType.DOOR) && heightAboveFloor > 0) { throw new InvalidDoorTemplateException(); } //a way to ignore cases in equal names. this.name = name.ToUpper(); this.length = length; this.heightAboveFloor = heightAboveFloor; this.height = height; this.type = type; }
public bool Equals(State other) { return(Trait.Equals(other.Trait) && ValueString.Equals(other.ValueString) && IsNegative.Equals(other.IsNegative) && Target.Equals(other.Target)); }
public bool Equals(RhythmCommandResource other) { return(Identifier.Equals(other.Identifier)); }