();
56 | String command;
57 |
58 | if (isWindows()) {
59 | command = "C:\\Python27\\python";
60 | } else {
61 | command = "python";
62 | }
63 |
64 | l.add(command);
65 | l.add(cmd);
66 | l.add(testIn);
67 |
68 | return Shell.exec(l);
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/difflib/myers/DiffNode.java:
--------------------------------------------------------------------------------
1 | package difflib.myers;
2 |
3 | /**
4 | * Title:
5 | * Description:
6 | * Copyright: Copyright (c) 2002
7 | * Company:
8 | * @author not attributable
9 | * @version 1.0
10 | */
11 |
12 | /**
13 | * A diffnode in a diffpath.
14 | *
15 | * A DiffNode and its previous node mark a delta between
16 | * two input sequences, that is, two differing subsequences
17 | * between (possibly zero length) matching sequences.
18 | *
19 | * {@link DiffNode DiffNodes} and {@link Snake Snakes} allow for compression
20 | * of diffpaths, as each snake is represented by a single {@link Snake Snake}
21 | * node and each contiguous series of insertions and deletions is represented
22 | * by a single {@link DiffNode DiffNodes}.
23 | *
24 | * @version $Revision: 60 $ $Date: 2003-05-10 21:56:10 +0300 (Суб, 10 Май 2003) $
25 | * @author Juanco Anez
26 | *
27 | */
28 | public final class DiffNode extends PathNode {
29 | /**
30 | * Constructs a DiffNode.
31 | *
32 | * DiffNodes are compressed. That means that
33 | * the path pointed to by the prev parameter
34 | * will be followed using {@link PathNode#previousSnake}
35 | * until a non-diff node is found.
36 | *
37 | * @param the position in the original sequence
38 | * @param the position in the revised sequence
39 | * @param prev the previous node in the path.
40 | */
41 | public DiffNode(int i, int j, PathNode prev) {
42 | super(i, j, (prev == null ? null : prev.previousSnake()));
43 | }
44 |
45 | /**
46 | * {@inheritDoc}
47 | * @return false, always
48 | */
49 | public boolean isSnake() {
50 | return false;
51 | }
52 |
53 | }
--------------------------------------------------------------------------------
/docs/projectInterpretation/ColinInterpretation.md:
--------------------------------------------------------------------------------
1 | Project Interpretation
2 | ======================
3 |
4 | ### Meta
5 | - They want a prototype to show that such a system is possible, not the finished
6 | system itself.
7 | - This lets us use a local database (or not even, if just for demonstration
8 | purposes) instead of worrying about servers.
9 | - They want Windows, but if we use Swing it should be multiplatform.
10 |
11 | ### Application
12 | - Desktop Windows `.exe`.
13 |
14 | ### Login System
15 | - Users can log in from any computer with a certain ID and password.
16 | - **Do they want integration with the rest of their system, a la Canvas,
17 | SFU Connect, go.sfu.ca, etc.?**
18 | - Bad passwords or usernames will reject the user.
19 |
20 | ### Actors/Users
21 | - Users can fill multiple roles.
22 | - SysAdmin: Can add, delete, and change account info. Can alter database
23 | location.
24 | - TA/TM: Same thing? Can grade.
25 | - Instructor: Can do everything a TA/TM can do. Can manipulate rubrics.
26 | Can assign TA/TMs to students. Can alter course activities.
27 | - AsAcAd: Can create/alter courses and assign users below him to courses.
28 | - AcAd: Can do everything the users below him can.
29 | - Non-user actors: students and student groups.
30 |
31 | ### Testing Suite
32 | - _This whole feature can be argued against_.
33 | It could be suggested to the client that they contract this out
34 | as a seperate job completely.
35 | - Instructors only.
36 | - Interface for providing test files.
37 | - The suite compiles C* and Java, and interprets Python.
38 | **What Python version? And what implementation of Python?**
39 | - _All_ code regardless of language must be checked for malicious
40 | behaviour before compiling/running. This requires writing a parser for
41 | for each language, which will take _a lot_ of research, time, and money.
42 |
--------------------------------------------------------------------------------
/docs/meetingMinutes/03-03-agenda.md:
--------------------------------------------------------------------------------
1 | # Meeting Agenda
2 | ## Mar 3, 2014
3 | #### Room: Shell House Recreation 4
4 |
5 | ### Attendance
6 | - Colin Woodbury
7 | - Jordan Toering
8 | - Ian Pun
9 | - Chazz Young
10 | - Markus Balasaki
11 | - Stephen Laboucane
12 | - Graeme Smith
13 |
14 | ### Agenda
15 | - Go over created UI screens on the TV(10 minutes)
16 | - Compile a list of general style guidelines(40 minutes)
17 | - Make the post-login page(main landing page) (20 minutes)
18 | - Delegate tasks for the rest of the week(20 minutes)
19 |
20 | ### Minutes
21 | - Went over UI screens and got feedback from group members
22 | - Created a list of style guidelines and put it in the repository
23 | - Divided up tasks for group members to accomplish based on style guidelines
24 | - Members should write their own descriptions for images they create
25 | - If a group member needs to use another member's images they can reference the section the image is in
26 | - Jordan and Colin will do the main landing page tomorrow after class.
27 | - Jordan and Colin will create subsections in the latest document, please wait until tomorrow after class to formally commit your work to the LaTeX document
28 |
29 | ### Screens Needed
30 | - Login {MARKUS}
31 | - Main Panel{JORDAN AND COLIN}
32 | - System Admin Panel {CHAZZ}
33 | - Database Panel(Sys Admin) {CHAZZ}
34 | - User Account Panel(Sys Admin) [Make a dropdown box to select account in the case of modification] {CHAZZ}
35 | - System Panel (Sys Admin, contains logs){CHAZZ}
36 | - Manages Courses{IAN}
37 | - Modify Course{IAN}
38 | - Choose Course(Choose a course for marking or for making activities){STEPHEN}
39 | - Choose Activity{STEPHEN}
40 | - Modify Activity{GRAEME}
41 | - Copy Activity{GRAEME}
42 | - Modify Rubric{GRAEME}
43 | - Select Activity(student/activity matrix){STEPHEN}
44 | - Test Suite(Test Student Code) {JORDAN}
45 | - Assignment Page(Rubric,Solution,Submitted views) {COLIN}
--------------------------------------------------------------------------------
/docs/formalQuestions/formalQuestions.md:
--------------------------------------------------------------------------------
1 | Questions
2 | =========
3 | ### General
4 | - How many users will be using this software (at one time), total
5 |
6 | ### Login
7 | - Is there a login system? What will it look like?
8 | - If a user tries to log in with bad passwords, what happens?
9 | Lockouts? (Does user get an email?)
10 | - How do we recover passwords? (Do we?)
11 |
12 | ### Users
13 | #### General
14 | - Is the following summary of possible user types correct:
15 | System Admin, Academic Admin, Assistant Academic Admin, Instructor, TA/TM.
16 | - Are students to interact with the system in any way?
17 |
18 | #### SysAdmin
19 | - How much control over accounts should the SysAdmin have?
20 |
21 | #### Markers (Instructor, TA/TM)
22 | - How are grades returned?
23 | - How exactly are assignments marked?
24 | - In what way are comments added to assignments?
25 | - Does all marking have to be done to a rubric?
26 |
27 | #### Instructors
28 | - When creating an assignment, does a rubric need to be included right away?
29 | If no, can we just block marking?
30 | - What happens when a rubric is changed when grades have already been
31 | submitted?
32 |
33 | #### Assistant Academic Admin
34 | - What is required in creating a course? Do class lists have to be added
35 | right away?
36 | - What does it mean to copy a course?
37 | - Are there time limits (dates) for creating/deleting/modifying a course?
38 |
39 | #### Academic Administrator
40 | - If Ac. Admins can "view and update all material added by other users", can they
41 | also do grading?
42 |
43 | ### Logs
44 | - Does the client think that having logs of all actions performed on the system,
45 | and marking logs for each student is a good idea?
46 | - (If yes) What Users should access to those logs?
47 |
48 | ### Code Testing Suite
49 | - (Describe potential problems - malicious code, writing parsers, time, money)
50 | - Should this be added to the software at all?
51 | - (If yes) Can all markers use this?
52 |
--------------------------------------------------------------------------------
/src/difflib/DiffAlgorithm.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package difflib;
17 |
18 | import java.util.*;
19 |
20 | /**
21 | * The general interface for computing diffs between two lists of elements of type T.
22 | *
23 | * @author Dmitry Naumenko
24 | * @param T The type of the compared elements in the 'lines'.
25 | */
26 | public interface DiffAlgorithm {
27 |
28 | /**
29 | * Computes the difference between the original sequence and the revised
30 | * sequence and returns it as a {@link Patch} object.
31 | *
32 | * @param original The original sequence. Must not be {@code null}.
33 | * @param revised The revised sequence. Must not be {@code null}.
34 | * @return The patch representing the diff of the given sequences. Never {@code null}.
35 | */
36 | public Patch diff(T[] original, T[] revised);
37 |
38 | /**
39 | * Computes the difference between the original sequence and the revised
40 | * sequence and returns it as a {@link Patch} object.
41 | *
42 | * @param original The original sequence. Must not be {@code null}.
43 | * @param revised The revised sequence. Must not be {@code null}.
44 | * @return The patch representing the diff of the given sequences. Never {@code null}.
45 | */
46 | public Patch diff(List original, List revised);
47 | }
48 |
--------------------------------------------------------------------------------
/src/audio/AudioPlayer.java:
--------------------------------------------------------------------------------
1 | package audio;
2 |
3 | import java.io.File;
4 | import javax.sound.midi.*;
5 |
6 | /**
7 | * @author: Colin
8 | */
9 | public class AudioPlayer {
10 | private boolean useExternalSynth;
11 | private String filename;
12 | private Sequencer seq;
13 |
14 | public AudioPlayer(String filename) {
15 | useExternalSynth = false;
16 | this.filename = filename;
17 |
18 | try {
19 | init();
20 | } catch (Exception e) {
21 | System.out.println("Couldn't open audio file...");
22 | e.printStackTrace();
23 | }
24 | }
25 |
26 | private void init() throws Exception {
27 | MidiDevice receivingDevice = getReceivingDevice();
28 | receivingDevice.open();
29 |
30 | Sequence sequence1 = MidiSystem.getSequence(new File(filename));
31 | seq = MidiSystem.getSequencer(false);
32 | Transmitter tx1 = seq.getTransmitter();
33 | Receiver rx1 = receivingDevice.getReceiver();
34 | tx1.setReceiver(rx1);
35 |
36 | seq.open();
37 | seq.setSequence(sequence1);
38 | }
39 |
40 | public void play() {
41 | if (seq != null)
42 | seq.start();
43 | }
44 |
45 | public void stop() {
46 | if (seq != null)
47 | seq.stop();
48 | }
49 |
50 | private MidiDevice getReceivingDevice()
51 | throws MidiUnavailableException {
52 | for (MidiDevice.Info mdi: MidiSystem.getMidiDeviceInfo()) {
53 | MidiDevice dev = MidiSystem.getMidiDevice(mdi);
54 | return dev;
55 | // if (dev.getMaxReceivers() != 0) {
56 | // String lcName =
57 | // defaultString(mdi.getName()).toLowerCase(Locale.ENGLISH);
58 | // if (lcName.contains(useExternalSynth? "usb": "java")) {
59 | // System.out.println("GOT HERE!!");
60 | // return dev;
61 | // }
62 | // }
63 | }
64 | return null;
65 | }
66 |
67 | private String defaultString(String s) {
68 | if (s == null)
69 | return "";
70 | return s;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/docs/meetingMinutes/03-17-agenda.md:
--------------------------------------------------------------------------------
1 | # Meeting Agenda
2 | ## Mar 17, 2014
3 | #### Room: Shell House Recreation 4
4 |
5 | ### Attendance
6 | - Ian Pun
7 | - Chazz Young
8 | - Jordan Toering
9 | - Graeme Smith
10 | - Markus Balaski
11 |
12 | ### Agenda
13 | - Formalize agenda(5 minutes)
14 | - Resolve incorrect assignment submission and mark(10 minutes)
15 | - Go over next deliverable(30 minutes)
16 | - Formalize roles for next deliverable
17 |
18 |
19 | ### Minutes
20 | - Approved Agenda
21 | - Emailed Professor Regan about our misplaced group mark
22 | - Went over requirements for next iteration (first prototype)
23 | - Test Case Document (Deliverable 8) will not be mentioned until next week's meeting
24 | - Ensure everyone has Swing and a suitable Java IDE
25 | - Until Friday, all code done will be voluntary. The Friday meeting will formally assign sections of code to members as all members will be present at the meeting.
26 | - Stephen is assigned to transcribe client meeting 2 by Friday's meeting.
27 |
28 | ### General coding guidelines(Use Java 8):
29 | - Follow as much as possible prototype requirements in terms of content
30 | - Variables are declared using only lowercase and underscores if a space is needed
31 | - Variable visibility: All variables will be private, except in special cases(interface classes). Methods should be public unless they are helpers used only in that class.
32 | - Variables in looping should be a single, lowercase character such as (i,j,k). The default start character is 'i', if more nesting is needed move down the alphabet. Constants should be notated in all CAPS.
33 | - Getters and Setters should be formatted in the style of the getters/setters generated automatically through Eclipse
34 | - Comments: Don't comment unnecessarily but if unsure, stray to the side of more comments vs less.
35 | - Methods: For the first word in each method, use lowercase. For every subsequent use uppercase. No matter how small the word is (Of, Is, To), follow the guidelines. No spaces between words.
36 | - Classes: Capitalize every word, no spaces.
37 | - Constructors: Always put the constructor between fields and other methods.
38 | - Use iterative loops instead of manual loops ( where possible)
39 | - Use Eclipse's style of formatting (ie. curly brace placement, tabbing)
40 | -
--------------------------------------------------------------------------------
/docs/projectInterpretation/Jordan Interpretation.md:
--------------------------------------------------------------------------------
1 | ### Account types
2 | -- Each user has an account type. For accounts in relation to classes: users can be part of more than one type of role in more than one class. For example: a student who TAs math but is enrolled in history.
3 |
4 | -- The system roles (admin, admin assistants) have jurisdiction over how the classes are created but can't change the content inside of courses.
5 |
6 | -- The way this works, we will have two different types of accounts. Some accounts are system based while some are class based. Markers for example will be only present in the scope of the class. They don't have control over how classes are created.
7 |
8 | ### Marking and Grades
9 | -- Returning work: the marker updates the students mark on the activity and the student can check the mark he acheived. Much like canvas.
10 |
11 | -- Comments: We should try to convince the client that comments should either be totally system-side or attached to individual work. This is also dependant on the types of files used. If the only filetypes we have to deal with are PDF and code files, it coild be optimal to store the comments within the file. However, if the comments are to be stored serverside, it would be helpful to create a system that does general comments(for arts work) or per-line comments(for code/math work).
12 |
13 | -- Rubric comparison: When the marker needs to compare to the rubic he could press a button to open a side by side view of the students work and the rubric. It would be optimal if the marks entered into the rubric are automatically updated into the students marks. (Perhaps we then need a more custom rubric solution. This would be a slick feature but the amount of time it takes might not be worth it)
14 |
15 | -- Compiling and checking code: Code could be run in the same way that 'codewrite' runs it. No access to external libraries and the code would run in a quarantine enviroment. This would reduce the need for santitation while allowing the markers to see if the assignments are fufilling the requirements.
16 |
17 | ### System implementation
18 | -- The program will run as a desktop application that connects to the server. Students will login each time to check their work and submit their grades
19 |
20 | -- The system will send email notifying of changes to grades(possible extra feature like canvas)
21 |
--------------------------------------------------------------------------------
/docs/releasePage.tex:
--------------------------------------------------------------------------------
1 | % Preamble. Don't worry about it.
2 | \documentclass{article}
3 | \usepackage{setspace,graphicx,fancyhdr}
4 | \usepackage[utf8]{inputenc}
5 | \usepackage[left=1in,top=1in,right=1in,bottom=1in]{geometry} % Document margins
6 | \onehalfspacing
7 |
8 | % For custom footers
9 | \pagestyle{fancy}
10 | \fancyhead{} % clear all header fields
11 | \renewcommand{\headrulewidth}{0pt} % no line in header area
12 | \fancyfoot{} % clear all footer fields
13 | \fancyfoot[LE,RO]{\thepage} % for page #s
14 | \fancyfoot[RE,LO]{\includegraphics{../images/logo/markshark-1x}}
15 |
16 | \begin{document}
17 |
18 | \textbf{Release: Markshark ver 1.0}\\
19 | \subsection{Documentation:}
20 | \begin{itemize}
21 | \item Software Requirement Specification 1.1
22 | \item Design Document 1.1
23 | \item User Manual 1.1
24 | \end{itemize}
25 |
26 | \subsection{Source Code:}
27 | \subsubsection{Database Access classes ver 1.0:}
28 | \begin{itemize}
29 | \item AccountAccess.java
30 | \item CourseAccess.java
31 | \item DBAccess.java
32 | \item GradeAccess.java
33 | \end{itemize}
34 |
35 | \subsubsection{GUI ver 1.0:}
36 | \begin{itemize}
37 | \item LandingPageAdmin.java
38 | \item LandingPageAssistAdmin.java
39 | \item LandingPageInstructor.java
40 | \item LandingPageSysAdmin.java
41 | \item LandingPageTA.java
42 | \item LoginScreen.java
43 | \item ActivityCreation.java
44 | \item ActivityManagement.java
45 | \item ActivitySelection.java
46 | \item CourseManagement.java
47 | \item CourseSelection.java
48 | \item CreateAccount.java
49 | \item CreateCourse.java
50 | \item DatabaseManagement.java
51 | \item LogManagement.java
52 | \item MarkingCode.java
53 | \item MarkingPDF.java
54 | \item MarkSharkGUI.java
55 | \item MasterFrame.java
56 | \item SelectActivityMatrix.java
57 | \item SettingsPage.java
58 | \item TestSuite.java
59 | \item GUIUtils.java
60 | \item Login.java
61 | \end{itemize}
62 |
63 | \subsubsection{Type classes ver 1.0:}
64 | \begin{itemize}
65 | \item AcademicAdmin.java
66 | \item Account.java
67 | \item Activity.java
68 | \item AssistantAdmin.java
69 | \item Course.java
70 | \item Instructor.java
71 | \item Marker.java
72 | \item ProgrammingTest.java
73 | \item Rubric.java
74 | \item Student.java
75 | \item SystemAdmin.java
76 | \item TATM.java
77 | \end{itemize}
78 |
79 | \subsubsection{Shell Classes ver 1.0:}
80 | \begin{itemize}
81 | \item Shell.java
82 | \item ShellExec.java
83 | \end{itemize}
84 |
85 | Date of Release : April 7, 2014
86 |
87 | \end{document}
88 |
--------------------------------------------------------------------------------
/src/difflib/InsertDelta.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package difflib;
17 |
18 | import java.util.List;
19 |
20 | /**
21 | * Describes the add-delta between original and revised texts.
22 | *
23 | * @author Dmitry Naumenko
24 | * @param T
25 | * The type of the compared elements in the 'lines'.
26 | */
27 | public class InsertDelta extends Delta {
28 |
29 | /**
30 | * Creates an insert delta with the two given chunks.
31 | *
32 | * @param original
33 | * The original chunk. Must not be {@code null}.
34 | * @param revised
35 | * The original chunk. Must not be {@code null}.
36 | */
37 | public InsertDelta(Chunk original, Chunk revised) {
38 | super(original, revised);
39 | }
40 |
41 | /**
42 | * {@inheritDoc}
43 | *
44 | * @throws PatchFailedException
45 | */
46 | @Override
47 | public void applyTo(List target) throws PatchFailedException {
48 | verify(target);
49 | int position = this.getOriginal().getPosition();
50 | List lines = this.getRevised().getLines();
51 | for (int i = 0; i < lines.size(); i++) {
52 | target.add(position + i, lines.get(i));
53 | }
54 | }
55 |
56 | /**
57 | * {@inheritDoc}
58 | */
59 | @Override
60 | public void restore(List target) {
61 | int position = getRevised().getPosition();
62 | int size = getRevised().size();
63 | for (int i = 0; i < size; i++) {
64 | target.remove(position);
65 | }
66 | }
67 |
68 | @Override
69 | public void verify(List target) throws PatchFailedException {
70 | if (getOriginal().getPosition() > target.size()) {
71 | throw new PatchFailedException("Incorrect patch for delta: "
72 | + "delta original position > target size");
73 | }
74 |
75 | }
76 |
77 | public TYPE getType() {
78 | return Delta.TYPE.INSERT;
79 | }
80 |
81 | @Override
82 | public String toString() {
83 | return "[InsertDelta, position: " + getOriginal().getPosition()
84 | + ", lines: " + getRevised().getLines() + "]";
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/difflib/DeleteDelta.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package difflib;
17 |
18 | import java.util.List;
19 |
20 | /**
21 | * Describes the delete-delta between original and revised texts.
22 | *
23 | * @author Dmitry Naumenko
24 | * @param T The type of the compared elements in the 'lines'.
25 | */
26 | public class DeleteDelta extends Delta {
27 |
28 | /**
29 | * Creates a change delta with the two given chunks.
30 | *
31 | * @param original
32 | * The original chunk. Must not be {@code null}.
33 | * @param revised
34 | * The original chunk. Must not be {@code null}.
35 | */
36 | public DeleteDelta(Chunk original, Chunk revised) {
37 | super(original, revised);
38 | }
39 |
40 | /**
41 | * {@inheritDoc}
42 | *
43 | * @throws PatchFailedException
44 | */
45 | @Override
46 | public void applyTo(List target) throws PatchFailedException {
47 | verify(target);
48 | int position = getOriginal().getPosition();
49 | int size = getOriginal().size();
50 | for (int i = 0; i < size; i++) {
51 | target.remove(position);
52 | }
53 | }
54 |
55 | /**
56 | * {@inheritDoc}
57 | */
58 | @Override
59 | public void restore(List target) {
60 | int position = this.getRevised().getPosition();
61 | List lines = this.getOriginal().getLines();
62 | for (int i = 0; i < lines.size(); i++) {
63 | target.add(position + i, lines.get(i));
64 | }
65 | }
66 |
67 | @Override
68 | public TYPE getType() {
69 | return Delta.TYPE.DELETE;
70 | }
71 |
72 | @Override
73 | public void verify(List target) throws PatchFailedException {
74 | getOriginal().verify(target);
75 | }
76 |
77 | @Override
78 | public String toString() {
79 | return "[DeleteDelta, position: " + getOriginal().getPosition() + ", lines: "
80 | + getOriginal().getLines() + "]";
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/difflib/Patch.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package difflib;
17 |
18 | import java.util.Collections;
19 | import java.util.LinkedList;
20 | import java.util.List;
21 | import java.util.ListIterator;
22 |
23 | /**
24 | * Describes the patch holding all deltas between the original and revised texts.
25 | *
26 | * @author Dmitry Naumenko
27 | * @param T The type of the compared elements in the 'lines'.
28 | */
29 | public class Patch {
30 | private List> deltas = new LinkedList>();
31 |
32 | /**
33 | * Apply this patch to the given target
34 | * @return the patched text
35 | * @throws PatchFailedException if can't apply patch
36 | */
37 | public List applyTo(List target) throws PatchFailedException {
38 | List result = new LinkedList(target);
39 | ListIterator> it = getDeltas().listIterator(deltas.size());
40 | while (it.hasPrevious()) {
41 | Delta delta = (Delta) it.previous();
42 | delta.applyTo(result);
43 | }
44 | return result;
45 | }
46 |
47 | /**
48 | * Restore the text to original. Opposite to applyTo() method.
49 | * @param target the given target
50 | * @return the restored text
51 | */
52 | public List restore(List target) {
53 | List result = new LinkedList(target);
54 | ListIterator> it = getDeltas().listIterator(deltas.size());
55 | while (it.hasPrevious()) {
56 | Delta delta = (Delta) it.previous();
57 | delta.restore(result);
58 | }
59 | return result;
60 | }
61 |
62 | /**
63 | * Add the given delta to this patch
64 | * @param delta the given delta
65 | */
66 | public void addDelta(Delta delta) {
67 | deltas.add(delta);
68 | }
69 |
70 | /**
71 | * Get the list of computed deltas
72 | * @return the deltas
73 | */
74 | public List> getDeltas() {
75 | Collections.sort(deltas, DeltaComparator.INSTANCE);
76 | return deltas;
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/docs/clientMeetings/clientMeeting1Questions.md:
--------------------------------------------------------------------------------
1 | Client Meeting Questions
2 | ========================
3 |
4 | #### Colin Woodbury cwoodbur@sfu.ca
5 |
6 | - How many users will be using this software (at one time), total
7 |
8 | Assignments
9 |
10 | - How exactly are assignments graded?
11 | - Are they all done directly on a rubric?
12 | - Is it necessary for the program to analyze the assignment to associate the
13 | rubric with the assignment?
14 | - Does the system block marking if no rubric has been submitted with the assignment?
15 |
16 | #### Jordan Toering jtoering@sfu.ca
17 |
18 | Assignments Part 2
19 |
20 | - Code assignments: building a testing suite?
21 | - Is it that essential (will require an exorbitant amount of work, potentially
22 | four different parsers along with potential security risks)
23 | - Suggest looking at code side by side?
24 | - How should the system implement the commenting portion?
25 | (i.e. directly on the work, within the assignment description
26 | (if students have access to the system))
27 | - Are there any time limits for modifying an assignment/rubric?
28 |
29 | #### Graeme Smith gds3@sfu.ca
30 |
31 | Assignements Part 3
32 |
33 | - What does it mean to `return` an assignment? Is it as simple as outputting
34 | the commented file back into the folder provided for the student?
35 |
36 | Students
37 |
38 | - Are students interacting with this system at all?
39 | - If not, will the system be responsible for showing grades in some other way?
40 | - If so, what can the student access?
41 |
42 | #### Ian Pun itpun@sfu.ca
43 |
44 | Courses
45 |
46 | - What does it mean to create a course? (pre-reqs etc.)
47 | - What does it mean to copy a course?
48 | - Is the system responsible for checking to see if a student is eligible to take
49 | the course?
50 | - Are there time limits as to when the course can be modified?
51 |
52 | #### Stephen Laboucane slabouca@sfu.ca
53 |
54 | The Login System
55 |
56 | - How sophisticated do you want the login system to be?
57 | - How are lost passwords handled?
58 | - How are bad passwords handled (lockouts, password reset, contact system admin etc.)
59 | - Does the system need different UIs for different types of users?
60 | - IF a user has multiple roles?
61 |
62 | #### Markus Balaski mabalaski@gmail.com
63 |
64 | Academic Administrators & Academic Admin Assistants
65 |
66 | - What precisely can the administrators do? Can they grade?
67 | - How will the admin assistants add students to the class?
68 | (batch add, person by person add)
69 | - Case where student cannot enter course?
70 |
71 | #### Chazz Young chazzy@sfu.ca
72 |
73 | System Administrator
74 |
75 | - Is there a limit to the number of SysAdmins?
76 | - How much control over accounts should the SysAdmin have?
77 |
78 | Logs
79 |
80 | - Explain Logs: Important to have, and cheap. Two types: Academic and System.
81 | - Who has access to logs? (System/Academic)
82 |
--------------------------------------------------------------------------------
/src/difflib/ChangeDelta.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package difflib;
17 |
18 | import java.util.List;
19 |
20 | /**
21 | * Describes the change-delta between original and revised texts.
22 | *
23 | * @author Dmitry Naumenko
24 | * @param T The type of the compared elements in the 'lines'.
25 | */
26 | public class ChangeDelta extends Delta {
27 |
28 | /**
29 | * Creates a change delta with the two given chunks.
30 | * @param original The original chunk. Must not be {@code null}.
31 | * @param revised The original chunk. Must not be {@code null}.
32 | */
33 | public ChangeDelta(Chunk original, Chunkrevised) {
34 | super(original, revised);
35 | }
36 |
37 | /**
38 | * {@inheritDoc}
39 | *
40 | * @throws PatchFailedException
41 | */
42 | @Override
43 | public void applyTo(List target) throws PatchFailedException {
44 | verify(target);
45 | int position = getOriginal().getPosition();
46 | int size = getOriginal().size();
47 | for (int i = 0; i < size; i++) {
48 | target.remove(position);
49 | }
50 | int i = 0;
51 | for (T line : getRevised().getLines()) {
52 | target.add(position + i, line);
53 | i++;
54 | }
55 | }
56 |
57 | /**
58 | * {@inheritDoc}
59 | */
60 | @Override
61 | public void restore(List target) {
62 | int position = getRevised().getPosition();
63 | int size = getRevised().size();
64 | for (int i = 0; i < size; i++) {
65 | target.remove(position);
66 | }
67 | int i = 0;
68 | for (T line : getOriginal().getLines()) {
69 | target.add(position + i, line);
70 | i++;
71 | }
72 | }
73 |
74 | /**
75 | * {@inheritDoc}
76 | */
77 | public void verify(List target) throws PatchFailedException {
78 | getOriginal().verify(target);
79 | if (getOriginal().getPosition() > target.size()) {
80 | throw new PatchFailedException("Incorrect patch for delta: "
81 | + "delta original position > target size");
82 | }
83 | }
84 |
85 | @Override
86 | public String toString() {
87 | return "[ChangeDelta, position: " + getOriginal().getPosition() + ", lines: "
88 | + getOriginal().getLines() + " to " + getRevised().getLines() + "]";
89 | }
90 |
91 | @Override
92 | public TYPE getType() {
93 | return Delta.TYPE.CHANGE;
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/src/difflib/StringUtills.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package difflib;
17 |
18 | import java.util.Iterator;
19 | import java.util.LinkedList;
20 | import java.util.List;
21 |
22 | public class StringUtills {
23 |
24 | public static String join(final Iterable objs, final String delimiter) {
25 | Iterator iter = objs.iterator();
26 | if (!iter.hasNext()) {
27 | return "";
28 | }
29 | StringBuffer buffer = new StringBuffer(String.valueOf(iter.next()));
30 | while (iter.hasNext()) {
31 | buffer.append(delimiter).append(String.valueOf(iter.next()));
32 | }
33 | return buffer.toString();
34 | }
35 |
36 | /**
37 | * Replaces all tabs with 4 spaces.
38 | * @param str The string.
39 | * @return
40 | */
41 | public static String expandTabs(String str) {
42 | return str.replace("\t", " ");
43 | }
44 |
45 | /**
46 | * Replaces all opening an closing tags with < or >.
47 | * @param str
48 | * @return
49 | */
50 | public static String htmlEntites(String str) {
51 | return str.replace("<", "<").replace(">", ">");
52 | }
53 |
54 | public static String normalize(String str) {
55 | return expandTabs(htmlEntites(str));
56 | }
57 |
58 | public static List normalize(List list) {
59 | List result = new LinkedList();
60 | for (String line : list) {
61 | result.add(normalize(line));
62 | }
63 | return result;
64 | }
65 |
66 | public static List wrapText(List list, int columnWidth) {
67 | List result = new LinkedList();
68 | for (String line : list) {
69 | result.add(wrapText(line, columnWidth));
70 | }
71 | return result;
72 | }
73 |
74 | /**
75 | * Wrap the text with the given column width
76 | * @param line the text
77 | * @param columnWidth the given column
78 | * @return the wrapped text
79 | */
80 | public static String wrapText(String line, int columnWidth) {
81 | int lenght = line.length();
82 | int delimiter = "
".length();
83 | int widthIndex = columnWidth;
84 |
85 | for (int count = 0; lenght > widthIndex; count++) {
86 | line = line.subSequence(0, widthIndex + delimiter * count) + "
"
87 | + line.substring(widthIndex + delimiter * count);
88 | widthIndex += columnWidth;
89 | }
90 |
91 | return line;
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/src/difflib/package.html:
--------------------------------------------------------------------------------
1 |
2 |
57 |
58 |
59 |
61 |
62 |
63 |
64 |
65 | The {@link difflib difflib} package
66 | implements general operation with diff files.
67 |
68 | @author Dmitry Naumenko
69 |
70 |
71 |
--------------------------------------------------------------------------------
/src/difflib/myers/DiffException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ====================================================================
3 | *
4 | * The Apache Software License, Version 1.1
5 | *
6 | * Copyright (c) 1999-2003 The Apache Software Foundation.
7 | * All rights reserved.
8 | *
9 | * Redistribution and use in source and binary forms, with or without
10 | * modification, are permitted provided that the following conditions
11 | * are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright
14 | * notice, this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright
17 | * notice, this list of conditions and the following disclaimer in
18 | * the documentation and/or other materials provided with the
19 | * distribution.
20 | *
21 | * 3. The end-user documentation included with the redistribution, if
22 | * any, must include the following acknowledgement:
23 | * "This product includes software developed by the
24 | * Apache Software Foundation (http://www.apache.org/)."
25 | * Alternately, this acknowledgement may appear in the software itself,
26 | * if and wherever such third-party acknowledgements normally appear.
27 | *
28 | * 4. The names "The Jakarta Project", "Commons", and "Apache Software
29 | * Foundation" must not be used to endorse or promote products derived
30 | * from this software without prior written permission. For written
31 | * permission, please contact apache@apache.org.
32 | *
33 | * 5. Products derived from this software may not be called "Apache"
34 | * nor may "Apache" appear in their names without prior written
35 | * permission of the Apache Software Foundation.
36 | *
37 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
38 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
39 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
40 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
41 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
42 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
43 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
44 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
45 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
46 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
47 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48 | * SUCH DAMAGE.
49 | * ====================================================================
50 | *
51 | * This software consists of voluntary contributions made by many
52 | * individuals on behalf of the Apache Software Foundation. For more
53 | * information on the Apache Software Foundation, please see
54 | * .
55 | *
56 | */
57 |
58 | package difflib.myers;
59 |
60 | /**
61 | * Base class for all exceptions emanating from this package.
62 | *
63 | * @version $Revision: 69 $ $Date: 2003-10-13 11:00:44 +0300 (Пнд, 13 Окт 2003) $
64 | *
65 | * @author Juanco Anez
66 | */
67 | public class DiffException extends Exception {
68 |
69 | private static final long serialVersionUID = 1L;
70 |
71 | public DiffException() {
72 | }
73 |
74 | public DiffException(String msg) {
75 | super(msg);
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/types/Activity.java:
--------------------------------------------------------------------------------
1 | package types;
2 |
3 | import java.util.ArrayList;
4 | /**
5 | * Write a description of class Activity here.
6 | *
7 | * @author Chazz Young
8 | * @version 0.1
9 | */
10 | public class Activity
11 | {
12 | private String name, solnPath, studentSubPath , due_date, activityDesc, language;
13 | private int num_of_tests, num_of_files;
14 | //isGroup has been included, but it will be empty as this was discontinued
15 | //in the prioritization meeting
16 | private boolean isProgramming, isGroup;
17 |
18 | private ArrayList tests;
19 |
20 | private Rubric rubric;
21 |
22 | public Activity(String n, String desc, String studPath, String soln, String lang, String dueDate, boolean p, boolean g, int numTests)
23 | {
24 | name = n;
25 | activityDesc = desc;
26 | studentSubPath = studPath;
27 | solnPath = soln;
28 | language = lang;
29 | isProgramming = p;
30 | isGroup = g;
31 | num_of_tests = numTests;
32 | due_date = dueDate;
33 | isProgramming = p;
34 | isGroup = g;
35 | tests = new ArrayList();
36 | //update Database
37 | }
38 |
39 | //Getters
40 |
41 | public String getActivityDesc() {
42 | return activityDesc;
43 | }
44 |
45 | public String getStudentSubPath() {
46 | return studentSubPath;
47 | }
48 |
49 | public String getSolnPath() {
50 | return solnPath;
51 | }
52 |
53 | public String getName()
54 | {
55 | return name;
56 | }
57 |
58 | public String getLanguage()
59 | {
60 | return language;
61 | }
62 |
63 | public String getDueDate()
64 | {
65 | return due_date;
66 | }
67 |
68 | public boolean isProgramming()
69 | {
70 | return isProgramming;
71 | }
72 |
73 | public boolean isGroup()
74 | {
75 | return isGroup;
76 | }
77 |
78 | public int getNumOfTests()
79 | {
80 | return num_of_tests;
81 | }
82 |
83 | public ArrayList getTests()
84 | {
85 | return tests;
86 | }
87 |
88 | //Setters
89 |
90 | public void setDueDate(String date)
91 | {
92 | due_date = date;
93 | }
94 |
95 | public void addProgrammingTest(String test)
96 | {
97 | ProgrammingTest p = new ProgrammingTest(test);
98 | tests.add(p);
99 | isProgramming = true;
100 | }
101 |
102 | public void addMultipleTests(ArrayList t)
103 | {
104 | for(ProgrammingTest p : t){
105 | if(tests.contains(p)){
106 | //do nothing
107 | }else{
108 | tests.add(p);
109 | }
110 | }
111 | }
112 |
113 | public void setIsGroup(boolean b)
114 | {
115 | isGroup = b;
116 | }
117 |
118 | /**
119 | * @desc: Creates a rubric depending on teh flag isPassFail
120 | * @author: Chazz Young
121 | */
122 | /*public void addRubric(boolean isPassFail)
123 | {
124 | Rubric r;
125 | if(isPassFail == true){
126 | r = new Rubric(isPassFail);
127 | }else{
128 | String path = (path_solutions + "/Rubric.txt");
129 | r = new Rubric(path);
130 | }
131 | }*/
132 | }
133 |
--------------------------------------------------------------------------------
/src/database/Dbaccess.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 |
7 | package database;
8 |
9 | import java.sql.*;
10 |
11 |
12 | /**
13 | *
14 | * @author Pun
15 | */
16 | public class Dbaccess {
17 |
18 |
19 | // ATTRIBUTES - CLASS VARIABLES
20 |
21 | private static Connection dbConnection; // The connection to the database
22 |
23 | // STATIC METHODS
24 |
25 | /*
26 | * Method to return the list of courses by course ID to be used in a course
27 | * selection dropdown box.
28 | */
29 | public static void backupdatabase(String filepath) {
30 | // set up the query string here:
31 | String query = "BACKUP DATABASE c275g01A TO DISK = '"+ filepath+"wiresharkbackup.BAK'";
32 | execUpdate(query); //execute backup
33 | }
34 |
35 | public static void restoredatabase(String filepath) {
36 | // set up the query string here:
37 | String query = "RESTORE DATABASE c275g01A FROM DISK = '"+ filepath+"'";
38 | execUpdate(query); //execute backup
39 | }
40 |
41 |
42 | // HELPER METHODS
43 |
44 | /*
45 | * Method to execute an update (INSERT, DELETE, UPDATE) query on the
46 | * database connection.
47 | */
48 | private static void execUpdate(String query) {
49 | PreparedStatement prepStatement = null;
50 |
51 | establishConnection(); // Establish connection to Cypress
52 |
53 | try { // Prepare and execute the query
54 | prepStatement = dbConnection.prepareStatement(query);
55 | prepStatement.executeUpdate();
56 | } catch (SQLException e) {
57 | System.out.println("SQL Exception occured, the state : "
58 | + e.getSQLState() + "\nMessage: " + e.getMessage());
59 | }
60 | }
61 |
62 | /*
63 | * Method to execute a query on the database connection and return a result
64 | * set for the query entered as a string argument.
65 | */
66 | private static ResultSet execQuery(String query) {
67 | PreparedStatement prepStatement = null;
68 | ResultSet resSet = null;
69 |
70 | establishConnection();
71 | try { // Prepare and execute query
72 | prepStatement = dbConnection.prepareStatement(query);
73 | resSet = prepStatement.executeQuery();
74 | } catch (SQLException e) {
75 | System.out.println("SQL Exception occured, the state : "
76 | + e.getSQLState() + "\nMessage: " + e.getMessage());
77 | }
78 | return resSet;
79 | }
80 |
81 | /*
82 | * Method to establish a connection to the Cypress SQL server. Uses
83 | * hard-coded login information of our group's SQL connection.
84 | */
85 | private static void establishConnection() {
86 | try { // Access the JDBC driver
87 | Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
88 | } catch (ClassNotFoundException e) {
89 | System.out.println("No JDBC driver found, exiting.");
90 | }
91 |
92 | try { // Connect to Cypress
93 | dbConnection = DriverManager
94 | .getConnection("jdbc:sqlserver://cypress.csil.sfu.ca;"
95 | + " user = c275g01; password = TAA2Md7nGrPj2LjN");
96 | } catch (SQLException e) {
97 | System.out.println("Connection failed, exiting.");
98 | }
99 | }
100 |
101 | /*
102 | * Method to convert a boolean value to either 0 or 1 to be used as a bit in
103 | * SQL queries.
104 | */
105 | private static int boolToBit(boolean b) {
106 | return b ? 1 : 0;
107 | }
108 | }
109 |
110 |
111 |
--------------------------------------------------------------------------------
/src/difflib/myers/DifferentiationFailedException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ====================================================================
3 | *
4 | * The Apache Software License, Version 1.1
5 | *
6 | * Copyright (c) 1999-2003 The Apache Software Foundation.
7 | * All rights reserved.
8 | *
9 | * Redistribution and use in source and binary forms, with or without
10 | * modification, are permitted provided that the following conditions
11 | * are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright
14 | * notice, this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright
17 | * notice, this list of conditions and the following disclaimer in
18 | * the documentation and/or other materials provided with the
19 | * distribution.
20 | *
21 | * 3. The end-user documentation included with the redistribution, if
22 | * any, must include the following acknowledgement:
23 | * "This product includes software developed by the
24 | * Apache Software Foundation (http://www.apache.org/)."
25 | * Alternately, this acknowledgement may appear in the software itself,
26 | * if and wherever such third-party acknowledgements normally appear.
27 | *
28 | * 4. The names "The Jakarta Project", "Commons", and "Apache Software
29 | * Foundation" must not be used to endorse or promote products derived
30 | * from this software without prior written permission. For written
31 | * permission, please contact apache@apache.org.
32 | *
33 | * 5. Products derived from this software may not be called "Apache"
34 | * nor may "Apache" appear in their names without prior written
35 | * permission of the Apache Software Foundation.
36 | *
37 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
38 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
39 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
40 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
41 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
42 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
43 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
44 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
45 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
46 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
47 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48 | * SUCH DAMAGE.
49 | * ====================================================================
50 | *
51 | * This software consists of voluntary contributions made by many
52 | * individuals on behalf of the Apache Software Foundation. For more
53 | * information on the Apache Software Foundation, please see
54 | * .
55 | *
56 | */
57 |
58 | package difflib.myers;
59 |
60 | /**
61 | * Thrown whenever the differencing engine cannot produce the differences
62 | * between two revisions of ta text.
63 | *
64 | * @version $Revision: 69 $ $Date: 2003-10-13 11:00:44 +0300 (Пнд, 13 Окт 2003) $
65 | *
66 | * @author Juanco Anez
67 | * @see MyersDiff
68 | * @see difflib.DiffAlgorithm
69 | */
70 | public class DifferentiationFailedException extends DiffException {
71 | private static final long serialVersionUID = 1L;
72 |
73 | public DifferentiationFailedException() {
74 | }
75 |
76 | public DifferentiationFailedException(String msg) {
77 | super(msg);
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/gui/SettingsPage.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
65 |
--------------------------------------------------------------------------------
/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processor.options=
4 | annotation.processing.processors.list=
5 | annotation.processing.run.all.processors=true
6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
7 | build.classes.dir=${build.dir}/classes
8 | build.classes.excludes=**/*.java,**/*.form
9 | # This directory is removed when the project is cleaned:
10 | build.dir=build
11 | build.generated.dir=${build.dir}/generated
12 | build.generated.sources.dir=${build.dir}/generated-sources
13 | # Only compile against the classpath explicitly listed here:
14 | build.sysclasspath=ignore
15 | build.test.classes.dir=${build.dir}/test/classes
16 | build.test.results.dir=${build.dir}/test/results
17 | # Uncomment to specify the preferred debugger connection transport:
18 | #debug.transport=dt_socket
19 | debug.classpath=\
20 | ${run.classpath}
21 | debug.test.classpath=\
22 | ${run.test.classpath}
23 | # Files in build.classes.dir which should be excluded from distribution jar
24 | dist.archive.excludes=
25 | # This directory is removed when the project is cleaned:
26 | dist.dir=dist
27 | dist.jar=${dist.dir}/MarkShark.jar
28 | dist.javadoc.dir=${dist.dir}/javadoc
29 | excludes=
30 | file.reference.batik-awt-util.jar=src\\lib\\batik-awt-util.jar
31 | file.reference.batik-dom.jar=src\\lib\\batik-dom.jar
32 | file.reference.batik-svg-dom.jar=src\\lib\\batik-svg-dom.jar
33 | file.reference.batik-svggen.jar=src\\lib\\batik-svggen.jar
34 | file.reference.batik-util.jar=src\\lib\\batik-util.jar
35 | file.reference.batik-xml.jar=src\\lib\\batik-xml.jar
36 | file.reference.icepdf-core.jar=src\\lib\\icepdf-core.jar
37 | file.reference.icepdf-viewer.jar=src\\lib\\icepdf-viewer.jar
38 | file.reference.java-src=src
39 | file.reference.sqljdbc4.jar=/Users/Pun/Downloads/sqljdbc_4.0/enu/sqljdbc4.jar
40 | file.reference.sqljdbc4.jar-1=C:\\Users\\toeri_000\\Downloads\\Microsoft JDBC Driver 4.0 for SQL Server\\sqljdbc_4.0\\enu\\sqljdbc4.jar
41 | includes=**
42 | jar.compress=false
43 | javac.classpath=\
44 | ${file.reference.sqljdbc4.jar}:\
45 | ${file.reference.sqljdbc4.jar-1}:\
46 | ${file.reference.icepdf-core.jar}:\
47 | ${file.reference.batik-awt-util.jar}:\
48 | ${file.reference.batik-dom.jar}:\
49 | ${file.reference.batik-svg-dom.jar}:\
50 | ${file.reference.batik-svggen.jar}:\
51 | ${file.reference.batik-util.jar}:\
52 | ${file.reference.batik-xml.jar}:\
53 | ${file.reference.icepdf-viewer.jar}
54 | # Space-separated list of extra javac options
55 | javac.compilerargs=
56 | javac.deprecation=false
57 | javac.processorpath=\
58 | ${javac.classpath}
59 | javac.source=1.8
60 | javac.target=1.8
61 | javac.test.classpath=\
62 | ${javac.classpath}:\
63 | ${build.classes.dir}
64 | javac.test.processorpath=\
65 | ${javac.test.classpath}
66 | javadoc.additionalparam=
67 | javadoc.author=false
68 | javadoc.encoding=${source.encoding}
69 | javadoc.noindex=false
70 | javadoc.nonavbar=false
71 | javadoc.notree=false
72 | javadoc.private=false
73 | javadoc.splitindex=true
74 | javadoc.use=true
75 | javadoc.version=false
76 | javadoc.windowtitle=
77 | main.class=MarkShark
78 | manifest.file=manifest.mf
79 | meta.inf.dir=${src.dir}/META-INF
80 | mkdist.disabled=false
81 | platform.active=default_platform
82 | run.classpath=\
83 | ${javac.classpath}:\
84 | ${build.classes.dir}
85 | # Space-separated list of JVM arguments used when running the project.
86 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
87 | # To set system properties for unit tests define test-sys-prop.name=value:
88 | run.jvmargs=
89 | run.test.classpath=\
90 | ${javac.test.classpath}:\
91 | ${build.test.classes.dir}
92 | source.encoding=UTF-8
93 | src.dir=${file.reference.java-src}
94 |
--------------------------------------------------------------------------------
/src/gui/LogManagement.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 |
7 | package gui;
8 |
9 | import gui.types.*;
10 | import types.*;
11 |
12 | /**
13 | *
14 | * @author colin
15 | */
16 | public class LogManagement extends MSPanel {
17 | private SystemAdmin a;
18 |
19 | /**
20 | * Creates new form LandingPageSysAdmin
21 | */
22 | public LogManagement() {
23 | super("System Administrator");
24 | initComponents();
25 | }
26 |
27 | /**
28 | * This method is called from within the constructor to initialize the form.
29 | * WARNING: Do NOT modify this code. The content of this method is always
30 | * regenerated by the Form Editor.
31 | */
32 | @SuppressWarnings("unchecked")
33 | // //GEN-BEGIN:initComponents
34 | private void initComponents() {
35 |
36 | tasks_panel = new javax.swing.JPanel();
37 | system_log_scrollpane = new javax.swing.JScrollPane();
38 | system_log_textpane = new javax.swing.JTextPane();
39 |
40 | tasks_panel.setBorder(javax.swing.BorderFactory.createTitledBorder("System Log"));
41 |
42 | system_log_scrollpane.setViewportView(system_log_textpane);
43 |
44 | javax.swing.GroupLayout tasks_panelLayout = new javax.swing.GroupLayout(tasks_panel);
45 | tasks_panel.setLayout(tasks_panelLayout);
46 | tasks_panelLayout.setHorizontalGroup(
47 | tasks_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
48 | .addGroup(tasks_panelLayout.createSequentialGroup()
49 | .addContainerGap()
50 | .addComponent(system_log_scrollpane, javax.swing.GroupLayout.DEFAULT_SIZE, 480, Short.MAX_VALUE)
51 | .addContainerGap())
52 | );
53 | tasks_panelLayout.setVerticalGroup(
54 | tasks_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
55 | .addGroup(tasks_panelLayout.createSequentialGroup()
56 | .addContainerGap()
57 | .addComponent(system_log_scrollpane, javax.swing.GroupLayout.DEFAULT_SIZE, 237, Short.MAX_VALUE)
58 | .addContainerGap())
59 | );
60 |
61 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
62 | this.setLayout(layout);
63 | layout.setHorizontalGroup(
64 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
65 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
66 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
67 | .addComponent(tasks_panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
68 | .addContainerGap())
69 | );
70 | layout.setVerticalGroup(
71 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
72 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
73 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
74 | .addComponent(tasks_panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
75 | .addContainerGap())
76 | );
77 | }// //GEN-END:initComponents
78 |
79 |
80 | // Variables declaration - do not modify//GEN-BEGIN:variables
81 | private javax.swing.JScrollPane system_log_scrollpane;
82 | private javax.swing.JTextPane system_log_textpane;
83 | private javax.swing.JPanel tasks_panel;
84 | // End of variables declaration//GEN-END:variables
85 | }
86 |
--------------------------------------------------------------------------------
/src/gui/LogManagement.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
82 |
--------------------------------------------------------------------------------
/src/difflib/myers/Snake.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ====================================================================
3 | *
4 | * The Apache Software License, Version 1.1
5 | *
6 | * Copyright (c) 1999-2003 The Apache Software Foundation.
7 | * All rights reserved.
8 | *
9 | * Redistribution and use in source and binary forms, with or without
10 | * modification, are permitted provided that the following conditions
11 | * are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright
14 | * notice, this list of conditions and the following disclaimer.
15 | *
16 | * 2. Redistributions in binary form must reproduce the above copyright
17 | * notice, this list of conditions and the following disclaimer in
18 | * the documentation and/or other materials provided with the
19 | * distribution.
20 | *
21 | * 3. The end-user documentation included with the redistribution, if
22 | * any, must include the following acknowledgement:
23 | * "This product includes software developed by the
24 | * Apache Software Foundation (http://www.apache.org/)."
25 | * Alternately, this acknowledgement may appear in the software itself,
26 | * if and wherever such third-party acknowledgements normally appear.
27 | *
28 | * 4. The names "The Jakarta Project", "Commons", and "Apache Software
29 | * Foundation" must not be used to endorse or promote products derived
30 | * from this software without prior written permission. For written
31 | * permission, please contact apache@apache.org.
32 | *
33 | * 5. Products derived from this software may not be called "Apache"
34 | * nor may "Apache" appear in their names without prior written
35 | * permission of the Apache Software Foundation.
36 | *
37 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
38 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
39 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
40 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
41 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
42 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
43 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
44 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
45 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
46 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
47 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48 | * SUCH DAMAGE.
49 | * ====================================================================
50 | *
51 | * This software consists of voluntary contributions made by many
52 | * individuals on behalf of the Apache Software Foundation. For more
53 | * information on the Apache Software Foundation, please see
54 | * .
55 | *
56 | */
57 |
58 | package difflib.myers;
59 |
60 | /**
61 | * Represents a snake in a diffpath.
62 | *
63 | *
64 | * {@link DiffNode DiffNodes} and {@link Snake Snakes} allow for compression
65 | * of diffpaths, as each snake is represented by a single {@link Snake Snake}
66 | * node and each contiguous series of insertions and deletions is represented
67 | * by a single {@link DiffNode DiffNodes}.
68 | *
69 | * @version $Revision: 69 $ $Date: 2003-10-13 11:00:44 +0300 (Пнд, 13 Окт 2003) $
70 | * @author Juanco Anez
71 | *
72 | */
73 | public final class Snake extends PathNode {
74 | /**
75 | * Constructs a snake node.
76 | *
77 | * @param the position in the original sequence
78 | * @param the position in the revised sequence
79 | * @param prev the previous node in the path.
80 | */
81 | public Snake(int i, int j, PathNode prev) {
82 | super(i, j, prev);
83 | }
84 |
85 | /**
86 | * {@inheritDoc}
87 | * @return true always
88 | */
89 | public boolean isSnake() {
90 | return true;
91 | }
92 |
93 | }
--------------------------------------------------------------------------------
/src/difflib/DiffRow.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package difflib;
17 |
18 | /**
19 | * Describes the diff row in form [tag, oldLine, newLine) for showing the
20 | * difference between two texts
21 | *
22 | * @author Dmitry Naumenko
23 | */
24 | public class DiffRow {
25 | private Tag tag;
26 | private String oldLine;
27 | private String newLine;
28 |
29 | public DiffRow(Tag tag, String oldLine, String newLine) {
30 | this.tag = tag;
31 | this.oldLine = oldLine;
32 | this.newLine = newLine;
33 | }
34 |
35 | public enum Tag {
36 | INSERT, DELETE, CHANGE, EQUAL
37 | }
38 |
39 | /**
40 | * @return the tag
41 | */
42 | public Tag getTag() {
43 | return tag;
44 | }
45 |
46 | /**
47 | * @param tag the tag to set
48 | */
49 | public void setTag(Tag tag) {
50 | this.tag = tag;
51 | }
52 |
53 | /**
54 | * @return the oldLine
55 | */
56 | public String getOldLine() {
57 | return oldLine;
58 | }
59 |
60 | /**
61 | * @param oldLine the oldLine to set
62 | */
63 | public void setOldLine(String oldLine) {
64 | this.oldLine = oldLine;
65 | }
66 |
67 | /**
68 | * @return the newLine
69 | */
70 | public String getNewLine() {
71 | return newLine;
72 | }
73 |
74 | /**
75 | * @param newLine the newLine to set
76 | */
77 | public void setNewLine(String newLine) {
78 | this.newLine = newLine;
79 | }
80 |
81 | /*
82 | * (non-Javadoc)
83 | *
84 | * @see java.lang.Object#hashCode()
85 | */
86 | @Override
87 | public int hashCode() {
88 | final int prime = 31;
89 | int result = 1;
90 | result = prime * result + ((newLine == null) ? 0 : newLine.hashCode());
91 | result = prime * result + ((oldLine == null) ? 0 : oldLine.hashCode());
92 | result = prime * result + ((tag == null) ? 0 : tag.hashCode());
93 | return result;
94 | }
95 |
96 | /*
97 | * (non-Javadoc)
98 | *
99 | * @see java.lang.Object#equals(java.lang.Object)
100 | */
101 | @Override
102 | public boolean equals(Object obj) {
103 | if (this == obj)
104 | return true;
105 | if (obj == null)
106 | return false;
107 | if (getClass() != obj.getClass())
108 | return false;
109 | DiffRow other = (DiffRow) obj;
110 | if (newLine == null) {
111 | if (other.newLine != null)
112 | return false;
113 | } else if (!newLine.equals(other.newLine))
114 | return false;
115 | if (oldLine == null) {
116 | if (other.oldLine != null)
117 | return false;
118 | } else if (!oldLine.equals(other.oldLine))
119 | return false;
120 | if (tag == null) {
121 | if (other.tag != null)
122 | return false;
123 | } else if (!tag.equals(other.tag))
124 | return false;
125 | return true;
126 | }
127 |
128 | public String toString() {
129 | return "[" + this.tag + "," + this.oldLine + "," + this.newLine + "]";
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/src/shell/ThreadedStreamHandler.java:
--------------------------------------------------------------------------------
1 | package shell;
2 |
3 | import java.io.*;
4 |
5 | /**
6 | * This class is intended to be used with the SystemCommandExecutor
7 | * class to let users execute system commands from Java applications.
8 | *
9 | * This class is based on work that was shared in a JavaWorld article
10 | * named "When System.exec() won't". That article is available at this
11 | * url:
12 | *
13 | * http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
14 | *
15 | * Documentation for this class is available at this URL:
16 | *
17 | * http://devdaily.com/java/java-processbuilder-process-system-exec
18 | *
19 | *
20 | * Copyright 2010 alvin j. alexander, devdaily.com.
21 | *
22 | * This program is free software: you can redistribute it and/or modify
23 | * it under the terms of the GNU Lesser Public License as published by
24 | * the Free Software Foundation, either version 3 of the License, or
25 | * (at your option) any later version.
26 |
27 | * This program is distributed in the hope that it will be useful,
28 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | * GNU Lesser Public License for more details.
31 |
32 | * You should have received a copy of the GNU Lesser Public License
33 | * along with this program. If not, see .
34 | *
35 | * Please ee the following page for the LGPL license:
36 | * http://www.gnu.org/licenses/lgpl.txt
37 | *
38 | */
39 | class ThreadedStreamHandler extends Thread {
40 | InputStream inputStream;
41 | String adminPassword;
42 | OutputStream outputStream;
43 | PrintWriter printWriter;
44 | StringBuilder outputBuffer = new StringBuilder();
45 | private boolean sudoIsRequested = false;
46 |
47 | /**
48 | * A simple constructor for when the sudo command is not necessary.
49 | * This constructor will just run the command you provide, without
50 | * running sudo before the command, and without expecting a password.
51 | *
52 | * @param inputStream
53 | * @param streamType
54 | */
55 | ThreadedStreamHandler(InputStream inputStream) {
56 | this.inputStream = inputStream;
57 | }
58 |
59 | /**
60 | * Use this constructor when you want to invoke the 'sudo' command.
61 | * The outputStream must not be null. If it is, you'll regret it. :)
62 | *
63 | * TODO this currently hangs if the admin password given for the sudo command is wrong.
64 | *
65 | * @param inputStream
66 | * @param streamType
67 | * @param outputStream
68 | * @param adminPassword
69 | */
70 | ThreadedStreamHandler(InputStream inputStream, OutputStream outputStream, String adminPassword) {
71 | this.inputStream = inputStream;
72 | this.outputStream = outputStream;
73 | this.printWriter = new PrintWriter(outputStream);
74 | this.adminPassword = adminPassword;
75 | this.sudoIsRequested = true;
76 | }
77 |
78 | public void run() {
79 | // on mac os x 10.5.x, when i run a 'sudo' command, i need to write
80 | // the admin password out immediately; that's why this code is
81 | // here.
82 | if (sudoIsRequested) {
83 | //doSleep(500);
84 | printWriter.println(adminPassword);
85 | printWriter.flush();
86 | }
87 |
88 | BufferedReader bufferedReader = null;
89 | try {
90 | bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
91 | String line = null;
92 | while ((line = bufferedReader.readLine()) != null) {
93 | outputBuffer.append(line + "\n");
94 | }
95 | } catch (IOException ioe) {
96 | // TODO handle this better
97 | ioe.printStackTrace();
98 | } catch (Throwable t) {
99 | // TODO handle this better
100 | t.printStackTrace();
101 | } finally {
102 | try {
103 | bufferedReader.close();
104 | } catch (IOException e) {
105 | // ignore this one
106 | }
107 | }
108 | }
109 |
110 | private void doSleep(long millis) {
111 | try {
112 | Thread.sleep(millis);
113 | } catch (InterruptedException e) {
114 | // ignore
115 | }
116 | }
117 |
118 | public StringBuilder getOutputBuffer() {
119 | return outputBuffer;
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/src/gui/LandingPageTA.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
85 |
--------------------------------------------------------------------------------
/src/gui/LandingPageAdmin.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
85 |
--------------------------------------------------------------------------------
/src/gui/LandingPageTA.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 |
7 | package gui;
8 |
9 | import javax.swing.*;
10 | import gui.utils.*;
11 | import gui.types.*;
12 | import types.*;
13 |
14 | /**
15 | *
16 | * @author Normal
17 | */
18 | public class LandingPageTA extends MSPanel {
19 | private TATM a;
20 |
21 | /**
22 | * Creates new form LandingPageTA
23 | */
24 | public LandingPageTA(TATM a) {
25 | super("TA/TM");
26 | this.a = a;
27 |
28 | initComponents();
29 | }
30 |
31 | /**
32 | * This method is called from within the constructor to initialize the form.
33 | * WARNING: Do NOT modify this code. The content of this method is always
34 | * regenerated by the Form Editor.
35 | */
36 | @SuppressWarnings("unchecked")
37 | // //GEN-BEGIN:initComponents
38 | private void initComponents() {
39 |
40 | tasks_panel = new JPanel();
41 | marking_button = new JButton();
42 |
43 | tasks_panel.setBorder(BorderFactory.createTitledBorder("Tasks"));
44 |
45 | marking_button.setText("Marking");
46 | marking_button.addActionListener(new java.awt.event.ActionListener() {
47 | public void actionPerformed(java.awt.event.ActionEvent evt) {
48 | marking_buttonActionPerformed(evt);
49 | }
50 | });
51 |
52 | GroupLayout tasks_panelLayout = new GroupLayout(tasks_panel);
53 | tasks_panel.setLayout(tasks_panelLayout);
54 | tasks_panelLayout.setHorizontalGroup(
55 | tasks_panelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
56 | .addGroup(tasks_panelLayout.createSequentialGroup()
57 | .addGap(165, 165, 165)
58 | .addComponent(marking_button, GroupLayout.PREFERRED_SIZE, 133, GroupLayout.PREFERRED_SIZE)
59 | .addContainerGap(166, Short.MAX_VALUE))
60 | );
61 | tasks_panelLayout.setVerticalGroup(
62 | tasks_panelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
63 | .addGroup(tasks_panelLayout.createSequentialGroup()
64 | .addGap(131, 131, 131)
65 | .addComponent(marking_button)
66 | .addContainerGap(142, Short.MAX_VALUE))
67 | );
68 |
69 | GroupLayout layout = new GroupLayout(this);
70 | this.setLayout(layout);
71 | layout.setHorizontalGroup(
72 | layout.createParallelGroup(GroupLayout.Alignment.LEADING)
73 | .addGap(0, 496, Short.MAX_VALUE)
74 | .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
75 | .addGroup(layout.createSequentialGroup()
76 | .addContainerGap()
77 | .addComponent(tasks_panel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
78 | .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
79 | );
80 | layout.setVerticalGroup(
81 | layout.createParallelGroup(GroupLayout.Alignment.LEADING)
82 | .addGap(0, 341, Short.MAX_VALUE)
83 | .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
84 | .addGroup(layout.createSequentialGroup()
85 | .addContainerGap()
86 | .addComponent(tasks_panel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
87 | .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
88 | );
89 | }// //GEN-END:initComponents
90 |
91 | private void marking_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_marking_buttonActionPerformed
92 | GUIUtils.getMasterFrame(this).movePage(new CourseSelection(TA_MARKING, a));
93 | }//GEN-LAST:event_marking_buttonActionPerformed
94 |
95 | private static final int TA_MARKING = 7;
96 |
97 | // Variables declaration - do not modify//GEN-BEGIN:variables
98 | private JButton marking_button;
99 | private JPanel tasks_panel;
100 | // End of variables declaration//GEN-END:variables
101 | }
102 |
--------------------------------------------------------------------------------
/final/README.txt:
--------------------------------------------------------------------------------
1 | **PLEASE READ IN WORDPAD FOR PROPER FORMATTING
2 |
3 | ,,,,,
4 | ,,,,,
5 | ,,,````,
6 | ,,,````,
7 | ,,,,```::`,,
8 | '' ' '''''''' ,,,, ,,``````````,,,
9 | '' ' '''''''' ,,,, ,,``````````,,,
10 | ''' ''' ' ,''''',,,, ,,,,```````````,,,,
11 | ''' ''' ' ,''''',,,, ,,,,```````````,,,,
12 | '' '' ' ''''' ,,''''''', ,,,``````````````,
13 | '' ' '' ,,'''''''',,,,,,,'',```````````````,,
14 | '' ' '' ,,'''''''',,,,,,,'',```````````````,,
15 | '' ' '''''''' ,,''''''''''''''',`````````````````,,
16 | '' ' '''''''' ,,''''''''''''''',`````````````````,,
17 | ,,''''''''''''''',`````````````````,,
18 | ,,;;''''''''''''',,`````:``````````````,
19 | ,,;;''''''''''''',,`````:``````````````,
20 | ,''''''''''''''',,```````:::``````````::`,,
21 | ,''''''''''''''',,```````:::``````````::`,,
22 | ,,, ,,''''''''''''''''`````````````````````````,,
23 | ,,''''',, ,,'''''''''''''''''```````````````,,,,,`````,
24 | ,,''''',, ,,'''''''''''''''''```````````````,,,,,`````,
25 | ,,''''',,, ,'''''''''''''''''```````````````,,, ,,,,,
26 | ,,''''',,, ,'''''''''''''''''```````````````,,, ,,,,,
27 | ,''''''',,,,,,,''''''''''''''''''````````````,,,,,
28 | ,,'''''''''''''''''''''''````'''''``````````,
29 | ,,'''''''''''''''''''''''````'''''``````````,
30 | ,,'''''''''''''````````````'''''```''''''',
31 | ,,'''''''''''''````````````'''''```''''''',
32 | ,'''''''''```````````,,,,'''''',,,,'''''',,
33 | ,,''''',,,,,,,,,,,,,,, '''''' ,''''',,
34 | ,,''''',,,,,,,,,,,,,,, '''''' ,''''',,
35 | ,,''',, ''''', ,,''',,
36 | ,,''',, ''''', ,,''',,
37 | ,''''',, ''''', ,,',,
38 | ,'''', ''',, ,
39 | ,'''', ''',, ,
40 | ,,''',, ,,,
41 | ,,''',, ,,,
42 | ,,''',,
43 | ,,,
44 | ,,,
45 |
46 | Assumed software present on CSIL Computers:
47 | ===========================================
48 | - Python 2.7 (Filepath: "C:\Python27\python")
49 | - Java JRE/JDK 1.7
50 | - Windows Vista or newer
51 | - Microsoft SQL Server 2003 or newer
52 | - Eclipse IDE
53 |
54 |
55 | Connections to External Servers:
56 | ================================
57 | - SFU Cypress Database
58 |
59 |
60 | Instructions to Build from Included Files:
61 | ==========================================
62 | - Unzip the project archive.
63 | - Open Eclipse and create a project based in the top level of the decompressed folder.
64 | - Appropriate JAR libraries will be included automatically by Eclipse.
65 | - Export the project as a runnable JAR file. (Make sure to click 'package required libraries...' option)
66 |
67 |
68 | Last Two Parts of Getting Started Section:
69 | ==========================================
70 |
71 | Running the Application:
72 | ------------------------
73 | - Double-click on the provided "MarkShark.jar"
74 | - Confirm network connection.
75 | - Log into the system with a valid user account.
76 | - Follow the instructions provided in this manual for the desired use case.
77 |
78 | Application Installation for UAT:
79 | ---------------------------------
80 | - Unzip the project archive.
81 | - Open Eclipse and create a project based in the top level of the decompressed folder.
82 | - Appropriate JAR libraries will be included automatically by Eclipse.
83 | - Export the project as a runnable JAR file. (Make sure to click 'package required libraries...' option)
84 | - If desired, run the MarkShark.jar file to start the program.
85 |
--------------------------------------------------------------------------------
/src/gui/LandingPageAssistAdmin.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
89 |
--------------------------------------------------------------------------------
/src/gui/LandingPageAdmin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 |
7 | package gui;
8 |
9 | import gui.utils.*;
10 | import gui.types.*;
11 | import types.*;
12 |
13 | /**
14 | *
15 | * @author Ian
16 | */
17 | public class LandingPageAdmin extends MSPanel {
18 | private AcademicAdmin a;
19 |
20 | /**
21 | * Creates new form LandingPageAdmin1
22 | */
23 | public LandingPageAdmin(AcademicAdmin a) {
24 | super("Academic Administrator");
25 | this.a = a;
26 |
27 | initComponents();
28 | }
29 |
30 | /**
31 | * This method is called from within the constructor to initialize the form.
32 | * WARNING: Do NOT modify this code. The content of this method is always
33 | * regenerated by the Form Editor.
34 | */
35 | @SuppressWarnings("unchecked")
36 | // //GEN-BEGIN:initComponents
37 | private void initComponents() {
38 |
39 | tasks_panel = new javax.swing.JPanel();
40 | manage_grades_button = new javax.swing.JButton();
41 |
42 | tasks_panel.setBorder(javax.swing.BorderFactory.createTitledBorder("Tasks"));
43 |
44 | manage_grades_button.setText("Manage Grades");
45 | manage_grades_button.addActionListener(new java.awt.event.ActionListener() {
46 | public void actionPerformed(java.awt.event.ActionEvent evt) {
47 | manage_grades_buttonActionPerformed(evt);
48 | }
49 | });
50 |
51 | javax.swing.GroupLayout tasks_panelLayout = new javax.swing.GroupLayout(tasks_panel);
52 | tasks_panel.setLayout(tasks_panelLayout);
53 | tasks_panelLayout.setHorizontalGroup(
54 | tasks_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
55 | .addGroup(tasks_panelLayout.createSequentialGroup()
56 | .addGap(120, 120, 120)
57 | .addComponent(manage_grades_button, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
58 | .addContainerGap(117, Short.MAX_VALUE))
59 | );
60 | tasks_panelLayout.setVerticalGroup(
61 | tasks_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
62 | .addGroup(tasks_panelLayout.createSequentialGroup()
63 | .addGap(117, 117, 117)
64 | .addComponent(manage_grades_button)
65 | .addContainerGap(128, Short.MAX_VALUE))
66 | );
67 |
68 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
69 | this.setLayout(layout);
70 | layout.setHorizontalGroup(
71 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
72 | .addGap(0, 400, Short.MAX_VALUE)
73 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
74 | .addGroup(layout.createSequentialGroup()
75 | .addContainerGap()
76 | .addComponent(tasks_panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
77 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
78 | );
79 | layout.setVerticalGroup(
80 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
81 | .addGap(0, 306, Short.MAX_VALUE)
82 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
83 | .addGroup(layout.createSequentialGroup()
84 | .addGap(4, 4, 4)
85 | .addComponent(tasks_panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
86 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
87 | );
88 | }// //GEN-END:initComponents
89 |
90 | private void manage_grades_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_manage_grades_buttonActionPerformed
91 | GUIUtils.getMasterFrame(this).movePage(new CourseSelection(GRADING, a));
92 | }//GEN-LAST:event_manage_grades_buttonActionPerformed
93 |
94 | private static final int GRADING = 5;
95 | private static final int VIEWING = 6;
96 |
97 | // Variables declaration - do not modify//GEN-BEGIN:variables
98 | private javax.swing.JButton manage_grades_button;
99 | private javax.swing.JPanel tasks_panel;
100 | // End of variables declaration//GEN-END:variables
101 | }
102 |
--------------------------------------------------------------------------------
/src/gui/LandingPageInstructor.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
92 |
--------------------------------------------------------------------------------
/src/gui/SettingsPage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 |
7 | package gui;
8 |
9 | import database.AccountAccess;
10 |
11 | import javax.swing.*;
12 |
13 | import java.awt.event.*;
14 | import gui.utils.*;
15 | import gui.types.MSPanel;
16 | import types.Account;
17 |
18 | /**
19 | *
20 | * @author Colin
21 | */
22 | public class SettingsPage extends MSPanel {
23 | private Account a;
24 |
25 | /**
26 | * Creates new form SettingsPage
27 | */
28 | public SettingsPage(Account a) {
29 | super("User Settings");
30 |
31 | this.a = a;
32 |
33 | initComponents();
34 | }
35 |
36 | /**
37 | * This method is called from within the constructor to initialize the form.
38 | * WARNING: Do NOT modify this code. The content of this method is always
39 | * regenerated by the Form Editor.
40 | */
41 | @SuppressWarnings("unchecked")
42 | // //GEN-BEGIN:initComponents
43 | private void initComponents() {
44 |
45 | jLabel1 = new javax.swing.JLabel();
46 | curr_pass_field = new javax.swing.JPasswordField();
47 | jLabel2 = new javax.swing.JLabel();
48 | new_pass_field = new javax.swing.JPasswordField();
49 | jLabel3 = new javax.swing.JLabel();
50 | new_pass_field2 = new javax.swing.JPasswordField();
51 | confirm_button = new javax.swing.JButton();
52 | cancel_button = new javax.swing.JButton();
53 |
54 | setLayout(new java.awt.GridLayout(4, 2, 20, 50));
55 |
56 | jLabel1.setText("Current Password");
57 | jLabel1.setName("curr_pass"); // NOI18N
58 | add(jLabel1);
59 | add(curr_pass_field);
60 |
61 | jLabel2.setText("New Password");
62 | add(jLabel2);
63 | add(new_pass_field);
64 |
65 | jLabel3.setText("Repeat New Password");
66 | add(jLabel3);
67 | add(new_pass_field2);
68 |
69 | confirm_button.setText("Confirm");
70 | confirm_button.setName("confirm_button"); // NOI18N
71 | confirm_button.addActionListener(new java.awt.event.ActionListener() {
72 | public void actionPerformed(java.awt.event.ActionEvent evt) {
73 | confirm_buttonActionPerformed(evt);
74 | }
75 | });
76 | add(confirm_button);
77 |
78 | cancel_button.setText("Cancel");
79 | cancel_button.addActionListener(new java.awt.event.ActionListener() {
80 | public void actionPerformed(java.awt.event.ActionEvent evt) {
81 | cancel_buttonActionPerformed(evt);
82 | }
83 | });
84 | add(cancel_button);
85 | }// //GEN-END:initComponents
86 |
87 | private void confirm_buttonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_confirm_buttonActionPerformed
88 | String curr = new String(curr_pass_field.getPassword());
89 | String newP = new String(new_pass_field.getPassword());
90 | String newP2 = new String(new_pass_field2.getPassword());
91 |
92 | if (! curr.equals(a.getPassword())) {
93 | JOptionPane.showMessageDialog(this, "Current password given isn't correct.");
94 | } else if (! newP.equals(newP2)) {
95 | JOptionPane.showMessageDialog(this, "The two new passwords given do not match.");
96 | } else if (newP.isEmpty() || newP2.isEmpty()) {
97 | JOptionPane.showMessageDialog(this, "Empty passwords are not allowed.");
98 | } else {
99 | int choice = JOptionPane.showConfirmDialog(this, "Really reset password?");
100 |
101 | if (choice == JOptionPane.OK_OPTION) {
102 | a.setPassword(newP);
103 | AccountAccess.modifyAccount(a.getUsername(), a);
104 |
105 | System.out.println("Password changed to " + newP);
106 | }
107 | }
108 | }//GEN-LAST:event_confirm_buttonActionPerformed
109 |
110 | private void cancel_buttonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_cancel_buttonActionPerformed
111 | GUIUtils.getMasterFrame(this).goBack();
112 | }//GEN-LAST:event_cancel_buttonActionPerformed
113 |
114 |
115 | // Variables declaration - do not modify//GEN-BEGIN:variables
116 | private javax.swing.JButton cancel_button;
117 | private javax.swing.JButton confirm_button;
118 | private javax.swing.JPasswordField curr_pass_field;
119 | private javax.swing.JLabel jLabel1;
120 | private javax.swing.JLabel jLabel2;
121 | private javax.swing.JLabel jLabel3;
122 | private javax.swing.JPasswordField new_pass_field;
123 | private javax.swing.JPasswordField new_pass_field2;
124 | // End of variables declaration//GEN-END:variables
125 | }
126 |
--------------------------------------------------------------------------------
/src/lib/versions-licenses.html:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 | ICEpdf v5.0.5 Versions & Licenses
21 |
54 |
55 |
56 |
131 |
132 |
133 |
--------------------------------------------------------------------------------
/src/types/Account.java:
--------------------------------------------------------------------------------
1 | package types;
2 |
3 | /**
4 | * @desc: The Abstract Account class is used to hold all attributes
5 | * and methods of the Account object
6 | * @author Chazz Young
7 | */
8 | public abstract class Account
9 | {
10 | /*
11 | Instructor==4
12 | TA/TM==5
13 | AcAdmin==2
14 | AssAdmin==3
15 | SysAdmin==1
16 | */
17 | public enum Type {
18 | INSTRUCTOR,
19 | TATMMARKER,
20 | ACADEMICADMIN,
21 | ASSISTANTADMIN,
22 | SYSTEMADMIN
23 | }
24 |
25 | private static final int MAX_FAILS = 5;
26 |
27 | protected String first_name, last_name;
28 | protected Type accountType;
29 | protected String username;
30 | private String password;
31 | protected boolean blocked;
32 | protected int empID;
33 | private int bad_logins;
34 |
35 | public Account(String fn, String ln, int empID, String un, String pass, Type ut) {
36 | first_name = fn;
37 | last_name = ln;
38 | this.empID = empID;
39 | username = un;
40 | password = pass;
41 | //if(ut < 1 || ut > 5){}
42 | setAccountType(ut);
43 | blocked = false;
44 | }
45 |
46 | public void setBlocked(boolean blocked) {
47 | this.blocked = blocked;
48 | }
49 |
50 | public String getFirstName() {
51 | return first_name;
52 | }
53 |
54 | public String getLastName() {
55 | return last_name;
56 | }
57 |
58 | public String getUsername() {
59 | return username;
60 | }
61 |
62 | public int getEmpID() {
63 | return empID;
64 | }
65 |
66 | public Type getAccountType() {
67 | return accountType;
68 | }
69 |
70 | public boolean isBlocked() {
71 | return blocked;
72 | }
73 |
74 | public String getPassword() {
75 | return password;
76 | }
77 |
78 | /**
79 | * @desc: Returns the string representation of the account type.
80 | * @author Chazz Young
81 | */
82 | public String getAccountTypeString()
83 | {
84 | String toReturn = null;
85 | if(accountType == Type.SYSTEMADMIN) {
86 | toReturn = "System Administrator";
87 | } else if(accountType == Type.ACADEMICADMIN) {
88 | toReturn = "Academic Administrator";
89 | } else if(accountType == Type.ASSISTANTADMIN) {
90 | toReturn = "Assistant Academic Administrator";
91 | } else if(accountType == Type.INSTRUCTOR) {
92 | toReturn = "Instructor";
93 | } else if(accountType == Type.TATMMARKER) {
94 | toReturn = "TA/TM Marker";
95 | } else {
96 | toReturn = "Error: invalid account type";
97 | }
98 | return toReturn;
99 | }
100 |
101 | /**
102 | * @desc: Tests to see if the inputted password is correct.
103 | * @author Chazz Young
104 | */
105 | public boolean checkPassword(String pass) {
106 | boolean toReturn = false;
107 | if(password.matches(pass)) {
108 | bad_logins = 0;
109 | toReturn = true;
110 | } else {
111 | bad_logins++;
112 | if(bad_logins >= MAX_FAILS){
113 | System.out.println("This account has been blocked due to the repeated number of failed logins.");
114 | blocked = true;
115 | }
116 | toReturn = false;
117 | }
118 | return toReturn;
119 | }
120 |
121 | public void setUsername(String name) {
122 | username = name;
123 | }
124 |
125 | /**
126 | * @desc Sets the new password.
127 | * @author Chazz Young
128 | */
129 | public void setPassword(String new_pass) {
130 | password = new_pass;
131 | }
132 |
133 | /**
134 | * @desc: Although the dropdown menu to select the account type will
135 | * be represented by strings, the dropdown menu will actually
136 | * pass an integer value.
137 | */
138 | public void setAccountType(Type type) {
139 | accountType = type;
140 | }
141 |
142 | public int getAccountTypeAsInt() {
143 | int typeInt;
144 | if (accountType==Type.INSTRUCTOR) {
145 | typeInt = 4;
146 | }
147 | else if (accountType==Type.TATMMARKER) {
148 | typeInt = 5;
149 | }
150 | else if (accountType==Type.ACADEMICADMIN) {
151 | typeInt = 2;
152 | }
153 | else if (accountType==Type.ASSISTANTADMIN) {
154 | typeInt = 3;
155 | }
156 | else if (accountType==Type.SYSTEMADMIN) {
157 | typeInt = 1;
158 | }
159 | else{
160 | System.out.println("Invalid account type");
161 | typeInt = 0;
162 | }
163 | return typeInt;
164 | }
165 |
166 | public void unblock() {
167 | blocked = false;
168 | }
169 | }
170 |
--------------------------------------------------------------------------------
/src/difflib/Delta.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package difflib;
17 |
18 | import java.util.*;
19 |
20 | /**
21 | * Describes the delta between original and revised texts.
22 | *
23 | * @author Dmitry Naumenko
24 | * @param T The type of the compared elements in the 'lines'.
25 | */
26 | public abstract class Delta {
27 |
28 | /** The original chunk. */
29 | private Chunk original;
30 |
31 | /** The revised chunk. */
32 | private Chunk revised;
33 |
34 | /**
35 | * Specifies the type of the delta.
36 | *
37 | */
38 | public enum TYPE {
39 | /** A change in the original. */
40 | CHANGE,
41 | /** A delete from the original. */
42 | DELETE,
43 | /** An insert into the original. */
44 | INSERT
45 | }
46 |
47 | /**
48 | * Construct the delta for original and revised chunks
49 | *
50 | * @param original Chunk describing the original text. Must not be {@code null}.
51 | * @param revised Chunk describing the revised text. Must not be {@code null}.
52 | */
53 | public Delta(Chunk original, Chunk revised) {
54 | if (original == null) {
55 | throw new IllegalArgumentException("original must not be null");
56 | }
57 | if (revised == null) {
58 | throw new IllegalArgumentException("revised must not be null");
59 | }
60 | this.original = original;
61 | this.revised = revised;
62 | }
63 |
64 | /**
65 | * Verifies that this delta can be used to patch the given text.
66 | *
67 | * @param target the text to patch.
68 | * @throws PatchFailedException if the patch cannot be applied.
69 | */
70 | public abstract void verify(List target) throws PatchFailedException;
71 |
72 | /**
73 | * Applies this delta as the patch for a given target
74 | *
75 | * @param target the given target
76 | * @throws PatchFailedException
77 | */
78 | public abstract void applyTo(List target) throws PatchFailedException;
79 |
80 | /**
81 | * Cancel this delta for a given revised text. The action is opposite to
82 | * patch.
83 | *
84 | * @param target the given revised text
85 | */
86 | public abstract void restore(List target);
87 |
88 | /**
89 | * Returns the type of delta
90 | * @return the type enum
91 | */
92 | public abstract TYPE getType();
93 |
94 | /**
95 | * @return The Chunk describing the original text.
96 | */
97 | public Chunk getOriginal() {
98 | return original;
99 | }
100 |
101 | /**
102 | * @param original The Chunk describing the original text to set.
103 | */
104 | public void setOriginal(Chunk original) {
105 | this.original = original;
106 | }
107 |
108 | /**
109 | * @return The Chunk describing the revised text.
110 | */
111 | public Chunk getRevised() {
112 | return revised;
113 | }
114 |
115 | /**
116 | * @param revised The Chunk describing the revised text to set.
117 | */
118 | public void setRevised(Chunk revised) {
119 | this.revised = revised;
120 | }
121 |
122 | @Override
123 | public int hashCode() {
124 | final int prime = 31;
125 | int result = 1;
126 | result = prime * result + ((original == null) ? 0 : original.hashCode());
127 | result = prime * result + ((revised == null) ? 0 : revised.hashCode());
128 | return result;
129 | }
130 |
131 | @Override
132 | public boolean equals(Object obj) {
133 | if (this == obj)
134 | return true;
135 | if (obj == null)
136 | return false;
137 | if (getClass() != obj.getClass())
138 | return false;
139 | Delta other = (Delta) obj;
140 | if (original == null) {
141 | if (other.original != null)
142 | return false;
143 | } else if (!original.equals(other.original))
144 | return false;
145 | if (revised == null) {
146 | if (other.revised != null)
147 | return false;
148 | } else if (!revised.equals(other.revised))
149 | return false;
150 | return true;
151 | }
152 |
153 | }
154 |
--------------------------------------------------------------------------------
/src/gui/LandingPageAssistAdmin.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 |
7 | package gui;
8 |
9 | import gui.utils.*;
10 | import gui.types.*;
11 | import types.*;
12 |
13 | /**
14 | *
15 | * @author Jordan
16 | */
17 | public class LandingPageAssistAdmin extends MSPanel {
18 | private AssistantAdmin a;
19 |
20 | /**
21 | * Creates new form LandingPageAssistAdmin1
22 | */
23 | public LandingPageAssistAdmin(AssistantAdmin a) {
24 | super("Assistant Academic Administrator");
25 | this.a = a;
26 |
27 | initComponents();
28 | }
29 |
30 | /**
31 | * This method is called from within the constructor to initialize the form.
32 | * WARNING: Do NOT modify this code. The content of this method is always
33 | * regenerated by the Form Editor.
34 | */
35 | @SuppressWarnings("unchecked")
36 | // //GEN-BEGIN:initComponents
37 | private void initComponents() {
38 |
39 | course_selection_header = new javax.swing.JPanel();
40 | course_management_button = new javax.swing.JButton();
41 |
42 | course_selection_header.setBorder(javax.swing.BorderFactory.createTitledBorder("Tasks"));
43 | course_selection_header.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
44 | course_selection_header.setName(""); // NOI18N
45 |
46 | course_management_button.setText("Course Management");
47 | course_management_button.addActionListener(new java.awt.event.ActionListener() {
48 | public void actionPerformed(java.awt.event.ActionEvent evt) {
49 | course_management_buttonActionPerformed(evt);
50 | }
51 | });
52 |
53 | javax.swing.GroupLayout course_selection_headerLayout = new javax.swing.GroupLayout(course_selection_header);
54 | course_selection_header.setLayout(course_selection_headerLayout);
55 | course_selection_headerLayout.setHorizontalGroup(
56 | course_selection_headerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
57 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, course_selection_headerLayout.createSequentialGroup()
58 | .addContainerGap(193, Short.MAX_VALUE)
59 | .addComponent(course_management_button)
60 | .addGap(169, 169, 169))
61 | );
62 | course_selection_headerLayout.setVerticalGroup(
63 | course_selection_headerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
64 | .addGroup(course_selection_headerLayout.createSequentialGroup()
65 | .addGap(123, 123, 123)
66 | .addComponent(course_management_button)
67 | .addContainerGap(125, Short.MAX_VALUE))
68 | );
69 |
70 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
71 | this.setLayout(layout);
72 | layout.setHorizontalGroup(
73 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
74 | .addGap(0, 525, Short.MAX_VALUE)
75 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
76 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
77 | .addContainerGap()
78 | .addComponent(course_selection_header, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
79 | .addContainerGap()))
80 | );
81 | layout.setVerticalGroup(
82 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
83 | .addGap(0, 325, Short.MAX_VALUE)
84 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
85 | .addGroup(layout.createSequentialGroup()
86 | .addContainerGap()
87 | .addComponent(course_selection_header, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
88 | .addContainerGap(20, Short.MAX_VALUE)))
89 | );
90 | }// //GEN-END:initComponents
91 |
92 | private void course_management_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_course_management_buttonActionPerformed
93 | GUIUtils.getMasterFrame(this).movePage(new CourseManagement(a));
94 | }//GEN-LAST:event_course_management_buttonActionPerformed
95 |
96 | private static final int MODIFY_COURSE = 1;
97 | private static final int DELETE_COURSE = 2;
98 |
99 | // Variables declaration - do not modify//GEN-BEGIN:variables
100 | private javax.swing.JButton course_management_button;
101 | private javax.swing.JPanel course_selection_header;
102 | // End of variables declaration//GEN-END:variables
103 | }
104 |
--------------------------------------------------------------------------------
/src/difflib/Chunk.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright 2010 Dmitry Naumenko (dm.naumenko@gmail.com)
3 |
4 | Licensed under the Apache License, Version 2.0 (the "License");
5 | you may not use this file except in compliance with the License.
6 | You may obtain a copy of the License at
7 |
8 | http://www.apache.org/licenses/LICENSE-2.0
9 |
10 | Unless required by applicable law or agreed to in writing, software
11 | distributed under the License is distributed on an "AS IS" BASIS,
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | See the License for the specific language governing permissions and
14 | limitations under the License.
15 | */
16 | package difflib;
17 |
18 | import java.util.Arrays;
19 | import java.util.List;
20 |
21 | /**
22 | * Holds the information about the part of text involved in the diff process
23 | *
24 | *
25 | * Text is represented as Object[] because the diff engine is
26 | * capable of handling more than plain ascci. In fact, arrays or lists of any
27 | * type that implements {@link java.lang.Object#hashCode hashCode()} and
28 | * {@link java.lang.Object#equals equals()} correctly can be subject to
29 | * differencing using this library.
30 | *
31 | *
32 | * @author target size");
76 | }
77 | for (int i = 0; i < size(); i++) {
78 | if (!target.get(position + i).equals(lines.get(i))) {
79 | throw new PatchFailedException(
80 | "Incorrect Chunk: the chunk content doesn't match the target");
81 | }
82 | }
83 | }
84 |
85 | /**
86 | * @return the start position of chunk in the text
87 | */
88 | public int getPosition() {
89 | return position;
90 | }
91 |
92 | public void setLines(List lines) {
93 | this.lines = lines;
94 | }
95 |
96 | /**
97 | * @return the affected lines
98 | */
99 | public List getLines() {
100 | return lines;
101 | }
102 |
103 | public int size() {
104 | return lines.size();
105 | }
106 |
107 | /**
108 | * Returns the index of the last line of the chunk.
109 | */
110 | public int last() {
111 | return getPosition() + size() - 1;
112 | }
113 |
114 | /*
115 | * (non-Javadoc)
116 | *
117 | * @see java.lang.Object#hashCode()
118 | */
119 | @Override
120 | public int hashCode() {
121 | final int prime = 31;
122 | int result = 1;
123 | result = prime * result + ((lines == null) ? 0 : lines.hashCode());
124 | result = prime * result + position;
125 | result = prime * result + size();
126 | return result;
127 | }
128 |
129 | /*
130 | * (non-Javadoc)
131 | *
132 | * @see java.lang.Object#equals(java.lang.Object)
133 | */
134 | @Override
135 | public boolean equals(Object obj) {
136 | if (this == obj)
137 | return true;
138 | if (obj == null)
139 | return false;
140 | if (getClass() != obj.getClass())
141 | return false;
142 | Chunk other = (Chunk) obj;
143 | if (lines == null) {
144 | if (other.lines != null)
145 | return false;
146 | } else if (!lines.equals(other.lines))
147 | return false;
148 | if (position != other.position)
149 | return false;
150 | return true;
151 | }
152 |
153 | @Override
154 | public String toString() {
155 | return "[position: " + position + ", size: " + size() + ", lines: " + lines + "]";
156 | }
157 |
158 | }
159 |
--------------------------------------------------------------------------------
/src/database/GradeAccess.java:
--------------------------------------------------------------------------------
1 | package database;
2 |
3 | import java.sql.*;
4 | import java.util.ArrayList;
5 |
6 | /**
7 | * Class to access grades in project SQL database.
8 | *
9 | * NOTE: This class will NOT work outside of the SFU network. It also requires
10 | * the JDBC Driver for SQL server to be in the classpath of the JVM for it to
11 | * function.
12 | *
13 | * @author Markus Balaski
14 | * @version 0.1 - 22/03/2014
15 | */
16 | public class GradeAccess {
17 | // ATTRIBUTES - CLASS VARIABLES
18 |
19 | private static Connection dbConnection; // The connection to the database
20 |
21 | // STATIC METHODS
22 |
23 | /*
24 | * Method to establish a connection to the Cypress SQL server. Uses
25 | * hard-coded login information of our group's SQL connection.
26 | */
27 | private static void establishConnection() {
28 | try { // Access the JDBC driver
29 | Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
30 | } catch (ClassNotFoundException e) {
31 | System.out.println("No JDBC driver found, exiting.");
32 | }
33 |
34 | try { // Connect to Cypress
35 | dbConnection = DriverManager
36 | .getConnection("jdbc:sqlserver://cypress.csil.sfu.ca;"
37 | + " user = c275g01; password = TAA2Md7nGrPj2LjN");
38 | } catch (SQLException e) {
39 | System.out.println("Connection failed, exiting.");
40 | }
41 | }
42 |
43 | // NON-STATIC METHODS
44 |
45 | // public static int getStudentID(String stud_name) {
46 | // String query =
47 | // "SELECT StudentID FROM c275g01A.dbo.Student WHERE StudentName = '" +
48 | // stud_name + "'";
49 | // ResultSet rs = execQuery(query);
50 | // int student_id = 666; //If you get this value, you'll know the database
51 | // didn't find anything.
52 | //
53 | // try {
54 | // rs.next();
55 | // student_id = rs.getInt(1);
56 | // } catch (SQLException ex) {
57 | // ex.printStackTrace();
58 | // }
59 | //
60 | // return student_id;
61 | // }
62 | //
63 | public static ResultSet accessGrades(String courseID, String actName) {
64 | String query = "SELECT StudentID,Grade FROM c275g01A.dbo.Grades WHERE"
65 | + " CourseID = '" + courseID + "' AND ActivityName = '"
66 | + actName + "' ORDER BY StudentID,RubricItem";
67 | return execQuery(query);
68 | }
69 |
70 | public static Object[] accessGrades(String courseID, String actName,
71 | int studentID) {
72 | ArrayList grades = new ArrayList();
73 |
74 | String query = "SELECT Grade FROM c275g01A.dbo.Grades WHERE"
75 | + " CourseID = '" + courseID + "' AND ActivityName = '"
76 | + actName + "' AND StudentID = " + studentID;
77 | ResultSet res = execQuery(query);
78 |
79 | try {
80 | while (res.next())
81 | grades.add(res.getFloat(1));
82 | } catch (SQLException e) {
83 | e.printStackTrace();
84 | }
85 |
86 | return grades.toArray();
87 | }
88 |
89 | public static void enterGrade(int studentID, String courseID,
90 | String actName, String rubricItem, float grade) throws SQLException {
91 | String query = "INSERT INTO c275g01A.dbo.Grades VALUES ('" + courseID
92 | + "','" + actName + "','" + rubricItem + "'," + studentID + ","
93 | + grade + ")";
94 | PreparedStatement prepStatement;
95 |
96 | establishConnection(); // Establish connection to Cypress
97 |
98 | prepStatement = dbConnection.prepareStatement(query);
99 | prepStatement.executeUpdate();
100 |
101 | }
102 |
103 | public static void updateGrade(int studentID, String courseID,
104 | String actName, String rubricItem, float grade) {
105 | String query = "UPDATE c275g01A.dbo.Grades SET Grade = " + grade
106 | + " WHERE StudentID = '" + studentID + "' AND CourseID = '"
107 | + courseID + "' AND ActivityName = '" + actName
108 | + "' AND RubricItem = '" + rubricItem + "'";
109 | execUpdate(query);
110 | }
111 |
112 | // HELPER METHODS
113 |
114 | /*
115 | * Method to execute an update (INSERT, DELETE, UPDATE) query on the
116 | * database connection.
117 | */
118 | private static void execUpdate(String query) {
119 | PreparedStatement prepStatement = null;
120 |
121 | establishConnection(); // Establish connection to Cypress
122 |
123 | try { // Prepare and execute the query
124 | prepStatement = dbConnection.prepareStatement(query);
125 | prepStatement.executeUpdate();
126 | } catch (SQLException e) {
127 | System.out.println("SQL Exception occured, the state : "
128 | + e.getSQLState() + "\nMessage: " + e.getMessage());
129 | }
130 | }
131 |
132 | /*
133 | * Method to execute a query on the database connection and return a result
134 | * set for the query entered as a string argument.
135 | */
136 | private static ResultSet execQuery(String query) {
137 | PreparedStatement prepStatement = null;
138 | ResultSet resSet = null;
139 |
140 | establishConnection();
141 | try { // Prepare and execute query
142 | prepStatement = dbConnection.prepareStatement(query);
143 | resSet = prepStatement.executeQuery();
144 | } catch (SQLException e) {
145 | System.out.println("SQL Exception occured, the state : "
146 | + e.getSQLState() + "\nMessage: " + e.getMessage());
147 | }
148 | return resSet;
149 | }
150 | }
--------------------------------------------------------------------------------