method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c9451b04-3215-4552-83e4-ecf94cc43a2a
4
public void netejaRecordsUsuari( String nom_usuari ) { if ( nom_usuari.equals( usuari_temps_minim ) ) { usuari_temps_minim = null; temps_minim = Long.MAX_VALUE; recalculaTempsMinim(); } if ( nom_usuari.equals( usuari_fitxes_minimes ) ) { usuari_fitxes_minimes = null; fitxes_minimes = Integer....
483c9d05-e68f-4a08-a674-9ab1bcc65173
8
private void findIndexUsageInVicinity(TablePairActivity tablePair) throws Exception { for (Query query : queries) { List<String> queryRelations = query.getRelations(); Set<QueryFilter> queryFilters = query.getSelections(); String tableA = tablePair.getNameOfTableA(); String tableB = tablePair.getNameO...
afc71f08-2acb-439c-bc8d-827edfdeab54
5
private void updateEventInSession(HttpSession session, int eventId, int bookedSeats) { try{ ArrayList<EventsBean> arrlbean = (ArrayList<EventsBean>)session.getAttribute("upcomingevents"); if(arrlbean != null && arrlbean.size()>0){ for(EventsBean bean:arrlbean){ if(bean.getEventId()==eventId){ bea...
d1feba8f-6d19-4a7f-80aa-14b222b36d04
9
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null && line.length() != 0) { int nSet = Integer.parseInt(line.trim()); for (int...
c018d195-8cf5-465e-a402-bbecbf1a6917
7
protected List<DataLead> selectAll() { String query = buildQueryString(); String url = buildConnectionString(); String class_name = "com.mysql.jdbc.Driver"; Connection conn = getConnection(url, class_name); if (conn == null) { errorLogFile.log(LoggingProxy.ERROR, "...
e0be9845-cbf3-4282-8b13-090a7a5d1a40
9
public void run() throws IOException { boolean go = true; initialize(); // initializes things which need initializing before // the game can run. sound = new Sound("assets/sounds/KingSolomonsOverworldTheme.wav", true); while (go){ if(doSetup) { if(!sound.isPlaying) { sound = new Sound("assets/s...
2ad6645c-ea16-46ad-9066-9a2c9aae4048
1
private boolean jj_3_4() { if (jj_3R_22()) return true; return false; }
4672b713-c7d0-4b09-b144-b807f8e186f9
1
private void calculateGravity(BlackHole bh) { double dx = x - bh.getX(); double dy = y - bh.getY(); double distance = Math.sqrt(dx * dx + dy * dy); if (distance != 0) { gravity = (FRAME_WIDTH * 1.0 / 20) / distance; } //System.out.println("dist: " + distance +...
fc2d349c-10df-4364-a6d9-9fe8da29a4a9
0
public Division(Expression left, Expression right) { this.left = left; this.right = right; }
283e64fe-2a5b-4b22-aeb5-e78ca411f66e
6
public static void makeGrid(Container parent, int rows, int cols, int initialX, int initialY, int xPad, int yPad) { SpringLayout layout; try { layout = (SpringLayout)parent.getLayout(); } ...
8ae4a29a-ac45-4f70-af45-0119a8cb2300
7
private boolean isPlayerKingInCheckFromPieceDiagonallyDownRight() { for (int i=playerKingPiece.pieceLine-1, j=playerKingPiece.pieceColumn+1; i>=1 && j<=8; i--, j++){ BoardSquare boardSquare = chessBoard.getBoardSquare(i, j); if (boardSquare.containsBoardPiece()){ if (i==playerKingPiece.pieceLine-1 && j==pla...
ea82ff37-b910-4b71-89de-4e93210c1c6d
8
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Endereco other = (Endereco) obj; if (!Objects.equals(this.rua, other.rua)) { return false; ...
ffbb098c-b22b-46e0-950f-bb82ff8fa349
3
public static void main(String args[]){ long start = System.currentTimeMillis(); PrintWriter outputStream = null; try{ BufferedReader inputStream = new BufferedReader(new FileReader("myBinaryIntegers.dat")); outputStream = new PrintWriter (new FileOutputStream("myBinaryIntegers.txt")); ...
0f624469-902d-469e-9d0d-8f4b0b0a494b
8
public V remove(K key) { if (key == null) return null; int index = hashFunction(key); if (mTable[index] != null) { // table bucket contains at least one entry Node currentNode = mTable[index]; V temp; if (currentNode.mKey == key) { // if first node matches key temp = currentNode.mValue; ...
57654b6b-031d-4e8f-a261-13d13ef70f2e
2
public InitTable setPartitioning(Partitioning partitioning, SetPartition setter) { this.partitioning = partitioning; if (null == partitioning) { return this; } for (int i = 0; i < partitioning.getCount(); i++) { partitioning.addPartition(setter.set(i)); } return this; }
bce122f7-127d-4026-85a8-2a23f9078bab
5
public TextMsg(String toUser,String fromUser,String createTime, String content,String msgId){ super(); this.xml = XML; this.setProperty(TO_USER, StringUtils.isNotBlank(toUser)?toUser:"touser"); this.setProperty(FROM_USER,StringUtils.isNotBlank(fromUser)?fromUser:"fromUser"); this.setProperty(MSG_TYPE, "text")...
7aa8f783-71d3-4974-99b6-71486f764ffe
7
private void jTextFieldSearchAdherentKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextFieldSearchAdherentKeyTyped // TODO add your handling code here: if (evt.getKeyChar() == KeyEvent.VK_ENTER) { String toSearch = jTextFieldSearchAdherent.getText(); if (jRadioButtonI...
d1f30bde-1dc3-4098-8a5d-d3bda70c48c4
8
public void dispatch( HttpServletRequest request, HttpServletResponse response, int action ) { switch( action ){ case Definitions.LOGIN: LoginHelper.dispatchLogin( request, response ); break; case Definitions.AUTHENTICATE: LoginHelper.dispatchAuthenticate( request, response ); break; case ...
a44a4930-9243-4c60-aec7-de74a35ae45c
7
public void saveStores(){ File storeFile = new File(getDataFolder(),storeFileName); if(storeFile.exists()) storeFile.delete(); if(stores.size()==0) return; try { storeFile.createNewFile(); } catch (IOException e) { logWarning("Unable to create stores file!"); return; } FileConfiguratio...
6700eb4a-4d97-4021-8e6e-ee2d4ca3b278
7
private static void buildIt() throws Exception{ StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace(); StackTraceElement s = stackTraceElements[3]; String callerClassFullName = s.getClassName(); String callerClassName = callerClassFullName.substring(callerClassFullName.lastIndexOf("...
d4d1cd5c-d09f-4135-989c-7e669dd28888
4
private double[] calculateCPUConsumptionW(Component component, HardwareAlternative hardwareAlternative) { double consumption[] = { 0, -1 }; for (HardwareComponent cpu : hardwareAlternative.getHardwareComponents()) { double temp[] = Utils.consumptionCPU((Cpu) cpu, component.getUsageCPU(), project.getDefaultCpuSco...
399e8b77-9bd1-4f7f-9999-4d559c62fe4e
1
@Override public boolean isAttributeCategorySupported(Class<? extends Attribute> category) { return false; }
78f12958-cb67-4ab3-8a31-1128edc7e18f
6
private boolean checkValidUser_digestAuthentication_processCredentials( URI requestURI, HTTPHeaders headers, HypertextAccessFile htaccess, String authMethod, File authUserFile, Map<String,BasicType> additionalSettings, Map<String,Basic...
465855f6-30e0-46d0-8375-e1f2a633632f
6
private static List<Location> getLocations(RandomAccessFile reader) throws IOException { List<Location> locations = new ArrayList<Location>(); // Find Definition reader.seek(0); String line = reader.readLine(); while (line != null) { if (line.contains(LOCATION_DEFINITION_DELIMETER)) { String names =...
8f43293b-971d-4e98-854e-2cb524ac139a
7
public final boolean isVFSOnlyPathFile() { if(demandLocal) return false; if(isDirectory()) return false; String dir=getVFSPathAndName().toLowerCase(); if(dir.endsWith("/")) return false; if(demandVFS) return true; int x=dir.lastIndexOf('/'); if(x<0) return false; final CMVFSFile file=get...
92db4cde-04ea-4f98-8d3b-7b67207df8d6
6
public ArrayList<MultihopPacketTrace> finishedTraces(boolean broadcast){ ArrayList<MultihopPacketTrace> results = new ArrayList<MultihopPacketTrace>(); for(MultihopPacketTrace t : traces){ for(MACPacket p : t.getPacketList()){ //if it matches, add to the list if((p.getDestinationNode().equals(t.getDestin...
23ef6aa0-87f4-4f72-995c-423d811e9104
7
public void removeType(URI typeId) { // We may have different version of the class being loaded by // different class loaders. We need to make sure all version are // removed from the cache since the type is no longer in HGDB. Set<Class<?>> S = new HashSet<Class<?>>(); String...
6767d6bf-a0ce-4d2a-b00d-11dc320f384f
6
public boolean isSameTree(TreeNode p, TreeNode q) { if (p == null && q == null) { return true; } else if (p == null || q == null) { return false; } boolean isLeftSame = isSameTree(p.getLeft(), q.getLeft()); boolean isRightSame = isSameTree(p.getRight(), ...
fac4235e-d223-4aa8-a11a-7bf062a6698a
9
public static String split(String filePath, int begin, int end) throws FileNotFoundException, IOException { String prefix; try (Scanner scan = new Scanner(new FileReader(filePath))) { if (! new File(tmp).exists()) new File(tmp).mkdir(); prefix = UUID.randomUUID()....
f35be6ca-33f9-4b16-92d2-7b79cb6e4e1f
4
private int AttemptDelete(LinkedList<PlayerReinforcement> toDelete) { boolean attemptRecovery = false; try { getDatabase().delete(toDelete); } catch (Exception ex) { attemptRecovery = true; Citadel.warning("DB mass delete failure: " + e...
764bcf4b-1e5f-492f-89e5-38e9d5aded4d
4
public NumberTextField() { addEventFilter(KeyEvent.KEY_TYPED, new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent event) { switch (event.getCode()) { case ENTER: case TAB: case BACK_SPACE: return; default: break; } ...
3cd8a7c9-65b9-4fed-9b9b-82078167e4fd
9
protected LoginResult acctcreateEmailEntered(final LoginSessionImpl loginObj, final Session session) { final boolean emailPassword=((CMProps.getVar(CMProps.Str.EMAILREQ).toUpperCase().startsWith("PASS")) &&(CMProps.getVar(CMProps.Str.MAILBOX).length()>0)); final boolean emailReq=(!CMProps.getVar(CMProps.Str.E...
125d84d3-6787-4180-ac28-fdc843984858
3
@Override public void deleteUser(User user) throws SQLException { Session session=null; try{ session=HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.delete(user); session.getTransaction().commit(); }catch(Exception e){ e.printStackTrace(); }finally{ if(ses...
dbf5f847-e639-463b-ade6-5b896f597f7c
4
public void move(int direction, int distance){ switch (direction){ case 1: yPosition-=distance; break; case 2: xPosition+=distance; break; case 3: yPosition+=distance; break; case 4: xPosition-=distance; break; } }
42207f81-2c57-4981-a9f1-8cf28314faee
0
@Override public void mouseEntered(MouseEvent e) {}
5313d16e-7528-4d0f-be9b-3b6793f9fa0c
0
protected void onSetSecret(String channel, String sourceNick, String sourceLogin, String sourceHostname) {}
0b1a97d3-94d7-4a64-a172-0ba4052b1489
7
public void izvrsi(HttpServletRequest req, HttpServletResponse res, ProizvodBean p){ try{ if(!naziv.equals("")){ p.setNaziv(naziv); } if(!opis.equals("")){ p.setOpis(opis); } if(kolicina!=0){ p.setKolici...
ad5e781c-46e0-4a35-a9f5-0365b023855a
8
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); Image off = createImage(WIDTH,HEIGHT); Graphics second = off.getGraphics(); second.setFont(new Font("Volter (Goldfish)",Font.PLAIN,30)); backGround.paintIcon(pan...
91b9d992-76d5-4148-9efe-6fa95ca7188c
2
public int compare(Node n0, Node n1) { if(n1.fCost < n0.fCost) return +1; if(n1.fCost > n0.fCost) return -1; return 0; }
b72e7923-9040-4ddd-b6ea-58e7357682e7
2
private IntKeyValuePair getIntKeyValuePair(String key) { IntKeyValuePair kvp; iter = bucket.iterator(); while(iter.hasNext()) { kvp = iter.next(); if(kvp.getKey().equals(key)) { return kvp; } } return null; }
31714d21-8eb2-4fec-b436-26a6b00864b3
6
public InterfaceCuisine(CarteInteractive carte){ setLayout(new GridLayout(6,1)); JLabel entree = new JLabel("Entree"); entree.setBorder(BorderFactory.createLineBorder(Color.black)); entree.setFont(new Font("TimesRoman",Font.BOLD,15)); JLabel plat = new JLabel("Plat"); plat.setBorder(BorderFactory.createL...
54f909f0-6149-4c06-ab37-714b3a967a80
2
public static int setSize(String set, TreeNode root) { String currVal; for(int m = 0; m< root.getRecords().size(); m++){ currVal = root.getRecords().get(m).get(ID3.indexOfClassLabel); if(!possClasses.contains(currVal)) possClasses.add(currVal); } return possClasses.size(); }
46b5bf77-0db1-4e0a-b672-487311209d46
6
public int minPathSum(int[][] grid) { if (grid.length == 0 || grid[0].length == 0) { return 0; } int m = grid.length; int n = grid[0].length; int[][] dp = new int[m + 1][n + 1]; dp[m - 1][n - 1] = grid[m - 1][n - 1]; for (int i = m - 1; i >= 0; i--) {...
51703225-ab73-4932-b859-dbbb17dd424d
7
public void setState(int state) { switch(state){ case 1://state is random move this.state = state; subState = RANDOM; break; case 2: break; case 3: break; case 4: break; case 5: this.state = state; subState = RANDOM; break; case 6: break; ...
4ac266e0-596c-42a0-b8f0-91cf621ff320
2
public boolean isGas() { boolean isGas = false; for(int i = 0; i < gases.length; i++) { if(this.equals(new MiniCompound(gases[i]))) { isGas = true; break; } } return isGas; }
f575dd13-8dc2-4c3f-97be-cac683a7b4fb
9
public Template handleRequest( HttpServletRequest request, HttpServletResponse response, Context context ) { Template template=null; int length = 0; SubmitArticleModel sam = new SubmitArticleModel(); context.put("apptitle", "E-com Journal"); if(ServletFileUpload.isMultipartContent(request)){ String articl...
438f1e0a-f675-4efc-b539-eed7fe530b5a
6
public void check(int bpm) { //check if it's to high if (bpm > high) { activate(); ishigh = true; } //check if it's to low else if (bpm < low) { ishigh = false; activate(); } else { deactivate(); } //pop ...
8182e66f-a06c-41e5-b505-f899031af95a
2
public void repositionFlyUps() { // removeDeadFlyUps(); int basePosition = 15 + (!permanentFlyUp.equals("") ? 0 : 15); for(FlyUp fly:flyups) { fly.setDistanceAboveRobot(basePosition); basePosition += 15; } }
327fa9b4-d6cc-4ce5-b1bd-d37ccece0da3
9
public int[][] right(int grid[][]) { score = 0; for (int yIndex = 0; yIndex < 4; yIndex++) { for (int xIndex = 0; xIndex < 3; xIndex++) { if (grid[yIndex][xIndex + 1] == 0) { for (int a = xIndex + 1; a > 0; a--) { grid[yIndex][a] = ...
a7e23d6d-3a77-44f8-ad92-d43e388909ac
0
public void setHiddenWithLayer(boolean hiddenWithLayer) { this.hiddenWithLayer = hiddenWithLayer; }
5d09eff3-4d51-4617-913c-d3a1673e1bf3
6
public boolean pressDownButton() { Lib.assertTrue(!inElevator && floor > 0); for (int elevator=0; elevator<numElevators; elevator++) { if (elevators[elevator].doorsOpen && elevators[elevator].direction == ElevatorBank.dirDown && elevators[elevator].floor == floor) return false; ...
8f726c3d-b85a-4dc2-8769-9dbe5655c3d0
3
public void mouseMoved(Point p){ if(rect.contains(p) && visible){ for(GuiComponent c: components){ c.mouseMoved(p); } } }
4c0d4736-5c09-4f8b-8061-3f3f0e883583
4
@Override public void update() { //If the button wasn't yet pressed if(!pressed){ //Get mouse position Vector mousePos = Directory.inputManager.getMousePosition(); //If the button contains the mouse if(attachedTo.contains(mousePos.getComponent(0), mousePos.getComponent(1))){ //If the LMB is being p...
9656f50b-bb44-4389-a793-d5c7c78cda7f
8
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Contact other = (Contact) obj; if (!Objects.equals(this.firstName, other.firstName)) { return...
1f305345-febc-4574-8993-ff0bb017e87d
7
public static boolean hasFlag(Cuboid c, Flag flag, String player) { if (c == null || player == null || flag == null) return false; User user = EdgeCoreAPI.userAPI().getUser(player); if (user != null && c.isOwner(user)) return true; if (user != null && Level.canUse(user, c.getModifyLevel())) return true; ...
b56ef612-94d3-45eb-8f03-4d9552d42cd0
9
public ListNode addTwoNumbers(ListNode l1, ListNode l2) { if (l1 == null) { return l2; } else if (l2 == null) { return l1; } int plus = 0; ListNode head = new ListNode(-1); ListNode curr = head; while (l1 != null && l2 != null) { ...
2b377dcc-c46f-4003-abac-62081519b505
9
public void updateAchievementWindow() { if (this.theAchievement != null && this.achievementTime != 0L) { double var8 = (double) (System.currentTimeMillis() - this.achievementTime) / 3000.0D; if (!this.haveAchiement && !this.haveAchiement && (var8 < 0.0D || var8 > 1.0D)) { ...
d4f4ef84-178e-4b40-8af8-4a5309488e7d
8
public static List<CDDHit> reloadHits(CyNetwork network, CyIdentifiable id) { if (!CyUtils.checkColumn(network.getDefaultNodeTable(), CDD_ACCESSION, List.class, String.class)) return null; List<String> accessions = network.getRow(id).getList(CDD_ACCESSION, String.class); List<String> names = network.getRow(id...
3b77f613-e498-46b5-8d3f-0f2f01bb26c9
6
private static String getLeftOut( int patientIDToLeaveOut ) throws Exception { String returnString = null; BufferedReader reader = new BufferedReader(new FileReader(new File(ConfigReader.getChinaDir() + File.separator + "phylum_taxaAsColumnsLogNorm_WithMetadataNonRare.txt"))); reader.readLine(); f...
77fe4922-4f0d-4f47-8b66-083e8e7d6e3d
3
public boolean containsItemSet(ArrayList<Item> subItemSet) { for (int i = 0; i < this.itemSet.size(); i++) {// loop through biggest // itemSet for (int j = 0; j < subItemSet.size(); j++) {// check against inner // subset Item item = subItemSet.get(j); if (!this.itemSet.contains...
3ff7582e-3350-4ca9-be14-58485fb41998
5
public void doGet(HttpServletRequest request, HttpServletResponse response) { response.setContentType("text/html"); PrintWriter webPageOutput=null; try { webPageOutput=response.getWriter(); } catch(IOException error) { Routines.writeToLog(servletName,"Error getting wr...
309d5a1a-1f73-4010-8bd8-97f4ebaa688d
0
public boolean isTerminal(String terminal) { return myTerminals.contains(terminal); }
e2a6776e-2a8c-415f-aa4b-8e776992911c
9
public void doGet(HttpServletRequest request, HttpServletResponse response, String[] uri, HorusBaseDAOCRUDInterface basedao) { try { content = new Hashtable<String, String>(); data = new ArrayList<Map<String, String>>(); if (uri.length > 4) { switch (uri[4]) { case "id": rs = basedao.getId(uri[...
f6642768-0acf-4167-8aef-07aad11b991f
9
private boolean wantGoods(WorkLocation wl, GoodsType goodsType, Unit unit, UnitType expert) { boolean ret = false; if (wl instanceof ColonyTile) { ret = true; } else if (wl instanceof Building) { Building bu = (Building) wl; Colon...
131f802d-86b9-4a31-96e2-3ea962ed841b
2
public EsteenTyyppi onkoPisteessaEste(Piste piste) { for (Este este : esteet) { if (este.kuuluukoPiste(piste) != null) { return este.kuuluukoPiste(piste); } } return null; }
66342b30-9902-46b8-b365-74e078ad6055
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Nurse_1)) { return false; } Nurse_1 other = (Nurse_1) object; if ((this.id == null && other.id != null) || (thi...
b75b1b83-0052-44af-859a-9ccaa23b8d56
8
@Override public boolean evaluate(RuleContext ruleContext) { BigDecimal lhs = new BigDecimal(mValues.get(0).asString(ruleContext)); BigDecimal lower = new BigDecimal(mValues.get(1).asString(ruleContext)); BigDecimal upper = new BigDecimal(mValues.get(2).asString(ruleContext)); // int lowerBound = l...
084eac66-26a1-4ade-8ad2-953795f6adbb
2
private void populateEntity() { enemys = new ArrayList<Enemy>(); entities = new ArrayList<EntitySpecial>(); Slugger s; Crawler s2; Point[] points = new Point[] { new Point(160, 64), new Point(1200, 100) }; Point[] points2 = new Point[] { new Point(660, 160), new Point(1600, 100), new Point(1860, 160), new P...
5a1d3a91-6b96-4d3d-95f3-a86aef19e67e
2
private String retrieveData(final String param){ String output = null; try { openStream(param); inputScan = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); output = inputScan.readLine(); } catch (IOException e) { e.prin...
ad8a042d-cf5b-46e9-b198-dfa34a5da19f
5
public void setShutdownframePosition(Position position) { if (position == null) { this.shdFrame_Position = UIPositionInits.SHDFRAME.getPosition(); } else { if (!position.equals(Position.LEFT) && !position.equals(Position.RIGHT) && !position.equals(Position.TOP) ...
4a9ee82a-1136-4bda-ab80-c9ed55572b75
2
public static void display() { if (!UIUtilities.inModalState()) { if (INSTANCE == null) { INSTANCE = new PreferencesWindow(); } INSTANCE.setVisible(true); } }
9b2730ff-6028-49b1-bd31-587d95282df4
9
@EventHandler public void onInventoryClick(InventoryClickEvent event) { Player player = (Player) event.getWhoClicked(); // The player that clicked the item ItemStack clicked = event.getCurrentItem(); // The item that was clicked Inventory inventory = event.getInventory(); // The inventory that was clicked in ...
2b94e305-8987-451f-9657-904471016b9e
2
public void mouseWheelMoved(MouseWheelEvent e) { //block zooming while a simulation is running if(Global.isRunning){ return; } int clicks = e.getWheelRotation(); if(clicks < 0) { parent.zoom(Configuration.wheelZoomStep); // zoom In } else { parent.zoom(1.0 / Configuration.wheelZoomStep);...
84acaca5-1b87-4467-8f3a-1f0f2cbff33c
9
public String Perse() { System.out.println("解釈開始"); //接続確立メッセージが存在しない、正しくない場合は不正な取引と判定して取引を中止する if (!BankTransferConfiguration.establish_connectionWord.matches(order[0])) { return "abort"; } else if (order[1] == null) { return "OK"; } if (order[1].matches("send")) { if (order[2] == null) { //O...
19dad2e9-c7ea-4543-b770-bb255d98ef3e
7
private JSONArray readArray(boolean stringy) throws JSONException { JSONArray jsonarray = new JSONArray(); jsonarray.put(stringy ? readString() : readValue()); while (true) { if (probe) { log("\n"); } if (!bit()) { if (!bit()) {...
ab29b736-d1f6-4a48-a864-b5163d6c273e
8
public NodoArbolBinarioOrdenado<T> eliminar( T aEliminar ) { if(izquierda==null&&derecha==null) return null; if(elemento.compareTo(aEliminar)==0){ if(izquierda==null) return derecha; if(derecha==null) return izquierda; NodoArbolBinarioOrdenado<T> x=derecha.darMenor(); derecha=derecha.elimina...
c40d785f-53e9-45f8-9a45-81ea45c99ace
9
public String toStringMatrix() { StringBuffer result; String[][] cells; int i; int n; String line; String title; String generated; result = new StringBuffer(); cells = toArray(); // generati...
ca6672b7-9ea3-42d2-a8c2-c6752901566f
5
public void Download() { // abort if nothing in queue if (DownloadQueue.size() == 0) { return; } // construct download url string String URLName = "http://api.eve-central.com/api/marketstat?usesystem=30000142"; while (!DownloadQueue.isEmpty()) { U...
8e17b0ac-a4e7-40bb-a5e7-a47ae652792b
7
public void run() { try { int n,tmppassnode; Scanner scan=new Scanner(new File("res/sites.txt")); while(scan.hasNext()){ Node a=new Node();//here !!!!Attention:must be new every time a.index=scan.nextInt(); a.setName(scan.next()); a.x=scan.nextInt(); a.y=scan.nextInt(); addN...
7eb1b3be-619b-4abf-8e42-8c3dc2a637f7
1
public static void main(String[] args) { products = new ArrayList<Product>(); //System.out.println("Arraylist size:"+products.size()); int owner = 1; if (owner == 0) { CreateOwnerView createOwner = new CreateOwnerView(); } else { Login...
5843451f-5562-4c35-9d06-64ecc64f4a87
6
@EventHandler public void WolfResistance(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getWolfConfig().getDouble("Wolf.Resistance...
3dfd2e04-58fb-4370-99e9-cf3400a76e16
4
public static Cell[] calculateCells(BigInteger biNumber){ List<? super Cell> cellList = new ArrayList<>(); BigInteger leftNumber = biNumber; Cell cell; BigInteger base = BigInteger.valueOf(Piece.values().length + 2); while(leftNumber.intValue() > 0){ ...
4b6c03ac-ec6b-453d-bb8d-0986eda0136d
9
public int compare(Object item, Object otherItem) { if ((item instanceof Map) && (otherItem instanceof Map)) { if (validateStringStringMap(item) && validateStringStringMap(otherItem)) { Map<String, String> a = (Map<String, String>) item; Map<String, String> b = (Map<S...
53bb0d5c-6478-4736-9d30-f23848c06e93
6
public MethodNode parseMethodNode() throws ParserException, IOException, LexerException { Token token = this.nextToken(); if (token == null) return null; if (token.getType() == TokenType.ID) { String selector = token.getValue(); String[] locals = this.parseLocalNames(); Node expr = this.parseExpr...
3b7302df-ed28-46d9-a6c9-42b9481bbc89
7
final void method1107(int i, int i_199_, int i_200_, int i_201_) { if ((i_200_ ^ 0xffffffff) != -1) { int i_202_ = Class70.sineTable[i_200_]; int i_203_ = Class70.cosineTable[i_200_]; for (int i_204_ = 0; i_204_ < ((Model) this).vertices; i_204_++) { int i_205_ = ((i_203_ * ((Model) this).ver...
110d35a6-0781-4d6b-938f-df89a1057810
5
public static byte[] stringToByteArray(String s) { java.util.Vector<Integer> v = new java.util.Vector<Integer>(); String operate = new String(s); operate = operate.replaceAll(" ", ""); operate = operate.replaceAll("\t", ""); operate = operate.replaceAll("\n", ""); if (operate.endsWith(";")) operate = ope...
651b9bd5-69b6-474a-978c-0cfb6aedd8d2
0
public void setI(int num) { i = num; }
4ca54191-e9a6-450e-8178-4bd5b03c7ea7
2
public void onCommandHelp(ChunkyCommandEvent event) { if (event.isCancelled()) return; Language.CMD_HELP.help(event.getSender(), event.getCommand().getChatName(), event.getCommand().getAliasesAsString()); for (String helpLine : event.getCommand().getHelpLines()) { event.getSender().s...
52db2db1-8d50-450e-8b28-217e8a19792a
7
public static String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String string = Double.toString(d); if (string.indexOf('.') > 0 && string.indexOf('e') < 0 && ...
2abde786-1e8d-4511-8605-36168503da81
4
public Population rouletteWheel(Population pop, int outSize){ Individual [] subset = new Individual[outSize]; double[] maxFitScores = new double[pop.population.size()]; double populationFitness = pop.calculateTotalFitness(); for (int i = 0; i<pop.population.size(); i++){ maxFitScor...
ee6d8832-e932-423e-90e0-52bb09f1aaf9
9
public static void main(String[] args) { for (Storage storage : storages.values()) { try { storage.load(); } catch (Exception e) { e.printStackTrace(); } } printHelp(); while (scanner.hasNextLine()) { Strin...
8d3b5ef7-03e7-407e-8841-9599d51158ca
6
public Settlement getNearestSettlement(Player owner, int radius) { if (radius <= 0) radius = INFINITY; Map map = getGame().getMap(); for (Tile t : map.getCircleTiles(this, true, radius)) { if (t == this) continue; Settlement settlement = t.getSettlement(); if ...
94a424f1-d92a-4af1-a2b6-9d969bdcc89a
6
private boolean valide(Point point, boolean[][] marker) { if (point.x < 0 || point.x >= map.getWidth()) return false; if (point.y < 0 || point.y >= map.getHeight()) return false; if (map.getMap()[point.x][point.y].isWall()) return false; if (marker[point.x][point.y]) return false; return true; }
82d855cb-605e-463c-81b1-8a3ddc4cedf7
6
@EventHandler protected void onPlayerQuit(PlayerQuitEvent event) { Player player = event.getPlayer(); ScavDuelsPlayer dPlayer2 = ScavDuels.scavDuelsPlayer.get(player.getName()); if (dPlayer2 != null && dPlayer2.isDueling) { Arena arena = null; for (Arena tempArena : A...
dc8046fe-397f-4f40-bef4-1feb361082bf
8
private void captureLineInMap(int x1, int y1, int x2, int y2) { int x, y, temp; if (x1 == x2) { if (y1 > y2) { temp = x1; x1 = x2; x2 = temp; temp = y1; y1 = y2; y2 = temp; } for (y = y1; y <= y2; y++) simulator.map.cells[x1][simulator.map.size - y] = Map.CELL_CAPTURED; } e...
e1082c26-2ce4-4e14-b4ab-d7d8063a27e8
7
public int readB(int bits){ int ret; int m=32-bits; bits+=endbit; if(endbyte+4>=storage){ /* not the main path */ ret=-1; if(endbyte*8+bits>storage*8){ ptr+=bits/8; endbyte+=bits/8; endbit=bits&7; return (ret); } } ret=(buffer[ptr]&0xff)...
4c5a5de8-e017-4ad3-a892-9377e3f8c0da
4
public void onVideoPicture(IVideoPictureEvent event) { if (event.getStreamIndex() != mVideoStreamIndex) { // if the selected video stream id is not yet set, go ahead an // select this lucky video stream if (mVideoStreamIndex == -1) mVideoStreamIndex = event.g...
edbc21e0-ed44-4886-828c-51b041241b2b
1
private void dinnerTime() { lastSecond = true; timer = new Timer(ARE_EATABLES, this); timer.start(); for (Phantom phantom : phantoms) { phantom.setIsEatable(true); } }
0bd0e795-f166-42c8-8861-18d2264fe675
6
public static float[] createFace( Face direction, float x, float y, float z ) { float[] points = null; // the point's we'll send back // these make the far (positive) spaces easier to reach float xp = x + 1; float yp = y + 1; float zp = z + 1; switch ( direction ) ...
c433fe19-04d9-4e31-b4df-9596d9eab189
8
public HashSet<ArrayList<String>> First(int k, String a){ if(m_lastFirstK==k && m_allFirstK!=null){ return m_allFirstK.get(a); } if(m_terminals.contains(a)){ HashSet<ArrayList<String>> res = new HashSet<ArrayList<String>>(); ArrayList<String>...