001    /*
002    
003      $Id: CVSConflictResponse.java,v 1.3 2003/03/23 19:18:27 culdesac Exp $
004    
005    */
006    
007    package sharpster.common;
008    
009    import sharpster.common.FileCollection;
010    import sharpster.common.Response;
011    import java.io.Serializable;
012    
013    /**
014     * A response containing information about a CVS conflict.
015     */
016    public class CVSConflictResponse extends Response implements Serializable {
017    
018        /**
019         * A collection of files that caused the conflict.
020         */
021        private FileCollection files;
022     
023        /**
024         * Returns the type of this response.
025         */
026        public int getType() {
027            return sharpster.common.ResponseType.CVS_CONFLICT;
028        }    
029    
030        /**
031         * Returns the FileCollection with information about the files 
032         * which has caused the conflict.
033         */
034        public FileCollection getFiles() {
035            return files;
036        }
037    
038        /**
039         * Sets the FileCollection with information about the files which 
040         * has caused the conflict.
041         */
042        public void setFiles(FileCollection files) {
043            this.files = files;
044        }
045    
046        public String toString() {
047            String msg = super.toString();
048    
049            msg = "CVS conflict response\n" + msg;
050            msg += "- Files: ";
051    
052            for(int i=0;i<files.getFileCount();i++) {
053                SharedFile file = files.getFile(i);
054                if(file != null) {
055                    msg += file.getFileName() + "\n";
056                }
057            }
058    
059            return msg;
060        }
061    }