method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
291946c3-b14e-45e8-982d-0c5b81ff438b
5
final boolean method2247(int i) { if (i != -4) method2245(null, 50); if (!((Signlink) this).allowsFileOperations) return false; if (((Signlink) this).aBoolean3794) { if (aClass134_3802 == null) return false; return true; } if (anObject3793 == null) return false; return true; }
b71ff4ad-eb73-49f7-8c7e-d646e6c819eb
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...
9db088ad-3d96-4c01-9de9-222c1b015e30
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...
f1819bce-2a58-480a-8453-919648729e89
8
public void set() { ConnectMySQL.connSQL(); String selectDate = dc.sdf2.format(dc.select.getTime()); String str1 = null, str2 = null, str3 = null, str4 = null; if ((Integer) staHourSpinner.getValue() < 10) { str1 = '0' + staHourSpinner.getValue().toString(); } else { str1 = staHourSpinner.getValue().toS...
2dcdf1b6-0ba7-41a3-a1d8-24757827e8b5
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...
9235f893-a85e-4024-b198-6d39d9b4ccb7
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final Vector<Room> V=new Vector<Room>(); TrackingLibrary.TrackingFlags flags; flags = CMLib.tracking().newFlags() .p...
f04f4516-b182-43e3-a64e-cd2a4dc6725b
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...
b478f668-289c-4ae4-a73c-9996a4096c60
1
private void updateTextFieldFormat() { if( timeSpinner == null ) return; JFormattedTextField tf = ((JSpinner.DefaultEditor) timeSpinner.getEditor()).getTextField(); DefaultFormatterFactory factory = (DefaultFormatterFactory) tf.getFormatterFactory(); DateFormatter formatter = (DateFormat...
e17d0489-5237-475c-85b8-5d8fff8bd013
3
@Override public synchronized void addTermDocument(String term, String document) throws RuntimeException { if (!documents.containsKey(document)) { long documentId = addDocument(document); documents.put(document, documentId); } if (!terms.containsKey(term)) { ...
c9ab5ade-89dd-4d5f-9b50-b89b515fddaa
1
protected void setStock(int stock) throws Exception{ if(stock<0){ throw new Exception("El stock tiene que ser 0 o superior."); }else{ this.stock = stock; } }
ca0d3941-0c0e-4c75-9e63-76dc90b7e1c1
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...
9af24774-6737-4158-97f0-435f2101661d
7
private void inActivityCluster(double[] tempTimeVector, String user) { double[] post_count = tempTimeVector; boolean contains = false; if (post_count[0] + post_count[1] + post_count[2] + post_count[3] == 0) { users0004.add(user); contains = true; } if (post_count[4] + post_count[5] + post_count[6] + po...
28d12beb-bef0-4e9e-b957-cd036c9e162c
7
public void start() { try { Socket socket; try { socket = new Socket(HOSTNAME, PORT); } catch (ConnectException e) { System.err.println("Error connecting"); System.exit(-1); return; } out = new ObjectOutputStream(socket.getOutputStream()); in = new ObjectInputStream(socket.getInputSt...
24747366-5669-40de-8899-b558db859360
7
private final boolean cons(int i) { switch (b[i]) { case 'a': case 'e': case 'i': case 'o': case 'u': return false; case 'y': return (i == 0) ? true : !cons(i - 1); default: ...
d235c43d-67d1-419f-aad7-46bc4acabd7c
5
@Test public void firstMowerTest() throws MowerOutOfLawnBoundaryException { try { this.lawnMowerController = new LawnMowerController("1 2 N", "GAGAGAGAA",lawnConfiguration); } catch (NumberFormatException e1) { fail(); } catch (NegativeNumberException e1) { fail(); } catch (UnrecognizedCommandExcept...
b8a352ac-5d59-4af8-908d-fc3b62e95675
6
@Override public RgbColor getRgb() { double red = 0; double green = 0; double blue = 0; double h = ChromaUtil.clamp(hue, 0, 360); double s = ChromaUtil.clamp(saturationV, 0, 1); double v = ChromaUtil.clamp(value, 0, 1); double c = s * v; double sector = h / 60; // Sector of the color ...
ada2a2f8-17a8-4014-9913-3941640d7aaa
6
private void checkPauseMenu() { if (input.back()) { running = true; stage.clear(); } else if (input.up()) { pauseButtons[selectedButton].setStyle(buttonStyle); selectedButton = (selectedButton == 0) ? 0 : selectedButton - 1; pauseButtons[select...
a249aa7b-aa24-49e1-abaa-6faf87bf4d51
6
public Tooltip HUDCollide(){ CollisionResults results = new CollisionResults(); Vector3f origin = new Vector3f(inputManager.getCursorPosition().x, inputManager.getCursorPosition().y, 0); Ray ray = new Ray(origin, new Vector3f(0, 0, 1)); guiNode.collideWith(ray, results); for(int a=0...
edf80746-520a-405f-bda8-07f60967d84c
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...
535b40bd-dd46-4fa1-ad82-3a07b790c7e8
0
public int[] getViewerCounts() { return viewerCounts; }
2f7c28d3-7a8e-4436-a7f4-7f6559dfd265
9
public static void main(String args[]) { // (NxN) chessboard. from (x,y) to (p,q), find a minimum number of moves // Knight can move relatively (1, 2), (-1, 2), (1, -2), (-1, -2), (2, 1), (-2, 1), (2, -1), (-2, -1) // move named as m0 m1 m2 m3 m4 m5 m6 m...
39bce061-adae-4fc9-9db5-3d466c02c107
6
@EventHandler public void GiantMiningFatigue(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.getGiantConfig().getDouble("Giant.Mini...
5561c7e8-1877-47f9-a573-503f3e9f0986
5
@Override protected boolean checkCollision(float xx, float yy) { for (int corner = 0; corner < 4; corner++) { int xc = (int) (((x + xx) + corner % 2 * 13 + 1) / Tile.SIZE); int yc = (int) (((y + yy) + corner / 2 * 13 + 1) / Tile.SIZE); if (world.getTile(xc, yc).isSolid())...
5f4b2040-0186-40cc-a76f-2cf1c4936a62
1
public void setFillWidth(boolean b) { if (this.fillWidth == b) { return; } this.fillWidth = b; installGUI(); }
f726842f-d907-4958-b5fc-60e2cebcbee8
3
public void run() { while (true) { try { Runnable runnable = queue.take(); runnable.run(); } catch (InterruptedException e) { e.printStackTrace(); } catch (RuntimeException e) { e.printStackTrace(); } } }
9d2d70da-4d17-47da-a805-11577b124d28
9
private void button5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button5ActionPerformed if (order1code5tf.getText().equals("1001")) { o1c5destf.setText("Chicken Nugget"); } if (order1code5tf.getText().equals("1002")) { o1c5de...
f6769b6a-0603-42f1-bbd3-ea0fda9c39dc
3
public int hasTile(int x, int y) { for (int i = 0; i < tiles.size(); i++) { if (tiles.get(i).getX() == x && tiles.get(i).getY() == y) { return i; } } return -1; }
5cef6eb0-db00-49cb-bdd5-d926688e99eb
1
public static ClienteDTO convertToClienteDTO(Cliente cliente) { if (cliente == null) { return new ClienteDTO(); } return new ClienteDTO(cliente .getId(), cliente.getNome(), cliente.getSobrenome(), cliente.getEndereco(), cliente.getCep(), cliente.getDtNascimento(), cliente.getTelefone()); }
a6e7b58e-659c-4815-a6fa-99ba7f831214
2
public static ArrayList<AchievementRecord> getAchievementRecordByUserID(int userID) { ArrayList<AchievementRecord> records = new ArrayList<AchievementRecord>(); String statement = new String("SELECT * FROM " + DBTable + " WHERE userid = ?"); PreparedStatement stmt; try { stmt = DBConnection.con.prepareStatem...
9eda1ab6-2d60-4b30-95b0-0a280b220522
9
public String getRoomDescription() { String temp = ""; String roomDescription; roomDescription = description; roomDescription = roomDescription + "Items:"; Enumeration<Item> e = items.elements(); while (e.hasMoreElements()) { Item i = (Item) e.nextElement(); if (!(i.getIsInvisable())) { roomDescri...
00278faa-8b2f-4d51-b013-a5fa1541d430
5
public void close() { /* First check if the Session is even open. */ status = Status.DISCONNECTED; if (sender != null) sender.send("DIS:", outStream); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } try { if (socket != null) socket.close(); ...
d2d0e675-f778-48bf-a7b6-8274459ef28b
1
public void learn(DataSet dataSet) { if (this.initialized) { this.neuralNetwork.learn(dataSet); } }
4d19c9b7-f186-4405-abdd-71664cb3dd53
6
private void checkForForwardRun(Object n, ArrayList array, int[] arrayTotal){ if (array.isEmpty()) { array.add(n); } else { if (c2I((char)array.get(array.size()-1)) == c2I((char)n)-1 || ((char)n == 'A' && c2I((char)array.get(array.size()-1)) == 3)){ ...
f5252932-658f-418a-a11f-a114d0f0a4f2
3
@Test public void testPlayerCapturesFlagAndIsReturnedToStartingPosition() throws InvalidActionException { factory.setPlayerOneFlagOneSquareUp(); PlayerFlag pf1 = null; for (Element e : grid.getElementsOnGrid()) { if (e instanceof PlayerFlag) { PlayerFlag pf = (PlayerFlag) e; if (pf.getPlayerInfo()....
0e6a31ec-2620-45e2-ad6e-1d9b3c120362
1
public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Welcome frame = new Welcome(); frame.setLocationRelativeTo(null); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); }
ecae752c-4c33-477c-9199-3bde267fdc49
0
public void setSliderMax(int i) { mySlider.setMaximum(i); }
c8977a9d-4c7b-4ebf-becc-78f5ebe4ad5d
5
public int maximumProductCuttingTS(int N) { if(N==0 || N==1) return 0; int max = 1; if(N==2) return max; else if(N==3) return max*2; else { while(N>4) { max = max * 3; N = N-3; } return max*N; } }
5f4acecc-ad8b-4f34-a6fa-aee0683a9eee
1
@Test public void testDates() throws Exception{ SimpleDateFormat ISO8601DATEFORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); String dateReceived = "2014-06-18T06:22:17+00:00"; StringBuilder sb = new StringBuilder("2014-06-18T06:22:17+00:00"); if(dateReceived.length()==25) ...
c49f32b4-b44e-4a23-befb-2c7b7ef83cf8
9
public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); for (int i = 0; i < n; i++) { int m = sc.nextInt(), pos = sc.nextInt(); List<Integer> vi = new ArrayList<Integer>(); for (int j = 0; j < m; j++...
5fd2b236-d0e6-4f67-b533-fa406c810af8
5
private static String getMessage(ResourceBundle resource, String messageTag, Object... args) { if (!resource.containsKey(messageTag)) return messageTag; String message = resource.getString(messageTag); MessageFormat format = new MessageFormat(""); format.setLocale(currentLocale); format.applyPattern(message)...
b4359ab8-dc8c-4af2-94c1-0e13ee729507
4
@Override protected void sort(T[] array, int leftIndex, int rightIndex) { if (array.length > 1) { T aux = array[leftIndex]; for (int i = leftIndex; i < rightIndex; i++) { for (int j = leftIndex; j < rightIndex; j++) { if (array[j].compareTo(array[j+1]) > 0) { aux = array[j]; ...
bd394408-fcca-4cb7-b1f5-da1a23430629
1
public void showView(){ if (Toolkit.getDefaultToolkit().isFrameStateSupported(Frame.MAXIMIZED_BOTH)) { this.setExtendedState(Frame.MAXIMIZED_BOTH); } this.setVisible(true); init(); }
66c86581-cfcf-4835-b2c1-db4ad68a1265
7
@Test public void mCracklePop(){ for(int i=1 ;i<=100 ;i++ ){ String m = ""; if( i%3==0 && i%5 !=0){ m = "crackle"; }else if(i%5==0 && i%3 !=0){ m ="pop"; }else if(i%5==0 && i%3 ==0){ m = "CracklePop"; } else...
df240d68-c6a0-43f1-8886-cb1903da906f
9
private void mapExecutable(ExecutableMemberDoc em) { Parameter[] params = em.parameters(); boolean isConstructor = em.isConstructor(); List<Type> classArgs = new ArrayList<Type>(); for (int k = 0; k < params.length; k++) { Type pcd = params[k].type(); // primitive...
bd81010b-cccf-4fcd-9f79-8f6ffde090ac
1
@Override public void reset() { Fonts.restoreDefaults(); mIgnore = true; for (FontPanel panel : mFontPanels) { panel.setCurrentFont(UIManager.getFont(panel.getActionCommand())); } mIgnore = false; GraphicsUtilities.forceRepaintAndInvalidate(); Fonts.notifyOfFontChanges(); }
4e897012-34e7-4b50-8a3d-d2900573d866
8
private boolean checkStericsBBonly(int strandNum, int resNum) { Residue res = m.strand[strandNum].residue[resNum]; Atom tmpAtm = null; int resToCheck = 0; for(int i=0;i<res.numberOfAtoms;i++) { if (isBBatom(res.atom[i])){ //backbone atom resToCheck = resNum; for(int w=0;w<resToCheck;w...
efa951b6-c31f-4da1-8ca4-bb6f4d25258c
1
public static void main(String[] args){ if (args.length > 0){ CommandLineMode commandLineMode = new CommandLineMode(args[0], new RectangleController()); } else{ SwingUtilities.invokeLater(new Runnable() { @Override public void run()...
abdf315b-8c92-46a9-9da7-ec45072f1352
9
public synchronized Object put(Object obj) { // This implementation is based on the IdentityMap.put method. if (obj == null) { return null; } Entry tab[] = mTable; int hash = hashCode(obj); int index = (hash & 0x7FFFFFFF) % tab.length; for (Entry e ...
e86765ab-435d-4ea9-91e6-5d7f6961e9a7
3
public static ArrayList<String> readFileContent(String filename) { ArrayList <String> input = new ArrayList<String>(); try { FileReader fr = new FileReader(filename); BufferedReader buffreader = new BufferedReader(fr); String line; int ...
c2fbd798-b8fe-4b2c-9f65-2b3a4c324437
9
@SuppressWarnings("unchecked") public synchronized void partialUpdate(String myEpisodesUsername, String pwdmd5, String cookie) { log.info("Starting partialUpdate"); MyEpisodesHTTPClient myEpisodesHTTPClient = new MyEpisodesHTTPClient(cookie); try { List<Show> currentShows = myEpi...
a9419301-a328-4efa-878d-a09926d7acfb
0
public LambdaHighlightAction(Automaton automaton, Environment environment) { super("Highlight "+Universe.curProfile.getEmptyString()+"-Transitions", null); this.automaton = automaton; this.environment = environment; }
cb073bbe-ad9e-4e59-9121-86c1435cdba1
7
private void parseObjectFromFile( final File file ) { int pos = file.getName().lastIndexOf( "." ); String name = pos > 0 ? file.getName().substring( 0, pos ) : file.getName(); if (!file.getName().endsWith( ".json" )) return; System.out.println("Trying to parse " + file.getName()); try { JsonObject...
1dfb4609-c8e4-44bf-a476-be15f2fb5bbb
6
public boolean interact(EntityPlayer par1EntityPlayer) { ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); if (var2 != null && var2.itemID == Item.bowlEmpty.shiftedIndex && this.getGrowingAge() >= 0) { if (var2.stackSize == 1) { par1Entity...
3e308175-e1bc-4f42-a42c-b171f9b0afe3
2
public void showSupplyOrders() { textArea.setText(""); for (int i = 0; i < driver.getOrderDB().getSupplyOrderList().size(); i++) { Order order = (driver.getOrderDB().getSupplyOrderList().get(i)); textArea.append("Order " + order.getId() + " was created by " + order.getCurrentlyLoggedInStaff().getName() +...
9f6adaf2-aa42-47f8-9caf-be369809f1cf
1
public static void main(String[] args) { //Load the problem from csv file NormalDistributedStochasticLotsizingProblem problem = new NormalDistributedStochasticLotsizingProblem(new File("examples/example_problem_Tempelmeier2012_p319.csv")); //Create a static uncertainty solver StaticUncertaintySolver solver =...
27842a50-c5f5-403a-ab6c-0384a01f82cd
8
@Override public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException { // TODO Auto-generated method stub super.execute(action, args, callbackContext); Log.v("iGreet", "iGreet: execute"); try { String baseUrl = null, consumerKey = null, secretKey = ...
7c30147a-e4e2-470b-9018-1fac7b3ce529
2
static Object accessArray(String name, Object val, int idx[]) { if (!val.getClass().isArray()) { throw new IllegalArgumentException("Not an array : " + name + " " + val); } for (int i : idx) { val = Array.get(val, i); } return val; }
9f2046e6-93a3-41de-b6ad-17b6f925870a
7
public AbstractGameObject createObject(GameObjectType type, Coordinate coordinate) { AbstractGameObject obj = null; switch (type) { case NOTHING: { obj = new Nothing(coordinate); break; } case WALL: { obj = new Wall(coo...
697da53d-d16c-45e9-82a4-3ba330ab8ce1
3
public static void main(String ... args){ byte [] bytes = {1,2,3,4,5,6,7,8,9}; ByteBuffer byteBuffer = ByteBuffer.wrap(bytes); byteBuffer.position(3); byteBuffer.limit(6); ByteBuffer _byteBuffer = byteBuffer.slice(); for(int i=0;i<_byteBuffer.capacity();i++){ ...
de8457f2-e0e4-4358-8c65-e5db7366809f
9
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Client client = (Client) o; if (firstName != null ? !firstName.equals(client.firstName) : client.firstN...
4a06d3af-e4e1-4c26-9fd3-ccf00e264409
1
private void allocate_page (PageId pageno, int num) throws BufMgrException { try { SystemDefs.JavabaseDB.allocate_page(pageno, num); } catch (Exception e) { throw new BufMgrException(e, "BUFMGR: allocate_page() failed"); } // end try } // end allocate_page()
3b13d187-2ef6-4852-a9ad-51d9f092b548
4
private void turnTowardsTarget(double targetAngle) { double angleDifference = angle - targetAngle; if (Math.min(Math.abs(angleDifference), 2 * Math.PI - Math.abs(angleDifference)) < da) { angle = targetAngle; } else if (angleDifference > Math.PI) { angle += da; ...
b84d4dae-d5bd-43ce-a07d-66f329f071db
0
private static boolean less(String v, String w, int d) { return v.substring(d).compareTo(w.substring(d)) < 0; }
13a19874-48f1-445a-b00d-739ff8828ec2
2
@SuppressWarnings("unchecked") public static <E> void mergeArrayIntoCollection(Object array, Collection<E> collection) { if (collection == null) { throw new IllegalArgumentException("Collection must not be null"); } Object[] arr = ObjectUtils.toObjectArray(array); for (Object elem : ...
97c5ed01-5074-44bf-b087-689c42683fe4
8
public Unit findNewTargetInCurrentRoom() { Unit new_target = null; double smallest_angle_to_target = max_angle_to_target; switch (target_type) { case PYRO: for (Pyro pyro : current_room.getPyros()) { if (!pyro.isHomable()) { continue; } double abs_angl...
80aa0798-43d2-4012-9f1d-a8f4b7c9e5a4
6
static final String method1909(byte i, String string) { if (i != 31) method1911((byte) 87); anInt3222++; String string_0_ = null; int i_1_ = string.indexOf("--> "); if ((i_1_ ^ 0xffffffff) <= -1) { string_0_ = string.substring(0, 4 + i_1_); string = string.substring(i_1_ + 4); } if (string.startsW...
f95f2a3b-aaad-401b-b225-418e04e7e83c
2
public void testLabelSearch() { try { Collection<Label> labels = GetLabels.create().search("Slampt"); for (Label l : labels) assert (l.getName().contains("lampt")); } catch (SQLException e) { e.printStackTrace(); assert (false); } ...
e4ebe893-0560-44e5-a6bb-2545c119df29
6
public static Point getClosestUnexplored(int x, int y, int[][] map, int target){ double distance; double prev = 1000; Point coordinates =null; for(int i=0;i<map.length;i++) for(int j=0;j<map[0].length;j++) if(map[i][j] == target && (i!= x || j!= y)){ distance = Math.sqrt(((i - x)* (i - x)) + ((j - y)* (j -...
7c35f563-4fcf-4915-8ce2-a5911b50c148
4
public static double hydratedRadius(String ion){ ion = ion.trim(); boolean test0 = true; boolean test1 = false; int i = 0; double radius = 0.0D; // check entered ion against ion list while(test0){ if(IonicRadii.compareHydrated(ion, i)){ ...
db5d5ca8-0816-448b-8da4-69fea0e328f7
5
private void setFailTransitions() { Queue<Node> q=new LinkedList<Node>(); for(int i = 0; i < 256; i++) if (this.root.get((byte) i) != null) { this.root.get((byte) i).setFail(this.root); q.add(this.root.get((byte) i)); } this.prepareRoot(); while (!q.isEmpty()) { Node state = q.poll(); byte[]...
a3100186-5a5e-4a41-8870-6e2de6bfc227
1
public String toString() { if (palavra != null) return palavra.toString(); return id + ""; }
390c55fd-c82c-4845-9fc4-95d694a48fe9
8
@EventHandler public void onPlayerMoveEvent(PlayerMoveEvent event) { if (master.getMBWorldManager().isBoxel(event.getTo().getWorld())[0]) { int maxBoxelSize = master.getConfig().getInt("max-boxel-size"); if (maxBoxelSize == 0) return; Player player = event.getPlayer(); Location targetLocati...
ee875139-f838-4d97-a911-beb2b050181e
5
@Override public void handleBeforeOp(int currentAddress, OpCode opCode, int opData, CPUState s) { if(currentAddress == 0x68b) s.loadedBank = 0x1; if(currentAddress == 0x3daf) s.loadedBank = 0x3a; if(currentAddress == 0x3760) s.loadedBank = 0x9; if(currentAddress == 0x2e8f) s.loadedBank = 0x1; if(...
dd589c6c-9cc4-4be1-9087-d0512b05f0a3
7
private List<Endpoint> parseEndpoints(NodeList endpointsList, Element serviceDiscoveryElement) { List<Endpoint> result = new LinkedList<Endpoint>(); for (int i = 0; i < endpointsList.getLength(); i++) { Node endpointNode = endpointsList.item(i); if (endpointNode.getNodeType() == Node.ELEMENT_NODE) { El...
d663c282-32cd-4ab7-8ad0-80caaa693d17
8
public String getContentOfSelectionAsPageNumberBlock(int x, int y, int height, int width) throws DoenstFitException, BadPageNumber { //Outside of image if (x > img.getWidth() || y > img.getHeight()) return null; if (height + y > img.getHeight()) height = img.getHeight() ...
57a27a8a-a061-4548-99c2-f49ffd664993
7
private void jList2ValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList2ValueChanged try { String str = jList2.getSelectedValue().toString(); String delimiter = " / "; String[] temp; temp = str.split(delimiter, 2); for(int i ...
4fd1b7ae-0aa1-4b32-b915-9360e069372f
3
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub JSONObject jb = new JSONObject(); String email = request.getParameter("email"); String password = request.getParameter("password"); String username = new...
b79c0ec4-1558-484d-a9af-a920a5a32143
6
public static double getPredictedScore(String user, Business business, Map<String, User> userMap){ //String u_id = user.u_id; String b_id = business.id; String ubKey = user + ";" + b_id; Double star = ubStar.get(ubKey); if (star == null) return -2.0; for (HashSet<String> cluster : clusters.values()){ ...
fde4acd4-1af6-4b0b-9d09-00230c7b10cc
2
public void mouseClicked(MouseEvent e) { if(e.getButton()==BUTTON3){ mouseX=e.getX(); mouseY=e.getY(); System.out.println("X:"+Integer.toString(mouseX)); System.out.println("Y:"+Integer.toString(mouseY)); System.out.println("Koordynaty: "+MapGetter.addMarke...
66ae7d5a-3860-4ece-b4ba-008f8059be55
8
@Override public String runMacro(HTTPRequest httpReq, String parm, HTTPResponse httpResp) { final java.util.Map<String,String> parms=parseParms(parm); final String last=httpReq.getUrlParameter("ABILITYTYPE"); if(parms.containsKey("RESET")) { if(last!=null) httpReq.removeUrlParameter("ABILITYTYPE"); ...
34cf790c-a712-48ae-ae6a-16b958ad8ab5
3
public void initField() { for (int i = 0; i < sizeField; i++) f1.add(new ArrayList<Value>()); for (int i = 0; i < sizeField; i++) { for (int j = 0; j < sizeField; j++) { f1.get(j).add(Value.empty); } } }
26838c96-67a2-4e07-8666-757c7c5a01bc
2
public double standardizedAllResponsesVariance(){ if(!this.dataPreprocessed)this.preprocessData(); if(!this.variancesCalculated)this.meansAndVariances(); return this.standardizedAllResponsesVariance; }
d970809b-9254-46f9-b9a3-22c4f50cdf3f
8
public boolean crearAuditoriaPorTabla(String schema, String nombre) { borrarTriggers(schema, nombre); try { Connection con = this.connecting(); String sql; if (con != null) { try (Statement stmt = con.createStatement()) { int cont =...
5e9a097a-39c7-4a3d-a9b8-82a4574bc78a
4
@Override public void execute() { switch (Settings.location.getBankerId()) { case 6200: Constants.FALADOR_WALK_BANK.traverse(); break; case 2759: Constants.EDGEVILLE_WALK_BANK.traverse(); break; case 496: Constants.AL_KHARID_WALK_BANK.traverse(); break; case 21301: Walking.walk(Constants.NEITIZNOT...
82cce96f-ef89-48d6-982d-af3aafdceb5c
3
private static DBConnection searchConnection() { while (true) { DBConnection conn = getFreeConnection(); if (conn != null) { conn.setInUse(); return conn; } // no free connection found if (connections.size() < ConnectionFactory.poolsizeMax) { conn = buildConnection(); connections.a...
9969b0e0-d8d6-4fa0-9b60-96cc21c88266
6
@Override public int compareTo(Object o) { Codon c = (Codon)o; if (c.getN1() == n1) { if (c.getN2() == n2) { if (c.getN3() == n3) { return 0; } else if (c.getN3() < n3) { return 1; } else { ...
b305a4a6-95ed-46d8-827c-690c1445a842
6
public void checkForFlag() { try { File dir = new File("characters"); if(dir.exists()) { String read; File files[] = dir.listFiles(); for (int j = 0; j < files.length; j++) { File loaded = files[j]; if (loaded.getName().endsWith(".txt")) { Scanner s = new Scanner (loaded); whi...
01dc5518-73a0-4b8f-a445-65beb407f818
2
public static void deleteStation(Station station) { Statement stat; try { stat = ConnexionDB.getConnection().createStatement(); stat.executeUpdate("delete from station where id_station="+ station.getId_station()); } catch (SQLException e) { while (e != null) ...
c95e37a8-dc80-4c5d-82f8-96e98e163ee9
7
public void drop(DropTargetDropEvent evt) { // Called when the user finishes or cancels the drag operation try { Transferable transferable = evt.getTransferable(); if (transferable.isDataFlavorSupported(DataFlavor.stringFlavor)) { evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);...
cc2ac971-7118-4c8f-9794-d5850417e57b
8
static LinkedList<Region> sort(LinkedList<Region> unsorted) { if (unsorted.size() <= 1) return unsorted; int mid = unsorted.size()/2; int size = unsorted.size(); LinkedList<Region> sorted = new LinkedList<Region>(); LinkedList<Region> first = new LinkedList<Region>(); LinkedList<Region> second = new Lin...
5d2178e0-807d-4a38-b3b3-55fdc77ecb79
7
@EventHandler public void onChunkPopulateEvent(ChunkPopulateEvent e) { Chunk c = e.getChunk(); List<String> genWorlds = Config.getStringList("generate-lifestone-worlds"); for (int i=0; i<genWorlds.size(); i++) { if (genWorlds.get(i).equalsIgnoreCase(c.getWorld().getName())) { break; } else ...
8b37818a-a75c-40f0-89d2-fe2343ff97b7
8
public void run() { try { boolean running = true; while (running) { try { String line = null; while ((line = _breader.readLine()) != null) { try { _bot.handleLine(line); } catch (Throwable t) { // Stick the whole stack trace into a...
e3066e3c-62e1-4f37-84fd-62fb1f550598
8
public void newGame() { String s; String name = ""; int choice = 0; s = "Welcome to Ye Olde RPG!\n"; s += "\nChoose your difficulty: \n"; s += "\t1: Easy\n"; s += "\t2: Not so easy\n"; s += "\t3: Beowulf hath nothing on me. Bring it on.\n"; s += "Selection: "; System.out.print( s ); try { difficulty ...
70064c11-a7c2-43e2-9317-2650fb3d9c7e
2
@Override public void Parse(Session Session, EventRequest Request) throws Exception { int Count = Request.PopInt(); for (int i = 0; i < Count; i++) { User mUser = UserHandler.GenerateUser(Request.PopInt()); Grizzly.GrabDatabase().RunFastQuery( "INSERT INTO server_friendships (friend_one_id, f...
30de38b4-eb5e-4e84-a611-18c8617c6535
6
public static String putp(String str) { mystr=""; int l=str.length(),s; if(l<3) s=17; else if(l%2==0) s=3*l; else s=4*l; //System.out.println("s="+s); for(int k=0;k<l;k++) { int d=str.charAt(k)+s; //System.out.println("here d="+d); if(d>126) { d=d-86; // System.out.println("ya ...
c90d3b2a-e2f8-42e3-aa03-00f9c83faec3
3
private double testArrayListInserts(int inserts) { System.out.println("Testing arrayList with " + inserts + " inserts"); long[] times = new long[20]; long startTime; long endTime; for (int i = 0; i < 20; i++) { arrayList = new ArrayList(); startTime = Sy...
b2c45d30-f8d7-4170-b8eb-319797a9d9e5
5
private void SetNewUtilityWithBellman(State currState) { double maxExpectedUtility = Integer.MIN_VALUE; for(ACTION action : ACTION.values()) { double sumU = 0.0; for(State nextState: this.game.GetNeighborStates(currState)) { if(!this.game.IsOutBound(nextState) && !nextState.IsWall){ sumU...
61f190c2-ce12-483a-90a5-7f061b1c027e
8
public AnswerCombination answer(Combination<Colors> attempt) { List<Token<AnswerColors>> answerTokens = new ArrayList<Token<AnswerColors>>(); List<Colors> attemptColorList = attempt.getColorsList(); List<Colors> targetColorList = target.getColorsList(); //Black and white number calculation ...
5db34d0d-8e25-4bf2-9c93-d610a9a31476
1
public static boolean typed(int keyEvent){ return !pressed[keyEvent] && prev[keyEvent]; }
7ae0fa83-a416-4cbe-93e9-7c536065f487
3
@Test public void testEnum(){ Method fromCodeMethod; try { for(Class<? extends StateProvinceEnum> clazz : enumToTest){ assertTrue(clazz.isEnum()); fromCodeMethod = clazz.getMethod("fromCode", String.class); //test that null is returned assertNull(fromCodeMethod.invoke(null,(Object)null)); ...