Question
MyHashMapTest.java import java.io.*; import java.util.*; public class MyHashMapTest { private HashMap > cooccs = null; public MyHashMapTest() throws FileNotFoundException { cooccs = new HashMap >();
MyHashMapTest.java
import java.io.*; import java.util.*;
public class MyHashMapTest {
private HashMap
public MyHashMapTest() throws FileNotFoundException { cooccs = new HashMap
public void generateMap() {
InputStream fis = getClass().getResourceAsStream("cooccs.txt"); InputStreamReader isr = new InputStreamReader(fis);
Scanner scanner = new Scanner(new BufferedReader(isr)); while (scanner.hasNextLine()) { String line = scanner.nextLine();
/* student code */ /* student code end */
} scanner.close();
}
public int getCooccValue(String coocc1, String coocc2) {
return -1; }
public HashMap getCooccurrents(String coocc) {
return null; }
private HashMap sortByValuesDec(HashMap map) { List list = new LinkedList(map.entrySet());
Collections.sort(list, new Comparator() { public int compare(Object o1, Object o2) { return -((Comparable) ((Map.Entry) (o1)).getValue()).compareTo(((Map.Entry) (o2)).getValue()); } });
HashMap sortedHashMap = new LinkedHashMap(); for (Iterator it = list.iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); sortedHashMap.put(entry.getKey(), entry.getValue()); } return sortedHashMap; }
public static void main(String[] args) throws IOException{
MyHashMapTest myTest = new MyHashMapTest(); myTest.generateMap();
int value1 = myTest.getCooccValue("software", "security"); int value2 = myTest.getCooccValue("security", "software");
System.out.println(value1); System.out.println(value2);
System.out.println(myTest.getCooccurrents("software")); System.out.println(myTest.getCooccurrents("security"));
} }
cooccs.txt
security part software development process process people practice application confidentiality integrity availability software result security software development process security software security mind security stage software development life cycle application process information solution software development security technology software development challenge technology advance application environment application development security application system network security attack code denial service challenge application development security point view virus horse logic bomb worm agent applet application security vulnerability software engineer software hardware control problem program practice limit sequence check user input quality data programmer practice application condition failure log information preparation audit security increase cost overhead application program language security implication core activity software development process application system definition requirement control specification design review code review system test review maintenance change management build software responsibility software engineer responsibility stakeholder management project manager business analyst quality assurance manager architect security specialist application owner developer principle number principle software security knowledge software software security protection disclosure protection alteration protection destruction request right privilege requester ability evidence management configuration session error exception practice list web security practice software developer input client side server side use domain entry encryption hash algorithm directory list data cookie randomness session flag cookie TLS SSL password policy information form field file functionality response header party library hide web server information security test attribute security test authentication authorization confidentiality availability integrity resilience security test system user resource data application data internet series server network device opportunity hacker summary system security control software hardware system network component process layer isolation organization resource data security control application development process security access application security appsec task software development life cycle development team goal security practice fix security issue application application life cycle requirement analysis design implementation verification maintenance approach subset security vulnerability application time software lifecycle tradeoff time effort cost vulnerability design review code application architecture design security problem technique phase creation threat model security review code review security engineer application source code security flaw comprehension application vulnerability application security audit use application test security vulnerability source code security tool inclusion development test environment example tool code editor cicd platform vulnerability platform application security solution website software developer individual recognition compensation report bug web application security web application security branch information security security web application web service level web application security principle application security internet web application security tool tool work traffic web application security threat web application security project resource top result research data partner organization data vulnerability application top web application security risk access control failure injection design security component identification authentification failure software data integrity failure security log monitor failure request security test security test technique vulnerability security hole application vulnerability application exploitation security test software development life cycle vulnerability manner kind tool vulnerability application tool category application vulnerability application security test source code security vulnerability application development sast application state access source code approach application security test scanner vulnerability tool attack injection flaw flaw logic business logic flaw tool input test application security test application software instrumentation strength sast dast method access code traffic library information connection configuration information product application quality assurance test application self-protection application intrusion detection prevention application dependency scanner software composition analysis usage software component vulnerability tool source code build process abstraction idea thing design software engineer software product capability security strategy tactics pattern begine software design architecture principle developer design pattern effect security design pattern security mind secure design development approach security privacy software system approach security system layer architecture design security design decision security strategy tactics pattern technique quality concern security tactics pattern solution authentication authorization confidentiality data integrity privacy accountability availability safety non-repudiation requirement system attack order security software system security architecture security strategy tactics pattern software development order security persistence attack attack software care impact security vulnerability user input practice software design design cloud native way security risk vulnerability design principle security purpose security obscurity design secrecy number attacker demotivate subset threat population logic increase complexity attacker attacker effort target technique risk set threat actor technique time secrecy method security design advantage people computer code odd flaw law disadvantage attacker code vulnerability advantage computer code disadvantage privilege privilege principle privilege example web server user root admin privilege file user flaw program system risk web server environment privilege network filesystem function compromise system security design consideration point development lifecycle development methodology design development methodology Microsoft security development Microsoft methodology guidance spiral model standard legislation standard legislation aide design definition step test system example standard cover touch design principle part UK government proposal consumer product security aspect design architecture architecture program side client client server server attack communication way security system head security mechanism man attack example detail user encryption hash security mechanism design information attacker wont access feature security design code practice example software design structure client broker structure foundation software future foundation separation client server programmer dynamics program security flaw design possibility standardization design chance
XCaLege ask yranolf the Golowing quostions while daing mo. Wast do you have to do? What tnet and edpe cous da jou have to coneider?' Thin ahorald happon before any setual implonemtation. getCosecurrenta0 of the clow Myatanhtapieart to making wa dab doo libeary's HahMap rawe. The gooll of this taik is to extract co-occurresons, to store them in a JCL. ' Brah3lap objoct and to retrime than again. Typirally, the trrm witherat cresidering the ceder of thas spprarance. The provided trxet mecurity", "Applatation ascurity", and "Secare hy design" (all three doeto sparrs. All pencetuation mouks are removed. two xperial cuex - A word pair to be comidered mat omprie difersut word. Exbe roparded. - A wod pair can orrur multiple time pes wentruce. Fsumple: If, likn in necars twion (as the word "dreign" appears twire), the manbes of necurreners for that word peir is 2 for that pooticalar matener. Barrally, you mast extract all word pocine foted in rach lian in the filn first aateace) the words "eoftwaen" and "erurity" co-ocar, jou mat wecurity's A.D Cecarity, antware's. Ax an ceamphr, the word peire of the but wateare to be conedrrod ar: 2 timen edexiga, poevelitity> 2 timen 2 timen extandardization, dexiga? 2 tamen edoxigh, taboce's 2 tames ectianes, dinegn' it time 1 shand be setarmad. The methad getCoocerraste() whould setarn all werids that a fiven word cosec co-cerurs with in docrading order mecording to the focparney inser Huchasp (value) of a givea word cosec (lay)- However, its rutries mast be ecried. For thix parpone, you con make awe of the incladed helper XCaLege ask yranolf the Golowing quostions while daing mo. Wast do you have to do? What tnet and edpe cous da jou have to coneider?' Thin ahorald happon before any setual implonemtation. getCosecurrenta0 of the clow Myatanhtapieart to making wa dab doo libeary's HahMap rawe. The gooll of this taik is to extract co-occurresons, to store them in a JCL. ' Brah3lap objoct and to retrime than again. Typirally, the trrm witherat cresidering the ceder of thas spprarance. The provided trxet mecurity", "Applatation ascurity", and "Secare hy design" (all three doeto sparrs. All pencetuation mouks are removed. two xperial cuex - A word pair to be comidered mat omprie difersut word. Exbe roparded. - A wod pair can orrur multiple time pes wentruce. Fsumple: If, likn in necars twion (as the word "dreign" appears twire), the manbes of necurreners for that word peir is 2 for that pooticalar matener. Barrally, you mast extract all word pocine foted in rach lian in the filn first aateace) the words "eoftwaen" and "erurity" co-ocar, jou mat wecurity's A.D Cecarity, antware's. Ax an ceamphr, the word peire of the but wateare to be conedrrod ar: 2 timen edexiga, poevelitity> 2 timen 2 timen extandardization, dexiga? 2 tamen edoxigh, taboce's 2 tames ectianes, dinegn' it time 1 shand be setarmad. The methad getCoocerraste() whould setarn all werids that a fiven word cosec co-cerurs with in docrading order mecording to the focparney inser Huchasp (value) of a givea word cosec (lay)- However, its rutries mast be ecried. For thix parpone, you con make awe of the incladed helperStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started