method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
4d5febc8-b9f1-499a-805f-a51ed7768f03
0
public SuccessFrame() { initComponents(); }
fdcda987-1910-47e1-bcab-802e71b30635
4
public static void main(String[] args){ Scanner in = new Scanner(System.in); String s = in.next(); BigInteger i = new BigInteger(s); int result = 1; switch(i.mod(new BigInteger("4")).intValue()){ case 1 : result+=9; break; case 2 : result+=9; break; case 3 : result+=9; break; case 0 : result+=3;...
5b440681-1c25-4c62-b4d1-fde041251289
1
private void endFormals() { if (hasFormals) { hasFormals = false; buf.append('>'); } }
7acf6aa3-0589-4a02-9a48-9a7aeb134400
8
protected int getRowNear(Connection connection, int r, int n, int x) { int min = Math.min(n, x), max = Math.max(n, x); if (min > r) { max = min; min = r - (min - r); } if (max < r) { min = max; max = r + (r - max); } int proximity = 0; int direction = -1; if (r % 2 == 1) r--; Integer i...
3c4e98aa-a1a5-4005-a51b-3a34dcab0549
7
private int getSumOfNonAbundant() { List<Integer> abundants = new ArrayList<>(); for (int i = 1; i <= THRESHOLD; i++) { if (isAbundant(i)) { abundants.add(i); } } boolean[] sumOfTwoAbundant = new boolean[THRESHOLD]; for (int i = 0; i < abundants.size(); i++) { for (int j = i; j < abundants.size()...
e59d4e11-151d-44a2-9aee-1d35d0d6374f
3
public void setMode(int m) { int mode = 0; if ((m & 0x1) == 0) { mode |= PDFShapeCmd.FILL; } if ((m & 0x4) != 0) { mode |= PDFShapeCmd.CLIP; } if (((m & 0x1) ^ ((m & 0x2) >> 1)) != 0) { mode |= PDFShapeCmd.STROKE; } th...
46e7476c-1750-4e6c-9311-8cd9959dd676
6
public void keyReleased(int k) { if(k == KeyEvent.VK_LEFT) { player.setLeft(false); } if(k == KeyEvent.VK_RIGHT) { player.setRight(false); } if(k == KeyEvent.VK_UP) { player.setUp(false); } if(k == KeyEvent.VK_DOWN) { player.setDown(false); } if(k == KeyEvent.VK_W) { player.setJumping(f...
5a8b40ee-6362-40e0-a54c-fb151cd164ee
0
@Override public void restoreTemporaryToCurrent() {tmp = cur;}
11aa0958-a990-4677-a9be-709157268077
0
public void setTransforms(TransformsType value) { this.transforms = value; }
8ea825a6-9471-4f05-b1a9-16db7941f344
9
private void writeInput(PrintWriter out, int input, boolean frameBoundary) { out.print(frameBoundary ? "F" : "."); out.print(".|"); out.print((input & Move.A) != 0 ? "A" : "."); out.print((input & Move.B) != 0 ? "B" : "."); out.print((input & Move.SELECT) != 0 ? "s" : "."); out.print((input & Mo...
131da6c2-0a56-45c6-ac2d-a8a18471a186
2
public static IntNode[ ] listCopyWithTail(IntNode source) { IntNode copyHead; IntNode copyTail; IntNode[ ] answer = new IntNode[2]; // Handle the special case of the empty list. if (source == null) return answer; // The answer has two null references . // ...
c6000878-c77c-4a11-a3ec-8c5f0a18c33b
4
public void checkHands() { if (pHand.checkHand() == BUST) { score.incrementComputerScore(); myFrame.getContainerPanel().getButtonPanel().enableButton("n"); } else if (pHand.checkHand() == BLACKJACK) { score.incrementPlayerScore(); ...
fc37efd2-25b2-4f26-96af-00c615c1e20c
3
private void createCategory(Map<String, Object> jsonrpc2Params) throws Exception { Map<String, Object> params = getParams(jsonrpc2Params, new NullableExtendedParam(Constants.Param.Name.TYPE, false), new NullableExtendedParam(Constants.Param.Name.HEADLINE, false), ...
a05a64bf-acbd-4980-962d-f042eac8fe99
2
public static PermissionsList fromByteArray(byte[] array){ try{ ByteArrayInputStream bis = new ByteArrayInputStream(array); ObjectInput in = null; in = new ObjectInputStream(bis); Object o = in.readObject(); try{ bis.close(); in.close(); }catch(Exception e){System.out.println("A Me...
91e6ae1e-0e89-4be9-b338-c0db0904ca21
4
@Override public void close() throws SecurityException { closing = true; flush(); open = false; if(outStream!=null){ try { outStream.close(); } catch(IOException e) { e.printStackTrace(); } } if(fw!=null){ try { fw.close(); } catch(IOException e) { e.printStackTrace(); } ...
4f73a36e-63c9-4161-8a26-711fc050d1df
9
@Override public void onReceiveData(byte[] array, int numRead) { try { baos.write(array, 0, numRead); String sBuffer = new String(baos.toByteArray(), 0, baos.size()); if (filename == null && filesize == 0 && sBuffer.contains("\n\n")) { String[] dataSplit = sBuffer.split("\n\n"); String header = dat...
aa190080-83c5-4b5c-ba6d-ed413b229fb2
5
public static void main(final String[] args) { final Game game = new Game(); game.setVisible(true); final View view = new View(controller, model); final JLabel viewWrapper = new JLabel(); viewWrapper.setLayout(new GridLayout(1, 1)); viewWrapper.add(view); view.se...
667324a1-12b4-4609-bd71-a753a2b24c0a
5
public void startPiecePlacement(Chessboard board, String filePath) { parser = new FileParser(); try { input = getClass().getResourceAsStream(filePath); BufferedReader bReader = new BufferedReader(new InputStreamReader(input)); try { while(bReader.ready()) { nextLine = bReader.readLine()...
e8d6c48a-5a43-44da-82d9-ebda1062c697
6
private boolean isConst(int op) { return op == Opcode.ACONST_NULL || op == Opcode.ICONST_0 || op == Opcode.ICONST_1 || op == Opcode.ICONST_2 || op == Opcode.ICONST_3 || op == Opcode.ICONST_4 || op == Opcode.ICONST_5; }
c760f55b-b95a-41c6-a57c-40cef0202aa7
0
@Override public void setBirth(String birth) { super.setBirth(birth); }
69f84cc2-ea25-4c72-9802-710e173069b1
4
@Override public boolean equals(Object object) { if(object instanceof MethodNode) { MethodNode n2 = (MethodNode) object; if(n2.owner.equals(owner) && n2.name().equals(name()) && n2.signature().equals(signature())) { return true; } } return false; }
749bb4dc-a337-44a4-9c62-0ce39224a57f
4
public static List<Cashier> formatOutputs(JSONArray results) { final List<Cashier> ret = new ArrayList<Cashier>(); for (int i = 0; i < results.length(); i++) { JSONObject r = null; if (results.get(i) instanceof JSONObject) r = (JSONObject) results.get(i); if (r != null) { final Cashier c = new Cas...
61d184d4-f5a0-4522-bf9c-bbcad4525c81
2
public boolean alterar(){ EntityManager em = conecta(); try { Exame exame = em.find(Exame.class, idExame); exame.setNome(nome); exame.setValor(valor); em.getTransaction().begin(); em.persist(exame); em.getTransaction()....
7868df1c-2d63-4c24-be36-e5fd1823a887
3
@PUT() @Path("trade/{playerId}/newteam/{teamId}") @Produces("application/json") @SportService(ServiceType.MLB) public Player tradePlayer(@PathParam("playerId") int iPlayerId, @PathParam("teamId") int iTeamId) { Player p = new Player(); UserTransaction utx ...
b9c60f53-b2ee-4cb6-b365-fa2cfc796bbb
5
public static double parseDoubleLoose(String number) throws NumberFormatException { // purpose is to be loose with doubles try { return Double.parseDouble(number); } catch (NumberFormatException nfe1) { if (isNumeric(number)) { ArrayList<String> tmp = Functions.explode(".",number); String test = tmp...
87f40c30-d679-41d6-93d0-06b49cff075e
6
public void save() { if ( this.fileName == null ) { saveAs(); return; } if ( ! this.isSave () ) { saveAs(); return; } this.setSave ( true ); AnalyseFilter af = getAnalyseFilter(); if (af != nu...
17de0d1e-8af1-40ee-89de-486fd4059418
5
public Path getImgPath_ShutdownBtn(Imagetype type) { Path ret = null; switch (type) { case MOUSEFOCUS_KEYFOCUS: ret = this.imgShutdownBtn_KFocMFoc; break; case KEYFOCUS: ret = this.imgShutdownBtn_KFoc; break; ...
ac282732-0707-4807-af71-a7a5217611bd
8
static final String method1519(Throwable throwable, int i) throws IOException { String s; if (!(throwable instanceof GameRuntimeException)) { s = ""; } else { GameRuntimeException exception = (GameRuntimeException) throwable; throwable = exception.throwable; ...
0ee6959f-874e-4fde-972f-02c68d84dc1e
3
@Override public void ejecutar(Stack<Valor> st, MemoriaDatos md, Cp cp) throws Exception { if (st.size() < 2) throw new Exception("MAYOROIGUAL: faltan operandos"); Valor op1 = st.pop(); Valor op2 = st.pop(); if (op1 instanceof Entero && op2 instanceof Entero) { st.push(new Booleano(((int) op2.getVa...
0ceb0957-e1fa-4eeb-ac97-e5e3acfa6f6c
5
public Athena(COP_Instance cop, String plus_operation, String times_operation) throws IllegalArgumentException { this.cop = cop; this.ps = new MailMan(); this.mfactory = new MessageFactoryArrayDouble(); // change this for sum or prod // LOOK: check the code! if (times_op...
914c0442-c26a-4c96-b4ab-3a5c7451ded9
4
public void destroy(String id) throws NonexistentEntityException, RollbackFailureException, Exception { EntityManager em = null; try { utx.begin(); em = getEntityManager(); Equipos equipos; try { equipos = em.getReference(Equipos.class, id)...
f890d918-b66b-46ac-888b-d4b3bff193f6
3
public static Region getRegion(World world, String regionName) { RegionManager regionManager = Cuboid.getRegionManager(world); ProtectedRegion region = regionManager.getRegion(regionName); Region regionWE = null; if (region instanceof ProtectedCuboidRegion) { final ProtectedCuboidRegion cuboid = (ProtectedCu...
5a29658b-e5f3-441d-acb0-231b120fe5e0
2
public double[] standardizedItemMedians(){ if(!this.dataPreprocessed)this.preprocessData(); if(!this.variancesCalculated)this.meansAndVariances(); return this.standardizedItemMedians; }
76acc478-fa0e-4001-a366-ad34b6ecb747
0
@Test public void runTestIntentSink2() throws IOException { InfoflowResults res = analyzeAPKFile("InterAppCommunication_IntentSink2.apk"); Assert.assertEquals(1, res.size()); }
0b1593cb-a8ba-4800-a0e9-53cdefe9eff5
0
@XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "X509CRL", scope = X509DataType.class) public JAXBElement<byte[]> createX509DataTypeX509CRL(byte[] value) { return new JAXBElement<byte[]>(_X509DataTypeX509CRL_QNAME, byte[].class, X509DataType.class, ((byte[]) value)); }
5c9509db-f352-450d-a992-92f7178baba0
9
public String getMessage() { if (!specialConstructor) { return super.getMessage(); } String expected = ""; int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSequences[i].length; } for (int j = 0; ...
8b24a66a-ef1c-4000-9770-9eeb1dfe8927
7
@Override public String executer(HttpServletRequest req) throws CommandeException { Facade f = new Facade(); DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); ClientBean cb; if (((String) (req.getParameter("saveProfil"))) != null && ((String) (req.getParamet...
0d1d98a9-30ed-47d4-a93a-b5c6c680898e
1
public List<Trata> ObtenerTrata(String consulta){ List<Trata> lista=new ArrayList<Trata>(); if (!consulta.equals("")) { lista=cx.getObjects(consulta); }else { lista=null; } return lista; }
56d5d548-cb45-4e78-9f53-2e08552742af
4
private void deleteFiles(Connection dbConnection) { logger.info("Polling for files pending deletion..."); try { PreparedStatement s = dbConnection.prepareStatement("SELECT * FROM files WHERE ready_for_processing=1 AND ((heartbeat IS NULL OR heartbeat<?) AND (ready_for_delete=1 OR (in_use=0 AND session_id ...
b6a4b4ea-0d0f-42f3-8d49-76100752939e
2
public static User getUserByUsername(String username) { username = username.trim(); try { String statement = new String("SELECT * FROM " + DBTable + " WHERE username = ?"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); stmt.setString(1, username); ResultSet rs = stmt.executeQuer...
f48418ba-d9a1-4b77-aca4-9cc016e3fb92
0
public String getServiceType() { return serviceType; }
97959f78-8718-4cc6-88a4-90d800a8659f
7
public void run() { while (true) { try { sleep(100); } catch (InterruptedException except) { } for (SwitchPort port: this.ports) { //Check incoming packets only on connected ports if (port.getIPAddress() == null) co...
4f01bed8-ddf5-4c2c-93ed-33313f258b0e
1
private String getName(String Declaration) { // TODO Auto-generated method stub Declaration = Declaration.trim(); int i = 0; String name = ""; while(Declaration.charAt(i) != ' '){ name += Declaration.charAt(i); i++; } return name; }
133a5f59-d2a7-43f1-be93-831c342eac08
2
public List<String> getResultingStatesValuesByStateAndSymbol(String state, String symbol) throws Exception{ List<String> result = new ArrayList<String>(); for(Transition tran: transitions){ if(tran.matchByStateAndSymbol(state, symbol, getSymbolByAlter(tran.getSymbolRef()))) r...
c3241c0c-6cf0-4635-833c-7f7e80be39fe
6
public ArrayList<ArrayList<Flight>> getMultiHopFlights( String departureAirport, String arrivalAirport) { ArrayList<ArrayList<Flight>> result = new ArrayList<ArrayList<Flight>>(); ArrayList<ArrayList<Flight>> arrangedFlights = arrangedFlights(); for (int i = 0; i < arrangedFlights.size(); i++) { ArrayList...
b7c2182e-2679-40fc-9229-587e59186ebe
4
static boolean player2Move(int x, int y) { if (getGame().m_board.anyValid(m_player2Colour)) { if (getGame().move(x, y, m_player2Colour)) { if (m_p1colour == Piece.OthelloPieceColour.WHITE) { m_gridButtons[x][y].setIcon(m_blackPiece); } else { m_gridButtons[x][y].setIcon(m_whitePiece); } ...
c01f0733-9d0f-4e7f-b9bb-418522298d01
3
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Pion)) return false; Pion other = (Pion) obj; return (this.couleur == other.couleur); }
bf1829d1-afe0-465d-8775-eaa67fbff766
2
public void cattr(Message msg) { synchronized (cattr) { while (!msg.eom()) { String nm = msg.string(); int base = msg.int32(); int comp = msg.int32(); CAttr a = cattr.get(nm); if (a == null) { a = new CAttr(nm, base, comp); cattr.put(nm, a); } else { a.update(base, comp); ...
9883c282-b0a0-4b83-af57-a6b617dc521f
2
public void uimsg(String msg, Object... args) { if (msg == "ch") { if (args.length > 1) change((String) args[0], (Color) args[1]); else change((String) args[0]); } }
3cd1c85a-b035-41d9-8510-da1afde6b32d
1
public boolean EliminarTipoCultivo(TipoCultivo p){ if (p!=null) { cx.Eliminar(p); return true; }else { return false; } }
03602bab-a3bd-4947-b671-65f799b25126
1
public boolean isHeld() { if(isDisabled()) return false; return held; }
fcac2d07-9cdd-4b25-b4fe-a04b0625931b
7
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed ArrayList<String> tagit = new ArrayList<>(); Component[] lomakkeenSisalto = lomake.getComponents(); JList tagilista = null; for (Component kentta : lomakkeenSisalto) { ...
4e039ee6-d134-4956-8c55-907dd8bd9811
2
public DoublyLinkedNode search(E e) { DoublyLinkedNode n = head; while (n != null) { if (n.getKey().equals(e)) { return n; } n = n.getSucc(); } return null; }
a82231d7-1eb6-4dc4-a457-ad9dd81f635b
5
public static boolean matrixCompare(double[][] A, double[][] B) { if (A.length != B.length) return false; for (int i = 0; i < A.length; i++) { if (A[i].length != B[i].length) return false; for (int j = 0; j < A[i].length; j++) if (Math.abs(A[i][j] - B[i][j]) > eps) return false; } return ...
5896e34e-dfc4-4d24-8527-63f6fb639d68
7
public static void main(String[] args) { CommandLineParser parser = new PosixParser(); Options options = new Options(); options.addOption("i", "info-lps", true, "INFO logs per second, defaults to " + DEFAULT_INFO_LPS); options.addOption("w", "warn-lps", true, "WARN logs per second, defaults to " + DEFAULT_WARN_...
c2fabc59-5f11-44ee-9bc0-fabe8a4d707f
5
public void drawMenu(int offsetX, int offsetY) { int x = menuOffsetX - offsetX; int y = menuOffsetY - offsetY; int width = menuWidth; int height = menuHeight; RSDrawingArea.drawRoundedRectangle(x, y, width, height, 0, 220, true, false); RSDrawingArea.drawFilledAlphaPixels(x + 1, y + 1, width - 2, 16, 0x2C2C...
f9bd8e30-fa8a-4955-ba94-184c0cc5a1b5
3
private void btnRemoveAssetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoveAssetActionPerformed selectedAsset = (Asset)listAssetList.getSelectedValue(); if(selectedElement !=null && selectedProject !=null && selectedAsset !=null) { deleteAsset(selectedAss...
8d38350b-2c45-40b8-9862-d2cc480bd045
7
* responsible for reporting the error to the user through * ValidationEventHandler. */ private String convert(String v) throws Exception { if (minLength != null && v.length() < minLength) { throw new Exception("string length violation " + this.getClass().getSimpleNa...
d360b240-36ce-4bf5-a819-d5682007da8a
6
private void handleResize() { paintCanvas.update(); Rectangle visibleRect = paintCanvas.getClientArea(); visibleWidth = visibleRect.width; visibleHeight = visibleRect.height; ScrollBar horizontal = paintCanvas.getHorizontalBar(); if (horizontal != null) { displayFDC.xOffset = Math.min(horizontal.getSel...
fb981535-3ae5-44ca-8c5a-8b1684fc637d
7
public void trackFile(String str){ Path path = Paths.get(str); WatchService watchService = null; try { watchService = path.getFileSystem().newWatchService(); path.register(watchService, StandardWatchEventKinds.ENTRY_MODIFY); } catch (IOException e) { ...
98b400b5-993b-4ea0-8051-d0740c77091e
4
public boolean[] weighingWithStones(int[] stones, int index, int maxWeight) { /* We want to use index from 1 to maxWeight */ boolean[] measurabilities = new boolean[maxWeight + 1]; int currentStone = stones[index]; if(index == 0) { measurabilities[currentStone] = true; } else { boolean[] subresult = ...
aa175ea4-9b08-4d3b-b989-82b74c0a6531
4
public void compute() { for (Tanq t: battleground.getCollider(this)) { if (!consumers.contains(t)) { t.reload(new Clip()); consumers.add(t); clips.pop().suicide(); if (clips.empty()) break; } } if (clips.empty()) relocate(); }
a6e77715-ff59-461d-a26c-059cea44a4f5
5
public static void main(String[] args) { // String filePath = "D:\\\\Download\\SecureCRT\\popup.yy.com.log.6\\popup.yy.com.log.6"; String filePath = "D:\\\\Download\\SecureCRT\\popup.yy.com.log"; try (FileReader fr = new FileReader(filePath); BufferedReader br = new BufferedReader(fr)) { String line = null;...
4304eb09-a367-4d45-b106-3b96f1447b9f
6
public int getGameState(int x, int y, char t) { if (validateRows(t, x) || validateColumns(t, y) || validateDiagonal(t, x, y)) { if (t == 'o') { return 1; } else if (t == 'x') { return 2; } } //dontetlen ellenorzese ezt kell utol...
8a39276b-88da-4870-aee3-6735ea6c42c2
2
@Override public int compare(Object o1, Object o2) { // Book obj=(Book) o1; // Book obj=(Book) o2; if(o1 instanceof Book && o2 instanceof Book) return((Book) o1).getBook_ID()-((Book) o2).getBook_ID(); return 0; }
ee622acc-fd7b-4f7f-9e95-bf2d93f8f1ba
2
public void setName(String name) { if (name == null || name.isEmpty()) { throw new IllegalArgumentException("Name shouldn't be NULL or empty."); } this.name = name; }
697669ca-dbe9-49ec-a8de-26c410c1c9da
8
private static boolean containsLegalAllGroup(Element p) { ComplexType t = p.getComplexType(); if (!(t instanceof ComplexTypeComplexContent)) return false; Particle particle = ((ComplexTypeComplexContent)t).getParticle(); if (!(particle instanceof ParticleAll)) return false; String ns = p...
14ab3579-567b-40ed-a68a-7bbe88dfd541
7
private DataType visitFactor(FactorContext ctx) { if (ctx.expression() != null) { return visitExpression(ctx.expression()); } else if (ctx.functionCall() != null) { return visitFunctionCall(ctx.functionCall()); } else if (ctx.qualifiedName() != null) { return ...
7226e059-3248-43df-a473-d70ed79d1d82
1
public static PictureQuestion getQuestionByQuestionID(int questionID) { try { String statement = new String("SELECT * FROM " + DBTable + " WHERE questionid = ?"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); stmt.setInt(1, questionID); ResultSet rs = stmt.executeQuery(); rs.ne...
f28785be-9f40-4213-afea-966b0b6e7f33
5
public void shareSessionWith(AbstractBusinessObject bo){ this.shareSessionWith.add(bo); bo.shareSessionWith.add(this); if(this.session.isSetForCommitting()){ for(AbstractBusinessObject businessObject : bo.shareSessionWith){ businessObject.session = this.session; if(businessObject.session.isSetForCommit...
da677582-ac7e-4544-ba15-b713e2c83a55
2
@Override protected void finalize() { if (resource.removeReference() && !fileName.isEmpty()) { loadedModels.remove(fileName); } }
80c4dc98-d3d0-4ed4-9ff5-28ed7cc8c156
5
double getKth(int[] a, int[] b, int k) { int m = a.length; int n = b.length; if (n == 0) return a[k - 1]; if (m == 0) return b[k - 1]; if (k == 1) return Math.min(a[0], b[0]); // divide k into two parts int p1 = Math.min(k / 2, m); int p2 = Math.min(k - p1, n); if (a[p1 - 1] < b[p2 - 1]) ...
4b683257-5012-46a3-b341-f342ea6e78a6
7
private static void createAndShowGUI() { final ProgramSettings settings = new ProgramSettings(); //Create and set up the window. JFrame frame = new JFrame("Scrapper Blaster"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(sett...
48ebfee0-adc4-4181-b69e-9b947d9d817d
3
private final boolean ends(String s) { int l = s.length(); int o = k-l+1; if (o < 0) return false; for (int i = 0; i < l; i++) if (b[o+i] != s.charAt(i)) return false; j = k-l; return true; }
6bfcb7fd-f2ae-4fa7-af6d-9ff8db4d3276
2
public AudioPlayer(String fileName) { m_errorState = true; m_errorMessage = "OK"; try { p = new Player(new FileInputStream(fileName)); } catch (FileNotFoundException ex) { m_errorState = false; m_errorMessage = ex.getMessage(); } catch (JavaLa...
0d4e3af2-0f47-42d4-bf0c-89ade648fec4
6
private Position getSubImagePosition(CHAR_TYPES types, char charToFind) { Position position = new Position(); switch (types) { case LETTER: position.y = Character.isUpperCase(charToFind) ? 0 : 11; charToFind = Character.toUpperCase(charToFind); ...
c07931f0-4c96-4c82-bbbc-f468d30918a5
7
private static double[][] genMatrix(int diceSides) { double[][] matrix = new double[BOARD_SIZE][BOARD_SIZE]; double[] roleProb = getRoleProb(diceSides); for (int i = 0;i< BOARD_SIZE;i++) { for (int j = 0;j< roleProb.length;j++) matrix[i][(i + j + 1) % BOARD_SIZE] = r...
73867a18-2bc9-4302-b142-c73b155cef0c
6
private void clearCollisions() { q = new QuadTree(mapDims,5); for (Mob m : dots) { q.insert((Collidable)m); } List<Mob> removals = new ArrayList<Mob>(); for (Mob m : dots) { if (removals.contains(m)) continue; List<Collidable> possibles = q.retrieve(new ArrayList<Collidable>(), (Collidable)...
5730bc42-767b-4a55-88f7-028b400cf702
0
public String getUlica() { return ulica; }
e1b1433e-1b78-4e2b-8798-2eb39bd1ee92
0
public Collection values() { accessTimes.clear(); touch(map.keySet()); return map.values(); }//values
6571eb21-514b-4367-8cd3-f16a98ab8743
3
private static void printAllDescriptions(ConceptChronicleBI con) throws IOException, ContradictionException { Collection<? extends DescriptionChronicleBI> allDesc = con .getDescriptions(); int i = 0; for (DescriptionChronicleBI descAllVersoins : allDesc) { DescriptionVersionBI desc = descAllVersoins.ge...
8967785a-afc4-4957-a36e-4156a903e728
7
private void jRadioViaXSLTActionPerformed( final java.awt.event.ActionEvent evt) { switch (etat) { case INIT_JSON_XML: throw new RuntimeException("Bouton ViaXSLT : " + "action interdite car " + "Etat INIT_XML_JSON"); case INIT_XML_JSON: throw new RuntimeException("Bouton ViaXSLT : " + "act...
e744087d-d52b-419c-9ad7-c45ce9d01e2b
9
public static void main(String[] args) throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while (true){ String s = in.readLine(); if(s==null)break; String arr[] = s.trim().split(" +"); int g[][] = new int[3][3]; for(int i=0;i<3;i++){g[i][0]=Integer.parseInt(a...
b56ae3d9-3e94-47bc-a4ce-b841c7fea645
6
private void packLayout(int padding) { if (rows.size() < 1) { return; } // Prepare to stash maxima Spring[] maxWidths = new Spring[rows.get(0).componentCount()]; Spring[] maxSpanWidths = new Spring[rows.get(1).componentCount() - 1]; for (int i = 0; i < maxWidths.length; ++i)...
ced5813c-3259-441e-968a-14ea63f0f234
6
@Override public List<T> multiGet(List<List<Object>> keys) { try { List<T> values = new ArrayList<T>(); for (List<Object> rowKey : keys) { Query operation = mapper.retrieve(rowKey); DBCursor results = coll.find(operation.getQuery(), operation.getProj...
eafc1316-5117-4143-b57c-c2236b708fdf
7
private static void importDataForPrelimRound() throws IOException { // the first round will be zero int roundIndex; while (true) { System.out.println("Import data for which prelim round?"); roundIndex = getIntegerFromUser() - 1; // Verify the round index if (roundIndex < 0) System.out.println(...
4a7fe3ea-af30-4e19-9669-ec2422a271b1
4
@Override public void manageInput(InputEvent e) { if (e.isKeyInput()) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE && e.getType() == InputEvent.KEY_PRESSED) { exitScreen(); model.setPaused(false); } } for (Item i : optionItems) { i.manageInput(e); } }
b707c6a5-dfcc-496a-ab3c-3a2be9382b4d
5
public void updateActivity(Activity a) { if (activities == null) { updateActivities(); } //System.out.println(a); //save changes to db MongoHelper.save(a, MongoHelper.ACTIVITY_COLLECTION); if (!user.getActivities().contains(a.getId())) { //user do...
090ce648-3432-4602-a8b7-f45f1e21297d
3
public String generateInsertStmt(TransactionSet transactionSet) { //code to convert transactionSet object to SQL insert statement string for that transactionSet //System.out.println("Generating Insert Statement for transactionSet"); String result = null; String start = transactionSet.getStart_date(); String e...
e37a90a4-021a-4e2a-a6fc-b63d771317e9
2
@Override public void addItem(final String fromDirectory, final String item) throws IOException { new Thread(new Runnable() { @Override public void run() { try (InputStream is = new FileInputStream(fromDirectory + File.separator + item); Output...
47443031-fc92-4bcb-a062-0f7cfa2e2681
9
@Override public void detectRelationships(Obituary obit) throws Exception { List<List<Term>> sentences = extractor.tagEntities(obit); for (List<Term> sentence : sentences) { sentence = EntityUtils.combineEntities(sentence); List<String> lines = new ArrayList<String>(); List<Term> terms = new ArrayList<Ter...
be76678a-dec4-4b4e-ac39-ae3f94ca9e7d
0
private void jButtonPrecActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPrecActionPerformed //Récupération de la méthode contrôleur 'precedent' ((CtrlVisiteurs)controleur).precedent(); }//GEN-LAST:event_jButtonPrecActionPerformed
5efa4518-866b-4ea6-b9c8-e648f8f0543e
3
public static void main(String[] args) { EventLog eventLog = new EventLog(); PickingStorage pickingStorage = new PickingStorage(); ExecutorService pool = Executors.newFixedThreadPool(20); Users users = new Users(); int sleepTime = 1000, i = 1; // Gets all users for (User u : users.getUsers()) { Double ...
da39b1c2-f7aa-45a1-adea-a8c4ef2e4258
3
public void open(){ if ((downloadDir==null)||(downloadDir.equals(""))) return; try { Runtime.getRuntime().exec(new String[]{"explorer.exe",downloadDir}); } catch (IOException e) { e.printStackTrace(); } }
f2bc8365-70ab-4874-9ff1-b2a5f38e27aa
4
public void putBeepers(int x, int y, int num) { Coordinate c = new Coordinate(x, y); if (num == Display.INFINITY) { synchronized (beepers) { beepers.put(c, new BeeperStack(x, y, num)); } return; } synchronized (beepers) { int oldBeepers = 0; BeeperStack b; if ((b = beepers.get(c)) != null...
d81a910e-b729-4392-ba36-3ba26e0286ef
7
@Override public int castingQuality(MOB mob, Physical target) { if(mob!=null) { final Room R=mob.location(); if(R!=null) { if(!R.getArea().getClimateObj().canSeeTheMoon(R,null)) return Ability.QUALITY_INDIFFERENT; if(R.fetchEffect(ID())!=null) return Ability.QUALITY_INDIFFERENT; for...
842bcd79-efb4-4d21-af92-ab7850770a3c
7
public Object readBeanConnection(Element node) throws Exception { Object result; Vector children; Element child; String name; int i; int source; int target; int ...
58ad142d-c898-4446-a70c-b339a4862e03
9
public void saveEmployee(Employee employee, Connection con) { HashMap<String, String> insertIntoTableEmployees = new HashMap<String, String>(); String tableName = "employees"; insertIntoTableEmployees.put("employee_id", employee.getId().toString()); insertIntoTableEmployees.put("first_n...
7d5852b5-1b45-408d-a8ff-a5dec67e8220
3
private static boolean isInsideInSameVerticalSpace(Positioned a, Positioned b) { return a.topBorder() == b.topBorder() && a.bottomBorder() == b.bottomBorder() && (pointInside(a, b.leftBorder(), (b.topBorder() + b.bottomBorder()) / 2, true) || pointIns...
b2b24bd3-6d42-4c40-a93f-7ed2f01ffd25
3
@Override public String execute() throws Exception { try { Map session = ActionContext.getContext().getSession(); Campaign camp = (Campaign) session.get("campa"); CampaignDevice campdev = new CampaignDevice(camp, platform); getMyDao().getDbsession().save(ca...