method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
aac09e89-d817-48cd-ad64-842cafae5d70
9
private static int getNumberSyncObjects(int smpNodeIndex){ SMPNodeConfig smpNodeCfg = Configuration.getInstance().smpNodeConfigs.get(smpNodeIndex); int n = 1 + smpNodeCfg.cacheConfigsPT.size() +smpNodeCfg.cacheConfigsMem.size(); if(smpNodeCfg.hasRemoteCache()){ n++; } for(int j = 0;j<smpNodeCfg.cacheConfig...
7a705ab6-0ccf-4458-a839-2f36a895cb1d
8
private void writeArray(JSONArray jsonarray) throws JSONException { // JSONzip has three encodings for arrays: // The array is empty (zipEmptyArray). // First value in the array is a string (zipArrayString). // First value in the array is not a string (zipArrayValue). boolean stringy = false; int leng...
62d9a9f7-e282-45c1-97ea-e3a2eeb95d3b
3
public void draw(Graphics2D g2, int x, int y) { RoundRectangle2D.Double r = new RoundRectangle2D.Double(x, y, getWidth(), getHeight(), 5, 5); g2.setColor(new Color(245, 245, 245)); g2.fill(r); if(selected) { if(name.equals("relative")) { ...
b4d28493-deab-4e0e-896a-a2b60bc2da8e
2
public int[][] generateMatrix(int n) { int[][] result = null; if(n == 0) return new int[0][0]; if(n == 1){ result = new int[1][1]; result[0][0] = 1; return result; } result = new int[n][n]; int step = 1; travel(result, st...
33c0c413-5f4b-4487-828b-e1cc75c6c7c7
2
public void loadPlanetSprites(){ planetSprites = new ArrayList(); ArrayList anims = new ArrayList(); for(int i = 0; i < planetImages.size(); i++){ Animation a = createPlanetAnim((Image)planetImages.get(i)); anims.add(a); } for(int i = 0; i < planetImages.size(); i++){ An...
b2927b10-be7c-41fd-ad2b-28f6fc300610
1
protected void demo10() throws IOException, UnknownHostException, CycApiException { if (cycAccess.isOpenCyc()) { Log.current.println("\nThis demo is not available in OpenCyc"); } else { Log.current.println("Demonstrating getParaphrase api function.\n"); CycFormulaSentence formula = cycAcce...
671d9541-87f3-4e1b-b7f9-8d1d46dfd4d2
2
public int getWisdom(){ int value = 0; for (Armor armor : armorList) { if(armor != null) value += armor.getStats().getWisdom(); } return value; }
8a66a0e6-6dfa-46ca-a348-fede6268bdac
9
public static void main(String[] args) { Scanner in = new Scanner(System.in); double x = in.nextDouble(); double y = in.nextDouble(); double ax = 12.5; double ay = 8.5; double bx = 22.5; double by = 8.5; double cx = 17.5; double cy = 3.5; ...
bad8b430-2bf1-43ef-bc4a-55aec35557c1
0
public void setjLabelMotifVisite(JLabel jLabelMotifVisite) { this.jLabelMotifVisite = jLabelMotifVisite; }
04d95a67-2b79-457f-b936-cc416a775e1c
1
@Test public void editUser(){ Connection conn = null; Statement statement = null; try{ conn = JDBCUtils.getConnection(); statement = conn.createStatement(); statement.executeUpdate("UPDATE table_user set age = 20 where name='Lily'"); }catch (Exception e) { e.printStackTrace(); }final...
48556570-6fb2-4fb0-9ca8-77ec6eb89938
8
private static String escapeJSON(String text) { StringBuilder builder = new StringBuilder(); builder.append('"'); for (int index = 0; index < text.length(); index++) { char chr = text.charAt(index); switch (chr) { case '"': case '\\': builder.append('\\'); builder.append(chr); break; ...
7d9e36d4-7888-4c21-b26f-294c79d9012e
2
@Override protected void done() { try { int patchesCount = get().size(); System.out.println(patchesCount+" patches"); firePropertyChange("progress", lastProgress, 1d); firePropertyChange("done", false, true); lastProgress=1d; } catch (InterruptedException e) { // TODO Auto-generated catch block ...
c92ff093-d737-4b4d-b0e1-ac765ddac4c8
4
public static int posteY(int rangee,int orientation){ int centreY = centrePositionY(rangee) ; switch(orientation){ case Orientation.NORD : centreY -= 20 ; break ; case Orientation.EST : centreY -= 25 ; break ; case Orientation.SUD : break ; case Orientation.OUEST : centreY -= 25 ...
04101fa9-5fd3-4c01-bd79-1762b28ea217
8
private int parseTime(String timeStart) { String hours; String mins; timeStart = timeStart.trim(); String timeCleaned = ""; for(int i = 0 ; i < timeStart.length() ; i++){ if(Character.isDigit(timeStart.charAt(i)) ||timeStart.charAt(i) == ':'){ timeCleaned += timeStart.charAt(i); } } if...
6006ebfa-7d46-46ac-92c1-4fed27e58061
7
@Override public void run() { // Get some ship variables (must be final) final float mass = movableEntity.getMass(); final Vect3D pos = new Vect3D(movableEntity.getPos()); final Vect3D speed = new Vect3D(movableEntity.getSpeed()); targetOffset.copy(target).substract(pos); if (targetOffset.modulus() == 0...
459633f7-bd26-47f3-8a4c-dfc95c301b6a
3
private void loadClasses() { try { Set<URL> urls = new HashSet<URL>(); List<String> elements = project.getRuntimeClasspathElements(); //getRuntimeClasspathElements() //getCompileClasspathElements() //getSystemClasspathElements() for (St...
da1e7300-b3bb-4748-9f63-f49a9e745386
6
public Simplex(double[][] A, double[] b, double[] c) { M = b.length; N = c.length; a = new double[M+1][N+M+1]; for (int i = 0; i < M; i++) for (int j = 0; j < N; j++) a[i][j] = A[i][j]; for (int i = 0; i < M; i++) a[i][N+i] = 1.0; for (int j = ...
0760663f-eceb-4908-9f49-83a98ebcbc28
3
public static void main(String[] args) throws IOException { int dbport = 5432; String dbuser = "dbuser"; String dbpasswd = "dbuser"; ArrayList<double[]> isochronePositions= null; Isochrone iso = null; if (args.length < 5) { System.out.println("zu weni...
d2e3ec16-925f-43a6-bc6b-241aa2c2a0d6
8
@Override public void newSource(boolean priority, boolean toStream, boolean toLoop, String sourcename, FilenameURL filenameURL, float x, float y, float z, int attModel, float distOrRoll) { IntBuffer myBuffer = null; if (!toStream) { // Grab the sound buffer for th...
d8e8350c-3455-4cec-b79e-512aa7bd1c30
4
public int compareTo(Deck deck) { if (deck.cardArray.length > cardArray.length) return -1; else if (deck.cardArray.length < cardArray.length) return 1; int r; for (int i = 0; i < cardArray.length; i++) { r = cardArray[i].compa...
0e1ea24d-19a4-4fa0-9604-8f1a3585e89e
4
private void jList1MouseClicked(MouseEvent evt) { if(evt.getClickCount() == 2) { String item = jList1.getSelectedValue().toString(); ElectricObject eo = null; for(ElectricObject e : electricObjects) { if((e.getName()).equals(item)) { eo = e; break; } } if(synchronizeWorkB...
3a2ba2f9-07f7-45b5-8e9e-f3a5ddd32056
7
@RequestMapping(value = "editTask", method = RequestMethod.POST) public @ResponseBody TodoTask editTask(@RequestParam Integer id, @RequestParam String title, @RequestParam String content, @RequestParam String targetTime, @RequestParam Integer priority, @RequestParam boolean completed, ...
f3c25687-4800-4c2d-bfac-819b4ce13276
3
@Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; Object...
c85f4a5a-f1f8-4904-9b25-597e7a3961b4
3
public TempoChange(int beatsPerMinute, int timeStamp) { if (beatsPerMinute < 0 || beatsPerMinute > 510) throw new IllegalArgumentException("The beats per minute field in the " + FrameType.SYNCHRONIZED_TEMPO_CODES.getId() + " contains an invalid value, " + beatsPerMinute + ". It must be 0 <= b...
c4086178-0548-4f87-a8f0-95e0a65b6fb5
0
public void setLongitude( double longitude ) { this.longitude = longitude; }
6b48160b-f2f7-424c-a722-250012663aee
6
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { if (debug) { log("EncodingFilter:doFilter()"); } doBeforeProcessing(request, response); Throwabl...
4439153b-f68c-44ed-81cc-b2a47262af67
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...
b0c34e3f-c93d-440c-9fcd-bfb558ee57fe
5
public List<Token> tokensToList(Lexer lexer) { Token lastToken = null; List<Token> tokens = new LinkedList<>(); for (Token token : lexer) { if(token.getType().equals(LexerType.OPENING_PARENTHESIS) && lastToken != null && (lastToken.getType().e...
6d0f7b22-24a7-487b-b716-54bd7c7b71b3
8
private String allDataToText() { Collection<Boolean> data = viewAllData(); StringBuilder builder = new StringBuilder(data.size()); int i = 0; for (Boolean bit : data) { if (i % 32 == 0 && i != 0) { builder.append("\n"); } else if (i % 16 == 0 && i ...
9ca1566b-da05-47e1-b3f0-9c656a24a2b1
5
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed jButton4.setEnabled(false); if(!reciboExiste) boton7.setEnabled(false); if(jButton4.getText().equals("Confirmar")){ if(controlarCampos()){ jButt...
603afd76-f8d6-4cf0-8657-f5f21d1f75df
8
public boolean stateEquals(Object o) { if (o==this) return true; if (o == null || !(o instanceof MersenneTwister)) return false; MersenneTwister other = (MersenneTwister) o; if (mti != other.mti) return false; for(int x=0;x<mag01.length;x++) if (ma...
25e6d091-2571-48b8-96b3-a45d3c90dc17
6
private Set<File> getsubFileList(String source,String... extensions){ Set<File> fileSet = new HashSet<File>(); File dir = getFile(source); //FileFilter로 돌릴수 없는 이유는 하위디렉토리를 모두 검색해야하는데 FileFilter로 하면 디렉토리도 필터링되어서 안되기 때문이다 File[] fileList = dir.listFiles(); for(int i = 0 ; i < fileList.length ; i++){ t...
b949d4bf-8d33-49b0-8414-6ff02a440f78
1
public void newwidget(int id, String type, Coord c, int parent, Object... args) throws InterruptedException { super.newwidget(id, type, c, parent, args); Widget w = widgets.get(id); synchronized(robots) { for(Robot r : robots) r.newwdg(id, w, args); } }
c99df087-d677-4819-9298-4b56ef07cab0
9
@Override public void insertPrev(T i, T j) { if (j.getParent() != null) throw new PromiscuousItemException(j, j.getParent()); if ((j.getNext() != null) || (j.getPrev() != null)) throw new PromiscuousItemException(j); if (i == null) { // insert as tail j.setPrev(_lastItem); j.setNext(null); j.s...
bc128fcb-dac7-4e9e-a3a5-1990a3dde4f5
6
public void run() { String messageFromClient; // das was der client einem gesendet hat. System.out.println("Chat Server Thread " + threadId + " is running on TCP Port " + ChatServer.PORT_NUMBER + " until BYE is recieved!"); try { /* * inputstream vom socket in inputreader und bufferedreader *...
3ef710e9-d96e-4ec2-8ba9-0e49484a4b8b
7
@Override public Shop readItem(File file, Shop shop){ try { scanner = new Scanner(file); Scanner lijn = null; if(shop == null) shop = new Shop(); while(scanner.hasNext()){ lijn = new Scanner(scanner.nextLine()); lijn.useDelimiter(";"); String stringType = lijn.next(); Stri...
39a3d3de-4f2d-47f4-84e9-78a065f8196a
6
@SuppressWarnings({"unchecked"}) public boolean retainEntries( TObjectObjectProcedure<? super K, ? super V> procedure ) { boolean modified = false; Object[] keys = _set; V[] values = _values; // Temporarily disable compaction. This is a fix for bug #1738760 tempDisableAutoCo...
df589235-36ce-4cb2-bf6c-8eb1a80e60d4
8
public void destroy(Long id) throws NonexistentEntityException { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); HistoricoConsumo historicoConsumo; try { historicoConsumo = em.getReference(HistoricoConsu...
96b6a4f5-2215-47cf-988f-8309cd241581
3
@Override public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { if (!(sender instanceof ConsoleCommandSender)) { Main.courier.send(sender, "requires-console", label); return true; } if (this.filter.isEn...
9e9dd72b-7caa-4bad-a305-e7b77e06f7c6
6
public boolean overlaps(PriceStep other) { if (this.getEndPrice() == 0 && other.getEndPrice() == 0) { return true; } if ((this.getEndPrice() != 0 && other.getStartPrice() >= this.getEndPrice()) || (other.getEndPrice() != 0 && other.getEndPrice() <= this.getStartPrice())) { return false; } else ...
ccbdec08-2d93-4077-8a8f-0b88036fd40f
4
public static void main(String[] args) throws ParseException { // Parse available options Options opts = createOptions(); CommandLineParser parser = new PosixParser(); CommandLine cmd = parser.parse(opts, args); // if help needed if (cmd.hasOption("h") || args.length==0) { HelpFormatter help = new HelpFo...
f64e2195-5a63-46cb-aecf-0ac9ac090513
0
public static Praticien selectOneByID(EntityManager em, String numero) throws PersistenceException { Praticien praticien = null; Query query = em.createQuery("select pra from Praticien pra where pra.numero = :numero"); query.setParameter("numero", numero); praticien = (Praticien) query.g...
8be82362-40a4-4718-8dd8-8e570e0d4ace
2
public static int gcd(int a, int b) { while (a != b) { if (a > b) a = a - b; else b = b - a; } return a; }
b52c46e8-ae18-404a-9602-7bcd68cb8943
8
private Vector checkForPossibleMoves( int piecePosition, int pieceType, Player aPlayer ) { Vector possibleMoves = new Vector(); boolean adjacentSpace = false; Player player = aPlayer; // Get available moves if the piece is on a wall. possibleMoves.addAll( wallPieceMoves( piecePosition, false, ...
909da7e3-d947-4719-9878-6b83feb3fd63
0
public void printComponent(Graphics g) { pane.print(g); }
8a070dd3-d515-4d6a-bcf3-09513ad4ed59
9
public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); char[] s = br.readLine().toCharArray(); char[] t = br.readLine().toCharArray(); int[] countS = new int['z'-'a'+1]; int[] countT = new int['z'-'a'+1]...
5a8db103-bc9b-406a-8cbc-8f5a7b2122cf
0
public void Part(String channel) throws Exception { Writer.write("PART " + channel + "\r\n"); Writer.flush(); }
3ae8c7ad-eebc-4cc6-a183-9b213e4cf523
3
private static void priceInputValidator() { while (!validInput) { try { System.out.print("You selected to search by price. Please enter a price: "); priceInput = actionInput.nextInt(); System.out.println("You entered: " + priceInput); validInput = true; if(data1.isEmpty()) { ...
1a2f4b2d-cc4f-4400-9502-2e1350b87c08
3
public int find(Object seek) { // check the objects and seek specifically int index = -1; if(seek instanceof Fermentable) { index = Collections.binarySearch(fermDB, (Fermentable)seek); } else if(seek instanceof Hop) { Comparator<Hop> c = new Comparator<Hop>() { public int compare(Hop h1, Hop h2){ ...
9f64a551-298c-497e-b646-72e5fbcc16fb
6
@command public void setpending(CommandSender sender, String[] args) { tickets = plugin.getTicketHandler(); if (sender instanceof Player) { Player p = (Player) sender; if (p.hasPermission("modreq.setpending")) { if (args.length == 1) { int ...
b0e0b6bd-133f-42e5-9157-a335198fe9dc
5
public void run() { while(threadSocket != null && socket.isConnected()) { try{ Message message = (Message)reader.readObject(); message.setIp(socket.getInetAddress().getHostAddress()); message.setPort(socket.getPo...
95736971-98d3-485f-ab28-f58cd2370f48
5
@Override public void onStackRemoved(UIInventorySlot s, ItemStack previous) { if(s == slots[43] && previous != null) { slots[40].stack = null; slots[41].stack = null; slots[42].stack = null; } if(s == slots[40] || s == slots[41] || s == slots[4...
82664265-db24-44f8-8e2f-dec3f98af886
7
private IMessage decrypterCaesar(IMessage crypte, String key) { /* * Les caractres sont dcods un un via oprations elementaires * Les caractres ne correspondant pas des lettres sont ajouts tel quels. */ int k=Integer.parseInt(key); char[] c=new char[crypte.taille()]; for(int i=0;i<crypte.taille();i++)...
409d3cfd-cc9a-443d-b094-186909fde1df
0
public void init() { update = new Update(); update.init(); loadedWorld = update.getLoadedWorld(); render = new Render(GraphicsMain.getGraphics()); render.start(); }
0653ba4e-4d59-4842-ab54-b797be5ce7d8
9
@FXML private void deleteFplan() { if (this.detailsFahrplanTable.getSelectionModel().getSelectedItem() != null) { Fahrplan fahrplan = this.detailsFahrplanTable.getSelectionModel() .getSelectedItem(); this.dbm.deleteFahrplan(fahrplan); for (int i = 0; i < this.fahrplanliste.size(); i++) { if (this....
e0a731a4-1f3c-4711-99cb-475c67fbf491
8
public static void main(String[] args) throws Throwable { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); int cartas = Integer.parseInt(bf.readLine()); while( cartas != 0 ){ ArrayList<Integer> numeros = new ArrayList<Integer>(); int[] discards = new int[cartas-1]; for...
2579dcf1-e2e2-4c07-82b2-1f554999086c
7
protected DrawableNode mergeClades(ArrayList<TreeItem> majorityClades) throws FileParseException { DrawableNode root = new DrawableNode(); progressMonitor.setNote("Merging clades"); if (majorityClades.size()==0) { throw new FileParseException("Error building majority tree: Could not identify majority clades");...
7feadfaf-fdae-4e96-a02a-cb5af709e371
5
public Instruction[] getMnemonics(String mnemonic){ Instruction[] temp = new Instruction[binCode.size()]; int c = 0; for (int j = 0; j < binCode.size(); j++) { if (binCode.get(j).getMnemonic().equalsIgnoreCase(mnemonic)) temp[c++] = binCode.get(j); } i...
7b347568-94d4-414d-8c4f-92962adbb30e
1
public boolean containsUnderscores() { boolean contains = false; if (placeholder.contains(UNDERSCORE)) { contains = true; } return contains; }
429c18ab-30a7-4536-9926-0c017ff3d177
6
public void addHand (Hand h) { if (h==null) return; for (int i=0; i<h._cardsDelt; i++) { try { boolean flag_add = true; for (int j=0; j<_cardsDelt; j++) if (_cards[j] == h._cards[i]) flag_add = false; if (flag_add) addCard (h._cards[i]); } catch (ArrayIndex...
24e3519d-ddce-4fee-af99-db374a1f9f17
5
public static void remove(int key, World world, int x0, int y0, int z0) { int[] coords = _keys.get(key); x0 -= coords[0]; y0 -= coords[1]; z0 -= coords[2]; for(int y = 0; y < _blocks.length; y++) { for(int z = 0; z < _blocks[y].length; z++) { ...
49352dbb-a354-4d1d-a2e9-eba04e04bf12
3
void sendToAll(String msg, String id) { Iterator it = clients.keySet().iterator(); while (it.hasNext()) { try { // Ŭ̾Ʈ ϴ κ! DataOutputStream out = (DataOutputStream) clients.get(it.next()); if (out.equals(clients.get(id))) continue; // ޼ ϰ continue out.writeUTF(msg); } catch (IOException...
deec064a-aca0-4bb2-aeb8-97c730b8c873
6
@Test public void insertTest() { ChainingHashSet test = new ChainingHashSet(10); try { test.insert(50); test.insert(32); } catch (Exception e) { fail("Unexpected Execption"); } try { test.insert(50); fail("ValueException"); } catch (ValueException e) { // expected Exception } catch (...
bc50ffb8-7a14-47ff-895d-50d426511ae4
2
@SuppressWarnings("unchecked") private Item[] resize(int newCapacity) { if (newCapacity > N) System.out.println("Increasing capacity from " + N + " to " + newCapacity); else System.out.println("Decreasing capacity from " + N + " to " + newCapacity); Item[] t = (Item[]) new Object[newCapacity + 1]; for (i...
6d281132-cebf-40e0-9b99-c3a9f3b3175d
9
private static boolean isKingInCheckAfterMoveRec(byte[][] board, byte piece, int hPos, int vPos, int skiphPos, int skipvPos, int tohPos, int tovPos, int hAdd, int vAdd) { hPos += hAdd; vPos += vAdd; if (hPos < 0 || hPos > 7 || vPos < 0 || vPos > 7 || (hPos == tohPos && vPos == tovPos)) { re...
1ade7c6c-ffe7-4a8f-b702-c9c3eb72f6e5
7
public void processOtherPluginLoadedAnnotation(Plugin newPlugin) { for (Plugin plugin : this.pluginManager.getPluginRegistry().getAllPlugins()) { final PluginMetaInformation pmi = this.pluginManager.getPluginRegistry() .getMetaInformationFor(plugin); for (PluginLoadedInformation pli : pmi.pluginLoa...
9ee6881c-b61c-4e17-b874-032974ac9c56
3
@Override public void run() { try { inputStream = new DataInputStream(new BufferedInputStream(socket.getInputStream())); outputStream = new DataOutputStream(new BufferedOutputStream( socket.getOutputStream())); while (inputStream.available() != -1) { System.out.println(); int packetSize = inp...
67e4558c-852c-42b0-9c45-c72bee9dca12
0
@Override public int foo1() { // do smth return super.foo1(); }
cd2c1f9f-1ae1-4c15-801b-01ac683eb156
1
public ArrayList<String> getAllTitles() { ArrayList<String> songTitles = new ArrayList<>(); //Run through each song and get title, set in array for (Song s : songList) { songTitles.add(s.getTitle()); } //Return array of titles ret...
8ccafabf-fd23-43d3-99bb-2645eb876e63
3
public boolean leaveChannel(ChatChannel channel, User user){ boolean returnValue = false; try { Socket socket = new Socket(SERVER_ADDRESS_CHAT, CHAT_PORT); socket.setSoTimeout(TIMEOUT); OutputStream outputStream = socket.getOutputStream(); ObjectOutputStream objectOutputStream = new ObjectOutput...
f421aca7-6a72-4db7-8a25-b7bf3dab65c6
3
@Override public Class<?> getColumnClass( int column ) { switch( column ){ case 0: return Integer.class; case 4: return Integer.class; default: return String.class; } }
5dc85d19-6278-4399-b982-5a802af84a54
8
public void writeModel(OutputStream output, CourseModel model) throws IOException { try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document dom = db.newDocument(); Element root = dom.createElement("StaticData"); dom.appendChil...
f524b098-e320-4099-a850-6f50532ac23b
8
@Override public void run() { long oldTime; long newTime; if (button.getText().equals("Campaign")) { double i = 0; newTime = System.currentTimeMillis(); oldTime = newTime; while (campaignPulse) { newTime = System.currentTimeMillis(); long difference = newTime - oldTime; i += di...
794a39fb-db35-406a-b42d-823f3e945dec
4
protected boolean in_grouping(char [] s, int min, int max) { if (cursor >= limit) return false; char ch = current.charAt(cursor); if (ch > max || ch < min) return false; ch -= min; if ((s[ch >> 3] & (0X1 << (ch & 0X7))) == 0) return false; cursor++; return true; }
4fc05d93-ce28-463a-9302-e8211cc86d2e
4
public void expandToEnclose(Rectangular other) { if (other.x1 < x1) x1 = other.x1; if (other.y1 < y1) y1 = other.y1; if (other.x2 > x2) x2 = other.x2; if (other.y2 > y2) y2 = other.y2; }
769411fe-a325-4203-a94a-9691ce986e46
9
public Item evaluateItem(XPathContext context) throws XPathException { AtomicValue av1 = (AtomicValue)argument[0].evaluateItem(context); long arity = -1; if (argument.length == 2) { arity = ((NumericValue)argument[1].evaluateItem(context)).longValue(); } StringValue n...
80f9a8ce-0ed6-4f3b-ae2a-e9fbe5128def
3
public byte[] read_single(short address) throws IOException { if ((this.mode==0) || (this.mode==SET_MODE_I2C_SERIAL)) this.set_mode(SET_MODE_I2C_100); byte[] data=new byte[2]; data[0]=(byte)RW_SINGLE; data[1]=(byte)address; byte[] result = this.sendAndReceive(data, COM_TIMEOUT, 1); i...
9e50d513-21fc-4042-ae22-f9ef19e002b0
1
public Object getValueAt(int rowIndex, int columnIndex) { switch(columnIndex){ case 0: return data[rowIndex][columnIndex].toString(); default: return data[rowIndex][columnIndex]; //Ne devrait jamais arriver } }
49572d9e-4b1f-4776-bc4f-462eae7cd7f6
6
public void initComponents() { Container con = this.getContentPane(); con.setLayout(new BorderLayout()); lblTitle = new JLabel("Tripcalculator Luttenberger u. Korosec"); lblTitle.setHorizontalAlignment(JLabel.CENTER); lblCO2onDistance = new JLabel("CO2 consumption based on dist...
162dff2e-159a-4327-9113-9d63dbe2edf0
0
@SuppressWarnings("deprecation") private void genFeatures() { Date d = new Date((long)t1*1000); int m = d.getMonth(); int day = d.getDay(); features[m] = true; features[12+day] = true; }
557a22f7-30df-4a0d-a6f9-4ab165eaef27
2
@Override protected PlayerCTF createPlayer(int playerNumber, Position beginPosition) { if (beginPosition == null || playerNumber <= 0) throw new IllegalArgumentException("The given arguments are invalid!"); return new PlayerCTF(grid, playerNumber, beginPosition); }
96b44e2d-1c9a-41e3-b165-b6fd250c41a7
7
public Object nextValue() throws JSONException { char c = this.nextClean(); String string; switch (c) { case '"': case '\'': return this.nextString(c); case '{': this.back(); return new JSONObject(this); ...
d456fb4f-86fd-481d-992b-f4553f550d9e
1
@Override public void actionESC() { if (_DEBUG) System.out.println("Press ESC from Pause"); Fenetre.setState(StateFen.Level); }
4d91470f-7611-4ebf-aa75-98db2f300078
9
public static double[][] costMap(double[][] energyMap){ double[][] costMap=new double[energyMap.length][energyMap[0].length]; //Compute the costs of the top (i.e. the values) for(int j=0;j<costMap[0].length;j++){ costMap[0][j]=energyMap[0][j]; } //Compute the rest of the minimum costs for(...
2e98504e-7cd7-47f7-995e-04dcc09ec1f6
5
public void loadAnimFile(String path) { this.animPath = path; animIndex = 1; fps = 0; frameCount = 0; File f = new File(path); try (Scanner scan = new Scanner(f)) { fps = scan.nextInt(); scan.nextLine(); synchronized (this) { while (scan.hasNextLine()) { String name = scan.next(); Lis...
fce5c5fe-acf0-4bf2-b8f2-0ff6bb622ecb
8
* @Post: no changes * @Return: whether or not this point is under attack by an enemy rook or queen (by line) */ private boolean lineCanAttack(Point pointToCheck) { ArrayList<Point> directions=new ArrayList<Point>(); //adds the 4 line directions to the list directions.add(new Point(0,1)); directions.add(n...
454ef4d9-20f2-4a6b-993f-3b5bffad3429
7
public void logInToAmazon() { try{ webDriver.get(config.getProperty("amazone.url")); webDriver.findElement(By.id(pageVar.accountLink)).click(); boolean userPage=false; try{ if(webDriver.findElement(By.id(pageVar.userEmail))!=null){ userPage=true; } }catch(Exception e){} if(userPage){ ...
055403fa-208b-47ee-a723-f0e94fc45c90
8
@Override public int decode( byte[] data, int offset, DecodeState ds, CerealDecoder context ) throws InvalidEncoding, ResourceNotFound { long propDecodeResult = NumberEncoding.readUnsignedBase128(data, offset); long props = NumberEncoding.base128Value(propDecodeResult); offset += NumberEncoding.base128S...
59df4836-2fc6-4002-910e-f14e1f5b89f3
8
public static byte[] decodeBase64(byte[] base64Data) { // RFC 2045 requires that we discard ALL non-Base64 characters base64Data = discardNonBase64(base64Data); // handle the edge case, so we don't have to worry about it later if (base64Data.length == 0) { return new byte[0]...
e9cfb4e4-2e6a-4024-b684-90c99dfff92c
5
public String reading() { String sCurrentLine = null; String Allfile = null; BufferedReader br = null; try { br = new BufferedReader(new FileReader("./ChatHistory.txt")); while ((sCurrentLine = br.readLine()) != null) { if (Allfile == null) { Allfile = sCurrentLine; } else { Allfile = Al...
bc9a3af8-aef1-4e28-a665-eb21e22bd462
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 Precos)) { return false; } Precos other = (Precos) object; if ((this.codigo == null && other.codigo != null) ||...
47705046-f8b1-44ae-9b31-1aa4fe31e59d
0
public int getHealth() {return health;}
9d4e8dff-fd4e-49a5-8e58-d088fed69abd
7
public static Cons cppTranslatePrintStream(Cons tree) { tree.firstSetter(Stella.SYM_STELLA_CPP_PRINT_STREAM); if (Surrogate.subtypeOfKeywordP(Stella_Object.safePrimaryType(tree.rest.value))) { { GeneralizedSymbol testValue000 = ((GeneralizedSymbol)(tree.rest.value)); if ((testValue000 == Stella.K...
964af2bd-1c81-476b-9cca-49a4931ceed4
6
synchronized void changeMap(int intLayer, int intLocX, int intLocY, short value) { if (value < 0 || value > vctTiles.size()) { LOG.printMessage(Log.INFO, "Invalid value passed to changeMap("+intLocX+","+intLocY+","+value+")"); return; } if (intLocX < 0 || intLocX > MapColumns || intLocY < 0 || intLocY > ...
72ef3d76-cf08-4723-98cc-6d35d3aa388f
8
private static int val(int id, int remW, int iterations) { if(iterations == 0) { return 0; } if(remW == 0) { return 0; } if(id == W.length) { return 0; } if(W[id] > remW) { if(val[id+1][remW][iterations] == -1) { val[id][remW][iterations] = val(id+1, remW, iteration...
b26ae4cf-b313-4909-af52-707188e1498a
8
public static Direction getDirection(int n) { switch (n) { case 1: return NW; case 2: return N; case 3: return NE; case 4: return W; case 6: return E; case 7: return SW; case 8: return S; case 9: return SE; default: return NONE; } }
87dbdcda-fdab-4d04-af91-54a4e0edbc07
2
@Override public void closing() throws IOException { if (!mClosed) { mClosed = true; try { mHandler.webSocketClosed(this); } catch (Throwable throwable) { Log.error(getSession(), throwable); } send(Opcode.CLOSE, new byte[0]); } }
3b630601-cb36-4bca-9ee1-2671bd87d9fb
6
@Override public int stage() { final int bits = bits(); for (int i = 0; i < NORMAL_STAGE.length; i++) { if (bits == NORMAL_STAGE[i]) { return i + 1; } } for (int i = 0; i < SUPER_STAGE.length; i++) { if (bits == SUPER_STAGE[i]) { return i + 1; } } for (int i = 0; i < TOMATO_STAGE.len...
ade78767-2312-4a9f-aff3-80b15723838a
3
public static boolean rankingCompare(String[] v, String[] w) { if (v.length != w.length) return false; for (int i = 0; i < v.length; i++) if (v[i].compareToIgnoreCase(w[i]) != 0) return false; return true; }
31bde6f7-4c14-42ab-8c7d-8235a26d3af1
7
public static void main(String argv[]) throws Exception { boolean running = true; /* Open up streams */ BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in)); Socket clientSocket = new Socket("localhost", 3000); ObjectInputStream in = new ObjectInputStream(clientSocket.getInputS...