method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
60fc3cc1-2a64-4061-8618-4156876b3825
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final ChangeOfState other = (ChangeOfState) obj; if (newState == null) { ...
a72468c3-f033-47ad-921c-ffdf5736ecdb
5
private void ladeFressakte(File aktdatei) { if (!aktdatei.exists() || aktdatei.isDirectory()) { System.err.println("Geschichtsdatei existiert nicht oder ist Ordner"); return; } try { BufferedReader reader = new BufferedReader(new FileReader(aktdatei)); String line; while ((line = reader.readLin...
889a0d30-a2ad-419d-a49a-da07169bd3fc
7
public void clusterDocument(Document doc) throws Exception{ Transaction tx = graphDb.beginTx(); try { ArrayList<Sentence> sentencesList = doc.getSentences(); // these tables will be used to calculate the similarity between the new document and existing cluster Hashtable<String, Double> documentSimilairtyTabl...
3af455fa-4427-4414-8bc1-0e40fadf8399
8
public String makingReservation(String type){ Random rand=new Random(); String resr=""; if(type.equals("W")){ for(int i=0;i<wSeats.length;i++) { if(wSeats[i].equals("NA")){ if(i/3==0){ resr="A"+i+(rand.nextInt(899)+100); wSeats[i]=resr; } else{ resr="D"+(i-3)+(ran...
fc37a129-b449-41cc-99a3-00f91cb0a201
6
private void button_remove_blue_listMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_button_remove_blue_listMousePressed if(frame_index_selected!=-1) { if(current_frame==null) { Element new_frame = hitboxes_doc.createElement("Frame"); new_frame.setAttribute(...
4fcac906-74c3-430f-a253-de6be5fb5c40
4
public void removeFocus(){ if(tmpFocus==null && focus==character) return; tmpFocus = null; focus = character; focusing = false; moving = true; if(wasCharacterFacingLeft!=null) if (wasCharacterFacingLeft != character.getDirection()){ character.changeDirection(); wasCharacterFacingLeft = null; ...
281c7bfe-c48b-4b80-b3a9-39bc29f56c44
7
private static void binarySearchFirst(int[] a, int i) { // TODO Auto-generated method stub int start = 0; int mid = 0 ; int end = a.length; while(start<end){ mid = ((start + end)/2); System.out.println(mid); if (a[mid] == i){ end = mid; } else if(a[mid] < i){ start = mid + 1; ...
3322db09-401f-4861-b69e-3df46ecea217
6
public int countMatches(String dataFile){ if(localconditions == null) { localconditions = new String[0]; } MatchData M = new MatchData(dataFile); Match m; int c = 0; Set<Integer> players = new HashSet<Integer>(); while((m = M.getNext()) != null...
8d83ede3-320e-4837-ba6d-625f1a70f66d
1
public int[] readAllInts() { String[] fields = readAllStrings(); int[] vals = new int[fields.length]; for (int i = 0; i < fields.length; i++) vals[i] = Integer.parseInt(fields[i]); return vals; }
79556ff8-470f-4523-b779-9c439d796f49
2
public MainMenuPanel(MainPanel mainPanel){ super(MainMenuPanel.ID,mainPanel); this.background = new Sprite("others/backMenu.png"); this.playSprite = new Sprite("others/menuButton.png"); this.exitSprite = new Sprite("others/menuButton.png"); this.mainPanel = mainPanel; this.setLayout(null); this....
3ed4a1ff-ca31-49b4-9ec5-0f35a2f40dd5
7
public void handle(String token) { StringTokenizer st = new StringTokenizer(token, " "); String action = st.nextToken(); List<String> params = new ArrayList<String>(); while (st.hasMoreTokens()) params.add(st.nextToken()); // Individual handling if (act...
1408e64d-b06e-4ef3-9930-c36c0d543002
8
public static final TypeBinding wellKnownType(Scope scope, int id) { switch (id) { case TypeIds.T_boolean: return TypeBinding.BOOLEAN; case TypeIds.T_byte: return TypeBinding.BYTE; case TypeIds.T_char: return TypeBinding.CHAR; case TypeIds.T_short: return TypeBinding.SHORT; case TypeIds.T_double...
0d60e567-142b-4851-bc14-71c0091d1e5c
0
@Override public AbstractPlay get(int number) { return bestPlays.get(number); }
f1300783-0720-4f42-bcbb-778770feef19
2
private void runSingleFile(String[] args) { ConfigurationForStdOut configuration = ConfigurationForStdOut.parse(args); configuration.setProperties(properties); if (configuration.isInvalid()) exitStatus = 1; if (configuration.showHelp()) { System.out.println(config...
4371f86f-4a14-498a-ad2f-57373a45a369
7
private void reflectClassWrapper(Map<Type, Set<GeneTrait>> genePool, String className, int parameterCount, List<String> parameterTypes, int parametersSet) throws ClassNotFoundException { // This wrapper takes care of running reflectClass() for all possible combinations of parameter types on classes that are paramete...
fc56b302-de06-4f19-bf1d-d04257a42550
5
synchronized void runProjectiles() { java.util.List<Projectile> remove = new LinkedList<Projectile>(); for (Projectile p : projectiles) { if (p.time >= 50) remove.add(p); else if(gameIsMultiPlayer() && p.hasCollision(otherPlayer)) { other...
fba97342-2bb8-49a9-a27d-9a29a4daab4c
7
private void loadConfig() throws InvalidConfigurationException { mAllGroups.clear(); mAutoGroups.clear(); FileConfiguration config = getConfig(); mNoisy = config.getBoolean("output_to_console", false); mInterval = config.getInt("ticks_between_run", 1200); if(mInterval <= 0) throw new InvalidConfig...
79c343a3-6971-4e3e-8f0f-16a97504523e
6
public String toStringFile() { StringBuilder string = new StringBuilder(); HashMap<NodeVariable, Integer> nodevariable_agent = new HashMap<NodeVariable, Integer>(); HashMap<NodeFunction, Integer> nodefunction_agent = new HashMap<NodeFunction, Integer>(); Iterator<NodeVariable> itnv; ...
26f75010-2580-437a-80c3-e7b98ea99b86
8
public void draw() { Graphics g = getFrame().getBufferStrategy().getDrawGraphics(); g.setColor(new Color(240, 240, 240)); g.fillRect(0, 0, getWidth(), getHeight()); for (int i = 0; i < grid.getUI().getTowers().size(); i++) { if (grid.getUI().getTowers().get(i).clicked()) { if (getMouse().getY() > 0 && ge...
046241bd-abe4-41a4-bb94-767c5f954be1
3
private static boolean isUsefulProduction(Production production, Set set) { ProductionChecker pc = new ProductionChecker(); String rhs = production.getRHS(); for (int k = 0; k < rhs.length(); k++) { char ch = rhs.charAt(k); if (!ProductionChecker.isTerminal(ch) && !isInUsefulVariableSet(ch, set)) { ...
a1e4ec58-adfb-45f3-9b83-7989c31b3e7e
6
private CompilerToken processFloat(String token, final String state) throws LexicalException { // state: real, realexponent, realexponentzero final String[] parts = token.split("\\."); final String NEW_EXPONENT = "e1"; final String NEW_DECIMAL = ".0e"; validateInteger(parts[0].sp...
b33a6252-8e6e-4255-91f6-648bdba0cf31
4
public BotManager(final int num, long time, final URI uri, final int numMsg) { //this.r = new Random(Thread.currentThread().getId() + Config.MACHINE_SEED); //this.top = r.nextInt(Config.MAX_TOP); //this.left = r.nextInt(Config.MAX_LEFT); this.top = 0; //0 is just a hardcoded value so that I can see bots p...
a4392b91-ae29-46d5-9460-ee87b7c8ad73
5
public void updateEvent() { if (id != null) { PreparedStatement st = null; String q = "UPDATE events SET name = ?, location = ?, start_date = ?, end_date = ? WHERE id = ?"; try { java.sql.Date sd = null; java.sql.Date ed = null; ...
f234364d-4bbe-4e58-a76d-619ad860590f
9
public void rule_mapred() throws Exception { fs.delete(path, true); JobConf job = new JobConf(getConf(), WordCount.class); job.setJarByClass(WordCount.class); job.setJobName("Rule Based Classifier"); job.set("attr_num", String.valueOf(attr_num)); job.set("attr_value", attr_...
7643091c-b208-40a0-9f72-cf19f9f83a2d
1
private boolean isAlertPresent() { try { driver.switchTo().alert(); return true; } catch (NoAlertPresentException e) { return false; } }
84cb931f-3f18-4412-9a1c-ab9eda49e0a7
2
public void run() { try { while (true) { TimeUnit.MILLISECONDS.sleep(100); System.out.println(Thread.currentThread() + " " + this); } } catch (InterruptedException e) { System.out.println("Interrupted"); } }
79646027-49d0-442e-b0ea-d72afa1f668d
3
public JSONWriter array() throws JSONException { if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') { this.push(null); this.append("["); this.comma = false; return this; } throw new JSONException("Misplaced array."); }
6119a698-fe7a-4dd1-97d7-8768c9a2fb2a
1
public void maybeShowPopup(MouseEvent e) { if (e.isPopupTrigger()) { menu.show(e.getComponent(), e.getX(), e.getY()); } }
60478c26-e250-4c91-a4ca-1bbcff75c3f7
6
private boolean isNumberVector() { if(x == Float.NEGATIVE_INFINITY || y == Float.NEGATIVE_INFINITY || x == Float.POSITIVE_INFINITY || y == Float.POSITIVE_INFINITY || x == Float.NaN || y == Float.NaN) { return false; } return true...
02d79fb1-238c-4a52-ab1d-2bae69fd8b64
3
void add() { String apiKey; BufferedReader bufferRead; ArrayList<Pushbullet> devices; Pushbullet device; String s; int option; int i = 0; String alias; UI.clearError(); try { System.out.print("Introduce la \"API_KEY\" del usuario: "); bufferRead = new BufferedReader(new InputStreamReader(Sy...
6c8b1710-a39b-4acf-a127-6cc69267f361
2
@EventHandler public void onPlayerQuit(PlayerQuitEvent e) { IrcClient client = Parent.Manager.getCurrentClient(); for(String s : client.getMcEcho_ActiveChannels()) { try{ client.PrivMsg(s, IrcColor.formatMCMessage(ChatManagerUtils.ParseDisplayName(e.getPlayer())) + IrcColor.N...
9ed3c879-5df0-4be4-b5aa-660cc0099f21
6
static int afficheMenu() { int choix = 0; System.out.println(); System.out.println("1 : Déplacer le porte-avion"); System.out.println("2 : Faire décoller un avion"); System.out.println("3 : Faire attérir l'avion");// affiché si decoller System.out.println("4 : Ne rien faire"); System.out.println("5 : Quit...
4cd7317c-cb90-4002-b139-81c4ac5ac579
1
public void stop() { if (player != null) { player.close(); player = null; } }
2c1f0926-bc82-4e8a-9516-b061325d71c4
6
public int validity() { int specifiedAttributes = 0; if (name != null) specifiedAttributes++; if (quality!= null) specifiedAttributes++; if (source != null) specifiedAttributes++; if (codec != null) specifiedAttributes++; if (releaseDate != null) specifiedAttributes...
5a38082b-b832-4e24-a9aa-2e7444674a78
5
public int Checkhit(){ int i; for(i = 0 ;i < button_count ;i++){ if(xpos >= buttons[i].getX() && xpos <= buttons[i].getX()+buttonPress.getWidth()){ if(ypos >= buttons[i].getY() && ypos <= buttons[i].getY()+buttonPress.getWidth()){ return i; } } } return 3; }
f90e8c0b-7a68-479f-80c2-6c9025ef4039
8
public String findRandom() { // string to return results with String result = ""; // randomiser for finding a random number Random random = new Random(); // a random entry can only be found if there exists a tree if(treeSize>0) { // this number represents the number of traversals to be executed in...
09e93c68-fd84-4cc9-ae61-a92462302dd7
1
public float readFloat(String tag){ float f =0; if(!data.containsKey(tag)){ System.out.println("The tag "+ tag + " did not exist."); return f; } double d = (double)data.get(tag); f = (float)d; return f; }
e5a9ff7b-8fb9-4348-af08-88e13a00488a
9
public static void writeProducts(String src){ XMLInputFactory xmlif = XMLInputFactory.newInstance(); try { XMLEventReader xmlr = xmlif.createXMLEventReader(new FileInputStream(new File(src))); while (xmlr.hasNext()) { XMLEvent e = xmlr.nextEvent(); if (e.isStartDocument()){ System.out.p...
e2c1516c-196e-4fcc-9818-022428291eb9
3
public void setCursor (int n) { for (int i = 0;i<boxes.size();i++) { Box b = boxes.get(i); Day d = b.getDayStored(); if (currentMonth.getNum()==b.getMonthStored().getNum()&&n==d.getNum()) cursor = new Box (b); } repaint(); }
15c3cc53-1f24-4a5b-b0a8-4986b47ce610
9
private static boolean typesHaveTheSameParameter(final Type thisArgument, final Type thatArgument, final TypeMap typeMap) { if (thisArgument.equals(thatArgument)) { return true; } if (isWildcard(thisArgument)) { if (isWildcard(thatArgument)) { return wild...
0aef6fc8-506b-4849-92db-8a15d91c065e
8
@Override public EntityInfo getFileMetaData(String path) throws PathNotFoundException { if (path.contains(hiddenPrefix)) throw new PathNotFoundException(path); if (hardlinks) { //Get hard link paths String[] hardlinks = getHardLinks(path); if (hardlinks.length > 0) { EntityInfo info = innerFs...
ff673efc-78e1-4038-b57e-b603294fbb4b
1
public static void main(String[] args) { Bank b = new Bank(NACCOUNTS, INITIAL_BALANCE); int i; for (i = 0; i < NACCOUNTS; i++) { TransferRunnable r = new TransferRunnable(b, i, INITIAL_BALANCE); Thread t = new Thread(r); t.start(); } }
21bbf946-b806-4956-9ce9-37f2cf87a319
1
public static synchronized boolean wavereplay() { if (Signlink.savereq != null) { return false; } else { Signlink.savebuf = null; Signlink.waveplay = true; Signlink.savereq = "sound" + Signlink.wavepos + ".wav"; return true; } }
fcc5cd15-fdf7-4ba9-a529-9f3db1aefaf6
4
public ZombieFrame(JPanel... contents) { super("ZombieHouse"); // Request keyboard focus for the frame. setFocusable(true); requestFocusInWindow(); requestFocus(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setUndecorated(true); setResizable(false); setBackground(Color.BLA...
4d853ce2-1dc8-4f92-b788-a4da33ca3b2e
0
public void mouseExited(MouseEvent e){ }
a7124a48-d1d3-4ead-9797-00bcc6d6ba4c
4
public void addResultSet(List<Map<String, Object>> resultSet) { if (rowData.size() <= 0) { setResultSet(resultSet); } else { if (resultSet != null && resultSet.size() > 0) { if (resultSet.get(0).keySet().size() != columnNames.length) { throw new IllegalArgumentException("Column names does not match c...
9b3e60c5-bc0d-4e80-8d71-c6df2c8b3608
7
private void txtnumtmovilKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtnumtmovilKeyTyped char caracter = evt.getKeyChar();//Validacion del campo telefono movil if (caracter >= '0' && caracter <= '9' || caracter == 8 || caracter == KeyEvent.VK_BACK_SPACE || caracter == KeyEvent.VK_CAPS_LOCK...
9d3b3e3d-6c7d-40dc-bdfa-6058b0dec431
6
@Override protected void onServerResponse(int code, String response) { if (code == 372 || code <= 5 || code == 375 || code == 376 || code == 396) { if (DarkIRC.currentChan.type == Channel.STATUS) { GUIMain.add_line(response); ...
3f790440-1bf2-4d95-a5e2-d197c0a89355
8
public void countFolders() throws IOException { System.out.println("counting Folders"); finalPath = Paths.get(backupDir.substring(0,backupDir.lastIndexOf(System.getProperty("file.separator"))+ 1)); try {DirectoryStream<Path> stream = Files.newDirectoryStream(finalPath); { for (@SuppressWarnings("unused") ...
815e45d5-1930-4e85-9e4a-b4b8cd68657b
8
private Component toComponent( Object obj ) { Component ret; if( obj instanceof Object[] ) { ret = SJPanel.createVerticalIPanel(null); Object[] objs = (Object[]) obj; for( int i=0; i<objs.length; ++i ) { ((SJPanel)ret).add( toComponent(objs[i]) ); } } else if( obj instanceo...
af786dce-3d4e-43f4-a150-59bd0ccb39e3
5
private void createNewRoom() { String name = mainPanel.getNewChatRoomName(); if(name == null) { return; } if(name.isEmpty()) { return; } try { ChatRoom room = session.create(name); mainPanel.addChatRoom(roo...
a04623a0-1805-4895-9180-d478e19f8d09
6
private static void errorMessage(String message, String expecting) { // Report error on input. if (readingStandardInput && writingStandardOutput) { // inform user of error and force user to re-enter. out.println(); out.print(" *** Error in input: " + message + "\n"); out....
c7a0c0ab-3716-43c1-8a1d-22dd44b78c63
7
public TreePath getPath(String fullName) { if (fullName == null || fullName.length() == 0) return new TreePath(root); int pos = -1; int length = 2; while ((pos = fullName.indexOf('.', pos + 1)) != -1) length++; TreeElement[] path = new TreeElement[length]; path[0] = root; int i = 0; pos = -1; ne...
e0824107-2cd5-4228-8ed3-854d9ea7e0d1
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; SequencePosition other = (SequencePosition) obj; if (position == null) { if (other.position != null) return false; } else if (!position....
b46feb22-7044-48cf-95b1-36644ac10f77
2
public List<String> getIDS() { List<String> citationIDS=new ArrayList<>(); String query="select distinct "+attr+" from "+tablename+" order by paperid asc limit "+cur+","+limit; ResultSet rsSet=sqLconnection.Query(query); try { while(rsSet.next()) { String id=rsSet.getString(attr); citationIDS.add...
13a464d5-1e79-4730-be45-364cba8d4ae5
5
private void doLogin (final String username, String password, String mojangData, String selectedProfile) { if (ModPack.getSelectedPack().getDisclaimer() != null && !ModPack.getSelectedPack().getDisclaimer().isEmpty()) { ErrorUtils.tossError(ModPack.getSelectedPack().getDisclaimer()); } ...
35cecc7a-8bf1-41de-9c50-1288831cdd73
3
private static Method findSuperMethod2(Class clazz, String name, String desc) { Method m = findMethod2(clazz, name, desc); if (m != null) return m; Class superClass = clazz.getSuperclass(); if (superClass != null) { m = findSuperMethod2(superClass, name, desc); ...
a1564e74-565a-4fe5-8922-ed6ec76de79c
9
public boolean dispatch(CommandSender sender, String commandName, String label, String[] args) { for (int argsIncluded = args.length; argsIncluded >= 0; argsIncluded--) { StringBuilder identifierBuilder = new StringBuilder(commandName); for(int i = 0; i < argsIncluded; i++) { identifierBuilder.append(' ').a...
138e6538-39c0-4222-bfda-6341d1adc815
2
private static MavenJarFile downloadAndUnzipJarForUnix(MavenJarFile oldMavenJarFile, URL jarRepository, FileDAO fileDAO) throws MalformedURLException, IOException, XMLStreamException { MavenJarFile downloadedJarFile = null; URL archiveURL = WebDAO.getUrlOfZippedVersion(jarRepository, ".tar.gz", true); ...
ed8e2eba-d103-49cb-93f9-5bf76cb07064
4
@Override public boolean equals (Object obj) { if (!(obj instanceof Entry)) { return false; } Entry e = (Entry) obj; return (piece == e.piece) && (pieceRange.equals(e.pieceRange)) && (file.equals(e.file)) && (fileRange.equals(e.fil...
4495b5af-1b6e-4bce-8380-dcf8e0d52975
4
public void createFileProtocol(String protocolName, String className) { try { Class theClass = Class.forName(className); FileProtocol fileProtocol = (FileProtocol) theClass.newInstance(); fileProtocol.setName(protocolName); boolean success = addProtocol(fileProtocol); if (success) { if ...
8e45ae79-2675-41b4-81b1-d9d20c294075
9
public void addRecentFile( String filename ) { boolean notListed = true; //true if file is not on list, false if on list int index = 0; //determine if filename exists in list for(int i=0; i<numRecentFiles; i++) { String rf = getRecentFile( i ); if( rf...
719e635c-b57d-4552-9712-80aa102f67d9
6
private boolean dadosValidos() { return !StringHelper.estaNulaOuVazia(txtCpf.getText()) && !StringHelper.estaNulaOuVazia(txtLogin.getText()) && !StringHelper.estaNulaOuVazia(txtNome.getText()) && !StringHelper.estaNulaOuVazia(txtSenha.getText()) &&...
43745a25-37bc-45fd-bd13-c74d5508355e
2
static void round(int nr) { writeln("Round "+nr); int correct = 0; for(int i = 0; i < Q_PER_ROUND; i++) { if(question(i+1)) correct++; } writeln("Round grade: "+correct+"/"+Q_PER_ROUND); writeln("---------------------------------"); }
af279566-588c-46d4-a79f-4330ac390aa3
2
private void print(byte[] bytes, String name) { System.out.print("byte[" + name + "]:"); for (int i = 0 ; i < bytes.length ; ++i) { System.out.print("" + bytes[i]); if (i < bytes.length ) { System.out.print(", "); } } System.out.println...
890f80a3-74ad-4fb5-bbb5-28e55dc22903
8
public double[] distributionForInstance(Instance instance) throws Exception { double[] result = new double[instance.numClasses()]; switch (m_CombinationRule) { case AVERAGE_RULE: result = distributionForInstanceAverage(instance); break; case PRODUCT_RULE: result = distributionForInstanceProd...
1f1e5849-0523-4f32-9412-a1a7231fd4c4
3
public MySplash(Rectangle progressArea, Color progressColor, Point statusPosition, Color statusColor) { this.progressColor = progressColor; this.statusPosition = statusPosition; this.statusColor = statusColor; this.progressArea = progressArea; if ((splash == null) || (!splash.isVisible())) { graphics = ...
260eba84-5930-4e33-b69a-4a18bd3e8c58
1
public static Clock makeClock(String clockType, Hosts hosts, String hostName){ Clock clock = null; if(clockType.equals("vector")){ clock = (Clock)(new VectorClock(hosts, hostName)); } else{ clock = (Clock)(new LogicClock()); } return clock; }
aad529cb-e7fd-446c-829b-80dd05860e8f
4
public static mxObjectCodec getCodec(String name) { String tmp = aliases.get(name); if (tmp != null) { name = tmp; } mxObjectCodec codec = codecs.get(name); // Registers a new default codec for the given name // if no codec has been previously defined. if (codec == null) { Object instance = ...
dd2e799d-4148-4331-bf85-a07ec9936777
2
public void test_01() { String args[] = { "-v" // , "-noStats" // , "-i", "vcf", "-o", "vcf" // , "-classic" // , "-onlyTr", "tests/filterTranscripts_01.txt"// , "testHg3765Chr22" // , "tests/test_filter_transcripts_001.vcf" // }; SnpEff cmd = new SnpEff(args); SnpEffCmdEff cmdEff = (S...
aa00a88e-3b88-4422-b133-bb3a89f54fba
4
@Override public void mouseClicked(MouseEvent arg0) { String[] values = ((String) productsComboBox.getSelectedItem()).split("\\t"); if (productsComboBox.getItemAt((productsComboBox.getSelectedIndex())).equals( "<html><font color='red'>Add New Product</font></html>")) { if (values != null && !automaticItemSe...
396481e1-b60a-4d0f-a4b7-cdf1ebe836c6
9
public boolean onCommand(CommandSender sender, Command command, String label,String[] args) { //we know that command is 'event', but check anyways if(!command.getName().equalsIgnoreCase("event")){ return false; } if (args.length < 1){return false;} String subCommand = args[0]; switch(subCommand){ ca...
0f013cfa-d81b-4fb4-9284-107f47e011b9
0
@Override public void setGUITreeComponentID(String id) {this.id = id;}
bac2b908-fb0a-445d-a039-e95f77e9b5f6
2
public int zerosCount() { int a = bits; int count = 0; for(int i = 0 ; i < 32 ; i ++){ if((a & 0x1) != 0x1){ count ++ ; } a = a >> 1; } return count; }
e9cebf72-e11a-466f-bb0a-20b1ce61c0da
0
public OpenFileFormat getDefaultImportFileFormat() { return defaultImportFileFormat; }
70abd841-1296-49a4-a5b7-1b872797538f
2
public static String executeShellCommandWithOutput(String command, String logFileName) { try { StringBuilder stdErr = new StringBuilder(); int exitVal = TestShared.executeShellCommand(command, stdErr); if (exitVal != 0) { return ""; } String stdOut = TestShared.re...
e700d1ee-7eca-459c-84b2-93952df2298e
0
public String getProtocoleJdbc() { return protocoleJdbc; }
55c416a7-6664-4d1f-a85f-272734008bdb
2
public void actionPerformed(ActionEvent event) { Object source = event.getSource(); if (source.equals(buttonSave)) { // Start Cash initialize controller.start(getCredit()); this.dispose(); } else if (source.equals(buttonClose)) { // Exit ...
0e2f5379-81bc-4574-9d4b-87663c4edb11
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...
6db3b3ad-1cee-49ec-802d-2a49d7594961
8
public boolean placeDownStairs() { boolean success = true; Room downStairsRoom = getDeepestRoom(); Tile downStairsTile; if (downStairsRoom.getFreeTiles().size() == 0) { ArrayList<Tile> edgeTilesCopy = (ArrayList<Tile>) downStairsRoom.getEdgeTiles().clone(); downS...
a4e37f18-35ae-45a2-9a25-432b2d68b36d
1
private static void write(String s, DataTag obj){ try { File theDir = new File("saves/"+s+".json"); theDir.getParentFile().mkdirs(); FileWriter file = new FileWriter(theDir); file.write(obj.toString()); file.flush(); file.close(); } catch (IOException e) { e.printStackTrace(); } }
d187f217-d4ab-42d7-88cd-f368978fe07d
7
@Override public Scanner scan(Lexer lexer) { loop: while (true) { if (lexer.hasNext()) { final char ch = lexer.next(); switch (ch) { case '\\': if (lexer.hasNext()) { final char chn = ...
a8f0fa7f-4126-41b7-b946-35eb5c009c93
8
public void update(Vector<Event> events) { if (isServer) sendBroadcastPacket(); if(isServer) { for (InetAddress ip : clients.keySet()) { clients.put(ip, clients.get(ip).floatValue() + Time.deltaTime()); } removeInactiveClients(); } for (Event ev : events) { try { if (isServer)...
1a749b95-0333-4f00-8512-b463fc9c49df
2
public Vector<BluetoothService> loadServices(){ Vector<BluetoothService> ret = new Vector<>(); File bt_services = new File(SERVICE_DIR); String[] bt_services_filenames = bt_services.list(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(".bts"); ...
e86ccf7a-5021-4508-bf9a-93780739b974
7
public static void qSort(int[] a, int begin, int end) { if (begin > end) return; int temp = a[begin]; int lbegin = begin; int right = end; while (lbegin < right) { while (lbegin < right && a[right] >= temp) right--; a[lbegin] = a[right]; while (lbegin < right && a[lbegin] < temp) lbegin++;...
522f9ea0-1362-4147-b542-58c2833a1157
2
public static byte[] inetAddress2Bytes(InetAddress val) { if (val == null){ return null; } if (!(val instanceof Inet4Address)) { throw new IllegalArgumentException("Adress must be of subclass Inet4Address"); } return val.getAddress(); }
bb58e2c2-855c-4bf7-b25d-6ca8bd96fd95
5
public static boolean isDisplayModeBetter(DisplayMode current, DisplayMode isBetter){ //Formatted weirdly to quickly see what the preferred settings are if( isBetter.getWidth() >= current.getWidth() && isBetter.getHeight() >= current.getHeight() && isBetter.getFrequency...
086e62f7-98e3-4cb8-8378-294447ea5753
8
public void parse(String[] inputarray){ switch(inputarray[0].toLowerCase()){ case "exit": IO.logln("[EXIT] User called exit"); System.exit(0); break; case "commands": IO.println("> calc_speed @speed @force @airrestistance (per m/s) @mass @initialtime @finaltimee or @acel @initialtime @finaltime"); ...
0a018972-0bc5-4797-884e-483cdf249d47
9
public static void populateTable() { ///////////////////////////////////CHANGE MUSIC FOLDER PATH HERE/////////////////////////////////////////////////// //String MusicFolder = "C:\\Users\\TomDoug\\Music"; String MusicFolder = "C:\\Users\\Matt\\Music\\Music"; int IDCount = 0; File folder = new File(MusicFolde...
51f453c2-c6ea-48d6-93a3-9138ae7a65bc
0
public edit() { this.requireLogin = true; this.info = "edit an appointment"; this.addParamConstraint("id", ParamCons.INTEGER); this.addParamConstraint("venueId", ParamCons.INTEGER, true); this.addParamConstraint("startTime", ParamCons.INTEGER, true); this.addParamConstraint("endTime", ParamCons.INTEGER, tr...
94a62645-9b5e-4190-aacf-864ed94b31c7
1
public RemoteTestRunnerGui() { super(); Utils.checkJMeterVersion(); try { testPanel = TestPanel.getTestPanel(); } catch (Exception e) { BmLog.error("Failed to construct RemoteTestRunnerGui instance:" + e); } init(); getFilePanel().setVisibl...
b9f6db7a-cd80-485c-a3d7-cea5e342e466
8
public void calculateDimensions() { // Reset all the outside points to 0 leftmostPoint = rightmostPoint = 0; lowestPoint = highestPoint = 0; farthestPoint = nearestPoint = 0; // For each triangle, for (int triangle = 0; triangle < triangles.length; triangle++) { // Get the triangle Triangle checkTrian...
831c7f7e-d2f7-4ffe-be38-a7facbb6e32f
2
private void exportFileborr() { JFileChooser fileChooser = new JFileChooser("."); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setDialogTitle("打开文件夹"); int ret = fileChooser.showOpenDialog(null); if (ret == JFileChooser.APPROVE_OPTION) { final String filePath = fileChooser.g...
bda6400b-7597-4265-a3e3-44dc4cd49c1f
5
public int[] getBorderStyles() { int[] styles = new int[5]; if( borderElements.get( "top" ) != null ) { styles[0] = borderElements.get( "top" ).getBorderStyle(); } if( borderElements.get( "left" ) != null ) { styles[1] = borderElements.get( "left" ).getBorderStyle(); } if( borderElements.get( "bo...
76733009-ad02-4144-bef6-7c76cc20d9ba
4
@Override public int hashCode() { int result = 0; for(LinkedList<E> bucket : buckets) { if(bucket != null) { for(E e : bucket) { if(e != null) { result += e.hashCode(); } } } ...
eb0a05b9-6257-42ad-ba2d-1b49020e7446
8
public static double doSpecialItemMod(Pokemon attacker, Move move, double damage) { if (attacker.hasItem(Item.CHOICE_SPECS)) { damage *= 1.5; } else if (attacker.hasItem(Item.LIGHT_BALL) && attacker.isSpecies(Species.PIKACHU)) { damage *= 2.0; ...
90f2fc76-41f5-42a5-ab01-f7a915a3fea8
0
public ValueFormatType getPINEncoding() { return pinEncoding; }
cf01224b-d238-4efd-8b51-d4ff284247b3
6
void createExampleWidgets () { /* Compute the widget style */ int style = getDefaultStyle(); if (topButton.getSelection ()) style |= SWT.TOP; if (bottomButton.getSelection ()) style |= SWT.BOTTOM; if (borderButton.getSelection ()) style |= SWT.BORDER; if (flatButton.getSelection ()) style |= SWT.FLAT; ...
671fb28b-0440-4a72-aac8-f7f50596228c
2
public static Map<String, Integer> countWords(ArrayList<String> list) { HashMap<String, Integer> result = new HashMap<String, Integer>(); for (String word : list) { if (result.containsKey(word)) { result.put(word, result.get(word) + 1); } else { ...
03b54d4a-7743-4dfb-8238-0aec1465e9fb
5
@Override public Musteri getMusteri(HashMap<String, String> values) { try { String ad = values.get("ad"); String soyad = values.get("soyad"); String telefon = values.get("telefon"); String resimURL = values.get("resimURL"); String kullanic...