Wednesday, September 2, 2020
Stylistic Analysis of the Text “The Last Leaf
/*/bundle javafxgrouping;/** * @author 094632220 */open class StudentEntity {/private String id; private String name; private String className; open StudentEntity(){ } open StudentEntity(String aID, String aName, String className) { this. id = aID; this. name = aName; this. className = className; } open String getId() { return id; } open void setId(String id) { this. id = id; } open String getName() { return name; } open void setName(String name) { this. name = name; } open String getClassName() { return className; } open void setClassName(String className) { his. className = className; } @Override open String toString() { String str = id + ââ¬Å",â⬠+ name + ââ¬Å",â⬠+ className ; return str; }/* : TaDB. java * ââ¬Ã¢â¬Ã¢â¬Ã¢â¬Ã¢â¬Ã¢â¬Ã¢â¬Ã¢â¬Ã¢â¬Ã¢â¬ * HashMap id( )? * , taMap? HashMap * , (open ): * TaEntity findEntry(String id): * String findName(String id): * int columns(): * Iterator<String> getIterator(): ( ) */bundle javafxgrouping; import java. i o. BufferedReader; import java. io. FileNotFoundException; import java. io. FileReader; mport java. io. IOException; import java. util. ArrayList; import java. util. HashMap; import java. util. Iterator; import java. util. Guide; import java. util. StringTokenizer;/** * @author */open class TaDB {/*/private Map<String, TaEntity> taMap;/(HashMap)/* TaDB, (TA. txt) * , */open TaDB(String filename) { taMap = new HashMap<>();/*/FileReader fr = invalid; attempt { fr = new FileReader(filename); } get (FileNotFoundException e) { System. out. print(ââ¬Å" â⬠+ filename + ââ¬Å"! ); }/*/BufferedReader bf = new BufferedReader(fr); String line; attempt {/while ((line = bf. readLine()) ! = invalid) {/, ta ArrayList<String> ta = new ArrayList<>(); StringTokenizer tokenizer = new StringTokenizer(line, ââ¬Å",â⬠); ta. add(tokenizer. nextToken()); while (tokenizer. hasMoreTokens()) { String token = tokenizer. nextToken(); ta. add(token); }/TaEntity passage = new TaEntity(ta. get(0), ta. get(1), ta. get(2), ta. get(3), ta. get(4), ta. get(5));/(HashMap) taMap. put(entry. getId(), passage); } get (IOException e) { System. ut. print(ââ¬Å" â⬠+ filename + ââ¬Å"! ââ¬Å"); }/* id( ) , invalid? */open TaEntity findEntry(String id) { return taMap. get(id); }/* id( ) , invalid? */open String findName(String id) { return taMap. get(id). getName(); }/*/open int lines() { return taMap. size(); }/* (id) */open Iterator<String> getIterator() { return taMap. keySet(). iterator(); }/*/bundle javafxgrouping;/** * @author */open class TaEntity { private String id;/private String name;/rivate String iid;/private String email;/private String telephone;/private String coach;/*/open TaEntity() { }/*/open TaEntity(String aID, String aName, String aIID, String aEmail, String aPhone, String aTutor) { this. id = aID; this. name = aName; this. iid = aIID; this. email = aEmail; this. telephone = aPhone; this. coach = aTutor; }/*getter ? setter*/open S tring getId() { return id; } open void setId(String ID) { this. id = ID; } open String getName() { return name; } open void setName(String name) { this. name = name; } open String getIid() { eturn iid; } open void setIid(String IID) { this. iid = IID; } open String getEmail() { return email; } open void setEmail(String email) { this. email = email; } open String getPhone() { return telephone; } open void setPhone(String telephone) { this. telephone = telephone; } open String getTutor() { return mentor; } open void setTutor(String coach) { this. mentor = guide; } */@Override open String toString() { String str = id + ââ¬Å",â⬠+ name + ââ¬Å",â⬠+ iid + ââ¬Å",â⬠+ email + ââ¬Å",â⬠+ telephone + ââ¬Å",â⬠+ coach; return str; }/*/bundle javafxgrouping; import java. io. FileWriter; import java. io.IOException; import java. io. PrintWriter; import java. util. ArrayList; import java. util. Iterator; import java. util. Irregular; import java. util. logging. Level; import java. util. logging. Lumberjack; import javafx. application. Application; import javafx. assortments. FXCollections; import javafx. assortments. ObservableList; import javafx. occasion. ActionEvent; import javafx. occasion. EventHandler; import javafx. scene. Gathering; import javafx. scene. Scene; import javafx. scene. control. Catch; import javafx. scene. control. ListView; import javafx. scene. input. MouseEvent; import javafx. scene. text. Text style; import javafx. stage.Stage;/** * @author */open class JavaFXGrouping expands Application {/HTML private static String htmlFileName = ââ¬Å"group. xhtmlâ⬠;/CSS private static String cssFileName = ââ¬Å"style. cssâ⬠; private last int sceneWidth = 900;/private last int sceneHeight = 660;/private taDb = new TaDB(ââ¬Å"src/javafxgrouping/TA. txtâ⬠);/, private studentsDb = new StudentsDB(ââ¬Å"src/javafxgrouping/Students. txtâ⬠); private ArrayList<String> taIdArray = new ArrayList<>();/d private ArrayList<String> studentIdArray = new ArrayList<>();/id private ArrayList<String> studentAdd = new ArrayList<>(); private int studentsNo = studentsDb. columns(); private int groupNo = taDb. lines();/, private Button btn = new Button(ââ¬Å" ââ¬Å");/ââ¬Å" private Button btn1 = new Button(ââ¬Å" HTML ââ¬Å");/ââ¬Å" HTML ââ¬Å" private ListView<String>[] bunch = new ListView[groupNo];/, 1? rivate ObservableList<String>[] myObservableList = new ObservableList[groupNo];/private Group root = new Group();/@Override open void start(final Stage primaryStage) {/ââ¬Å" btn. setFont(Font. font(null, 24)); btn. setLayoutX(sceneWidth â⬠240); btn. setLayoutY(20); btn. setPrefSize(220, 50);/ââ¬Å" HTML ââ¬Å" btn1. setFont(Font. font(null, 24)); btn1. setLayoutX(sceneWidth â⬠240); btn1. setLayoutY(20); btn1. setPrefSize(220, 50); btn1. setVisible(false); initArray();/taIdArray? studentIdArray drawGroupList();/, root. getChildren(). d dAll(btn, btn1);/scene = new Scene(root, sceneWidth, sceneHeight);/primaryStage. setTitle(ââ¬Å" ââ¬Å");/primaryStage. setScene(scene);/primaryStage. appear();/â⬠ââ¬Å" ( ) btn. setOnAction(new EventHandler<ActionEvent>() { @Override open void handle(ActionEvent occasion) { btn. setVisible(false); randomGrouping(); btn1. setVisible(true); });/â⬠HTML ââ¬Å" ( ) btn1. setOnAction(new EventHandler<ActionEvent>() { @Override open void handle(ActionEvent occasion) { writeToFile(); btn1. setVisible(false); }); } ** * JavaFX fundamental() IDE FX * NetBeans primary() * @ args */open static void main(String[] args) { launch(args); } private void drawGroupList() { int k; for (int j = 0; j < groupNo; j++) { myObservableList[j] = FXCollections. observableArrayList(); group[j] = new ListView<>(); group[j]. setStyle(ââ¬Å"-fx-textual style size:18;â⬠); group[j]. setItems(myObservableList[j]); group[j]. setLayoutX(20 + j * 60); group[j]. setLayoutY(20 + j * 34); group[j]. setPrefSize(360, 320); k = j + 1; myObservableList[j]. add(ââ¬Å"? â⬠+ k + ââ¬Å"? [ :â⬠+ taIdArray. et(j) + ââ¬Å",â⬠+ taDb. findName(taIdArray. get(j)) + ââ¬Å"]â⬠); last int I = j; group[j]. setOnMouseClicked(new EventHandler<MouseEvent>() { @Override open void handle(MouseEvent occasion) { group[i]. toFront(); }); root. getChildren(). add(group[j]); } private void initArray() {/id Iterator<String> taIterator = taDb. getIterator(); while (taIterator. hasNext()) { taIdArray. add(taIterator. next()); }/id , Iterator<String> studentsIterator = studentsDb. getIterator(); while (studentsIterator. hasNext()) { studentIdArray. add(studentsIterator. ext()); } private void randomGrouping() {/, int I, j, num = 0; Random studentsRandom = new Random(); for (I = 0; I < groupNo; i++) { j = 0; in the event that (I < studentsNo % groupNo) { while (((studentsNo â⬠num) ! = 0) && (j < studentsNo/groupNo + 1)) { j++ ; int studentNo = studentsRandom. nextInt(studentsNo â⬠num); myObservableList[i]. add(studentsDb. findclassName(studentIdArray. get(studentNo)) + ââ¬Å",â⬠+ studentIdArray. get(studentNo) + ââ¬Å",â⬠+ studentsDb. findName(studentIdArray. get(studentNo))); studentAdd. add(studentIdArray. et(studentNo)); studentIdArray. remove(studentNo); num++; if (num == studentsNo) { break; } else { while (((studentsNo â⬠num) ! = 0) && (j < studentsNo/groupNo)) { j++; int studentNo = studentsRandom. nextInt(studentsNo â⬠num); myObservableList[i]. add(studentsDb. findclassName(studentIdArray. get(studentNo)) + ââ¬Å",â⬠+ studentIdArray. get(studentNo) + ââ¬Å",â⬠+ studentsDb. findName(studentIdArray. get(studentNo))); studentAdd. add(studentIdArray. get(studentNo)); studentIdArray. remove(studentNo); num++; f (num == studentsNo) { break; } private void writeToFile() { writeToHtml(htmlFileName); createCss(cssFileName); } private void writeToHtml(Stri ng fileName) {/HTML , PrintWriter wr = invalid; attempt { wr = new PrintWriter(new FileWriter(htmlFileName)); } get (IOException ex) { Logger. getLogger(JavaFXGrouping. class. getName()). log(Level. Extreme, invalid, ex); } wr. println(ââ¬Å"<? xml version=â⬠1. 0â⬠³ encoding=â⬠UTF-8â⬠³? >â⬠); wr. println(ââ¬Å"<! DOCTYPE html>â⬠); wr. println(ââ¬Å"<html xmlns=â⬠http://www. w3. organization/1999/xhtmlâ⬠>â⬠); wr. println(â⬠<head>â⬠);String join = â⬠<link rel=â⬠stylesheetâ⬠href= ââ¬Å"â⬠+ cssFileName + ââ¬Å"â⬠/>â⬠; wr. println(link); wr. println(â⬠<title> </title>â⬠); wr. println(â⬠</head>â⬠); wr. println(â⬠<body>â⬠);/wr. println(ââ¬Å"<div class=â⬠resultâ⬠> </div>â⬠); wr. println(ââ¬Å"<hr/>â⬠); int I, n = 0, j,
Subscribe to:
Posts (Atom)