method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
679f8e01-f8c7-46ff-8523-df1db80999ce
6
public void read(){ try { FileInputStream fis1; fis1 = new FileInputStream("Datas/AccountPO.out"); FileInputStream fis2 = new FileInputStream("Datas/CollectionOrPaymentPO.out") ; FileInputStream fis3 = new FileInputStream("Datas/CashPO.out"); if(fis1.available()>0 ){ ObjectInputStream oin1 ; ...
25fe3c9d-db31-47ce-8179-6c0d6a6048ca
4
public void actionPerformed(ActionEvent ae) { double x = 0.0, y = 0.0; Double d; try { d = new Double(eastings.getText()); x = d.doubleValue(); } catch (NumberFormatException nfe) { eastings.setText("0"); x = 0.0; } try { d = new Double(northings.getText()); y = d.doubleValue(); } catc...
8f75c8be-c786-49ba-9eea-211ca2eb43a9
5
public void dropCourseFromAll(String course) { if (root == null) { System.out.println("Roster is empty, can't drop course " + course); return; } Queue<StudentNode> queue = new LinkedList<StudentNode>(); queue.add(root); while (queue.size() != 0) { StudentNode temp = queue.remove(); if (temp.cou...
475cf0da-9510-48b5-af7d-7026da5c571e
6
public void run() { int counter = 0; while (!maze.allRatsOnTarget() && counter < maze.getMaxSimulationStep()) { for (MazeRat rat : maze.getRats()) { if (!maze.isRatOnTarget(rat)) rat.performStep(); } mazePanel.repaint(); try { Thread.sleep(100); } catch (InterruptedExcepti...
051774f6-aa4a-4283-909f-8d7855188d68
7
@Override public <Y> Y convert(IntNode node, Class<Y> cls) { if (Object.class.equals(cls) || Number.class.equals(cls)) { cls = (Class<Y>) Long.class; } else if (cls.isPrimitive()) { cls = (Class<Y>) WRAPPERS.get((Class<? extends Number>) cls); if (cls == null) { ...
eb260d74-d01d-4db7-a51c-6f28568f4d4d
1
@Override public void run() { if(!EntityConcentrationMap.isRunning()) mPlugin.runGroups(false); }
5a11917b-c21f-40c0-a29c-70e4663baf97
9
protected void closeStatements(String Closer) { try { if(!Closer.equals("")) { if(myStatement!=null) { lastSQL=Closer; lastQueryTime=System.currentTimeMillis(); myStatement.executeUpdate(Closer); } } if(myResultSet!=null) { myResultSet.close(); myResultSet=null; ...
953cf4f7-1b8d-498f-ae9b-b176954639f5
8
public void test_collapseZeroGap() { initRand(); int numMarkers = 20; Chromosome chr = genome.getChromosome("1"); for (int num = 1; num < 1000; num++) { // Create markers Tuple<Markers, Markers> tupleMarkers = createMarkers(chr, numMarkers); Markers markersOri = tupleMarkers.first; Markers markersC...
ef5a0c43-c2b2-44bd-9741-8f0254f7e6c6
1
public void testRemoveBadIndex2() { Converter[] array = new Converter[] { c1, c2, c3, c4, }; ConverterSet set = new ConverterSet(array); try { set.remove(-1, null); fail(); } catch (IndexOutOfBoundsException ex) {} assertEquals(4, set.s...
c5ffa39e-baa0-4c32-9261-cf7c262d4aa8
4
public static void main(String[] args) { int width = 20; int height = width; Node[][] grid = new Node[width + 1][height + 1]; for (int y = 0; y <= height; y++) { for (int x = 0; x <= width; x++) { Node left = null; Node above = null; if (x > 0) { left = grid[x - 1][y]; } if (y > 0) ...
4649a78b-969e-4a50-9c41-55b55c46b533
6
public Grid(int x, int y){ boolean test = false; if (test || m_test) { System.out.println("Grid :: Grid() BEGIN"); } setGrid(new Game.PlayerTurn[x][y]); for (int i = 0; i < x; i++) { for (int j = 0; j < y; j++) { setCoordinate(new Coordinate(i, j, Game.PlayerTurn.NONE)); if ...
a0c7f08a-a21a-4a37-9cf7-4c7d0de93e8a
1
private void adjustVolume(IAudioSamplesEvent event) { ShortBuffer buffer = event.getAudioSamples().getByteBuffer().asShortBuffer(); for (int i = 0; i < buffer.limit(); ++i) { buffer.put(i, (short) (buffer.get(i) * volumeScale)); } }
c1f85917-7891-40c2-add1-1fab90079bce
4
@Override public MoveResult makeMove(HantoPieceType pieceType, HantoCoordinate from, HantoCoordinate to) throws HantoException { MoveResult result; HantoPlayerColor color; // use copy constructor on given HantoCoordinates PieceCoordinate newFrom = from == null? null : new PieceCoordinate(from); PieceC...
f9706650-322f-4f60-abc4-6b6d5fb9fafe
5
public void initGraphicData() { final int W = 200; final int H = 100; boolean changed = false; int x = 10; int y = 10; if (x < 0) x = 0; if (y < 0) y = 0; for (int i = 0; i < nodeList.size(); i++) { y = y + H + 10; Rectangle rect = new Rectangle(x, y, W, H); circles.addElement(rect); drawing...
a07872f6-4195-407e-a74c-9dc0bd718564
9
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out=response.getWriter(); Map params=request.getParameterMap(); boolean show=false; String env="ppe"; Strin...
f6183fce-5b8c-4cf5-82a9-e92804c997ee
8
public Set<Map.Entry<Short,Byte>> entrySet() { return new AbstractSet<Map.Entry<Short,Byte>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TShortByteMapDecorator.this.isEmpty(); } publ...
057718a7-4374-4fec-a9e0-66c12a0b829e
2
public WindowsRegistry(boolean user) { if (!Platform.isWindows()) { throw new IllegalStateException("Only avaliable on a Windows platform"); } if (user) { mRoot = Preferences.userRoot(); mRootKey = Integer.valueOf(0x80000001); } else { mRoot = Preferences.systemRoot(); mRootKey = Integer.valueOf(...
0b98fd30-1c4a-4931-b6b9-59ffe1b5583d
6
@Override public void run() { SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM HH:mm"); do { try { trayIcon.setToolTip("Busy..."); trayIcon.setImage(imageBusy); TemperatureStatus t=controller.invoke(); t.save(orm); trayIcon.setToolTip("Last sample: " ...
24df805e-7cc3-4d2b-97db-14fe4222c346
6
@Override public void setValueAt(Object aValue, int rowIndex, int columnIndex) { Customer customer = customers.get(rowIndex); switch (columnIndex) { case 0: customer.setId((Long) aValue); break; case 1: customer.setFirstname((String) aValue); break; case 2: customer.setLastname((String) a...
46807ee2-b9b0-469d-9cb0-569854a8f840
7
@Override public void rightMultiply(IMatrix other) { // TODO Auto-generated method stub for(int i=0;i<4;i++) for(int j=0;j<4;j++) copy[i][j]=0; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { for (int k = 0; k < 4; k++) { copy[i][j]=copy[i][j] + this.get(k, i) * other.get(j, k); ...
cefa6f80-69d4-447d-ab29-6582f2e4bec0
6
public void keyPressed(int k) { if(player.getMovable()){ if(k == KeyEvent.VK_LEFT) player.setLeft(true); if(k == KeyEvent.VK_RIGHT) player.setRight(true); if(k == KeyEvent.VK_W) player.setJumping(true); if(k == KeyEvent.VK_R) player.setScratching(); if(k == KeyEvent.VK_F) player.setFiring(); } }
457b6037-d2f4-4be5-9102-5b8b441eba95
8
@Override public double calculateJuliaWithoutPeriodicity(Complex pixel) { iterations = 0; Complex tempz2 = new Complex(init_val2.getPixel(pixel)); Complex[] complex = new Complex[3]; complex[0] = new Complex(pixel);//z complex[1] = new Complex(seed);//c comp...
b48aa3b7-d0e8-4660-a1ee-7a148c92fd45
1
public String testStartLocal(String appKey, String userKey, String testId) { try { appKey = URLEncoder.encode(appKey, "UTF-8"); userKey = URLEncoder.encode(userKey, "UTF-8"); testId = URLEncoder.encode(testId, "UTF-8"); } catch (UnsupportedEncodingException e) { ...
e0185336-5bca-48dc-819f-b942f9526df4
0
public void setTitle(String title) { this.title = title; }
17291b14-dfc5-4f49-9835-c040bed78486
6
public Document createDocument(final List<Student> students) { Document doc = null; try { final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(true); final DocumentBuilder db = dbf.newDocumentBuilder(); doc = db.newDocument(); final Element root = doc.createElem...
d3d13ab2-8d4a-496e-bb8a-e19b3a329b98
2
private final void split() { if (isLeaf()) { int hw = mWidth / 2; int hh = mHeight / 2; mNorthWest = new Node<>(mX, mY, hw, hh, mMaxCapacity); mNorthEast = new Node<>(mX + hw, mY, mWidth - hw, hh, mMaxCapacity); mSouthWest = new Node<>(mX, mY + hh, hw, mHeight - hh, mMaxCapacity); mSouthEast ...
f083aab6-53d6-409a-b594-95404f153ee4
4
private boolean hasAppropriateFirstTerminal() { return peekTypeMatches("ID") || peekTypeMatches("LPAREN") || peekTypeMatches("INTLIT") || peekTypeMatches("STRLIT") || peekTypeMatches("NIL"); }
e62c1f62-1443-49ba-be41-00ee80ca42bd
1
@Override protected void paint(Graphics2D g2) { if (debug) { paintDebuggingFrame(g2); } super.paint(g2); }
60068523-68ff-4460-b2ad-2d80675eda72
9
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Jump other = (Jump) obj; if (captureX != other.captureX) { return false; } if (captureY != other.captureY) {...
4af626d9-f645-497b-8f90-22bd9b1eb1f5
8
public static void restoreGODatabase(){ for (File file: new File("C:/Users/hgabr/Desktop/go_201207-assocdb-tables").listFiles()){ if (file.getName().indexOf(".sql") > 0){ try { Process process = Runtime.getRuntime().exec("cmd /c mysql -u root go < " + "c:\\Users\\hgabr\\Desktop\\go_201207-assocdb-tables\\...
b74a45b3-71b5-43b5-8ac4-49c337a591d2
2
public Message<?> debug(Message<?> message) { StringBuilder builder = new StringBuilder(); builder.append("\n############################## DEBUG HOOK ##############################\n"); builder.append("Payload:"+message.getPayload()+"\n"); builder.append("Headers:"+message.getHeaders(...
b2d05c47-9a9c-4b56-bc3b-8fd1d7c06e1f
1
private void registerJobs(){ List<String> list =getJobsConf().getStringList("enabled-jobs"); for(String job : list){ registerJob(job); } }
cad5a14e-ae17-4d78-84f6-4e143a4c9339
1
public void setSelected(TreeNode node, boolean select) { if (select) selectedNodes.put(node, null); else selectedNodes.remove(node); }
9885296e-86a6-45ce-99c1-05ad34b1359b
8
public static void main(String args[]) throws Throwable{ BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); for(int t=0,T=parseInt(in.readLine().trim());t++<T;){ int N=parseInt(in.readLine().trim()); int arr[][]=new int[N][2]; long s1=0,s3=0; ...
72742956-c9a6-469f-9c40-8442bed30f94
3
@Override public void addUser(User user) throws SQLException { Session session=null; try{ session=HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.save(user); session.getTransaction().commit(); }catch(Exception e){ e.printStackTrace(); }finally{ if(session!...
ecbca877-399a-4f82-be39-bc7e8bd94eb7
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...
bb477071-786b-4058-9e4e-bb4a67fdc4d5
4
public JPanel createSettings() { JPanel settings = new JPanel(); settings.setLayout(new GridBagLayout()); settings.setBackground(new Color(255, 231, 186)); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(5,5,5,5); JLabel set = new JLabel("Settings"); ...
de99eada-d200-4be2-b889-cdcec67da778
8
protected PseudoSequencePair getLastInstanceOfPrefixSequenceNEW(List<Itemset> prefix, int i){ int remainingToMatchFromPrefix = i; List<Position> listPositions = new ArrayList<Position>(); int prefixItemsetPosition = prefix.size() -1; // for each itemset of sequence for(int j = size() -1; j>=0; j--){...
df80a8ca-57bf-4d59-b4e8-96b4b81ace5a
2
public static void main(String[] args) throws UnknownHostException, SocketException{ Enumeration e = NetworkInterface.getNetworkInterfaces(); while (e.hasMoreElements()) { NetworkInterface n = (NetworkInterface) e.nextElement(); Enumeration ee = n.getInetAddresses(); while(ee.hasMoreElements()) { ...
50efc7ec-b1bf-4b4e-876d-6bbc86d5735a
2
public List<Endereco> listarTodos(int idPessoa){ try{ PreparedStatement comando = banco.getConexao() .prepareStatement("SELECT * FROM enderecos WHERE id_pessoa = ? " + "AND ativo = 1"); comando.setInt(1, idPessoa); ResultSet consulta = ...
14f4a2d8-1bf6-4674-b8ea-2bbc4d16d28b
3
public void shiftLeft(boolean isJump){ reDrawIndex = reDrawIndex - 5; if(reDrawIndex < 0){ reDrawIndex = files.size() + reDrawIndex; } if(isJump){ listPosition = listPosition - 5; if(listPosition < 0){ listPosition = files.size() + listPosition; } } }
c3af5aa4-7fba-4af6-8860-60b891773cc2
8
public int insert(List<DBRow> rows) throws Exception{ File table = new File("Databases/" + name + ".xml"); if(!table.exists()) throw new Exception("The table " + name + " doesn't exist."); SAXBuilder builder = new SAXBuilder(); Document document = null; try { document = (Document) builder.build...
0dd1d3d1-d5c4-48fe-9e2f-b45ca4de29aa
2
public RQHTTPHandler(RemoteQuery plugin, RQSchedulerHandler schedHandler) { this.plugin = plugin; this.schedHandler = schedHandler; try { cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); // must match with remote PHP scripts encryption scheme } catch (NoSuchAlgorithm...
3e286404-e208-4801-b0b0-add928921872
8
public Set<Map.Entry<Double,Character>> entrySet() { return new AbstractSet<Map.Entry<Double,Character>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TDoubleCharMapDecorator.this.isEmpty(); } ...
ff7e733d-fcf1-412d-a3b5-03688282ff55
9
protected long encodeBinary(OutputStream objOut, RPCObject rpcObj) throws IOException { long byteSent = 0L; RPCBinaryObject rcpbinary = (RPCBinaryObject)rpcObj; Object val = rpcObj.getValue(); File f = null; byte[] data = null; if(val instanceof File){ f = (File) val; }else if(val instanceof String){ ...
c3057b4b-f72a-4f76-843e-c1b5dd4eb4c1
1
private void changeViewMode() { viewModeCounter++; if(viewModeCounter==4){viewModeCounter=0;} MapGetter.setMapType(viewMode[viewModeCounter]); MapGetter.getMapImage(MapGetter.createUrl(0, 0)); buttonViewMode.setText(viewMode[viewModeCounter].toUpperCase()); ...
929b0c82-1088-4546-9947-d1989f87b669
9
public void handlePacket(LoginPacket packet) { final IoBuffer buf = packet.getPayload(); switch (packet.getOpcode()) { case LoginPacket.CHECK_LOGIN: { final String name = NameUtils.formatNameForProtocol(IoBufferUtils .getRS2String(buf)); final String password = IoBufferUtils.getRS2String(buf); final...
331b1246-df08-409d-84c3-2cb1a863fd31
2
public boolean collides(Ship someShip) { for(int i = 0; i < fleet.size(); i++) { Ship ship = fleet.get(i); if(someShip.contains(ship)) return true; } return false; }
bfb9b62f-eda8-432f-814f-c994ddb75d02
4
public static final BruteParams<?>[] valuesGlobal() { final BruteParams<?>[] values_ = values(); for (int i = 0; i < values_.length; i++) { if (!values_[i].global) { values_[i] = null; } } return values_; }
5ddb4078-413d-43b7-bec1-f9d6a91ee7e9
0
public Matrix getBack() { return cam.getBack(); }
603fe14a-ac96-4f75-ba0d-5d3575f035d4
2
private void acao111() throws SemanticError { try{ IdentificadorMetodo idMetodo = pilhaMetodosAtuais.peek(); for(Identificador id : listaParametros){ IdentificadorParametro idParametro = completarIdParametro(id); idMetodo.getParametros().add(idParametro); tabela.override(idParametro, nivelAtual); ...
71dc9ec4-c193-447b-b40d-e98ed55e9f5e
6
void drawObject(Graphics g, JGObject o) { if (!o.is_suspended) { //o.prepareForFrame(); drawImage(g,(int)o.x,(int)o.y,o.getImageName(),true); try { o.paint(); } catch (JGameError ex) { exitEngine(dbgExceptionToString(ex)); } catch (Exception e) { dbgShowException(o.getName(),e); } } ...
89ccc58f-e463-4310-9b2a-3a3723a95d31
7
public String getCampoVenta(String clave, beansVentas venta){ if(clave.trim().equals("nombre")) return venta.getNombre(); if(clave.trim().equals("nick")) return venta.getNick(); if(clave.trim().equals( "precio")) return Integer.toString(venta.getPrecio()); if(clave.trim().equals("fecha")) return ven...
53f139a4-f4a3-4e8e-99d0-c75c9e81df42
1
private void toFastboot_fastbootMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_toFastboot_fastbootMenuActionPerformed try { adbController.getFastbootController().rebootDeviceFastboot(deviceManager.getSelectedFastbootDevice(), RebootTo.BOOTLOADER); } catch (IOException...
9397b6c8-cc51-4824-b9da-6aec3ac56117
3
public void play(int numGames, int numPlayer, int numCard, int itemsPerLine, boolean shuffle) { for (int i = 0; i < numGames; i++) { System.out.println("=== Game " + (i+1) + " ==="); System.out.println(); if (shuffle) { cardDeck.shuffle(); } ...
9baa37c2-643d-48f5-a236-b17cbfc15151
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(this.ID())!=null) { mob.tell(target,null,null,L("<S-NAME> <S-IS-...
4756ae04-c491-4985-ab97-df38e31c0e62
6
public Cuboid getFace(CuboidDirection dir) { switch (dir) { case Down: return new Cuboid(this.worldName, this.x1, this.y1, this.z1, this.x2, this.y1, this.z2); case Up: return new Cuboid(this.worldName, this.x1, this.y2, thi...
442def50-092e-4edd-b06e-1ebc38f376ce
4
public static void OrdiVsOrdi(Parametre param){ // Faire des statistiques sur plusieurs parties Ligne ligneOrdi1 = new Ligne(param, true); Ligne ligneOrdi2 = new Ligne(param, false); LigneMarqueur liMarq = new LigneMarqueur(param.getTailleLigne()); String esp = ...
30ed62f8-0d00-44ab-9274-3f4303a6da8e
8
public FenetreVisualiserRaster(){ //maintenant la fenêtre de visualisation this.setLocationRelativeTo(null); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.setTitle("Visualisation de Raster"); this.setSize(500, 240); // this.connexion=connexion; if(FenetreVisualiserRaster.nomShape1.size(...
cc6397f4-1ca3-4d5a-b2b7-8ec4d6541ba6
9
private RepositoryConfig createRepositoryConfig(Properties properties) throws MojoExecutionException{ String driverClass = this.databaseDriverClass; String username = this.databaseUsername; String password = this.databasePassword; String url = this.databaseUrl; if (Strings.isNullOrEmpty(driverClass) && ...
86954a0c-9b78-47b7-b502-33ff42c1b405
8
public CloudController(String componentName, Config config, InputStream userRequestStream, PrintStream userResponseStream) { this.componentName = componentName; this.controllerConfig = config; this.userRequestStream = userRequestStream; this.userResponseStream = userResponseStream; /* * Initialize the use...
51d70f00-d459-4599-9357-ee1dcd498529
7
public Object[][] bacaDaftar(){ boolean adaKesalahan = false; Connection cn = null; Object[][] daftarPembeli = new Object[0][0]; try{ Class.forName(Koneksi.driver); } catch (Exception ex){ adaKesalahan = true; JOptionPane.showMessageDialog(null...
2aeddf48-dff4-49f1-b5f7-6c83795d7b51
1
public void setK(double K) { assert K >= 0 && K <= 1; this.K = K; }
9b554fa6-0fc4-40ab-b1c4-aa0f015b6f9f
3
public void drawGridLines(Graphics g) { if (gridLines) { g.setColor(new Color(0, 0, 200)); for (int i = 0; i < GameConstants.HEIGHT; i++) { g.drawLine((finalFormatX + padding) - (wallSize / 2), i * wallSize + padding + finalFormatY, (finalFormatX + padding) + wallSize * GameConstants.WID...
c275fb41-3c71-4567-b237-d0ea99eee9c2
3
private void setBreakableLines() { for (int i = 0; i < program.size(); i++) { if (program.getCode(i).getClass() == LineCode.class && ((LineCode) program. getCode(i)). getLineNumber() > 0) { source...
2f02535e-0452-477a-871e-b664ef7b670b
7
private List<PhaseField> getPhasesStatuses(DaySchedule daySchedule, List<TaskRow> tasksData) { List<PhaseField> tmpPhaseFields = new ArrayList<PhaseField>(); String prevProjectName = tasksData.get(0).getProjectName(); String prevPhaseName = tasksData.get(0).getPhaseName(); int phaseStatus = 0; int row =...
166777ec-8ae1-4a31-ba8c-fb2256b5d0c0
7
private byte[] readInputStreamSlowMode(InputStream is) { boolean lastByteWasReturnByte = false; ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { while (true) { int intB = is.read(); byte b = (byte) intB; /** * prevent OutOfMemory exceptions, per leopoldkot */ if (intB ...
7094f689-8dcc-45a9-8235-f328034a2b38
3
public static Node transplant(Node root,Node u, Node v){ if(u.p == null){ root = v; } else if(u == u.p.left) u.p.left = v; else u.p.right = v; if(v != null) v.p = u.p; return root; }
aa60fe67-322d-4276-8160-a02abe66bb9c
7
public String truncate(String string, int maxLength) { if(null == string) return null; if(_trimFirst) { string = string.trim(); } if(_compressWhiteSpace) { string = string.replaceAll("\\s{2,}", " "); } ...
2076046b-452b-46e5-9db3-b3244363234f
5
private void updateVersion(Object[] args) throws CacheUnreachableException { List<VersionUpdateDefinition> updates = cacheDefinitionCollection.getVersionUpdateDefinitions(); if (updates == null) { return; } // 根据cacheDefinitionCollection中配置的所有更新版本操作,循环调用,更新版本号 for (VersionUpdateDefinition definition : upd...
0b093d33-eb68-4d66-98af-b00180b32b57
3
protected void fireReceiveDataEvent(ReceiveDataOnServerEvent evt) { if (receiveDataOnServerListenerList != null) { Object[] listeners = receiveDataOnServerListenerList.getListenerList(); for (int i=0; i<listeners.length; i+=2) { if (listeners[i]==ReceiveDataOnServerListener.class) { ((...
ee47201d-a4e1-4a44-b352-055acf72f16f
4
private int findMinIndex( ) { int i; int minIndex; for( i = 0; theTrees[ i ] == null; i++ ) ; for( minIndex = i; i < theTrees.length; i++ ) if( theTrees[ i ] != null && theTrees[ i ].element.compareTo( theTrees[ minIndex ].element ) < 0 ) minIndex = i; ...
3d5b2cf1-6c16-482e-85b8-a036294a875c
2
private void clean() { for(int i=0; i<mapHeight; i++) for(int j=0; j<mapWidth; j++) { buttons[i][j].setText(""); buttons[i][j].setBackground(Color.WHITE); } }
a1f5a782-4736-451e-9fc7-0e344f03156e
9
@SuppressWarnings("unchecked") public static BaseJob createJob(ClassLoader classLoader, Map<String, Object> map, JQlessClient client) { try { // Guarantee "data" is a Map if (map.containsKey("data") && map.get("data") instanceof String) { try { Map<String, Object> data = JsonHelper.parseMap((String...
06fde59c-6343-409a-bc2b-5fd3620d864b
7
private void makeHouse(int y, int x, int h, int w) { for(int i=y; i<y+h; i++) { for(int j=x; j<x+w; j++) { if(i==y || j==x || i==y+h-1 || j==x+w-1) { if(i==y+h/2) tiles.get(j+i*width).switchType(2); ...
78503d89-f965-41da-b602-edaa6806cb32
4
@Override public void keyPressed(KeyEvent e) { if(e.getKeyCode()== KeyEvent.VK_LEFT){ if(mainMenuShowing==false){ showPreviousSlide(); } } if(e.getKeyCode()== KeyEvent.VK_RIGHT){ if(mainMenuShowing==false){ showNextSlide(); } } }
a6c5726d-e9f0-4a33-b186-1cecc7167da7
9
private boolean areEqual(String string1, String string2) { if (string1 == "") string1 = null; if (string2 == "") string2 = null; if ((string1 == null && string2 != null) || (string1 != null && string2 == null)) { return false; } else if (string1 != null && string2 != null && !string1.equalsI...
1dc8187b-081a-43a1-9c67-df34ae6a9bab
4
@SuppressWarnings({ "rawtypes", "unchecked" }) private static File[] createFileArray(final BufferedReader bReader, final PrintStream out) { try { java.util.List list = new java.util.ArrayList(); java.lang.String line = null; while ((line = bReader.readLine()) != null) { ...
7e9dee44-f5ec-4485-b0a4-36b910cac383
6
public void step(boolean blockStep) { Configuration[] configs = configurations.getValidConfigurations(); ArrayList list = new ArrayList(); HashSet reject = new HashSet(); // Clear out old states. configurations.clearThawed(); if (!blockStep){ //for ordinary automaton for (int i = 0; i < ...
72e5a0cf-0018-4366-a626-73bc5a1e7830
1
public void heapSort() { // decreasing order, since this is maxHeap for (int i = 0; i < heap.size(); i++) { BTPosition<T> tmp = remove(); System.out.println("Removed: " + tmp.element()); } }
af9c767c-9ed8-4084-8baa-9f4dc06a260f
7
private boolean castlingPossible(final boolean kingside) { // First check whether castling is generally allowed in this position. boolean result = this.getPos().isCastlingAvailable(kingside, this.getColor()); if (result) { // Castling to the specified side is generall...
3000e4a0-c2c5-47cc-93f2-ee850395607e
7
@EventHandler(priority = EventPriority.NORMAL) public void onInteract(PlayerInteractEvent e) { Player player = e.getPlayer(); if (e.getAction() == Action.RIGHT_CLICK_BLOCK) { if (e.getClickedBlock().getState() instanceof Sign) { Sign s = (Sign) e.getClickedBlock().getState(); if (s.getLine(0).eq...
fe8d918e-a0d6-4e0d-ae62-1bb325439e5b
9
public boolean begin() { try { //Sanity check if(filename == null || filename.isEmpty()) { throw new Exception("File name must be set"); } //Ready the output writer Charset charset = Charset.forName("UTF-8"); bW...
cbf19ae2-39b9-4784-ada1-77e9bac529ec
5
public String getParameterString(){ String retString = super.getParameterString(); try{ if(sourceText!=null) retString+="&sourceText="+sourceText; if(cQuery!=null) retString+="&cquery="+URLEncoder.encode(cQuery,"UTF-8"); if(xPath!=null) retString+="&xpath="+URLEncoder.encode(xPath,"UTF-8"); if(baseUrl!=...
2efae354-2f68-4196-b61b-a67f2450aba5
8
public void sanityCheck() { if (DEBUG) { System.out.print(this); int[] widthsCheck = new int[height]; int maxHeightCheck =0; for(int i =0; i< width;i++){ int heightCheck = 0; for(int j =0; j< height;j++){ if(grid[i][j]) { heightCheck = j+1; widthsCheck[j]++; if(maxHe...
ff8e6d8a-936e-4df0-bda2-fdc6b4faef25
6
@EventHandler public void IronGolemWeakness(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.getIronGolemConfig().getDouble("IronGol...
98b2817b-2503-4e49-a256-ac7a4e0a2911
9
@Override public void unInvoke() { // undo the affects of this spell final Environmental E=affected; if(E==null) return; super.unInvoke(); if(canBeUninvoked()) { if(E instanceof MOB) { final MOB mob=(MOB)E; mob.tell(L("You are no longer soiled.")); final MOB following=((MOB)E).amFollo...
c60d8d6f-3261-4649-94b4-c22d3f47cbbf
0
public String getDefault_() { return default_; }
788a1498-8b80-4391-8af5-8671069147fb
4
public static Class<?> getInterfaceGenericType(Class<?> clazz) { Type genericType = clazz.getGenericInterfaces()[0]; Class<?>[] classes = getActualClass(genericType); if (classes.length == 0) { return null; } else { return classes[0]; } }
4a142013-a326-48a5-99c8-5690c31a0b90
8
public NetWork(int inputPopulation, int middlePopulation, int outputPopulation, double learningRate, double momentum) { _inputz = new InputNode[inputPopulation]; for (int ii = 0; ii < _inputz.length; ii++) { _inputz[ii] = new InputNode(); } _middlez = new MiddleNode[middlePopulation]; for (in...
2b0a1c62-a619-46be-a0b7-f2e93703c8ea
7
int parseInt(String s) throws NumberFormatException { int radix; int i; if( s.startsWith("0x") || s.startsWith("0X") ) { radix = 16; i = 2; } else if( s.startsWith("0") && s.length() > 1 ) { ...
ef2c84c7-2e72-45e5-bc3c-0a330ac2dee9
2
private void putCardInFromStack() { if(cardStackFrom != null && card != null) { cardStackFrom.addCardRandomly(card); cardStackFromPanel.setCurrentCount(cardStackFrom.getCount()); card = null; } }
7f022052-132b-4fd7-b09f-cd00aef1a899
6
@EventHandler public void PigZombieStrength(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.getPigZombieConfig().getDouble("PigZomb...
f4cc526b-ca72-4278-a4e5-69d9fefd102c
1
private Window() { // Sets the title for this frame. this.setTitle("Race Car Game"); // Sets size of the frame, checks for full screen if (false) // Full screen mode { // Disables decorations for this frame. this.setUndecorated(true); // Puts ...
c15a6d94-95f3-46df-ac1c-aba06695739c
3
private void startCollectionSelection() { ImageButton editCollection = new ImageButton(parent, "Edit collection", ((int) posX + 85), ((int) posY + 150), 100, 25, 1) { @Override public void onMousePress(int x, int y) { if (collectionSelected) { editingCollection = true; stopEditingCollection()...
abd49335-29a5-493e-b44f-1204c4c53cfb
3
private static float sqrt(int n){ float l = 0; float r = n; while(l<r){ float mid = l + (r-l)/2; float curr = mid*mid; if(curr < n){ l=(float) (mid+0.001); } else if (curr == n) { return mid; } else { r=(float) (mid-0.001); } } return l; }
63c5feb5-b257-46ff-b1f2-f39c9e5ec538
0
public Laptop(FabrykaPodzespolowLaptop fabrykaPodzespolowLaptop){ this.fabrykaPodzespolowLaptop = fabrykaPodzespolowLaptop; skladanie(); }
9c695015-5ab2-442f-8739-cce76109c72f
4
public boolean addAll(SimpleSet<? extends E> s) { Iterator<? extends E> itr = s.iterator(); int temp = set.size(); while (itr.hasNext()) { add(itr.next()); } if(set.size()==temp){ return false; } return true; }
94ebea13-7b74-4fec-bb17-e74d3e978849
2
public void setFinal(final boolean flag) { if (this.isDeleted) { final String s = "Cannot change a field once it has been marked " + "for deletion"; throw new IllegalStateException(s); } int modifiers = fieldInfo.modifiers(); if (flag) { modifiers |= Modifiers.FINAL; } else { modifiers &= ~...
374db6c1-5a38-45af-ab8a-dc689a1073cb
7
static double incompleteBetaFraction2(double a, double b, double x) throws ArithmeticException { double xk, pk, pkm1, pkm2, qk, qkm1, qkm2; double k1, k2, k3, k4, k5, k6, k7, k8; double r, t, ans, z, thresh; int n; k1 = a; k2 = b - 1.0; k3 = a; k4 = a + 1...