CS 4773 Object Oriented Systems, Spring 2005 Project Designs, Part 2
General
- See the CS4773Editor2 project on jbuilder_public.
- Each group will use a package based on the group name.
- The package for group n will be cs3773.editor.groupn
- Example: the code generated by group 1 will be in the package:
cs4773.editor.group1.
- Each class that will be used by another group will create a
Version object, version, and call
Editor.registerVersion(version).
- In addition to the capabilities described below, the classes will have
to provide information to the Inspector class.
Groups 1 and 2: GUI
- Each group will produce a class, GUI, that implements UserInterface.
- The constructor will take no parameters.
- Each UserInterface will have a 0 or more EditingSessions.
- The public methods will include:
- public void addSession(EdiingSession session);
Adds this session to those known by the UserInterface
- public void removeSession(EditingSession session);
This removes the session if it is there.
No action is taken if this UserInput does not contain the session.
- public void getSessionCount
Returns the number of sessions for this UserInterface.
- All of the setChanged methods in UserInterface.
- In addition, there will be a way for the user to have the method
Editor.showInspector(int x, int y) to be called.
The parameters give the location of the inspector window.
Groups 3 and 4: Some commands
- These group will create classes like CommandExecuterSearch
and CommandExecuterCursor that
will extend the abstract class CommandExecuter.
- Each group will create a class called CommandExecuterRegister
containing one static method registerExecuters as in the example.
It will register each of the classes that extend CommandExecuter.
- The only public methods in the classes that extend CommandExectuer
are the ones in the abstract class.
Group 5: CommandDecoder and CommandThread
- The CommandDecoder will have a constructor like in the example
- It will create a CommandThread for executing commands.
- The CommandDecoder class will have the following two public methods:
- public RawCommand decodeCommand(String s)
which will make a RawCommand from a String or return
null if the command cannot be decoded.
- public void insertInQueue(RawCommand cmd)
which will insert a RawCommand in the queue of the CommandThread.
- The CommandThread will have the public methods indicated in the
example code.
Group 6: Inspector and Error Handler
- The EditorInspector class will have a constructor with no parameters.
- The EditorInspector class will have three public methods:
- public void show()
- public void show(int x, int y)
- These show the inspector, the last of these puts it at the given location.
- The ErrorHandler class will have a constructor with no parameters.
- The ErrorHandler class will have the following public methods:
- public void logError(String s)
- public void logMessage(String s)
- public void logDebug(String s)
- There may need to be several classes that extend ErrorHandler
depending on the needs of the GUIs. Some GUIs might want the errors
displayed as part the the user interface.
Group 7: EditingSession and EditorFile
- EditingSession will have a private constructor as in the example.
- An EditingSession has a local name in addition to the
unique name kept by the EditorFile.
- An EditingSession has a unique id.
- EditingSession will have the following public methods:
- static EditingSession openEditingSession(String localName,
UserInterface gui)
This makes a new EditingSession corresponding to the given
name and associates it with the given user interface.
- public void close()
This removes all references to the session.
- public int getCursorPosition()
- public void setCursorPosition(int pos)
- public int getCursorLine()
- public void setCursorLine(int ln)
- public int getNumberLines()
- public int getId()
- public CommandDecoder getCommandDecoder()
- public UserInterface getUserInterface()
- public boolean changeUserInterface(int id)
- public void inspect()
- public String getLongDescriptor(int n)
Like in the example for use by the inspector.
- public String getShortDescriptor()
Like in the example for use by the inspector.
- public String getLineNumber(int n)
Returns the nth line of the corresponding file.
- public boolean replaceLinenumber(int , String s)
Replaces the corresponding line if possible and returns true if
successful.
- Any other primitive commands needed by the other groups.
- EditorFile will have a private constructor as in the example.
- An EditorFile will have a unique id and 1 or more
EditingSessions.
- EditorFile will have the following public methods:
- public static EditorFile createEditorFile(String name)
This returns a new EditorFile corresponding to the given
unique name if the file exits.
- public static EditorFile newEditorFile(String name)
This returns a new EditorFile corresponding to the given
unique name assuming the file did not exist. An empty file on
disk is created.
- public String getUniqueName()
- public int getId()
- public void addSession(EditingSession es)
- public boolean removeSession(EditingSession session)
Removes the session if found and returns true.
Otherwise it returns false and does nothing.
- public boolean removeSession(int id)
As above but uses the id.
- public int getSessionCount()
- public int[] getSessionIds()
Returns an array containing the session ids for this file.
- public int getNumItems()
Returns the number of lines int he file.
- public String getDescriptor()
Returns a descriptor for use by the inspector.
- public void inspect()
Shows an inspector for the given file.
This will call be coordinated with the inspector.
- public EditingSession getSession(int id)
Returns the corresponding session if one exists for this file and
returns true. Otherwise it returns false and does nothing.