method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
89d0a2ce-d6a0-4eb2-ae1c-84005bec21f6
1
public static void saveWindowOpt() { synchronized (window_props) { try { window_props.store(new FileOutputStream("windows.conf"), "Window config options"); } catch (IOException e) { System.out.println(e); } } }
fa9b43b4-88db-426d-afb1-b7a78d90d892
9
protected void search(String fileName){ File file = new java.io.File(fileName + ".html.txt"); File fileHistory = new java.io.File(fileName + ".history.txt"); FileWriter fw = null; FileWriter fwHistory = null; try { fw = new FileWriter(file); fwHistory = new FileWriter(fileHistory); fw.write("Start: "...
12803ae4-763e-4d1b-946e-0fd0618804ee
4
public static void changeLendability(BookCopy bc, boolean lendable) { try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try{ conn.setAutoComm...
2a5f6bc9-c15a-425d-bf41-603fe5386bcb
1
public boolean canFeed(CommandSender sender) { if ( sender instanceof Player ) { return this.hasPermission((Player)sender, "SheepFeed.feed"); } return false; // can not feed from console }
155d19f2-f433-4e94-8758-293e981aae83
3
@Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub if(e.getSource() == comButton) { String name = comTextField.getText(); InfoDownload infodownload = new InfoDownload(); if(infodownload.init(name)) { infodownload.getinfo(); cc.add(new User(name)); loadCha...
6b04ee63-aeb8-4fe6-8e52-01811611718a
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...
9df919c4-b702-47e6-8df3-b7cbb319e447
1
public void criarAtividade(Atividade atividade) throws SQLException, atividadeExistente { AtividadeDAO atividadeDAO = new AtividadeDAO(); Atividade atividadeExistente = null; atividadeExistente = atividadeDAO.SelectATividadePorNome(atividade.getNome()); if (atividadeExistente == null)...
90a05c18-717c-46b8-b738-a249270c8564
4
@Override public void onBlockBreak(BlockBreakEvent event) { Block block = event.getBlock(); Player player = event.getPlayer(); if ((block.getTypeId() == 63) || (block.getTypeId() == 68)) { Sign thisSign = (Sign) block.getState(); if (thisSign.getLine(0).equals("[WebAuction]")) { if (!plugin.permission....
f8246e84-8ee8-46e9-a0a0-31449748e3ac
9
public boolean isConnected() { if (this.size() < 2) { return true; } final Iterator<T> iterator = this.iterator(); final T source = iterator.next(); Deque<T> queue = new LinkedList<>(); Set<T> visited = new HashSet<T>(); queu...
a21b9535-e264-4744-8244-b085bea47ed9
9
public TagExtracter(List<Line> tagLines) { StringBuilder sb = new StringBuilder(); TagClosureCreator.TagClosure itemsHolder = new TagClosureCreator().getHolder(); TagClosureCreator.TagClosure deleteHolder = new TagClosureCreator().getHolder(); for (Line line : tagLines) { sb...
6ea14cd0-994b-4797-a841-ce9d1ab12527
4
static long getOffsetOfChunk(int []vsize, int[] csize, int []start) { int [] volume = new int [vsize.length]; int []dsize = new int [vsize.length +1]; dsize[vsize.length]=1; volume[0]=1; for(int i = 1; i < volume.length; i++) { volume[i] = volume[i-1]*vsize[i-1]; } for(int i = vsize.length -1 ; ...
08378cdb-6d24-487e-85b4-7c028e858426
4
public void chooseDeleteMethod(Scanner a_scan) { boolean wasDeleted = false; System.out .println("Please Select Deletion Method of Choice(1 or 2): " + "\n1)Delete by Name,\n2)Delete by techID)"); switch (getMenuChoiceNameOrId(a_scan)) { case 1: { String name; name = inputStudentName(a_scan); ...
263def63-8792-4a9f-bfb1-28b33fac162f
4
@RequestMapping(Routes.exerciciosbasicosRoda) public String runExercise(HttpServletRequest request, Model model){ resolution = request.getParameter("resolution"); exercise.buildGrading(resolution); if (exercise.hasCompileErrors != true) { //exercicio.salvarBancoDeDados(codigoUsu...
68feb8c8-b8cb-4f29-a94e-e3d48f68611a
4
private UsersReader() throws IOException { try { FileInputStream fin = new FileInputStream(MAP_DIR); ObjectInputStream oos = new ObjectInputStream(fin); userMap = (HashMap<Long, Integer>) oos.readObject(); oos.close(); } catch (Exception e) { e.printStackTrace(); } tr = new TreeMap<Integer, User...
4bd01182-1fc4-45aa-879a-ad807f141e3c
7
public boolean tryRotate() { boolean valid = true; incrementTYPE(true); int[][] key = screen[row][col].key(); for (int i=0; i<3; i++) { int r = row+key[i][0]; int c = col+key[i][1]; if (r < 0 || r >= NUM_ROWS || c < 0 || c >= NUM_COLS || dead[r][c] == true) valid = false; } incrementTYPE...
0c3c3373-8833-40a3-ac7a-2141b1750489
8
private int countNeighbours(int col,int row){ int total = 0; total = getCell(col-1, row-1) ? total + 1 : total; total = getCell( col , row-1) ? total + 1 : total; total = getCell(col+1, row-1) ? total + 1 : total; total = getCell(col-1, row ) ? total + 1 : total; total = getCell(col+1, row ) ? total + 1 :...
fb43501b-f05e-49a2-9d5b-56f73c1720a4
3
public static <T> T getTrackObjectFuzzyAt(World world, int x, int y, int z, Class<T> type) { T object = getTrackObjectAt(world, x, y, z, type); if (object != null) return object; object = getTrackObjectAt(world, x, y + 1, z, type); if (object != null) return objec...
ddc782a0-082c-4a2c-b5e5-d71348cda149
9
private void initSpritePanel() { File path = new File(Preference.getSpriteLocation()); path.mkdirs(); List<SpritePackage> packages = new ArrayList<SpritePackage>(); File[] dirs = path.listFiles(); for (int i = 0; i < dirs.length; i++) { File dir = dirs[i]; ...
71e9b8d4-9030-45f8-838b-2f5053348771
6
private static MapPoint getTileAccordingToBuildingType(UnitTypes building) { MapPoint buildTile = null; boolean disableReportOfNoPlaceFound = false; // Bunker if (TerranBunker.getBuildingType().ordinal() == building.ordinal()) { buildTile = TerranBunker.findTileForBunker(); } // Supply Depot // if (T...
0f69ae9b-a246-48ea-9f20-ed1c574aa42a
5
@Override public boolean activate() { if(Variables.banking) { return !ShadeLRC.fullInventory() && (Combat.getRock() == null || !Players.getLocal().isInCombat()); } else { return Inventory.getCount() < 21 && (Combat.getRock() == null || !Players.getLocal().isInCombat()); ...
8939f064-f599-4b5d-8f1b-18891c59a278
3
@Override public int write(ResultSet rs) throws IOException,SQLException { ResultSetMetaData md = rs.getMetaData(); int colCount = md.getColumnCount(); for (int i = 1; i <= colCount; i++) { print(md.getColumnName(i) + "\t"); } println(); int rowCount = 0; while (rs.next()) { ++rowCount; for (int...
e11472a9-421f-4069-b3c7-3600e3422105
1
private static void testCase1(){ CellEntry[][] cell = new CellEntry[][]{ {CellEntry.white, CellEntry.inValid, CellEntry.white, CellEntry.inValid, CellEntry.white, CellEntry.inValid, CellEntry.white, CellEntry.inValid}, {CellEntry.inValid, CellEntry.white, CellEntry.inValid, CellEntry.empty, CellEntry.inValid, Ce...
33f42eb1-699a-4edb-95d2-57cdbefc6ffc
8
private FileChannel findOrCreateNewLogFile() { long currentSyncTime = writer.getSyncTime(); resetCurrentChannel(currentMaxTxnTime); for (int i = 0; i < logFiles.size(); i++) { if (i == currentFilePosn) { continue; } FileChannel channel = logFiles.get(i).getChannel(); long size = 0; try...
bfbfe315-1b0c-4a69-995d-de448337ab93
1
public synchronized void addGameListener(GameListener listener) throws IllegalArgumentException { if (listenerCount > gameListeners.length) throw new IllegalArgumentException("Too many listeners"); this.gameListeners[listenerCount++] = listener; }
4de3ca6d-12d2-480e-8d95-c51ff8d82286
1
public static void encrypt(int[] value, int[] key) { int sum = 0; int delta = 0x9E3779B9; for (int i = 0; i < ENCRYPT_ROUNDS; i++) { value[0] += (((value[1] << 4) ^ (value[1] >> 5)) + value[1]) ^ (sum + key[sum & 3]); sum += delta; value[1] += (((value[0] << 4) ^ (value[0] >> 5)) + value[0]) ^ ...
432923b6-38fd-45a9-b78a-1f7aece02809
8
protected List<String> getCraftableSpellRow(String spellName) { List<String> spellFound=null; final List<List<String>> recipes=loadRecipes(); for(final List<String> V : recipes) if(V.get(RCP_FINALNAME).equalsIgnoreCase(spellName)) { spellFound=V; break;} if(spellFound==null) for(final List<String> V :...
35a4db15-9127-46eb-b1df-c90e2a4c67f9
3
@Override public void keyPressed(KeyEvent e) { /** * If the P key is pressed, pause or unpause the game */ if (e.getKeyCode() == KeyEvent.VK_P) { if (gamePaused) { unpauseGame(); } else { pauseGame(); } } else if (e.getKeyCode() == KeyEvent.VK_Q) { GameEngine.getGameScreenManager().setG...
6d0c8f79-3df7-4b51-a03f-297f555fcf9a
8
public void body() { // wait for a little while for about 3 seconds. // This to give a time for GridResource entities to register their // services to GIS (GridInformationService) entity. super.gridSimHold(3.0); LinkedList resList = super.getGridResourceList(); // in...
9f3fc3ab-23e1-47cf-8e92-e41f62eec594
5
public boolean equals(Object instance) { if (instance instanceof PairNonOrdered<?>) { PairNonOrdered<?> other = (PairNonOrdered<?>)instance; return super.equals(other) || super.equals(other.reverse()); } return false; }
becdbdb9-7a1f-4af3-b4f4-93e2bdd4b121
3
public JSONObject putOnce(String key, Object value) throws JSONException { if (key != null && value != null) { if (this.opt(key) != null) { throw new JSONException("Duplicate key \"" + key + "\""); } this.put(key, value); } return this; }
bc1bfe9d-b746-4420-a8ac-db7e4ffc6fb3
0
public void update(MainWindowModel mainWindowModel) { setNumberOfPoints(mainWindowModel.getNumberOfPoints()); setTimeStep(mainWindowModel.getTimeStep()); setTimePeriod(mainWindowModel.getTimePeriod()); setXMin(mainWindowModel.getXMin()); setXMax(mainWindowModel.getXMax()); ...
9abf6f7a-82c9-4de6-b14e-ec19124b0e5a
2
public MasterMindAI(int level) { int i = level; if (i > 5) { i = 5; } if (i < 0 ) { i = 0; } this.level = (level+5)*500; init(); }
0186328e-5b4d-4da9-8436-e92592e1373a
9
void createControlGroup () { /* * Create the "Control" group. This is the group on the * right half of each example tab. It consists of the * "Style" group, the "Other" group and the "Size" group. */ controlGroup = new Group (tabFolderPage, SWT.NONE); controlGroup.setLayout (new GridLayout (2, tr...
5df64ad2-e0d4-4282-bc59-b9c4fc1b2213
8
@Override public void compute() { // A very simple AI boolean newShip = false; if (currentOpponentShip == null || currentOpponentShip.getMorphsByIds().size() == 0) { currentOpponentShip = findOpponentShip(); newShip = true; } // iterate over the user's ships and send them all engage the opponent ship ...
24580578-3c0f-4178-8b71-b605c062140a
1
@Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; }
5ea22c99-98fe-4155-bc43-cd1b370aac50
9
public static void printMatrix(double[][] matrix, String fp, String[] names, int[] perm, String format) throws FileNotFoundException { File f = new File(fp); FileUtils.makeSubDirsOnly(f); PrintWriter out = new PrintWriter(f); if (names != null) { out.print("#"); ...
ba34ef1a-be3a-459d-a62b-b6a4624b175a
8
private void setHeightRatio() { if(backup_orbit != null && orbit) { System.arraycopy(((DataBufferInt)backup_orbit.getRaster().getDataBuffer()).getData(), 0, ((DataBufferInt)image.getRaster().getDataBuffer()).getData(), 0, image_size * image_size); } main_panel.repaint(); St...
625c668b-ab5e-4df1-bc2f-afe941d4c611
3
public Position<T> SearchNode(Position<T> root, T value) throws InvalidPositionException { BTPosition<T> BTroot = checkPosition(root); while (BTroot != null) { T currentV = BTroot.element(); if (currentV == value) break; if (comp.compare(currentV, value) > 0) BTroot = BTroot.getLeft(); else...
8bf7ef4a-6595-4464-8874-039cd9152ed2
2
private void delay() { if (_packetDelay > 0) { try { Thread.sleep(_packetDelay); } catch (InterruptedException e) { // Do nothing. } } }
53dbcb18-83d5-4641-b68c-83af705b7654
4
@Override public void actionPerformed(ActionEvent e) { if(e.getActionCommand().equals(classeString)) // Si on clic sur le boutton "Selectionner classe" on affiche les // équipements { selectionClasse(); } if(e.getActionCommand().equals(equipementString)) // ...
5dbbe4b1-94e8-44d8-825c-998ac7a0a2b0
5
final void put(int i, Object object, long key, int i_5_) { try { anInt1092++; if (i_5_ > anInt1084) throw new IllegalStateException("s>cs"); method586(key); anInt1086 -= i_5_; while ((anInt1086 ^ 0xffffffff) > -1) { Class348_Sub42_Sub8 class348_sub42_sub8 = ((Class348_Sub42_Sub8) ...
8a9fb77f-80bb-4a1c-8ba2-fb7b7873713e
7
private void updateHasOne(Object obj, String column, Map<String, Object> foreignKey) { StringBuilder sb = new StringBuilder(); sb.append("update " + obj.getClass().getSimpleName() + " set "); PreparedStatement stmt = null; Connection connection = null; try { PropertyDescriptor[] pd = handler.getPropert...
2b6e2fda-1fa0-4394-96e9-a05fe560209d
9
public void draw(Graphics2D g) { //Draw the background image so the board looks pretty. g.drawImage(boardImage, 0, 0, null); //We're gonna mess with the board so lets copy it. Board temp = copy(); //Determine where each piece is. String checkerColor, checkerType; for (int i = 0; i < SIZE; i++)...
5d23cd02-0c25-4efa-bb23-4df0ab47e1ae
5
public void run() { screen = createVolatileImage(pixel.width, pixel.height); //actually use the graphics card (less lag) render(); if(!debugMode) { int twoPlayers = JOptionPane.showConfirmDialog(null, "Play with 2 players?", "2 Players?", JOptionPane.YES_NO_OPTION); if(twoPlayers == 1) //they sai...
ae8f3f03-c725-4a46-a095-65ae8ca93792
4
void setUp(int width) { for (int x = 0; x < width; x++) { for (int y = 0; y < width; y++) { Square square = squares[x][y]; if (uniform() < 0.5) { square.setDirty(true); } if (uniform() < 0.1) { square.setObstacle(true); } } } }
8f970dc1-fcf3-4389-bc65-6145cbe58697
8
private void init() { int run_server = JOptionPane.showConfirmDialog(null, "Run the server ? "); if (run_server == 0) { server = new Server(this); client = new Client(this, "localhost"); client.start(); } else if (run_server == 1) { try { client = new Client(this, JOptionPane.showInputDialog(nu...
9dfb381a-5921-422c-8069-39c8d7abbcb5
4
public Shape getShape(String shapeType){ if(shapeType == null){ return null; } if(shapeType.equalsIgnoreCase("CIRCLE")){ return new Circle(); } else if (shapeType.equalsIgnoreCase("RECTANGLE")){ return new Rectangle(); } else if...
646c862e-6646-4754-9b39-529bac42fa19
1
public void visitEnd() { super.visitEnd(); if (fv != null) { fv.visitEnd(); } }
4f3144f2-9bcf-46c3-8ea9-fbb6ae1f0979
8
public void run() throws ParsingException { parseStack.push(new TerminalEntry(EOF)); parseStack.addToParseStack(ruleTable.find(startSymbol, startToken)); A = parseStack.peek(); getNextToken(); while ((A != null) && !A.isEof()) { A = parseStack.peek(); if (...
f603c47f-0625-4896-b016-f7d258d4c15a
8
private Component cycle(Component currentComponent, int delta) { int index = -1; loop : for (int i = 0; i < m_Components.length; i++) { Component component = m_Components[i]; for (Component c = currentComponent; c != null; c = c.getParent()) { if (component == c) { index = i; break loop; } ...
4a7cc0e6-3f55-4b3d-985c-89fbefb08bf7
5
private static Object dialog(WindowType window, MessageType messageType, String title, String message, JFrame parent) { int swingType; switch (messageType) { case WARN: swingType = JOptionPane.WARNING_MESSAGE; break; case QUESTION:...
ef36dce6-3d2d-4aaa-bfeb-07009720291c
3
public static int[][] mul(int[][] a, int[][] b) { int[][] result = new int[a.length][b.length]; for (int i = 0; i < a.length; i++) { for (int j = 0; j < a.length; j++) { result[i][j] = 0; for (int N = 0; N < a.length; N++) { result[i][j] +=...
68233e2b-975b-411e-9ae6-f701b616dd25
9
public FeatureVector extract(String idref) throws IDrefNotInSentenceException, RootNotInPathException, FeatureValueNotCalculatedException { FeatureVector fv = new FeatureVector(); if (FeatureTypes.isUsedFeatureType("target")) fv.addFeature("target", extractTarget()); if (FeatureTypes.isUsedFeatureType("synC...
aa90ffd6-5585-46bc-97f7-51b6dda9866b
7
public boolean isValidSelection(DateModel<?> model) { if (model.isSelected()) { Calendar value = Calendar.getInstance(); value.set(model.getYear(), model.getMonth(), model.getDay()); value.set(Calendar.HOUR, 0); value.set(Calendar.MINUTE, 0); value.set...
8e4c99c5-0de8-4af7-bf63-4aa2da2a6833
8
@Override public void endElement ( String uri, String localName, String qName ) throws SAXException { if ( requestType.equals( Globals.requestStatus ) ) { if ( qName.equals( XMLTags.Status ) ) { return; } else { processStatusXml( qName ); } } else if ( requestType.equals( Globals.requestMemoryB...
f45030ae-d53b-474d-9f70-f325fedb4e98
1
private void initComponents() { setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); wordsInSectionLbl = new JLabel(); wordsPane = new JScrollPane(); wordsTable = new JTable(); editWordLbl = new JLabel(); motherLangWordTextField = new JTextField(); translation...
9de9b344-8b7b-4831-b4e4-4a918f3e8e45
5
public static TransactionSet DoApriori(TransactionSet transSet,double minSupportLevel) { ItemSet initialItemSet = transSet.GetUniqueItems();//get all singular unique items and put them into a ItemSet object TransactionSet finalLargeItemSet = new TransactionSet(); // resultant large itemsets TransactionSet LargeIt...
9834a6c6-49bf-4976-84b5-bee5bf48f15b
5
@Override public void renderContents(float interpolation) { if(mainCollider != null) mainCollider.drawCollider(0xffffff); if(moveCollider != null) moveCollider.drawCollider(0xffffff); if(altMoveCollider != null) altMoveCollider.drawCollider(0x00ff00); if(rawMoveCollider != null) rawMoveCollid...
a9cb1bf5-910b-4578-bc3a-9eae155befce
2
@Override public void getFromPane(User u) throws InvalidFieldException { String oID = u.getID(); u.setID(tfID.getText().trim()); GameData g = GameData.getCurrentGame(); if (!g.checkID(u, User.class)) { if (oID != null) u.setID(oID); throw new InvalidFieldException(Field.USER_ID_DUP, "Duplica...
e35a9c4b-f075-4d63-b979-adf3d1aa18fc
9
public boolean similar(Object other) { try { if (!(other instanceof JSONObject)) { return false; } Set set = this.keySet(); if (!set.equals(((JSONObject)other).keySet())) { return false; } Iterator iterator =...
c8e2e1ff-be49-42c8-aea4-c74b7ffc569c
8
public AttackResult attack(Territory target){ //assumes that troop strength of attacking territory is > 1 Integer[] aDice, dDice; if(this.troopStrength > 3){ aDice = new Integer[3]; } else{ aDice = new Integer[this.troopStrength - 1]; } if(target.getTroopStrength() > 1){ dDice = new Integer[2]; ...
0228b8bb-72ef-4bd4-9b84-2e0d2b06539e
0
public static void main(String[] args) { ArrayList list = new ArrayList(); list.add("hello"); list.add(new Integer(2)); String str = (String)list.get(0); Integer in = (Integer)list.get(1); // String in1 = (String)list.get(1); java.lang.Integer cannot be cast to java.lang.String System.out.println(str);...
d90fc60c-13b2-4728-94ac-b7bbb5274dfc
2
public void playGame(GUI gui, int matchNum, int totalMatches) { gui.initaliseWorldMap(world, matchNum, totalMatches); System.out.println("Total Food:" + world.getFoodNum()); try { // Sleep thread for 3 seconds between each game for the player to observe the results Thread...
336aeca0-46b3-4347-ae6d-aef55a5d9162
0
public String getName() { return name; }
003e5bd1-dc7d-4efa-8bad-a65255e3b04c
4
public boolean isChar() { char c = symbol; if ((c >= 65 && c <= 90) || (c >= 97 && c <= 122)) { return true; } return false; }
dbaa7b3b-47bf-4415-be3b-9efb4049b393
6
private void searchForControllers() { Controller[] controllers = ControllerEnvironment.getDefaultEnvironment().getControllers(); for(int i = 0; i < controllers.length; i++) { Controller controller = controllers[i]; if (controller.getType() == Controller.Type.STICK || ...
54d36f8b-b9df-47b6-a634-71559151bd54
5
public static boolean equal(List<Partition> listA, List<Partition> listB) { if (listA.size() != listB.size()) { return false; } for (int index = 0; index < listA.size(); index++) { Partition a = listA.get(index); Partition b = listB.get(index); if ...
20c17952-b73d-400a-b237-59ef9d3f9b36
8
public static void main(String[] args) { if (args == null || args.length < 2) { printHelp(); throw new IllegalArgumentException("Minimum 2 file pathes needed"); } List<String> inputFileNames = new ArrayList<String>(); for (int i = 0; i < args.length - 1; i++ ) { inputFileNames.add(args...
ea1f0e17-4118-4925-9d5a-387862856bd4
7
private TreeNode Statement() { TreeNode tmp; int line = t.lineNumber; switch (t.id) { case Constants.ID: tmp = ExpressionSmt(); break; case Constants.RETURN: tmp = Return(); break; case Constants.READ: tmp = Read(); break; case Constants.WRITE: tmp = Write(); break; case Constan...
94590c55-84b8-47e1-82bc-baa1813cf49d
9
public void open(String[] onlines) { if (onlines == null || onlines.length == 0) return; DedicatedUI ui = null; String senderName = fPropertiesDB.getUserName(); String remoteIPAddress = null; // // Open only one dedicated ...
29c5476b-9ee2-4c1d-aa22-e55308962ea0
4
private String buildFullPath(Class<?> aClass, Method method) { int modifiers = method.getModifiers(); String modifier = "package-local"; if (Modifier.isPrivate(modifiers)) { modifier = "private"; } else if (Modifier.isProtected(modifiers)) { modifier = "protected...
9dda7b64-57b2-4e08-9d52-7f2b9f660b60
4
public static Method getAccessor(Class<?> declaringClass, String accessorname) { Method res = null; if (declaringClass != null) { // check this class try { res = declaringClass.getDeclaredMethod(accessorname); } catch (NoSuchMethodException e) { // do nothing, keep iterating up } ...
d35cf062-12f7-4568-83fb-698b5498fdeb
6
private void loadLetterPoints() throws IOException, FileNotFoundException { BufferedReader in = null; try { in = new BufferedReader(new FileReader(POINTS_FILE)); String line; while((line = in.readLine())!=null){ line = line.trim(); int letterPoint = Integer.parseInt(line.substring(0, 2)); line ...
dc48d84f-402d-486a-8709-b7cf0767a219
9
@Override public ArrayList<Lot> findLots(Map<String, String> params) { //проверка, что обязательные поля заполнены if (!params.containsKey(MechanicSales.findParams.ARRIVAL_AIRPORT) || !params.containsKey(MechanicSales.findParams.DEPARTURE_AIRPORT) || !params.containsK...
2e2bdb99-5e6d-4965-bdd1-163c417752d4
1
public ArrayList<GameObject> getAllAttached() { ArrayList<GameObject> result = new ArrayList<GameObject>(); for ( GameObject child : children ) result.addAll( child.getAllAttached() ); result.add( this ); return result; }
7ee4b1b9-d573-4a4b-8009-98aaa820ede9
8
public boolean posNeg(int a, int b, boolean negative) { if ( a<0 && b<0 && negative) return true; if ( ( ( a<0 && b>0 ) || ( a>0 && b<0 ) ) && !negative ) return true; return false; }
6ecbda52-bc88-4cd1-aa29-8264302c33e6
9
public String toString() { String res = ""; for (int i = 0; i < this.hauteur; i++) { // Parcours le premier tableau for (int j = 0; j < this.largeur; j++) { // Parcours le second tableau switch (this.background[i][j]) { case MUR : res = res +"M"; break; case HERBE : res = res...
7cd6cb61-c838-4c06-81f0-8807947556d8
6
public static void main(String[] args) throws IOException { Scanner scan = new Scanner(System.in); w: while (scan.hasNext()) { int n = -1, con = 0; boolean[] a = new boolean[101]; Arrays.fill(a, false); ArrayList<Integer> ll = new ArrayList<Integer>(); HashSet<Integer> set = new HashSet<Integer>(); ...
9bfa71ca-ec1c-4d8d-827c-8b10c60804f4
3
@Override public EntidadBancaria get(int id) { PreparedStatement preparedStatement; EntidadBancaria entidadBancaria; ResultSet resultSet; Connection connection = connectionFactory.getConnection(); try { preparedStatement = connection.prepareStatement("SELECT * FRO...
2fb4d656-0d03-4b0b-8418-c09379c3198d
9
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("N: "); sb.append(N); sb.append("\tP: "); sb.append(p); sb.append("\tQ: "); sb.append(q); sb.append("\n"); for(int i = 0; i < N; ++i) { for(int j = 0; j < N; ++j) { sb.append(Odometer.intToOdometer...
5861e53c-6e08-4aed-b93f-a28fdf92dbab
1
private static String[] formatEmpty(){ String[] cards = new String[60]; for(int i=0; i<60; i++){ cards[i]="Forest"; } return cards; }
5b47735a-4c52-46a1-ae6f-7aa52404913d
4
private void calculatePosition(){ nx = Math.cos(Math.toRadians(moveAngle)); ny = Math.sin(Math.toRadians(moveAngle)); x+=speed*nx; y+=speed*ny; if(x>MainWindow.WIDTH) x = -getWidth(); if(y>MainWindow.HEIGHT) y = -getHeight(); if(x+getWidth()<0) x = MainWindow.WIDTH; if(y+getHeight()<0) y = MainWi...
f6eee16c-5397-46e1-8900-03e50bf8ec1a
9
private static void setDefaultLookAndFeel(){ try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (UnsupportedLookAndFeelException...
b87d3b1d-1c99-4209-9337-0f3ada67e08d
6
private boolean fsk2001000FreqHalf (CircularDataBuffer circBuf,WaveData waveData,int pos) { boolean out; int sp=(int)samplesPerSymbol/2; // First half double early[]=do64FFTHalfSymbolBinRequest (circBuf,pos,sp,lowBin,highBin); // Last half double late[]=do64FFTHalfSymbolBinRequest (circBuf,(pos+sp),sp,lowBi...
6f2f266a-c4f8-46b3-8ace-d0c34937b1eb
8
public static String encode(String value) { String encoded = null; try { encoded = URLEncoder.encode(value, "UTF-8"); } catch (UnsupportedEncodingException ignore) { } StringBuffer buf = new StringBuffer(encoded.length()); char focus; for (int i = 0; i...
3d8d7777-7154-424b-80f2-4285cccc7222
0
public Hunter(Field field, Location newLocation) { this.field = field; setLocation(newLocation); }
adfc843f-9d89-4a67-863d-3e1db0b16895
9
protected void renderContinuousSegment() { /* A lazy but effective line drawing algorithm */ final int dX = points[1].x - points[0].x; final int dY = points[1].y - points[0].y; int absdX = Math.abs(dX); int absdY = Math.abs(dY); if ((dX == 0) && (dY == 0)) return; if (absdY > absdX) { final int inc...
a849ef52-b4d7-4c62-922c-8812e3030643
9
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); if(session != null){ String sleeveInput = (String) session.getAttribute("sleeveInput"); String op...
8d9efc0f-5e47-4bb4-b075-b503e3cbcd85
0
public User(Socket s) throws IOException { socket = s; in = new BufferedReader(new InputStreamReader(socket.getInputStream())); // Включение автосброса буферов: out = new PrintWriter(new BufferedWriter(new OutputStreamWriter( socket.getOutputStream())), true); port = socket.getPort(); // Если какой ...
3b0303c2-fd7d-413d-bbd8-29de90c61e6c
1
public void render() { root.renderAll(); for(GUI gui:guiLayer){ gui.render(); } }
065e91b8-6ea4-408f-9893-8b6ffa02f96c
1
@Override public void out() throws Exception { Object val = fa.getFieldValue(); // Object val = access; // if (ens.shouldFire()) { // DataflowEvent e = new DataflowEvent(ens.getController(), this, val); //// DataflowEvent e = new DataflowEvent(ens.getController(), this, ...
5135f942-4a77-4836-bdda-27defe41dda8
1
public Renderer.CommandHandler getHandler(String symbol) { if (handlers.containsKey(symbol)) return (CommandHandler) handlers.get(symbol); return null; }
dd2282dd-264e-439b-ab86-e763bd5c1a95
3
private static boolean isWhitespace(char c) { return c == ' ' || c == '\t' || c == '\r' || c == '\n'; }
23f65365-cace-457b-85b7-ac9a7d75a7c7
1
private void bindTexture(int texId) { if (texId == boundTex) { return; } glBindTexture(GL_TEXTURE_2D, texId); boundTex = texId; }
f613be0e-54ac-4132-8e6b-b5ded89e0924
6
public void visitInsn(final int opcode){ // adds the instruction to the bytecode of the method code.putByte(opcode); // update currentBlock // Label currentBlock = this.currentBlock; if(currentBlock != null) { if(compute == FRAMES) { currentBlock.frame.execute(opcode, 0, null, null); } else { ...
f8a7ad04-e012-4b91-a519-cfa4cb27b5e5
3
public static String[] getIDs(Connection con, TableInfo tableInfo) { ArrayList<String> data = new ArrayList<String>(); try { PreparedStatement ps = con.prepareStatement("SELECT ID FROM " + tableInfo.tableName); ResultSet rs = ps.executeQuery(); while (rs.next()) data.add(rs.getString("ID")); ...
3d6b835a-8f3e-4cd2-987d-f8b0c2dfb5b0
8
public Object render(Scope scope, Statement statement, int tokenIndex) throws PoslException { switch (state) { case NORMAL: case OPTIONAL: return scope.get(type, statement.get(tokenIndex)); case CONTEXT_PROPERTY: return scope.get((String) parameter); case SCOPE: return scope; // Collection is a...
6fc4d425-fdbe-49e5-96b3-5b5009afe8ee
7
public SlotType(String type) { reward = new HashMap<ItemStack,Integer>(); fireworks = new HashMap<ItemStack,Integer>(); wrg = new WeightedRandomGenerator(); String typeNode = "types."+type; String rewardNode = typeNode+".reward"; cost = Global.config().getInt(typeNode + ".cost"); Set<String> keys...
8d527d75-774f-4f2e-9888-485002e797bb
0
public GUIChat(DataInputStream in, DataOutputStream out, RequestChatHandler rq, ComingRequestChatHandler commingRq) { setResizable(false); this.rq = rq; this.commingRq = commingRq; read = in; write = out; fc = new JFileChooser(); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(100, 100, ...
835620b5-0ff5-49db-a8d1-c99c81e8a2fa
8
public String addingYear(String field, int before, int max) { String newField = ""; for(int i = 1; i <= field.length(); i++) { if(isNumber(field.substring(i - 1, i))) { newField = newField + field.substring(i - 1, i); } else ...