method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
4aa11dbe-8d74-4c70-9d4d-e0c815e4f28d
8
public void moveToDirection(int direction) { switch(direction) { case 1: moveUp = true; break; case 2: moveUp = true; moveRight = true; break; case 3: moveRight = true; break; case 4: moveRight = true; moveDown = true; break; case 5: moveDown = true; break; case 6: moveDown = true; moveLeft ...
89c0346a-64a9-41e7-b4d4-b4b3cbc972ff
9
@Override public void onBlockIgnite(BlockIgniteEvent event) { Block b = event.getBlock(); if (event.getCause().equals(BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL)) { Player p = event.getPlayer(); World w = event.getBlock().getWorld(); Block netherRack = b.getLoca...
38f95576-6902-4138-9adf-eef6324fb46b
9
public static List<Class<?>> processJarfile(URL resource, String pkgname) { List<Class<?>> classes = new ArrayList<Class<?>>(); //Turn package name to relative path to jar file String relPath = pkgname.replace('.', '/'); log("relative path: "+relPath); String resPath = resource.getPath(); log("resource p...
1e318858-c5c6-4fc2-9008-daaa4af79323
9
private boolean r_verb_suffix() { int among_var; int v_1; int v_2; int v_3; // setlimit, line 174 v_1 = limit - cursor; // tomark, line 174 if (cursor < I_pV) { ...
366e2823-0726-448b-a239-40c5c2857300
8
public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TimePeriodValues)) { return false; } if (!super.equals(obj)) { return false; } TimePeriodValues that = (TimePeriodValues) obj; if...
31307e43-2e64-42ed-99e3-25ea3ae88bea
9
public String saveVideo(){ try{ CookieStore cookieStore = new BasicCookieStore(); HttpContext localContext = new BasicHttpContext(); localContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet(new URI(videoInfo.g...
17b6b8fa-3db0-4465-84de-8247d986224f
3
public void stopGame() { // Setting isRunning to false will // make the thread stop (see run()) this.isRunning = false; // Unset the game model... this.view.setModel(null); // Stop listening for events this.view.removeKeyListener(this.keyListener); // Make sure we wait until the thread has stopped......
650d3fab-7b47-43f8-bb82-8270282de732
0
@Override public void endDocument () {}
9865efc4-81f6-4e3a-9ab7-e979e1ad1603
8
public synchronized static String getUnitText(double v, String u) { double va = Math.abs(v); if (va < 1e-14) { return "0 " + u; } if (va < 1e-9) { return showFormat.format(v * 1e12) + " p" + u; } if (va < 1e-6) { return showFormat.forma...
dea78af4-bbea-4e6c-93d5-f756d7e38e70
2
public AbstractSandboxAgent(Creature c, Environment environment) { state = new ArrayList<AgentState>(); if (c == null){ creature = createCreature(); }else{ creature = c; } if (environment != null){ this.setEnvironment(environment); } }
409db2ff-30ef-4e78-9a3c-f9887d4b7800
8
public ArrayList<String> getPossibleDirections(double x, double y, String dir) { Rectangle nextLoc = new Rectangle(boundingBox); ArrayList<String> directions = new ArrayList<String>(); if(!dir.equals("up")) { if(this.attemptDirection("down", x, y) == true) { direction...
99de4c84-c576-443f-a7f9-be025f2037ce
1
public DefaultComboBoxModel<String> buildWeaponList() { DefaultComboBoxModel<String> comboBoxModel = new DefaultComboBoxModel<String>(); String[] names = Weapon.getWeaponNames().split(";"); for(int x = 0; x<names.length; x++) { comboBoxModel.addElement(names[x]); } return comboBoxModel; }
59140701-2888-41c9-8eda-d265fa0998b0
8
@Override public int getTopQualifiedRoleID(Function func, MOB mob) { if(mob==null) return govt().getAutoRole(); ClanPosition topPos = null; for(final ClanPosition pos : govt().getPositions()) { if(canBeAssigned(mob,pos.getRoleID()) &&((topPos==null)||(pos.getRank() < topPos.getRank())) &&((func==n...
634c1d40-1ef5-4314-851b-eabf851d965c
4
@Override public boolean equals(Object o){ if(! (o instanceof Spring)) return false; Spring s = (Spring)o; return myRestLength==s.myRestLength&& myObject1==s.myObject1&& myObject2==s.myObject2&& myStifness==s.myStifness; }
33e9e0f5-ae99-4fad-bb48-258161a4fce1
6
String OriginalComment(int commentID) { String comment =""; DatabaseConnection db = new DatabaseConnection(); Connection conn = db.connectToDB(); String sql = "Select * from "; if(bookType == 0) { ParentCommentTextArea.setText("Insert question below"); ...
264c911a-6dac-413e-9655-d9b4621ddb98
0
@Override public boolean supportsMoveability() {return true;}
5ade8eff-c377-4118-9ebe-acfcae2d7120
6
private void buildMap() { nodes = new Node[xs.size()][ys.size()]; Cord.maxI = xs.size() - 1; Cord.maxJ = ys.size() - 1; int i = 0, j = 0; for (int x : xs) { j = 0; for (int y : ys) { Point p = new Point(x, y); if (!(cpFrom.contains(p) || cpTo.contains(p))) { Node nd = new Node(p); nd...
b4900a3b-2344-4f9f-b393-b5ff27c8eb48
9
TitleInputDialog(Page page0) { super(JOptionPane.getFrameForComponent(page0), "Title", true); String s = Modeler.getInternationalText("Title"); if (s != null) setTitle(s); page = page0; JPanel panel = new JPanel(new BorderLayout(8, 8)); panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));...
db075d71-5062-49b3-90cb-173c1a184b24
4
@Override public boolean delete(Chambre x) { Statement stm = null; try { stm = cnx.createStatement(); int n= stm.executeUpdate("DELETE FROM chambre WHERE chambreid='"+x.getChambreId()+"'"); if (n...
f1b6362b-cc57-49b1-a6f2-9692125e7e9d
5
@SuppressWarnings("unchecked") public synchronized T obtain() { for (int i = 0; i < taken.length; i++) if (!taken[i]) { T obj = (T)pool[i]; if (obj == null) obj = construct(i); taken[i] = true; if (fReset != null) fReset.f(obj); return obj; } int index = taken.length; T obj = ...
e9dd0cc5-dc71-4d83-a3cb-f6124fa74951
6
public void setBroadcastEnable(boolean enabled){ if(enabled){ bcast_enabled = true; if(bcast == null || (bcast != null && !bcast.isRunning()) ){ bcast = new Broadcaster(); new Thread(bcast).start(); } }else{ bcast_enabled = false; if(bcast!=null && bcast.isRunning()){ bcast.stop(); } ...
54b25335-9d99-4734-a4fa-9ce294eec02a
7
@Override public void updatePartialView(final AbstractFleedModel fleedModel, final int i, final int j) { int gridValue = fleedModel.getSeaGrid()[i + 1][j + 1]; SeaGridButton gridButton = gridButtons[i][j]; // Just water if (gridValue == 0 || gridValue == AbstractFleedModel.MISS) { ...
b87514c7-9f59-40b1-ae6c-a1a3e13c841b
1
private boolean jj_2_54(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_54(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(53, xla); } }
e7ba2adf-702b-40d2-95d3-8656bb504b66
0
public static void main(String[] args) { MutliInheritance multi = new MutliInheritance(1); actionLikeA(multi); actionLikeB(multi.getBReference()); }
999ffc7e-cb9b-4c18-bfc8-42311bb01d2b
0
public JLabel getjLabelPraticien() { return jLabelPraticien; }
802b9087-c49d-4deb-b74c-cc065933c8ef
3
public static String decimalToBinary(int decimal) { String binary = ""; while (decimal != 0) { if (decimal % 2 == 0) binary = "0" + binary; else binary = "1" + binary; decimal = decimal / 2; } for (int i = binary.length(); i < 16; i++) { binary = "0" + binary; } return binary; }
caed690d-81db-47ec-8ec6-34a19d30f2f6
7
public void makeDirectory() { if (os.contains("win")) { String appData = System.getenv("APPDATA"); String mainDir = appData + s + "WordProcessor" + s; processor = new File(mainDir); String docsDir = mainDir + s + "docs" + s; docs = new File(docsDir); String exportsDir = mainDir + s + "exports" ...
f3c17375-7c9e-483b-ae02-b7f77866c5b5
8
public Calendar() { dayPanels = new ArrayList<JPanel>(); hourPanels = new ArrayList<ArrayList<JPanel>>(); layouts = new ArrayList<GroupLayout>(); for (int i = 0; i < 8; i++){ dayPanels.add(new JPanel()); hourPanels.add(new ArrayList<JPanel>()); layouts.add(new GroupLayo...
aca6033a-a15a-4ba4-a618-3ed921ab6f16
3
static byte[] fromBase64(byte[] buf, int start, int length){ byte[] foo=new byte[length]; int j=0; for (int i=start;i<start+length;i+=4){ foo[j]=(byte)((val(buf[i])<<2)|((val(buf[i+1])&0x30)>>>4)); if(buf[i+2]==(byte)'='){ j++; break;} foo[j+1]=(byte)(((val(buf[i+1])&0x0f)<<4)|((val(buf[i+...
175db1ec-505b-4635-bbd4-e2b231c5ad2a
7
protected boolean handleModeSwitch(Tag tag) { //first there's no point in looking for a mode switch if the tag name isn't "key" or "plist" if (!tag.getName().equals(TagType.KEY) && !tag.getName().equals(TagType.PLIST)) { return false; } switch (currentMode) { case MODE_PARSING_LIBRARY: if (ta...
5313f367-7876-4e53-9c21-c0aae044a81a
8
public void login (String id, String password) { util.Utility.DEBUG(0, "test"); if (staffs.containsKey(id)) { // 有這個人 if ( staffs.get(id).password().equals(password)) { // 密碼正確。開始登入 Staff aStaff = staffs.get(id); sw...
dcff4c70-4284-464a-bab8-98d3636bca99
4
public void setHSBColor(int row, int col, double hue, double saturation, double brightness) { if (row >=0 && row < rows && col >= 0 && col < columns) { grid[row][col] = makeHSBColor(hue,saturation,brightness); drawSquare(row,col); } }
a61b5391-3ca0-4cd5-9637-14ea82eb4a4d
6
public void merge(Target target) { if(hashCode() != target.hashCode()) throw new DeveloperError("Targets with non-matching <match> segments cannot be merged!"); Iterator iterator = target.getInputs().iterator(); Iterator iterator1 = target.getReplies().iterator(); Iterato...
b093e687-0087-44f0-a1f0-81c509886582
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...
62fbfe65-211f-409f-80ed-527c2c7b9c37
6
public Chord[] getChords(ChordFunction chordFunction) { switch (chordFunction) { case TONIC: Chord[] ret = {tonic}; return ret; case RESOLUTION: return resolution; case SUBDOMINANT: return subdominant; case DOMINANT: return dominant; case PREDOMINANT: return predominant; case SECONDARY_D...
6fe70a2b-e98b-4d5e-8b2f-3663d1478dbe
1
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((code == null) ? 0 : code.hashCode()); return result; }
28d21b97-9706-4a01-abd3-344a7ddeff66
1
public TreeNode deserialize(String data) { if(data.equals("NULL")) return null; String[]nodes=data.split(","); return rebuild(nodes,new int[]{0}); }
85d3093e-359f-4a28-8159-df6166c2ca99
6
public static void maxDepthR(TreeNode root, int level) { if(root==null){ maxlevel = 0; return; }else{ if (root.left != null ) { level += 1; if (level > maxlevel) maxlevel = level; maxDepthR(root.left, level); } if (root.right != null) { if(root.left==nu...
b07ab818-2615-414f-a985-6c41e2570c8d
6
public boolean mergeFieldFrom(final int tag, final CodedInputStream input) throws IOException { final int number = WireFormat.getTagFieldNumber(tag); switch (WireFormat.getTagWireType(tag)) { case WireFormat.WIRETYPE_VARINT: getFieldBuilder(number).addVari...
517edb23-18bb-4609-8a92-71470a547057
4
public void calcNext(Optimum opt, Point TILE_SIZE, ArrayList<House> houses) { while (!opt.getPossibleSol().isEmpty() && !this.foundSolution) { LinkedList<House> myHouses = new LinkedList<House>(); for (int i = 0; i < opt.getPossibleSol().get(0).obj.length; i++) { for (int j = 0; j < opt.getPossibleS...
fbd6bf29-2e4d-4d43-94d2-dd4254887264
4
public String getClipboardContents() { String result = ""; Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); // odd: the Object param of getContents is not currently used Transferable contents = clipboard.getContents(null); boolean hasTransferableText = (con...
f5a2367e-0137-46c8-8a4f-3705e7887f7f
6
private void paymentClick() throws InterruptedException { if(jTable6.getRowCount()<1) return; if (jTable6.getSelectedRow() < 0) { JOptionPane.showMessageDialog(this, "Please select NYM", "Error", JOptionPane.ERROR_MESSAGE); return; } String n...
1622e668-4ec1-41ab-aa2b-6fb482906cfc
3
public static AbstractDataWrapper getWrapperInstance(WrapperType type, WrapperParams wrapperParams, AuthFields authFields, GeoParams geoParams) { AbstractDataWrapper wrapper = null; switch (type) { case TWITTER: wrapper = new TwitterWrapper(wrapperParams, authFields, geoParams); break; case CSV:...
8e84a2eb-8fad-405e-b949-90ec5b8a90b1
2
public static void loadFromPreferences() { Preferences prefs = Preferences.getInstance(); for (String key : DEFAULTS.keySet()) { Font font = prefs.getFontValue(MODULE, key); if (font != null) { UIManager.put(key, font); } } }
f745aecd-c2f6-4bee-970b-b8ac9bf6d120
4
public void move() { if (y + ya > 0 && y + ya < game.getHeight() - HEIGHT) y += ya; if (x+xa > 0 && x + xa < (game.getWidth()/2)-WIDTH) x += xa; }
cbf6be35-3f72-4cc3-b38e-091d84e07c66
9
public void loop(){ double delta = System.currentTimeMillis(); DecimalFormat df = new DecimalFormat("#.000"); while(true){ delta = System.currentTimeMillis(); try { if(!jf.isVisible() && s.ticks > 10 && s.START_PRICE != 0 && s.MAX_PRICE != 0){ jf.setExtendedState(JFrame.MAXIMIZED_B...
d1cc5e36-e4ba-4d42-9409-cd6a560c8818
7
@Override protected void doCommit(Map<String,String> commitUserData) throws IOException { if (hasChanges) { segmentInfos.setUserData(commitUserData); // Default deleter (for backwards compatibility) is // KeepOnlyLastCommitDeleter: IndexFileDeleter deleter = new IndexFileDeleter(directory,...
64935d56-eba4-4931-bed2-4a645c1400ca
8
public static List<String> getLinks(String companyTicker) { List<String> links = new ArrayList<String>(); HttpClient client = new HttpClient(); client.getParams().setParameter("http.useragent", "Test Client"); BufferedReader br = null; for(int page = 1; page < 2; page++) { PostMethod method = new PostMet...
652930a1-7a46-425e-b050-467f7066774a
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://do...
4db63ed7-e7a3-424d-b709-78e78e85b168
8
static final public void facteur() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VRAI: case FAUX: case entier: case ident: case 52: primaire(); break; case NON: case 63: opNeg(); primaire(); expression.controleTypeNE...
fa096238-5ae4-4478-a6bf-b9a1b3d66b35
2
public void connect(String address, String name) { this.name = name; String host; int port = Server.PORT_RANGE_LOWER; int splitIndex = address.lastIndexOf(':'); if (splitIndex == -1) { host = address; } else { host = address.substring(0, splitIndex); port = Integer.parseInt(address.substring(splitI...
52d15d01-572e-4385-9564-5d866d2b344e
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; IndexReader other = (IndexReader) obj; if (indexNumber != other.indexNumber) return false; if (rootDirectory == null) { if (other.rootDirectory != nu...
e1046dbc-9c53-42a5-9e7d-3144dbaa297f
4
Pos followSuffixLink( Pos pos ) { // gama is the string between node and its father, in case node // doesn't have a suffix link Path gama = new Path(); // dummy argument for trace_string function int charsFound = 0; if ( pos.node == root ) return pos; // if node has no su...
8b470b1a-d6f4-4259-95ba-2b0238d2d481
8
public static void main(String[] args) { CopyOnWriteArraySetImpl<Integer> copyOnWriteArraySet = new CopyOnWriteArraySetImpl<Integer>(); if (copyOnWriteArraySet.add(10)) System.out.println("element 10 added"); if (copyOnWriteArraySet.add(20)) System.out.println("element 20 added"); if (copyOnWriteArray...
f6f1f26e-f19e-4770-9677-83c0e3a3ec3e
2
public Metrics(final Plugin plugin) throws IOException { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } this.plugin = plugin; // load the config configurationFile = getConfigFile(); configuration = YamlConfiguration.load...
ea201078-8add-43d8-96ca-9688578d3eb5
5
public boolean isItPvPTime(String world) { long startTime = Long.parseLong(plugin.getValue(plugin.pvpWorlds, world, "startTime").toString()); long endTime = Long.parseLong(plugin.getValue(plugin.pvpWorlds, world, "endTime").toString()); long currentTime = plugin.getServer().getWorld(world).getTi...
f89e0d09-5a4f-42bc-bb3d-f1bde8252c8a
2
private boolean bottomRightCorner(int particle, int cubeRoot) { for(int i = 0; i < cubeRoot; i++){ if(particle == cubeRoot * cubeRoot * i - 1 + cubeRoot){ return true; } } return false; }
d03c0bcc-32e7-49c1-b660-7cd81d090de6
7
private static String getCompressionString(String original) { if (original == null || original.isEmpty()) { return original; } int compressionCount = getCompressionCount(original); if (compressionCount > original.length()) { return original; } cha...
84d7ca0b-b8ac-4b01-bf8d-fa84f8dc7faf
4
public static void main(String[] args) throws IOException { Make make = new Make(); BufferedWriter bw = new BufferedWriter(new FileWriter(new File("statsFH.dat"), true)); //int count; for (int i = 100; i <= 10000; i += 100) { for (int j = 0; j < 100; j++) { /...
c4a47d25-7bb9-45a5-8b7d-736cdf655347
7
public QuadTree getBranch(String ID) { if (id.equals(ID)) { return this; } QuadTree qt = this; ID = ID.substring(1); while (ID.length() > 0 && qt.nw != null) { if ('0' == ID.charAt(0)) qt = qt.nw; else if ('1' == ID.charAt(0)) qt = qt.ne; ...
a6fb696b-79b7-48b7-8bee-9ecbdee500e9
4
@Override public void process() { // TODO: If it is a CHALLENGE, accept or reject if (message.equals("MAKE")) { int response = controller .displayChallengeMessage(challengerUsername); if (response == JOptionPane.YES_OPTION) { String jsonString = String .format("{ \"type\":\"%s\", \"gameID\":\"...
43c2e7a5-684f-44f2-8e6f-a00f790b2091
1
public static ItemStorageInventory create(){ if(storageInventory == null){ storageInventory = new ItemStorageInventory(); } return storageInventory; }
bdf3faa3-6bf4-468f-9db8-c8942372a3c5
0
public JButton getBeendenButton() { return this.beendenButton; }
9bb714ba-0538-4e15-9a3d-555f5ebe213f
7
private static void writeWatchableObject(DataOutputStream par0DataOutputStream, WatchableObject par1WatchableObject) throws IOException { int var2 = (par1WatchableObject.getObjectType() << 5 | par1WatchableObject.getDataValueId() & 31) & 255; par0DataOutputStream.writeByte(var2); switch (pa...
d1db19fb-39ee-4949-a23f-e1954b673e8f
3
public Playmode[] getPlaymodes(){ Playmode[] playmodes = null; try { Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); String url = "jdbc:derby:" + DBName; Connection connection = DriverManager.getConnection(url); Statement statement = connection.createStatement(); String getRanking = "SELEC...
351e7aa3-48e2-4227-8337-677e2a39a043
1
public double Normal(double Media, double DStd) { double Suma = 0; for (int i = 1; i <= 12; i++) { //r obtiene el valor pseudo aleatorio double r = Math.random(); Suma = Suma + r;//Suma acumula el valor de los valores aleatorios } //x obtiene el valor ...
f2facc15-d7ca-4f2f-8074-8fbb8d200d03
0
public int numCells(){ return cells.size(); }
f30937de-0024-47da-a34e-6e34621c425d
5
public ArrayList<String> anagrams(String[] strs) { // Note: The Solution object is instantiated only once and is reused by // each test case. ArrayList<String> result = new ArrayList<String>(); HashMap<String, ArrayList<Integer>> recordMap = new HashMap<String, ArrayList<Integer>>(); for (int i = 0; i < strs...
d4bc2b5d-23df-46c6-a91e-f32b8b746ad9
2
public String eliminarRol (String name) { Rol rol = null; ArrayList<Rol> dbRol = tablaRoles(); String msg = ""; for (Rol r : dbRol){ if(r.getNombre().equals(name)){ rol = r; msg = rol.getNombre(); return "Se ha eliminado el rol...
aa6b9e0b-ce67-4837-8a4b-ce8604934636
0
private void setContactNumber() { Address.getInstance(addressType) .setStreetName(streetNameText.getText()); Address.getInstance(addressType).setCityName(cityNameText.getText()); Address.getInstance(addressType).setStateName(stateNameText.getText()); Address.getInstance(addressType).setZipCode(zipCodeText....
1a2b1e9d-a651-4008-842c-4a1ec250ff78
4
@SuppressWarnings("empty-statement") private void jButtonRunActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonRunActionPerformed uList.clear(); ziarno.clear(); ziarno.add(x1); ziarno.add(x2); ziarno.add(x3); ziarno.add(x4); if(...
5436ce9c-19a6-48a2-943a-a010373b3743
0
@Override public void startSetup(Attributes atts) { super.startSetup(atts); setEnabled(false); addActionListener(this); Outliner.documents.addDocumentRepositoryListener(this); }
95d80e5c-75d1-4d9d-876a-b5aa6839f536
7
private void startMonitor(){ try{ // Create a new selector Selector selector = Selector.open(); // Create a new non-blocking server socket channel ServerSocketChannel serverChannel = ServerSocketChannel.open(); serverChannel.configureBlocking(false); InetSocketAddress isa = new InetSocketA...
2ff9eeaf-1a4c-4947-a4d5-e6dbae4348af
2
@Override public void onDisable(){ if ((dbcon != null) && (dbcon.IsConnected)) { dbcon.CloseDatabase(); } // cancel all tasks we created getServer().getScheduler().cancelTasks(this); Log(pdfFile.getName() + " has been disabled!"); }
83a9fa31-cccc-4b1d-a0fa-4b99394eaf66
9
public static boolean matchType2(String move) { char p = move.charAt(0); char a = move.charAt(1); char b = move.charAt(2); return (p == PGNParser.PAWN.charAt(0) || p == PGNParser.KNIGHT.charAt(0) || p == PGNParser.BISHOP.charAt(0) || p == PGNParser.ROOK.charAt(0) || p == PGNParse...
02f8ab49-b379-4b7b-8510-a7290db1d070
8
protected Acronym parseCandidate(String outOfParenthesis, String inParenthesis) { if(inParenthesis.indexOf(";") != -1){ int i = inParenthesis.indexOf(";"); inParenthesis = inParenthesis.substring(0, i); } if(outOfParenthesis.indexOf(";") != -1){ int i = outOfParenthesis.indexOf(";"); outOfParenthesi...
13d0612c-c31c-4bbe-93c3-d54cb9e3f1e2
9
public int findPeakElement(int[] nums) { // Critical assumption: nums[-1] = nums[n] = -∞. // Binary Search: If nums[m - 1] > nums[m] there must be at least 1 peak in left half // Else nums[m + 1] > nums[m] there must be at least 1 peak in right half int n = nums.length; if (n < 1) return -1; int l = 0, r...
9dfdac5f-d81d-4b72-9dbe-2e17c8aae021
8
public void compExecTime() { double newExeTime; double newCost; dEval = 0; dTime = 0; dCost = 0; for (int i = 0; i < iClass; i++) { newExeTime = 0; // System.out.print("Cost[" + i + "]"); for (int j = 0; j < iSite; j++) { if (dmAlloc[i][j] != -1) { if (dmAlloc[i][j] < 1) { newExeTime...
a86da0fb-163c-4633-bcb1-387966daa3d6
5
/* */ public Object getMetaPacket(Object watcher) /* */ { /* 106 */ Class<?> packet_class = Util.getCraftClass("Packet40EntityMetadata"); /* 107 */ Object packet = null; /* */ try { /* 109 */ packet = packet_class.newInstance(); /* */ /* 111 */ Field a = Util.getField(packet...
016ed1cd-befa-44e5-8d2f-4caf7df4fd8b
6
public String diff_toDelta(LinkedList<Diff> diffs) { StringBuilder text = new StringBuilder(); for (Diff aDiff : diffs) { switch (aDiff.operation) { case INSERT: try { text.append("+").append(URLEncoder.encode(aDiff.text, "UTF-8") .replac...
3385a9e5-da7c-4412-af7b-f7a28dff2370
8
public int build() throws IOException { if (Files.exists(file)) { Files.delete(file); } if (!Files.isDirectory(file.getParent())) { Files.createDirectories(file.getParent()); } // Sort the file infos and add the directories Set<FileInfo> fileInfos = new TreeSet<>(); for (FileSe...
e88a294c-c04c-4c5f-bb93-dc2f0785f929
5
@Override public void paintComponent(Graphics g) { super.paintComponent(g); if (instance) { int x = 30; int y = 30; for (String s : map.keySet()) { if (!"Type".equals(s) && !"Parent".equals(s)) { if (map.get(s) != null) { ...
92d8a9d7-c404-4b75-a2c2-2deddf7d1557
4
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession mensaje = request.getSession(true); ResultSet respuesta=null; PrintWriter out = response.getWriter(); //Declaro variables ...
55857272-0af4-4704-871b-134f86f2ef6c
0
public Vuerapport() { initComponents(); }
17445f02-7ada-4036-82f7-5561216fc4cb
0
public void reset() { totalForce.set(0, 0, 0); location.set(0, 0, 0); }
cb82778c-b7e8-4e19-8e2f-01efcb5906cb
9
public int daysInChineseMonth(int y, int m) { // 注意:闰月m<0 int index = y - baseChineseYear + baseIndex; int v = 0; int l = 0; int d = 30; if (1 <= m && m <= 8) { v = chineseMonths[2 * index]; l = m - 1; if (((v >> l) & 0x01) == 1) d = 29; } else if (9 <= m && m <= 12) { v = chineseMonths[2 ...
0c61d465-73ce-42f7-ac6d-b2bf07904703
9
private void testAbstractMethods(ByteMatcher matcher) { // test methods from abstract superclass assertEquals("length is one", 1, matcher.length()); assertEquals("matcher for position 0 is this", matcher, matcher.getMatcherForPosition(0)); try { matcher.getMatcherForPositio...
5a7a05d1-421d-42fb-a0d2-424c95d6e1b1
9
public void testVariables() { System.out.println(); String[] testStrings = { "?X", "?XX", "?X-X", "?ABC-234", "?ABC-ABC", "?UIO-123-UIO", "??X", "??XX", "??X-X", "??ABC-234", "??ABC-ABC", "??UIO-123-UIO", "?a"}; String[] testsThatShouldFail = { "?-", "??234", "", "XX", "qawerpiouasdf", "??", ...
75bcd3de-c373-4bf0-9d42-79fd7a426462
6
void unloadRace() { RandomAccessFile rafFile2; String strStore; String strRaceDir; if (isPet()) { strRaceDir = "defPets"; } else { strRaceDir = "defRaces"; } try { if (strRace == null || !(new File(strRaceDir+"/"+strRace).exists())) { strRace = null; return; } rafFile2 =...
66acbd8a-be8b-4441-9790-6621af37b70e
3
public void update(){ super.update(); if(!alive){ for(int x=0;x<objects.size();x++){ if(objects.get(x).kind==kind){ objects.get(x).alive=false; } } } }
82918c06-95f8-48a8-8ead-4ad7f8595706
5
public void keyTyped(KeyEvent e) { // if we're waiting for a "any key" type then // check if we've recieved any recently. We may // have had a keyType() event from the user releasing // the shoot or move keys, hence the use of the "pressCount" // counter. if (game.isWaitingForKeyPress()) { if (pressCount...
e3ae3e62-c28a-4662-91f2-e6f6d654e043
7
private boolean inSection(double x, double x1, double x2, double y, double y1, double y2){ if (Math.abs(x1 - x2) > 0.1) { return (((x >= x1) && (x <= x2)) || ((x <= x1) && (x >= x2))); }else { return (((y >= y1) && (y <= y2)) || ((y <= y1) && (y >= y2))); } }
770e9b49-4148-4758-9ab9-428ef8a41241
0
public Account getSeller() { return sellerInt; }
d29453a8-025d-4081-b7a5-12f256f15561
5
@Command(aliases = {"refillcooldown", "dispensercooldown"}, usage = "", desc = "Shows how much cooldown is still left on a dispenser.", max = 0) public void refillcooldown(CommandContext args, CommandSender sender) throws CommandException { // wrap player BukkitPlayer player = this.plugin.getWorldEdit().wrapPlayer...
0fb66ee2-52f8-44c9-9044-89ff95026425
4
public void executeQueryFile(String fileName) throws QueryEngineException{ try { @SuppressWarnings("resource") Scanner fileScan = new Scanner(new File(fileName)); //Process each query through the loop while(fileScan.hasNextLine()){ String query = fileScan.nextLine().trim().toUpperCase(); /...
b55871c8-135e-49ab-8703-a57cbec4e2ef
6
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SurveyHasUser that = (SurveyHasUser) o; if (id != that.id) return false; if (answer != null ? !answer.equals(that.answer) : that.answer != null...
130cd7d4-f985-4623-a760-17eda6509462
6
private void checkAggregation() { if(group!=null) { ExpressionDecomposer ed=new ExpressionDecomposer(); Iterator<Expression> s=select.iterator(); while(s.hasNext()) { Expression e=s.next(); if(!e.getType().equals("sum") && !e.getType().equals("avg")) { ArrayList<String> selectAttrs=ed...
5ef0f2c4-7aba-46f9-be2c-6053c4e87311
8
private void getFloorPlanWS(String line, CellDescription cellDescription) { int startIndex; /*get wall sensors*/ direction n = direction.NORTH; direction e = direction.EAST; direction s = direction.SOUTH; direction w = direction.WEST; startIndex = line.indexOf("ps") + 4; ...
06b0eab4-c167-4a76-907e-fdc66af87cb7
4
public static ArrayList<File> getListFiles(Object obj) { File directory = null; if (obj instanceof File) { directory = (File) obj; } else { directory = new File(obj.toString()); } ArrayList<File> files = new ArrayList<File>(); if (directory.isFile()) { files.add(directory); return files; } els...
40c86649-cf50-4df2-a612-5d2b0cbd3e54
1
protected void setInfotext(String text) { if (text != null) { this.rightPanelInfo.setText(text); } }