-
Notifications
You must be signed in to change notification settings - Fork 0
/
ECRL.java
38 lines (37 loc) · 966 Bytes
/
ECRL.java
1
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
import java.util.Random;
public class ECRL
{
private String virusText = "";
private String text = "";
private String virus = "";
private int num;
public ECRL(String path1, String path2, int n)
{
TextVirusExtracter tve = new TextVirusExtracter(path1, path2);
text = tve.getText();
virus = tve.getVirus();
num = n;
String[] sentences = text.split("\\.");
if(num<sentences.length)
{
for(int x = 0; x<sentences.length; x++)
{
if(x == num)
{
virusText += virus;
}
virusText += sentences[x] + ".";
}
}
else
{
System.out.print("Text is not big enough." + sentences.length);
virusText = null;
}
}
public String getVirusText()
{
System.out.println(virusText);
return virusText;
}
}