ΠŸΠΎΠΌΠΎΡ‰ΡŒ Π² ΡƒΡ‡Ρ‘Π±Π΅, ΠΎΡ‡Π΅Π½ΡŒ быстро...
Π Π°Π±ΠΎΡ‚Π°Π΅ΠΌ вмСстС Π΄ΠΎ ΠΏΠΎΠ±Π΅Π΄Ρ‹

Бписок ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Π½Π½Ρ‹Ρ… источников

Π Π΅Ρ„Π΅Ρ€Π°Ρ‚ΠŸΠΎΠΌΠΎΡ‰ΡŒ Π² Π½Π°ΠΏΠΈΡΠ°Π½ΠΈΠΈΠ£Π·Π½Π°Ρ‚ΡŒ ΡΡ‚ΠΎΠΈΠΌΠΎΡΡ‚ΡŒΠΌΠΎΠ΅ΠΉ Ρ€Π°Π±ΠΎΡ‚Ρ‹

TeachersTableModel ttm = new TeachersTableModel (new String{" ЀИО учитСля", «ΠŸΡ€Π΅Π΄ΠΌΠ΅Ρ‚», «ΠΠ΅Π΄Π΅Π»ΡŒΠ½Π°Ρ Π½Π°Π³Ρ€ΡƒΠ·ΠΊΠ°» }); PupilsTimeTableModel pttm = new PupilsTimeTableModel (new String{" Класс", «Π£Ρ€ΠΎΠΊ», «ΠŸΠΎΠ½Π΅Π΄Π΅Π»ΡŒΠ½ΠΈΠΊ», «Π’Ρ‚ΠΎΡ€Π½ΠΈΠΊ» ,. Рисунок А.3 — «Π”Скомпозиция Π±Π»ΠΎΠΊΠ° Π‘ΠΎΡΡ‚Π°Π²ΠΈΡ‚ΡŒ расписаниС для ΡƒΡ‡ΠΈΡ‚Π΅Π»Π΅ΠΉ». Рисунок А.4 — «Π”Скомпозиция Π±Π»ΠΎΠΊΠ° ΠŸΡ€ΠΎΠ²Π΅Ρ€ΠΈΡ‚ΡŒ ΠΏΡ€Π°Π²ΠΈΠ»ΡŒΠ½ΠΎΡΡ‚ΡŒ». Public void Connect () throws IOException… Π§ΠΈΡ‚Π°Ρ‚ΡŒ Π΅Ρ‰Ρ‘ >

Бписок ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Π½Π½Ρ‹Ρ… источников (Ρ€Π΅Ρ„Π΅Ρ€Π°Ρ‚, курсовая, Π΄ΠΈΠΏΠ»ΠΎΠΌ, ΠΊΠΎΠ½Ρ‚Ρ€ΠΎΠ»ΡŒΠ½Π°Ρ)

1. Java. ΠœΠ΅Ρ‚ΠΎΠ΄Ρ‹ программирования. Π‘Π»ΠΈΠ½ΠΎΠ² И. Н., Π ΠΎΠΌΠ°Π½Ρ‡ΠΈΠΊ Π’. Π‘. — ΠœΠΈΠ½ΡΠΊ: Π˜Π·Π΄Π°Ρ‚Π΅Π»ΡŒΡΡ‚Π²ΠΎ «Π§Π΅Ρ‚Ρ‹Ρ€Π΅ Ρ‡Π΅Ρ‚Π²Π΅Ρ€Ρ‚ΠΈ», 2013.

ΠŸΠ Π˜Π›ΠžΠ–Π•ΠΠ˜Π―

ΠŸΡ€ΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅ А

(ΠΎΠ±ΡΠ·Π°Ρ‚Π΅Π»ΡŒΠ½ΠΎΠ΅)

Π€ΡƒΠ½ΠΊΡ†ΠΈΠΎΠ½Π°Π»ΡŒΠ½Π°Ρ модСль Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠΈ расписания занятий

А.1 - Β«ΠšΠΎΠ½Ρ‚Π΅ΠΊΡΡ‚Π½Π°Ρ Π΄ΠΈΠ°Π³Ρ€Π°ΠΌΠΌΠ°Β».

Рисунок А.1 — «ΠšΠΎΠ½Ρ‚Скстная Π΄ΠΈΠ°Π³Ρ€Π°ΠΌΠΌΠ°».

А.2 - «ДСкомпозиция контСкстной Π΄ΠΈΠ°Π³Ρ€Π°ΠΌΠΌΡ‹Β».

Рисунок А.2 — «Π”Скомпозиция контСкстной Π΄ΠΈΠ°Π³Ρ€Π°ΠΌΠΌΡ‹».

ΠŸΡ€ΠΎΠ΄ΠΎΠ»ΠΆΠ΅Π½ΠΈΠ΅ прилоТСния А.

А.3 - «ДСкомпозиция Π±Π»ΠΎΠΊΠ° Π‘ΠΎΡΡ‚Π°Π²ΠΈΡ‚ΡŒ расписаниС для ΡƒΡ‡ΠΈΡ‚Π΅Π»Π΅ΠΉΒ».

Рисунок А.3 — «Π”Скомпозиция Π±Π»ΠΎΠΊΠ° Π‘ΠΎΡΡ‚Π°Π²ΠΈΡ‚ΡŒ расписаниС для ΡƒΡ‡ΠΈΡ‚Π΅Π»Π΅ΠΉ».

А.4 - «ДСкомпозиция Π±Π»ΠΎΠΊΠ° ΠŸΡ€ΠΎΠ²Π΅Ρ€ΠΈΡ‚ΡŒ ΠΏΡ€Π°Π²ΠΈΠ»ΡŒΠ½ΠΎΡΡ‚ΡŒΒ».

Рисунок А.4 — «Π”Скомпозиция Π±Π»ΠΎΠΊΠ° ΠŸΡ€ΠΎΠ²Π΅Ρ€ΠΈΡ‚ΡŒ ΠΏΡ€Π°Π²ΠΈΠ»ΡŒΠ½ΠΎΡΡ‚ΡŒ».

ΠŸΡ€ΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅ Π‘

Листинг ΠΊΠΎΠ΄Π° ΠΊΠ»ΡŽΡ‡Π΅Π²Ρ‹Ρ… классов

public class ClientConnector {.

//static ServerSocket variable.

private static ServerSocket server;

//socket server port on which it will listen.

// private static int port;

public ClientConnector () throws IOException {.

/**.

* Reading info about port from file*/.

BufferedReader fis = new BufferedReader (new InputStreamReader (new FileInputStream («port.txt»)));

String line = fis. readLine ();

fis.close ();

server = new ServerSocket (Integer.parseInt (line));

}.

public void Connect () throws IOException, ClassNotFoundException, InterruptedException, SQLException {.

while (true){.

System.out.println («Waiting for client request…»);

//creating socket and waiting for client connection.

Socket socket = server. accept ();

//read from socket to ObjectInputStream object.

ObjectInputStream ois = new ObjectInputStream (socket.getInputStream ());

ObjectOutputStream oos = new ObjectOutputStream (socket.getOutputStream ());

oos.writeObject («Server connected»);

while (true){.

String str = (String) ois. readObject ();

if (str.equals («sending school»)) {.

System.out.println (str);

School school;

school = (School) ois. readObject ();

ObjectOutputStream out = new ObjectOutputStream (new FileOutputStream («school.txt»));

out.writeObject (school);

}.

if (str.equals («send call table»)) {.

System.out.println (str);

CallTableModel ctm = new CallTableModel (new String[]{" Π£Ρ€ΠΎΠΊ", «ΠΠ°Ρ‡Π°Π»ΠΎ», «ΠšΠΎΠ½Π΅Ρ†» });

CallTableOperation cto = new CallTableOperation ();

ctm = cto. initRows (ctm);

oos.writeObject (ctm);

}.

if (str.equals («Client connected»)).

System.out.println (str);

if (str.equals («update call table»)).

{.

System.out.println (str);

CallTableModel ctm;

ctm = (CallTableModel) ois. readObject ().

CallTableOperation cto = new CallTableOperation ();

cto.update (ctm);

}.

if (str.equals («send teachers table»)){.

System.out.println (str);

TeachersTableModel ttm = new TeachersTableModel (new String[]{" ЀИО учитСля", «ΠŸΡ€Π΅Π΄ΠΌΠ΅Ρ‚», «ΠΠ΅Π΄Π΅Π»ΡŒΠ½Π°Ρ Π½Π°Π³Ρ€ΡƒΠ·ΠΊΠ°» });

TeachersTableOperation tto = new TeachersTableOperation ();

ttm = tto. initRows (ttm);

oos.writeObject (ttm);

}.

if (str.equals («update teachers table»)).

{.

System.out.println (str);

TeachersTableModel ttm;

ttm = (TeachersTableModel) ois. readObject ();

TeachersTableOperation tto = new TeachersTableOperation ();

tto.update (ttm);

}.

if (str.equals («send classes table»)){.

System.out.println (str);

ClassesTableModel ctm = new ClassesTableModel (new String[]{" ΠŸΠ°Ρ€Π°Π»Π»Π΅Π»ΡŒ", «Π‘ΡƒΠΊΠ²Π°» });

ClassesTableOperation cto = new ClassesTableOperation ();

ctm = cto. init (ctm);

oos.writeObject (ctm);

}.

if (str.equals («update classes table»)).

{.

System.out.println (str);

ClassesTableModel ctm;

ctm = (ClassesTableModel) ois. readObject ();

ClassesTableOperation cto = new ClassesTableOperation ();

cto.update (ctm);

}.

if (str.equals («exit»)){.

break;

}.

if (str.equals («send school»)) {.

System.out.println (str);

ObjectInputStream in = new ObjectInputStream (new FileInputStream («school.txt»));

School school = (School)in.readObject ();

oos.writeObject (school);

}.

if (str.equals («sending teacherstimetable»)) {.

System.out.println (str);

TeachersTimeTableModel tttm;

TeachersTimeTableOperation ttto = new TeachersTimeTableOperation ();

tttm = (TeachersTimeTableModel) ois. readObject ();

ttto.update (tttm);

}.

if (str.equals («send teacherstimetable»)) {.

System.out.println (str);

TeachersTimeTableModel tttm = new TeachersTimeTableModel (new String[]{" Π£Ρ‡ΠΈΡ‚Π΅Π»ΡŒ", «Π’рСмя», «ΠŸΠΎΠ½Π΅Π΄Π΅Π»ΡŒΠ½ΠΈΠΊ», «Π’Ρ‚ΠΎΡ€Π½ΠΈΠΊ» ,.

Π‘Ρ€Π΅Π΄Π°", «Π§Π΅Ρ‚Π²Π΅Ρ€Π³», «ΠŸΡΡ‚Π½ΠΈΡ†Π°», «Π‘ΡƒΠ±Π±ΠΎΡ‚Π°» });

TeachersTimeTableOperation ttto = new TeachersTimeTableOperation ();

tttm = ttto. init (tttm);

oos.writeObject (tttm);

}.

ois.close ();

oos.close ();

socket.close ();

public class MySQLConnector {.

private static final String URL = «jdbc:mysql://localhost:3306/timetable» ;

private static final String USERNAME = «root» ;

private static final String PASSWORD = «root» ;

private Connection connection;

public Connection getConnection () {.

return connection;

}.

public MySQLConnector (){.

try {.

Driver driver = new FabricMySQLDriver ();

DriverManager.registerDriver (driver);

connection = DriverManager. getConnection (URL, USERNAME, PASSWORD);

}.

catch (SQLException e){.

e.printStackTrace ();

}.

}.

public ResultSet executeQuery (String query) throws SQLException {.

Statement statement = this. getConnection ().createStatement ();

ResultSet res = statement. executeQuery (query);

return res;

}.

public class GeneratePupilsTable {.

public GeneratePupilsTable (){}.

public Object replaceTeachersAndSubjects (Object object) throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, IOException {.

TeachersTableModel ttm;

ServerConnector connector = new ServerConnector ();

connector.setOnlineMode ();

connector.sendToServer («send teachers table»);

ttm = (TeachersTableModel) connector. receive (connector.getOis ());

connector.setOffLineMode ();

for (int i = 0; i < ttm. getRowCount (); i++) {.

if (ttm.getValueAt (i, 0).equals (object)) {.

object = String. valueOf (ttm.getValueAt (i, 1));

break;

}.

}.

return object;

}.

public List returnLessons () throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, IOException {.

CallTableModel ctm;

ServerConnector connector = new ServerConnector ();

connector.setOnlineMode ();

connector.sendToServer («send call table»);

ctm = (CallTableModel) connector. receive (connector.getOis ());

connector.setOffLineMode ();

String element;

List list = new ArrayList ();

for (int i = 0; i < ctm. getRowCount (); i++) {.

element = String. valueOf (ctm.getValueAt (i, 0));

list.add (i, element);

}.

return list;

}.

public List returnClasses () throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException, IOException {.

assesTableModel ctm;

ServerConnector connector = new ServerConnector ();

connector.setOnlineMode ();

connector.sendToServer («send classes table»);

ctm = (ClassesTableModel) connector. receive (connector.getOis ());

connector.setOffLineMode ();

String element;

List list = new ArrayList ();

for (int i = 0; i < ctm. getRowCount (); i++) {.

String part1 = String. valueOf (ctm.getValueAt (i, 0));

String part2 = String. valueOf (ctm.getValueAt (i, 1));

element = part1 + part2;

list.add (i, element);

}.

return list;

}.

public PupilsTimeTableModel generatePupilsTimeTable () throws IOException, ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException {.

ServerConnector connector = new ServerConnector ();

connector.setOnlineMode ();

connector.sendToServer («send teacherstimetable»);

TeachersTimeTableModel tttm = (TeachersTimeTableModel) connector. receive (connector.getOis ());

connector.setOffLineMode ();

PupilsTimeTableModel pttm = new PupilsTimeTableModel (new String[]{" Класс", «Π£Ρ€ΠΎΠΊ», «ΠŸΠΎΠ½Π΅Π΄Π΅Π»ΡŒΠ½ΠΈΠΊ», «Π’Ρ‚ΠΎΡ€Π½ΠΈΠΊ» ,.

" Π‘Ρ€Π΅Π΄Π°", «Π§Π΅Ρ‚Π²Π΅Ρ€Π³», «ΠŸΡΡ‚Π½ΠΈΡ†Π°», «Π‘ΡƒΠ±Π±ΠΎΡ‚Π°» });

List classes = this. returnClasses ();

List lessons = this. returnLessons ();

for (int i = 0; i < classes. size (); i++).

for (int j = 0; j < lessons. size (); j++).

pttm.addRow (new String[] {classes.get (i), lessons. get (j), «», «», «», «», «», «» });

for (int i = 0; i < tttm. getRowCount (); i++).

for (int j = 2; j < tttm. getColumnCount (); j++).

{.

String element = String. valueOf (tttm.getValueAt (i, j));

for (int k = 0; k < pttm. getRowCount (); k++).

{.

if (pttm.getValueAt (k, 0).equals (element)){.

int q = i%lessons.size ();

pttm.setValueAt (replaceTeachersAndSubjects (tttm.getValueAt (i, 0)), (q+k), j);

break;

return pttm;

ΠŸΠΎΠΊΠ°Π·Π°Ρ‚ΡŒ вСсь тСкст
Π—Π°ΠΏΠΎΠ»Π½ΠΈΡ‚ΡŒ Ρ„ΠΎΡ€ΠΌΡƒ Ρ‚Π΅ΠΊΡƒΡ‰Π΅ΠΉ Ρ€Π°Π±ΠΎΡ‚ΠΎΠΉ