<?xml version="1.0" encoding="UTF-8"?>
<config title="appartments">

<!--  <DBURL>jdbc:mysql://localhost:3306/test?user=mylogin&amp;password=mypwd</DBURL> -->
  <DBURL>jdbc:derby:databases/derby/testdb;create=false</DBURL>

  <fromClause>appartement left join timeFromZipCode on (appartement.npa = timeFromZipCode.zipcode)</fromClause>

  <preferencesAllowed>true</preferencesAllowed>
  <prospectiveAnalysisDisplayed>false</prospectiveAnalysisDisplayed>
  <conflictAnalysisDisplayed>true</conflictAnalysisDisplayed>
  <exampleDisplayed>true</exampleDisplayed>
  <contextualToolTipDisplayed>false</contextualToolTipDisplayed>

<!--  <itemTableRendererClassName>external.CarItemTableRenderer</itemTableRendererClassName> -->
  <criteriaPanelWidth>390</criteriaPanelWidth>

  <initFunction>function booleanText(valueId, trueText, falseText) { if (valueId == true) return trueText; else if (valueId == false) return falseText; else return null; }
                function booleanWithText(valueId, attributeLabel) { if (valueId == true) return 'with ' + attributeLabel; else if (valueId == false) return 'without ' + attributeLabel; else return null; }
  </initFunction>


  <attribute id="loyer" label="rent" particular="true" type="number" defaultConstraintType="lessThanOrEqual" 
	     helpPrompt="this is the rent in CHF per month, without including the taxes." 
	     valueStringFunction="utils.toInt(valueId) + ' CHF'"
	     withConstraintStringFunction ="     if (constraintType=='ecatalog.db.LessThanOrEqualConstraint') 'for ' + utils.toInt(valueId) + ' CHF or less';
                                            else if (constraintType=='ecatalog.db.MoreThanOrEqualConstraint') 'for ' + utils.toInt(valueId) + ' CHF or more';
					    else null;"

	     relaxConstraintStringFunction="     if (constraintType=='ecatalog.db.LessThanOrEqualConstraint') 'maximum rent to ' + utils.toInt(valueId) + ' CHF';
                                            else if (constraintType=='ecatalog.db.MoreThanOrEqualConstraint') 'minimum rent to ' + utils.toInt(valueId) + ' CHF';
					    else null;"
     defaultConstraintIndex="1">
    <constraint className="ecatalog.gui.criteriaSelection.SimpleAttributeConstraintGui">
      <cconfig type="EQUAL" penaltyClassName="ecatalog.db.SimpleShapePenaltyFunction"><pconfig type="EQUAL" offsetFraction="0.4"/></cconfig>
    </constraint>

    <constraint className="ecatalog.gui.criteriaSelection.SimpleAttributeConstraintGui">
      <cconfig type="LESS_THAN_OR_EQUAL" penaltyClassName="ecatalog.db.SimpleShapePenaltyFunction"><pconfig type="LESS" offsetFraction="0.4"/></cconfig>
    </constraint>

    <constraint className="ecatalog.gui.criteriaSelection.SimpleAttributeConstraintGui">
      <cconfig type="MORE_THAN_OR_EQUAL" penaltyClassName="ecatalog.db.SimpleShapePenaltyFunction"><pconfig type="MORE" offsetFraction="0.4"/></cconfig>
    </constraint>
  </attribute>


  <attribute id="nbrpieces" label="Nbr of rooms" type="number" defaultConstraintType="moreThanOrEqual" 
	     helpPrompt="the number of pieces of the appartment, without counting the kitchen (Lausanne style)" 
	     valueStringFunction="utils.toInt(valueId) + ' rooms'"
	     withConstraintStringFunction ="     if (constraintType=='ecatalog.db.LessThanOrEqualConstraint') '' + utils.toInt(valueId) + ' rooms or less';
                                            else if (constraintType=='ecatalog.db.MoreThanOrEqualConstraint') '' + utils.toInt(valueId) + ' rooms or more';
					    else null;"

	     relaxConstraintStringFunction="     if (constraintType=='ecatalog.db.LessThanOrEqualConstraint') 'maximum to ' + utils.toInt(valueId) + ' rooms';
                                            else if (constraintType=='ecatalog.db.MoreThanOrEqualConstraint') 'minimum to ' + utils.toInt(valueId) + ' rooms';
					    else null;"
	     defaultConstraintIndex="2">
    <constraint className="ecatalog.gui.criteriaSelection.SimpleAttributeConstraintGui"><cconfig type="EQUAL"/></constraint>
    <constraint className="ecatalog.gui.criteriaSelection.SimpleAttributeConstraintGui"><cconfig type="LESS_THAN_OR_EQUAL"/></constraint>
    <constraint className="ecatalog.gui.criteriaSelection.SimpleAttributeConstraintGui"><cconfig type="MORE_THAN_OR_EQUAL"/></constraint>
  </attribute>


  <attribute id="localite" label="Location"  helpPrompt="the city/commune" withConstraintStringFunction = '"in \"" + valueId + "\""'
	     defaultConstraintIndex="1">
    <constraint className="ecatalog.gui.criteriaSelection.SimpleAttributeConstraintGui"><cconfig type="EQUAL"/></constraint>
    <constraint className="ecatalog.gui.criteriaSelection.MultipleValuesConstraintGui"><cconfig type="INCLUDE"/></constraint>
    <constraint className="ecatalog.gui.criteriaSelection.MultipleValuesConstraintGui"><cconfig type="EXCLUDE"/></constraint>
  </attribute>



<!--
  <attribute id="npa" label="zip code" type="number" 
	     helpPrompt="the zip code"
	     valueStringFunction="utils.toInt(valueId)"/>
-->

  <attribute id="minutesToUnil" label="time to unil" type="number" defaultConstraintType="lessThanOrEqual"
	     helpPrompt="time in minutes to Unil by car" 
	     valueStringFunction="utils.toInt(valueId) + ' min'"
	     withConstraintStringFunction ="     if (constraintType=='ecatalog.db.LessThanOrEqualConstraint') '' + utils.toInt(valueId) + ' min or less to UNIL';
                                            else if (constraintType=='ecatalog.db.MoreThanOrEqualConstraint') '' + utils.toInt(valueId) + ' min or less to UNIL';
					    else null;"

	     relaxConstraintStringFunction="     if (constraintType=='ecatalog.db.LessThanOrEqualConstraint') 'maximum to ' + utils.toInt(valueId) + ' min to UNIL';
                                            else if (constraintType=='ecatalog.db.MoreThanOrEqualConstraint') 'minimum to ' + utils.toInt(valueId) + ' min to UNIL';
					    else null;"
     defaultConstraintIndex="1">
    <constraint className="ecatalog.gui.criteriaSelection.SimpleAttributeConstraintGui">
      <cconfig type="EQUAL" penaltyClassName="ecatalog.db.SimpleShapePenaltyFunction"><pconfig type="EQUAL" offsetFraction="0.4"/></cconfig>
    </constraint>

    <constraint className="ecatalog.gui.criteriaSelection.SimpleAttributeConstraintGui">
      <cconfig type="LESS_THAN_OR_EQUAL" penaltyClassName="ecatalog.db.SimpleShapePenaltyFunction"><pconfig type="LESS" offsetFraction="0.4"/></cconfig>
    </constraint>

    <constraint className="ecatalog.gui.criteriaSelection.SimpleAttributeConstraintGui">
      <cconfig type="MORE_THAN_OR_EQUAL" penaltyClassName="ecatalog.db.SimpleShapePenaltyFunction"><pconfig type="MORE" offsetFraction="0.4"/></cconfig>
    </constraint>
  </attribute>

  <attribute id="minutesToCenter" label="time to center" type="number" defaultConstraintType="lessThanOrEqual"
	     helpPrompt="time in minutes to the center of Lausanne by car"
	     valueStringFunction="utils.toInt(valueId) + ' min'"
	     withConstraintStringFunction ="     if (constraintType=='ecatalog.db.LessThanOrEqualConstraint') '' + utils.toInt(valueId) + ' min or less to center';
                                            else if (constraintType=='ecatalog.db.MoreThanOrEqualConstraint') '' + utils.toInt(valueId) + ' min or more to center';
					    else null;"

	     relaxConstraintStringFunction="     if (constraintType=='ecatalog.db.LessThanOrEqualConstraint') 'maximum to ' + utils.toInt(valueId) + ' min to center';
                                            else if (constraintType=='ecatalog.db.MoreThanOrEqualConstraint') 'minimum to ' + utils.toInt(valueId) + ' min to center';
					    else null;"
     defaultConstraintIndex="1">
    <constraint className="ecatalog.gui.criteriaSelection.SimpleAttributeConstraintGui">
      <cconfig type="EQUAL" penaltyClassName="ecatalog.db.SimpleShapePenaltyFunction"><pconfig type="EQUAL" offsetFraction="0.4"/></cconfig>
    </constraint>

    <constraint className="ecatalog.gui.criteriaSelection.SimpleAttributeConstraintGui">
      <cconfig type="LESS_THAN_OR_EQUAL" penaltyClassName="ecatalog.db.SimpleShapePenaltyFunction"><pconfig type="LESS" offsetFraction="0.4"/></cconfig>
    </constraint>

    <constraint className="ecatalog.gui.criteriaSelection.SimpleAttributeConstraintGui">
      <cconfig type="MORE_THAN_OR_EQUAL" penaltyClassName="ecatalog.db.SimpleShapePenaltyFunction"><pconfig type="MORE" offsetFraction="0.4"/></cconfig>
    </constraint>
  </attribute>

  <attribute id="cuisine" label="kitchen" type="boolean" helpPrompt="do you need a kitchen?" textYes="with kitchen" textNo="without kitchen"
	     withConstraintStringFunction ="booleanWithText(valueId, 'kitchen');"/>

  <attribute id="salle_bain" label="bathroom" type="boolean" helpPrompt="do you want to have a bathroom?" textYes="with bathroom" textNo="without bathroom"
	     withConstraintStringFunction ="booleanWithText(valueId, 'bathroom');"/>

  <attribute id="meuble" label="furnished" type="boolean" helpPrompt="do you want it furnished?" textYes="furnished" textNo="not furnished"
	     withConstraintStringFunction ="booleanText(valueId, 'furnished', 'not furnished');"/>

  <attribute id="bus" label="bus" type="boolean" helpPrompt="do you want to be close to a bus station?" textYes="with bus" textNo="without bus"
	     withConstraintStringFunction ="booleanWithText(valueId, 'bus');"/>

  <attribute id="metrom1" label="metro m1" type="boolean" helpPrompt="do you want to be close to a metro m1 station?" textYes="with metro m1" textNo="without metro m1"
	     withConstraintStringFunction ="booleanWithText(valueId, 'metro');"/>

  <attribute id="stationnement" label="parking" type="boolean" helpPrompt="do you need a parking place?" textYes="with parking" textNo="without parking"
	     withConstraintStringFunction ="booleanWithText(valueId, 'parking');"/>


  <attribute id="id" label="id" defaultConstraintIndex="-1"/>

<!--
  <attribute id="balcon" label="balcony" type="boolean" helpPrompt="do you want a balcon?" textYes="with balcony" textNo="without balcony"
	     withConstraintStringFunction ="booleanWithText(valueId, 'balcon');"/>

  <attribute id="vue" label="view" type="boolean" helpPrompt="do you want to have a good vue?" textYes="with view" textNo="without view"
	     withConstraintStringFunction ="booleanWithText(valueId, 'view');"/>

  <attribute id="tranquilite" label="calm" type="boolean" helpPrompt="should it be a silence area?" textYes="calm" textNo="not calm"
	     withConstraintStringFunction ="booleanWithText(valueId, 'calm');"/>


  <attribute id="gerance" label="gerance" type="boolean" helpPrompt="do you want the appartment to be managed by a gerance?" textYes="with gerance" textNo="without gerance"
	     withConstraintStringFunction ="booleanWithText(valueId, 'gerance');"/>

  <attribute id="proprietaire_prive" label="private property" type="boolean" helpPrompt="?????" textYes="with private property" textNo="without private property"
	     withConstraintStringFunction ="booleanWithText(valueId, 'private property');"/>

  <attribute id="cuisine_partagee" label="cuisine_partagee" type="boolean" relevantOn="cuisine=1" helpPrompt="if you need a kitchen, should it be shared or private?"/>
  <attribute id="cuisine_agencee" label="cuisine_agencee" type="boolean" relevantOn="cuisine=1" helpPrompt="if you need a kitchen, should it be already there or you would buy your own?"/>
  <attribute id="cuisine_rechaudpossible" label="cuisine_rechaudpossible" type="boolean" relevantOn="cuisine=1" helpPrompt="????"/>

  <attribute id="salle_bain_partagee" label="salle_bain_partagee" type="boolean" relevantOn="salle_bain=1" helpPrompt="if you want a bathroom, should it be shared or private?"/>
  <attribute id="salle_bain_douche" label="salle_bain_douche" type="boolean" relevantOn="salle_bain=1" helpPrompt="if you want a bathroom, should it have a shower?"/>
  <attribute id="salle_bain_baignore" label="salle_bain_baignore" type="boolean" relevantOn="salle_bain=1" helpPrompt="if you want a bathroom, should it have a '?bathtub'?"/>
-->
<!--
  <attribute id="remarque" label="remarque" particular="true" helpPrompt="this is a comment from the appartment's owner"/>
  <attribute id="adresse" label="adresse" particular="true" helpPrompt="The address of the appartment"/>
  <attribute id="id" label="id" type="id" helpPrompt="this is a unique identifier of the appartment"/>
  <attribute id="dateoffre" label="dateoffre" particular="true" helpPrompt="the appartment is available at this date"/>
  <attribute id="nbrpersones" label="nbrpersones" helpPrompt="this is a subjective information of how many people could live in this appartment. While 1 person could live in a 4 pieces appartment alone, living 4 persons in a 1 piece appartment does not seem reasonable"/>
-->


</config>

