method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
6f677fca-e831-49ee-b24a-90307bf5da43
4
public JPanel CreatGui(){ int NumberOfServer = serverlist.size(); tabbedPane = new JTabbedPane(); ImageIcon icon = createImageIcon("glorous28.png"); for(int i =0; i < NumberOfServer; i++){ TABID[CurrentTab] = i; CurrentTab += 1; ArrayList<JTextArea>...
1f593ed0-ff12-4e43-9a5d-126bd7cac8bb
4
public static void printTruthTable(String [][] results, int propagationTime){ for(int i = 0; i < results.length; i++){ for(int j = 0; j < results[0].length; j++){ if(i == 0 || results[0][j].length() == 1) System.out.print("|" + results[i][j]); else System.out.print("|" + results[i][j] + String.fo...
fb7a6212-cea6-4b71-8f3c-bc1ebec5a80a
8
final public void Function_declaration() throws ParseException { /*@bgen(jjtree) Function_declaration */ SimpleNode jjtn000 = new SimpleNode(JJTFUNCTION_DECLARATION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { Functi...
754ae916-0cbc-475d-85f1-f16d48f0d86c
2
public void matchTexture() { if (getAssociatedPlayer() instanceof ComputerPlayer && !Game.madHax) { this.setTextureID(TextureManager.getTextureID("card_back")); } else { this.setTextureID(TextureManager.getCardTextureID(card.value, card.suite)); } }
d0a2e776-23e2-46b6-94d8-53e16b991739
8
protected int partition(int attIndex, int l, int r) { double pivot = instance((l + r) / 2).value(attIndex); while (l < r) { while ((instance(l).value(attIndex) < pivot) && (l < r)) { l++; } while ((instance(r).value(attIndex) > pivot) && (l < r)) { ...
a31fffef-9e85-4a62-96ef-ad63fc4dd634
8
public static void main(String[] args) throws IOException { while (true) { System.out.println("Choose option for HomeWork to be done with...\n 1 - BufferedReader\n 2 - Scanner\n 3 - JOptionPane\n 4 - Exit"); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System....
bf4f4470-8b9a-44a0-9624-bd6c78409e97
9
public Instances defineDataFormat() throws Exception { // initialize setOptions(getOptions()); checkCoverage(); Random random = new Random (getSeed()); setRandom(random); Instances dataset; FastVector attributes = new FastVector(3); Attribute attribute; boolean classFlag = getClas...
5f7e9b54-5e3c-4304-bb3e-778faa20c7e0
6
public static <T> boolean swapArray(T[] array, int i, int j) { int size = array.length; if (size < 2 || i == j || i < 0 || i >= size || j < 0 || j >= size) { return false; } T temp = array[i]; array[i] = array[j]; array[j] = temp; return true; }
6b6e5fc8-12c8-445e-8a3a-85ddeb39e46c
8
private Vector<TrieNode> fetch(TrieNode parent) { int prev = 0; Vector<TrieNode> siblings = new Vector<TrieNode>(); for (int i = parent.left; i < parent.right; i++) { if (this.keys[i].length() < parent.depth) { continue; } String tmp = this.keys[i]; int cur = 0; if (this.keys[i].length() !...
78e57827-1653-47a2-bfb3-851935d6edb5
0
public void mouseReleased(MouseEvent e) { }
aac4fa75-c43a-4033-a04a-e90e80fee797
5
public void drawBoard(Graphics g) { g.drawImage(boardSizer.getBoardImage(), 0, 0, null); int radius = boardSizer.getPieceRadius(); for (int x = 0; x < board.boardSize; ++x) { for (int y = 0; y < board.boardSize; ++y) { int move = board.intersections[x][y]; if (move == Board.PLAYER_1 || move == Board.P...
d35cdd8c-b688-40f5-b87c-6ee433f0a2f2
8
public Offset readOffset(XMLStreamReader2 streamReader) throws XMLStreamException { Integer periodMultiplier = null; PeriodEnum period = null; DayTypeEnum dayType = null; int startingDepth = streamReader.getDepth(); while(streamReader.hasNext()) { switch(streamReader.next()) { case XML...
706038c9-606d-43ef-9624-091ba602d567
5
protected void debugOutput(int topK, String filePrefix) { File parentTopicFolder = new File(filePrefix + "parentTopicAssignment"); File childTopicFolder = new File(filePrefix + "childTopicAssignment"); if (!parentTopicFolder.exists()) { System.out.println("creating directory" + parentTopicFolder); parentTo...
395e9de4-6290-4e75-9bf3-953e76e1a529
6
@EventHandler public void PigZombieHarm(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getPigZombieConfig().getDouble("PigZombie.H...
bcdcf08b-532e-4568-914b-f87df6fe00af
9
public Line2D.Double getClippedLine(Line2D.Double line) { if (isInside(line.x1, line.y1) && isInside(line.x2, line.y2)) { return line; } if (isInside(line.x1, line.y1) == false && isInside(line.x2, line.y2) == false) { return null; } if (line.x1 != line.x2 && line.y1 != line.y2) { return null; } ...
29589861-3f28-4b1a-830c-36a89766450f
3
* @return a set of actual versions in bitset form */ BitSet getSelectedVersions( String spec ) { BitSet bs; if ( spec != null && spec.length()>0 ) bs = convertVersions( spec ); else { bs = new BitSet(); for ( int i=1;i<=versions.size();i++...
301a1304-2806-4370-931a-55380091abbd
5
public static void main(String[] args) { // read names from file List<String> names = new ArrayList<String>(); BufferedReader reader = null; try { reader = new BufferedReader(new FileReader("/home/nagasaki45/code/cattle_drive/names.txt")); String line; while((line = reader.readLine()) != null) { n...
f3779412-373b-453d-9dae-6018fa9e8c96
9
public static ObjectDefinitions getObjectDefinitions(int id) { ObjectDefinitions def = objectDefinitions.get(id); if (def == null) { def = new ObjectDefinitions(); def.id = id; byte[] data = Cache.STORE.getIndexes()[16].getFile( getArchiveId(id), id & 0xff); if (data == null) System.out.println...
638d5e6a-3ecd-4637-b4d3-f356695ff86a
4
public Person retrieve() { if (personArray.length == 0) { return null; } Person result = personArray[0]; for (int position = 0; position < personArray.length-1; position++) { if (personArray[position+1] != null) { personArray[position] = personArra...
93a37d68-6d7e-489f-986e-ac63b5f8038d
2
public GameData(int numInitialContestants) { // check if within parameters if (numInitialContestants > 15 || numInitialContestants < 6) return; // if not, do not create GameData item weeksRem = numInitialContestants - 2; weeksPassed = 0; setBetAmount(0); this.numInitialContestants = numInitialContestant...
f9df33ba-2ee3-43c3-9c00-23bf540d7167
1
public void togglefs() { if (prefs == null) setfs(); else setwnd(); }
47a728ba-f832-4c2f-b7d6-fda9e9cbe264
2
public String readLine() { if (input != null) { if (input.hasNext()) { return input.next(); } else { return null; } } else { return null; } }
e0c3e1e1-4c84-4c6c-aa80-c02f57fdeffb
4
@Override public PropertyFilter removeFilterByName(String name) { for (int i = 0; i < filters.size(); i++) { PropertyFilter filter = (PropertyFilter) filters.get(i); String filter_name = filter.getName(); if (filter_name == null && name == null) { filters.remove(i); return filter; } else if (filt...
34713499-46bb-4d87-acc3-26ecc48d7db4
8
public void recieveCmd(){ int cmd; try { cmd = input.read(); } catch (IOException ioe) { System.out.println("failed to read from serial"); ioe.printStackTrace(); return; } System.out.printf("cmd = %x: ", cmd); if((cmd & 0x80) == 0) return; switch(cmd){ case 0xC0: // start left click Syste...
29f1a3bf-aeec-4db8-a4a4-b3c3e472a9dd
4
public boolean poistaRuutu(int a, int b) { for (int i = 0; i < reuna; i++) { for (int j = 0; j < reuna; j++) { if (i == a && j == b) { ruudukko[i][j] = ""; return true; } } } return false; }
0ccccbf6-01b5-4c77-8cff-37bff53b53ca
6
public static void main(String[] unused) { Machine M; BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); M = null; boolean firstline = true; try { while (true) { String line = input.readLine(); if...
ac878949-7277-42bd-836e-62363a726052
8
public String reportByMark(){ preReportByMark(); boolean check = true; if(stdo.getStrMark().isEmpty()){ check = false; addFieldError("stdo.strMark", "You must a value to mark"); } else { try { stdo.setMark(Float.parseFloat(stdo...
e01895a2-7c8d-4fb9-8d94-37be144d4af2
1
public void setUserKey(String key) { if (key.isEmpty()) { return; } userKeyTextField.setText(key); BmLog.debug("Setting user key " + key); }
32b644d3-af74-403c-98e1-225b3aedf71a
0
public Reminder() { super(Reminder.class.getSimpleName()); }
5acba783-9d9a-43bf-b7ea-d0e9f9ee1832
8
public void displayandSearchContents() { // Output Scriptures that match System.out.println("Topic References"); for (int i = 0; i < topicsList.size(); i++) { String tempTopic = topicsList.get(i).getTopic(); System.out.println(tempTopic); for (int ...
8e1721b3-dff8-4b49-be9e-6faed8f17da6
2
private void validate(byte[] bytes) { for (byte b : bytes) { if (b == Utils.RECORD_SEPARATOR) { throw new RuntimeException("Key contains a Record Separator 0x1E"); } } }
1cd7ce81-cfc2-4fbe-a028-057588da3346
0
public void handlePark(Park park) { park.setManaged(true); this.park = park; }
61cf90d1-756e-4dfc-84c5-da55094a098a
7
@Override public boolean disInvokeEffects(Environmental E) { if(E==null) return false; if(E instanceof Affectable) { final Affectable aE=(Affectable)E; final LinkedList<Ability> affects=new LinkedList<Ability>(); for(int a=aE.numEffects()-1;a>=0;a--) // personal affects { final Ability A=aE.f...
4886922f-ff6d-4165-8ef6-af86ed5c6e43
6
public static void startupDateTimeParser() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$); Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get()))); ...
e67fad43-c35c-4613-b053-8e70c455035f
3
public static void main(String[] args) { BufferedOutputStream stream = null; try { stream = new BufferedOutputStream(new FileOutputStream("out.txt")); stream.write("Hello, World!".getBytes()); stream.write(System.getProperty("line.separator").getBytes()); stream.write("I am writting into a file using Bu...
3facb295-34ab-4e53-ba76-b8967738d3c6
5
private void getNextPosition() { // movement if(left) { dx -= moveSpeed; if(dx < -maxSpeed) { dx = -maxSpeed; } } else if(right) { dx += moveSpeed; if(dx > maxSpeed) { dx = maxSpeed; } } // falling if(falling) { dy += fallSpeed; } }
0d2c21bd-5feb-44e4-bb7e-36bcef7db012
3
public static void main(String[] args) { User u = null; try { u = new User("bob", "builder", "bbuilde"); } catch (InvalidFieldException e) { } Contestant c = new Contestant(); Contestant ul = new Contestant(); try { c.setID("aa"); ul.setID("ab"); u.setWeeklyPick(c); u.setUltimatePick(ul); ...
c8cef143-b86c-4617-a0e1-c0b90722b015
2
public void testPropertyCompareToDay() { LocalDateTime test1 = new LocalDateTime(TEST_TIME1); LocalDateTime test2 = new LocalDateTime(TEST_TIME2); assertEquals(true, test1.dayOfMonth().compareTo(test2) < 0); assertEquals(true, test2.dayOfMonth().compareTo(test1) > 0); assertEqual...
a76ad550-7875-4095-bbff-4d9b1589dec9
2
public static void addOL(Gob obj) { if(obj != null) { Integer newId = Integer.valueOf(obj.id); if(!iObj.contains(newId)) iObj.add(newId); } }
c5609747-d079-4e49-8612-c4c23f0fb4d2
9
@Override public void run() throws Exception { // TODO Auto-generated method stub try { // Eclipse doesn't support System.console() BufferedReader console = new BufferedReader(new InputStreamReader(System.in)); ConfigManager config = NetBase.theNetBase().config(); try { String targetIP = config.g...
6cc867cb-0a5e-495e-baf1-32cb0903bac6
2
public void redrawAllOpenDocuments() { for (int i = 0, limit = openDocuments.size(); i < limit; i++) { OutlinerDocument doc = (OutlinerDocument) getDocument(i); // Only request focus for the current document. if (doc == getMostRecentDocumentTouched()) { doc.panel.layout.redraw(); } else { doc....
dce8b251-ac4a-4f3a-a771-59276ef97d87
1
@Override public String getHTTPStatusCode(HTTPStatusCodes httpStatusCodes) { return getPatchMap().containsKey(etag) ? httpStatusCodes.getStatus(204) : httpStatusCodes.getStatus(200); }
08aa12c5-b00e-4204-8c8b-03f59f0698cf
0
public static void main(String[] args) { w = new Worker(); }
191cf3b4-af37-4a41-b2d7-78ebee974226
7
private void initNeedParseLangList() { if (null == needParseLangList) { needParseLangList = new ArrayList<>(); if (langEnUsjCheckBox.isSelected()) { needParseLangList.add("en_us"); } if (langDeDejCheckBox.isSelected()) { needParseLa...
836c30b9-f96c-4c5a-bf29-86724c3fea4b
3
private static void expandAllSubheads(OutlinerDocument doc) { try { if (doc.tree.getComponentFocus() == OutlineLayoutManager.TEXT) { TextKeyListener.expandAllSubheads(doc.tree.getEditingNode()); } else if (doc.tree.getComponentFocus() == OutlineLayoutManager.ICON) { IconKeyListener.expandAllSubheads(doc...
302374b8-0874-409b-9484-d7b9ea9c96ab
6
*/ public void iniciar() { /* 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://download.ora...
d74a16a6-6d16-4008-93d0-0565253e5255
3
public void addLeft() { int rows[] = types.getSelectedIndices(); if (rows.length != 0) { for(int i : rows) { AccountType type = allTypes.get(i); if (!debitTypes.contains(type)) { debitTypes.add(type); debitModel.addElement(type); } } } }
32c77a64-7d7f-45b9-a02e-2f4c7d8c3f40
4
@Override public void stateChanged(ChangeEvent ce) { System.out.println("you changed the state of the program...:P"); if(((JTabbedPane)(ce.getSource())).getSelectedIndex()==0) { if((Student.studentListAudio.size()-Integer.parseInt(studentNumberComboBox.getSelectedItem().toString()))>=0) waitingButton.se...
a5afc3e4-ccdc-451f-b93b-246204728b91
1
private static Animacion crearAnimacionCanasta() { Animacion anim = new Animacion(); for (int i = 0; i <= 8; i++) { anim.sumaCuadro (Toolkit.getDefaultToolkit ().getImage (Canasta.class.getResource ("Images/basket/net" + i + ".png")), 200); } return anim; }
0b71794b-6261-4c61-91cb-431aab4a73d1
7
private void createContenedoresGraphic() { horizontalContenedoresBarModel = new HorizontalBarChartModel(); horizontalContenedoresBarModel.setStacked(true); horizontalContenedoresBarModel.setBarMargin(40); Axis xAxis = horizontalContenedoresBarModel.getAxis(AxisType.X); xAxis.setLabel("Espacio del Conten...
30c59c51-5b22-4676-b19c-44bef41ebd44
6
public void setAnimState(AnimState state) { if (state != null) resetAnimState(); getPrivates(); stateColor = g.getColor(); stateNew = new AnimState(state); g.setColor(state.color); state.color.bind(); if (state.pos.x != 0 || state.pos.y != 0) g.translate(-state.pos.x,-state.pos.y); if (state.angle !...
ab597b52-d877-491e-97d1-1485df28d4e2
5
@Override public boolean setChartOption( String op, String val ) { boolean bHandled = false; if( op.equalsIgnoreCase( "Stacked" ) ) { fStacked = val.equals( "true" ); bHandled = true; } else if( op.equalsIgnoreCase( "PercentageDisplay" ) ) { f100 = val.equals( "true" ); bHandled = true; } ...
085d48e9-3805-4c70-a7cb-831fc4216250
9
Point computeSize(Control control, int wHint, int hHint, boolean flushCache) { if (flushCache) flushCache(); if (wHint == SWT.DEFAULT && hHint == SWT.DEFAULT) { if (defaultWidth == -1 || defaultHeight == -1) { Point size = control.computeSize(wHint, hHint, flushCache); defaultWidth = size.x; defau...
8d658102-4066-4c63-a8cf-7764f4dd40e7
4
public ModelState(final boolean score, final int level, final int theme) { this.ifScore = score; this.difficulty = level; this.theme = theme; endOfTheGame = false; //назначаем стартовые очки if (level == 8) { bricks = new boolean[4]...
37cee233-1567-4165-a36a-5c762afe0e04
2
public void guardarArchivo(String path){ try { Configuracion c = principal.configuraciones.buscar(principal.getCurrentServer()); if(c==null){ c = principal.configuraciones.getConfigLocal(); } FileOutputStream fileOut = new FileOutputStream(c.getStr...
1cb06298-d453-4309-b185-af03c0f16864
8
private static void calculateUsersTopTenMatches(HashMap<Integer, User> userMap) { /* * Note: Currently this function is hovering at a runtime of O(N^2). All possible combinations of users are computed, with no cashing, i.e. * user 1's potential relationship with user 2 is calculated, and later user 2's potenti...
271e6af7-6b52-4ae2-9a26-2da7e11917b5
6
private static void parseCriteria(Element attrElem, ChartData chartData, AttributeData parentAttr, HashMap<String, Color> colorMap) throws IOException { try { if (attrElem.getAttribute("type").equals("abstract")) { AttributeAbstractData attr = new AttributeAbstractDa...
8ee38ba6-851f-4307-8933-7a944ca7598b
3
public void init(){ initialized = true; int i = 0; while(i < content.size()){ content.get(i).PreInit(this,new Config(new File(""))); i++; } while(i < content.size()){ content.get(i).Init(this); i++; } while(i < con...
29596d64-2f00-4852-a92e-e98d8a3721f4
5
public boolean move(int direction) { if (this.movingState >= 0) { return false; } this.direction = direction; Point nextPosition = this.getNextTile(direction); if (nextPosition.x < 0 || nextPosition.y < 0 || nextPosition.x >= Constants.ENVIRONMENT_WIDTH || nextPosition.y >= Constants.ENVIRONMENT_HEIG...
439770d5-e86f-44aa-b531-5a30d716fcd4
3
@Override public void caseAConstanteDeclaracao(AConstanteDeclaracao node) { inAConstanteDeclaracao(node); if(node.getValor() != null) { node.getValor().apply(this); } if(node.getIdentificador() != null) { node.getIdentificador().apply(this)...
01975d80-632b-4fcc-a2c5-c2a143f29bb7
6
private void paintJogo(Graphics g) { // Desenhar for(int x=0; x<Engine.NUM_COLUMNS; x++) { for(int y=0; y<Engine.NUM_LINES; y++) { int drawY = Engine.NUM_LINES-1-y; if( getEngine().getCobra().isPosTrue(x,y) ) // Cobra { rectanguloJogo(g, Color.BLUE, x, drawY); } else if( getEngine...
c9dee324-90c2-418b-a8e0-60916f636436
1
public void inicio(Curso curso) throws Exception { salvar = new JButton("Salvar"); id = new JTextInt(curso.getId()); id.setEditable(false); id.setEnabled(false); nome = new JTextField(curso.getNome() == null ? "" : curso.getNome()); JPanel pp = new JPanel(); DesignGridLayout layout = new DesignGridLayou...
2ded3623-7a04-47f1-9aeb-215220fc6000
6
private boolean isTitleGood() { boolean titleGood = false; int start = -1; for (int i = 0; i < this.currentTitle.length(); i++) { if (!Trie.isASCIIAlpha(this.currentTitle.charAt(i))) { if (-1 != start) { Str...
e03757f0-13e3-4f2a-b1fc-87644348589d
7
public NewRDPNode(String taxaName, String scoreString) throws Exception { this.taxaName = stripQuotes( taxaName); scoreString = scoreString.trim(); if( scoreString.equals("1") || scoreString.equals("1.0")) { this.score = 100; } else if ( scoreString.equals("0")) { this.score = 0; } else ...
e1bac232-d254-485f-9da4-4371c940caf5
6
public static Color convertToEnum(String color_name) { switch(color_name.toUpperCase()) { case "YELLOW" : return Color.YELLOW; case "WHITE" : return Color.WHITE; case "BROWN" : return Color.BROWN; case "BLUE" : return Color.BLUE; case "RED" : return Color.RED; case "GREEN" ...
f5570e0c-af4d-4314-93d1-f68771e0897d
3
public String getAllFarmAnimals(){ Player[] p = Bukkit.getOnlinePlayers(); for(Player player : p){ if(plugin.getAnimalData().contains("Farmer." + player.getUniqueId().toString())){ String farmer = player.getUniqueId().toString(); Set<String> animals = plugin.getAnimalData().getConfigurationSection("Farm...
964f35d1-2080-4b23-af8e-c857cbbee9e6
7
public String[] getOptions() { int i; Vector result; String[] options; File file; result = new Vector(); options = super.getOptions(); for (i = 0; i < options.length; i++) result.add(options[i]); if (getOutputClassification()) result.add("-classification"); if (getRe...
3c5a00af-1d92-49ba-b545-2c782b442085
0
public int getNorth(){ return this.north; }
86fb6acd-1bf7-4f02-b332-40d26659f534
6
public void merge(int[] arrayA, int sizeA, int[] arrayB, int sizeB) { if (sizeB == 0) return; if (sizeA == 0) System.arraycopy(arrayB, 0, arrayA, 0, sizeB); int tailA = sizeA - 1; int tailB = sizeB - 1; int lastA = tailA + tailB + 1; while (tail...
1b8d9424-664b-409c-81f5-9f966d813949
5
public void close() { try { if (fileOutputStream != null) { fileOutputStream.close(); } if (fileInputStream != null) { fileInputStream.close(); } if (byteArrayInputStream != null) { byteArrayInputStream.c...
4aff473f-0a7b-45a6-9d03-0fd875a82f2e
3
public int linearRegInterceptLookback( int optInTimePeriod ) { if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) ) optInTimePeriod = 14; else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) ) return -1; return optInTimePeriod-1; }
8a34c0d6-c58d-4363-b766-b8e9aadcbdfa
3
public int overlapStart(Interval interval) { int i = 0; while (i < size() - 1 && !get(i).overlaps(interval)) { i++; } if (i >= size()) { return -1; } return i; }
b2730d21-3923-47c2-b40a-e5ac732b6eef
2
private void getInfo() { infoTextArea.setText(""); infoTextArea.append(" Тип FAT: " + extractor.getTypeOfFileSystem()); infoTextArea.append("\n BS_OEMNAME: " + extractor.getBS_OEMNAme()); infoTextArea.append("\n FAT таблиц: " + extractor.getBPB_NumFATs().toString()); infoTextArea...
21a36d7c-d070-4a66-87bd-67a744ee9028
9
private static final boolean isDelimiter(char c) { return ((c == '[') || (c == ']') || (c == '(') || (c == ')') || (c == '<') || (c == '>') || (c == '{') || (c == '}') || (c == '/') || (c == '%')); }
5a8b308e-c19c-4d64-bddb-8394a1dbd913
1
public static ProtocolException throwInaccessibleTileException(String direction, Tile theTile){ if(theTile == null){ return new ProtocolException("Invalid move: tile " + direction + " is not accessible (outside of map)"); } else { return new ProtocolException("Invalid move: " + theTile.tileType + " t...
e22b2b82-7bdf-4ad7-a900-d4dda319b965
4
public static void fail(){ if (round < 6) { currentPlayer.setScore(MrVago.getPrizes()[0]); } if (round >= 6 && round < 11) { currentPlayer.setScore(MrVago.getPrizes()[5]); } if (round >= 11) { currentPlayer.setScore(MrVago.getPrizes()[10]); } saveCurrentPlayer(prevPlayerFile); LOGG.logInf...
ad25c5c6-586c-4881-b310-51437d6755ab
6
public static File createRandomFile(File dir, String ext) { if (!dir.isDirectory()) return null; File[] files = dir.listFiles(); while (true) { String fileName = String.valueOf((int) (Math.random() * 1e10)) + '.' + ext; boolean found = false; if (files != nu...
7403ffab-2889-46ef-acdd-1f39b49f4672
3
public void testSubsetUnion() throws Exception { for (int i = 0; i < 100; i++) { int len = (int)(Math.random() * (10 - 1) + 1); RBtree a = randomRB( len ); RBtree b = randomRB( len ); RBtree ab = a.union( b ); if (!(a.subset( ab )) && !(b.subset( ab )) ) { throw new Exception("FAILURE A SET WAS ...
78d42ca8-5982-4408-8920-af7586c4a39e
8
public StringSelection getStringSelection() { StringSelection result; int[] indices; int i; int n; StringBuffer tmp; result = null; // nothing selected? -> all if (getSelectedRow() == -1) { // re...
2aa0887a-cc58-4988-a013-12bc494c4637
3
public void sortColumns() { //remove all columns first for( int i=browseTable.getColumnCount(); i > 0 ;i-- ) { browseTable.removeColumn(browseTable.getColumnModel().getColumn(i-1)); } //and now set up only the columns witch should be visible for(int j=0 ; j < isColumnShow.length; j++) { if(isColumnSh...
c4cc7038-3741-431d-ac1b-eb987f6e1db6
3
public static void sendPrivateMessageToSpies( BSPlayer sender, BSPlayer receiver, String message ) { for ( BSPlayer p : getChatSpies() ) { if ( !( p.equals( sender ) || p.equals( receiver ) ) ) { p.sendMessage( Messages.PRIVATE_MESSAGE_SPY.replace( "{sender}", sender.getName() ).repl...
4682f872-96b3-48ee-8958-b07dfce2dc90
0
public Document getDoc() { return doc; }
5d55be15-9311-4b42-9def-b720724c4e1b
0
@Override public void documentAdded(DocumentRepositoryEvent e) {}
afbdb119-f744-4ff3-8e07-db17a6d59229
7
private int findSingleBranchMaxPathSum(TreeNode root) { int leftMaxPathSum=0; int rightMaxPathSum=0; if(root.left != null){ leftMaxPathSum = findSingleBranchMaxPathSum(root.left); } if(root.right != null){ rightMaxPathSum = findSingleBranchMaxPathSum(root....
308c95be-6ebb-4c67-a90b-e7cb36bc15cb
8
public static void init() { if (weightList == null) { try { weightList = new ArrayList<Algorithm>(); HashMap<Integer, ArrayList<String>> listJp = CSVReaderUtils .csvToListJp(); if (listJp != null && listJp.size() > 0) { for (Entry<Integer, ArrayList<String>> entry : listJp .entrySet(...
3962f809-3eb8-4854-a14a-8870a9db3cf9
2
public static final boolean isHTML(String fileName) { for (String file : HTML) { if (file.equals(fileName)) { return true; } } return false; }
52e03499-42f8-4fd2-8c76-ccf67764c6ed
5
public void analyzeInnerClasses(ProgressListener pl, double done, double scale) { double subScale = scale / innerComplexity; // If output should be immediate, we delay analyzation to output. // Note that this may break anonymous classes, but the user // has been warned. if ((Options.options & Options.OPTIO...
df4f56b6-cd0f-4205-8079-6dc433cf661c
2
private static void copyfile(String srFile, String dtFile) { try { File f1 = new File(srFile); File f2 = new File(dtFile); InputStream in = new FileInputStream(f1); //For Overwrite the file. OutputStream out = new FileOutputStream(f2); by...
12774293-66ea-45ed-902a-e67eaaa7a61d
7
final void method3956(byte i, Class310 class310) { ((DirectxToolkit) this).anIDirect3DDevice9810.SetTexture (((DirectxToolkit) this).anInt8175, class310.method2314(17723)); if (i <= -53) { if (aClass209Array9795[((DirectxToolkit) this).anInt8175] == ((Class310) class310).aClass209_389...
30d1f2c0-16b3-4f25-8f47-0dda23f5fd42
2
public void copyAlphaFrom(CPColorBmp bmp, CPRect r) { r.clip(getSize()); for (int j = r.top; j < r.bottom; j++) { for (int i = r.left; i < r.right; i++) { data[j * width + i] = (data[j * width + i] & 0xffffff) | (bmp.data[j * width + i] & 0xff000000); } } }
d391ecdb-8c8c-4a88-ab2d-51d42e5f164f
4
public TGetResponse postRequest(String URL, String request) throws IOException { HttpPost hp = new HttpPost(URL); //StringEntity ent = new StringEntity(request, "UTF-8"); StringEntity ent = new StringEntity(request, HTTP.UTF_8); hp.setEntity(ent); hp.addHeader("Authorization",...
fde506fa-a144-4e63-8bd7-84df30049123
2
public static void main(String[] args) { long number = 600851475143L; for(int i = 2; i < Math.sqrt(number); i++) { if((number / i) * i == number) number = number / i; } System.out.println(number); }
c9216ea3-e9e5-49d3-a79d-24be9f7ed3e9
0
@Id @Column(name = "PRP_MOA_TIPO") public String getPrpMoaTipo() { return prpMoaTipo; }
8b1dbfcb-89b3-475f-ad46-70b181a45f00
4
private void fileChoose() { JFileChooser fc = new JFileChooser(); fc.setFileSelectionMode(JFileChooser.FILES_ONLY); fc.setCurrentDirectory(new File(System.getProperty("user.dir"))); fc.setFileFilter(new FileNameExtensionFilter("20 Questions Files", "q20", "txt")); fc.setAcceptAllFileFilterUsed(false); i...
5c00b574-96a9-4747-a715-3914bcdb5b73
1
public MovingSquares(ArrayList<Point> ms) { movingSquares = new Vector<MovingSquare>(); for (Point point : ms) { movingSquares.add(new MovingSquare(point)); } }
f2d2e535-a213-4a42-8227-6e87e5a757ac
2
@Override public void keyPressed(int key, char c) { if(!inputEnabled) return; ArrayList<GameKeyListener> keyListenersCopy = new ArrayList<GameKeyListener>(keyListeners); //Create a copy because scripts can register keypress components. System.out.println("Pressed key: " + key); Iterator<GameKeyListener> ...
84c54ab4-6bf4-488c-b231-1483e23d9636
9
public Data parse(byte[] bytes) { String input = getString(bytes).trim(); String s; if (input.length() < 1) { s = null; }else if (getSignPosition() == LEADING) { char c = input.charAt(0); s = (isPositive(c) ? "" : "-") + getNumber(c) ...
9b284675-c19e-42ed-ac69-fa417704250a
4
private void addNode(CharNode node) { int charData = 0xFFFF & node.data; if (charData > 254) { dict[dictSize++] = (byte) 255; dict[dictSize++] = (byte) ((node.data >> 8) & 0xFF); dict[dictSize++] = (byte) (node.data & 0xFF); } else { dict[dictSize+...
7711be32-c264-406e-bf04-e395634947b5
8
public void initTableHandlers(String decisionSettings, SymbolTableHandler symbolTableHandler) throws MaltChainedException { transitionTableHandler = new TransitionTableHandler(); tableHandlers = new HashMap<String, TableHandler>(); final String[] decisionElements = decisionSettings.split(",|#|;|\\+"); in...
09de994e-4266-4298-ba7f-ca778d12e30f
9
public void update() { if (followList.size() == 0) return; // FINDING THE BOUNDING RECTANGLE { Rectangle bound = new Rectangle(Integer.MAX_VALUE, Integer.MAX_VALUE, 0, 0); // Finding the minimum position for (GameObject toFollow : followList) { if (toFollow.pos.x < bound.x) { bound.x = (int) (toFoll...