method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
fe483447-ff08-4e18-b8ca-6cc1d0a2d4d3
5
public Hosts(Object hosts){ this.hosts = new HashMap<String, HostInfo>(); String name; String IP; Integer port; Object value; ArrayList<Object> hostList = (ArrayList<Object>) hosts; for (Object host : hostList) { name = null; IP = null; port = null; Map<String, Object> hostMap = (Map<String, O...
0a9a4674-5e6f-4d33-8ef8-a921a68352f6
0
@Column(name = "PEP_ID_ELEMENTO") @Id public int getPepIdElemento() { return pepIdElemento; }
fc622eba-a7ce-47db-a7b6-29d9295c1739
4
private void stopEditingCollection() { // Removes collection edit selection stuff if (selectingCollection && editingCollection) { screenManager.removeImageButton("Edit collection"); screenManager.removeImageButton("Delete collection"); } // Remove editingCollection stuff else if (!editingCollection &&...
d1dedf26-7703-46e7-bfd7-299eb7a79f36
6
private void nombrelaboratoriosFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_nombrelaboratoriosFieldKeyTyped // TODO add your handling code here: if (!Character.isLetterOrDigit(evt.getKeyChar()) && !Character.isISOControl(evt.getKeyChar()) && !Character.isWhitespace(evt.getKeyChar()) && ...
40a42904-810f-4d61-babb-69de95af9bf6
9
public static PublicKeyEntry decode(DataInputStream in) throws IOException { PublicKeyEntry entry = new PublicKeyEntry(); entry.defaultDecode(in); String type = entry.properties.get("type"); if (type == null) { throw new MalformedKeyringException("no key type"); } i...
64f0aafb-868b-4fea-96ed-871e03c62fef
6
@Override public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException { if(!startUp) { if(menu.playing() == false) menu.loop(); g.setColor(Color.green); g.drawRoundRect(200, 200, 400, 100, 10); g.drawRoundRect(200 , 310 , 400 , 100 , 10 ); g.setColor(Color.white); ...
b90f31d1-ed5e-4cb8-ae80-919ff4d51ad4
8
protected boolean verticalLevelCollision() { // we do the same for the Y-axis int direction = (int) (this.speedY/Math.abs(this.speedY)); // -1 for top, 1 for bottom) double startPos = this.posY; if (direction == 1) startPos +=this.height; for (int i = -3; i <= Math.abs(this.speedY);i++) { for (int j ...
de30df5b-4dbb-4d62-adf6-ea250beddf57
8
public void keyPressed(int k) { if(k == KeyEvent.VK_A) player.setLeft(true); if(k == KeyEvent.VK_D) player.setRight(true); if(k == KeyEvent.VK_UP) player.setUp(true); if(k == KeyEvent.VK_DOWN) player.setDown(true); if(k == KeyEvent.VK_SPACE) player.setJumping(true); if(k == KeyEvent.VK_W) player.setGliding(...
cab4a177-0e79-4a37-9529-2581d6fe9879
0
public Queue[] GetInputBuffers() { return inputBuffers; }
7261e329-9668-4c7b-a62f-8331906cee50
5
public static void main(String[] args){ long total = 0; Problem032 p32 = new Problem032(); for(int n = 2; n <= 9; n++){ int i = 1; while(true){ p32.pandCheackList.clear(); for(int m = 1; m <= n; m++){ p32.addPandCheackList(i * m); } if(p32.isPandigital(p32.pandCheackList)){ S...
c699dfa6-b195-4228-95ec-9830ee5cea2c
2
public String getMommaJoke(String user) { if(mommaJokes.isEmpty()) { connection.msgMasters("OUT OF MOM JOKES!!!"); //Inform channel connection.noticeChan(this.channel, "[***]RELOADING AMMUNITION"); //Reload the jokes reader.fileToArrayList("MomJokes.txt", mommaJokes); } ...
a4672cd0-8c53-49c1-a57e-898f1eb787a6
4
public boolean isAccessible(){ // rock, void and spawn are not accessible. // grass, rubidium, explosium, scrap are accessible. if(tileType == TileType.GRASS || tileType == TileType.RUBIDIUM || tileType == TileType.EXPLOSIUM ||tileType == TileType.SCRAP){ return true; } else { return false; } }
bc124546-6bda-4ca8-8f09-8cc275e169e9
7
public void mouseClicked (MouseEvent event) { if(!visualisable.isGameOver()) { //sets movePlayer to false initially boolean movePlayer = false; //gets the mouse click x and y coordinate and scales them int xPos = (int) (event.getXOnScreen() / imageScale()); int yPos = (int) ((event.getYOnScreen() - ...
b1d9e4e3-4d04-4b02-a2d6-d33932fb2b99
3
private void accept(){ Socket clientSocket = null; try { clientSocket = serverSocket.accept(); }catch (SocketException e){ if(running){ LOG.fatal("server socket error", e); System.exit(-1); } } catch (IOException e) { ...
b697f4db-9c1d-4232-82ca-30ce83794b9c
8
public int raw_seek(int pos){ if(!seekable)return(-1); // don't dump machine if we can't seek if(pos<0 || pos>offsets[links]){ //goto seek_error; pcm_offset=-1; decode_clear(); return -1; } // clear out decoding machine state pcm_offset=-1; decode_clear(); // seek ...
921d90a2-2c20-47b0-bd45-6a0996f83ae0
8
public boolean searchII(int[] A, int target) { int left = 0, right = A.length - 1; while (left <= right) { int mid = left + (right - left) / 2; if (A[mid] == target) { return true; } else { if (A[mid] > A[left]) { if (target >= A[left] && target < A[mid]) { right = mid - 1; } else {...
64273c25-0434-4135-b820-49e5ab8263db
5
public static InetAddress getListenHostname(String fullHostname) { int pos = fullHostname.lastIndexOf(":"); int pos2 = fullHostname.lastIndexOf(","); int lastMarker = Math.max(pos, pos2); if(lastMarker == -1) { return null; } else { pos2++; if(pos == -1) { return null; } else { i...
f1113000-4daa-4287-87fb-79b7c5f25727
2
private static boolean checkForWin(int turnNumber, int inputX, int inputY, int[][] board, int consecutiveConectionsRequired, int numberOfPlayers){ if(turnNumber > (numberOfPlayers * (consecutiveConectionsRequired - 1))){ if(checkGrid(board[inputX-1][inputY-1], board, consecutiveConectionsRequired)){ return...
ad341008-2530-418f-8bee-b2dc0eb745b3
8
private void TfCodServicoKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_TfCodServicoKeyReleased if (!TfCodServico.getText().equals("")) { prodcompravenda.getForneproduto().getProduto().setCodigo(Integer.parseInt(TfCodServico.getText())); if (!TfCodFornecedor.getText().equals...
b26f9f1f-8bad-41a2-b2d6-872a6c8d68e4
0
@Test public void runTestApplicationLifecycle3() throws IOException { InfoflowResults res = analyzeAPKFile("Lifecycle_ApplicationLifecycle3.apk"); Assert.assertEquals(1, res.size()); }
9d1d02f8-a557-4d52-bbc2-6694480e3884
6
public void doAction (String o) { Result=null; if (o.equals("SearchRek")) search(true); else if (o.equals("Search")) search(false); else if (o.equals("TextAction")) { L.removeAll(); action(); } else if (o.equals("Action")) action(); else if (o.equals("Help")) help (); else if (o.equals("Close")) { Abort=tr...
598e3264-a110-4e66-83e0-ab9af2a36f25
6
public boolean isAdjacentTo(HantoCoordinate otherCoordinate) { if (otherCoordinate.equals(this)) return false; int otherX = otherCoordinate.getX(); int otherY = otherCoordinate.getY(); int deltaX = otherX - x; int deltaY = otherY - y; if (deltaX < 0 && deltaY < 0 || deltaX > 0 && deltaY > 0) return fal...
c0f80f8f-6264-4110-addb-9a7bf09b773a
3
private void configureButtons() { if (newIssue != null) { newIssue.setDisable(true); } if (saveIssue != null) { saveIssue.setDisable(true); } if (deleteIssue != null) { deleteIssue.setDisable(true); } }
6afdf7a1-88af-4ad3-a130-f45709337d2b
9
private void parseFormAndUpdate() { this.nome = this.jTextField1.getText(); this.email = this.jTextField2.getText(); this.senhaAntiga = String.copyValueOf(this.jPasswordField3.getPassword()); this.senhaNova = String.copyValueOf(this.jPasswordField1.getPassword()); boolea...
3749c473-0c41-48cc-8ce2-a0e3452430f2
7
public EigenvalueDecomposition (Matrix Arg) { double[][] A = Arg.getArray(); n = Arg.getColumnDimension(); V = new double[n][n]; d = new double[n]; e = new double[n]; issymmetric = true; for (int j = 0; (j < n) & issymmetric; j++) { for (int i = 0; (i < n) & issymmetr...
6ef60929-9a8c-4b46-bf75-3cc683df550a
4
public void render() { text.setAttribute("x", Double.toString(x)); text.setAttribute("y", Double.toString(y)); NodeList textParts = text.getElementsByTagName("tspan"); for (int pIter = 0; pIter < textParts.getLength(); pIter++) { Element textPart = (Element) textParts.item(pIter); textPart.setAttribute("x...
83fa4827-f19f-4d7c-a2b1-90ab6f346bf9
3
public boolean checkResendForNewElement(String IPComing, ArrayList<String> comingConnections){ ArrayList<String[]> localTable = (ArrayList<String[]>)routingTable.get(IPSource); if(comingConnections != null) { for(int i=0; i<keys.size(); i++){ recalculate(keys.get(i), IPComing...
5b51d821-bf67-4860-ab90-71a6d15b9fe4
8
public static StudentBean fetchStudentInfo(int id) { StudentBean bean = new StudentBean(); ResultSet rs=null; Connection con=null; PreparedStatement ps=null; try{ String sql="SELECT S.S_ID, S.DEPTID, S.MAJOR, D.DEPTNAME " + "FROM STUDENT S, DEPARTMENT D WHERE S.DEPTID=D.DEPTID AND" + " S_ID=?"; ...
7c5f1a87-9754-41b3-91f6-406c21e9f830
6
public boolean isInGoal(Location playerLocation) { Vector Max = GoalDimensions.getMaximumPoint(); Vector Min = GoalDimensions.getMinimumPoint(); //Check to see if the player is in the goal if (playerLocation.getBlockX() >= Min.getBlockX() && playerLocation.getBlockX() <= Max.getBlockX()) { if (playerLocat...
6582a1cf-c007-4de2-9fa8-fbbabd0fdcf9
5
private void moveDisclaimer(File input, File output) { try { PdfReader reader = new PdfReader(input.getAbsolutePath()); com.itextpdf.text.Document document = new com.itextpdf.text.Document(reader.getPageSizeWithRotation(1)); PdfCopy writer = new PdfCopy(document, new FileOutputStream(output)); document.o...
85ede7e8-178d-48a7-817e-d3cad9afd590
7
public boolean upgradePossible(Upgrade upgrade) { // Consider returning a String explaining the problem, if there is one? // ...Or an error code of some kind? if (upgrades == null) return false ; boolean isSlot = false, hasReq = upgrade.required == null ; int numType = 0 ; for (Upgrade u : upg...
167d9db6-3d40-422a-b411-ea6a8c5cf833
2
public void shutdown() { if (this.timer != null) { this.timer.stop(); this.readThread.interrupt(); try { this.readThread.join(1000); } catch (InterruptedException e) { e.printStackTrace(); } } this.timer...
12aeb950-7d7d-4e83-adf2-ae570bc9859a
1
public boolean isBound() { synchronized (this.exchangeLock) { return this.exchange != null && this.exchange.isConnected(); } }
0b7bcd32-02cd-4885-92c9-3b9d4cbfe041
3
public int magnitudeNumber(String strength){ int convertedStrength; if (strength.equals("High")){convertedStrength = Relationship.HIGH;} else if (strength.equals("Med")){convertedStrength = Relationship.MEDIUM;} else if (strength.equals("Low")){convertedStrength = Relationship.LOW;} ...
4df779e0-a37a-49d6-a511-431ac79a0d8e
4
public boolean push_msg (Msg msg_) { // First message to receive is identity (if required). if (!identity_received) { msg_.set_flags (Msg.identity); identity_received = true; if (!options.recv_identity) { return true; } ...
2889f6da-9199-44fe-b38e-93dadb36fbea
7
public static Domains getDomainName(String url) { if (url.startsWith("http://link.springer.com/article") || url.startsWith("http://link.springer.com/chapter")) return Domains.SPRINGER; else if (url.startsWith("http://dl.acm.org/citation")) return Domains.ACM_DL; else if ...
8326d707-ee16-42b1-af9c-b48faa456677
7
private static int[] argbToHSV(Raster ras, int x, int y) { int[] pixel = ras.getPixel(x, y, (int[]) null); float r = pixel[0] / 255f; float g = pixel[1] / 255f; float b = pixel[2] / 255f; float max = Math.max(Math.max(r, g), b); float min = Math.min(Math.min(r, g), b); float h = 0; if (r == max && g >= ...
ea46d753-10d6-443a-a037-a32cc47daba3
0
public void setTxtVille(JTextField txtVille) { this.txtVille = txtVille; }
45cade23-311c-400b-a5d8-f44cf2b1d632
5
public static void main(String[] args) throws FileNotFoundException { int num_rows = 100; String filename = "problem067.txt"; int[] [] pyramid_array = new int[num_rows] [num_rows]; File txtfile = new File(filename); Scanner pyramid = new Scanner(txtfile); for (int i=0; i<num_rows; i++) { for (int j=...
c9013e03-ab37-499d-8b88-ec4d33ee0019
6
public static String constructRequestURL(String url) { int index = url.indexOf("?"); if (-1 != index) { url = url.substring(0, index); } int slashIndex = url.indexOf("/", 8); String baseURL = url.substring(0, slashIndex).toLowerCase(); int colonIndex = baseURL...
dccf04e8-42f9-4a36-ad4f-f232f2651024
4
public void fullDrop() { if (!isAlive || isPaused) { return; } boolean isDropGood=true; while (isDropGood) { Point check=new Point(pieceCorner.getX()+1,pieceCorner.getY()); isDropGood=board.canFit(currentPiece.getPiece(), check); if (!isDropGood) { board.addPiece(currentPiece.getPiece(),...
46d21b38-4d78-438c-8892-0c8f33248b30
3
private int iType() throws UnexpectedTokenException { int nexts = 0; this.expect(IDENT); this.nextToken(); nexts++; if(this.accept(LBRACK)) { while(true) { this.nextToken(); nexts++; this.expect(RBRACK); if(this.accept(RBRACK)) break; } } return nexts; }
5a405b71-61bc-46ed-99ca-e1d281d6ec58
6
@Override public void displayProbabilities(double[][] probabilities, int[] knownRoles) { String rolesText = "<html>"; int n; for (int i = 0; i < players; i++) { n = 1; String role = null; String dead = ""; String name = ""; if (knownRoles[i] < 0) { dead = "DEAD "; n = -1; name = " ("...
5352e0a2-5d13-479d-8e5d-406689ef78a6
7
public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); for(;;) { String[] line = br.readLine().split(" "); int x1 = Integer.parseInt(line[0]); ...
f37f8a8d-d796-4962-9559-549daed1097b
9
public String parseFile(CPU cpu, File file) { // Load Data and Program file. This will later be handled by the GUI. // The Data File will probably not be used anymore and as we enter the data // directly via the GUI. The Program File will always be loaded via the GUI. FileLoader fl = new...
b9876db8-3653-489d-b873-9d29dc61734e
9
private Resource getFunction(ExprFunction function) { String symbol = function.getOpName(); if(symbol == null) { symbol = function.getFunctionSymbol().getSymbol(); } if(symbol != null) { List<Resource> list = symbolsMap.get(symbol.toLowerCase()); if(list != null) { if(list.size() == 1) { retur...
0bfaa893-0236-4b71-86e8-f84f91483907
8
private void draw3D(int image_size, boolean update_progress) { int x, y; int w2 = image_size / 2; int n1 = detail - 1; double dx = image_size / (double)n1; double ct = Math.cos(fiX), cf = Math.cos(fiY), st = Math.sin(fiX), sf = Math.sin(fiY); double m00 = scale * cf,...
b52bd911-6bd4-46f5-b94d-3ba7b5ef6fe9
1
public static void main(String... args) { int[] array = {1, 2, 32, 12, 34, 543, 1434, 565, 777}; sort(array); for (int i = 0; i < array.length; i++) { System.out.println(array[i]); } }
6c3f53c5-7095-4a7a-bdab-c26a75bcd6e2
8
static void invokeMethodWithAnnotation(Class<?> clazz, final Object instance, final Class<? extends Annotation> annotationClass) throws IllegalStateException, SecurityException { Method[] declaredMethods = clazz.getDeclaredMethods(); for (final Method method : declaredMethods) { if (method.i...
35f7df5b-543c-46b6-950e-6e4a9e477340
3
private void modifyLinkedThread(Map<String, Object> jsonrpc2Params) throws Exception { Map<String, Object> params = getParams(jsonrpc2Params, new NullableExtendedParam(Constants.Param.Name.LINKED_THREAD_ID, false), new NullableExtendedParam(Constants.Param.Name.HEADLINE, true)); ...
2720e76d-fada-4c75-b197-34f20de433ea
8
private void menoroigual() throws Exception{ op2 = pila.pop(); if (op2.getValor().equals("null")) throw new Exception("Una de las variables esta sin inicializar!"); op1 = pila.pop(); if (op1.getValor().equals("null")) throw new Exception("Una de las variables esta sin inicializar!"); Elem resultado = n...
d4932dce-bb18-46f4-8736-f493f554e86b
6
public void rangedComplex(int screen) { if (screen == 1) { clearMenu(); menuLine("1", "Standard Bow", 839, 0); menuLine("5", "Oak Bow", 845, 1); menuLine("20", "Willow Bow", 847, 2); menuLine("30", "Maple Bow", 851, 3); menuLine("30", "Ogre Bow", 2883, 4); menuLine("30", "Ogre Composite Bow", 482...
41ddd008-fb7d-4e5d-a2b9-60e1718b3e05
9
private void printJoins(Vector<LogicalJoinNode> js, PlanCache pc, HashMap<String, TableStats> stats, HashMap<String,Double> selectivities ) { JFrame f = new JFrame("Join Plan for " + p.getQuery()); // Set the default cl...
226ae38b-e68a-4e55-95b4-5e546dccdf1c
8
public boolean executeCommand(String command, String addr, int port, boolean executeCommands_in_series) { try { if ((command == null) || (command.trim().equals(""))) { return true; } this.implant.beacon_provide_response = true; boolean success = authenticateWithControll...
d1d831cd-6381-4f8d-ae64-29c12402b58e
8
public static void saveSlot(String hostname, String[] words) { if (words.length > 2) { String hostmessage = Functions.implode(Arrays.copyOfRange(words, 2, words.length), " "); if ((words.length > 2) && (Functions.isNumeric(words[1]))) { int slot = Integer.parseInt(words[1]); if (slot > 0 && slot < 11) {...
028fe568-efd1-4812-901d-0e7cbfccd1de
3
@Override public Joueur insert(Joueur obj) { PreparedStatement pst = null; try { pst = this.connect().prepareStatement("INSERT INTO Joueur (nom, prenom,datenaiss,post,salaire,poid,taille,email,id) VALUES (?,?,?,?,?,?,?,?,?);"); pst.setString(1,...
6f2edc01-3e23-4d5c-8dd8-a4ec595f6133
4
private void close() { try { if (res != null) res.close(); if (stmt != null) stmt.close(); if (con != null) con.close(); } catch(SQLException e) { logger.debug("Error closing connections: " + e.toString()); return; }...
b97282ef-6093-4c15-9bf6-61f2cb925c66
9
@SuppressWarnings("unused") private boolean fixGateways(Graph<Vertex,Edge> g) { int openAND = 0; int closeAND = 0; boolean result = true; for(Vertex v: g.vertexSet()){ // Count number of gateways first if(v.type == GraphLoader.ParallelGateway){ if(g.inDegreeOf(v) > 1) closeAND++; if(g.outDegreeO...
da218322-94b8-4751-8a29-dba204d33be3
4
public double computeSimilarity(int movie1, int movie2) { double sim = 0; // generate arrays containing ratings from users which rated both movies List<Integer> sharedUsers = findSharedUsers(movie1, movie2); if (sharedUsers.isEmpty()) { return sim; } Double[] movieOneRatings = new Double[sharedUsers.s...
c8f8920f-0243-49d1-9382-cf4170bf7712
3
private static void handleMakeOffer(SerializableMakeOffer pack) { Server.loggerServer.info("[Server] Received a Make Offer packet"); SelectionKey key; if (pack.commandInfo == null || pack.commandInfo.size() != 2) { Server.loggerServer.error("Two aditional params required as command info: " + "buyer's na...
3e80781a-170c-4d7a-b11c-d2b59bce5996
6
private HttpRequest createRequest(String urlStr, Request fullQuery, String requestMethod, boolean useOAuth) throws GeneralSecurityException, IOException { Map<String, String> postData = fullQuery.getPostData(); GenericUrl url = new GenericUrl(urlStr); if (debug) { fullQuery.printDebug(); l...
9d1e5a4a-69d9-46de-9bcc-7cc6bdf2d358
7
@Override public String toString() { switch(this) { case A: return "A"; case B: return "B"; case C: return "C"; case D: return "D"; case BE: return "B+E"; case CE: return "C+E"; case DE: return "D+E"; default: re...
e22ab3a9-9ea9-4e33-94a4-67edf7996e56
9
static User check(User user){ User userChecked=null; //Get registered info boolean flag=false;//if registered List<User> list=new ArrayList<User>();//Store all accounts String infomation="";//Store the content in login.txt FileInputStream file=null; try { file = new FileInputStream("login.txt"); }...
cd26d83f-501f-4ac3-9923-e8507c1f331c
2
public void visitNewMultiArrayExpr(final NewMultiArrayExpr expr) { // Keep track of the value numbers of expressions that create new // objects. if (expr.valueNumber() != -1) { if (ValueFolding.DEBUG) { System.out.println("New " + expr); } news.set(expr.valueNumber()); } }
7bc27b60-26dc-4654-ae2c-ce72a3d50a3f
4
public static void main(String args[]) throws IOException{ try { GenData data = new GenData(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } ArrayList<User> users = new ArrayList<User>(GenData.getUserMap().values()); //HashSet<Business> businesses = new HashSet<B...
4f65f6ad-046c-4bc5-891c-c1ea615fc170
7
public static void main(String[] args) { EvolvingGlobalProblemSetInitialisation starter = new EvolvingGlobalProblemSetInitialisation(); starter.initLanguage(new char[]{'0','1','2','3','4','5','6','7','8','9'}, 20, "0[123456789]{3}[0123456789]{6}"); int solutionFoundCounter = 0; int noSolutionFound = 0; Lis...
cef689e6-0594-4b61-b85d-07f7cbae6825
6
@Override public boolean filter(Class c) { if(type != null && !type.isAssignableFrom(c)){ return false; } if(annotation!=null && c.getAnnotation(annotation)==null){ return false; } if(!allowAbstract && Modifier.isAbstract(c.getModifiers())){ ...
2e4d0b4f-7881-4867-95d1-dc95e3563f8b
9
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
fb0c1d07-a714-4352-a740-e206eeb8f498
6
private Node composeMappingNode(String anchor) { MappingStartEvent startEvent = (MappingStartEvent) parser.getEvent(); String tag = startEvent.getTag(); Tag nodeTag; boolean resolved = false; if (tag == null || tag.equals("!")) { nodeTag = resolver.resolve(NodeId.mapp...
0cfc4605-6867-4fe9-b837-1f2f477b4e19
1
public static boolean getKeyUp(int keyCode) { return !getKey(keyCode) && lastKeys[keyCode]; }
19b5594f-1336-435e-87fd-876c86c510bd
1
private void init(String category2, String ticker2) { this.category = category2; this.ticker = ticker2; PERCENT_CHANGE_COMPARISON_LINES.clear(); timeSeriesCompayData.clear(); eWidth = ProfileCanvas.W - 40; id = Database.dbSet.indexOf(ticker); List list = Arrays.asList(DBLabels.priorityLabeling); this.re...
12fe0933-1546-4d23-9d76-a78d3cc67f85
8
public void run() { try { // Create character streams for the socket. in = new BufferedReader(new InputStreamReader( socket.getInputStream())); out = new PrintWriter(socket.getOutputStream(), true); //TODO Get the clients name writers.add(out); // Accept messages from this client ...
c9c8652e-9161-4466-8f47-7c3220e66cff
1
public void sendMessage() { if(txtMessage.getText().equals("")) return; mInterface.sendMessage(mReceiver, txtMessage.getText()); txtConversation.append("Du: " + txtMessage.getText() + "\n"); txtMessage.setText(""); }
81b403d2-2351-4ec7-85da-eb308ac3808a
8
public boolean overlapsAny(ArrayList<Edge> them) { if (VectorWorld.DEBUG_OLAP) { System.out.println("Does the edge from " + this.getStart().getName() + " to " + this.getEnd().getName() + "overlap any of the others?"); } Edge that; for (...
961edbad-e928-4bc2-97eb-2e424eab575d
1
public static boolean isAttributeUsed(int attribute) { if(usedAttributes.contains(attribute)) { return true; } else { return false; } }
95de2bf9-c8d7-4f91-afd4-4f9cc74c67e2
7
public static String getTechnicFolder() { if (INSTANCE.versionData.getNode("install").getBooleanValue("technicFolder", "automatic")) { File jarPath = new File(Minecraft.class.getProtectionDomain().getCodeSource().getLocation().getPath()); return jarPath.getParentFile().getParentFile().getP...
456011a6-0501-41bf-94cc-4dafd32e4f4e
2
private static double remainder(String attribute, ArrayList<HashMap<String, String>> examples, HashMap<String, String[]> attributeValues, int[] pn) { double out = 0; for (String distinctValue : attributeValues.get(attribute)) { int[] pnk = getPositivesAndNegatives(distinctValue, attribute, examples); ...
a3ac0bee-71f7-4be5-b043-e22f4aa78ba9
7
synchronized static Paint getVerticalGradient(String name, int height, int y, float[] positions, Color[] colors) { if (verticalGradients == null) { verticalGradients = new Hashtable<String, TexturePaint>(); } String key = name + " " + height + " "...
480d8071-efe3-4bd8-b32d-20fe6ec32638
8
public String findLongestPalindromicSubstring(String str) { int len = str.length(); // create auxiliary table boolean[][] table = new boolean[len][len]; // variable for startindex of longest palindromic substring int startIndex = 0; // variable for max length of palindromic substring int maxLength = 0; ...
e92c6615-1f33-4401-ad54-ccfe19d6d095
2
public void testPropertyCompareToMinute() { LocalTime test1 = new LocalTime(TEST_TIME1); LocalTime test2 = new LocalTime(TEST_TIME2); assertEquals(true, test1.minuteOfHour().compareTo(test2) < 0); assertEquals(true, test2.minuteOfHour().compareTo(test1) > 0); assertEquals(true, t...
9fad2562-23dd-40fe-b0a7-a1eaa638bb5d
8
private YLabel findYLabel(int yaxis, int desiredMinimumLabelCount) { AxisImageParameters aim = im.axisImageParams[yaxis]; double scaledrange = this.getScaledRange(aim); int labelFactor; //Check each YLabel definition to see if it's acceptable for (int i = 0; ylabels[i].grid > 0; ...
7d2eadfa-7974-43f8-8e41-4574e625ae35
0
public FindReplaceResultsModel() {}
0ca90764-2669-46f2-85a0-cc32729b5cbe
0
@Override public void startSetup(Attributes atts) { super.startSetup(atts); addActionListener(this); }
7134937a-bf24-418e-9e0a-49efd6ea1e1a
7
public static String substrb(String input, int n, String charsetName) { if (n <= 0) { return ""; } byte[] bytes; try { bytes = input.getBytes(charsetName); } catch (UnsupportedEncodingException e) { throw new BaseException(e); ...
f8bb2706-e0db-4136-b745-fadb3cef8957
5
private void setKit(){ if(global.getManager().scriptEngine.equals(lastEngine)) return ; if(addons.Syntax.loaded){ if (global.getManager().scriptEngine.equals("JavaScript")) Content.setEditorKit((EditorKit) addons.Syntax.js); else if (global.getManager(...
c8bb1c06-2d96-48df-8c50-9dcf010bfcb5
4
public static String formatColumnName(String columnName) { if (columnName.length() < 3) return columnName; StringBuffer buffer = new StringBuffer( columnName ); boolean isPreviousLowerCase = false; for (int i = 1; i < buffer.length(); i++) { boolean isCurrentUpperCase = Character.isUpperCase( buffer.cha...
bff1f17a-d7b8-4388-a14e-c63afb8d63bf
8
private void randMove() { int rand = (int)(1 + Math.random() * 4); switch (rand) { case 1: if (dyGob >= -560) { dyGob -= 4; } break; case 2: if (dyGob <= 0) { dyGob += 4; } break; case 3: if (dxGob <= 230) { dxGob += 4; } break; case 4: if (dxGob >= -230) { dxGob ...
0cffe3f6-41d1-43f7-a8a8-3ab898cae576
0
public int compare(String s1, String s2) { return compareVersions(s1,s2); }
4da26e3b-92af-4a65-99db-89d798dbf4ae
3
public int createUserProfileJson(String payload) { DefaultHttpClient httpClient = new DefaultHttpClient(); int output = 0; try { HttpPost httpPostRequest = new HttpPost("http://localhost:2021/mule-esb/rest/createuserprofile"); httpPostRequest.addHeader("accept", "application/json"); StringEntity body ...
4c3731f0-c399-473e-8d76-e3b6e5770996
2
public static void checkWhitelistConfigYAML() { File config = new File(path + "Whitelist/config.yml"); if(!config.exists()) { try { config.createNewFile(); FileConfiguration c = YamlConfiguration.loadConfiguration(config); c.set("Whitelisted", false); c.set("Message", "You are not on the whitelis...
23bbb8a0-e920-47c4-be35-68337d4161cc
5
@Override public void action() { ACLMessage msg = myAgent.receive(); if (msg != null) { if (msg.getConversationId() == null) { String log = "ConversationId == null : sender: " + msg.getSender().getLocalName() + "; content: " + msg.getContent(); ...
4eb826eb-3fb4-4fed-b441-4dd3004388d7
6
public void move(){ if (bulletX + bulletSize/2 < enemyX){ bulletX++; } if (bulletX + bulletSize/2 > enemyX){ bulletX--; } if (bulletY + bulletSize/2 < enemyY){ bulletY++; } if (bulletY + bulletSize/2 > enemyY){ bulletY--; } if (bulletX + bulletSize/2 == enemyX && bulletY + bulletSize/2 == ...
b3a1eb33-9e10-47b9-8a91-75acc525dc11
6
public static void updateMiddleClick(Global global){ Input input = global.getContainer().getInput(); if (input.isMousePressed(Input.MOUSE_MIDDLE_BUTTON) && !prevInput.isMousePressed(Input.MOUSE_MIDDLE_BUTTON)){ //Middle button pressed, find and set next verse, if exists Level currentLvl = global.getCurrent()....
15753296-d871-40cd-b697-f2defbed55cc
6
public BuilderDisplay(){ editingExisting = false; widgetList = new ArrayList<JComponent>(10); currentQuestionString = ""; newWidget = false; panel = new JPanel(); builderBody = new JPanel(); loaderBody = new JPanel(); //activeBuildingPanel = new JPanel(); buildingPanel = new JPanel(); previewPanel =...
098ca4ab-aaea-43d2-b92f-0f517ad61af3
1
public void testDividedBy_int() { Weeks test = Weeks.weeks(12); assertEquals(6, test.dividedBy(2).getWeeks()); assertEquals(12, test.getWeeks()); assertEquals(4, test.dividedBy(3).getWeeks()); assertEquals(3, test.dividedBy(4).getWeeks()); assertEquals(2, test.dividedBy(5...
dc580487-4fa5-4359-b8a6-a2dcc114784f
9
private void processGridletReturn(Sim_event ev) { if (trace_flag) { System.out.println(super.get_name() + ": received an GRIDLET_RETURN event. Clock: " + GridSim.clock()); } Object obj = (Object) ev.get_data(); Gridlet gl = null; Random ra...
11992313-714e-4694-b365-b02e6831a234
8
public static void main(String[] args) throws FileNotFoundException, IOException { SJF s = new SJF(); SJF sw = new SJF(); // z wywlaszczaniem // ================================================================== try (BufferedReader br = new BufferedReader(new FileReader( "wywl.txt"))) { StringBuilde...
af8031a6-001d-4aa2-922c-603fcb8ff0b6
5
@Override public void process(RsPlan plan) throws RsParsingException{ RsToken token; token = nextToken(); if(!token.isIdentifier()) throw token.gripe("Invalid syntax where units specification expected"); String test = token.getString(); if(test.equals("inches")) plan.set...
f3018bb5-d0ee-4806-b04d-7221a1172732
6
public static void main (String[] args) { new ResultSummarizer(args); stopWatch("Starting.."); try{ File infpath = new File(infroot); for (File file : infpath.listFiles()) { if (file.getName().matches("[\\d]+\\.res")){ if (file.listFiles().length == 0) continue; int dlnLogNum = 1; int ...
6343e689-ecac-4032-a82a-71cae25da7f4
5
private HashMap<String, String> getAttributes() { HashMap<String, String> map = new HashMap<String, String>(); for(LayerField field : mFields) { String text = mTextFields.get(field.getName()).getText(); // Get the user input. if(!isInputValid(field, text)) // Checks if inputs are valid and alerts the user i...