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