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