method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
5f02c41f-780a-43ba-9056-5be938398da7
9
public void run() //listening { print("listening port: " + port); while (true) { Socket s; ObjectInputStream input; ObjectOutputStream output; try { s = ss.accept(); input = new ObjectInputStream(s....
47e7faaa-a492-42f1-a991-3abf9a307de4
3
private void stopListeningToMessages() { if(ChatClient.messageReciever != null && !ChatClient.messageReciever.isInterrupted()) { ChatClient.messageReciever.interrupt(); ChatClient.messageReciever.sendUnblockMessageToReciever(); /* * Sende dem Socket des ClientMessageRecieve...
3b059d2b-3582-456a-8549-931121977e2e
1
public static void insertArticle(int idCouleur, int idtva, String libelle, String reference, float prixht, int photo) throws SQLException { String query; try { query = "INSERT INTO ARTICLE (ID_COULEUR,ID_TVA,ARTLIBELLE,ARTREF,ARTPRXHT,ARTPHOTO) VALUES (?,?,?,?,?,?) "; PreparedS...
4af6870b-103d-4401-bbb9-3c6f9bdf544b
9
protected void validateProperties() { if (pre_signed_put_url != null && pre_signed_delete_url != null) { PreSignedUrlParser parsedPut = new PreSignedUrlParser(pre_signed_put_url); PreSignedUrlParser parsedDelete = new PreSignedUrlParser(pre_signed_delete_url); if (!parsedPut....
d4d966d1-13d6-4682-8a64-b88ff03d17c5
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.g...
32429e8d-6a92-4d57-9655-aaa6dedc7101
8
public static BufferedImage generatePicture(BufferedImage image, double mean, double variance) { int w = image.getWidth(); int h = image.getHeight(); // Obraz wynikowy BufferedImage result = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); for (int x = 0; x < w; ++x) for (int y = 0; y < h; ++y)...
b9519d17-df02-49ac-8b90-414ac568e93d
9
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; /* * First fill the circle buffer with as many characters as are in the ...
d0abbe41-a25e-4e66-9867-d9dca1db6cbf
7
public void dispose() { if (catalog != null) { catalog.dispose(false); catalog = null; } if (library != null) { library.dispose(); library = null; } pTrailer = null; if (documentSeekableInput != null) { try { ...
18bcc191-b0b9-4f31-adc4-5c23a0f81007
2
public List<Professor> pesquisaProfessorPeloNome(String nome) { List<Professor> listaNomes = new ArrayList<Professor>(); for (Professor e : professores) { if (e.getNome().indexOf(nome) != -1) { listaNomes.add(e); } } return listaNomes; }
69627b42-6a71-461b-826e-e9849f901a1e
2
public byte[] encrypt(String plainText) { byte[] text = plainText.getBytes(); int[] intText = byte2int(text); int i, v0, v1, sum, n; i = 0; while (i < intText.length - 1) { n = numCycles; v0 = intText[i]; v1 = intText[i + 1]; sum = 0; for (int ind = 0; ind < n; ind++) { v0 += (((v1 << 4) ^...
100be317-a623-4a3a-adc3-c042c9fcf957
2
public static List<Tva> selectTva() throws SQLException { String query = null; List<Tva> tva = new ArrayList<Tva>(); ResultSet resultat; try { query = "SELECT * from TVA "; PreparedStatement pStatement = (PreparedStatement) ConnectionBDD.getInstance().getPreparedS...
f11def8f-25ee-446b-9288-3bc596ce832d
4
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder out = new StringBuilder(); int t = Integer.parseInt(in.readLine().trim()); for(int tt = 0; tt<t; tt++){ int size = Integer.parseInt(in.readLine().trim()); m =...
87b43dce-7d76-4cb3-b12c-5f9dabd4b27a
3
public boolean existeProdutos(int idProduto) { this.setProdutos(this.getProdutosDTO().buscaProdutos(idProduto)); // if (this.getProdutos() != null && this.getProdutos().getIdProduto() != null && this.getProdutos().getIdProduto() > 0) { return EXIST_RECORD; } else { return NO_EXIST_RECORD...
2bb1d0a7-98d9-4b46-a086-e6181532cb4f
5
protected void hypothesizeChomsky(GrammarEnvironment env, Grammar g) { //System.out.println("Chomsky TIME"); CNFConverter converter = null; try { converter = new CNFConverter(g); } catch (IllegalArgumentException e) { JOptionPane.showMessageDialog(env, e.getMessage(), "Illegal Grammar", JOptionPan...
00c406bf-e849-49cd-9a94-65abb5fa39fc
9
public void initialize(FlowChartInstance flowChartinstance, ChartItemSpecification chartItemSpecification) throws MaltChainedException { super.initialize(flowChartinstance, chartItemSpecification); for (String key : chartItemSpecification.getChartItemAttributes().keySet()) { if (key.equals("id")) { idName = ...
eb6a3f52-1d81-40af-afc7-a7abbb52225f
1
public Object get() { if (!this.isEmpty()) { return removeFirst(); } else { System.err.println("You can\'t do that!"); return null; } }
394c5605-100b-48e6-bf31-4128ce946841
5
public boolean onCommand(CommandSender sender, Command command, String s, String[] strings) { if(!(sender instanceof Player)) { sender.sendMessage(ChatColor.RED + "You must be a player to do this."); return true; } Player player = (Player) sender; if(player.hasPer...
847cee54-d05c-46b4-bca9-a972a7563e51
2
public double getGroupVelocity(){ if(this.distributedResistance==0.0D && this.distributedConductance==0.0D){ this.generalPhaseVelocity = 1.0D/Math.sqrt(this.distributedInductance * this.distributedCapacitance); } else{ double omegaStored = this.omega; this.ome...
d959f2b3-46ec-4bba-9991-5643585771ec
3
public static Image applyMeanMask(Image original, int maskWidth, int maskHeight) { if (original == null) { return null; } Image image = original.shallowClone(); for (int x = 0; x < image.getWidth(); x++) { for (int y = 0; y < image.getHeight(); y++) { image.setPixel( x, y, RED, ...
9554eae3-e39f-4a04-b5f9-49987b0a222e
3
@Override public List<SymptomDTO> getAllSymptoms() throws SQLException { Session session = null; List<SymptomDTO> symptoms = new ArrayList<SymptomDTO>(); try { session = HibernateUtil.getSessionFactory().openSession(); symptoms = session.createCriteria(SymptomDTO.clas...
fb3ee618-a2ee-4cca-900c-e85a60c49c79
4
public static void main(String[] args) throws Throwable { try { Options options = new Options(); options.addOption("v", "verbose", false, "Enables verbose compiler output."); options.addOption("ee", "easterEgg", false, "Enables compiler easter eggs, DO NOT USE!"); CommandLineParser parser = new Basic...
32a9e78c-590a-496d-8b46-a65f0e1d9950
0
public String getName(){ return this.name; }
e75f10ec-59e0-45ea-90b2-b0037b6cdf80
8
private static int run_left(char[][] grid, int[][] from, int[][] to, int N, int M, int max) { for (int i = 1; i < N; i++) { for (int jhigh = M-1; jhigh > 0; jhigh--) { if (grid[i][jhigh] == '#' || from[i-1][jhigh] < 0) continue; int up = from[i-1][jhigh]; ...
936360c7-b886-4bb9-b181-5146969de373
1
private void setEhtoX(Pelihahmo h, int x){ if (h==h1){ ehtoh1x = x; } else { ehtoh2x = x; } }
fbc2a3fc-ffda-45c1-90a1-8bec95023d64
9
private void calculateImageSizes() { int oldMaxImageWidth = maxImageWidth; maxImageWidth = 1; for (Map.Entry<String, ImageRecord> entry : images.entrySet()) { if (entry.getValue() != null) { int val = entry.getValue().image.getAsBufferedImage().getWidth(null); if (val > maxImageWidth) { maxImageWi...
268ed013-f4eb-4563-900d-284224b9febc
6
public static String convertIntToServerChar(int piece) { piece = Math.abs(piece); switch (piece) { case 1: return "P"; case 2: return "N"; case 3: return "B"; case 4: return "R"; case 5: return "Q"; case 6: return "K"; default: return ""; } }
d8b00b6b-352a-4bf1-b4a6-435b428f556b
2
public void mousePressed(MouseEvent arg0) { if(status == 2) { status = 3; image.repaint(); /*(new Thread(new Runnable() { public void run() { try { animateTutorial(); } catch (InterruptedException e) { e.printStackTrace(); } startButton.setEnabled(true); e...
00a7cbf1-8d3b-45b5-b904-146ec43157d8
8
public Person createPerson(String givenName, String surname, String genType, String changeMessage, String birthDate, String birthMonth, String birthYear) { Person createdPerson = new Person(); Gender gender = new Gender(); Attribution attr = new Attribution(); Name name = new Na...
fdec416d-42b4-46db-8f0b-55677d3b7109
1
private void check(boolean val, Object... debugArguments) { if (!val) { throw new RuntimeException("We have a hacker! debugArguments=" + Arrays.toString(debugArguments)); } }
58c6b9c8-0f2f-4faa-8e44-ce9eb11de7f0
1
public SecurityMenuPreview(SkinPropertiesVO skin, JPanel parent) { if (skin == null) { IllegalArgumentException iae = new IllegalArgumentException("Wrong parameter!"); throw iae; } this.skin = skin; this.parent = parent; }
bf17f945-b02a-4952-9eee-57ec765f2f73
4
public static void main(String[] args) { Logger logger = Logger.getLogger(MapTest.class); logger.info("---- Map Starts ----"); looThruMap = new LoopThruMap(); Map<String, Integer> cart =new TreeMap<String, Integer>(); cart.put("ant",3); cart.put("zebra",4); cart.put("book",2); //Get value by spec...
2ca7570a-3026-4314-b450-da1cc2049350
3
private Date deserializeToDate(JsonElement json) { synchronized (this.enUsFormat) { try { return this.enUsFormat.parse(json.getAsString()); } catch (ParseException localParseException) { try { return this.iso8601Format.parse(json.getAsString()); } catch (P...
9c96e560-de52-47f6-9e15-b2eb7dbda867
7
@Override public void windowClosing(WindowEvent e) { if (Obj.principal != null && !Obj.principal.guardado) { int g = JOptionPane.showConfirmDialog(null, "¿Quieres guardar antes de salir?"); switch (g) { case 0: if (Obj.princip...
17cf775a-1434-44e7-989c-cd51a2d22d3a
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...
7d12557c-faf6-4d49-80d0-8c94bb93d19e
6
public int getNextWalkingDirection() { if(wQueueReadPtr == wQueueWritePtr) return -1; int dir; do { dir = Misc.direction(currentX, currentY, walkingQueueX[wQueueReadPtr], walkingQueueY[wQueueReadPtr]); if(dir == -1) { wQueueReadPtr = (wQueueReadPtr+1) % walkingQueueSize; } else if((dir&1) != 0)...
4ff9f62c-071a-41a9-8519-9691aa912989
3
public static char[] getOptions(String cmdLineArg) { char[] result = new char[0]; if (cmdLineArg == null || cmdLineArg.isEmpty()) { return result; } // avoid "--abc" if (cmdLineArg.lastIndexOf('-') == 0) { result = cmdLineArg.replace("-", "").toCharArray...
85ea0f4e-1170-417f-84ca-cb6a6b7c1d60
6
public void run() { boolean check; check = false; while (!check) { // query database access requestDatabaseInfo(); // create database object // db = new MySQLClientWrapper(console); db = new MySQLJDBCConnection(console); // open database check = db.open(sqlhostname, sqlport, sqldatabase, s...
2b8d4190-17ac-4ffb-a956-f8f6edf0c45d
0
public Eliminar() { initComponents(); }
9ad00865-35dc-4771-adde-47299be3a916
7
public boolean isCorner(){ int countUnblocked=0; for(int i = 0; i < corridor.length; i++) { if(corridor[i].getWeight()==1){ countUnblocked++; } } if(countUnblocked == 2) { if(corridor[0].getWeight() == 1 && corridor[2].getWeight() == 1){ return false; } else if(corridor[1].getWeight() == ...
7233b993-36a8-42da-99ff-fe9c241e85e0
3
public void setBullet(int id, int x, int y){ switch (id) { case 1:{ this.id = 1; this.pointX = x; this.pointY = y; this.bulletSpeed = 10; this.shotSpeed = 24; this.damage = 1; this.directi...
b3213500-eee6-450e-91c0-82950f27e436
6
public static QueryIterator createQuerySpecialistIterator(ControlFrame frame, Object [] MV_returnarray) { { Proposition proposition = null; PropertyList subqueryoptions = null; { Object [] caller_MV_returnarray = new Object[1]; proposition = ControlFrame.computeSubqueryOptions(frame, caller_MV...
c82f76ad-ae00-40b8-ba3f-30ed1d6eec52
7
public String stemString(String str) { StringBuffer result = new StringBuffer(); int start = -1; for (int j = 0; j < str.length(); j++) { char c = str.charAt(j); if (Character.isLetterOrDigit(c)) { if (start == -1) { start = j; } } else if (c == '\'') { i...
fa536bb2-9a54-4034-b80c-c213070bb443
6
private void playerTurn() { String word=""; //the game loop happens here while(true){//loop until return view.messageToPlayer(INPUT_MESSAGE); word=control.getWord(); if(word.equals("?")){ //special input for help view.displayHelp(); } else if (word.equals("!")){ //special input for done entering ...
8692f196-2d90-40fa-b73f-0d917ccd25a4
3
public void setRight(PExpLogica node) { if(this._right_ != null) { this._right_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); ...
3b671019-4ccb-4961-999b-3845443cf78a
5
@Test(expected=DAIllegalArgumentException.class) public void evaluatePostfix7() throws DAIndexOutOfBoundsException, DAIllegalArgumentException, NumberFormatException, NotEnoughOperandsException, BadPostfixException { try { postfix.removeFront(); postfix.removeFront(); postfix.removeFront(); p...
98c3530a-72e6-473a-bd25-f0d4e5652b88
5
public static void verifyPlayerCache(String player) { PlayerCache cP = getPlayerCache(player); int temp = 0; for(String job : cP._playerJobs) { if(PlayerJobs.getJobsList().containsKey(job)) { if(!PlayerJobs.getJobsList().get(job).getData().compJob().isDefault()) ...
2d79a4a7-82e8-4303-bf2f-46e2524797ff
2
public int bonusGain(Territoire t) { List<Peuple> lstTmp = t.getPrisesDuTerritoire(Partie.getInstance().getTourEnCours()); Iterator<Peuple> it = lstTmp.iterator(); while( it.hasNext() ){ Peuple p = it.next(); if( p == this.peupleLie){ return 1; } } return 0; }
279aa2f2-512a-44cd-9d7a-4af3ef710b4e
5
public ParsingResult parse(List<String> strings) { String name = getName(strings); strings = beforeEmptyLine(withoutHeader(strings)); List<double[]> matrix = new ArrayList<double[]>(); if (strings.size() != alphabet_size) { throw new RuntimeException("Incorrect number of weight lines in the transp...
34296798-7232-4e0f-9d77-0fa51c54611c
6
public static double biseccion(double extremoIzq, double extremoDer, double epsilon, int cantIter, Funcion fun) throws Exception { double p = 0; while (Math.abs(extremoDer - extremoIzq) >= epsilon && cantIter > 0) { p = (extremoDer + extremoIzq) / 2; // Punto medio del inter...
37e5562a-d713-4243-9843-eba2b61095a6
7
private void addBallsFromQueue() { int numBallsToDoInNextCall = 0;//Used to make the method stop when this number of elements //is in the queue. Ball waiting = toAdd.peek(); boolean spaceFree = true; for(Ball b : ballarray) { if(waiting.getX() >= b.getX() - b.getRadius() && waiting.getX() <= b.getX() + b.g...
c4283096-7213-4f1b-b0a5-fec5d76c53fb
3
public static String encrypt(final String pPassword) { String encryptedPassword = null; if (pPassword == null) { throw new NullPointerException(); } try { final MessageDigest md = MessageDigest.getInstance("SHA"); md.update((pPassword).getBytes("UTF-8")); encryptedPassword = new BASE64Encoder().enc...
668ca7ed-be9c-4712-b475-16be10a645fe
3
protected void generate() { String year = this.yearField.getText(); String title = this.titleField.getText(); ArrayList<String> authors = new ArrayList<String>(); for (JTextField textField : this.authorsField) { authors.add(textField.getText()); } ArrayList<...
bb8d109f-14ad-4184-95f3-df7ca4d5de84
9
@Test public void testBallConstructor() { Ball b; //inbounds x and y, theta try{ b = new Ball(250,250,1); assertArrayEquals(new int[]{250,250},b.getPosition()); assertEquals(1,b.getOrientation(),1e-4); } catch(IllegalArgumentException e){ fail("Failed requirement: "); } //out of bounds (lo...
c4ac6b6e-c007-4f3d-a20c-64aef3452dd0
8
@Override public int strstr(char[] pattern, char[] string) { if( pattern.length > string.length ) return -1; int auxIdx = -1; for( int i = 0; i < string.length; i++ ) { for( int j = 0; j < pattern.length; j++ ) { if( i + j >= string.length ) return -1; if( string[ i + j ] == pattern[ j ] && j ...
94ecacd1-ad77-40a6-afbc-106fd8d95fb5
2
public static PacketPlayOutEntityDestroy getDestroyEntityPacket() { PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(); Field a = ReflectionUtil.getDeclaredField(packet.getClass(), "a"); a.setAccessible(true); try { a.set(packet, new int[]{ENTITY_ID}); ...
46d76ab9-5687-4190-aa78-d1879b51529a
4
public static void main(String[] args) { if(args.length == 1 && args[0].equals("-dev")) Configuration.OFFLINE = true; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { /* * Must disable the strict EDT checking for substance * (almost must be set before th...
b3f6655a-6d9a-4b7d-82d8-98a2605abd90
4
public String toString() { StringBuffer sb = new StringBuffer().append(clazzAnalyzer.getClazz()) .append(".OuterValues["); String comma = ""; int slot = 1; for (int i = 0; i < headCount; i++) { if (i == headMinCount) sb.append("<-"); sb.append(comma).append(slot).append(":").append(head[i]); sl...
733faf97-a996-4ac4-b46d-e6e30ce2651c
5
private boolean r_i_verb_suffix() { int among_var; int v_1; int v_2; // setlimit, line 163 v_1 = limit - cursor; // tomark, line 163 if (cursor < I_pV) { return false; } cursor = I_pV;...
21248e46-ca22-4889-a448-2dfa7816deda
7
private String parseTrimmedChecked(String str, int ichStart, int ichMax) { int ich = ichStart; char ch; while (ich < ichMax && ((ch = str.charAt(ich)) == ' ' || ch == '\t')) ++ich; int ichLast = ichMax - 1; while (ichLast >= ich && ((ch = str.charAt(ichLast)) == ' ' || ch == '\t')) --ich...
43eb0256-9566-4eae-88b4-36d88c501a1d
9
public int getRarestPiece(Peer peer){ updatePiecePrevalence(); int min = Integer.MAX_VALUE; for(int i = 0; i < this.piecePrevalence.length; i++){ if(this.ourBitfield[i] == false && peer.bitfield[i] == true){ if(min > this.piecePrevalence[i]){ min = piecePrevalence[i]; } } } if(min ...
1586b3d5-a5fa-4293-b832-075a3cc302e5
5
private boolean isValidWorkHour(String shouldWork) { return (shouldWork.equalsIgnoreCase("z") || shouldWork.equalsIgnoreCase("v") || shouldWork.equalsIgnoreCase("c") || shouldWork.equalsIgnoreCase("k") || shouldWork.equals("*") || s...
1e662f83-3c61-4047-add5-3516cb0251d1
5
private void countUnshelved() throws SQLException { Collection<Record> records = GetRecords.create().getAllRecords(); Map<String, Integer> formatCount = new TreeMap<String, Integer>(); for (Record r : records) if (r.getShelfPos() <= 0 && r.getSoldPrice() < 0) if (formatCount.co...
e2ece889-b592-4de7-8778-8911f6d654ef
3
boolean matchesAny(char... seq) { if (isEmpty()) return false; char c = input[pos]; for (char seek : seq) { if (seek == c) return true; } return false; }
4064f2af-04f5-4cab-af5a-ac5feb8fdc4c
1
@Override public void openFiles(OpenFilesEvent event) { for (File file : event.getFiles()) { // We call this rather than directly to open(File) above to allow the file opening to be // deferred until startup has finished OpenDataFileCommand.open(file); } }
36d9777f-feda-400a-ade1-65cce097afcc
6
public TreeNode lca(TreeNode root, TreeNode a, TreeNode b) { TreeNode left = null; TreeNode right = null; if (root == null || root == a || root == b) { return root; } left = lca(root.left, a, b); right = lca(root.right, a, b); if (left != null && right != null) { return root; } else { if (left ...
656b0196-482b-411a-bbd5-9e4c2206bab6
6
@Test public void readOpmlTree() { opmlReader.init(); try { Reader resourceReader = new FileReader(resourceFile); boolean parseStatus = opmlReader.readDocument(resourceReader); if (parseStatus) { Map<String, List<String>> elementTree = opmlReader...
3f5857b2-1b37-452b-aca5-68130f71151a
3
@GET @Produces(MediaType.APPLICATION_JSON) public String getMeeting(@QueryParam("id") String id) { String valueToReturn = ""; try { Meeting meeting = Repository.getMeeting(id); if (meeting != null) { MeetingVO.Builder builder = MeetingVO.getBuilder().id(meeting.getId()); for (Vote vote : meeting.get...
fdcafd2d-0bcf-4603-bdb5-d9acd651c8a5
5
@Override public void onCreateDirectory(String arg0, DokanFileInfo arg1) throws DokanOperationException { try { if (DEBUG) System.out.println("CreateDirectory: " + arg0); fileSystem.createDirectory(this.mapWinToUnixPath(arg0)); } catch (PathNotFoundException e) { throw new DokanOperationException(n...
83c4e5d4-aea9-4e52-88fe-e2797650667a
1
private static Unsafe getUnSafe() { try { Field unsafeField = Unsafe.class.getDeclaredField("theUnsafe"); unsafeField.setAccessible(true); return (Unsafe) unsafeField.get(null); } catch (Exception e) { throw new RuntimeException(e); } }
bc55b9da-e3b9-4182-aeef-9af9dfbc2150
6
@Override public void onKeyPress(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_SPACE || key == KeyEvent.VK_ENTER) { if (currentSelection == 0) { setCurrentState(new PlayState()); } else if (currentSelection == 1) { GameMain.sGame.exit(); } } else if (key == KeyEvent.VK_UP) { ...
a83e336b-5357-4b5c-8a50-e20d52fb0741
6
public boolean isSpace(){ if (p1 == false && p2 == false && p3 == false && p4 == false && p5 == false && p6 == false){ return true; } return false; }
8a26e4b9-1b3b-4925-86f6-8d38fca26c0d
6
private void naytaLopetusNakyma() { for (int i = 0; i < soluPainikkeet.length; i++) { for (int j = 0; j < soluPainikkeet.length; j++) { JButton soluPainike = soluPainikkeet[i][j]; Solu solu = moottori.getKentta().getSolu(i, j); soluPainike.setEnabled(f...
7a392d09-f680-469c-884c-223f4cd0ad13
6
public final void downloadPage(ProgressReporter reporter) throws ProblemsReadingDocumentException, InterruptedException { Main.log(Level.FINE, String.format("Downloading %s from network...%n", url.toString())); org.jdom2.Document doc = null; try { XMLReaderSAX2Factory saxConverter = new XMLReaderSAX2Facto...
beb914ea-812f-4859-9db6-11f1e97ce8e8
3
@SuppressWarnings("deprecation") public static boolean UserInputs() { user = new JTextField(15); pass = new JPasswordField(15); JPanel myPanel = new JPanel(); myPanel.add(new JLabel("Username:")); myPanel.add(user); myPanel.add(Box.createHorizontalStrut(15)); // a spacer myPanel.add...
aba85a6e-064d-4dbd-9e73-b810dea03c30
2
public static int getCPickerID(String name) { for(int i = 0; i < numCPickers; i++) { if(cPickers[i].name().equalsIgnoreCase(name)) { return i; } } return -1; }
6f40d1c4-110b-43ea-a544-471926e93d6c
1
public void sendMessageResponse(Response message) throws IOException, InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException{ if(message instanceof LoginResponse){ //GET CHALLENGE AND BASE 64 ENCODE byte[] challenge=this.encodeBase64(((LoginRespon...
ba69a69d-737b-4530-9d7c-99b3ac90d036
0
@Override public boolean supportsDocumentAttributes() {return false;}
52ad4595-80a7-489b-bfcf-c50eaf7c8a46
0
public long createRoom(int roomNumber) { roomEntity = new RoomEntity(); roomEntity.create(roomNumber); return roomEntity.getId(); }
a8697d66-f64b-48eb-9470-eb617dc89922
6
private boolean isSpace(char ch) { switch (ch) { case ' ': case '\t': case '\f': case 0x0B: case '\r': case '\n': return true; default: return false; } }
2f09609a-428e-44be-9807-b4054d1db7ef
2
@RequestMapping(value = "/{worldId}", method = RequestMethod.GET) @ResponseBody public List<Event> getEventsByWorld(@PathVariable int worldId) { List<Event> result = new ArrayList<Event>(); List<Event> events = data.getEvents(); for(Event event : events) { if(event.getWorldId() == worldId) { result.add(e...
acbba54c-5642-4c3d-b236-a614189d8b22
4
public MiniAirplaneImage(String imageURL, PlaneColor color) { super(imageURL); totalFrame=3;//3 frames per plane delayCounter=0;//delay counter starts at 0 //Set the image to military color if(color==PlaneColor.MILITARY) { frameNumber=0; firstFrame=0; } //Set the image to white color else i...
e4354c66-141a-408c-8b07-d02cf7583ebf
9
public String nextToken() throws JSONException { char c; char q; StringBuffer sb = new StringBuffer(); do { c = next(); } while (Character.isWhitespace(c)); if (c == '"' || c == '\'') { q = c; for (;;) { c = next(); ...
a83b382d-df6a-435a-ba04-2289c993fba3
2
public void readRect(Rect r, CMsgHandler handler) { int x = r.tl.x; int y = r.tl.y; int w = r.width(); int h = r.height(); int[] imageBuf = new int[w * h]; int nPixels = imageBuf.length; int bytesPerRow = w * (reader.bpp() / 8); while (h > 0) { int nRows = nPixels / w; if (nR...
47b73a27-7d7c-47da-b3bb-ea6b3a743f61
6
public static void main(String[] args) { File file; Scanner scan = null; try { file = new File("workAreas.wrk"); scan = new Scanner(file); HashMap<String, String> workAreaList = new HashMap<String, String>(); String area = null; while(scan.hasNext()) { String lin...
23304027-a282-4611-8f7a-aa10d1bf0324
2
public String getEncoding() { if (!isInited) { try { init(); } catch (IOException ex) { IllegalStateException ise = new IllegalStateException("Init method failed."); ise.initCause(ise); throw ise; } } return encoding; }
2ce28f0e-b20f-4b58-aafc-1a7fd8f36f2a
6
@Override public void focusLost(FocusEvent e) { if(e.getSource() == frame.name && frame.name.getText().equals("")) frame.name.setText("Логин"); else if(e.getSource() == frame.password && new String(frame.password.getPassword()).equals("")) frame.password.setText("Пароль"); else if(e.getSourc...
96e63cc7-ffc7-403f-a4be-a3f60344ab6b
4
public static boolean[] toBooleanA(byte[] data) { // Advanced Technique: Extract the boolean array's length // from the first four bytes in the char array, and then // read the boolean array. // ---------- if (data == null || data.length < 4) return null; // ---------- int len = toInt...
35fa39d0-254a-49d4-b4d9-a69f491eecdd
2
public static boolean zipDirectoryTo(Path dir, Path destDir, String suffix) throws IOException { if (!controlDirectory(dir) || !controlDirectory(destDir)) { return false; } DirectoryZip.zipDirectory(dir, destDir, suffix); return true; }
eed3f04b-95fb-4e9f-950a-f382c050638d
2
public Set<BankAccount> getAccountsSatisfying(Checker<BankAccount> checker) { Set<BankAccount> result = new HashSet<>(); for (BankAccount account: accounts) if (checker.check(account)) result.add(account); return result; }
3db4af8f-84ea-43c6-bc15-d26a8ade970c
6
public static void exit(boolean close) { Utils.logger.log(Level.INFO, "Exiting main frame..."); Utils.setThreadUpdater(false); try { if(mainFrame != null) mainFrame.dispose(); } catch(Exception ignored) { } try { socket.close(); } catch(Exception ignored) { } try { Thread.s...
802c2315-9de1-4790-b731-7efeee346c5b
3
public int bwt() { final int[] SA = this.SA; final byte[] T = this.T; final int n = this.n; final int[] bucketA = new int[BZip2DivSufSort.BUCKET_A_SIZE]; final int[] bucketB = new int[BZip2DivSufSort.BUCKET_B_SIZE]; if (n == 0) { return 0; } else if (n == 1) { SA[0] = T[0]; return 0; } in...
ca32e266-dac3-41e5-935c-dbd064885d61
1
@Override public void draw(Graphics graphics, int x, int y) { int currentLeft = x; for (UiGlyph uiGlyph : this.uiGlyphs) { uiGlyph.getGlyph().draw(graphics, currentLeft, y); currentLeft += uiGlyph.getGlyph().getWidth() + 2; } }
4c0dcda0-f6dd-4fd5-a92d-e3dcef778046
9
public void populateList() { dic = new HashMap<>(); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if(Settings.level == 1){input = classLoader.getResourceAsStream("oneLetterWords.txt");} else if(Settings.level == 2){input = classLoader.getResourceAsStream("twoLetterWords.txt");} ...
918f2f08-eda2-485e-9809-0de0b83bd2d3
9
@Post("json") public Representation _post1(Representation body) { if (body == null) { setStatus(Status.CLIENT_ERROR_BAD_REQUEST); return null; } Map<String, Object> map = mapify(body); Object stmt_obj = map.get("statement"); if (stmt_obj == null) { ...
88256452-9d6e-47a2-a830-c0e5fc958209
8
double evaluateInstanceLeaveOneOut(Instance instance, double [] instA) throws Exception { DecisionTableHashKey thekey; double [] tempDist; double [] normDist; thekey = new DecisionTableHashKey(instA); if (m_classIsNominal) { // if this one is not in the table if ((tempDist = (double...
45010551-751d-4317-8fc0-1fb274ba0750
6
private boolean gwFreqHalf (CircularDataBuffer circBuf,WaveData waveData,int pos) { boolean out; int sp=(int)samplesPerSymbol100/2; // First half double early[]=do100baudFSKHalfSymbolBinRequest(circBuf,pos,lowBin,highBin); // Last half double late[]=do100baudFSKHalfSymbolBinRequest(circBuf,(pos+sp),lowBin,h...
dfeea8dd-03d6-42d6-a6fd-5a48ecb0ee02
6
public static final Integer getInteger(Object value, Integer defaultValue) { if (value == null) { return defaultValue; } if (value instanceof Number) { return value.getClass() == Integer.class ? (Integer) value : ((Number) value).intValue(); } else if (value instanceof CharSequence && ((CharSequence) valu...
7d263329-f48e-489c-990f-a124852c56f1
2
public static void main(String[] args) { if(args.length < 2) { return; } if (args.length > 2) { System.out.println("Multiplier is: x"+net.acampadas21.pokemine.types.TypeMultiplier.getMultiplier(args[0], args[1], args[2])); } else { System.out.println("Multiplier is: x"+net.acampadas21.pokemine.types.Ty...
bee09848-14a2-4725-8d9e-77c091d71ae9
9
public int takePolyomino(Polyomino p){ for (Block b:p.getContents()){ if (contents[b.getLoc().y][b.getLoc().x]==null){ contents[b.getLoc().y][b.getLoc().x] = b; } } p=null; int linesCleared=0; //Clearing rows: for (int i=contents.le...
6a20efcf-87f7-40b8-a460-520381b46d5a
9
public MoveResult[] evaluateMove() { // setCurrentPlayer(); //random person making first move MoveResult[] results = new MoveResult[]{new MoveResult(), new MoveResult()}; boolean hit = false; boolean enemyStunned = false; int dmg = 0; AttackResult attackResult;//.. = A...