Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/28/16 18:32:54 (8 years ago)
Author:
gkronber
Message:

#1966: changed PackingShapes to ParameterizedItems

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Shapes/CuboidPackingShape.cs

    r13497 r13574  
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2727using HeuristicLab.Common;
     28using HeuristicLab.Data;
     29using HeuristicLab.Parameters;
    2830using HeuristicLab.Problems.BinPacking.Dimensions;
    2931
     
    3335  public abstract class CuboidPackingShape : PackingShape<ThreeDimensionalPacking>, IRegularPackingShape, IComparable<CuboidPackingShape> {
    3436    #region Properties
    35     /// <summary>
    36     /// Describes the size on the X-axis
    37     /// </summary>   
    38     [Storable]
    39     public int Width { get; set; }
    40     /// <summary>
    41     /// Describes the size on the Y-axis
    42     /// </summary>   
    43     [Storable]
    44     public int Height { get; set; }
    45     /// <summary>
    46     /// Describes the size on the Z-axis
    47     /// </summary> 
    48     [Storable]
    49     public int Depth { get; set; }
     37    public int Height {
     38      get { return ((IFixedValueParameter<IntValue>)Parameters["Height"]).Value.Value; }
     39      set { ((IFixedValueParameter<IntValue>)Parameters["Height"]).Value.Value = value; }
     40    }
     41
     42    public int Width {
     43      get { return ((IFixedValueParameter<IntValue>)Parameters["Width"]).Value.Value; }
     44      set { ((IFixedValueParameter<IntValue>)Parameters["Width"]).Value.Value = value; }
     45    }
     46
     47    public int Depth {
     48      get { return ((IFixedValueParameter<IntValue>)Parameters["Depth"]).Value.Value; }
     49      set { ((IFixedValueParameter<IntValue>)Parameters["Depth"]).Value.Value = value; }
     50    }
     51
    5052    #endregion
    5153
     
    101103    #endregion
    102104
    103     protected CuboidPackingShape(int width, int height, int depth)
    104       : base() {
    105       this.Width = width;
    106       this.Height = height;
    107       this.Depth = depth;
    108     }
     105
    109106
    110107    public override void InitializeFromMeasures(int[] measures) {
     
    119116    }
    120117
     118
     119    protected CuboidPackingShape()
     120      : base() {
     121      Parameters.Add(new FixedValueParameter<IntValue>("Width"));
     122      Parameters.Add(new FixedValueParameter<IntValue>("Height"));
     123      Parameters.Add(new FixedValueParameter<IntValue>("Depth"));
     124    }
     125
     126    protected CuboidPackingShape(int width, int height, int depth)
     127      : this() {
     128      this.Width = width;
     129      this.Height = height;
     130      this.Depth = depth;
     131    }
     132
    121133    [StorableConstructor]
    122134    protected CuboidPackingShape(bool deserializing) : base(deserializing) { }
    123135    protected CuboidPackingShape(CuboidPackingShape original, Cloner cloner)
    124136      : base(original, cloner) {
    125       this.Width = original.Width;
    126       this.Height = original.Height;
    127       this.Depth = original.Depth;
    128137    }
    129 
    130     protected CuboidPackingShape() : base() { }
    131138
    132139    public override string ToString() {
Note: See TracChangeset for help on using the changeset viewer.