/// <summary> /// Add the given <see cref="IZincItem"/> to this <see cref="IZincModel"/>, but only if it is valid in MiniZinc. /// </summary> /// <param name="item">The given <see cref="IZincItem"/> to be added.</param> /// <remarks> /// <para>If an invalid item is added, nothing happens, but a warning is printed.</para> /// </remarks> public override void AddItem(IZincItem item) { if (item != null) { switch (item.Type) { case ZincItemType.Include: case ZincItemType.VarDecl: case ZincItemType.Assign: case ZincItemType.Constraint: case ZincItemType.Solve: case ZincItemType.Output: case ZincItemType.Predicate: case ZincItemType.Function: this.items.Add(item); break; case ZincItemType.TypeInstanceSynonym: case ZincItemType.Enum: case ZincItemType.Test: Interaction.Warning("Items of type \"{0}\" are part of Zinc but not of MiniZinc.", item.Type); break; default: Interaction.Warning("A ZincItem was found with an type that cannot be added to a ZincModel. Probably you are running an outdated version of ZincOxide."); break; } } }
public override void AddItem(IZincItem item) { if (item != null) { switch (item.Type) { case ZincItemType.Assign: this.AddAssignItem(item as ZincAssignItem); break; default: throw new ZincOxideMiniZincException("Only assign items are valid items in a MiniZinc data file."); } } }
public abstract void AddItem(IZincItem item);
/// <summary> /// Add the given <see cref="IZincItem"/> to this <see cref="IZincModel"/>, but only if it is valid in MiniZinc. /// </summary> /// <param name="item">The given <see cref="IZincItem"/> to be added.</param> /// <remarks> /// <para>If an invalid item is added, nothing happens, but a warning is printed.</para> /// </remarks> public override void AddItem(IZincItem item) { if (item != null) { switch (item.Type) { case ZincItemType.Include: case ZincItemType.VarDecl: case ZincItemType.Assign: case ZincItemType.Constraint: case ZincItemType.Solve: case ZincItemType.Output: case ZincItemType.Predicate: case ZincItemType.Function: this.items.Add (item); break; case ZincItemType.TypeInstanceSynonym: case ZincItemType.Enum: case ZincItemType.Test: Interaction.Warning ("Items of type \"{0}\" are part of Zinc but not of MiniZinc.", item.Type); break; default : Interaction.Warning ("A ZincItem was found with an type that cannot be added to a ZincModel. Probably you are running an outdated version of ZincOxide."); break; } } }
public override void AddItem(IZincItem item) { if (item != null) { switch (item.Type) { case ZincItemType.Assign: this.AddAssignItem (item as ZincAssignItem); break; default: throw new ZincOxideMiniZincException ("Only assign items are valid items in a MiniZinc data file."); } } }