method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b82db6b0-1e4b-4acc-9e56-18272b1cd7fd
4
public static String getText() { String out = "Siegbedingung: \n"; if (Status.ifWin == -1) { out = out + "Alle Felder aufdecken\nVerbleibend: " + new Integer(FieldGame.unknown).toString() + "/" + new Integer(FieldGame.size_x * FieldGame.size_y).toString() + "\n\n"; } if (Status.ifWin == 0) { ...
19cbc62d-c1e5-4db4-b7c0-156f89adbfe9
4
public void crawlRobotFiles() { try { GutenbergCrawlerHelper.init(); } catch (IOException e) { e.printStackTrace(); } File robotFileDir = new File(GUTENBERG_ROBOT_FILE_DIR); File[] fileNames = robotFileDir.listFiles(); List<File> files = Collections.synchronizedList(new ArrayList<File>()); for (int...
ba39f513-6f67-4f4a-a85b-cec705a65d4f
2
public void testForFields_time_HS() { DateTimeFieldType[] fields = new DateTimeFieldType[] { DateTimeFieldType.hourOfDay(), DateTimeFieldType.secondOfMinute(), }; int[] values = new int[] {10, 30}; List types = new ArrayList(Arrays.asList(fields)); ...
34b2c90b-729f-4e98-abf5-48096075635c
8
private <T> Class<?> createProxyClass(Class<?> possibleMockedType, Class<?>... ancilliaryTypes) { Class<?> mockedType = possibleMockedType == Object.class ? ClassWithSuperclassToWorkAroundCglibBug.class : possibleMockedType; Enhancer enhancer = new Enhancer() { @SuppressWarnings("rawtypes") @Override ...
a3907cf4-a9c7-435b-9ba8-8dc96d43121c
3
@Deprecated public static String getClassName(CONSTANT_MethodHandle cnst, LinkedList<CONSTANTPoolElement> pool) { CONSTANTPoolElement attr = CONSTANT_POOL_DRIVER.getRawValue(cnst.getRefrence_index(), pool); if (cnst.getRefrence_kind() < 5) { CONSTANT_fieldRef fattr; }...
e7f6f745-8767-416f-867b-eb572dc16153
3
private void removeRows(ArrayList<Integer> rowsToBeCleared){ int cntr = 0; String rows =""; for(int row : rowsToBeCleared){ rows += row+", "; for(int i = row; i > 0; --i){ for(int j = 0; j < 10; ++j) { screen[i][j] = new Square(screen[i-1][j].isEmpty(), screen[i-1][j].getColor()); } } } ...
31e256a1-2b99-4485-8077-3e2f32f2e66b
8
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Endereco other = (Endereco) obj; if (this.id != other.id) { return false; } i...
3af10106-649e-4440-b45a-9ad989a06d63
6
private void updateGate(String CLK, String CLR, String SHLD, String CLKINH, String SER, String A, String B, String C, String D, String E, String F, String G, String H, String QH) throws InvalidPinException { if (this.isLow(CLR)) { this.a = Pin.PinState.LOW; this.b = Pin.PinState.LOW; this.c = Pin.PinState.LO...
934f17be-b898-4032-b67d-7ab26408140e
6
public void mainMenu() throws InterruptedException { System.out.println(); // Tell the user options and get input println("Choose an option:"); println("0: Conversions"); println("1: Analysis"); println("2: Element info"); println("10: Quit"); // Now check the option he entered switc...
e87e6071-e840-4856-8114-d6d302dd5cdf
0
@AfterClass public static void tearDownClass() { }
1da5479a-937e-4e93-a47a-6963dd694949
3
private static void printIt(ParseResult<Character, List<Token>> r) { if(!r.isSuccess()) { print("couldn't parse file"); return; } print("rest: " + r.getRestTokens().size()); print("number of tokens: " + r.getValue().size()); int j = 0; for(Token t : r.getValue()) { print("token type: " + t.type + "...
5211cdf5-a466-4748-be9a-a375944e64e6
3
public void actionPerformed(GuiButton var1) { if(var1.enabled) { if(var1.id == this.scrollUpButtonID) { this.amountScrolled -= (float)(this.slotHeight * 2 / 3); this.initialClickY = -2.0F; this.bindAmountScrolled(); } else if(var1.id == this.scrollDownButtonID...
cd1899fb-ec3e-46dc-9dea-dc00129d0ae5
7
private static Alignment traceback(Sequence s1, Sequence s2, Matrix m, byte[][] pointers, Cell cell) { char[] array1 = s1.toArray(); char[] array2 = s2.toArray(); float[][] scores = m.getScores(); Alignment alignment = new Alignment(); alignment.setScore(cell.getScor...
a5204e58-0683-463a-927c-572196749c8f
2
private static String retirerCaracteresSpeciaux(String chaine) { StringBuilder str = new StringBuilder(); for (char c : chaine.toCharArray()) { Character tmpC = mappagesCaracteres.get(c); if (tmpC != null) str.append(tmpC); else str.app...
4fa45a23-5290-4b73-90c0-7e4a18a327f7
0
public JSONWriter(Writer w) { this.comma = false; this.mode = 'i'; this.stack = new JSONObject[maxdepth]; this.top = 0; this.writer = w; }
650c6d53-e9d1-44d4-86ca-99ca14c02d40
2
public void popularCmbAtividade() { ArrayList<String> Atividade = new ArrayList<>(); AtividadeBO atividadeBO = new AtividadeBO(); String nomeUsuario = usuarioLogado.getNome(); try { Atividade = atividadeBO.ComboBoxAtividades(nomeUsuario); } catch (SQLException ex) {...
fe236dc6-331d-4dac-b1c0-601b64a10f3b
6
private List<Student> getPageOfStudents() { final List<Student> pageStudents = new Vector<Student>(); if (students.size() == 0 || currPage < 0 || currPage >= getMaxPage()) { return pageStudents; } int size = 0; if (students.size() - viewSize * currPage < viewSize) { size = students.size() - viewSize * ...
effb467b-c837-454e-b23c-fc2e5b416e42
0
public Vector getAgents () { return agents; }
ee3a114c-0e15-4d7c-be13-b2a59ac95f4a
4
public Position getVisibleMapOffsetPosition(Player player) { int offsetXTile = player.x - (int) Math.ceil(Realm.MAP_WIDTH / 2); int offsetYTile = player.y - (int) Math.ceil(Realm.MAP_HEIGHT / 2); if (offsetXTile < 0) offsetXTile = 0; if (offsetYTile < 0) offsetYTile = 0; if (offsetXTile > Realm.WORLD...
ffe9c666-82c8-41e0-971b-dc6198f5ade9
2
public static <T> void removeTail(Vector<T> last, T element) { int l = last.indexOf(element); if (l != -1) for (int i = last.size() - 1; i > l; i--) { last.remove(i); } }
df289a31-35c8-4e45-b4b6-4b07098e2b8a
9
public ProfesorBean load(ProfesorBean oProfesor) throws NumberFormatException { try { if ((request.getParameter("id_usuario") != null)) { oProfesor.setId_usuario(Integer.parseInt(request.getParameter("id_usuario"))); } if ((request.getParameter("dni") != null)...
77899d23-9bc1-4d09-915d-0110cf790b7f
8
@Override public boolean show() { if (!tab.open()) return false; WidgetChild window = Widgets.get(BOOK_WIDGET, CLICK_WINDOW); WidgetChild wc = getChild(); WidgetChild scrollbar = Widgets.get(BOOK_WIDGET, SCROLLBAR); if (wc == null || window == null || scrollbar == null || !wc.visible() || !window.visible(...
25a25598-fbdf-47e6-99d7-2f8d38cfe1dc
9
public void pixelLoop(int x, int y) { // os primeiros pixels não processa if( x==0 || y==0 || x==_img.getWidth() || y==_img.getHeight() ) return; if( ! Arrays.equals( corPreto, _pix ) ) return; getMatriz( x, y ); // aqui pega a matriz de comparacao for( int i=0; i<Caracteristicas.osTemplates.lengt...
1474d386-996e-40f4-9abd-9d1a37a4863b
3
private void scruffit(Document document) throws XPathExpressionException { Element root = document.getDocumentElement(); XPathExpression xPathExpression = xml.compileXPath("descendant::*[parent::g[@class = 'node']]"); NodeList evaluate = (NodeList)xPathExpression.evaluate(root, XPathConstants.N...
ddb8a90c-4037-439e-ab26-150df06e500c
2
<T> T execute(String sql, int fetchSize, boolean returnKeys, PreparedStatementCallback<T> action, Object... args) { // 创建Connection Connection con = JdbcUtils.getConnection(dataSource); PreparedStatement ps = null; try { // 创建PreparedStatement ps = JdbcUtils.createPreparedStatement(con, sql, returnKeys, a...
594643bc-ac1f-4f48-8068-fad26a32cec6
0
public static String getPublicKey(Map<String, Object> keyMap) throws Exception { Key key = (Key) keyMap.get(PUBLIC_KEY); return SecurityCoder.base64Encoder(key.getEncoded()); }
b975007e-c08f-4ec6-908d-65e340725068
9
public boolean movimientoValido(int[] dados, int posicionActual, int posicionFinal) { // System.out.println(posicionActual); // System.out.println(posicionFinal); int res = dados[0] + posicionActual; if (res > 68 && posicionFinal <= 68) { res = res - 68; } if (p...
4c9374cc-c73e-4417-9a3d-0acd3c9a9689
2
public void cargarVentHas() { try { clearVentHas(); String sql = "SELECT t1.productos_idproductos, t2.nombre_producto, t2.proveedor, t1.cantidad_venta, t1.cantidad_venta * t2.precio " + "FROM productos_has_ventas AS t1, productos AS t2 " + "WHERE t...
2287c946-b633-4526-8bfc-dfbdd78cb2c5
7
private void handleHttpRequest(ChannelHandlerContext ctx, FullHttpRequest req) throws Exception { // Handle a bad request. if (!req.getDecoderResult().isSuccess()) { sendHttpResponse(ctx, req, new DefaultFullHttpResponse(HTTP_1_1, BAD_REQUEST)); return; } // Allo...
b57915dc-2a23-4cf5-8023-f0c2a6c4633f
1
private void openBooksDatabase() throws SQLException { try { Context initialContext = new InitialContext(); Context envContext = (Context) initialContext.lookup("java:comp/env"); DataSource dataSource = (DataSource) envContext.lookup("library/books"); booksConnection = dataSource.getConnection()...
111bae3b-d8e0-41ad-abeb-c534e63e091a
9
private void parseXML() { Stack<XMLElement> elemStack = new Stack<XMLElement>(); pos = 0; root = new XMLElement("xml"); elemStack.push(root); String next = getNextString(); while (!next.isEmpty()) { if (next.contains("?xml")) { next = getNextString(); continue; } if (next.charAt(0) == '<...
6301d61c-64f2-43c3-989b-00a947d6faf3
5
private void replace2(String statement) throws CompileError, NotFoundException, BadBytecode, CannotCompileException { thisClass.getClassFile(); // to call checkModify(). ConstPool constPool = getConstPool(); int pos = currentPos; CtClass retType; int ...
2661e92a-c712-475f-b6de-373a94bb5a65
9
public void updateMatrix(File file) { System.out.println ("actualizando matriz"); FileReader fr = null; //BufferedImage TempBI = new BufferedImage(Columns * Dime_200819312.DimeSize, Rows * Dime_200819312.DimeSize, BufferedImage.TYPE_INT_RGB); BufferedImage TempBI = new BufferedImage(Colu...
003ec755-ccea-414d-a5e7-581e2633df12
7
protected String extraToString() { Map<? extends Object, ? extends Object> attr = getAttributes(); if (attr == null || attr.size() == 0) { return ""; } StringBuilder sb = new StringBuilder(); for (Map.Entry<?, ?> e : attr.entrySet()) { sb.append(TAB_SIZE)....
b78a526a-dabf-4583-a507-e523fa17f7ed
1
private final static void checkEquality(byte[] b1, byte[] b2) { if(!compare(b1, b2)) { throw new RuntimeException("Format error"); } }
8f233af6-d136-4249-bac6-257ced4fcdf7
9
public String validateMatrix(){ ArrayList<String> messages = new ArrayList<>(); int [] inputs = new int [transitions.length]; int [] outputs = new int [transitions.length]; for (int i = 0; i < transitions.length; i++) { for (int j = 0; j < transitions[i].length; j++)...
186424f8-4a01-4ae5-bae3-321539a9c24e
9
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = null; if (sender instanceof Player) { player = (Player) sender; } Player[] players = Bukkit.getOnlinePlayers(); String PlayerName; String ChanName = args[0].toLowerCase(); i...
bc64274b-4b08-4ff4-89b9-ffdba56c6fcd
2
@Override public Short validate(String fieldName, String value) throws ValidationException { if (value == null) { return null; } try { return Short.parseShort(value); } catch (NumberFormatException e) { throw new ValidationException(fieldName, value, "not a valid short", e); } ...
0f78e318-f64d-475d-a35c-32313b79e207
1
public State stateCreate(Point point) { if (currentStep != CREATE_SINGLE_TRAPSTATE) { outOfOrder(); return null; } myTrapState = automaton.createState(point); myTrapState.setLabel("Trap State"); frame.repaint(); currentStep=TRANSITIONS_TO_TRAPSTATE; nextStep(); return myTrapState; }
5551b4ee-ddb1-4489-af36-2826beadc934
7
public void syncScrollBars() { if (sourceImage == null) { redraw(); return; } AffineTransform af = transform; double sx = af.getScaleX(), sy = af.getScaleY(); double tx = af.getTranslateX(), ty = af.getTranslateY(); if (tx > 0) tx = 0; if (ty > 0) ty = 0; ScrollBar horizontal = getHorizont...
fc5e6a29-be9b-410b-aa7b-bc037618df50
7
public void keyPressed(int k){ if (k == KeyEvent.VK_UP){ Effect.MENU_MOVE.play(); currentChoice--; if (currentChoice == -1) {currentChoice = options.length - 1;} } if (k == KeyEvent.VK_DOWN){ Effect.MENU_MOVE.play(); currentChoice++; if (currentChoice == options.length) {currentChoice = 0;} } ...
22f05b40-1113-4754-939a-49cecaeea2e6
4
public final void applyColourMask(int maskID) { for (int h = myHeight - 1; h > 0; h--) { int x = h * myWidth; for (int w = myWidth - 1; w > 0; w--) { if (myPixels[w + x] == 0 && myPixels[w + x - 1 - myWidth] != 0) { myPixels[w + x] = maskID; } } } }
40d290b3-6761-4fc8-bbff-842590a16094
4
public static void saveCompters(){ try { File f = new File("tmp/listCompte.ser"); if(!(f.exists())){ if(!f.getParentFile().exists()) f.getParentFile().mkdirs(); f.createNewFile(); } FileOutputStream fileOut = new FileOutputStream(f); ObjectOutputStream out = new ObjectOutputStream(fileOu...
3428f0eb-f143-4f68-bba2-7f93ec4a52e2
1
@Override public JSONObject main(Map<String, String> params, Session session) throws Exception { JSONObject rtn = new JSONObject(); long month = Long.parseLong(params.get("timestamp")); month = DateUtil.getStartOfMonth(month); rtn.put("rtnCode", this.getRtnCode(200)); JSONArray apptJa = new JSONArra...
575ee130-4d6f-4049-9f13-a43cede9f5ab
8
public void solve() { // Pick a root this.treeRoot = this.edges.keySet().iterator().next(); this.subTreeSizes = new int[this.numVertices]; Deque<Integer> traversal = new LinkedList<Integer>(); // The post stack acts both as a way to figure out // the parent for our current node as well as a marker for...
1073c6a7-849e-4857-8353-3e578974527c
9
private void setSecondAspectForBlock(String firstAspect) { if (firstAspect!= null){ setSecondAspectGroupEnabled(false); if (firstAspect.equals(AData.L)){ f2.setEnabled(true); i2.setEnabled(true); } else if(firstAspect.equals(AData.P)) { ...
cc0dce93-1c7f-4a3d-ac2c-9ae501aafa11
0
public static void DisPlayPicByFrame(JFrame _frame, BufferedImage _img, String _title, int _x, int _y) { //JFrame frame = new JFrame(); _frame.setTitle(_title); _frame.setLocation(_x, _y); JLabel label = new JLabel(new ImageIcon(_img)); _frame.getContentPane().removeAll(); ...
f8d4fc5f-a762-4487-a3be-683752ed8c53
8
private void finaliseRelations() { if (tempRelations == null) return; PageLayout layout = page.getLayout(); Relations relations = layout.getRelations(); if (relations == null) return; for (int i=0; i<tempRelations.size(); i++) { List<String> rel = tempRelations.get(i); if (rel != null && rel...
d144ce9f-c83e-4a28-a5ff-629b6644ce2d
7
protected short parse_config_param(final String param_title, final String param_content) { short ret = MsgDumperCmnDef.MSG_DUMPER_SUCCESS; boolean found = false; for (int index = 0 ; index < title_len ; index++) { if (param_title.indexOf(title[index]) == 0) { switch(index) { case 0: serv...
0f1f9e1b-a2cd-4fd5-99ec-ddd08fc26a41
5
public set Difference(set FirstSet, set SecondSet) { //Make a new set set ThirdSet = new set(); //Cycle through the FIRST array and compare to the second //to see what's in the first and not the second //add those elements to the third array for (int i = 0; i < FirstSet....
0e4c63ce-2128-47e6-894f-ef5a933ced4f
6
@Override public void handshakeResponseReceived(HandshakeResponseEvent e) { if(e.getStatus() == HandshakeStatus.FAILED) { enableUserInput(true); switch(e.getCause()) { case HandshakeResponseEvent.CAUSE_USERNAME_PASSWORD_NOMATCH: setLoginActionInfoText(LoginStatus.ERROR_USERNAME_PASSWORD); break; ...
0a5d81ed-acf5-445b-ab1c-dcaef4a32bd4
5
@EventHandler public void onBreak(BlockBreakEvent e){ Block b = e.getBlock(); Player p = e.getPlayer(); if(Main.Main.rb.containsKey(b.getLocation())){ String Team = Main.Main.rb.get(b.getLocation()); if(Main.Main.playerTeam.containsKey(p)){ if(Main.Main.playerTeam.get(p) == Team){ e.setCancelled(t...
82a6ec24-3026-42fe-8266-4bf2608ab7ea
4
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ZFrame zFrame = (ZFrame) o; if (!Arrays.equals(data, zFrame.data)) return false; return true; }
fcf5d2bf-cf9b-4991-86c4-85c2faeb9020
1
private void updateFormValues(WebPage entry) throws ParseException { formValues.clear(); Element form = Jsoup.parse( entry.getContent() ).getElementsByTag("form").first(); Elements inputs = form.getElementsByAttributeValue("type", "hidden"); for (Element input : inputs) formV...
5c8888c9-3cff-4bac-a736-f0d247a6bc29
7
private static void inputLoop() { String friendlyMessage = "Press 'q' to quit or use 'w','a','s','d' to navigate. 'e' to interact"; drawRoom(currentRoom); System.out.println(friendlyMessage); try { int input = 's'; while (input != 'q'){ input = System.in.read(); switch (input){ case 'w':...
0c17ceeb-6fbe-41ca-9aab-652db2839941
2
public static double[][] convertIntToDoubleMatrix(int[][] m) { int mRows = m.length; int mColumns = m[0].length; double[][] res = new double[mRows][mColumns]; for (int i = 0; i < mRows; i++) { for (int j = 0; j < mColumns; j++) { res[i][j] = m[i][j]; } } return res; }
e4ccf537-c09a-4d32-b319-6f7fc3911f23
8
@Override public void giveIMC2MudList(MOB mob) { if((mob==null)||(!imc2online())) return; if(mob.isMonster()) return; final Hashtable l=imc2.query_muds(); final Vector<REMOTEINFO> V=new Vector<REMOTEINFO>(); for(final Enumeration<REMOTEINFO> e=l.elements();e.hasMoreElements();) { final REMOTEINFO...
6121a5e4-a2d7-4fd2-932c-f6a99ebad5b7
1
@Override public void onDisable() { try { FruitManager.getInstance().saveFruits(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
dcc032f5-064c-4972-bcb5-60acec900d88
5
@EventHandler public void onPlayerInteract(PlayerInteractEvent e) { { Player Player = e.getPlayer(); if (!(e.getAction() == Action.RIGHT_CLICK_BLOCK)) return; { ItemStack IE = e.getItem(); ItemStack IEe = new ItemStack(Material.FEATHER); if(Player...
85698dc6-1a3d-43b8-ac03-61ebefdd64c8
5
@Override public void updateBoardView(Colors[][] board) { for (int r = 0; r < ROW; r++) { for (int c = 0; c < COL; c ++) { switch(board[r][c]) { case BLUE: boardBtns[r][c].setBackground(Color.BLUE); break; case RED: boardBtns[r][c].setBackground(Color.RED); break; case EMPTY: boa...
32ae94bc-1b59-4947-bbb0-1b698eb9b108
7
public ToetsPanel() { setLayout(new BorderLayout(0, 0)); list = new JList<Vak>(vakLijst); list.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent evt) { JList<Vak> list = (JList<Vak>) evt.getSource(); if (evt.getClickCount() == 1) { vulToetslijst(); } } }); add(l...
9e05b772-e3cf-449d-9952-aa8e6cea064d
1
public void testFactory_fromCalendarFields_null() throws Exception { try { LocalDateTime.fromCalendarFields((Calendar) null); fail(); } catch (IllegalArgumentException ex) {} }
c4a2a489-693b-47fe-afd6-f98e4dece61f
5
public static void save()//Method that saves to a file with the path name given { String output ="savedata/"+JokemonDriver.getVersion()+".inventory"; try { PrintWriter fout=new PrintWriter(new FileWriter(output)); if(JokemonDriver.getVersion().equals("Peaches")) fout.println("PDAE"+JokemonDriver.idSt...
2745b08b-9c3c-47a9-b176-d20cc8fb96bc
1
public final void actualiser() { try { chargerListeVisiteur(); chargerListeLabo(); } catch (DaoException ex) { JOptionPane.showMessageDialog(getVue(), "CtrlVisiteur - actualiser - " + ex.getMessage(), "Saisie des présences", JOptionPane.ERROR_MESSAGE); } }
c2b481f6-1919-4df9-a9b8-4224fa0d5a73
6
@Override public void run(){ while(true){ try{ Logger.log("Please enter\"5\" to view a map of registered DataNodes" + "\n Please enter \"6\" to view running jobs"); choice = br.readLine(); if(choice=="" || choice==null){ throw new Exception("Blank input not allowed."); } ...
85bd8d51-1996-4d25-bdf1-e323c0ce8a28
8
@Override public Object getTeleportPacket(Location loc) { Class<?> PacketPlayOutEntityTeleport = Util.getCraftClass("PacketPlayOutEntityTeleport"); Object packet = null; try { packet = PacketPlayOutEntityTeleport.getConstructor(new Class<?>[] { int.class, int.class, int.class, int.class, byte.class, byte.cla...
ab5b9d1f-22a7-4720-bdcd-db0f45c265e0
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...
9b43200d-da11-4e7e-bf40-08ca6259b64e
1
public void write(int[] b) { for (int i = 0; i < b.length; i++) { writeByte(b[i]); } }
42c7d507-fc6c-4688-9e68-9539695fa0c9
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; BoardCell other = (BoardCell) obj; if (adjacencies == null) { if (other.adjacencies != null) return false; } else if (!adjacencies.equal...
4a08c28a-aeed-4fe0-897c-518ef99a70c3
3
public Object[] getAllEdges(Object[] cells) { List<Object> edges = new ArrayList<Object>(); if (cells != null) { for (int i = 0; i < cells.length; i++) { int edgeCount = model.getEdgeCount(cells[i]); for (int j = 0; j < edgeCount; j++) { edges.add(model.getEdgeAt(cells[i], j)); } ...
ed4ef89e-4255-4eaf-93cd-ab1fa1d7a1d6
6
public void moveDir(char c1,int tank){ Tank temp; if(tank==1)temp=t; else temp=t2; temp.move(c1); if(bounding_box_collision(t.getTopX(),t.getTopY(),t.getWidth(),t.getHeight(), t2.getTopX(),t2.getTopY(),t2.getWidth(),t2.getHeight())){ if(c1=='u')temp.setY(temp.getY()+5); if(c1=='d')temp.setY...
733e6312-ba69-49b4-b6aa-85605f6a0268
3
private String convertRequestToString() throws IOException { InputStreamReader inputStreamReader = new InputStreamReader(inputStream); BufferedReader bufferedReader = new BufferedReader(inputStreamReader); StringBuilder requestBuilder = new StringBuilder(); String line; try { do { lin...
6221a993-e3bb-414f-a896-5c47a81aee1f
3
private void checkLoaderCol(){ if(imgCol < 0){ throw new IllegalArgumentException(String.format("Illegal column specified, must be a non-negative number (yours was %d)", imgCol)); } if(null != ldr && !(ldr.numColumns() > imgCol)){ throw new IllegalArgumentException(String.format("Illegal column specifi...
1213255d-3ad6-4703-8d4e-5e05a192be5a
7
@Override protected String getFirstRow() throws SQLException { if ( this.rs == null ) { throw new SQLException("Rs is not initialized."); } ResultSetMetaData md = rs.getMetaData() ; int totalCol = md.getColumnCount(); String[] cols = new String[totalCol]; int[] types = new int[totalCol]; for ( i...
a83c69fb-4838-42f0-9d97-e4c9fcd22ab9
9
public void saveText(int textResultType){ JFileChooser saveText = new JFileChooser(lastOpenDir); int saveStatus = saveText.showSaveDialog(ContentMain.instance); if(saveStatus==JFileChooser.APPROVE_OPTION){ File selectedFile = saveText.getSelectedFile(); if(selectedFile.exists()){ if(confirmOverride()){...
02302bb6-bd05-4cb0-b805-34a90785369f
6
public boolean getBoolean(String key) throws JSONException { Object object = this.get(key); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String) object) .equalsIgnoreCase("false"))) { return false; } else if (object.equals...
0e48d392-f11b-4b16-a6a5-a188258d055f
7
private boolean isUserValid(AuthenticationDescriptor model, char[] password) { boolean valid = false; try { char[] hpwd = hashPassword(password); if (model != null) { char[] passwd = model.getPassword().toCharArray(); ...
9b7e420a-206c-4bef-b32e-cb965ca7d988
9
@Override public void actionPerformed(ActionEvent e) { Vastaustyyppi tyyppi = null; String kysymysTekstina = kysymys.getText(); int tyyppiIndeksi = vastaustyyppi.getSelectedIndex(); if (tyyppiIndeksi == 0) { tyyppi = Vastaustyyppi.AVOIN; } else if (tyyppiIndeksi...
4b06253f-00d9-48b6-8851-4756b6b29a72
4
public int compareTo(TemporalyArray o) { if (this.item == null || o == null) return 0; else if (this.getIndex() > o.getIndex()) return 1; else if (this.getIndex() < o.getIndex()) return -1; else return 0; }
7cea7fb5-34c4-4977-b21a-69f0acc6fa3b
8
protected T removeImpl(int sublistIndex, int sublistOffset) { T result; if (sublistIndex < headSublistIndex + (calculateSublistsUsed() >>> 1)) { CircularListInternal<T> prev = sublists.get(sublistIndex); result = prev.remove(sublistOffset); size -= 1; for (int j = sublistIndex - 1; j >= ...
0af6084e-e407-4c3a-b056-5861b38ebeb1
7
public void convert(String nameI, String nameO) { int width = 0; int height = 0; float[][] data = new float[0][0]; try { BufferedImage inputImage = ImageIO.read(new File(nameI)); width = inputImage.getWidth(); height = inputImage.getHeight(); ...
c13c0330-6bd6-4423-95cc-5485cd945042
6
@Override public void takeInfo(InfoPacket info) throws Exception { super.takeSuperInfo(info); Iterator<Pair<?>> it = info.namedValues.iterator(); Pair<?> pair = null; Label label = null; while(it.hasNext()){ pair = it.next(); label = pair.getLabel(); switch(label){ case temp: temperature = (D...
f332352d-b5cf-490b-ade2-15db020455f7
9
public void save() { choice = "@Choice:"; if(!textField.getText().isEmpty()) choice += "true:" + textField.getText() + ";"; else choice += "false:"; if(!txtYes.getText().isEmpty()) choice += txtYes.getText() + ";"; if(!txtNo.getText().isEmpty()) choice += txtNo.getText() + ";"; if(!textField_3.g...
2b6ccb17-17e2-4599-9d17-a13b05434c91
0
public synchronized WebPage peekUnsearchQueue() { final WebPage result = (WebPage)getUnsearchQueue().poll(); return result; }
f5767b8e-5cad-42c4-9499-16b1714da012
5
void checkBounds() { if (buzzThis != null) { Vector3d t = new Vector3d(buzzThis.p.x, buzzThis.p.y + TURN_RADIUS, 0); if (p.x > buzzThis.p.x + RANGE || p.x < buzzThis.p.x - RANGE) { moveManager.setTargetPoint(t); } if (p.y > buzz...
38e895ea-a7cc-474a-bff3-14b7537c4de1
0
@RequestMapping(value = "addEmp.json", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) private void addEmployee(@RequestBody Employee employee) { employeeDao.add(employee); }
e0bff822-1d3f-4c7a-8f27-6983b7928233
2
public void addAstore(int n) { if (n < 4) addOpcode(75 + n); // astore_<n> else if (n < 0x100) { addOpcode(ASTORE); // astore add(n); } else { addOpcode(WIDE); addOpcode(ASTORE); addIndex(n); } ...
cb99dd9c-a19c-4d32-96a6-628443d1967b
7
public static double alphaMSquared(final int m) { switch(m) { case 1/*2^0*/: case 2/*2^1*/: case 4/*2^2*/: case 8/*2^3*/: throw new IllegalArgumentException("'m' cannot be less than 16 (" + m + " < 16)."); case 16/*2^4*/: ...
18a913d8-8243-46b1-9338-d8aad513eaa6
9
protected boolean checkForCollisionAi(int[][] tempBlock, int[][] gameTable, int tempX, int tempY) { clearMovingBlocks(tempBlock, 1); try { for (int i = 0; i < tempBlock.length; ++i) { for (int j = 0; j < tempBlock[i].length; ++j) { //Testing if the block i...
3e15b419-74a8-405b-a4b5-84bd3a9120f0
1
public String getString(String key) throws JSONException { Object object = this.get(key); if (object instanceof String) { return (String)object; } throw new JSONException("JSONObject[" + quote(key) + "] not a string."); }
2860f854-624a-4061-b34d-8244e0f1a1e6
8
private void fixDoubleRed(Node child) { Node parent = child.parent; Node grandParent = parent.parent; if (grandParent == null) { parent.color = BLACK; return; } Node n1, n2, n3, t1, t2, t3, t4; if (parent == grandParent.left) { n3 = gra...
b9edb961-3bac-498f-a5bd-f6c2faa558f0
2
public static void main(String[] args) { if (args.length > 0) { try { /* Form our AST */ Lexer lexer = new Lexer (new PushbackReader( new FileReader(args[0]), 1024)); Parser parser = new Parser(lexer); Start ast = parser.parse()...
bc8d42bf-132d-46c9-904e-43f90dbd68c1
0
public void stats(HashMap<Color, Counter> stats) { this.stats = stats; }
42e200a9-6546-4bf8-aeb8-eba1e13b6034
2
public HandShakeStart receiveHandShakeStart () throws IOException { // HandShake length inputBuffer.clear().limit(1); while (inputBuffer.remaining() > 0) { channel.read(inputBuffer); } inputBuffer.flip(); int length = 29 + (inputBuffer.get() & 0xFF); ...
b1cb0544-35c7-455b-ab73-0652fbdafb0f
2
private Criteria[] prepareTourUpdate(Criteria criteria, AbstractDao dao) throws DaoException { Criteria[] crit = new Criteria[]{new Criteria(), new Criteria()}; crit[0].addParam(DAO_ID_TOUR, criteria.getParam(DAO_ID_TOUR)); crit[0].addParam(DAO_TOUR_SELECT_FOR_UPDATE, true); List<Tour> t...
e9b619f7-4156-4b8b-b781-43ed7c441a90
7
public String[] getInput() { Scanner inFile = new Scanner(System.in); System.out.println("\n\t________________________________________________________________________"); System.out.println("\n\t You must enter names for two players before starting a two player game."); ...
8ec50991-485f-4e60-86ac-f43cea0399b3
3
public resultGUI(final questionNode current) { setTitle("20 Questions"); addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { Main.exitCheck(getContentPane()); } }); setMinimumSize(new Dimension(223, 219)); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOS...
889d7798-df2f-4677-8083-02d759b77828
6
public void run_step() throws Exception{ switch(current_step){ case 0: if (pc >> 2 < raw_instructions.size()){ // Fetch stage /* * load instruction from instruction memory increment the PC */ fetch_stage(); gui.selectInstruction(pc >> 2); gui.set_fetch_red(); System....
f647716e-fa44-4801-b15f-ecdc2c808981
8
private int parse(char[] data, int i, int z) { System.out.println(); System.out.println(" Sub: "); for (; i < z; i++) { switch (data[i]) { case '{': i = parse(data, i + 1, z); System.out.println(); break; case '}': return i; case '\\': i++; int j; for (j = i + 1; j < z; j++...
36b52d77-71f0-4ffe-b10a-1d83a6671f37
2
public static void encodePacket(Packet packet, EncodeCallback callback) { if (packet.data instanceof byte[]) { @SuppressWarnings("unchecked") Packet<byte[]> _packet = packet; @SuppressWarnings("unchecked") EncodeCallback<byte[]> _callback = callback; e...