diff --git a/build/classes/random/text/generator/Gui$1.class b/build/classes/random/text/generator/Gui$1.class new file mode 100644 index 0000000..86169fc Binary files /dev/null and b/build/classes/random/text/generator/Gui$1.class differ diff --git a/build/classes/random/text/generator/Gui.class b/build/classes/random/text/generator/Gui.class new file mode 100644 index 0000000..b52581d Binary files /dev/null and b/build/classes/random/text/generator/Gui.class differ diff --git a/build/classes/random/text/generator/RandomTextGenerator.class b/build/classes/random/text/generator/RandomTextGenerator.class index 63b7168..0fd006a 100644 Binary files a/build/classes/random/text/generator/RandomTextGenerator.class and b/build/classes/random/text/generator/RandomTextGenerator.class differ diff --git a/build/classes/random/text/generator/SpaceEfficientGenerator.class b/build/classes/random/text/generator/SpaceEfficientGenerator.class index 41775ae..e158e81 100644 Binary files a/build/classes/random/text/generator/SpaceEfficientGenerator.class and b/build/classes/random/text/generator/SpaceEfficientGenerator.class differ diff --git a/build/classes/random/text/generator/SpeedEfficientGenerator.class b/build/classes/random/text/generator/SpeedEfficientGenerator.class index 58b6dfb..8a9b6a1 100644 Binary files a/build/classes/random/text/generator/SpeedEfficientGenerator.class and b/build/classes/random/text/generator/SpeedEfficientGenerator.class differ diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties index 08bbc8d..50acb60 100644 --- a/nbproject/private/private.properties +++ b/nbproject/private/private.properties @@ -1,2 +1,2 @@ compile.on.save=true -user.properties.file=C:\\Users\\Ma Jing\\AppData\\Roaming\\NetBeans\\8.1\\build.properties +user.properties.file=C:\\Users\\Work\\AppData\\Roaming\\NetBeans\\8.0.2\\build.properties diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml index 5403ce2..7a83fe9 100644 --- a/nbproject/private/private.xml +++ b/nbproject/private/private.xml @@ -3,7 +3,11 @@ - file:/C:/Users/Ma%20Jing/Documents/NetBeansProjects/Random%20Text%20Generator/src/random/text/generator/SpaceEfficientGenerator.java + file:/D:/OSS/Hacktoberfest/Random-Text-Generator/src/random/text/generator/SpaceEfficientGenerator.java + file:/D:/OSS/Hacktoberfest/Random-Text-Generator/src/random/text/generator/SpeedEfficientGenerator.java + file:/D:/OSS/Hacktoberfest/Random-Text-Generator/src/random/text/generator/RandomTextGenerator.java + file:/D:/OSS/Hacktoberfest/Random-Text-Generator/src/random/text/generator/WordSet.java + file:/D:/OSS/Hacktoberfest/Random-Text-Generator/src/random/text/generator/Gui.java diff --git a/src/random/text/generator/Gui.java b/src/random/text/generator/Gui.java index 719b426..772015c 100644 --- a/src/random/text/generator/Gui.java +++ b/src/random/text/generator/Gui.java @@ -32,10 +32,15 @@ public void init() { label.setAlignmentX(Component.CENTER_ALIGNMENT); panel.add(label); - JTextArea textField = new JTextArea(5, 5); - textField.setText("Not randomly generated text."); - textField.setAlignmentX(Component.CENTER_ALIGNMENT); - panel.add(textField); + JTextArea inputTextArea = new JTextArea(5, 5); + inputTextArea.setText(RandomTextGenerator.getDefaultText()); + inputTextArea.setAlignmentX(Component.CENTER_ALIGNMENT); + panel.add(inputTextArea); + + JTextArea outputTextArea = new JTextArea(5, 5); + outputTextArea.setText("Not randomly generated text."); + outputTextArea.setAlignmentX(Component.CENTER_ALIGNMENT); + panel.add(outputTextArea); JButton generateTextButton = new JButton("Generate text"); generateTextButton.setAlignmentX(Component.CENTER_ALIGNMENT); diff --git a/src/random/text/generator/RandomTextGenerator.java b/src/random/text/generator/RandomTextGenerator.java index 7088860..acff3b5 100644 --- a/src/random/text/generator/RandomTextGenerator.java +++ b/src/random/text/generator/RandomTextGenerator.java @@ -10,7 +10,21 @@ * to form a new text. This technique is called the Markov chain. */ public abstract class RandomTextGenerator { - + protected static final String defaultText = "She is into superstitions, black cats and voodoo dolls. " + + "I feel a premonition that girl is gonna make me fall. " + + "She is into new sensations, new kicks in the candle light. " + + "She has got a new addiction for every day and night. " + + "She will make you take your clothes off and go dancing in the rain. " + + "She will make you live her crazy life but she will take away your pain like a bullet to your brain. " + + "Come On! Upside, inside out she is livin la vida loca. " + + "She will push and pull you down, livin la vida loca. " + + "Her lips are devil red and her skin is the color mocha. " + + "She will wear you out livin la vida loca. Come On! Livin la vida loca, Come on! " + + "She is livin la vida loca. Woke up in New York City in a funky cheap hotel. " + + "She took my heart and she took my money. She must have slipped me a sleeping pill. " + + "She never drinks the water and makes you order French Champagne. " + + "Once you have had a taste of her you will never be the same. " + + "Yeah, she will make you go insane."; public final String[] text; public final int SETSIZE = 3; @@ -18,6 +32,10 @@ public RandomTextGenerator(String text) { this.text = text.split("\\s+"); } + public static String getDefaultText(){ + return defaultText; + } + public String generateText(int wordAmount) { if (wordAmount <= SETSIZE) return null; diff --git a/src/random/text/generator/SpaceEfficientGenerator.java b/src/random/text/generator/SpaceEfficientGenerator.java index 6a41e3f..3ae39f8 100644 --- a/src/random/text/generator/SpaceEfficientGenerator.java +++ b/src/random/text/generator/SpaceEfficientGenerator.java @@ -34,21 +34,6 @@ public ArrayList getFollowingWords(WordSet set) { * @param args the command line arguments */ public static void main(String[] args) { - final String defaultText = "She is into superstitions, black cats and voodoo dolls. " - + "I feel a premonition that girl is gonna make me fall. " - + "She is into new sensations, new kicks in the candle light. " - + "She has got a new addiction for every day and night. " - + "She will make you take your clothes off and go dancing in the rain. " - + "She will make you live her crazy life but she will take away your pain like a bullet to your brain. " - + "Come On! Upside, inside out she is livin la vida loca. " - + "She will push and pull you down, livin la vida loca. " - + "Her lips are devil red and her skin is the color mocha. " - + "She will wear you out livin la vida loca. Come On! Livin la vida loca, Come on! " - + "She is livin la vida loca. Woke up in New York City in a funky cheap hotel. " - + "She took my heart and she took my money. She must have slipped me a sleeping pill. " - + "She never drinks the water and makes you order French Champagne. " - + "Once you have had a taste of her you will never be the same. " - + "Yeah, she will make you go insane."; SpaceEfficientGenerator gen = new SpaceEfficientGenerator(defaultText); System.out.println(gen.generateText(100)); } diff --git a/src/random/text/generator/SpeedEfficientGenerator.java b/src/random/text/generator/SpeedEfficientGenerator.java index 66e973c..bbf1076 100644 --- a/src/random/text/generator/SpeedEfficientGenerator.java +++ b/src/random/text/generator/SpeedEfficientGenerator.java @@ -52,21 +52,6 @@ public ArrayList getFollowingWords(WordSet set) { * @param args the command line arguments */ public static void main(String[] args) { - final String defaultText = "She is into superstitions, black cats and voodoo dolls. " - + "I feel a premonition that girl is gonna make me fall. " - + "She is into new sensations, new kicks in the candle light. " - + "She has got a new addiction for every day and night. " - + "She will make you take your clothes off and go dancing in the rain. " - + "She will make you live her crazy life but she will take away your pain like a bullet to your brain. " - + "Come On! Upside, inside out she is livin la vida loca. " - + "She will push and pull you down, livin la vida loca. " - + "Her lips are devil red and her skin is the color mocha. " - + "She will wear you out livin la vida loca. Come On! Livin la vida loca, Come on! " - + "She is livin la vida loca. Woke up in New York City in a funky cheap hotel. " - + "She took my heart and she took my money. She must have slipped me a sleeping pill. " - + "She never drinks the water and makes you order French Champagne. " - + "Once you have had a taste of her you will never be the same. " - + "Yeah, she will make you go insane."; SpeedEfficientGenerator gen = new SpeedEfficientGenerator(defaultText); // Uncomment the line below to print all the WordSets and their following words // gen.printWordMap();