method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
52e69e3b-0026-4a86-a26d-f2c85cf535bd
3
public boolean func_para_num_wrong(String func_name,int number){ int num = gt.function_table.function_name.size(); for (int i = 0; i < num; i++) { if (gt.function_table.function_name.get(i).toString().equals(func_name)) { int n =(Integer)gt.function_table.function_parameter_n...
4317c9e6-700c-4ff8-90f4-4c6bd732e71f
8
public int characterAt(int at) throws JSONException { int c = get(at); if ((c & 0x80) == 0) { return c; } int character; int c1 = get(at + 1); if ((c1 & 0x80) == 0) { character = ((c & 0x7F) << 7) | c1; if (character > 0x7F) { ...
636ce0e1-b204-43d6-b7ff-b573c31e0acc
9
private int minPathSumMN(int m, int n, int[][] s, int[][]grid){ if(m == 0 && n == 0 ){ return grid[0][0]; } else if(m == 0){ if(s[m][n-1] != -1){ s[m][n] = s[m][n-1] + grid[m][n]; } else{ s[m][n] = minPathSumMN(m, n-1, s, grid) + g...
bad1df0b-1826-44da-989a-78bafd30017a
6
@Override public void mouseDragged(MouseEvent mouse) { Tool tool = controls.getTool(); if (begin == null && selectedMessage == null) { graph.canvas.offX = oldOffX + (mouse.getX() - preClickX); graph.canvas.offY = oldOffY + (mouse.getY() - preClickY); GUI.gRepaint(...
6b62cfdb-d436-47ca-b41b-0e37ee096b33
6
public static void killMetaInf () { File inputFile = new File(Settings.getSettings().getInstallPath() + "/" + ModPack.getSelectedPack().getDir() + "/minecraft/bin", "minecraft.jar"); File outputTmpFile = new File(Settings.getSettings().getInstallPath() + "/" + ModPack.getSelectedPack().getDir() + "/mine...
505e643d-2d6b-48e1-b785-8d68bca6ee97
9
public static String getLongestPalindrome(String s){ char[] T = preProcess(s).toCharArray(); int n = T.length; int[] P = new int[n]; int C = 0, R = 0; for (int i = 1; i < n-1; i++) { int i_mirror = 2*C - i; // equals to i' = C - (i-C) if ( i < R ) { ...
551e8bcb-ff8e-4e3d-bc9d-446019071108
5
public boolean hasPermission(CommandSender sender, String permission) { if( sender instanceof ConsoleCommandSender ) return true; // from here forward it must be a player object to pass if( !(sender instanceof Player) ) return false; Player p = (Player) sender; if( usePermissions && vaultPerms != null...
dbef4ea1-b8a7-4e6e-b028-4e7576c8d979
8
public static boolean validClass(Class<?> clazz) { try { Method serialize = clazz.getDeclaredMethod("serialize"); if (!serialize.getReturnType().equals(String.class)) { System.out.println("Class '" + clazz.getCanonicalName() + "' is not serializable because it does not return a String"); return false; ...
afa4d88e-4bb1-41ee-bbbd-ab8aad421176
8
public int placeWords(String matchString, String[] matchWords){ int n = matchString.length(); int m = 0; for(int i=0; i<n; i++){ if(m<matchWords[i].length()) m = matchWords[i].length(); } int min = Integer.MAX_VALUE; for(int i=0; i<m; i++){ int cos...
24355ff8-6b5a-4b58-a747-502b8005fd09
2
public synchronized void m4t2() { int i = 5; while (i-- > 0) { System.out.println(Thread.currentThread().getName() + " : " + i); try { Thread.sleep(500); } catch (InterruptedException ie) { } } }
d20fbf50-d36d-4629-9b80-7b17ebf7d07f
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=this.getTarget(mob,commands,givenTarget); if(target==null) return false; Room R=CMLib.map().roomLocation(target); if(R==null) R=mob.location(); if(!super.invoke(mob,commands,g...
498e8b41-2a0d-47bd-8ccd-b46044ec40fc
8
private static void getConfigLocations(File dir, String curPath, String cfgFileName, String filePrefix, List<String> files, boolean isFullPath) { String[] fileNames = dir.list(); if (fileNames == null) return; String filePath = dir.getPath(); for (int i = 0, len = fileNames.length; i < len; i++) { i...
448b906b-6435-4bd9-ba2d-cf5bc77f2bf4
6
public void initMatrix() { set0ButtonActionPerformed(null); float m[][] = filter.getMatrix(); int size = m[0].length; int start_position = 0; switch(size) { case 3 : start_position = 2; jComboBox1.setSelectedIndex(0); break; case 5 : start...
f6b59f25-47d7-4e96-8d5b-ce7c274e728c
2
public void copyDataFrom(CPColorBmp bmp) { if (bmp.width != width || bmp.height != height) { width = bmp.width; height = bmp.height; data = new int[width * height]; } System.arraycopy(bmp.data, 0, data, 0, data.length); }
b5e11667-7b2c-48d4-8cb6-9b0c03bec12c
1
private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed Desktop dt = Desktop.getDesktop(); try { dt.open( new File("help.html") ); } catch (IOException e) {//exception handling? } }//GEN-LAST:event_jM...
848f92e3-9ef9-47d9-9305-a5967835ccef
5
public static final ISignature getInstance(String ssa) { if (ssa == null) { return null; } ssa = ssa.trim(); ISignature result = null; if (ssa.equalsIgnoreCase(Registry.DSA_SIG) || ssa.equals(Registry.DSS_SIG)) { result = new DSSSignature(); } else if (ssa.equalsIg...
ae4751cf-36de-450d-87c4-557fe40dae7c
0
public int getACC() { return acc; }
cc71f488-1c6b-4b54-9f6b-1c50bf008730
4
protected Behaviour getNextStep() { if (actor.mind.home() == newHome) return null ; if (verbose) I.sayAbout(actor, "Getting next site action ") ; if (! newHome.inWorld()) { if (! canPlace()) { abortBehaviour() ; return null ; } final Tile goes = actor.world().tileAt(newHome) ; final A...
62360768-d76f-4a46-aab9-cfb0bbfcd81a
4
private void generarArchivoAutomata() { FileWriter archivoAutomata = null; PrintWriter pw = null; this.nombreAutomata = "AFN_TXT\\" + JOptionPane.showInputDialog("Por favor, indique el nombre del archivo que almacena al automata")+".txt"; try { archivoAutomata = ...
f02b3b04-dff7-4b1c-99b8-420bde47f622
0
public Integer next() { current++; return current - 1; }
52ee86fa-97cf-49e2-a8f8-3499e4c91c00
4
public void register(Object value) { if (JSONzip.probe) { int integer = find(value); if (integer >= 0) { JSONzip.log("\nDuplicate key " + value); } } if (this.length >= this.capacity) { compact(); } this.list[this.le...
1834ae2b-21a6-4a93-886f-f65281d353db
8
public void actionPerformed(ActionEvent e) { // Reset all labels userView.lblUserName.setText("* User Name"); userView.lblUserName.setForeground(Color.BLACK); userView.lblPassword.setText("* Password"); userView.lblPassword.setForeground(Color.BLACK); userView.lblFirstName.setText("* First Name"); ...
c4b6a75d-7fe0-4597-897f-ea2bf9f595c3
4
@Override public List<Integer> sort() { int i, j, k, h, x; int[] spalten = { 271, 111, 41, 13, 4, 1 }; for (k = 0; k < 6; k++) { h = spalten[k]; // Sortiere die "Spalten" mit Insertionsort for (i = h; i < list.size(); i++) { x = list.get(i); j = i; while (j >= h && list.get(j - h) > x) { l...
1520b497-310b-491e-bef2-0fe506af4f60
3
@Override public boolean isDataFlavorSupported(DataFlavor flavor) { DataFlavor[] flavors = getTransferDataFlavors(); for (int i = 0; i < flavors.length; i++) { if (flavors[i] != null && flavors[i].equals(flavor)) { return true; } } return false; }
ab8869e0-c93f-442b-a1b6-982717c8b234
9
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) { if (!(table.getParent() instanceof JViewport)) { return; } JViewport viewport = (JViewport) table.getParent(); Rectangle rect = table.getCellRect(rowIndex, vColIndex, true); Rectangle viewRect =...
5c12ca1f-e62b-4f66-b2fe-a60918f24d03
8
private int amtBet(int minBet, int maxBet){ double betAmt = 0; //Decide if its worth being aggressive if(match.tableCards.size()==0){ if(match.abs_prob_win < AGGRESSION_THRESHOLD){ return -1; }else{ betAmt = match.abs_prob_win*match.pot; } }else if(match.tableCards.size()==3){ if(opponent.b...
08f95b64-7f60-4f37-baaf-89f70a689235
5
public void service(){ while(true){ Socket socket = null; try { socket = serverSocket.accept(); System.out.println("New connections accepted" + socket.getInetAddress() + " : " + socket.getPort()); Thread.sleep(5000); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedExcept...
a88cc4f3-92b5-4dc8-b824-6f28668a0648
9
public static void parse(String t, int lineNum) { acceptingStates = new ArrayList<String>(); if (lineNum == NFA.STATES.lineNum()) { numStates = Integer.parseInt(t); } else if (lineNum == NFA.LANGUAGE.lineNum()) { language = t; } else if (lineNum == NFA.CARDINALITY.lineNum()) { numAcceptingStates = Int...
140eab20-f1c2-4c43-9244-74446c75d02d
0
public int getValue() { return value; }
eb121a36-559b-4a2b-add3-ab2577164c00
1
public RandomListNode copyRandomList(RandomListNode head) { if(head == null) return null; else{ RandomListNode headNew = copyNext(head);; copyRandom(headNew,head); return headNew; } }
34c63bb4-b82b-4c10-80a8-68a96fb5f4b3
6
public static void main(String[] args) { // abort program if correct number of command-line argument is not given if ( args.length != 1 ){ System.out.println(args.length); System.out.println("Usage : RunZeroGameSolver output.dat"); System.exit(0); } final int m0 = 2; final int increment = 1; ...
83ba83ad-28b7-425f-a43c-48a6c654b6f4
5
public static boolean Pase(Cancha cancha, int equipoA, int jugadorA, int jugadorR,int equipoD,int jugadorD, Pelota pelota){ float pase=cancha.getEquipoX(equipoA).getJugadorX(jugadorA).getPase(); pase=pase*Factorf.factorF(); //se multiplican datos por valores aleatorios float bloque=(Fact...
56890bfd-0830-4839-ac53-86d7cb711507
8
private void destroyNeighbors(Brick[][] array, int y, int x) { triggerPower(powers[y][x]); array[y][x].blowUp(); if (isBlockAbove(array, y, x)) { if (array[y - 1][x].getType() == BrickType.EXPLOSIVE) { // above explosive? destroyNeighbors(array, y - 1, x); } array[y - 1][x].blowUp(); score ...
6659e787-b74d-4425-91c9-a0782da8e64e
0
public String getWebPage() { return WebPage; }
88391c01-1d43-4bf2-be31-3b5ccc48d8cf
3
private void updateStateFound(List<Keyword> keywords, List<String> terms) { for (Keyword kw: keywords) { for (DialogState d : kw.getReference()) { if (d.getCurrentState() == Start.S_USER_FOUND) { getCurrentSession().setCurrentUser(new User((UserData)(kw.getKeywordData().getDataReference().get(0)))); ...
6f68da29-5aa9-464b-95bd-b7238ca11983
5
private final String getChunk(String s, int slength, int marker) { StringBuilder chunk = new StringBuilder(); char c = s.charAt(marker); chunk.append(c); marker++; if (isDigit(c)) { while (marker < slength) { c = s.charAt(marker...
2b597c64-0838-43af-8164-c171c04c26f8
1
File getFile() { return file == newFile ? null : file; }
12d1f856-74d1-471b-87fe-87611a497966
3
@Test public void getListProductPreferredAllClients() { Map<Client, List<Product>> currentList = null; Product book = new Product("Book", 1234, 2.30, 100); Product table = new Product("Table", 4321, 3.00, 100); Product printer = new Product("Printer", 4321, 3.00, 100); facade.addProduct(book); facade.ad...
258fd663-af59-4d53-91bc-3cf6d022d166
8
AIMove onTestPuckFriction(AIHockeyist hockeyist) { AIManager manager = AIManager.getInstance(); AIRectangle rink = manager.getRink(); int currentTick = manager.getCurrentTick(); AIPuck puck = manager.getPuck(); AIMove move = new AIMove(); if (manager.isPuckOwner(hockeyis...
4c59c2a8-c0b1-4e63-8bd0-b0c17d351b8a
5
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOW) // override protection plugins public void onBlockBreak(final BlockBreakEvent broken) { if (broken instanceof KioskRemove) return; if (!Kiosk.SIGN_BLOCKS.contains(broken.getBlock().getTypeId())) return; final Sign state = (...
92ff4c61-01ee-49c9-b152-5219eb600046
4
public void info() { List<Host> newList = new ArrayList<Host>(network_.size()); for (Host host : network_) { try { newList.add(simulation_.info(host)); } catch (CommunicationException e) { logger_.warn("{}", e.getMessage()); } ...
ecd6dfa7-d5b1-4779-a6bc-d3258d10c16d
6
public static long runQuery(final String query, final PrintStream p, final DBHandle handle) throws SQLException { final Statement stmt = handle.createReadStatement(); final RSIterator source = new RSIterator(stmt.executeQuery(query)); final String sep = "\t"; boolean first = true; long rowNum = 0; while(sou...
fb1c65ee-da4a-4804-aaf4-0db97f3bc5cd
1
public void closePopUp() { Parent parentRoot = ((Stage) stage.getOwner()).getScene().getRoot(); if (parentRoot instanceof StackPane) { ((StackPane) parentRoot).getChildren().remove(mask); } stage.close(); }
92b442d4-8288-4672-925a-89b75f77080f
5
public void morrisTraverse(TreeNode root) { while (root != null) { if (root.getLeft() == null) { System.out.println(root.getData()); root = root.getRight(); } else { TreeNode ptr = root.getLeft(); while (ptr.getRight() != null && ptr.getRight() != root) ptr = ptr.getRight(); if (ptr....
c14618e5-5fb6-42fb-a9b1-5f940e8af7d3
8
protected void buildClassifierWithWeights(Instances data) throws Exception { Instances trainData, training; double epsilon, reweight; Evaluation evaluation; int numInstances = data.numInstances(); Random randomInstance = new Random(m_Seed); // Initialize data m_Betas = new double [m_C...
ca734268-8d3f-4aec-8474-3eb4f4b4431d
6
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed if (jTable1.getSelectedRow()==-1) { JOptionPane.showMessageDialog(this, "Select a search item to check in"); return; } if (jTable1.getSelectedRowCount(...
a1e56760-6e34-47c9-b1da-e8fb6eac547a
0
private void createGui() { sendButton.setText(settings.getLanguage().getLabel("button_send")); outputTextArea.setEditable(false); setInputsEnabled(false); JPanel inputPanel = new JPanel(); inputPanel.setLayout(new BoxLayout(inputPanel, BoxLayout.LINE_AXIS)); JScrollPane inputScrollPane = new JScroll...
5de547d6-7231-4710-8dca-142cde971f13
2
public synchronized void runTask(Runnable task) { if (!isAlive) { throw new IllegalStateException(); } if (task != null) { taskQueue.add(task); notify(); } }
05a3e2d8-257c-41ec-b477-759ce9f61df2
4
public String getParameterString(){ String retString = super.getParameterString(); try{ if(sourceText!=null) retString+="&sourceText="+sourceText; if(cQuery!=null) retString+="&cquery="+URLEncoder.encode(cQuery,"UTF-8"); if(xPath!=null) retString+="&xpath="+URLEncoder.encode(xPath,"UTF-8"); } catch(Uns...
ad1d57f9-7b02-43c0-8ea5-fe2acd60ff91
8
private boolean calulateBrightnessContrast(ij.process.ImageProcessor ip) { boolean brightnesscontrast = false; int w = ip.getWidth(); int h = ip.getHeight(); //set image as current window ImagePlus bc_imp; bc_imp = WindowManager.getCurrentImage(); //calculate histogram values int []hist = ne...
7e17f7d6-4383-4d98-ad2b-57476f434fdc
6
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Square other = (Square) obj; if (this.xmin != other.xmin) { return false; } i...
980e6144-90be-4a93-b583-b7d1cf7f930e
8
public String strStr(String haystack, String needle) { // Start typing your Java solution below // DO NOT write main() function assert (haystack != null && needle != null); if (needle.length() == 0) { return haystack; } int i = 0; while (i < haystack....
b783dec3-6720-453e-ab34-80535c1a7633
7
public static boolean existeUsuario(String username) { username = username.trim(); Connection conn = null; PreparedStatement stmt = null; boolean existe = false; try { conn = model.ConexionMySQL.darConexion(); stmt = conn.pr...
532304ff-8ca2-4874-b274-0205e181b36a
2
public Authentication(AdminClient parent) { super("resources/UmbrellaSignIn.png"); this.parent = parent; this.parent.setTitle("Authentication"); if(AdminClient.client == null) { try { AdminClient.client = new Client("127.0.0.1", 1234); }catch (IOException e) { javax.swing.SwingUtilities.invokeLate...
56be4807-9a98-439a-b0e8-cea2541668db
9
public static void main(String[] args) { try { Sys.savePID(new ClinicClient().getPidFile()); Log.init(); App form = new App(); form.setUploadRunnable(new Runnable() { @Override public void run() { try { ...
cec73374-bfb9-4df0-8945-fa485ceccdfb
7
private String joinTypeToString(QbJoinType joinType) { switch (joinType) { case DEFAULT: return ""; case LEFT_OUTER: return "LEFT OUTER"; case RIGHT_OUTER: return "RIGHT OUTER"; case INNER: case OUTER: case LEFT: case RIGHT: default: return joinType.toString(); } }
1a38aec1-92cf-4f7f-ab74-6dee22f8a5e1
8
private void processPaging(MapHttpServletRequest request) { String path = request.getRequestURI(); int index = path.lastIndexOf("/page/"); if (index != -1) { String url = path.substring(0, index); String[] elements = path.substring(index + 6).split("/"); if ...
f78f9734-1da4-4429-a58f-d34d5e70870b
1
public DefaultParser(final String fileName) throws DaoException { super(); file = DefaultParser.class.getResourceAsStream(fileName); if (file == null) { throw new DaoException("file not found:" + fileName); } }
ee94b498-27ad-4785-be72-df0c6aac50fa
8
private void bump(int x, int y){ int[][] bumpvals = {new int[] {2,3,4,5}, new int[] {6, 7, 8, 9}, new int[] {10,11,12,13}, new int[] {14,15,16,17}, new int[] {18,19,20,21}}; for(int i = 0 ; i< bumpvals.length; i++){ for(int j : bumpvals[i]){ if(j == terrain[x][y]){ switch(i){ case 0: bumpKey(...
1ce30137-065a-4bfa-b83c-11563a6e4206
8
public Node execute (SearchProblemInterface problem) { Node result = null, node, shallowestNode = null; resetStatistics(); openlist.add(initialNode(problem)); /* Loop until openlist is empty, search is cancelled, or * solution is found. */ while (true) { node = openlist.poll(); if (node == null) { r...
698b428a-2664-4f4e-aa52-210d906ed504
2
public static void main(String[] args) { long SEED = 287848937; int NumberOfPackets = 10 ; //************************* double mean = 10;//2.9; //************************* System.out.println("Packets arrival distributions: "); //for packet...
3815ea62-0265-4b5e-bd33-1e7c7ed5669a
3
public void createEmpire() { beginGame(); properEmpire(); initializeTime(); EmpireDrawer.createDrawableEmpire(); SoundsOfEmpire.playBackgroundMusic(); createBarbarianMotherfuckers(); while(true) { if(Empire.getInstance().SETTLEMENTS.size() >0) { } else...
2a0547c6-ff5c-42e2-9e63-21410b2fba74
8
public int threeSumClosest(int[] num, int target) { Arrays.sort(num); int n = num.length; if(n < 3) { int sum = 0; for(int i : num) { sum+=i; } return sum; } int closest = 0; for(int i=0; i<3; i++){ ...
48dbddfa-e47c-409e-8644-82f3e4607446
8
private void seleccionarArchivos() { int resultado = selectorArchivo.showOpenDialog(this); if (resultado == JFileChooser.CANCEL_OPTION) return; File archivo = selectorArchivo.getSelectedFile(); if (archivo.isDirectory()) explorador = new ExploradorRecursivoArchivos(EXTENSIONES_TODAS); else { // Si es...
e5234d78-b50d-408a-b059-25483fd0248e
6
public static <E extends Comparable<? super E>> Node<E> partitionList(Node<E> head, E value) { Node<E> oh = null; Node<E> ot = null; Node<E> h = null; Node<E> t = null; Node<E> curr = head; while (curr != null) { if (curr.data.compareTo(value) < 0) { ...
63e4c27d-aaf3-4473-bf67-ef070463554b
1
public Usuario Logar(String Email, String Senha) throws SQLException, excecaoLogin { Usuario userLogado = new Usuario(); LoginDAO LoginDAO = new LoginDAO(); userLogado = LoginDAO.selectLogin(Email, Senha); if (userLogado == null) { throw new excecaoLogin(); } else...
91b61eae-d806-4582-8804-d8eca6df218e
7
private static int partition(int[] arr, int left, int right) { int pivot = arr[left]; // any number while (left < right) { while (left < right && arr[right] > pivot) { right--; } if (left < right) { arr[left++] = arr[right]; } while (left < right && arr[left] <= pivot) { left++; } i...
b7903c50-b63d-49aa-9f68-422bc5dd6c02
2
@Override public Position getNextPosition() { if(reader == null) { if(super.getParamString().equals("")) { reader = PositionFileIO.getPositionFileReader(null); } else { reader = PositionFileIO.getPositionFileReader(super.getParamString()); } } return PositionFileIO.getNextPosition(reader); }
d45dfe52-b6d4-480a-9426-aed773f89879
2
public boolean matches( Class<?> clazz ) { return this.a.matches( clazz ) && this.b.matches( clazz ); }
af25cc83-8737-4856-b975-c62a7ca87fba
4
@Override public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { if (IOHandler.this.master.isInterrupted() && !method.equals(this.interruptMethod)) { if (Thread.currentThread() != IOHandler.this.master) { throw new InterruptedException(); ...
e81b75d0-be4f-4c97-9109-42aea086f647
4
private void botonEliminarEliminarProductoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonEliminarEliminarProductoActionPerformed // TODO add your handling code here: Producto p = controlador.buscarProducto(txtCodigoEliminarProducto.getText()); if (p != null) { ...
07c1d622-7924-4c7e-a59d-64dec6d30755
5
public static int countOccurrencesOf(String str, String sub) { if (str == null || sub == null || str.length() == 0 || sub.length() == 0) { return 0; } int count = 0; int pos = 0; int idx; while ((idx = str.indexOf(sub, pos)) != -1) { ++count; pos = idx + su...
495c51fd-8dd7-4f75-b756-95d73ce4c411
3
private void isGameStable() { if (play.getGameStatus().equals(GameResult.GameStable)) engine.startDay(); if (play.getGameStatus().equals(GameResult.MafiaWins)) engine.endGame(GameResult.MafiaWins); if (play.getGameStatus().equals(GameResult.VillagerWins)) engine.endGame(GameResult.VillagerWins);...
a371af23-300f-464f-9038-506c1943cce0
3
@Override protected boolean xhas_in () { // We may already have a message pre-fetched. if (prefetched) return true; // Try to read the next message to the pre-fetch buffer. prefetched_msg = xxrecv (ZMQ.ZMQ_DONTWAIT); if (prefetched_msg == null && ZError.is(...
b957aaf3-a690-460b-b61c-ef27a5b64bc9
2
public int getInt(String key) throws JSONException { Object object = this.get(key); try { return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object); } catch (Exception e) { throw new JSONException("JSONObject[" ...
2a0d9613-e874-41a7-8809-ad5aaa8c7d12
8
public synchronized boolean use(String openerSQL) { if((!inUse)&&(ready())&&(!isProbablyDead())) { lastError=null; try { myPreparedStatement=null; sqlserver=true; myStatement=myConnection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); } catch(final SQLExce...
e14dfbf6-883a-45e8-be83-096538c0bf54
1
public void connect() { try { Connection c = DriverManager.getConnection( "jdbc:hsqldb:file:C:\\Users\\school\\Ninak+katen\\repo\\sytossCinemaTraining\\cinemaBom\\cinema.db;ifexists=true", "SA", ""); } catch (SQLException e) { // TODO Auto-generated catch block e.printS...
39278ae5-6558-4b48-8576-a0f5b849d6fb
6
public void debugOutput(String filePrefix) { File topicFolder = new File(filePrefix + "topicAssignment"); if (!topicFolder.exists()) { System.out.println("creating directory" + topicFolder); topicFolder.mkdir(); } File childTopKStnFolder = new File(filePrefix + "topKStn"); if (!childTopKStnFolder.exi...
38f3116e-123d-4181-b920-550aa7938440
1
private static final InetAddress getLoopBackAddress() { try { return InetAddress.getByName(null); } catch (UnknownHostException uhe) { // This can't occur, as the loopback address is always valid. Log.error(uhe); return null; } }
0cc58cca-0bc6-473a-86c8-152c3ab0593d
5
public static boolean isValidPresenceValue(int presence) { switch(presence) { case AWAY: case ONLINE: case HIDEN: case BUSY: case ROBOT: return true; default: return false; } }
a36c645d-a026-418e-b465-df219f975ab7
0
@Test public void TestOptions() { ArgSet a1 = new ArgSet("nooption -o --option -op -- - -"); assertTrue(a1.hasArg()); assertFalse(a1.hasAbbArg()); assertFalse(a1.hasOptionArg()); a1.pop(); assertFalse(a1.hasOptionArg()); assertTrue(a1.hasAbbArg()); assertTrue(a1.fetchAbbr().equals('o')); assertTrue(a...
55061689-df54-4048-87b1-c56fbff38863
1
private void initFrames(CtClass clazz, MethodInfo minfo) throws BadBytecode { if (frames == null) { frames = ((new Analyzer())).analyze(clazz, minfo); offset = 0; // start tracking changes } }
03447cd4-cf0d-4f02-aaa6-60d604eaed21
8
public ListIterator listIterator(final int startIndex) { if (startIndex < 0 || startIndex > instructionCount) throw new IllegalArgumentException(); return new ListIterator() { Instruction instr = get0(startIndex); Instruction toRemove = null; int index = startIndex; public boolean hasNext() {...
9f91a27d-a010-4f0b-908a-eaf747492c9b
4
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.setColor(Color.WHITE); Rectangle2D.Double background = new Rectangle2D.Double(0, 0, Main.WINDOW_SIZE.width, Main.WINDOW_SIZE.height); g2.fill(background); g2.draw(background); for (int ...
41d6d19d-fa63-454d-b3e5-2e1339bce080
8
private void nodeId(String s,int t) { nextToken("error occurred in node_id"); if (m_st.ttype == '}') { //creates a node if t is zero if (t == 0) { m_nodes.addElement(new InfoObject(s)); } m_st.pushBack(); } else if (m_st.ttype == '-') { nextToken("error occurred chec...
28445195-ce5c-4945-a144-f702de318a74
0
public PDALambdaTransitionChecker() { super(); }
6fbb53d9-1320-4248-9719-f77e7f73af4e
5
protected static List<Block> mergeBlocks(final List<Block> blocks, final List<PartitioningMath.Partition> partitions, final Set<LinkDigest> survivors) { final List<Block> merged = new ArrayList<Block>(); for (Parti...
6481ea1a-ba88-42e5-8edb-77b3b363fe64
0
public void setCars(List<Car> cars) { this.cars = cars; }
e02c1f60-cc20-4ea5-8482-0abb064d54ae
9
private static boolean processArgs(Option option) throws IOException, InterruptedException { if (option.isDecodeurl() == false && option.getNbThreads() > 0 && option.isCheckOnly() == false && OptionFlags.getInstance().isMetadata() == false) { return multithread(option); } for (String s : option.getResult()...
0359ebcf-e830-41c6-814a-a144a6c63910
7
public void close(boolean fuse) { PluginVars.commu_mode.remove(this.editing); this.editing.closeInventory(); if(fuse) { if(!this.editing.isOnline()) { this.returnCards(); return; } else if(!this.receiver.isOnline()) { this.editing.sendMessage("Player " + this.receiver.getDisplayName() + ChatColo...
3e2c7015-dfbe-49b8-824c-dfbac343eaa4
3
public int nombreKamonInitial(int nbjoueur){ int nbkamons = 0; if(nbjoueur == 2){ nbkamons = 12; } if(nbjoueur == 3){ nbkamons = 10; } if(nbjoueur == 4){ nbkamons = 8; } return nbkamons; }
733812e9-1a1a-4e31-99d0-6aeaccd412d1
4
private ArrayList<String> getclashedModules(String name) { // String part is module ID that it's clashed with, integer is how many // students take that module. try{ openDatabase(); }catch(Exception e){} String query = "SELECT name FROM t8005t2 .modules WHERE ID IN (SELECT ForeignID FROM t8005t2 .cla...
2978ba22-169c-46a0-9b12-5950d9ca3017
8
private static BitVector algoritam2(SATFormula formula) { BitVector vector = new BitVector(formula.getNumberOfVariables()); for (int i = 0; i < NUMBER_OF_ITERATIONS; i++) { SATFormulaStats vstat = new SATFormulaStats(formula); vstat.setAssignment(vector, true); if (vstat.isSatisfied()) { System.out.pri...
e9f17f43-74e2-4bfd-81d1-af2cdd1cf1fc
1
public void setBedCount(int bedCount) throws CarriageException { if (bedCount < 0) { throw new CarriageException("Beds count is under zero"); } this.bedCount = bedCount; }
2da83467-353f-47d7-9784-b6acefc0adfc
2
public static boolean isExist(int number, int counter){ int x = 0; while(x < counter){ if(number == randlist[x]){ return false; } x++; } return true; }
2cd2b501-5bb6-40b4-ac25-e9822ae2842c
7
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args){ if (GuildUtils.czyGraczMaGildie(sender.getName()) == true) { if (GuildUtils.czyGraczJestOwnerem(sender.getName(), GuildUtils.dajGildieGracza(sender.getName())) == false) { if (args.length == 0) { sender.sendMessage(C...
1ca08747-23aa-4cd8-bda2-293ca3f54989
3
public static int generateResult(Bean beanobj) throws NullPointerException, SQLException { int total=0; try { con = DBConnection.getConnection(); //String query1 = "select question.answer,testresult.capturedanswer from question,testresult,test where test.testid='"+beanobj.getTestid()+"'and test.questionid=q...
db91d059-015b-40a1-ba15-8706a96fb24a
5
@Override public void saveTroubleTicket(TroubleTicket troubleticket) { int ID = troubleticket.getID(); String userName = troubleticket.getUserName(); String callerName = troubleticket.getCallerName(); String description = troubleticket.getDescription(); String dateTime = troubleticket.getDateTime(...
3475bf0e-3efd-4156-8e87-04ad45463189
0
private void addVariable(String variable) { myVariables.add(variable); }
23a40e95-f1cc-402a-a407-841b864e6412
9
public static void main(String[] args){ //the best input in the command line is : 1440 900 filename 6 3.75 Thread main = Thread.currentThread(); System.out.println(main); if(args.length!=6&&args.length!=5&&args.length!=3&&args.length!=0&&args.length!=2){ System.err.println("i need either three or five or ...