method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
61cc583f-03be-468b-aad7-cf91c8e657e2
0
public void setInitialResizePoint(Point initialResizePoint) { this.initialResizePoint = initialResizePoint; }
7df58b6a-feac-43fd-8961-c54fe3ada271
9
private ArrayList<String> createPrintables() { ArrayList<String> printables = new ArrayList<String>(); // Title printables.add("Graph: " + numNodes + " nodes"); String separationLine = ""; for (int i = 0; i <= 2 * numNodes; i++) separationLine += "-"; printables.add(separationLine); // Matrix for (...
dbc50b8f-1fc0-43c4-8a02-fea10f96d0c9
2
private void deviceListComboBoxItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_deviceListComboBoxItemStateChanged //this gets triggered whenever the list of items is changed, like when refreshing //don't do anything then if (!refreshing && evt.getStateChange() == java.awt.event...
3f1abd8d-4047-4a23-bcf9-59e243808966
6
private boolean isTrueSNP(VariantCandidate v) { if (v.val("max.qual.minor") >= 58.341 && v.val("max.qual.major") >= 46.184 && v.val("total.depth") < 47.256) { return true; } else if(v.val("max.qual.minor") <= 58.933 || v.val("max.qual.major") < 48.921 || v.val("total.depth") >= 63.330) { ...
feae2cbc-bd3c-49b8-b0a8-c7fdd9aca790
0
@SuppressWarnings("unused") @Pointcut("execution(public String demo.spring.aop..*(..))") //public 戻りString demoサブ階層 doが含まれるメソッド名 private void anyPublicOperation() {}
bb45f947-67e2-4332-bb16-b5fc8359d87d
2
public void destroy() { if (frames == null) return; for (ZFrame f : frames) { f.destroy(); } frames.clear(); frames = null; }
54892e9d-e6da-4b0b-b7df-335e8640263f
9
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((brandName == null) ? 0 : brandName.hashCode()); result = prime * result + ((originalPrice == null) ? 0 : originalPrice.hashCode()); result = prime * result + ((percentOff == nu...
08f680cf-6354-4a2b-bf1f-59299c5a74e3
9
public MOB determineMonster(MOB caster, int level) { final MOB newMOB=CMClass.getMOB("GenMOB"); newMOB.basePhyStats().setAbility(7); newMOB.basePhyStats().setLevel(level); newMOB.basePhyStats().setRejuv(PhyStats.NO_REJUV); newMOB.baseCharStats().setStat(CharStats.STAT_GENDER,'M'); final int choice=CMLib.d...
df79dffc-aa17-4674-8813-8979c0593ebe
0
public void setFunCedula(long funCedula) { this.funCedula = funCedula; }
b8d15926-1f8f-42af-8159-776767a20abd
0
public int size()//Accessor method { return manyItems; }
f2c7e50e-5697-445d-9400-d53a6c3d2af7
2
@Override public void fire() { InviteMessage msg = new InviteMessage(); refreshCounter--; if(refreshCounter <= 0) { ((Antenna) this.node).resetNeighborhood(); msg.requireSubscription = true; refreshCounter = refreshRate; // reset the counter } this.node.broadcast(msg); double time = dist.nextSa...
cf145a5d-d75d-42bd-8291-15252b7bb9c9
6
public ArrayList<Meeting> getAllMeetingsFromDatabase(){ ArrayList<Meeting> meetings = new ArrayList<>(); ArrayList<HashMap<String, String>> meetings_raw = mySQLQuery.getAllRows("Meeting"); for(HashMap<String, String> meeting_raw : meetings_raw){ int meetingID = Integer.parseInt(meet...
41691439-8125-4406-8f63-3f5cd1d7366c
2
public static void main(String[] args) { System.out.println("Enter number of dice to toss"); Scanner s = new Scanner(System.in); int diceCount = s.nextInt(); SevenTally t = new SevenTally(diceCount); int experiments = 1000000; // int experiments = 1; int wins = 0; for(int j = 0...
fb5570ca-6e61-4cb1-87bd-5e8c6ed00223
0
private BaseDO makeObjectPersistent(final BaseDO baseDO) { return getEntityManager().merge(baseDO); }
916b6e56-ab58-4797-bf67-45ef835986e1
2
public void cargarComboCargo(){ Usuario u = new Usuario(); ArrayList<String> listado = u.listarCargos(); if(listado !=null){ for (int i = 0; i < listado.size(); i++) { Cargo.addItem(listado.get(i)); } ...
9c31ec03-44f9-49a2-8472-daea7692e922
2
public void wallOut() { if (mySpringies.getKey(JGEngine.KeyDown) & BoardSetup.wall_margin > 0) { for (Wall w : myBoardSetup.getWalls()) { w.remove(); } BoardSetup.changeMargin(-1* WALLCHANGE); myBoardSetup.setWalls(myEnvForces.getWallMags(), myEnvForces.getWallMags()); mySpringies.clearKey(JGEngine...
89d3b547-76c0-47e8-a6c0-a351c2c9cbfe
3
private boolean bit() throws JSONException { boolean value; try { value = this.bitreader.bit(); if (probe) { log(value ? 1 : 0); } return value; } catch (Throwable e) { throw new JSONException(e); } }
cb885f1f-41bb-40f3-9b70-c1c8aa980a66
0
public int getY() { return y; }
8bb94498-4289-4bc3-b761-92155bf7e484
6
public boolean canFall(){ // Parcours les coordonnées du jeu for(int x=0; x <= coordonneJeu.getNombreColonne()-1; x++) for(int y=0; y <= coordonneJeu.getNombreRangee()-1; y++) // Si un Tetrominoe est présent vérifie la position du desous if(!tetrominoes.get(t...
6e3325a9-6cfe-4163-99a1-a8b7387b2ca9
1
public Nodo<E> mostrarElementoAzar(){ //muestra solamente int posicionAzar = (int )(Math.random() * talla); Nodo datoEscogido = cabeza; for (int cont = 0; cont < posicionAzar; cont++) { datoEscogido = datoEscogido.siguiente; } Nodo <E> tmp2 = d...
a867bbd9-7f78-43d1-8ab1-32a8f93067fa
4
public void render(Graphics2D g) { g.setColor(new Color(0,0,0,125)); g.fillOval(colBox.x-5, colBox.y, colBox.width+5, colBox.height+5); if (dir == 2) { g.drawImage(animRight.getCurrentImage(), (int) x, (int) y, width, height, null); } else if (dir == 1) { g.drawImage(animUp.getCurrentImage(), (int) x, (...
1fb6406d-7a03-42dc-8d54-63849a36012f
0
private void jButton1MouseMouseClicked(MouseEvent event) { ChooseFrame cf = new ChooseFrame(); cf.setDefaultCloseOperation(ChooseFrame.EXIT_ON_CLOSE); cf.setTitle("ChooseOpration"); cf.getContentPane().setPreferredSize(cf.getSize()); cf.pack(); cf.setLocationRelativeTo(null); cf.setVisible(true); this.d...
77c59132-5142-48d5-967f-3aa055fa4d1f
3
public void cambiarPosicionJugado2(){ for(int x=0;x<8;x++){ for(int y=0;y<8;y++){ if(pd.mapa_jugador2[x][y].equals(codigo)) pd.mapa_jugador2[x][y]=""; } } int x=rd.nextInt(0)+7; int y=rd.nextInt(0)+7; cam...
b40876fa-150f-44b1-8914-d3e42c68b339
3
public static Boolean[] getCaseFancyMap(String strToMap) { Boolean[] map = new Boolean[strToMap.length()]; for (int i = 0; i < strToMap.length(); i++) { if (Character.isUpperCase(strToMap.charAt(i))) { map[i] = true; } else if (Character.isLowerCase(strToMap.charAt(i))) { map[i] = false; } } ...
281f6a79-5f76-4ccb-a218-bf2952214b1b
2
public LinkedHashMap<Integer, Persona> leerPersonaJAXB(String rutaFichero) { rutaFichero = rutaFichero + ".xml"; LinkedHashMap<Integer, Persona> personas = new LinkedHashMap<>(); try { JAXBContext jaxbContext = JAXBContext.newInstance(MapPersona.class); Unmarshaller jaxbU...
6e616748-0502-4f9b-ac06-813eb81a178d
2
public void filter(byte[] samples, int offset, int length) { for (int i=offset; i<offset+length; i+=2) { // update the sample short oldSample = getSample(samples, i); short newSample = (short)(oldSample + decay * delayBuffer[delayBufferPos]); setS...
756eff4b-ff7d-4e85-ae0a-d805e407c025
4
@Override public void renderControl(Graphics2D g) { if(this.isEnable()) { // create control bitmap BufferedImage Control = new BufferedImage(this.getSize().getWidth(), this.getSize().getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D g2d = (Graphics2D) Control...
a029964b-0449-4adc-a7ab-1d79e9e71e14
7
private void field_localidadFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_field_localidadFocusLost boolean es_componente=false; // voy a preguntar si la componente que me saco el foco es algun campo del panel de datos de asientos int i=0; ...
8a0ea728-0392-4f03-9324-36c14638b026
3
public boolean conflict(ValueIndexPair in) { return index1 == in.index1 || index1 == in.index2 || index2 == in.index1 || index2 == in.index2; }
1bedc33a-a43b-4069-a784-54e52ce25cea
8
private int walkthrough() { int result = 0; for (Position whiteKingPos : Position.getAllPositions()) { for (Position blackKingPos : Position.getAllPositions()) { if (whiteKingPos == blackKingPos) { continue; } for (Position blackRookPos : Position.getAllPositions()) { if (...
396160ed-5ad9-4dac-8b07-27f75f954bb8
2
public static boolean hasAlpha(final Image image) { // If buffered image, the color model is readily available if (image instanceof BufferedImage) { BufferedImage bimage = (BufferedImage) image; return bimage.getColorModel().hasAlpha(); } // Use a pixel grabber to retrieve the image's color model; // g...
cb76c972-5033-4272-a8eb-4e04a69fb8a9
6
@Test public void sequentialFigurePlacement() { FiguresPlacement figuresPlacement = new BishopsPlacement(); Set<String> boards = figuresPlacement.placeFigureOnBoard(BISHOP.getFigure(), EMPTY_BOARD_SIZE_6); assertThat("board is different", boards.contains("b.....\n" + ...
55ba2dd1-a930-445f-8df2-2c11bd85a2b5
9
@SuppressWarnings({ "rawtypes", "unchecked" }) protected int testCompareTo(Comparable o1, Comparable o2) { int res = 0; Map<String, Object> fields1 = getMineAndParentFields( ForCompareTo.class, o1); Map<String, Object> fields2 = getMineAndParentFields( ForCompareTo.class, o2); if (!isEmpty(fields1) && ...
ce5a3f07-6c33-48c4-8be9-17e8c00c051e
2
public BeeperStack(int x, int y, int beepers) { super(x, y); if (beepers < 1 && beepers != Display.INFINITY) { Debug.printWarning("Invalid amount of beepers: " + beepers + "... Setting to 1..."); beepers = 1; } numBeepers = beepers; }
3928a296-ac29-4ff2-ab45-46112b8ec259
3
public boolean isActive(int id) { if (!plugin.getConfig().getBoolean("registration.activation")) return true; Connection conn = plugin.getDbCtrl().getConnection(); PreparedStatement ps = null; ResultSet rs = null; try { String sql = String.format("SELECT `active` FROM `%s` WHERE `id` = ?", plugin...
57ef8fbc-bc98-4326-957d-08b891ab97fb
2
public void close() { loggedIn = false; if (out != null) { // And attempt to logout, but don't care if we fail try { int id = invoke("loginService", "logout", new Object[] { authToken }); join(id); } catch (IOException e) { // Ignored } } super.close(); }
a31e44c2-9715-454e-a6cd-965f001d638a
0
public DefaultSurfaceModel getModel() { return model; }
49498c0a-2c31-4b8c-a31d-394dc9012a85
0
public Sound(byte[] samples) { this.samples = samples; }
ae5806d7-515f-4e10-8ce5-ce690a801ec5
5
public Train firstComeTrain(Double humpTime){ double minTime = humpTime; int trackNo=-1; //最先來火車的火車軌道 int i=0; for(ReceivingTrack rt : receivingTrack){ if(rt.isEmpty==false && rt.existTrain.currentTime<minTime){ //track有火車且最先來 minTime = rt.existTrain.currentTime; trackNo = i; //設定最先來的火車軌道是第幾個 ...
1298f91a-5518-4523-b59d-0845eee686d6
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!PositionType.class.isAssignableFrom(obj.getClass())) return false; PositionType other = (PositionType) obj; return row == other.getRow() && col == other.getCol(); }
4bbdba6a-5a10-46a9-9bfd-1a66e6da81b4
2
public void run() { if(this.resultFilePath == null || this.resultFilePath == ""){ this.resultFilePath = createFileName(); } search(this.resultFilePath); }
2bf308f0-9919-49ac-8344-1b80cc3bca80
2
@Override public void teardownTest(JavaSamplerContext context) { super.teardownTest(context); try { if (table != null) { table.flushCommits(); table.close(); table = null ; } } catch (IOException e) { System.out.println("teardown error"); } }
8513bf74-df79-4249-8890-a085744ff561
1
public void loadConfigFiles() { try { board.loadConfigFiles(); board.calcAdjacencies(); loadPlayers(); loadCards(); board.setPlayers(players); //called here after the cards are loaded notes.setUpNotes(cards); accuse.setUpComboBoxes(cards); suggest.setUpComboBoxes(cards); } catch(BadCon...
8da03533-fbd9-4ebb-9bf9-9350f34698bb
1
public ArithmeticEncoder(BitOutputStream out) { super(); if (out == null) throw new NullPointerException(); output = out; underflow = 0; }
ceb4ec78-3496-4c76-b664-7de35f2fe6f9
8
private void getSelectedDownloads() { toDownload = new ArrayList<>(); ArrayList<Object> selections; for (int i = 0, l = table.getRowCount(); i < l; i++) { selections = table.isSelected(i); if ((boolean) selections.get(0)) { toDownload.add(new Resource(i, lectures.get(i))); //System.out.println(lectu...
57b33d79-76da-49d2-bcfb-063162c5a0a6
3
public int[] getArrayForNumberOfBreakpoints() throws IOException { FileInputStream fileInputStream = new FileInputStream(pathToFile); DataInputStream in = new DataInputStream(fileInputStream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; Stri...
78b1b999-e59a-4000-a9e1-24ca20a94626
2
public int getNumberOfSamples() { if (vcfFileIterator == null) return 0; VcfHeader vh = vcfFileIterator.getVcfHeader(); if (vh == null) return 0; return vh.getNumberOfSamples(); }
7ee1dbab-5ce3-4191-8a6f-9f202ed03509
4
public boolean isFlipD() { switch (tileFlip) { case D: case HD: case VD: case HVD: return true; default: return false; } }
2590cc16-92ee-4344-9ea7-189edd1b9001
3
String typeOf(String st) throws Exception { //handle define, the word after it is a procedure //to ensure that everything after define is still procedure if (reservedWords.contains(st)) { return "RESERVED WORD"; } else if (Character.isDigit(st.charAt(0))) { ...
244481d7-1c42-4fc3-901b-8254f0f1b4fb
0
@Cacheable(cacheName = "findAllBlogCache") public List<Blog> getBlogs() { return this.blogModelDao.findAll(); }
48c79100-f42c-449b-8ce5-750a0fefe992
0
public int getX() { return x; }
bb273b49-d7fa-48f2-89c9-de18674cbbb9
7
String checkSecurity(int iLevel, javax.servlet.http.HttpSession session, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request){ try { Object o1 = session.getAttribute("UserID"); Object o2 = session.getAttribute("UserRights"); boolean bRedirect = false; ...
11f98528-280b-4013-8824-2f63d5997a42
7
public Draw(int a, int b, int c, boolean v) { int[] p = new int[] { a + 1, b + 1, c + 1 }; if (v) { boolean asc, desc; for (int i = 0; i <= 2; i++) { asc = desc = true; for (int j = 0; j <= 1; j++) if (p[(i + j + 1) % 3] > p[(i + j) % 3]) desc = false; else if (p[(i + j + 1) %...
5feb0cdc-b511-4fd5-b8d6-03faadbb2cd1
6
public static void subpermute(List<List<Integer>> res, List<Integer> l, int[] num) { if (0 == num.length) { List<Integer> t = new ArrayList<Integer>(l); res.add(t); return; } else { for (int i = 0; i < num.length; i++) { if (i > 0 && num[i] == num[i - 1]) continue; l.add(num[i]); int[] t...
ae3558ea-3930-4df5-9b67-f825d521032c
9
public void doLoad(List<String> codes, List<String> years, List<String> publishers) throws XMPPException { StringCollection reg = new StringCollection(); reg.setType(IQ.Type.GET); reg.setTo(connection.getServiceName()); PacketFilter filter = new AndFilter(new PacketIDFilter(reg.getPacket...
fad6018b-fd64-402b-9604-4150aa8d4653
2
private void refreshRemoteUsersList(){ for(Object clients:userOnLineL){ InterClient client=(InterClient) clients; try { client.refreshClient(); } catch (RemoteException ex) { Logger.getLogger(ServeurLegede.class.getName()).log(Level.SEVERE, nul...
6d696d46-520e-4866-a731-100a4ef1be0e
6
public static String toText(byte [] bytes) { StringWriter sw = new StringWriter(); int length = bytes.length; if(length > 0) { for(int i = 0; i < length; i++) { byte b = bytes [i]; if(b > 64 && b < 91 || b > 96 && b < 123) sw.write((char)b); } } return(sw.toStr...
aa9914c5-636b-44c6-8ea7-329c90417ef5
8
@Override public <T extends OAuthResponse> T execute(Request request, Class<T> responseClass) { String responseBody = null; URLConnection c = null; int responseCode = 0; try { URL url = new URL(request.getLocationUri()); c = url.openConnection(); responseCode = -1; if (c instanceof HttpURLCo...
60de4078-9075-4ce7-a29e-bec702e92a50
3
protected void generateWorld() { if(!Game.Online) { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { int tile = r.nextInt(Tile.dirtId); tiles[y][x] = Tile.createTile(tile, x, y, this); } } ...
1778aacb-d836-49fd-874b-88dc29cb11a6
8
private void performTask(){ long start = System.nanoTime(); switch(this.action){ case HASHFUNCTIONS: performHashFunctionTests(); break; case HYPERLOGLOG: performHyperLogLog(); break; case SIMILARITIES: performSimilarities(); break; case SLIDINGWINDOW: performSlidingWindow(); break...
dc7c941c-239b-400d-942a-10e17b1c1690
5
public IVPBoolean ivpNotEqualTo(IVPValue num, Context c, HashMap map, DataFactory factory) { IVPBoolean result = factory.createIVPBoolean(); map.put(result.getUniqueID(), result); boolean resultBoolean = false; if(getValueType().equals(IVPValue.INTEGER_TYPE) && num.getValueType().equals(IVPValue.INTEGER_TYPE)){...
f8e574e3-8588-4bd2-a5f8-1840ce04493a
4
public void hit(int damage) { if(dead || flinching) return; health -= damage; if(health < 0) health = 0; if(health == 0) dead = true; flinching = true; flinchTimer = System.nanoTime(); }
d68e5476-1d6a-4baf-a51d-8c9dd255bf01
6
public int getHp(int npc) { switch (npc) { case 2627: return 10; case 2630: return 20; case 2631: return 40; case 2741: return 80; case 2743: return 150; case 2745: return 2500; } return 100; }
b6fab08c-09ac-4eb2-a55f-571ff7a49657
1
public static void main( String[] args ) throws IOException { String myFile = "/home/abu/Desktop/1.txt"; FileReader myFileReader = new FileReader( myFile ); BufferedReader myFileBuffer = new BufferedReader( myFileReader ); String text = myFileBuffer.readLine(); while ( text ...
c89248b3-8f78-4282-b49b-9ce55a9a5eac
3
public boolean addUser(String username, String password) { boolean succes = false; try { crs = qb.selectFrom("users").where("username", "=", username).executeQuery(); if(crs.next()) { succes = false; } else { String[] fields = {"username", "password"}; String[] values = {username, password}; ...
1172c6e3-3161-4ade-8402-7b8636d4aa3a
7
public HipPacket handleClose(byte[] src, byte[] dst, HipPacket close, HipSadb sadb, SignatureAlgo sigAlgo, HostIdentityTag hit) { SaEntry __entry = null; HMACParameter __hmacParam = null; HipPacket __closeAck = null; SignatureParameter __sigParameter = null; byte[] __signature = null; byte[] __hmac = nul...
8299eb0b-2e6c-4dfd-a45e-c648bb2f0d1d
7
public StudentInfoEditor(StudentsListTab window, Student student) { this.window = window; this.student = student; this.setTitle(student.getFirstName() + " " + student.getLastName()); this.tabs = new JTabbedPane(); this.avoidingTable = makeTable(student); this.scrollbar = new JScrollPane(this.avoiding...
13475311-345d-4ab3-b294-6769e264e22d
4
public static void test_2(){ try{ System.out.println("\n\nTestCase-2\n\n"); TestNetwork n=new TestNetwork(4,4,2); Paxos p=new Paxos(n); p.runPaxos(); n.change_DPmode(-1,1); for(int i=0;i<10;i++) //Block the channel of all processes n.block_channel(i, 1); Thread.sleep(500); fo...
8407cbdb-2fd8-47c7-99db-1b63a5b540b7
8
@Override public void unInvoke() { if(!(affected instanceof MOB)) return; final MOB mob=(MOB)affected; if(canBeUninvoked()) { if(!mob.amDead()) { if((invoker!=null)&&(invoker.location()==mob.location())&&(!invoker.amDead())) invoker.tell(invoker,mob,null,L("You are no longer distracting <T-N...
ea93c56a-e4a5-4ed1-abe3-cc2e85950654
2
public static final String trim4Html(Object obj) { String str; return obj != null && (str = obj.toString().trim()).length() > 0 ? str : "&nbsp;"; }
8931855e-4c90-4c7b-886c-aeb7a9b61910
9
public void setProperty(String property, int value) { switch (property) { case "resolution": setResolution(value); break; case "tolerance": setTolerance(value/100d); break; case "blurRadius": setBlurRadius(value); break; case "temperature": setTemperature(value/100d); break; case "brightness": setBrightness...
90d5751e-2c5f-4c72-aa9b-1aa0a25a369b
8
private void Ok() { if(loginTextField.getText().length() == 0) { JOptionPane.showMessageDialog(rf, "Enter login"); return; } if(loginTextField.getText().length() < 4) { JOptionPane.showMessageDialog(rf, "Login is to short, it should be longer then 3 characters"); return; } if(passTextField.ge...
3ff1da2e-27b1-45bd-8893-eb66f6c46f5f
5
private WarMachine platziereWarMachine(WarMachine newWarMachine) { boolean invalidInput = true; String input = null; Koordinate platzKoordinate = null; Ausrichtung platzAusrichtung = null; while (invalidInput) { try { input = client.getPlayerInput(); } catch (Exception e) { e.printStackTrace()...
0b2faf6c-992a-4a6a-bfff-23dbe169712e
6
public String getThreeOfAKind() { String stt = "0"; //search for groups of 3 neighbouring cards that have the same rank if (cards[0].getRank() == cards[1].getRank() && cards[1].getRank() == cards[2].getRank()) { stt = Character.toString (cards[0].getCharCard()) + cards[3].getCh...
cfbbc404-6772-4dd6-865b-ded088b8f6d2
0
public List<IrcClient> getAllClients(){ return AllClients; }
85a6631a-3510-4eab-92e3-2ca66a064750
0
public void setCurrentCells(boolean[] currentCells) { this.currentCells = currentCells; }
48cc138c-e818-4a7e-8bea-cfd6d764b6c3
0
public boolean[] getCurrentCells() { return currentCells; }
adf56048-0cf3-4b4c-b632-1770725eb0d9
7
public int firstMissingPositive(int[] A) { for (int i = 0; i < A.length; i++) { while(A[i] != i+1){ if(A[i] <= 0 || A[i] > A.length || A[i] == A[A[i]-1]) break; int tmp = A[i]; A[i] = A[tmp-1]; A[tmp-1] = tmp; } } for (int i = 0; i < A.length; i++) { if (A[i] != i + 1) return i + 1; ...
d5aeeaa7-747b-4841-bc29-14a4cb1aa44b
9
@Override public CellSpace newSubCellSpace( int i ) { // We need to describe the corners of the two cubes on the lo-hi // diagonal. There are 13 new points to create. // T top / B bottom // L left / R right // F front / B back if( C == null ) { double cx = lo.x + ( hi.x - lo.x ) / 2; double ...
a4f2d76d-8a6d-42c0-9765-0e352ec9aaef
0
@Override public String readFromBomberman() throws IOException { Scanner scan = new Scanner(System.in); System.out.print("Please input your command: "); String command = scan.nextLine(); clientSideWriter.append(command).append("\n").flush(); return serverSideReader.readLine()...
61e518c9-f3ee-4e67-9279-04392651baf6
8
private boolean isAdjacent(int currentIndex, int newIndex, RoomCell.DoorDirection directionOut, RoomCell.DoorDirection directionIn) { // If your new cell is a walkway and you're not in a room, return true if (cells.get(newIndex).isWalkway() && !cells.get(currentIndex).isRoom()) return true; // If the curre...
dcc72000-873c-4219-969e-dcf2ae74e7ab
4
private void getPheno() { if(Character.isUpperCase(allel1)){pheno = allel1;} if(Character.isUpperCase(allel2)){pheno = allel2;} if(Character.isLowerCase(allel1)&&Character.isLowerCase(allel2)){pheno = allel1;} }
7caaed0a-1063-4e46-a1dc-fb5c5bc882e7
5
public synchronized final void saveToCache () { if (getCache() == null) return; // absolutely required field if (getTitle()==null) return; //1. Compose this one and childrefs Element e = getSpecificDataXML(); if (e==null) return; // element is corrupt and should not be cached e.setAttribute("title", ...
0c1c82a4-c009-4a54-8fa2-d3a224471943
1
private int sum(int[] a) { int sum = 0; for (int i = 0; i < a.length; i++) { sum += a[i]; } return sum; }
49b75b01-88ac-4177-b1e6-c7ac82726740
2
private void notifyListeners() { if(!listeners.isEmpty()) for(Listener listener : listeners) listener.update(); }
0c52ae85-0599-4732-9456-6018988ee207
7
@Test public void testConnection6() throws Throwable { final LoopHandle loop = new LoopHandle(); if (!UDPHandleTest.isIPv6Enabled(loop)) { return; } final AtomicInteger serverSendCount = new AtomicInteger(0); final AtomicInteger clientSendCount = new AtomicIntege...
a3ed26db-dcc1-4bda-a723-e36a7bb7a19f
2
public List<Deal> ListerDeals() { PrestataireDeServiceDAO psdao = new PrestataireDeServiceDAO(); try { String sql = "SELECT * FROM Deal "; ResultSet rs = crud.exeRead(sql); List<Deal> liste = new ArrayList<Deal>(); while (rs.next()) { ...
55f7daf0-437a-4355-8293-b61eed6b5e84
3
@Test public void testDeleteAcademy() { System.out.println("deleteAcademy"); String nameId = "CPH"; int ispresent = amock.getAcademysAsJson().contains(nameId) ? 1 : 0; BusinessAcademy a = amock.deleteAcademy(nameId); if (ispresent == 1 && a.getName().equals(nameId)) { ...
14445ff3-5738-4299-a755-63b5bbeed16d
6
@Override public void run() { String responseData = null; HttpClient httpClient = new HttpClient(); int statusCode = -1; try { statusCode = httpClient.executeMethod(mHttpMedthod); if (statusCode != HttpStatus.SC_OK) { System.err.println("HttpMethod failed: " + mHttpMedthod.getStatusLin...
8d1bd387-7704-4c8d-bbd5-dcbbbb73de6b
5
public void run(){ try ( /*ServerSocket serverSocket = new ServerSocket(portNumber); Socket clientSocket = serverSocket.accept();*/ PrintWriter out = new PrintWriter(socket.getOutputStream(), true); BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); ) { System.o...
e9fd058d-0e7c-4676-83c7-69f3bbd4d437
3
public boolean matchesAddress(String address, int port) { if(address == null) return (clientAddress == null && port == clientPort); return (address.equals(clientAddress) && port == clientPort); }
0d562c1f-7065-4375-a8b3-f6e9ef1f17d5
5
public U fold(U u, Queue<T> ts, Function2<T, U, U> function) { // The recursive implementation will overflow the stack for // any data set of real size, your job is to implement a // non-recursive solution // return fold(function.apply(ts.poll(), u), ts, function); ...
b5b806a5-2da9-4e0d-bbc0-7197778a1ecd
4
public static void main(String[] args) { int port; if (args.length < 1) { port = 6727; } else { port = Integer.parseInt(args[0]); } try { serverSocket = new ServerSocket(port); } catch (IOException ex) { Logger.getLogger(Cl...
ba274f93-9150-4dfb-9d97-94dbc22e9dfd
0
protected static float complexToFloat(int complex) { return (complex&(COMPLEX_MANTISSA_MASK << COMPLEX_MANTISSA_SHIFT)) * RADIX_MULTS[(complex>>COMPLEX_RADIX_SHIFT) & COMPLEX_RADIX_MASK]; }
1acc7140-5513-45aa-b025-70654e8481fc
0
public Set<AndroidMethod> getSources() { return sources; }
09706a0e-aa8a-4484-9b9e-66a2bc68ac3d
1
public String toString() { StringBuilder sb = new StringBuilder(); for (Card card : cards) { sb.append(card.toString()); } return sb.toString(); }
bc30b950-3841-4f62-9744-e47c83ce23f3
2
public EqualDivisionNormalDistributedDemandGenerator( int numberOfForerunPeriods, int offSet) { if (numberOfForerunPeriods < 0 || offSet < 0) throw new IllegalArgumentException(); this.forerun = numberOfForerunPeriods; this.offSet = offSet; }
93c0a03b-d032-48eb-9ddf-646ce615ad8a
5
@Override public void mouseClicked(MouseEvent click) { for (int j = 0; j < components.getLength(); j++) { Componente component = components.get(j); if (component.contains(click.getPoint())) { if (SwingUtilities.isLeftMouseButton(click)) { if (comp...
ca439c09-696b-407f-af9d-12302b421d5c
3
private static void writeTableAssignmentByTable(String fileName) { EasyWriter tableByTable = new EasyWriter(fileName + "_byTable.txt"); // "table_assignment_by_table.txt"); if (tableByTable.bad()) { System.err.println("Error creating " + fileName + "_byTable.txt\n"); } for (int i = 0; i < DiningRoom.size();...
1546ccd2-ab35-435a-bfcd-924c3911e074
9
private String currentCategory() { if (places[currentPlayer] == 0) return "Pop"; if (places[currentPlayer] == 4) return "Pop"; if (places[currentPlayer] == 8) return "Pop"; if (places[currentPlayer] == 1) return "Science"; if (places[currentPlayer] == 5) return "Science"; if (places[currentPlayer] == 9) ret...