001/** 002 * TravelDescription.java 003 * jCOLIBRI2 framework. 004 * @author Juan A. Recio-Garc�a. 005 * GAIA - Group for Artificial Intelligence Applications 006 * http://gaia.fdi.ucm.es 007 * 10/01/2007 008 */ 009package es.ucm.fdi.gaia.jcolibri.test.test3; 010 011import es.ucm.fdi.gaia.jcolibri.cbrcore.Attribute; 012 013 014/** 015 * Bean that stores the description of the case. 016 * This version includes a compound attribute to store the region. 017 * @author Juan A. Recio-Garcia 018 * @version 1.0 019 * @see es.ucm.fdi.gaia.jcolibri.test.test3.Region 020 */ 021public class TravelDescription implements es.ucm.fdi.gaia.jcolibri.cbrcore.CaseComponent { 022 023 enum AccommodationTypes { OneStar, TwoStars, ThreeStars, HolidayFlat, FourStars, FiveStars}; 024 025 String caseId; 026 String HolidayType; 027 Integer Price; 028 Integer NumberOfPersons; 029 Region Region; 030 String Transportation; 031 Integer Duration; 032 String Season; 033 AccommodationTypes Accommodation; 034 String Hotel; 035 036 037 public String toString() 038 { 039 return "("+caseId+";"+HolidayType+";"+Price+";"+NumberOfPersons+";"+Region+";"+Transportation+";"+Duration+";"+Season+";"+Accommodation+";"+Hotel+")"; 040 } 041 042 /** 043 * @return the accomodation 044 */ 045 public AccommodationTypes getAccommodation() { 046 return Accommodation; 047 } 048 /** 049 * @param accomodation the accomodation to set 050 */ 051 public void setAccommodation(AccommodationTypes accomodation) { 052 Accommodation = accomodation; 053 } 054 /** 055 * @return the caseId 056 */ 057 public String getCaseId() { 058 return caseId; 059 } 060 /** 061 * @param caseId the caseId to set 062 */ 063 public void setCaseId(String caseId) { 064 this.caseId = caseId; 065 } 066 /** 067 * @return the duration 068 */ 069 public Integer getDuration() { 070 return Duration; 071 } 072 /** 073 * @param duration the duration to set 074 */ 075 public void setDuration(Integer duration) { 076 Duration = duration; 077 } 078 /** 079 * @return the holidayType 080 */ 081 public String getHolidayType() { 082 return HolidayType; 083 } 084 /** 085 * @param holidayType the holidayType to set 086 */ 087 public void setHolidayType(String holidayType) { 088 HolidayType = holidayType; 089 } 090 /** 091 * @return the hotel 092 */ 093 public String getHotel() { 094 return Hotel; 095 } 096 /** 097 * @param hotel the hotel to set 098 */ 099 public void setHotel(String hotel) { 100 Hotel = hotel; 101 } 102 /** 103 * @return the numberOfPersons 104 */ 105 public Integer getNumberOfPersons() { 106 return NumberOfPersons; 107 } 108 /** 109 * @param numberOfPersons the numberOfPersons to set 110 */ 111 public void setNumberOfPersons(Integer numberOfPersons) { 112 NumberOfPersons = numberOfPersons; 113 } 114 /** 115 * @return the price 116 */ 117 public Integer getPrice() { 118 return Price; 119 } 120 /** 121 * @param price the price to set 122 */ 123 public void setPrice(Integer price) { 124 Price = price; 125 } 126 /** 127 * @return the region 128 */ 129 public Region getRegion() { 130 return Region; 131 } 132 /** 133 * @param region the region to set 134 */ 135 public void setRegion(Region region) { 136 Region = region; 137 } 138 /** 139 * @return the season 140 */ 141 public String getSeason() { 142 return Season; 143 } 144 /** 145 * @param season the season to set 146 */ 147 public void setSeason(String season) { 148 Season = season; 149 } 150 /** 151 * @return the transportation 152 */ 153 public String getTransportation() { 154 return Transportation; 155 } 156 /** 157 * @param transportation the transportation to set 158 */ 159 public void setTransportation(String transportation) { 160 Transportation = transportation; 161 } 162 163 public static void main(String[] args) { 164 TravelDescription t = new TravelDescription(); 165 t.setAccommodation(AccommodationTypes.ThreeStars); 166 Attribute at = new Attribute("Accommodation", TravelDescription.class); 167 try { 168 System.out.println(at.getValue(t)); 169 } catch (Exception e) { 170 e.printStackTrace(); 171 } 172 } 173 174 public Attribute getIdAttribute() { 175 return new Attribute("caseId", this.getClass()); 176 } 177}