Stylistic Analysis of the Text “The Last Leaf

/* * ???????? */ package javafxgrouping; /** * * @author ?? 094632220 */ public class StudentEntity { //??????????? private String id; private String name; private String className; public StudentEntity(){ } public StudentEntity(String aID, String aName, String className) { this. id = aID; this. name = aName; this. className = className; } public String getId() { return id; } public void setId(String id) { this. id = id; } public String getName() { return name; } public void setName(String name) { this. name = name; } public String getClassName() { return className; } public void setClassName(String className) { his. className = className; } @Override public String toString() { String str = id + “,” + name + “,” + className ; return str; } } /* * ??? : TaDB. java * —————————– * ????? HashMap?????????????? HashMap?????? id(????? )? * ??????????????? ,??????? taMap? HashMap???? * ??????? ,????????? (public?? ): * TaEntity findEntry(String id):?????????????????? * String findName(String id):?????????????? * int rows():???????? * Iterator<String> getIterator():????? (????? )????? */ package javafxgrouping; import java. io. 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. Map; import java. util. StringTokenizer; /** * * @author ??????? */ public class TaDB { /*?????????? */ private Map<String, TaEntity> taMap; //?????????? (HashMap) /* ???? * ????? TaDB,???????? (TA. txt)?????????????? * ??????????????????? ,????????????? */ public TaDB(String filename) { taMap = new HashMap<>(); //?????? /*???? */ FileReader fr = null; try { fr = new FileReader(filename); } catch (FileNotFoundException e) { System. out. print(“?? ” + filename + “????! ); } /*??? */ BufferedReader bf = new BufferedReader(fr); String line; try { //???? while ((line = bf. readLine()) ! = null) { //?????????????? ,??? 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 entry = 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(), entry); } } catch (IOException e) { System. ut. print(“?? ” + filename + “????! “); } } /* * ???? id(?? )?????????? ?????????????? ,?????? null? */ public TaEntity findEntry(String id) { return taMap. get(id); } /* * ???? id(?? )???????? ?????????????? ,?????? null? */ public String findName(String id) { return taMap. get(id). getName(); } /* * ???????? */ public int rows() { return taMap. size(); } /* *????? (id)???? */ public Iterator<String> getIterator() { return taMap. keySet(). iterator(); } } /* * ???????? */ package javafxgrouping; /** * * @author ??? */ public class TaEntity { private String id; //????? private String name; //?? rivate String iid; //???? private String email; //?????? private String phone; //???? private String tutor; //???? /*???????? */ public TaEntity() { } /*???????? */ public 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. phone = aPhone; this. tutor = aTutor; } /*getter ? setter*/ public String getId() { return id; } public void setId(String ID) { this. id = ID; } public String getName() { return name; } public void setName(String name) { this. name = name; } public String getIid() { eturn iid; } public void setIid(String IID) { this. iid = IID; } public String getEmail() { return email; } public void setEmail(String email) { this. email = email; } public String getPhone() { return phone; } public void setPhone(String phone) { this. phone = phone; } public String getTutor() { return tutor; } public void setTutor(String tutor) { this. tutor = tutor; } * ???????????????? */ @Override public String toString() { String str = id + “,” + name + “,” + iid + “,” + email + “,” + phone + “,” + tutor; return str; } } /* * ???????? */ package javafxgrouping; import java. io. FileWriter; import java. io.

IOException; import java. io. PrintWriter; import java. util. ArrayList; import java. util. Iterator; import java. util. Random; import java. util. logging. Level; import java. util. logging. Logger; import javafx. application. Application; import javafx. collections. FXCollections; import javafx. collections. ObservableList; import javafx. event. ActionEvent; import javafx. event. EventHandler; import javafx. scene. Group; import javafx. scene. Scene; import javafx. scene. control. Button; import javafx. scene. control. ListView; import javafx. scene. input. MouseEvent; import javafx. scene. text. Font; import javafx. stage.

Stage; /** * * @author ??????? */ public class JavaFXGrouping extends Application { //??? HTML????????????????? private static String htmlFileName = “group. xhtml”; //??? CSS????????????????? private static String cssFileName = “style. css”; private final int sceneWidth = 900; //?????? private final int sceneHeight = 660; ////?????? private TaDB taDb = new TaDB(“src/javafxgrouping/TA. txt”); //??????? //??????? ,????????? private StudentsDB 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. rows(); private int groupNo = taDb. rows(); //???? ,?????? private Button btn = new Button(“???? “); //?? “???? “?? private Button btn1 = new Button(“?? HTML?? “); //?? “?? HTML?? “?? private ListView<String>[] group = new ListView[groupNo]; //???? ,??? 1? rivate ObservableList<String>[] myObservableList = new ObservableList[groupNo]; //???????? private Group root = new Group(); //????? @Override public 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(). ddAll(btn, btn1); //??????????? Scene scene = new Scene(root, sceneWidth, sceneHeight); //???? primaryStage. setTitle(“?????? “); //?????? primaryStage. setScene(scene); //???????? primaryStage. show(); //???? //”???? “??????? (?????? ) btn. setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { btn. setVisible(false); randomGrouping(); btn1. setVisible(true); } }); //”?? HTML?? “??????? (?????? ) btn1. setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { writeToFile(); btn1. setVisible(false); } }); } ** * ????? JavaFX?????? main()??? ???????? IDE???? FX???????????????????? * NetBeans????? main()??? * * @?? args?????????? */ public 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-font-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)) + “]”); final int i = j; group[j]. setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { 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; if (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(String fileName) { //??????? HTML?? ,????? PrintWriter wr = null; try { wr = new PrintWriter(new FileWriter(htmlFileName)); } catch (IOException ex) { Logger. getLogger(JavaFXGrouping. class. getName()). log(Level. SEVERE, null, ex); } wr. println(“<? xml version=”1. 0″ encoding=”UTF-8″? >”); wr. println(“<! DOCTYPE html>”); wr. println(“<html xmlns=”http://www. w3. org/1999/xhtml”>”); wr. println(” <head>”);

We will write a custom essay sample on
Stylistic Analysis of the Text &#8220;The Last Leaf
or any similar topic only for you
Order now

Custom writing services

×

Hi there, would you like to get such a paper? How about receiving a customized one? Check it out