method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
1e55571e-f223-497c-8362-09f61b9cb9ee
6
public void setAlignment (int alignment) { checkWidget (); if ((alignment & (SWT.LEFT | SWT.RIGHT | SWT.CENTER)) == 0) return; int index = getIndex (); if (index == -1 || index == 0) return; /* column 0 can only have left-alignment */ alignment = CTable.checkBits (alignment, SWT.LEFT, SWT.CENTER, SWT.RIGHT, 0, 0, ...
6d4b0696-6e09-4b6c-961a-5d26c97a25a7
9
private void gatherResultsByHeuristic(String word, List <Character> queue, List <String> results, int maxResults) { List <Character> locQ = new LinkedList <Character> (queue); if (word.length() == 1 && !this.isRoot()){ if(!this.isLeaf()) { Map <Integer, Integer> heuristicMap = new HashMap <Integer, I...
1de92389-c34d-4ef8-97a4-5fec69619ec9
5
public static void enlargePoints(BufferedImage img, ArrayList<ImageMarker> markerList, int enlargeAmount, double imageScaledFactor) { Graphics g = img.getGraphics(); for (ImageMarker marker : markerList) { //draw a circle at each point, with the radius (enlargeAmount + 1) if (mar...
6eaac7af-71b7-42f3-b013-88af23e7d202
7
public void setOptions(String[] options) throws Exception { String tmpStr; String[] tmpOptions; setChecksTurnedOff(Utils.getFlag("no-checks", options)); tmpStr = Utils.getOption('C', options); if (tmpStr.length() != 0) setC(Double.parseDouble(tmpStr)); else setC(1.0); tmpS...
745c5b94-77ee-4d97-9460-7956963cf8ad
9
public ClerkView(MainWindow parent, Controller session, int userBID, String password) { super(parent, session, userBID, password); mainPanel = new JPanel(); mainPanel.setBackground(SystemColor.window); mainPanel.setMinimumSize(new Dimension(100,100)); mainPanel.setMaximumSize(new Dimension(100,100)); ...
8cac2d2d-82e9-46f0-8ee4-24b22f43ffa1
3
@Override public void caseAProgramas(AProgramas node) { inAProgramas(node); { List<PComando> copy = new ArrayList<PComando>(node.getComando()); Collections.reverse(copy); for(PComando e : copy) { e.apply(this); } ...
d3208e2b-be65-4128-a08a-8e53e945dcf4
8
public void close() { if(rs != null ){ try { rs.close(); } catch (SQLException e) { e.printStackTrace(); } } if(stmt != null) { try { stmt.close(); } catch(Exception e) { e.printStackTrace(); } } if(pstmt != null) { try { pstmt.close(); } catch(Exception e) { e....
7127b949-7403-4d7a-a3ff-09c929867674
9
public static void printBoard(int table[][]){ int rows=table.length; int cols=table[0].length; msg.print(" "); for(int i=0;i<cols;i++){ if(i==0){ msg.print("0 "); } else{ if(i<10){ msg.print(gen[0].charAt(i-1)+" "); } else{ msg.print(gen[0].charAt(i-1)+" ...
5985dc05-4ed5-4121-b79d-1fe3c12a4aeb
2
static void zipDirectory(Path zipdir, Path destDirectory, String zipSuffix) throws IOException { assert FileUtil.controlDirectory(zipdir) && (destDirectory != null); if (zipSuffix != null) { suffix = zipSuffix; } else { suffix = ".zip"; } prefixLength = z...
b111c516-1bf9-40d1-ae46-d9e1a40c9a72
2
@EventHandler(priority = EventPriority.HIGHEST) public void sendPlayerToHub(final PostLoginEvent e) throws SQLException { if(SpawnConfig.forcespawn && !SpawnManager.newPlayers.contains(e.getPlayer())){ ProxyServer.getInstance().getScheduler().schedule(BungeeSuite.instance, new Runnable(){ @Override publi...
81bff33c-a631-4513-9f6e-2fc37744e027
5
public boolean next(){ int len = start.length - 1; itr[len]++; if(itr[len] >= roff[len]) { int j = len - 1; while (j >= 0) { itr[j]++; fpos += fjump[j + 1]; if (itr[j] < roff[j]) { break; } else if (j == 0) { break; } else { fpos -= itr[j] * fjump[j + 1]; itr[j] = 0...
78528f95-223e-4c5c-99ab-54088d47a8bc
0
private void init(){ locMan = new LocationManager(ticker); //создаем мир GameWorld startWorld = locMan.getGameWorld(0); scene = new Scene(ticker, startWorld); }
7fb9773c-8971-473a-8bf4-7a752926ef72
9
@Override public boolean tick(Tickable ticking, int tickID) { if(!super.tick(ticking,tickID)) return false; if(affected instanceof MOB) { final MOB mob=(MOB)affected; mark=getMark(mob); if((mark!=null) &&(mob.location()!=null) &&(mob.location().isInhabitant(mark)) &&((mob.fetchAbility(ID())...
5ac8c66b-63c0-430a-8a59-e59a4d9956ad
5
@Override public void run() { while(!Thread.interrupted()) { Selector sel = _selector; try { sel.select(); } catch(IOException e) { break; } Set<SelectionKey> keys = sel.selectedKeys(); Iterator<SelectionKey> iter = keys.iterator(); while(iter.h...
a4dd4f38-bdee-4dba-a51b-30b6db1fc3d8
1
private void onOK() { try { Config.getInstance().setRpcURL(serverTextField.getText(), Integer.parseInt(portTextField.getText())); Config.getInstance().setRpcUser(userTextField.getText()); Config.getInstance().setRpcPass(new String(passwordTextField.getPassword())); ...
59f4fe49-1c58-412a-902c-faa143a6d702
1
public Boolean Query(String sql) { Statement stmt; try { stmt = con.createStatement(); return stmt.execute(sql); } catch (Exception e) { System.out.println("Error running statement: " + e.toString()); return false; } }
5de31d36-215c-41ea-8826-f0895e934821
9
public List getUnparsedEntities() { if (unparsedEntities == null) { return null; } List list = new ArrayList(unparsedEntities.size()); for (int i=0; i<unparsedEntities.size(); i++) { Object ent = unparsedEntities.get(i); String name = null; ...
71f53c32-8a84-40d2-8e71-61899db1f3b3
4
@Override protected void paintComponent(final Graphics g) { if (scaledMapImage == null) { super.paintComponent(g); } else { mode.paint(g); for (java.util.Map.Entry<Integer, Color> override : overrides.entrySet()) { paintProvince((Graphics2D) g, ov...
79dd9b10-5baa-4d17-a555-75b7286613c6
3
private static InputStream findConfiguration( String suggestedFile ) throws FileNotFoundException { if (suggestedFile == null || suggestedFile.isEmpty()) { suggestedFile = DEFAULT_CONFIGURATION_FILE; } File file = new File( suggestedFile ); if (file.isFile()) { ...
796fe06d-0e68-45dc-b9cf-82c60fab9dd9
5
public static byte[] getBuffer(File f) throws Exception { if(!f.exists()) return null; byte[] buffer = new byte[(int) f.length()]; DataInputStream dis = new DataInputStream(new FileInputStream(f)); dis.readFully(buffer); dis.close(); byte[] gzipInputBuffer = new byte[999999]; int bufferlength = 0; GZIPInp...
2fc9e557-1f41-43cf-bfcd-20f23dfcafd4
1
public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext( "applicationContext.xml"); MessageManager messageManager = (MessageManager) context .getBean("messageManager"); try { messageManager.display(); Thread.sleep(1000); messageManager.display(); ...
b27e5894-69c3-4e2e-a4e5-69d8f440e728
3
private void register(Path dir) throws IOException { WatchKey key = dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY); if (trace) { Path prev = keys.get(key); if (prev == null) { log.info(String.format("register: %s\n", dir)); } else { if (!dir.equals(prev)) { log.info(String.for...
c37acef3-9f71-4d64-a3e7-7014050891b3
4
public void startMIDlet(String name) throws InstantiationException, ClassNotFoundException, IllegalAccessException { if(active != null && !active.inDestruction){ try{ active.inDestruction = true; active.destroyApp(...
3810752a-2020-4503-9ee1-88784f803ebd
6
public void visitArrayRefExpr(final ArrayRefExpr expr) { // a[i] // [a[i]] <= [element type of a] final Expr array = expr.array(); if (!expr.isDef()) { if (!array.type().equals(TypeInference.UNDEF) && !array.type().equals(Type.OBJECT) && !array.type().equals(Type.SERIALIZABLE) && !array.type(...
8ef73190-4de5-4837-8399-46292f6ced4a
4
private void buildAttributes(Node node, StringBuffer buf) { Iterator it = node.getAttributeKeys(); StringBuffer readOnlyAtts = new StringBuffer(); if (it != null) { while (it.hasNext()) { String key = (String) it.next(); Object value = node.getAttribute(key); boolean isReadOnly = node.isReadOnly...
a3d685b8-94e1-4e66-b220-a57eedee2a1d
5
private boolean isCheck(Player player) { Iterator<Position> pieceIter = Board.chessBoard.keySet().iterator(); while(pieceIter.hasNext()){ // YG: 이 변수 무슨 역할인지 이해할 수 없음 Position isValidWhenKing = (Position) pieceIter.next(); Piece inspectedPiece = Board.chessBoard.get(isValidWhenKing); if (!player.isS...
1bd3cdcd-7712-4018-8b24-d9c2ffd25112
1
private static void displayDrugs(ResultSet rs) throws SQLException{ StringBuffer bf = new StringBuffer(); while (rs.next()){ bf.append(rs.getInt("drugid")+": "); bf.append(rs.getString("drugname")); System.out.println(bf.toString()); bf.delete(0, bf.length()); } }
9de6a50a-ea88-48c3-a02b-823b6cc764a9
9
protected void rRun() { boolean flag = false; try { sendUpdate(); while(super.isRun) { int i = super.In.available(); if(i >= 2) readLine(); else if(bufferOut.size() >= 2) ...
faf28043-71d6-4396-9fa0-a55b617432a7
1
public Hash() { hashTable = new List[length]; for (int i = 0; i < length; i++) { hashTable[i] = new List(); } }
0fc1de85-d7a1-4668-8e60-012ef3f0dc2a
0
public void setSeatType(String value) { this._seatType = value; }
9347012b-e804-4629-8cb8-0086daa9a952
5
public int alphaBeta(char player) { redWinFound = blackWinFound = false; if (player == Board.MARK_BLACK) { evaluateBlackMove(0, 1, -1, Integer.MIN_VALUE + 1, Integer.MAX_VALUE - 1); if (blackWinFound) { return column; } ...
e20f843d-23dc-4654-a751-9ce601d1f38b
5
private void analyseWithAssemblyOpTree(String assemblyLine) throws AssemblerException { AssemblyOpTree assemblyOpTree = data.getAssemblyOpTree(); String rootNode = assemblyOpTree.getRootToken(); ArrayList<String> roots = assemblyOpTree.getAssemblyOpTreeHash().get(rootNode); ArrayList<ArrayList<String>> paths...
ff65fc8b-e1ee-44e3-8ebd-388f475288a1
8
public static List<Field> getAll(Class entityClass) { List<Field> fields = new ArrayList<>(); for (Field field : entityClass.getDeclaredFields()) { if (field.getName().equals("serialVersionUID") || Modifier.isTransient(field.getModifiers()) || Modifier.isStatic(field.getModifiers()) || !isTypeAllow...
b2b88003-bb04-4a90-880f-a9adb716c50e
0
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
e8a90509-8bfb-49ed-ae7d-5a0b53923ecd
9
public String stExternalEmailGoogleLogin(int dataId,int ExpVal,String flow ) { int actVal=1000; String returnVal=null; hm.clear(); hm=STFunctionLibrary.stMakeData(dataId, "Login"); String emailadrs = hm.get("EmailAddress"); String password = hm.get("Passwor...
a5f90eaa-d772-4bf1-9ba9-13fbf3bdbb42
6
private int placeOfLastMathSign() { String expressionInDisplay = getDisplay().getText(); int lengthOfExpression = expressionInDisplay.length(); while (lengthOfExpression > 0) { String lastCharacter = expressionInDisplay.substring(lengthOfExpression - 1, lengthOfExpression); if (lastCharacter.equals...
0ec58676-9a80-421b-9600-4b85faaea977
8
public void errResponseReceived(final SipResponse sipResponse) { Dialog dialog = dialogManager.getDialog(sipResponse); if (dialog != null) { dialog.receivedOrSent300To699(); dialogManager.removeDialog(dialog.getId()); } int statusCode = sipResponse.getStatusCode()...
9cb379e0-99ee-4d90-b41e-5eb715dac686
2
@Override public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals(OK)) { ok(); } else if (e.getActionCommand().equals(CANCEL)) { cancel(); } }
fc88e3d8-a29d-4744-9875-1a668bbd5957
6
@Override public int getIndexOfChild(Object parent, Object child) { if ( parent.getClass() == SpritesFile.class ) { SpritesFile file = (SpritesFile)parent; for ( int i = 0 ; i < file.getMoveCount() ; i++ ) if (child.equals(file.getMove(i)))return i; ...
0b379bb8-f13d-4622-b8d4-54d65e29bae8
1
public static String delambda(String string) { return string.equals(Universe.curProfile.getEmptyString()) ? "" : string; }
818ae184-7542-4fc5-9727-3aa185bd91d3
5
private byte[] HandleRevealSubscriptionCommands(short transId, byte api, byte opcode) { switch(opcode) { case 0x01: break; case 0x02: break; case 0x03: break; case 0x04: break; case 0x05: break; } return null; }
154677d8-3ac3-427f-ae2a-eb5d09e0eb8a
5
public static String trimWhitespace(String str) { if (!hasLength(str)) { return str; } StringBuilder sb = new StringBuilder(str); while (sb.length() > 0 && Character.isWhitespace(sb.charAt(0))) { sb.deleteCharAt(0); } while (sb.length() > 0 && Character.isWhitespace(sb.charAt(sb.length() - 1))) { s...
97ec32cd-dc90-41d9-aa7e-e0616ad914a3
7
private void setupLinks() { // // now acquire links. // final int rawlinksnum = this.links.size(); int[] rawlinks = new int[rawlinksnum * Link.LINK_SIZE]; int idx = 0; // for (int i = 0; i < rawlinksnum; i++) { final int[] link = this.links.ge...
bc5421f5-effa-4184-b702-4471c4917cb5
3
private void addValueElement(final String element, final String name, final String desc, final String value) { AttributesImpl att = new AttributesImpl(); if (name != null) { att.addAttribute("", "name", "name", "", name); } if (desc != null) { att.addAttribute("", "desc", "desc", "", desc); } if (v...
a89e36b9-667f-4e28-ac2e-2264d04e439b
5
final AbstractFontRasterizer createFontRasterizer(BitmapFont class143, ImageSprite[] sprites, boolean supportsAlpha) { int[] indexWidths = new int[sprites.length]; int[] indexHeights = new int[sprites.length]; boolean isAlphaIndexed = false; for (int i = 0; i < sprites.length; i++) { indexWidths[i] = ...
7c8bfdb3-d939-44cf-92c3-afee0b7bac03
6
@EventHandler public void SpiderBlindness(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.getSpiderConfig().getDouble("Spider.Blind...
996861bb-34f0-4d91-a1fa-113d7b94c65e
1
@Override public int hashCode() { return playerNames != null ? Arrays.hashCode(playerNames) : 0; }
e80556b6-ca19-45ef-9f4c-e9b5290ffacd
8
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(((msg.targetMajor()&CMMsg.MASK_MALICIOUS)>0) &&(!CMath.bset(msg.sourceMajor(),CMMsg.MASK_ALWAYS)) &&(msg.target()!=null) &&(msg.target().Name().equalsIgnoreCase(text()))) { final MOB target=(MOB)msg.target(); if((!tar...
531db65b-795a-4665-a7c8-25d38b4daa95
6
@Override public String toString(){ if(polynomial == null || polynomial.isEmpty()) return "0"; String out = ""; ListIterator lIt = polynomial.listIterator(); int index = -1; while(lIt.hasNext()){ index++; out += ((Term)lIt.next()).toString(...
a0d7ac57-441d-4c0a-968f-f867e1541fa6
5
public void validaEndereco(String cep, String rua, String numero, String bairro, String cidade) { if (cep.replaceAll("-", "").trim().isEmpty()) { JOptionPane.showMessageDialog(null, "CEP Inválido"); txt_cep.requestFocus(); } else { if (txt_rua.getText().isEmpty()) { ...
64c93856-12f7-44c2-ac20-dfb87becda4d
7
private void enodeFileNames(File dir) { if (!dir.isDirectory()) { return; } File[] files = dir.listFiles(); int cntr = 0; for (File file : files) { if (file.isDirectory()) { enodeFileNames(file); } else if (!fileIsInUnlimitedSizeFolder(file, dontLimitMaxFilesInDirs)) { ++cntr; } if (...
10baef50-ee7c-485c-95d5-ea76d788c0c7
0
public EventItf makeEvent() { // Construct the AutoBean AutoBean<EventItf> car = factory.event(); // Return the Book interface shim return car.as(); }
d01e5ff1-3277-4810-b7cc-2d7006f9a418
5
int maxValue(Board cB, int ply) { //System.out.print("Max" + ply + ": "); int[] moves = new int[7]; int highest = 0; for (int i = 0; i < 7; i++) { moves[i] = Integer.MAX_VALUE; if (cB.validMove(i)) { cB.makeMove(i); if ((cB.winnerIs() == 0) && ply>0) { moves[i] = minValue(cB,ply-...
b41c9d73-ed89-4514-912c-6fe72ec5bb46
3
@Override public void play(String audioType, String fileName) { //inbuilt support to play mp3 music files if (audioType.equalsIgnoreCase("mp3")) { System.out.println("Playing mp3 file. Name: " + fileName); } //mediaAdapter is providing support to play other file formats e...
f90d791c-5b41-4f7f-8fc6-16eb35f48b90
5
public boolean jsFunction_waitWindow(String name, int timeout) { deprecated(); int curr = 0; if (timeout == 0) timeout = 10000; while (curr < timeout) { if (JSBotUtils.lastCreatedWindow != null && JSBotUtils.lastCreatedWindow.cap.te...
a2706148-2a7f-44d5-8b04-ee54c574c14e
6
@Override public void onStackChanged(UIInventorySlot slot, ItemStack previous) { if(slot == slots[40] || slot == slots[41] || slot == slots[42] || slot == slots[43] || slot == slots[44] || slot == slots[45]) { checkCraft = true; } }
692653fe-eee7-4930-ade6-ca3b43cc9ffa
2
@Override public HTTPResponse handle(HTTPRequest req) { Map<String, String> env = cgiApp.environment(); env.put("PATH_TRANSLATED", req.getPath()); env.put("PATH_INFO", req.getPath()); env.put("REMOTE_ADDR", req.getClientIP()); env.put("QUERY_STRING", req.getQueryString()); env.put("REQUEST_METHOD", req.g...
94b6f986-ca07-4dc5-b1a8-ac642a6d227e
4
public int executer_update(String requete) { int key = 0; if (this.debug){ System.out.println("DEBUG : REQUETE : "+requete); } try { this.stmt.executeUpdate(requete, Statement.RETURN_GENERATED_KEYS); } catch (SQLException ex) { Logger.getLogger...
9dc47d82-9f3f-4dc8-84d1-93faa10d22a6
8
public void testUnregisteredClasses () throws IOException { final Data dataTCP = new Data(); populateData(dataTCP, true); final Data dataUDP = new Data(); populateData(dataUDP, false); final AtomicInteger receivedTCP = new AtomicInteger(); final AtomicInteger receivedUDP = new AtomicInteger(); final Ser...
b68dc8f9-e3de-4f6f-8b46-b3aa0e1d3362
8
public EvaluationResult evaluate(List inputs, EvaluationCtx context) { // Evaluate the arguments one by one. As soon as we can return // a result, do so. Return Indeterminate if any argument // evaluated is indeterminate. Iterator it = inputs.iterator(); Evaluatable eval = (Eva...
43da6839-6a6e-4c53-8c36-5f9ec8c1370b
1
public static void main(String[] args) { List<_3_InfiniteRecursion> v = new ArrayList<_3_InfiniteRecursion>(); for (int i = 0; i < 10; i++) v.add(new _3_InfiniteRecursion()); System.out.println(v); }
2de0e035-c229-4209-8f72-a44136a9479c
3
public int[] getSample(){ ArrayList<int[]> temporalListClone; synchronized(listLock){ temporalListClone = new ArrayList<>(temporalList); } int[] avgSignal = new int[4]; for(int i = 0; i<temporalListClone.size(); i++){ int[] listSample = temporalListClone.get(i); System.out.println(listSample[0]+" "+listSa...
b339203f-4631-4765-8fbc-dd44c088ff5a
0
public void execute() { System.out.println("Called ThirdStrategy.execute()"); }
f788bfc2-da83-4aa5-955e-f0150f87f5bf
2
public boolean equals(Object o) { Match m = (Match) o; return m.homeTeam.equals(homeTeam) && m.awayTeam.equals(awayTeam) && m.score.equals(score); }
4d86ee86-d054-42db-8f49-e30f726217f7
3
@Override public String toString() { return width + "x" + height + (fullscreen ? " -F" : "") + (borderless ? " -B" : "") + (icon == null ? "" : " " + icon.toString()); }
1d839e2d-f3be-41d3-82da-f1b5a949b4a3
6
@Override public boolean undo(final CardGame game, final CardPanel panel) { List<Card> pack = game.getPack(); if (game.canAddToDeckFromBoard()) { //We don't want to do this halfway through a deal if (pack != null) { Stack<Card> deck = game.getDeck(); ...
e45c864b-87e5-4f37-be6a-8dc5fd2355e1
6
public void loadAllClientReps(){//COMPLETE try { ResultSet dbAllClientReps = null; Statement statement; statement = connection.createStatement(); dbAllClientReps = statement.executeQuery( "SELECT ClientRep.clientRepID, ClientRep.organisationID, ClientRep.c...
a8337533-7019-420c-98d7-15e04c5cc58f
3
protected boolean parseArgs(String[] args) { boolean parsed = false; if (args.length == 1) { init(args[0]); parsed = true; remote = false; } else if (args.length == 2) { if (!(args[0].equals("-url"))) { showUsage(); } else { init(args[1]); parsed = true; remote = tru...
3f9e78a1-46c5-4dcc-9b10-92aa4c643a12
9
public void nextDay( final List<LifeformModel> neighbors, final List<Cardinal> freeSpace ) { final int move = Rand.randInt( 0, 100 ); if( ( move > 50 ) && ( freeSpace.size( ) > 0 ) ) { final int cardinal = Rand.randInt( 0, freeSpace.size( ) - 1 ); GridModel.move( free...
4c8881a1-bec4-40ff-ad9c-026a51b670c9
1
public boolean pass(int[] bowl, int bowlId, int round, boolean canPick, boolean musTake) { updateStats(bowl, round); if (totalFruitSeen >= 60) { return distributionStrategy(bowl); } else { return stoppingStrategy(bowl, round); } }
2474bfa4-0d2a-410d-9ab7-2cc7aec0c220
5
public Vector<Block> extractBlocks(ProbChar[] probabilities) { //make a vector to hold all the new blocks Vector<Block> blocks = new Vector<Block>(); //start filling the vector //go through the probabilities array, looking for blocks of non wilds Block currentBlock = null; for(int index = 0; index < probab...
83ea792b-e461-449b-ad78-6cde1a350887
1
private void addSongToPlaylist() { try { int playlistid; int songID; System.out.println("Enter Playlist ID: "); showPlaylists(); playlistid = Keyboard.readInt(); System.out.println("Enter Song ID: "); showSongs(); ...
5d07195d-fcc8-465c-9307-203d20edad22
2
private int getExportSize() { try { int sizeReturn = 0; for (int i = 0; i < activeControllers.size(); i++) { // The fixed component siez of 17, +2 is the length byte and bundle ID before each bundle sizeReturn += 24; } return sizeReturn;...
832e3ced-e5b6-4695-b57f-9f4f026f5a9d
0
public JTable getjTableOffre() { return jTableOffre; }
e76679bb-8f5c-492e-9133-4dffd73e133b
9
public int bitrate(int i) { if (i >= links) { return (-1); } if (!seekable && i != 0) { return (bitrate(0)); } if (i < 0) { long bits = 0; for (int j = 0; j < links; j++) { bits += (offsets[j + 1] - dataoffsets[j]) *...
9ec38da4-2571-45ba-8a1b-397ba6f88a19
8
public static FactorExtraTrees getData2(int ndata, int ndim, int ntasks) { if (ndim<2) { ndim = 2; } int[] output = new int[ndata]; int[] tasks = new int[ndata]; double[] v = new double[ndata*ndim]; for (int i=0; i<v.length; i++) { v[i] = Math.random(); } Matrix m = new Matrix(v, ndata, ndim...
4ce623f9-d193-41fe-8470-3259b80a1dc6
0
public String getParagraph() { return textArea.getText(); }
676f95ab-a24c-431f-bae4-658045149c50
5
private final TreeSet<Path> selectFilesOnly(Set<Path> selection) { final TreeSet<Path> selectionFiles = new TreeSet<>(); final ArrayDeque<Path> queue = new ArrayDeque<>(selection); while (!queue.isEmpty()) { final Path p = queue.remove(); if (p.toFile().isDirectory()) { for (final String dir : ((SongDat...
d27b32c0-adc9-49cf-9b3e-91b18b6a273a
1
@Override public void setSelected( Selection selection ) { this.selection = selection; box.updateSelected(); ItemSelectionEvent event = new ItemSelectionEvent( box, selection ); for( ItemSelectionListener listener : listeners() ){ listener.itemSelectionChanged( event ); } }
26fe33b8-75f0-4f1d-afbb-a1bff27c3062
1
public void eat(int healthIncrease, int fixHunger) { if(fixHunger != 0) { mealTime1 = Parasite.theTime.getRawMinutes(); hunger = hunger-fixHunger; } modifyHealth(healthIncrease); }
4322bfdf-999d-45d8-b343-d0a2faf68184
0
public void seenAt(SharingPeer peer) { this.seen++; }
10e8b175-790d-4e6f-901d-877171d44386
8
public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("ok")) { if (m_isFirstClick) { if (m_editor != null) { m_editor.setCaretPosition(m_editText.indexOf(m_findField.getText())); m_editor.requestFocus(); } else { } m_isFirstCli...
069a7dc9-08b0-4434-a847-96dc4483f19e
0
@Id @Column(name = "person_id") public int getPersonId() { return personId; }
824cedec-c077-4eef-a056-26beafb87bc1
2
public boolean pressPointIsInsideCard(Point pressPt) { // part 1, seems this method should be named: checkPressPoint() return (cardArea.contains(pressPt) && !hasBeenRemoved ? true : false); //return false; //You may need to change this }
191486ae-ee5d-40c4-8d86-e6b2a39f6a99
3
static void scoreAndEmpties() { Scanner in = new Scanner(System.in); final Board b = Board.readBoard(in); ArrayList<Integer> nextPiece = new ArrayList<Integer>(); while(in.hasNextInt()) nextPiece.add(in.nextInt()); Heuristic hAll [] = { //new BoardScore(), new BoardScoreNormalised(), new...
3d89cde7-5120-4107-a167-f55e2cc6e072
2
@Override public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception { Contexto oContexto = (Contexto) request.getAttribute("contexto"); oContexto.setVista("jsp/hilo/form.jsp"); HiloBean oHiloBean; HiloDao oHiloDao; oHiloBean = new HiloBe...
9aa18517-a8b8-4a26-bb14-a3a0e90cc447
8
private short[] chooseSplitIndex(short axis) { int used = this.getUsed(); int rstarMin = getMMin(); short[] sort = new short[used]; short[] bestSort = new short[used + 1]; int k; int maxK = (getMMax() - 2 * rstarMin + 2); // Anzahl der Teilmengen // M - 2m + 2 double value = 0.0; double be...
09d51fc7-d27e-4ff4-82ab-d634d241db52
1
public void deleteInformation(String code) { data.setUse(code, false); if (informations.remove(code)) notifyZElement(); }
642905d9-b68b-41da-a6d6-0f2329785e19
8
@Override public void run() { while (!stop) { // get the oldest updated monitor try { FolderMonitor monitor = updatedMonitors.take(); Event event = monitor.poll(); File file = event.getFile(); if (file == null) continue;// Should only be possible for OVERFLOW events, // which are n...
839e8674-2ccb-4110-b0d2-7caad825c9ee
0
public List<EventComment> findBeforeEventCommentsByHallEventId(final Long hallEventId) { return new ArrayList<EventComment>(); }
d129fdff-f155-4482-8172-cb8617b09cf5
5
@Override public String toString() { StringBuilder sb = new StringBuilder(); if (!"".equals(mode.getName())) sb.append(mode.toString()); if (isNegation) sb.append(LITERAL_NEGATION_SIGN); sb.append(name); sb.append(getPredicateString()); if (null != temporal) sb.append(temporal.toString()); if (isPlaceHo...
35f387e7-0f9e-4226-a1be-ec8f374028a0
0
public LocaleSet(String threeCharCode) throws UnsupportedEncodingException { super(); add(new Locale(LocaleSet.iso639_2_to_iso639_1(threeCharCode))); }
3cc186d4-35b4-45d5-aa2b-b03a6b5c0795
0
public static void main(String[] args) { JFrame frame = new JFrame("Mandelbrot"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(116,138); frame.add(new MandelbrotPanel()); frame.setVisible(true); // System.out.println(BigDecimal.valueOf(1).divid...
aa68262c-6713-44f3-885c-237e31a6475c
4
private List<String> getFileContentsWithSpecialCharactor(File file, String oChar) { List<String> contents = new ArrayList<String>(); try { FileInputStream fstream = (FileInputStream) getFileInputStream(file); BufferedReader br = new BufferedReader(new InputStreamReader(fstream, Constant.ENCODING)); String ...
16b3bfef-a48d-4417-81dd-169f33c9cf43
9
public void draw(Object obj, Component comp, Graphics2D g2, Rectangle rect) { Color color = (Color) AbstractDisplay.getProperty(obj, "color"); if (color == null && obj instanceof Color) color = (Color) obj; Color textColor = (Color) AbstractDisplay.getProperty(obj, "textColor"); ...
6469355d-33d0-4830-a7bc-c89303cdc7ec
3
public void refresh() { for (Setting setting : modelSettings.getSettings()) setting.read(); System.out.println("refresh"); ArrayList<Pair<Property, String>> need = ModelType.getNewInstance( ModelType.valueOf((String) cb.getSelectedItem())).neededSe...
4c0cce80-f96e-49a4-9154-0c3458ab7a51
4
public static synchronized Phone getInstance(String phoneType) { int index = -1; if (phones == null) { phones = new ArrayList<>(); Phone phone = new Phone(phoneType); phones.add(phone); index = 0; } else { int counter = 0; for (Phone phone : phones) { if (phone.getPhoneType().equals(phoneT...
721d5001-b1b0-4d54-9f09-08a34ea824f0
1
@Override public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException { if (DATA_FLAVOR.equals(flavor)) { return this; } throw new UnsupportedFlavorException(flavor); }
f5cd97f8-7431-452d-82b0-d463d4f30027
1
public void mouseReleased(MouseEvent e) { //permet de mettre à jour les champs de texte lorsque l'on a bougà le curseur du slider if (e.getSource() == slider){ val_S.setText(Integer.toString(slider.getValue()/1000)); val_ms.setText(Integer.toString(slider.getValue()%1000)); val_S.setColumns(2); val_ms.s...
59b20a23-4850-4072-a186-736b170576d0
5
public void keyPressed(KeyEvent e) { if( e.getKeyCode() == KeyEvent.VK_A || e.getKeyCode() == KeyEvent.VK_LEFT){ panel.setOption(0) ; this.panel.repaint(); }else if(e.getKeyCode() == KeyEvent.VK_D || e.getKeyCode() == KeyEvent.VK_RIGHT){ panel.setOption(1) ; this.panel.repaint(); }else if(e.getKeyCode...