method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
a2430953-b389-4852-9872-ad9cb3590e06
5
public void chooseCheckerPieceCPU() { int index = 0; for (int x = 0; x < checkersSpaces.length; x++) { for (int y = 0; y < checkersSpaces.length; y++) { if(checkersSpaces[x][y].getIcon() != null && (checkersSpaces[x][y].getIcon().equals(playerTwoCheckerPiece) || checkersSpaces[x][y].getIcon().equals...
6d1bdfcb-5e39-48b8-ad2c-c71056212ad7
8
protected synchronized InputStream readFileDataBlockInputStream(int blockID) throws IOException { if(blockID < 0) { throw new IllegalArgumentException("blockID must be positive"); } // read from local if available if(this.localFileSystem && this.localCachedBlocks != ...
5202ceec-2009-44d2-ae87-d3d94dcfcbba
5
public static <GItem, GItem2> Comparator<GItem> navigatedComparator(final Converter<? super GItem, ? extends GItem2> converter, final Comparator<? super GItem2> comparator) throws NullPointerException { if (converter == null) throw new NullPointerException("converter = null"); if (comparator == null) throw new Nu...
8018e7b8-3c68-4f6d-99c3-1f3c3ca4b71c
3
public static ArrayList<Person> read(Person person) { ArrayList<Person> personList = new ArrayList<>(); if(person == null){ try { Class.forName("org.h2.Driver"); Connection conn = DriverManager.getConnection("jdbc:h2:tcp://localhost/~/test", "sa", ""); Statement st = conn.creat...
90d86a8f-ac66-4a75-9d49-ca6d5510371b
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final ChangeOfValue other = (ChangeOfValue) obj; if (newValue == null) { ...
6b5b3f18-3f02-4854-aeb0-1ee91168ec63
7
@Override public Command planNextMove(Info info) { // TheGameView. Point C = new Point(info.getX(), info.getY()); double min = GameData.GAME_WIDTH+GameData.GAME_HEIGTH; int enemy = 0; for (int i = 0; i < info.getEnemies().size(); i++) { InfoDetail d = info.getEnemies().get(i); Point A = new Point(d.g...
a10c5ce7-1d8f-4484-a656-9fd7250d41a8
4
@Override public void caseAAssignStmt(AAssignStmt node) { inAAssignStmt(node); if(node.getSmc() != null) { node.getSmc().apply(this); } if(node.getExp() != null) { node.getExp().apply(this); } if(node.getEq() != null) ...
630f02d2-80ff-446f-9eb5-2239c4665dde
4
public boolean isOptOut() { synchronized (optOutLock) { try { // Reload the metrics file configuration.load(getConfigFile()); } catch (IOException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); } return true; } catch (InvalidConfigurationExcept...
5d0f2cca-f4f1-4707-afee-ac1396e9a157
5
public int getResult() { int i, j; double var_or = 0, var_ta = 0, var, result; for ( i = 0 ; i < orig.getWidth() ; i ++ ) { for ( j = 0 ; j < orig.getHeight() ; j ++ ) { var_or += Math.pow(((double)orig.getlum(i, j) - avg_or),2.0); } } for ( i = 0 ; i < target.getWidth() ; i ++ ) { ...
ecd09fa5-3ee1-4cdd-ab6c-9f821330ba47
7
@Override public String toString() { String output = "ID: " + mID + " " + String.format("%.7g%n", mLat[mCoordIndex]) + ", " + String.format("%.7g%n", mLon[mCoordIndex]) + " Speed: " + String.format("%.4g%n", mSpeedMPH); if (mStopHistoryIndex >= 0 && mStopHistoryIndex < mStopHistory.size() && m...
2d0b78ac-178f-4acd-b3d0-bd11b9900337
9
public void splitMultiRange(String sourceVideoFile, final String destVideoFile, final int... time) { final IStatusListener oldListener = listener; final int countOfTime = time.length; mulitRangeIndex = 0; if (countOfTime < 2) { return; } listener = new IStatusListener() { List<String> filenames = ...
4549b6ea-5bd4-43df-9246-88ed5dda3c07
0
public void Write(RandomAccessFile raf) throws Exception { raf.writeInt(this.id); raf.writeUTF(this.Name); raf.writeDouble(this.height); }
38745b06-0d44-41f2-8426-5808607f6287
5
public Vector3f checkCollision(Vector3f oldPos, Vector3f newPos, float objectWidth, float objectLength){ Vector2f collisionVector = new Vector2f(1, 1); Vector3f movementVector = newPos.sub(oldPos); if(movementVector.length() > 0){ Vector2f blockSiz...
6c1e7f23-72b7-4aa3-8ace-192a25392b54
0
@Override public void remove() { throw new UnsupportedOperationException(); }
b95ab271-4b41-4aee-80fe-20f81bfc3a6d
1
public float getProgress() { if (this.total == 0L) return 0.0F; return (float)this.current / (float)this.total; }
7cb27d82-bf4c-464c-97cb-a1accb0f59c6
6
public static double getHue(int color) { double var_R = ( color >> 16 & 0xff ) / 255.0; //RGB from 0 to 255 double var_G = ( color >> 8 & 0xff ) / 255.0; double var_B = ( color & 0xff ) / 255.0; double var_Min = Math.min(Math.min( var_R, var_G), var_B ); //Min. value of RGB double var_Ma...
43c15087-125c-45b3-88b0-aea811541b43
2
public void receive(final PacketHandler handler) { receive = new Thread("receive_thread") { public void run() { while(running) { byte[] buffer = new byte[1024]; DatagramPacket dgpacket = new DatagramPacket(buffer, buffer.length); try { socket.receive(dgpacket); } catch (IOExcept...
7d9dfbc7-0fca-4cd6-91c6-0347f07d196d
3
public DefaultConnectionUserID( UUID serverID, InetAddress localAddress, int localPort, InetAddress remoteAddress ) throws NullPointerException { super(); if( serverID == null ) throw new NullPointerException( "Cannot create a DefaultConnectionUserID with a null-serverID." ); if( loc...
d21b7734-7129-47e9-be78-3efc8b2f9e28
7
public String stemming(String sen){ sen+=" "; Stemmer s = new Stemmer(); String result = ""; char[] w = new char[501]; char[] chars = sen.toCharArray(); for(int a=0;a<chars.length;a++){ int ch = chars[a]; if (Character.isLetter((char)ch)){ int j = 0; a++; for(;a<chars.length;a++){...
e4728c04-ace4-4573-84be-5ef6b6ab46f3
5
@Override public void run() { String message; try { User user = (User) ois.readObject(); if (authentication(user)) { LOGGER.info(user.getNickname()+" connected"); clientList.add(user); oos.writeObject(clientList); }...
ef198b9c-dbc7-4e75-b68a-a43bcebcf1e1
8
public SortedMap<Long, Boolean> berechneZustandsWechselZustand(Long von, Long bis, int jahr) { // Die Abfrage besitzt eine eigene Zustandsliste //ListeZustandsWechsel listeZustandsWechselAbfrage = new ListeZustandsWechsel(); listeZustandsWechsel = new ListeZustandsWechsel(); Integer temp = jahr; ...
2992e8d0-1177-4490-9576-10171bc27458
6
public String getDirectionStr() { String dir = this.toString().toLowerCase(); switch(dir) { case "northwest": dir = "NW"; break; case "northeast": dir = "NE"; break; case "east": dir = "E"; break; case "west": dir = "W"; break; case "southwest": dir = "SW"; break; case "...
32d4e941-30ed-4b42-90d1-9dad7d1ccde0
3
private void match(SegmentedImage A, SegmentedImage B){ // int numNodes = Math.max(A.numCells(), B.numCells()) + 3; double[][] costs = assignCosts(A, B); HungarianAlgorithm hungarian = new HungarianAlgorithm(costs); int[] assigns = hungarian.execute(); for(int i = 0; i < A.numCells(); i++){ A.se...
17bceb5e-ed2d-4767-bc85-9ddfc2bc2e60
6
public void printTree(TreeNode node) { if(node == null) return; //for root we have all data with out any division if(node.parent != null) { for(int i = 0; i < node.depth - 1; i++) System.out.print("| "); System.out.print("attr" + "" + node.parent.selectedAttribute + " = " + node.selectedAttributeValue +...
02ccbc69-08e7-4ed5-bc32-fd209fc42fc1
7
private void field_localidadFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_field_localidadFocusLost boolean es_componente=false; // voy a preguntar si la componente que me saco el foco es algun campo del panel de datos de asientos int i=0; Component[] components = panel_d...
be8818fd-34ac-4ea7-843a-470cd8f1e99e
5
private void addAnimation(Animation animation, int frame) throws LowDurationException, DuplicateFrameElementException, FrameOutOfBoundsException, DuplicateNameException { actualDuration += animation.getDuration(); checkDuration(animation, frame); if(frame > (duration-1)) throw new FrameOutOfBoundsExcept...
f9a617ad-e57c-4ffe-bb32-4a206eff6305
9
private void executeAction(List<String> actionList, Player p) { for(String action : actionList) { String[] a = action.split(" "); // Give action if(a[0].equalsIgnoreCase("give")) { String[] itemData = a[1].split(":"); int item = Integer.parseInt(itemData[0]); byte data = 0; sh...
359750ba-585f-4da6-a983-11d8da624e17
7
public static void main(String[] args) { final int max = 1000000; final HashMap<Integer, Integer> primes = new HashMap<Integer, Integer>(); final SieveOfAtkin sieve = new SieveOfAtkin(max); final ArrayList<Integer> list = sieve.run(); for (int prime : list) { primes.p...
a90bc76c-4b2e-4af5-b1ea-ef22a5931ab7
5
@Override public void nativeKeyPressed(NativeKeyEvent e) { if(e.isMenuKey()) ControlKeys.setKeyPressed(e.getKeyCode()-16, true); else if(Constants.KEYS_ENABLED) { String[] scs = Configuration.getSetting("shortcuts").split("\\|"); for(byte i=0;i<scs.length;++i) { if(Byte.parseByte(scs[i].substring(3...
19aeb917-d96a-4073-8ffd-734cd74c7e50
6
public static DateTimeObject timeAdd(DateTimeObject t1, DateTimeObject t2) { { Surrogate testValue000 = Stella_Object.safePrimaryType(t1); if (Surrogate.subtypeOfP(testValue000, Stella.SGT_STELLA_CALENDAR_DATE)) { { CalendarDate t1000 = ((CalendarDate)(t1)); { Surrogate testValue001 = Stel...
85eb8c73-46c5-49d3-8ff6-cde84c696009
6
public void setLastMove(int lastMove) { move = NO_MOVE; canMove = true; this.lastMove = lastMove; switch(lastMove){ case MOVE_LEFT+MOVE_UP: setLookRight(false); break; case MOVE_RIGHT+MOVE_UP: setLookRight(true); break; case MOVE_LEFT+MOVE_DOWN: setLookRight(false); break; case MOVE_RI...
1f40584d-50df-4785-84d0-7c7a97390e90
5
public static boolean isCompatibleWithThrowsClause(Throwable ex, Class<?>[] declaredExceptions) { if (!isCheckedException(ex)) { return true; } if (declaredExceptions != null) { int i = 0; while (i < declaredExceptions.length) { if (declaredExceptions[i].isAssignableFrom(ex.getClass())) { ret...
d783e8a2-75cd-4f55-b3df-17a18e2ae73f
6
public void addPage(String document){ //add to termIndex the parsed words from *document* HTMLParser pageParser = new HTMLParser(document); docCount++; //For each word in our parsed array... for(String word: pageParser.getParsedArray()){ if (termIndex.size() == 0) ...
92d0fa44-f8eb-4e63-b528-20f146d850ba
6
private boolean removeCmd(CommandSender sender, String[] args) { if(Validate.isPlayer(sender)) { UPlayer player = plugin.getPlayerManager().getUPlayer(sender.getName()); if(player == null) return true; if(!StaffRank.isEqualOrGreater(player, StaffRank.ADMIN)) { player.sendMessage("§4You can't use this com...
d1f5fad8-311c-4ff0-bf4f-be7e3b65a46d
3
public Pos SearchMaxPos( Stone color) { Pos retPos = null; Pos workPos = new Pos(); int maxCnt = 0; for (int y = Common.Y_MIN_LEN; y < Common.Y_MAX_LEN; y++) { workPos.setY(y); for (int x = Common.X_MIN_LEN; x < Common.X_MAX_LEN; x++) { workPos.setX(x); int getCnt = this.DoSet(workPos, color, fal...
f5da14b4-5f4d-4726-965e-c83dab81de8f
8
public MapDef getDef(KeyPressedEvent e) { if (e.getID() == KeyPressedEvent.KEY_RELEASED) { MapDef def = (MapDef) keysCurrentlyDown.get(e .getCharCode()); registerKeyPressedEvent(e, def); // if (e.getID() == KeyPressedEvent.KEY_RELEASED) //l...
4b505c38-6620-4cb3-96ec-e332507279bc
7
void setConfigurationData(SystemObject systemObject, AttributeGroupUsage atgUsage, Data data) throws ConfigurationChangeException { try { final ConfigurationRequester requester = getRequester(); // Den Datensatz in ein byte-Array umwandeln. final byte[] dataAsByteArray; if(data != null) { // Prüfen ...
8e9c6b34-1581-4ee7-9cc7-619eb78ceb31
1
public void render() { for (Enemies enemies : enemises) enemies.render(); }
99c3c084-31f8-4d55-b411-5d75514eeb6c
2
public Matrix transpose() { Matrix A = new Matrix(N, M); for (int i = 0; i < M; i++) for (int j = 0; j < N; j++) A.data[j][i] = this.data[i][j]; return A; }
ab8c5d94-e363-490b-ab4f-93c55809c38f
9
public boolean process(File inputFile, boolean overwrite) throws IOException, InterruptedException, CommunityFinderException { File outputDir = inputFile.getParentFile(); if (!new File(inputFile.getAbsolutePath() + ".mcliques").exists() || overwrite) { if (!generateMaxCliques(inputFile)) th...
502aa021-a68b-4413-80e2-389d22b49209
2
public String printPropertiesFromFile(String fileName) { String result = ""; try { Properties properties = new Properties(); FileStreamLoader fileStreamLoader = new FileStreamLoader(); Context cx = Context.enter(); validateFileName(fileName); String evaluationScript = "function print(){ fileStreamL...
297f114c-cc50-47c6-a2f6-f09cdbe3e7fe
1
public static String word2num(String word) { // convert word to upper case String _word = word.trim().toUpperCase(); // for each letter, convert to number StringBuilder sb = new StringBuilder(); String _num = ""; for (int i = 0; i < _word.length(); i++) { _num = getNumberEncoding(_word.substring(i, i +...
ae216ea7-ce90-4102-9a83-d6d3a08dafaf
1
private boolean jj_2_65(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_65(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(64, xla); } }
860e4b97-62e8-4476-b3b4-225ff7ea424a
9
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) { int i = par1World.getBlockMetadata(par2, par3, par4); boolean flag = false; if (i == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1)) { flag = true; } if ...
6051c3aa-cd6b-4ec4-a84f-c3d02d2b46d6
9
private Map<Integer, Double> getTagRecencies(List<UserData> bookmarks) { //Collections.sort(bookmarks); // TODO: necessary? int testIndex = bookmarks.size() + 1; Map<Integer, Integer> firstUsages = new LinkedHashMap<Integer, Integer>(); Map<Integer, Integer> lastUsages = new LinkedHashMap<Integer, Integer>(); ...
35b47570-af68-4218-9e8e-5534b8b5a471
1
@Override public int getPrevPage() { return (hasPrevPage()) ? this.currPage-1 : 0; }
0ca09db9-0298-4f05-91e6-0f434cb8e7c9
6
static public char classChar(Object x){ Class c = null; if(x instanceof Class) c = (Class) x; else if(x instanceof Symbol) c = primClass((Symbol) x); if(c == null || !c.isPrimitive()) return 'O'; if(c == long.class) return 'L'; if(c == double.class) return 'D'; throw new IllegalArgumentExce...
0feacdfd-57c2-46d4-8e4e-1f7d14af719a
8
public List<List<GraphComponent>> findGraphPaths() { List<GraphNode> allGraphNodeList = _graphFragment.listAllNodes(); if ((allGraphNodeList != null) && (allGraphNodeList.size() > 0)) { /* Go through each node looking for out-bound relationships that haven't been visited yet. * Trying to use as few...
3606cef9-dd74-45e5-bcdc-919c95249ee9
2
public void placeMines(BoardModel boardModel) { int addedMines = 0; while (addedMines < boardModel.getNumberOfMines()) { int x = getRandomInt(boardModel.getBoardWidth()); int y = getRandomInt(boardModel.getBoardHeight()); if (!boardModel.getBoard()[x][y].isMine()) { ...
effec42d-10bb-4e3e-b8fc-8e70ba431320
0
@Test public void getConnectedComponentsTest(){ VertexSet set = new VertexSet(); set.addVertex(new City(4, 213, 250, Owner.Rom)); set.addVertex(new City(6, 300, 300, Owner.Rom)); set.addVertex(new City(5, 387, 250, Owner.Rom)); City testCity = city_graph.getCity(4); assertTrue(city_graph.getConnected...
a576c2fa-fa9f-47e5-a4b7-a6598aada809
1
@Override public void draw(Graphics2D drawScreen) { // Draw a white background first. This won't be needed if the graphics // of a layer cover the entire screen. But I am keeping this as a lot of // my tests of the game engine don't cover the entire screen, and it // would be annoying to the end user if they d...
47cf95f2-4085-4863-9a86-90ca7103ecb8
9
public boolean collision() { // We hit the right wall. if (xPosition + BALL_RADIUS > BALL_MAX_X) { if (theta < Math.PI / 2 || theta > 3 * Math.PI / 2) { /* Critical Region */ synchronized (this) { theta = wrapTheta(Math.PI - theta); return true; } } } // We hit the left w...
819cd33f-898b-41e5-b5cb-a98e3cbf5696
3
private void drawHighScores(Graphics2D g){ g.setColor(Color.white); g.drawString("HIGH SCORES", (getWidth()-fm.stringWidth("HIGH SCORES"))/2, 100); if (highScores.size() == 0){ g.drawString("No Scores Added!", (getWidth()-fm.stringWidth("No Scores Added!"))/2, getHeight()/2); }else{ for (int i = 0; ...
51da1879-d6d3-456b-9715-9a095d95df9c
7
public static String getJavaFieldOracleTypeByDBType(String type){ String str = "String"; String typeUC = type.toUpperCase(); if(typeUC.equalsIgnoreCase("NUMBER") || typeUC.startsWith("INTEGER")){ str = "Integer"; }else if(typeUC.startsWith("NUMBER")){ str = "Double"; }else if(typeUC.equalsIgnoreCase("LO...
355afe99-6aa5-40bd-8469-736252a1a6cb
3
static double [] findPercentageNumbers(int arr[]){ double fraction []=new double[3]; double total =0; for(int arr_i=0; arr_i < arr.length; arr_i++){ if(arr[arr_i]>0){ fraction[0]=fraction[0]+1; }else if(arr[arr_i]==0){ fraction[1]=fraction[1]+1; ...
cad5cec5-6ddd-43f0-b5a6-145728d64a95
2
public void checkDateAndGetStat(boolean force) { if (force || nextDate.before(new Date())) { logger.info(getName() + " collecting now..."); collectStat(force); nextDate = state.getNextDate(); } else { logger.debug(getName() + " going to collect " +...
d427e5f9-3da5-4d09-999b-20e509658445
5
public static void main(String[] args) { try { List<String> strDNAs = FileUtils.readFileFASTA2("d:/temp/rosalind_glob.txt"); char[] st1 = strDNAs.get(0).toCharArray(); // вертикальная (первая) char[] st2 = strDNAs.get(1).toCharArray(); // горизонтальная (вторая) //st1 = "PLEASANTLY".toCharArray(); //st...
4c68f41d-4c96-461e-bb6f-7f8b0d26573f
3
public static Host getHost () throws IOException { synchronized (RemoteHostFactory.class) { if (self != null) return self; // FIXME: handle _both_ RMI/JRMP and RMI/IIOP ... try { self = (Host) Naming.lookup ("usb.core.Host"); } catch (ConnectException e) { // no (default) registry ...
ff9605b0-fec0-4a7e-939d-caaeb9901ec1
9
@Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub if(e.getSource()==jb1){ //上移 //先获得选择项的索引 int index = list.getSelectedIndex(); if(index!=-1){ if(index > 0){ System.out.println(model.getSize()+" index="+index); //再把当前选择项的值赋给上一个索引处的值 model.set(i...
91d15b71-9014-4142-957a-99c67dca70bc
8
@Override public void deserialize(Buffer buf) { houseId = buf.readInt(); if (houseId < 0) throw new RuntimeException("Forbidden value on houseId = " + houseId + ", it doesn't respect the following condition : houseId < 0"); modelId = buf.readShort(); if (modelId < 0) ...
bfadac03-7c96-44b0-b9df-d4f6cc18a35c
4
@EventHandler public void onCrazySmokeMove(PlayerMoveEvent pME) { Player player = pME.getPlayer(); if(CrazyFeet.CrazySmoke.contains(player)) { Location to = pME.getTo(); Location from = pME.getFrom(); Location loc = player.getLocation(); if(to.getX() != from.getBlockX() || to.getY() != fr...
92ee1c0f-47a6-4f81-a856-521ec70680dd
6
public Element handle(FreeColServer server, Player player, Connection connection) { ServerPlayer serverPlayer = server.getPlayer(connection); Unit unit; try { unit = serverPlayer.getFreeColGameObject(unitId, Unit.class); } catch (Exception e...
3c1268bb-378d-4f66-9323-403f7cfd54ca
9
private boolean r_mark_suffix_with_optional_U_vowel() { int v_1; int v_2; int v_3; int v_4; int v_5; int v_6; int v_7; // (, line 159 // or, line 161 lab0: do { v_1 = limit - cursor; lab1: do { // (, line 160 // (, line 160 // test, line 160 v_2 = limit - cursor; if (!(in_g...
03d534bf-cd17-4633-84cb-368a68c81575
3
public static void updateMain() { //V spremenljivko zapiši trenutno lokacijo aplikacije in jo shrani v datoteko, //katero bo kasneje prebral posodobljevalnik, da bo vedel kam //shraniti novo verzijo. File file=new File(com.DzinVision.preprosteSuplence.main.Main.class.getProtectionDomain(...
074452a4-dd38-4cd7-897f-05ed07c6e728
2
@Override public final void dec(final Integer... a) { for (final Integer i : a) { if (filter[i]>=0) filter[i]--; } }
82f690cc-d10f-4d88-9186-b97bfc60c97d
0
@Test public void testGetS1() { System.out.println("getS1"); Turn instance = new Turn(Turn.direction.LEFT, 6); int expResult = 6; int result = instance.getS1(); assertEquals(expResult, result); }
5327ede8-7a14-480d-b994-fd0d66490f0d
1
private void generateHeader(PrintStream out) { out.println("digraph G {"); out.println(" ranksep = " + repository.meta("rankSep", ""+rankSep)); out.println(" rankdir = " + repository.meta("direction", ""+direction)); if(repository.hasMeta("nodesep")) out.println(" nodese...
1ca84e29-c375-440d-850d-9f138285786b
1
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing // TODO add your handling code here: System.out.println("closing"); try { FileWriter configwriter=new FileWriter(configfile); configwriter.write(startaddress+"\r\n"); ...
57e56f88-7794-4e00-a54f-3c53cd164e0f
3
public GuiceTestRunner(Class<?> klass) throws InitializationError { super(klass); // Check the @WithModules annotation WithModules wm = this.getTestClass().getJavaClass() .getAnnotation(WithModules.class); if (wm == null) { throw new InitializationError( "The class should have the @WithModules ann...
3946f502-0eaf-40e6-98f3-dd887becdd4f
4
public Console() { everyone = new HashMap<String, Player>(); games = new HashMap<String, TournyGame>(); norder = new Vector<Player>(); if (!new File("masterlist.txt").exists()) { File file = new File("masterlist.txt"); try { file.createNewFile(); } catch (IOException e) { e.printStackT...
5218c639-2173-4c0f-ac64-6bebae789c6d
4
@Override public String toString() { String ret = null; switch(type) { case CHATCMD: ret = "ChatCommand from " + nick + " : " + command + " -- " + args; break; case GAMECMD: ret = "GameCommand from " + nick + " : " + command + " -- " + args; break; case JOIN: ret = "JoinEvent : " + nick + " -- " + args; ...
854a7a47-3817-4150-8feb-904f0c02d612
2
*/ public boolean hasIsDead() { boolean b = false; for (int index = 0; index < animalFactory.getQuantityOfVictims(); index++) { if (animalFactory.getVictim(index).isDead) { b = true; } } return b; }
63f683fd-9a6b-4d1c-8c4a-b0596460d1db
3
private void construirGrafo (Nodo origen) { origen.minDistancia = 0; PriorityQueue<Nodo> cola = new PriorityQueue<>(); cola.add(origen); while (!cola.isEmpty()) { Nodo u = cola.poll(); for (Arista e : u.adyacente) { Nodo v = ...
9cc4d7c6-c5fd-405a-bdb0-cce06880ddb2
0
public ParseServlet() { super(); }
3234a665-b6ec-4154-9ddd-43c377f310ec
0
@Override public void fly() { System.out.println("I fly just like an eagle."); }
fe1b1e97-5d1b-443a-a472-8fb434843eb8
0
public void setY(int y) { this.y = y; }
90abb393-8362-49ff-a425-2e5594fe5a2d
4
public void dfs(Object root, mxGraph graph) { if (root == null) return; if (graph.getModel().isVertex(root)) { visited.add(root); } for (Object n : graph.getChildCells(root)) { if (!visited.contains(n)) dfs(n, graph); } }
b51eee66-b6bc-4ac0-a9c6-e2d14c0b92df
5
protected int parseLineName() throws ParseError { int rc = parseToken(false); boolean inp_line = s.equals("input"); boolean gate_line = s.equals("gate"); if ((rc != WORD_INDICATOR) || (!inp_line && !gate_line)) { throw new ParseError("parseLineName : Bad line name"); ...
ec9a8477-86fa-4868-b309-1c02b042e51f
5
private static void rangeQ(int l, int r, int bSize, int[] a, long[] bSums, StringBuilder sb){ long s=0; if(r-l<bSize){ for(int k=l;k<=r;k++){ s+=a[k]; } } else { int lowerB = l/bSize + 1; int upperB = r/bSize; for(int k=l;k<=bSize*lowerB;k++){ s+=a[k]; } // System.out.println("DEBUG: "...
d2f0d53c-bf80-4021-a86c-69174f962276
9
public void resolveCollision(Pinball pinball) throws Exception { int startPoint = -1, endPoint = -1; for (int i = 0; i < 361; i++) { if (getMapVal(Constants.toInt(pinball.position.getX() + pinball.getRadius() * Math.sin(Math.toRadians(i))), Constants.toInt(pin...
528f6761-8e1f-44b4-9050-412d80f05914
8
private void keresAllitmanyt(Mondat mondat) { List<Szo> potencialisSzavak = new ArrayList<>(); for (String s : mondat.getVizsgalandoSzavak()) { s = s.toLowerCase(); s = igekototLevesz(s); for (Szo szo : szokincs) { if (!szo.getSzofajok().contains("ige"...
f4d004a7-39fe-47ef-bffb-d39de53725c3
4
public InternalCommand[] listCommands() { int numInvisible = 0; for (String cmd : commands.keySet()) if (!commands.get(cmd).visible) numInvisible++; InternalCommand[] list = new InternalCommand[commands.size() - numInvisible]; int i = 0; for (String cmd : commands.keySet()) { if (commands.get(cmd).v...
05b7875d-16c9-4915-a22b-dab6ecb22f5d
6
public Vector3d getLocalNormal(Vector3d position, Matrix3d rotation, Vector3d point) { Vector3d localPoint = getLocalPoint(position, rotation, point); // Calling methods should catch this since it means that a potentially // intersecting point is not intersecting after all. if ((localPoint.x >= signedDistan...
587f55df-6811-43dc-97c0-9b930b7a5bc7
3
private void parse_authUserFile( String line, String keyword, String[] split, int lineNumber, boolean strictMode ) throws ParseException { // Line has the format: // "AuthUserFile" <AbsoluteFilePath> if( split.length != 2 ) { throw new ParseException( "Invalid '"+keyword+...
324c57ef-f4b5-4882-aa4c-503551c71e69
6
@Override public void run() { long delta = 0; while (true) { long start = System.currentTimeMillis(); update((int) delta); BufferStrategy bs = getBufferStrategy(); if (bs == null) { createBufferStrategy(3); continue; } render(bs.getDrawGraphics()); if (bs != null) bs.show(); ...
e9edd72b-2627-4ba8-b4d6-9b8ffc43792f
1
public void actionPerformed(ActionEvent e) { System.out.print("click"); String[] params = loginView.getLoginParams(); startupModel.Login(params); Boolean result = startupModel.getLoginResult(); if(!result){ loginView.setResu...
c51ab164-37ee-46e3-ad36-c3718deb6ab0
9
@SuppressWarnings("unchecked") private void getDebateList() { debateList = debate.getDebateList(); topicDBDLM.removeAllElements(); numberTurnDBDLM.removeAllElements(); statusDBDLM.removeAllElements(); winnerDBDLM.removeAllElements(); int activeTopic = 0, completedTopic = 0, pendingTopic = 0; for (int i =...
609f79e8-7170-447c-ad06-8b2cc7e22f02
4
private String decrypt(String encryptedMessage) { byte[] encMsgAsBytes = null; byte[] decrypted = null; try { encMsgAsBytes = hexStringToByteArray(encryptedMessage); SecretKeySpec keyspec = new SecretKeySpec(RemoteQuery.secretKey.getBytes("UTF-8"), "AES"); //IvPara...
4d4f6823-01b5-4e03-8178-d66b3454da4e
8
public ChannelLPC(BitInputStream is, Header header, ChannelData channelData, int bps, int wastedBits, int order) throws IOException { super(header, wastedBits); this.residual = channelData.getResidual(); this.order = order; // read warm-up samples //System.out.println("Order="+...
717702d2-4968-4b26-baa2-85ff739eabd5
2
* @Post: No changes * @Return: Whether or not the king can safely move out of check */ private boolean canMoveOutOfCheck() { King theKing =this.getCurrentKing(); for(Point p :theKing.possibleMoves())//if any of them wouldn't place the king in check, it works { if(!(wouldBeInCheck(theKing,p))) { ret...
8f38049d-9224-426d-8544-57f3ac9e32b6
3
@SuppressWarnings("unchecked") public void setDefaultFont() { GL11.glDisable(GL11.GL_TEXTURE_2D); try { font = Font.createFont(Font.PLAIN, new FileInputStream(System.getProperty("resources") + "/fonts/" + defaultFontName)); font = font.deriveFont(defaultSize); } catch (FontFormatException e) { System.er...
61c8edd6-633b-4f0d-adf0-f66feb809e0c
5
public static int indexOfIgnoreCase(String longer, int skip, String shorter) { char chInShorter = shorter.charAt(0); int indexOf = longer.indexOf(chInShorter, skip); if (indexOf == -1 && chInShorter <= 'z') { char switchCaseHead = Character.isLowerCase(chInShorter) ? Character.toUpperCase(chInShorter) ...
7f7eb574-9852-4191-bfca-237923c99437
7
public Object[] list() { ArrayList<Object> ret = new ArrayList<Object>(); while (true) { if (off >= blob.length) break; int t = uint8(); if (t == T_END) break; else if (t == T_INT) ret.add(int32()); ...
916ad5ad-86ef-4c6e-85b8-f8aea8db9456
0
void setLocation(SimpleVector location) { this.location = location; }
9d626cb5-ef8e-4f85-8978-3c139764548e
4
public static void sortStudentsPromotion(int mode) { if (sList.isEmpty()) { System.out.println("There is no Student !"); } else if (pList.isEmpty()) { System.out.println("There is no Promotion !"); } else { System.out.println("Which promotion do you want ?"); displayPromotionList(); Scanner scIn...
38635e67-edd4-48a7-87e8-693b74bb84cb
1
public static void main(String[] args) throws Exception { VorbisStream vs = new VorbisStream(new FileInputStream(args[0])); InputStream pcm = vs.pcmstream(); byte[] buf = new byte[4096]; int ret; while((ret = pcm.read(buf)) >= 0) System.out.write(buf); }
58830eab-646a-4081-b907-cad4f847fd98
0
public void mouseExited(MouseEvent e) {}
1ecd7b19-8a18-4d48-90f6-ddbf6ba4afb3
4
public void placePlayerIntoList(Player player) { // check if player is already in the quester list boolean wasInList = false; for (Quester quester : theQuesterList) { if (quester.theQuestersName.equalsIgnoreCase(player.getName())) { wasInList = true; } } if (wasInList == false) { // needs to be adde...
2a077186-96ba-413a-991a-db0511887ddb
9
public String methodLLParser(){ //this.displayTokenStack(); do{ //System.out.println("input stack top: "+tokens.peek().getToken()); //System.out.println("productions: "+productions+"\n\n"); try{ if(!tokens.peek().getToken().equals(productions.peek())){...
c26cfa3c-00cb-4f13-98d9-0a2d64e65b78
1
public boolean equals(Object object) { return object == null || object == this; }