method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
5a48164c-d32d-4080-b57c-1b53277f5ff5
7
private void addNodes() { List<Transition> transitionsToVisit = new ArrayList<Transition>( simplifiedSTS.getTransitions()); while (!transitionsToVisit.isEmpty()) { Transition trans = transitionsToVisit.remove(0); logger.trace("Visiting " + trans); boolean added = addAsActivityNode(trans) || addAsX...
b5be5ec5-d865-4afa-b726-6c8005ec6573
1
public boolean handleClick(Player p, Point clickPoint) { if (p == registry.getPlayerManager().getCurrentPlayer()) { return placeCurrent(p); } else { return false; } }
095d46b9-fa45-4167-bde9-7d4594436e7e
6
public void releaseConn() { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { e.printStackTrace(); } } if (pstmt != null) { try { pstmt.close(); } catch (SQLException e) { e.printStackTrace(); } } if (connection != null) { try { connection.cl...
e34c9c51-f847-4c6c-abdf-cfb06b057ce1
6
public static void writeStat() { if (Config.stat) try { if (Config.verbose >= 1) { System.out.println("Generating statistics file : stat.txt"); } BufferedWriter writer = new BufferedWriter(new FileWriter( "stat.txt")); writer.write("Generation , nb of trees \n"); for (int i = 0...
040447af-9fa3-409f-947c-2367bb680b16
3
public static void main(String[] args) { ArrayCopier arrayCopier = new ArrayCopier(); int[] array1 = {1, 2, 3}; int[] array2 = new int[3]; arrayCopier.copy(array1, array2); for (int i = 0; i < array2.length; i++) { System.out.println(array2[i]); } System.out.println(); int[] array3 = new int [2...
35bf4607-ffe4-4eba-b787-8e5cbd626d67
3
public String toString() { StringBuffer sb = new StringBuffer(); if (parent != null) { sb.append(parent.toString()); } String indent = new String(); for (int i = 0; i < depth; i++) { indent += " "; } for (Symbol s : table.values()) { sb.append(indent + s.toString() + "\n"); } return...
0b2d5c56-c267-4dae-8aae-bad528d15d95
6
@Override public void run() { // Setup the calendar Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT-0"), Locale.UK); // Create a date format SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HHmm z"); // Set the log filename String fileName = "Frequency.txt"; // ...
b1317409-a75e-4882-827b-cbdcc4e50378
7
public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { if (reportPanel == instructorReportPanel) { Object selected = instructorReportPanel.getSelected(); if (selected != null) { if (selected instanceof Instructor...
4a7cc441-c07f-47f8-a3b6-90526c5099af
0
public List<Image> getAllImagesTimestamps() { Query query = new Query(); query.fields().include(Image.FIELD_NAME_TIMESTAMP); return mongoImageTemplate.find(query, Image.class); }
7e3ffb86-6896-4a58-9cf9-10b0c4e939e6
0
public void setEmployeeId(String employeeId) { this.employeeId = employeeId; }
e7190b98-0d1a-4df6-b3d3-a2fe49379c08
8
void output( int code, OutputStream outs ) throws IOException { cur_accum &= masks[cur_bits]; if ( cur_bits > 0 ) cur_accum |= ( code << cur_bits ); else cur_accum = code; cur_bits += n_bits; while ( cur_bits >= 8 ) ...
0268b328-6309-4c55-b555-3745f3b5bb3d
9
private boolean smartMove(RobotController rc, Boolean takeTwo) throws GameActionException { Direction dir; if(takeTwo) { dir = Direction.values()[(int)(rndGen.nextFloat() * 8)]; } else { if(this.destination==null){ this.destination = this.enemyHQ; ...
3cbc3c24-eb99-4d9f-8631-4a513c61d7b7
4
public void doSelected() { // if (buttonSelectedIdx == BUTTON_CONFIG_IDX) toggleUserPanel(); if (buttonSelectedIdx == BUTTON_START_IDX) advanceTutorial(); else if (buttonSelectedIdx == BUTTON_ODDBALL_IDX) { startOddballGame(); } else if (buttonSelectedIdx == BUTTON_BANDIT_IDX) startBandi...
28bd1cab-4578-4c3b-8556-1e5741134267
5
@Override public double sim(int word1, int word2) { if (word1 > word2) { int temp = word1; word1 = word2; word2 = temp; } else if (word1 == word2) { return 1; } // Binary search int indStr = tListStr[word1], ...
de0b5b5e-3f0a-41a8-85bc-a354c07765ea
4
@Override public void processPacket(Client c, int packetType, int packetSize) { switch(packetType) { case 128: int answerPlayer = c.getInStream().readUnsignedWord(); if(Server.playerHandler.players[answerPlayer] == null) { return; } if(c.arenas() || c.duelStatus == 5) { c.sendMessage(...
a1359b31-6b80-4ee0-baee-4c09748ea277
1
public InputStream getInputStream() throws IOException { synchronized(this) { if(in == null) in = new HackInputStream(super.getInputStream()); return(in); } }
f8e562f6-0506-4272-9d87-6a92931b3bf4
1
public final Instruction[] getSuccs() { if (succs instanceof Instruction) return new Instruction[] { (Instruction) succs }; return (Instruction[]) succs; }
244de323-f9a8-4f98-8f8d-c92604126084
6
public void paintComponent(Graphics g) { Graphics2D g2d2 = (Graphics2D) g; // super.paintComponent(g2d2); for (Iterator<Sommet> it = Fenetre.lePert.sommets.iterator(); it .hasNext();) { Sommet leSommet = it.next(); if (leSommet != Fenetre.lePert.puit) { int ordre = 0; for (int i = 0; i < leSom...
89e5640f-fe08-4c95-9f18-48546ccb1493
6
@Override protected void idle() { boolean moved=false; switch(facing) { case UP: moved=move(x, y-1); break; case DOWN: moved=move(x, y+1); break; case LEFT: moved=move(x-1, y); break; case RIGHT: moved=move(x+1, y); break; } Random r = new Random(); if(!moved || r.nextInt(8) == 0) facing = r.nextI...
994401cf-4672-4355-9813-85d42f152646
9
public CreoleStripeSimpleParser(String line, CreoleContext creoleContext, FontConfiguration fontConfiguration, ISkinSimple skinParam, boolean modeSimpleLine) { this.fontConfiguration = fontConfiguration; this.modeSimpleLine = modeSimpleLine; this.skinParam = skinParam; final Pattern p4 = MyPattern.cmpile("^...
5e37565a-35c3-47fd-b1d9-fc85955c44b6
7
public ListNode insertionSortList(ListNode head) { if(head == null){ return head; } ListNode p = head.next; head.next = null; while (p!=null) { ListNode temp = p.next; ListNode sortP = head; ListNode sortPParent = null; ...
4602ffdd-2c28-42fb-8ba1-953c8b78d566
9
private void printAttempt(Code attempt) { for (int i = 0; i < 4; i++) { //print attempt switch (attempt.getColour(i)) { case RED: System.out.print("R|"); break; case WHITE: System.out.print("W|"); break; case YELLOW: System.out.print("Y|"); break; case GREEN: System.out.print("G|"); break; cas...
ade78df8-0bda-41bc-b7a6-17e3b1353675
5
@Override public void checkerMove(Location from, Location to) { if(isGameMotivatedMove(from, to)){ Point pFrom = Convert.locationAndCount2xy(from, subject.getCount(from)); Point pTo = Convert.locationAndCount2xy(to, subject.getCount(to) - 1); lock(); Figure clickedFig = findFigure(pFrom.x, pFr...
4f2d1a36-8cc0-4cc9-ab9e-ab6ad85109ff
5
public void render() { if (loading) return; updateScale(); renderSky(); Main.m.modeler.setHexColor(0xFFFFFFFF); renderTerrain(0); renderTerrain(1); if (Block.singleTerrainTexture) if (Main.m.modeler.started) Main.m.modeler.finish(); Entity.renderEntities(); Projectile.renderProjectiles();...
4cb0df49-e5a0-4306-b8f4-a3e16a114e5c
5
public boolean search(T data) { if (this.isEmpty()) return false; if (this.getData().compareTo(data) == 0) return true; if (this.getData().compareTo(data) > 0) { if (this.getLeft() == null) return false; return this.getLeft().search(data); } else { if (this.getRight...
8e8af206-950d-4f50-9f79-8cb6987b37cd
6
@Override public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if (key >= 37 && key <= 40) { reqDir = key; } if (START) { if (key == KeyEvent.VK_P) { if (PAUSE) { PAUSE = false; } else { ...
9c0db148-f6cf-409e-96e3-44b186726acb
2
public BoardCell getCellAt(int i) { if(cellCache.get(i) == null) { // Then create the cell. if(config[i].equals(WALKWAY_INITIAL)) { cellCache.put(i, new WalkwayCell(i, numRows, numCols)); } else { cellCache.put(i, new RoomCell(i, numRows, numCols, config[i])); } } return cellCache.get(i); }
538438f7-00d1-44fe-a8ce-0247f6777e2b
6
public void drawSquare() { String lenString = ""; while (true) { lenString = JOptionPane.showInputDialog(null, null, ENTERSIDE, JOptionPane.QUESTION_MESSAGE); if(null == lenString) { break; } else if(lenString.equals...
f9679295-02d6-4d54-9496-ef626a37f949
0
public void setRWord(String s){ rWord = s; }
e06d26aa-d9bc-4fbd-bae1-cac5cd26ce79
1
private static ComplexMatrix emptyMatrix(int rowSize, int colSize) { // [ [row], [row], [row], [row]...] Complex[][] arr = new Complex[colSize][rowSize]; try { return new ComplexMatrix(arr); } catch (Exception e) { e.printStackTrace(); } return nul...
7b9c7025-eeda-4bfb-9c37-63d6e8ccb5bb
1
@Override public int getCount(ArrayList<FilterBean> hmFilter) throws Exception { int pages; try { oMysql.conexion(enumTipoConexion); pages = oMysql.getCount("cliente", hmFilter); oMysql.desconexion(); return pages; } catch (Exception e) { ...
0e42511b-441c-450b-9964-76b84e5c695b
7
public void iterate(){ switch(interrupt){ case 0: break; default: controller.iterateInterrupt(interrupt); interrupt = 0; break; } switch(aamode){ case 1: pete.iterate(); break; case 2: for(int h = 0; h <= gridy-1; h++){ for(int w = 0; w <= gridx-1; w++){ grid[w][h].checkRules(); gri...
88a2a020-f991-4ce2-b287-395f9384a380
5
public Geometric3DNodeCollection() { // Immediately stop execution if rMax is not defined in the xml config file. try { rMax = Configuration.getDoubleParameter("GeometricNodeCollection/rMax"); } catch(CorruptConfigurationEntryException e) { Main.fatalError(e.getMessage()); } if(rMax <= 0) { Main.fa...
47d66d2c-34fd-46e6-b395-5f1d62ac3e66
1
protected void initView() { treePanel = initTreePanel(); // Sets up the displays. JComponent pt = initParseTable(); JScrollPane parseTable = pt == null ? null : new JScrollPane(pt); GrammarTable g = initGrammarTable(grammar); JScrollPane grammarTable = new JScrollPane(g); treeDerivationPane.add(initTree...
742cfa32-a186-4003-ab86-7559fd521132
8
@Override public void editarProduto(String codigo) { boolean retorno = false; String codigoNovo, descricaoNova, categoriaNova; int qtdEstoqNova; double precoVendaNovo; int indexLista = 0, editar; for (int i = 0; i < listProdutos.size(); i++) { if (listPro...
5936d4d1-c946-4849-a967-4259e05a24f8
5
public boolean writeResults(String... values) { int i; int len = values.length; // If no values are supplied, don't write anything if (len < 1) { return true; } // Get file writer BufferedWriter writer = getWriter(); if (writer == null) { return false; } // Append first value with no column...
c5631d9e-d9f3-41b6-8119-d35615fbfd4e
0
@Test public void out_a_car_when_it_parking_first_park() { Car car = new Car(); Ticket ticket = parkBoy.in(car); Assert.assertSame(car, parkBoy.out(ticket)); }
5f5acdb4-1371-4372-abf0-762c4d83ca7d
7
public void move() { int width = image.getWidth(null); int height = image.getWidth(null); if (x >= fWidth) //x moves out of bounds right { x = -1 * width; } else if (x < (0 - width)) //x moves out of bounds left { x = fWidth; ...
9921a6ac-1740-461a-a9b8-138c2257a615
9
private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpos = jj_...
fac66750-41ba-415c-9d68-e44eadd96ba6
7
public MaterialData getReqdMaterialData(ArrowType type) { if (data.containsKey("materials")) { LinkedHashMap<String, Object> materials = data.get("materials"); String typeName = type.toString().toLowerCase(); if (materials != null && materials.containsKey(typeName)) { try { String value = materials....
fd4b29bc-5cd2-4dfa-ae4f-b09653de4f27
3
public void decoderTrame(String xml) { ParseXML monFichier = new ParseXML(xml); for(int i = 0; i< monFichier.getTrame().length;i++){ int id = monFichier.getTrame()[i].getId(); int taille = monFichier.getTrame()[i].getDlc(); int date = 0; if(filemessages.isEmpty()){ debut = monFichier.getTra...
54a29426-89c4-47f2-bfd5-e3a77d8cba11
1
@Override public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals(CLOSE)) { close(); } }
795d5a29-d77f-4434-b8ee-9adfee2c0822
5
void changeBackground() { String background = backgroundCombo.getText(); if (background.equals(bundle.getString("White"))) { imageCanvas.setBackground(whiteColor); } else if (background.equals(bundle.getString("Black"))) { imageCanvas.setBackground(blackColor); } else if (background.equals(bundle.getStrin...
002a3932-c698-471f-9603-57b3aa5d92c6
1
public MaxAmountMapClass() { mapWithAnnot = new HashMap<Integer, String>(); mapWithoutAnnot = new HashMap<Integer, String>(); int i = 0; while (i < 6) { mapWithAnnot.put(i, "e" + i); mapWithoutAnnot.put(i, "e" + i); i++; } }
1e535091-d4d7-41d9-85ba-40ff83fa0172
0
public Date getSignDatetime() { return signDatetime; }
7dd88269-7cf5-4a61-9fe7-71d69f92663e
3
public static CODepartment fromCode(String code){ if (!StringUtils.isBlank(code)){ String codeUpper = code.toUpperCase().trim(); for (CODepartment p : CODepartment.values()){ if (codeUpper.equals(p.departmentCode)){ return p; } } } return null; }
c35cae74-09ec-4e68-abf5-089550564928
2
public void anounceNewHand() throws Exception { state.setPlayersNotFolded(playerList.size()); for (IPlayer player : playerList) { player.newHand(); } state.initNewHand(); incrementDealerPosition(); setBlinds(); opponentLogger = new OpponentLogger(playerList.size(), preFlops, opponentModels); for (Opp...
9c4ad29d-e032-49e7-8380-c906e27dbb6c
9
public void writeGrouped(Map<String, Set<Artifact>> missingGrouped, boolean resolveReference, boolean printOnlyMoreThanOne, String onlyReferencedFromPath, int minNumVersionsRef) { for (Map.Entry<String, Set<Artifact>> artifactEntrys : missingGrouped.entrySet()) { Set<Artifact> artifacts = artifactEn...
8d428004-92ab-4d9a-a242-209b9b7d4da8
9
public static void main(String[] args) throws IOException { StreamTokenizer st = new StreamTokenizer(new BufferedReader( new InputStreamReader(System.in))); while (st.nextToken() != StreamTokenizer.TT_EOF) { int n = (int) st.nval; int count = 0; int[] array = new int[n]; while (count < n) { st.n...
7749f0b5-9a85-4f1b-8666-f4b94e4568f2
5
protected List<Node> expand(Node node, Problem problem, List<State> generatedStates, List<State> expandedStates) { List<Node> successorNodes = new ArrayList<Node>(); Node successorNode = null; State currentState = null; State successorState = null; //If the current node and problem aren't null if (node !...
0bf0f4d3-d731-4bb2-80ab-8c6ed1d30b48
7
public static void main(String[] args) throws Throwable { BufferedReader in = new BufferedReader( new InputStreamReader(System.in )); int t = Integer.parseInt(in.readLine()); StringBuilder sb = new StringBuilder( ); for (int casos = 0; casos < t; casos++) { sb.append("Case ").append(casos+1).append(": "); ...
4575c3e6-fc50-40fc-ac3d-51da734288cb
6
public void createAndListenSocket() { try { socket = new DatagramSocket(9876); byte[] incomingData = new byte[1024 * 1000 * 50]; while (true) { DatagramPacket incomingPacket = new DatagramPacket(incomingData, incomingData.length); socket.receiv...
2f597e0f-5a8f-40e2-a3ae-b0184b172cd3
8
public void onKeyReleased(KeyEvent e) { switch (e.getKeyCode()) { case VK_UP: case VK_W: case VK_DOWN: case VK_S: // Arrow up and down keys: move direction = stand still moveDirection = 0; moveAmount = 0; break; case VK_RIGHT: case VK_D: case VK_LEFT: case VK_A: // Arrow right and left...
ea759f35-8dc0-4e80-b5f9-46a67d8f66b0
8
public static void countingSort(Integer array[]) { if (array.length == 0) return; /** find max and min values **/ int max = array[0], min = array[0]; for (int i = 0; i < array.length; i++) { if (array[i] > max) max = array[i]; ...
3019bb58-3666-4034-ab6c-5e458c3c65f0
3
public void checkAndUpdate(){ for (int i = 0; i < chequeList.size(); i++) { if(chequeList.get(i).chequeDateCheck(current)){ } else{ try { newBankData.updateBankAmount(chequeList.get(i).getBankName(),newBankData.RetrieveBank...
451e443a-2a44-4636-a140-ed8e3237bd9c
4
public void setLocation(int x, int y){ if((x<0) || (x>=worldWidth)){ throw new IllegalArgumentException("Room xLocation " +x +" out of bounds. It must be between 0 and "+(worldWidth-1)+"."); } if((y<0) || (y>=worldWidth)){ throw new IllegalArgumentExceptio...
4058b15c-a2f9-41ef-8a61-e15e23fb70ed
2
public List<String> getHref(String content){ List<String> results = new ArrayList<String>(); Pattern p = Pattern.compile("<a class=\"anchor\" id=\"(.*?)\">"); Matcher m = p.matcher(content); while (!m.hitEnd() && m.find()){ results.add(m.group(1)); } return results; }
4a1e4335-a303-42ee-b1bf-9b12157f63e2
3
@Override public void act(){ Quest testQuest = player.questList.getQuest("TestQuest"); String speech; if (testQuest == null) { testQuest = new TestQuest(stateManager, player); player.questList.add(testQuest); testQuest.step = "Start"; } if (testQuest.step.equal...
1885a006-14ee-4048-8516-ef91a4e7fe6a
1
public void process() { for (int i = 0; i < 1000; i++) { stageOne(); stageTwo(); } }
afbf91ea-1918-4474-b262-8c607c4610e9
1
@Override public void paint ( Graphics gr ) { initDraw(gr); //Clean the Applet switch(state) { case game: DrawGrid(gr); break; default: break; } }
a2ba5a3b-c70f-4e09-8ce4-ab589df9066f
6
public int getTotalBonusPotential(GoodsType g, UnitType unitType, int tilePotential, boolean onlyNatural) { int potential = tilePotential; int improvementBonus = 0; for (TileItem item : tileItems) { if (item instanceof TileImprovement) { TileImprovement improvement = ...
ccd9b39e-512e-408d-9bc2-3c9a0627ce54
1
public void setPasswordfieldUpshift(int shift) { if (shift < 0) { this.passwordfieldUpshift = UIShiftInits.PWAREA_UP.getShift(); } else { this.passwordfieldUpshift = shift; } }
4287822e-2166-48df-8326-d5c7bb4fbd16
8
@Override public void run() { cleanUpMapping(); for (int i = 0; i < mapping.size(); i++) { final LinkedHashSet<Integer> set = mapping.get(i); final IBank.BankTab sortingTab = BANK_TABS[i]; final HashSet<Integer> alreadyHave = new HashSet<Integer>(); for (Item item : ctx.bank.getItemsInTab(sortingTab)...
3303af79-1a46-4183-a7c3-e423631221a1
7
public SMPLString(String param) { value = param; // Format the string... for (int i = 0; i < value.length(); i++) { if (value.charAt(i) == '\\' && (i + 1) < value.length()) { char controlChar = 0; switch (value.charAt(i + 1)) { c...
cc8fd1b6-64fa-4fdb-87f5-b2ca301917f1
1
public void setFrames(Sprite... sprites) { this.sprites = sprites; if (currentFrame >= sprites.length) currentFrame = 0; }
fef29794-9133-4ecb-b28d-699e35e7b42f
7
public static Hashtable sortClassesByRoot(String classes) { Hashtable roots; Hashtable result; Enumeration enm; int i; StringTokenizer tok; String clsname; Vector list; Hie...
c4181d7e-da50-4bc4-ac46-eb710fdca39c
7
public void performAction() { if (isConnected()) { boolean first = getOutput()[0].getStatus(); if (this.isTurnedOn()) { for (int i=0; i<getOutput().length; i++) { getOutput()[i].setStatus(getInput()[0].getStatus()); } } ...
fd85e8d7-3192-4a23-a336-5d4bca2e22a6
0
protected JComponent initTreePanel() { treePanel=new SelectableUnrestrictedTreePanel(this); return treePanel; }
399a15e9-d490-4519-85d9-8a84edde7b8b
1
public void sublimate(String label) { subinfo.setText(label); subinfo.setFont(new Font("Arial", Font.PLAIN, (int)(15))); subinfo.setForeground(Color.RED); removeAll(); updateSize(new Dimension(250, 65)); setLayout(new FlowLayout(FlowLayout.CENTER, 10, 7)); if (Mode == IVMode.INTERLOCK) updateValue("O"...
0ad6435e-3b64-44c5-9309-963016c8c1ae
1
public Properties setPropertiesFile() { props = new Properties(); //try retrieve data from file try { props.load(new FileInputStream(System.getProperty("user.dir") + "\\datafiles\\project.properties")); } catch (IOException e) { e.printStackTrace(); ...
b7799878-18ed-4091-ba65-cad3772d0ca6
6
public static boolean isOperator(Character someCharacter) { char ch = someCharacter.charValue(); switch(ch) { case '^': case '*': case '/': case '+': case '-': case '=': return true; ...
cb02628c-7e24-4718-b1e9-bf09f5818dd2
4
@Override public void actionPerformed(ActionEvent ae) { boolean testPourEgalite = true; if(this._partie.jouerCase(this._joueurCourant, this._joueurAdverse, this._caseTouche)) { // Le joueur a gagne this._partie.afficherMessageFinPartie("Vous avez gagné la...
937aeabb-4fb5-4fb8-9db4-2efae02aac57
8
public void putAll( Map<? extends Short, ? extends Integer> map ) { Iterator<? extends Entry<? extends Short,? extends Integer>> it = map.entrySet().iterator(); for ( int i = map.size(); i-- > 0; ) { Entry<? extends Short,? extends Integer> e = it.next(); this.put( e....
d1da3432-528e-48ae-b1df-4aa58892a7ed
9
@Override public void draw (Batch batch, float parentAlpha) { validate(); Color color = getColor(); batch.setColor(color.r, color.g, color.b, color.a * parentAlpha); float x = getX(); float y = getY(); float scaleX = getScaleX(); float scaleY = getScaleY(); if (drawable != null) { if (drawable.ge...
82174357-4214-40ca-aecc-f9f7a9765fd8
6
@Override public void doPlayCard(UIDataInterface data, List<CardInterface> cards, PacketFactoryInterface pf, Status status) { Random rand = new Random(); while (true) { try { CardInterface c = cards.get(Math.abs(rand.nextInt()) % cards.size()); pf.sendPlay...
6b44ae80-51f2-489a-a591-e99dc137bcb0
1
public Object getParseLanguageMt() { if (DEFAULT.equals(parseLanguageMt)) { return locale.getLanguage(); } else { return parseLanguageMt; } }
95b0a1c5-6876-4aa6-9ef5-117bb09ebade
5
public static void toFile(Log log, Properties properties, String comment, File file, boolean append) { if (file == null) { log.error("Can't write config to null file."); } else { FileWriter writer = null; try { writer = new FileWriter(file, append); if (comment != null) { properties.store(writ...
22ce607c-6125-44e8-84e2-0c55cf017d1e
9
private int alloc(int num_bytes) throws IOException { int new_adr = 0; // the address of the block. int new_size = 0; // the size of the block. // The current bucket is the first place to look for space. for (int i = 0; i < bucket.av_count; i++) { if (bucket.av_size[i] >= num_bytes) { n...
113f00c3-262f-497a-839a-3f32cd88a9a3
5
public void fileActionBuffered(Action action){ try{ BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(file)); byte bytes[] = new byte[optBufferSize]; int ret; do{ if (inputStream.available() < optBufferSize){ ...
20c5bc8b-9a06-4ca7-b37f-ac1724ea3667
7
public static void execute(Instruction instruction) { switch (instruction.getOpCode()) { case 0: //R-Type instructions switch(((RTypeInstruction)instruction).getFunction()) { case 0: case 8: InstructionProcessor.getInstance().executeJR((RTypeInstruction) instruction); break; default: ...
dddf16ff-52a9-4c54-b3ea-efcdde2fc36d
5
private void initialize() { EDAUtil.reset(); EdaChromosome bestPreviousIndividual = this.initialIndividual!=null ? new EdaChromosome(this.initialIndividual.getPersonWorkLists()) : null; EdaChromosome initialEdaChromosome = null; if (bestPreviousIndividual == null) { initialEdaChromosome = new E...
0e731cb4-b0f1-450e-ae34-d4607ad4bc82
4
public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.print("Ingrese un numero 1: "); int num1 = s.nextInt(); /*Siento que el operador confunde*/ System.out.print("Ingrese un operador(+,-,/,*): "); char oper = s.next().charAt(0); System.out.print("Ingrese un numero ...
4baff743-7c12-45d2-ba34-75583f4b9714
7
public void setMove(char c) { switch (c){ case 'r': // right moveX = speed; if (crawl) moveX /= 2; play(); break; case 'l': // left moveX = -speed; if (crawl) moveX /= 2; play(); break; case 's': // stand moveX = 0; stop(); break; case 'j': // jump if (!inAir) // ju...
b700b9b0-ee0f-47e6-bb62-ee4edbda692a
2
@Override public boolean execute(CommandSender cs, String[] args) { //don't quite understand what this point of the help arg in this, but to fix a bug, will keep it if (args.length == 1 || args.length == 0) { args = new String[]{"help", "1"}; } int page = getInt(args[1]);...
3e03fcb1-4275-4c25-b6fa-cf9132a8f992
4
public void browserShowFile(String fileName) { Document doc; String objectPath; String fileContents; if (browseFolder.isRootFolder()) { objectPath = browseFolder.getPath() + fileName; } else { objectPath = browseFolder.getPath() + "/" + fileName; }...
6809253d-e696-4af4-9dec-b093931244a4
4
@Override public int update(Object obj) { int changedRows = -1; Connection connection = this.initTransaction(); if(connection != null){ changedRows = executeUpdate(createUpdateCmd(obj), connection);//insere turma Turma turma = (Turma)obj; //Se tur...
600984ad-4986-410d-95a3-7f38305d3e3a
1
public Card getCard() { if (card == null) card = new Card(); return card; }
8915fbb8-9724-40c6-8045-c4103a420825
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
e59b2a64-792c-4535-8a2a-faa699b3fc25
7
public Tile (String identifier){ this.identifier= identifier; if (identifier.equals("GRASS")) {image = GRASS;} else if(identifier.equals("ROCK")) {image= ROCK ;} else if(identifier.equals("BLUE_CAMP")) {image = BLUE_CAMP;} else if(identifier.equals("BLUE_SPRITE")){image = BLUE_SPRITE;} e...
c82171b5-635b-4d78-8cee-ddf4fc3533b4
5
private Tile[] mergeLine(Tile[] oldLine) { LinkedList<Tile> list = new LinkedList<Tile>(); for (int i = 0; i < ROW; i++) { if (i < ROW - 1 && !oldLine[i].empty() && oldLine[i].equals(oldLine[i + 1])) { // can be merge, double the val Tile m...
05c82a29-da08-47ae-8cc0-1dcab3509061
2
@Override public int compareTo(SPVertex o) { if (distFromSource > o.distFromSource) return 1; else if (distFromSource < o.distFromSource) return -1; return 0; }
84d2f02a-360e-4db4-90cf-b45a99a6feef
4
public boolean checkpermissionssilent(Player player, String action) { try { if (player.isOp()) { return true; } if (player.hasPermission(action) || player.hasPermission(action.toLowerCase())) { return true; } else { return false; } } catch (Exception e) { sendGeneralErrorMessage(player...
63b1d8f0-ac58-4155-bd06-c4883e01e6af
7
public static String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String string = Double.toString(d); if (string.indexOf('.') > 0 && string.indexOf('e') < 0 ...
ad200f2f-c96b-4e3c-a190-04277df6b75f
6
public void renderMap(EntityPlayer var1, RenderEngine var2, MapData var3) { for(int var4 = 0; var4 < 16384 /*GL_LIGHT0*/; ++var4) { byte var5 = var3.field_28176_f[var4]; if(var5 / 4 == 0) { this.intArray[var4] = (var4 + var4 / 128 & 1) * 8 + 16 << 24; } else { in...
69395228-ff60-445c-abb6-87a2faa24b09
6
@Override public void train(List<Instance> instances) { // TODO Auto-generated method stub HashMap<String, Integer> labelCounts = new HashMap<String, Integer>(); int maxCount = 0; ArrayList<String> maxLabels = new ArrayList<String>(); for(Instance instance : instances){ Label l = instance.getLabel(...
d1560185-c8e9-4fea-97ea-282cfa1b984e
0
@Override public void setWorkingDay(String workingDay) { super.setWorkingDay(workingDay); }
ea1a2b8c-4caa-4a7f-b183-9c23e587f9c5
7
public void getSecondLinks(ArrayList<String> theLinks) throws IOException { String temp=null; Document doc=null; boolean flag; for(String sLink : theLinks) { if(sLink.endsWith(".asx")==true || sLink.endsWith(".swf")==true){ stationLinks2.add(sLink); print("Written to file: %s", s...
a005906f-ce5b-4c8a-9587-2010b2537d24
4
public void destroyEntity() { //dead = true; // TODO: replace with death animations if (faceingX == 1) { sprite = rDeath; } if (faceingX == -1) { sprite = lDeath; } if (faceingY == 1) { sprite = dDeath; } if (faceingY == -1) { sprite = uDeath; } sprite.restart(); sprite.stopAt(7);...
ad557e33-fd3b-4fa5-a763-a6b81f6a84aa
7
public String statement() { double totalAmount = 0; int points = 0; String result = "Subscription Record for " + getName() + "\n"; for (Training each : trainings) { double thisAmount = 0; //determine amounts for each line switch (each.getCourse().getP...
f35ea716-974b-4b5a-9466-d3a0feb63cbe
4
public K atIndex(int i) { if (i < 0 || i >= size) return null ; Sector sector = first ; while (true) { if (i < sectorSize) return (K) sector.array[i] ; i -= sectorSize ; sector = sector.next ; } }