method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
76f26e4f-1e18-4bf3-883b-94e6be7c547c
0
public int getViewerCount() { return viewerCount; }
a35f072b-1806-45e2-afcf-d66c4176628f
9
public static void m92_screenrefresh(osd_bitmap bitmap,rectangle clip) { if (pf3_shape != 0) /* Updating all tilemaps causes palette overflow */ tilemap_update(pf3_wide_layer); else tilemap_update(pf3_layer); tilemap_update(pf2_layer); if (pf1_shape != 0) tilemap_update(pf1_wide_layer); else tile...
74ec5225-97d0-4fd3-acda-87a84b4e57e0
4
public static TorrentInfo getTorrentInfo(File torrentFile) { FileInputStream fis = null; TorrentInfo ti = null; try { fis = new FileInputStream(torrentFile); } catch (FileNotFoundException e) { System.err.println("File not found"); System.exit(1); } byte [] bytes = new byte[(int) torre...
cbec44aa-c371-4828-88aa-fdab938d7a2d
2
@Override public void earlyStartup() { Display.getDefault().asyncExec(new Runnable() { public void run() { IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); // get preference store of this plugin IPreferenceS...
8bd74426-9200-4bec-a89f-1f6f5a929e3f
3
synchronized public static org.omg.CORBA.TypeCode type () { if (__typeCode == null) { synchronized (org.omg.CORBA.TypeCode.class) { if (__typeCode == null) { if (__active) { return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); } ...
e85ac7b7-2e42-4b91-bcc0-d3ea2e6070ab
6
public SimpleNode interpret(Environment env) { env.print(); if (((SimpleNode)jjtGetChild(0)).type.equals("ident")) return ((SimpleNode) ((SimpleNode)jjtGetChild(0)).interpret(env).jjtGetChild(0)).interpret(env); else if (((SimpleNode)jjtGetChild(0).jjtGetChild(0)).type.equals("ident") || ((SimpleNode)...
49bb9a73-3eba-4cf8-b312-a4c50314c70a
0
void clearIndicator() { hboxIndicator.getChildren().remove(indicator); errorMessage.setVisible(false); }
22361d9a-af07-4fb1-b86e-e3637feed603
6
public int getMenuSize() { if(prayings.size() <= 9) return 9; if(prayings.size() <= 18) return 18; if(prayings.size() <= 27) return 27; if(prayings.size() <= 36) return 36; if(prayings.size() <= 45) return 45; if(prayings.size() <= 54) return 54; return 0; }
de03844e-cfda-456c-b4ba-7400c3854489
7
static void P(){ int S = 0; int O = 0; int SMax=19; int OMax=19; int STemp = 0; int OTemp = 0; int OCounter = 0; while(O <= OMax){ S = 0; while(S <= SMax){ //code start OTemp = 0; STemp = S; while(STemp >= 5){ STemp = STemp - 5; OTemp = OTemp + 1; } //code en...
3d583ad8-a245-42f2-b01a-c6c84ff54904
2
private void siirryLuvunLoppuun() { while (true) { if (!merkkiOsaLukua()) { break; } paikka++; } }
568b4b7d-235f-4d5c-bb72-c60413fbf422
4
public void processData(String link, String urlText, WriteToCsvPostsFile writeToCSV, int howTimes){ Document doc; try { doc = Jsoup.connect(link).userAgent("Mozilla").get(); Element body = doc.body(); if(body!=null) { findAllPosts(body); } } catch (SocketTimeoutException a){ //try three times t...
0cf5129e-2f01-4b23-b5e0-a319fc5d2d7c
1
public PreferenceBoolean getApplyFontStyleForEditability() { if (useDocumentSettings()) { return this.applyFontStyleForEditability; } else { return Preferences.getPreferenceBoolean(Preferences.APPLY_FONT_STYLE_FOR_EDITABILITY); } }
2576dfc7-99d7-468c-9b7c-e56660f4e475
5
public static void main(String[] args) { //ExtractionService extractor = new ExtractionService(); CoreNlpParser parser = new CoreNlpParser(); String sentence = "A rare black squirrel has become a regular visitor to a suburban garden"; Tree root = parser.parseAndRemovePeriods(sentence)[0]; List<Tripl...
058e79d9-7f65-40bc-80e3-7bd3e863c323
5
@Override public void deserialize(Buffer buf) { barType = buf.readByte(); if (barType < 0) throw new RuntimeException("Forbidden value on barType = " + barType + ", it doesn't respect the following condition : barType < 0"); firstSlot = buf.readInt(); if (firstSlot < 0 ||...
2628f0d1-8dc3-42cc-b89d-066089158c2f
4
public void schrijfQuizzenNaarBestand(QuizCatalogus quizCatalogus) { File file = new File("bestanden/quizzen"); try { PrintWriter writer = new PrintWriter(file); for (int i = 0; i < quizCatalogus.getQuizzen().size(); i++) { Quiz quiz = quizCatalogus.getQuizzen().get(i); String lijn = quiz.getId() + ",...
b19236f8-a8eb-4364-852a-29d2fe68bfea
2
public static void main(String[] args) throws Exception { // TODO Auto-generated method stub File file = new File("C:/1.txt"); in = new BufferedReader(new FileReader(file)); String line; while ((line = in.readLine()) != null) { char[] array = line.toCharArray(); int sum = 0; ...
eaccac6c-f627-4252-8cdc-3437d525b0e7
4
private void loadDatabase() { //Declare a few local variables for later use ClassLoader currentClassLoader = null; Field cacheField = null; boolean cacheValue = true; try { //Store the current ClassLoader, so it can be reverted later currentClassLoader = ...
fced7fb8-d576-4c3b-97e0-09a24fdd2694
3
public static void printAll() { try { PreparedStatement stmt = Main.EMART_CONNECTION.prepareStatement("select * from sale"); ResultSet rs = stmt.executeQuery(); System.out.println("Orders:"); while (rs.next()) { System.out.println("Order:"); System.out.println(rs.getString("order_id") + " |...
11f45192-7f2d-44d2-9b52-bfa3929e829e
7
public static void main(String[] args) { if(args.length != 1){ System.out.println("Invalid number of parameters. Application will exit."); System.exit(0); } try{ WSDLDomParser wsdlParser = new WSDLDomParser(args[0]); System.out.println("Service name: " + wsdlParser.getServiceName()); System.out.pri...
389228a2-3db6-42bb-a5ca-cf2a38da7051
9
private boolean startExpr(Symbol token) { return lexer.token == Symbol.FALSE || lexer.token == Symbol.TRUE || lexer.token == Symbol.NOT || lexer.token == Symbol.THIS || lexer.token == Symbol.NUMBER || lexer.token == Symbol.SUPER || lexer.token...
7cf8437b-eb8c-4a7e-a7ae-9a3903bbfe3b
4
public void avanzar() { switch (direccion) { case ARRIBA: ArribaM(); break; case ABAJO: AbajoM(); break; case IZQUIERDA: IzquierdaM(); break; case DERECHA: DerechaM(); break; } }
d4c1bfc7-a193-40a2-a334-87c97fc7fd45
0
public ISocketServerConnection getClientConnection() { return clientConnection; }
821c243d-94c5-4bb6-bb38-62c358546176
3
public static boolean isPositiveInteger(String s){ try { Integer.parseInt(s); } catch(NumberFormatException e) { return false; } int var = Integer.parseInt(s); if (var > 0 && var <= 1000) { return true; } else { return false...
a67de258-cbe7-41be-9875-ec81bc9e1afa
2
public boolean isValid(String urlString) { URL url = null; try { url = new URL(urlString); } catch (MalformedURLException e) { return false; } URLConnection conn; try { conn = url.openConnection(); conn.connect(); } catch (IOException e) { return false; } return true; }
f50af288-92ed-4a35-998d-3a60b9516f29
7
public static Cons walkSysCallTree(Cons tree, Object [] MV_returnarray) { { Slot slot = Cons.slotFromExpressionTree(tree); StandardObject slottype = Stella.SGT_STELLA_UNKNOWN; if (slot != null) { slottype = ((CompoundTypeSpecifier)(KeyValueList.dynamicSlotValue(slot.dynamicSlots, Stella.SYM_STE...
4370e0b6-5d63-424f-aa5a-e0ec8a71c725
4
private void MoreSellMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_MoreSellMouseClicked // TODO add your handling code here: List<String> s = new Conectar().GetFecha(); String f = null; int x,y; Map<Integer,Integer> in = new TreeMap<Integer,Integer>(); ...
67f41c6e-2511-4deb-9f81-b72158e678aa
0
public void setEmail(String email) { this.email = email; }
0cdd9be0-d27f-4c23-bda3-5205f44e1be4
7
@Override public void moveInto(GameEntity target) { if (target instanceof Monster) { int damage = attack((Actor) target); if (((Actor) target).applyDamage(damage, this)) { char fl = getName().charAt(0); GamePanel.get().logMessage( ...
a3155087-6a92-4b46-9b66-21c28c030d90
3
public static String replaceAll(String str, Pattern regex, Replacer replacer){ if(regex==null){ throw new ESTypeException("A regex must be provided"); } if(replacer==null){ throw new ESTypeException("A replacer must be provided"); } Matcher matcher=regex.matcher(str); StringBuffer sb = new StringBuffe...
8bfbded1-5ad9-4745-a261-4f580b51ab45
9
protected SnmpValue decodeValueContext() throws BerException { try { byte tag = (byte)decodeTag(-1); int length = decodeLength(); if (debug) dump("Context " + tag + " length " + length + " " + SNMP_ENDOFMIBVIEW); if ...
75c17914-1929-4f06-8cd3-3adb4a3fc45f
2
@Override public void deleteMax() throws EmptyCollectionException, KeyNotFoundException { if (treeIsEmpty()) throw new EmptyCollectionException(); Node x = root; while (x.right != null) x = x.right; delete(x.key); }
a1095b23-8e11-492e-befa-82dce30c9e4e
3
private long calc(int pos, int n) { if (pos < numbers.length && (pos + n - 1) < numbers.length) { long v = 1; for (int i = pos - 1; i < pos + n - 1; i++) { v *= numbers[i]; } return v; } return 0; }
b170ff79-f959-482b-ad4e-f249809deefd
3
@Override public void update() { if (!entityRemoveBuffer.isEmpty()) { removeEntities(); entityRemoveBuffer.clear(); } if (!entityChangeBuffer.isEmpty()) { checkEntities(); entityChangeBuffer.clear(); } for (Entity entity : entities) { process(entity); } }
77c29122-f0e5-44d8-8d45-3e80a5993a64
7
public static Integer getNumeros(String numeroString) { StringTokenizer st = new StringTokenizer(numeroString); List lstLetras = Arrays.asList(Letras); Integer numero = 0; Integer mil = 0; Integer millon = 0; while (st.hasMoreTokens()) { String t = st.nextTok...
092ed36f-fbcb-46ed-924d-c249880b9328
1
boolean dejaLugarAOtro() { if(criterioInscripcion instanceof ModoSolidario){ return true; } else { return false; } }
857d50da-a294-4d35-b60e-27d7d89db0bb
4
public static Record getRecordByXMLElem(XMLElement root) { if (!root.attributeMap.containsKey("type")) { System.out.println("Record should contain attribute 'type'"); return null; } String type = root.attributeMap.get("type"); if (type.equals("quiz-taken")) { return QuizTakenRecord.getQuizTakenRecordBy...
5da5903f-876f-49c4-828d-ca28f356dd86
1
private boolean jj_2_17(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_17(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(16, xla); } }
7b7e12c9-d1de-4b13-8b66-0b6d27677b36
8
public Instance nextInstance() { double attrib1 = 0, attrib2 = 0, attrib3 = 0; int group = 0; boolean desiredClassFound = false; while (!desiredClassFound) { // generate attributes attrib1 = 10 * this.instanceRandom.nextDouble(); attrib2 = 10 * this.in...
ee9ada99-1be6-497e-b452-3255adb5fc30
0
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Round " + round + ":\n"); sb.append("Payload: (" + PAYLOAD_SIZE + " bytes)\n"); sb.append(Arrays.toString(payload)); return sb.toString(); }
7b424f48-7810-4b12-bfec-a050732ffb58
0
public ToolAdapter(AutomatonPane pane) { this.pane = pane; }
82a3da18-1657-4af8-b0e4-dab75cff9b17
0
private void refreshLabels() { setTitle(settings.getLanguage().getLabel("title_settings")); languageLabel.setText(settings.getLanguage().getLabel("label_language")); nameLabel.setText(settings.getLanguage().getLabel("label_name")); portLabel.setText(settings.getLanguage().getLabel("label_port")); minimizeToTr...
f2df0b5f-99c7-41d8-bda7-9d153ddabc41
4
private void updateSelection(int x, int y) { //check which button is at the point x,y and select it and update cursor if (onNewPlayer(x, y)) { setCursor(new Cursor(Cursor.HAND_CURSOR)); selected = ButtonSelected.NEW; } else if (onLoadPlayer(x, y)) { setCursor(new Cursor(Cursor.HAND_CURSOR)); selected ...
8ca9e0a4-bbd4-4887-bc42-97a3f427159e
6
private void privFlushPages(PageId pageid, int all_pages) throws HashOperationException, PageUnpinnedException, PagePinnedException, PageNotFoundException, BufMgrException, IOException { // The current page Page curPage; // The current frame descriptor FrameDesc fr...
238fc911-0a52-4f9b-99da-c66c7867b8a5
0
public int getAlertid() { return alertid; }
69ce2a97-ba88-486d-9d11-d9cd3ece61dc
6
public static ArrayList<Planet> forShips(SimulatedPlanetWars simpw){ ArrayList<Planet> asw = new ArrayList<Planet>(2); // Find the biggest fleet to attack with and our weakest planet to know what is our goal of fleet to be destroyed in the enemey int maxShips = 0; int minShips = 1000; for (Planet p : simpw.My...
1293be0e-287d-4da9-98a4-5f392279f29b
2
public void testThreeArgsConstructorException() { // first case : the nominator is null. constructor should fail. try { Quantity testo = new Quantity(100 , null, Arrays.asList("this homework is too hard")); fail(); } // test is passed. no need to catch anything. c...
0f5ca06e-ee05-473b-9c7a-c208ceffd877
0
public Chunk(int biome, int initResources, Point loc) { this.loc = loc; this.setBiome(biome); this.setResources(initResources); }
32a2e24d-198d-4e29-9fc0-c1a6be15f202
5
public void playerKeyPress(int down, int up, int right, int left, int bomb) { if (Keyboard.isKeyDown(down)) { update(Direction.DOWN); xOffset = 0.0f; } if (Keyboard.isKeyDown(up)) { update(Direction.UP); xOffset = 0.25f; } if (Keybo...
700a300c-760e-49be-984a-11c63c45832c
6
public void update(){ player.update(); player.checkAttack(enemies); player.checkCoins(coins); finish.update(); finish.checkGrab(player); // System.out.println(player.gety()); // System.out.println(player.getx()); bg.setPosition(tileMap.getx(), tileMap.gety()); tileMap.setPosition( GamePa...
3da7efac-9d90-4e0c-95c5-bf6ad5a18bd5
5
public boolean existBlackForest(){ for(int i=0;i<getDim();i++) for(int j=0;j<getDim();j++) if(!damiera[i][j].isFree() && damiera[i][j].getPezzo().getColore()==Color.BLACK) if(!damiera[i][j].getPezzo().getAlberoMosse().isSAMNull()) return true; return false; }
ba33684c-b27e-4c5b-9fc2-4de73cb790b9
3
public final void mapCommand(String command, Action a) { if(commandMap.containsKey(command)) System.err.println("[CLC] Command " + command + " has already been registered."); else if(a == null) { System.err.println("[CLC] Command " + command + " can not be linked to a null Action."); } else if(contextMap.c...
b6be7436-a2bc-4ae9-b870-13d170f07dc3
3
@Override public Temporal adjustInto(Temporal input) { LocalDate date = LocalDate.from(input); if (date.getDayOfWeek() == DayOfWeek.FRIDAY || date.getDayOfWeek() == DayOfWeek.SATURDAY || date.getDayOfWeek() == DayOfWeek.SUNDAY){ ret...
c83743ff-3185-463a-ac6d-b87827bb017c
9
public int findRankBinary(int[][] matrix) { int n = matrix.length; int m = matrix[0].length; // number of linearly independent row vector so far int row = 0; for (int i = 0; i < m; i++) { // for every column, scan the entire column int max = 0; int maxRow = 0; for (int j = row; j < n; j++) { i...
8016c133-a4bd-4782-b36a-1004ef5f7700
0
public void destroy() { super.destroy(); // Just puts "destroy" string in log // Put your code here }
04dabe8e-8282-49a7-9b4b-7044ef3314eb
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Controller other = (Controller) obj; if (jsRoutes == null) { if (other.jsRoutes != null) return false; } ...
57878151-3f64-4336-ab6a-c0616f020a8e
7
public Path shortestPath(Vertex start, Vertex end) { checkVertexExists(start); checkVertexExists(end); DHeap<Vertex> pq = new DHeap<Vertex>(2); Map<Vertex, Vertex> prevMap = new HashMap<Vertex, Vertex>(); /* v_k -> v_k+1 if v_k+1 is the previous vertex on the shortest path to v_k */ for (Vertex v : grap...
90c1d94e-89e0-4434-b632-35604504229d
6
public void repaintData() { if ( currentEntry != null ) { TProjectData current = TGlobal.projects.getCurrentData() ; int len = langFields.length ; for ( int t = 0 ; t < len ; t++ ) { String str = current.getTranslation( currentEntry, t ) ; TLangTextField field = langFie...
19df6b83-66f1-4469-89fd-ddca072073d0
2
@Override public void disconnect() throws Exception { try { if ((keepAliveThread != null) && (keepAliveThread.isAlive())) { keepAliveThread.setStopped(true); } } finally { super.disconnect(); } }
2865e12d-4895-49bb-94f8-94f28b27ec03
0
public Queue<Grid> getStack() { return stack; }
c7a9bd7e-7578-482f-abb5-b3f27456886e
5
public boolean keyup(KeyEvent ev) { if (focusctl) { if (focused != null) { if (focused.keyup(ev)) return (true); return (false); } else { return (false); } } else { for (Widget wdg = child; wdg != null; wdg = wdg.next) { if (wdg.keyup(ev)) return (true); } } return (fals...
66a9d0a8-c9b2-4113-b8f2-295eb93eef31
2
private void viewResultsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_viewResultsButtonActionPerformed if(getProposal().getAuthor() == FOTE.getUser().getId() || ProposalLogic.isExpired(getProposal())){ new ViewResults((Frame) this.getParent(), true, getProposal()).setVisib...
139801ab-e36c-4506-b252-f9af914c4a75
1
public void loadFromImage(){ try { BufferedImage img = ImageIO.read(new File("res/Map.png")); createWorld(img); loading = false; } catch (IOException e) { e.printStackTrace(); } }
18a68da8-dbdd-4cae-b9c4-97a0288509e5
7
public void initialize() throws Exception { // EXC for (int e=0; e<5; e++) { client.callProcedure(new BenchmarkCallback("EXC.insert"),"EXC.insert",e); } System.out.println(" loaded 5 records into EXC"); // SEC for (int s=0; s<numSecs; s++) { ...
07d30eeb-c1c4-4e1e-a820-a2ef3c187325
9
public void reLoadDomains(CyNetwork network) { hitMap = new HashMap<CyIdentifiable, List<CDDHit>>(); featureMap = new HashMap<CyIdentifiable, List<CDDFeature>>(); pdbChainMap = new HashMap<CyIdentifiable, List<PDBStructure>>(); // System.out.println("Reloading domains"); boolean havePDB = PDBStructure.haveP...
b1cf04c7-1abf-42ea-941f-45c7bc06c94d
4
public void update() { checkTileMapCollision(); setPosition(xtemp, ytemp); if (dx == 0 && !hit) { setHit(); } animation.update(); if (hit && animation.hasPlayedOnce()) { remove = true; } }
72fbc3e1-7320-43e9-a16a-ba78f1a1dcf6
3
public mxICellOverlay removeCellOverlay(Object cell, mxICellOverlay overlay) { if (overlay == null) { removeCellOverlays(cell); } else { mxICellOverlay[] arr = getCellOverlays(cell); if (arr != null) { // TODO: Use arraycopy from/to same array to speed this up List<mxICellOverlay> list =...
f7d6d752-c0f4-4209-bb8e-56864dde193a
9
public static String determineBondType(Formula formula) { List<String> elements = formula.getElements(); List<String> elementTypes = new ArrayList<String>(); for (String element : elements) { elementTypes.add(typeList.get(element)); } String bondType = null; if (elementTypes.contains(...
3beee53d-d0be-4112-9836-fc16f46f40f3
9
@Override public void deconneced(OVNode n) { if (n.equals(inNode_)) { if (isFree() ||( inNode_.getConnections().size()==1 && outNode_.isFree())) { outNode_.setType(ValueType.VOID); inNode_.setType(ValueType.VOID); } else if (inNode_.isFree() && !outNod...
dee74c69-4095-4551-a7a6-31c47f502c81
6
public void setVisible(boolean visible) { // // Centering About windows // if (visible && fWhichAbout != kMessageReceived) ComponentUtil.centerComponent(this, fParentFrame.getLocation(), fParentFrame.getSize()); // // Restore / Save the location of Message ...
52761df9-3968-40f7-bc69-328de5c7adb6
1
public Block clone(){ try{ return (Block) super.clone(); }catch(Exception e){ e.printStackTrace(); return null; } }
42fbe453-8abb-42c3-ab21-abdfa90101a8
3
public JSONWriter object() throws JSONException { if (this.mode == 'i') { this.mode = 'o'; } if (this.mode == 'o' || this.mode == 'a') { this.append("{"); this.push(new JSONObject()); this.comma = false; return this; } t...
d2f6c698-4519-4df7-955a-254c161387fc
8
public Model getRotatedModel() { Model model = aSpotAnim_1568.getModel(); if(model == null) return null; int j = aSpotAnim_1568.aAnimation_407.anIntArray353[anInt1569]; Model model_1 = new Model(true, Class36.method532(j), false, model); if(!aBoolean1567) { model_1.method469(); model_1.method470(j...
abd5f586-ccac-4038-8d9d-1e296b52c906
1
private String display() { String displayString = ""; if (this.contents == null) { return displayString; //Will update display with blank string if contents is empty } displayString += this.contents; return displayString; }
fe6b79da-3885-4193-9de6-09ff5042f7ec
1
public boolean equalsIgnoreCase(CharSequence other) { return other != null ? toString().equalsIgnoreCase(other.toString()) : false; }
fc5cb2cb-472e-4a16-b424-e3787ee95605
9
public Pair<ParseDirective,Item> beginCB(Node aInData, Item aInParentItem) { // TRY TO FIND EXISTING META NODE MNode lMNode = (MNode) (null != aInParentItem ? aInParentItem.getChildItem(MNode.MY_CAT, aInData.getQual()) : MNode.M...
14962631-3d1f-4287-864b-88e8c3a7e34a
0
private Distance(String value) { _value = value; }
0c2138c0-3628-4256-94f7-cf3fa2d6707a
1
@Override public boolean colides(SchlangenKopf head) { if (!super.colides(head)) { head.die(); return true; } return false; }
691c1546-20d6-434a-a8f1-9b752d482704
2
public ResetGraphState(Graph g) { this.graph = g; for (int i = 0; i < g.getEdges().getSize(); i++) { g.getEdges().get(i).setVisited(false); } for (int i = 0; i < g.getVertices().getSize(); i++) { g.getVertices().get(i).setColor(null); g.getVertices().g...
9c6af6ff-c95e-4b92-8503-9facb2b15e73
1
@Override public final void focusLost(FocusEvent focusevent) { awtFocus = false; for (int i = 0; i < 128; i++) { heldKeys[i] = 0; } }
b0ea55bc-eb5e-4fc9-aa37-e06e630eb20e
2
protected URL getAudioURL() { String urlString = getAudioFileName(); URL url = null; if (urlString!=null) { try { url = new URL(getDocumentBase(), urlString); } catch (Exception ex) { System.err.println(ex); } } return url; }
30262ee4-5381-48e8-afe7-9a30f2cb3c12
9
public SentiWordNetFeature createFeaturesObject(String s) { int wordCount = 0; double sumPositiveScore = 0.0; double sumNegativeScore = 0.0; double sumObjectiveScore = 0.0; int nonZeroPositiveCount = 0; int nonZeroNegativeCount = 0; int nonZeroObjectiveCount = ...
5c57f80b-270e-432c-a512-b7d6c2fc6796
7
@Override public void addEdge(int v, int w) throws InvalidEdgeException, SelfLoopExistsException, ParallelEdgeExistsException { // check for invalid edge if (v < 0 || v >= V() || w < 0 || w >= V()) throw new InvalidEdgeException("Invalid edge : " + v + "-" + w); if (v == w) throw new SelfLoopExistsExc...
04102945-9b87-49e0-a198-4fd12b93b9ea
9
protected void reconnect() { if (this.isReconnectionAllowed()) { // Since there is no thread running, creates a new one to attempt // the reconnection. Thread reconnectionThread = new Thread() { /** * Holds the current number of reconnection ...
bf496c10-5c02-4b41-a3ca-6b091dc2eb37
2
private void parsePlayerUpdateFlags(Stream stream) { for (int j = 0; j < entityUpdateCount; j++) { int k = playerUpdateIndices[j]; Player player = localPlayers[k]; int l = stream.getUnsignedByte(); if ((l & 0x40) != 0) { l += stream.getUnsignedByte...
e5400b25-7492-47f6-b111-c99611793cfe
3
private static List<Server> parseServers(DeployConfig config, String targetServer) { List<Server> result = new ArrayList<Server>(); boolean flag = true; String[] serverList = targetServer.split(C.separator); Server server = null; for (String target : serverList) { server = config.getServers()....
2d1e0cb0-6a8e-4665-a9e4-be341a086a45
3
public void applyNews(News news){ double effect = news.getEffect(); if (effect < 0) stockStrength += effect; else stockStrength += effect; if (effect < -.4) price -= .2; if (effect > .4) price += .2; }
3180a57a-3788-412a-9de1-34eae022dd35
8
public void actionPerformed(ActionEvent evt) { if (evt.getSource() == browseButton) { if (browseFile() && recording) startRecording(); } else if (evt.getSource() == recordButton) { if (!recording) { startRecording(); } else { stopRecording(); fnameField.setText(nextNewFilename(fnameField.g...
905e578f-00ef-40d8-a986-710da113a7cd
6
private void parseArguements(String[] args, Job job) throws IOException { for (int i = 0; i < args.length; ++i) { if ("-input".equals(args[i])) { FileInputFormat.addInputPaths(job, args[++i]); } else if ("-output".equals(args[i])) { FileOutputFormat.setOutputPath(job, new Path(args[++i])); } else if ...
a6136a61-b195-4f33-9bcb-62885db23a88
3
public FormulaTools(String name, String prefix, String[] formula, boolean numChangeable, List<Parameter> params, List<Parameter> sysParams) { setLayout(new BorderLayout()); setBorder(new TitledBorder(name)); this.params = params; this.sysParams = sysParams; if (formula == null) { formula = new String...
0de74d7f-cbd6-4c4a-b22f-605aa4749fdd
4
public void mouseClicked(MouseEvent e){ chosenColumn = e.getX()/100 - 1; chosenRow = e.getY()/100 - 1; //this method connects the UI with the logic int size = logic.getGameBoard().length; if ((chosenColumn >= 0) && (chosenColumn < size) && (chosenRow >= 0) && (chosenRow < size...
c56d0b1b-87d3-4ed7-81ae-8f42bac4bb92
0
public double getTotalRevenue() { return totalRevenue; }
2e4d815e-e52d-4cd9-8cef-fa2cd140bb11
9
public static ColaLigada<String> convertirPostfija(String infija) throws Exception { ColaLigada<String> colaPostfija = new ColaLigada<>(); PilaLigada<String> pila = new PilaLigada<>(); ArrayList<String> separada= Utilidades.convertir(infija); for(int i=0; i<separada.size();i++) { ...
616592a0-4390-49f5-a250-7d22b8df4b16
9
@Override public void mouseReleased(MouseEvent e) { if (e.getSource() == addPersonToParticipantsListLabel && searchList.getSelectedValue() != null) { addParticipants(); } else if (e.getSource() == removePersonFromParticipantsListLabel && invitedList.getSelectedValue() != null) { removePar...
350b6cc1-7fc0-454c-aa5c-afdccd15ec63
9
static void plotUnclipped(int x, int y, int z, int argb, int argbBackground, Graphics3D g3d, int textWidth, int textHeight, int[] bitmap) { int offset = 0; int shiftregister = 0; int i = 0, j = 0; int[] zbuf = g3d.zbuf; int[] pbuf = g3d.pbuf; ...
57cd1fe2-0551-495f-bb10-27094c7e919d
4
public boolean remove(int index){ if(index <1 || index > size()){ return false; } Node current = head; for(int i = 0; i < index; i++){ if(current.getNext() == null){ return false; } current = current.getNext(); } current.setNext(current.getNext().getNext()); count--; return tr...
c96aaab5-7e7a-4951-aa8c-9d7fa7eb7085
7
public static BufferedImage cropImage(BufferedImage source, double tolerance) { // Get our top-left pixel color as our "baseline" for cropping int baseColor = source.getRGB(0, 0); int width = source.getWidth(); int height = source.getHeight(); int topY = Integer.MAX_VALUE, topX...
4977d2a7-391e-47fa-b908-bd9b2bd0d788
9
public Move getBestMoveNegascout(GameBoard board, int d) { ArrayList<NegascoutThread> threads = new ArrayList<NegascoutThread>(); for (Move child : board.getAllPossibleMoves(board.currentColor)) { NegascoutThread t = new NegascoutThread(child, board, d); t.start(); threads.add(t); } System.out.println(...
292de4c4-261e-4866-8f3c-930420359c8b
7
void showpage(String url,BufferedReader b,PrintStream p) { File f; try { f = new File( "website/" + url); System.out.println(f.getAbsolutePath()); String m = hf.defPageOrder(url); if (m.compareTo("NO") != 0) { url = m; h.setUrl(url); } if (h.getExt().compareTo("jsx")==0) { f = n...
4d473a08-99f5-4de3-b219-3c522adc8000
2
public Persistent Next() throws InstantiationException, IllegalAccessException { if (ids == null) initSearch(); if (currentPosition >= ids.size()) return null; Persistent obj = (Persistent) (searchClass.newInstance()); obj.Id = ids.get(currentPosition); obj.LoadData(); currentPosition++; r...
bf4a3e81-86af-4eef-848d-7f6ca8bd24b9
8
public TextoCompactadoHuffman comprimirHuffman(){ if(texto==null){ return null; } NodoHuffman[] nodos=new NodoHuffman[MAXIMO_CARACTERES]; for(int i=0;i<MAXIMO_CARACTERES;i++){ nodos[i]=new NodoHuffman((char)i); } for(int i=0;i<texto.length();i++){ nodos[texto.charAt(i)].registrarN...