Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/03/08 21:53:41 (15 years ago)
Author:
gkronber
Message:

killed TrueConstraint and FalseConstraint (#416)

Location:
trunk/sources/HeuristicLab.Constraints
Files:
8 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Constraints/HeuristicLab.Constraints.csproj

    r852 r893  
    8484    </Compile>
    8585    <Compile Include="IntBoundedConstraint.cs" />
    86     <Compile Include="FalseConstraintView.cs">
    87       <SubType>UserControl</SubType>
    88     </Compile>
    89     <Compile Include="FalseConstraintView.Designer.cs">
    90       <DependentUpon>FalseConstraintView.cs</DependentUpon>
    91     </Compile>
    9286    <Compile Include="IntBoundedConstraintView.cs">
    9387      <SubType>UserControl</SubType>
     
    125119      <DependentUpon>OrConstraintView.cs</DependentUpon>
    126120    </Compile>
    127     <Compile Include="FalseConstraint.cs" />
    128121    <Compile Include="SubOperatorsConstraintAnalyser.cs" />
    129122    <Compile Include="SubOperatorsTypeConstraint.cs" />
     
    134127      <DependentUpon>SubOperatorsTypeConstraintView.cs</DependentUpon>
    135128    </Compile>
    136     <Compile Include="TrueConstraint.cs" />
    137129    <Compile Include="HeuristicLabConstraintsPlugin.cs" />
    138130    <Compile Include="Properties\AssemblyInfo.cs" />
    139     <Compile Include="TrueConstraintView.cs">
    140       <SubType>UserControl</SubType>
    141     </Compile>
    142     <Compile Include="TrueConstraintView.Designer.cs">
    143       <DependentUpon>TrueConstraintView.cs</DependentUpon>
    144     </Compile>
    145131    <Compile Include="VariableComparisonConstraint.cs" />
    146132    <Compile Include="VariableComparisonConstraintView.cs">
     
    182168      <DependentUpon>DoubleBoundedConstraintView.cs</DependentUpon>
    183169    </EmbeddedResource>
    184     <EmbeddedResource Include="FalseConstraintView.resx">
    185       <SubType>Designer</SubType>
    186       <DependentUpon>FalseConstraintView.cs</DependentUpon>
    187     </EmbeddedResource>
    188170    <EmbeddedResource Include="IntBoundedConstraintView.resx">
    189171      <SubType>Designer</SubType>
     
    209191      <DependentUpon>SubOperatorsTypeConstraintView.cs</DependentUpon>
    210192      <SubType>Designer</SubType>
    211     </EmbeddedResource>
    212     <EmbeddedResource Include="TrueConstraintView.resx">
    213       <SubType>Designer</SubType>
    214       <DependentUpon>TrueConstraintView.cs</DependentUpon>
    215193    </EmbeddedResource>
    216194    <EmbeddedResource Include="VariableComparisonConstraintView.resx">
  • trunk/sources/HeuristicLab.Constraints/NotConstraint.cs

    r764 r893  
    4444    public NotConstraint()
    4545      : base() {
    46       subConstraint = new FalseConstraint();
    4746    }
    4847
    4948    public override bool Check(IItem data) {
    50       return !subConstraint.Check(data);
     49      return (subConstraint == null) || (!subConstraint.Check(data));
    5150    }
    5251
     
    5857      NotConstraint clone = new NotConstraint();
    5958      clonedObjects.Add(Guid, clone);
    60       clone.SubConstraint = (ConstraintBase)SubConstraint.Clone();
     59      if (subConstraint != null)
     60        clone.SubConstraint = (ConstraintBase)SubConstraint.Clone();
    6161      return clone;
    6262    }
     
    6565    public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    6666      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    67       XmlNode sub = PersistenceManager.Persist("SubConstraint", SubConstraint, document, persistedObjects);
    68       node.AppendChild(sub);
     67      if (subConstraint != null) {
     68        XmlNode sub = PersistenceManager.Persist("SubConstraint", SubConstraint, document, persistedObjects);
     69        node.AppendChild(sub);
     70      }
    6971      return node;
    7072    }
     
    7274    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    7375      base.Populate(node, restoredObjects);
    74       subConstraint = (ConstraintBase)PersistenceManager.Restore(node.SelectSingleNode("SubConstraint"), restoredObjects);
     76      XmlNode subNode =  node.SelectSingleNode("SubConstraint");
     77      if(subNode!=null)
     78        subConstraint = (ConstraintBase)PersistenceManager.Restore(subNode, restoredObjects);
    7579    }
    7680    #endregion
  • trunk/sources/HeuristicLab.Constraints/NotConstraintView.cs

    r2 r893  
    9999          NotConstraint.SubConstraint = (ConstraintBase)Activator.CreateInstance(itemTypes[subConstraintComboBox.SelectedIndex]);
    100100        } catch (Exception) {
    101           NotConstraint.SubConstraint = new FalseConstraint();
     101          NotConstraint.SubConstraint = null;
    102102        }
    103103      }
Note: See TracChangeset for help on using the changeset viewer.