method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
cf3b7109-52ce-4685-b7ca-4147512775b2
4
public Double calculateCost(Order order){ if(order == null){ System.out.println("Order is empty"); } double totalCost = 0; for(Pizza pizza : order.getPizzas()){ totalCost += pizza.getCost(); for(String topping : pizza.getToppings()){ Double toppingPrice = toppingsMenu.get(topping); if(toppingPr...
78af5872-304b-4ec6-bffb-51f9b185b7d3
9
public void setUserSavedGame() { File file = new File("Users.txt"); String line = ""; FileWriter writer; ArrayList<String> userData= new ArrayList<String>(); ListIterator<String> iterator; try { Scanner s = new Scanner(file); while(s.hasNextLine()) { userData.add(s.nextLine()); } s...
e1c047e4-f357-460b-b1af-e126b2fe9d91
7
@Override public void rightMultiply(IMatrix other) { // TODO Auto-generated method stub for(int i=0;i<4;i++) for(int j=0;j<4;j++) copy[i][j]=0; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { for (int k = 0; k < 4; k++) { copy[i][j]=copy[i][j] + this.get(k, i) * other.get(j, k); ...
488c5294-5b2d-4c98-8984-bf4a4acd0c88
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; @SuppressWarnings("unchecked") Entry<K,V> other = (Entry<K,V>) obj; if (k == null) { if (other.k != null) return false; } else if (!k....
c3b804f7-b8f7-42d6-b24f-b79e2f3f9b31
8
public ArrayList<Reservation> ReservationsByCustomerForFranchise( int FranID, int CustID) throws UnauthorizedUserException, BadConnectionException, DoubleEntryException { /* Variable Section Start */ /* Database and Query Preperation */ PreparedStatement statment = null...
c2cd9c34-8f5c-495f-a524-b986bee3f32b
4
public boolean isValidPassword(String userName, String password) { try { LoginDao ds = new LoginDao(); String pwdFromDB = ds.getUserPassword(userName); if (null != pwdFromDB) { if (pwdFromDB.equals(password)) { return true; } } } catch (Exception ex) { if (!(ex instanceof DaoException))...
5af72c70-3753-48ac-8185-87000d9359cb
9
public void ensureConnection() throws AuthenticationException { BugLog.getInstance().assertNotNull(getConnection()); if (getConnection().isOpen()) { return; } // #69689 detect silent servers, possibly caused by proxy errors final Throwable ex[] = new Throwable[1]; ...
7788a3c4-ecd8-48c2-8300-8bd8850c2d32
0
private MailUtil(){ };
52747e82-74f9-45de-8a01-bde27ce06850
7
@Override public void discoverChildren() { //super.discoverChildren(); Map<Date, VirtualFolder> datums = new HashMap<Date, VirtualFolder>(); Map<String, VirtualFolder> series = new HashMap<String, VirtualFolder>(); String xml = HTTPWrapper.Request("http://iptv.rtl.nl/xl/VideoItem/I...
0c327213-2342-41f8-a4b3-65877d26751d
3
public static void toggleCommentAndClear(Node currentNode, JoeTree tree, OutlineLayoutManager layout) { CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree); JoeNodeList nodeList = tree.getSelectedNodes(); for (int i = 0, limit = nodeList.size(); i < limit; i++) { toggleComment...
85ace560-c24f-4361-91a8-ed5cff41f533
8
public void sendWertBerechnenX(int inputX, int inputY){ if(inputX >= 0){ //Positiv if(inputX <= 256){ posX1 = setPosWert(inputX); posX2 = 0; }else{ posX1 = 256; posX2 = setPosWert(inputX - 256); } } if(inputX < 0){ //Negativ if(inputX > -255){ negX1 = setNegWert(inputX); negX2 ...
22399a72-8d48-4fe9-9f0b-bad136473193
4
@Override public double fun(double[] w) { double f = 0; double[] y = prob.y; int l = prob.l; int w_size = get_nr_variable(); double d; Xv(w, z); for (int i = 0; i < w_size; i++) f += w[i] * w[i]; f /= 2; for (int i = 0; i < l; i++...
8694513b-b7c5-4d2e-a08d-ef037a58b86e
8
public String getTooltipExtraText(final Province curr) { final int id = curr.getId(); if (!editor.Main.map.isLand(id)) return ""; String owner = mapPanel.getModel().getHistString(id, "owner"); String controller = mapPanel.getModel().getHistString(id, "controller"); ...
353de7a1-564e-49ed-862c-1a10ced9df2a
7
public static Map<Integer, Double> getResourcesFromUserWithBLL(List<Bookmark> trainData, List<Bookmark> testData, int userID, List<Map<Integer, Double>> bllValues) { Map<Integer, Double> resourceMap = new LinkedHashMap<Integer, Double>(); Map<Integer, Double> values = null; if (bllValues != null && userID < bllVa...
3662e26e-be94-47c2-8063-b47fae3f38d9
3
protected String removeHttpProtocol(String html) { //remove http protocol from tag attributes if(removeHttpProtocol) { Matcher matcher = httpProtocolPattern.matcher(html); StringBuffer sb = new StringBuffer(); while(matcher.find()) { //if rel!=external if(!relExternalPattern.matcher(matcher.group(0...
427ea07a-cdf7-4547-955e-d690dac92531
5
@Override public boolean login(String userID, String password) { // TODO Auto-generated method stub if(validate(userID)){ String[] userIds= (rb.getString("userIds")).split(" "); String[] passwords= (rb.getString("passwords")).split(" "); String[] status= (rb.getString("status")).split(" "); for (int i = 0;...
d15cebba-03ba-4820-be2d-1c3067a1e2c3
5
@Override public void destroy(VirtualMachine virtualMachine) throws Exception { if (status(virtualMachine).equals(VirtualMachineStatus.RUNNING)) { stop(virtualMachine); } IMachine machine = this.vbox.findMachine(virtualMachine.getName()); ISession session = getSession(virtualMachine); machine.lockMach...
19871dab-35f7-4b5c-a3b6-f335faf2c4f3
8
public void crossReferenceMetaAnnotations() throws CrossReferenceException { Set<String> unresolved = new HashSet<String>(); Set<String> index = new HashSet<String>(); index.addAll(annotationIndex.keySet()); for (String annotation : index) { if (ignoreScan(annotation)) ...
3c8e375e-99d2-4b32-a5db-4f953d54baf7
3
@Override public Book readBook(String isbn) { if (doc == null) return null; Element currRoot = doc.getRootElement(); Element parrentBook = currRoot.getChild("books"); List<Element> listBooks = parrentBook.getChildren(); for (Element book : listBooks) { String bookIsbn = book.getChild("isbn").getText(...
922b80f8-1225-41ed-8c89-3bf3e605ea08
8
private void printEnclosedStackTrace(PrintStreamOrWriter s, StackTraceElement[] enclosingTrace, String caption, String prefix, Set<Throwable> dejaVu) { assert Thread.holdsLock(s.lock()); if (dejaVu.contains(this)) { s.println("\t[CIRCULAR REFERENCE:" + this + "]"); } else { dejaVu.add(this); // Com...
cd88bff8-8002-451b-8121-8034867a4cce
2
public static EnumColumn getEnumColumn(int value) { for (EnumColumn column : EnumColumn.values()) { if (column.getPosition() == value) { return column; } } return null; }
63a6f7ad-2223-4f85-b35e-da8c6b50606f
6
protected void selectImageFilter(){ FileNameExtensionFilter imageFilter; imageFilter= new FileNameExtensionFilter("All files (*.*)","*.*"); switch(this.selectedExtensionImage){ case all: imageFilter = new FileNameExtensionFilter("All files (*.*)","*.*"); ...
83d46138-77b1-47b1-8d7b-a0d1e095a873
1
public char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1);...
72f79ea1-0e43-4608-8099-9a5abe3134c0
4
public int checkLine(int[] line) { int i; boolean test = (line[0] == 0); for (i = 0; i < line.length; i++) { if ((line[i] == 0) != test) { break; } } if (i >= line.length) { return 0; // Ligne incomplète } else if (test)...
cae8c353-0c32-4295-9d64-da479b2414a1
9
@Override public List<Object> filter(Status status) { URLEntity urls[] = status.getURLEntities(); if (urls == null) { return null; } URL finalUrl = null; List<Object> marketUrls = new LinkedList<Object>(); for (URLEntity url : urls) { try { ...
0e877c2c-e91d-497e-9f11-5492f3996d62
5
public void recursiveBFS(String label) { Vertex v = getVertex(label); if (v.wasVisited() == false) { v.setVisited(true); this.queueOfNodes.add(v); System.out.println("Visited vertex : " + v); } int r = getVertexIndex(label); for (int i = 0; i < this.COLS; i++) { if (graph[r][i] == 1) { Vert...
887d8f90-d4e2-46e7-bc0c-bf00ad519780
5
public Hashtable SibXMLMessageParser(String xml, String id[]) { if(xml==null) { System.out.println("ERROR:SSAP_XMLTools:SibXMLMessageParser: XML message is null") ;return null; } if(id==null) { System.out.println("ERROR:SSAP_XMLTools:SibXMLMessageParser:id is null"); return null; } Docu...
69a713fb-ade8-4de4-b56a-2ac16ea5cf15
6
private void tarjanAlgorithm(Node n) { n.setIndex(index); n.setLowlink(index); index++; s.add(n); for(Node c: n.getToNode()) { if(c.getIndex() == -1) { tarjanAlgorithm(c); n.setLowlink(Math.min(n.getLowlink(), c.getLowlink())); } else if(s.contains(c)) { n.setLowlink(Math.min(n.g...
43c55015-1b98-44a0-8bdb-713dfb61ffce
9
public Object[][] getMultipleRows(String testcase) { String testSheetName = getTestSheetName(testcase); if(testSheetName.equalsIgnoreCase("TestSheet Not Found")){ return null; } HSSFSheet testSheet = workBook.getSheet(testSheetName); String cellData; int totalRows = testSheet.getPhysicalNumberOfRows(); ...
f4be4c28-4cc5-4ec8-b7a8-d1df0ac8416f
3
public int getCurrentSectionNo(){ if (isEmpty()) return -1; int position = size()-1; Enumeration en = positionMap.keys(); Integer nextKey = null; Integer nextValue = null; while(en.hasMoreElements()){ nextKey = (Integer)en.nextElement(); nextValue = positionMap.get(nextKey); int v = nextValue.intValue(); ...
bf0c21dc-81af-465f-b85b-bd80f6f37ff4
9
public Cloud(int id, Channel leftIn, Channel leftOut, Channel rightIn, Channel rightOut) { this.id_ = id; this.leftIn_ = leftIn; this.leftOut_ = leftOut; this.rightIn_ = rightIn; this.rightOut_ = rightOut; name = this.getId(); currentState = Status.PRE_AUTHED; /* Swing parts */ cloudLbl = new JL...
f76039c0-da6b-495b-ae69-6d3bdd4ec941
0
@Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); }
287a4256-0547-44cd-af7d-eef343325a3f
1
@RequestMapping(value = "/login", method = RequestMethod.GET, produces = "application/json") private @ResponseBody User checkLoginAvailability(@RequestParam String login) { User user = appContext.getUserService().readUserByLogin(login); if (user != null) { return user; } ...
d07115e6-edba-4338-be22-dd6b460f7b0d
0
public void setField(String field) { this.field = field; }
4b5d6a77-bba5-4f0e-804d-3c69808ef822
2
@Override public boolean getOutput() { for (int j = 0; j < getNumInputs(); j++) if (getInput(j)) return true; return false; }
e7ee335e-5c2b-49d0-914e-07d590cfaa46
9
public BasicStructure2 parse(BasicStructure1 structure1) { ArrayList<Integer> types = structure1.getTypes(); ArrayList<String> tokens = structure1.getTokens(); ArrayList<Integer> types1 = new ArrayList<Integer>(); ArrayList<String> tokens1 = new ArrayList<String>(); int type; String token; boolea...
767024f2-85da-456f-ae8d-4fdc41ec8cc3
5
private int search(int[]A,int b,int e,int target) { if (b >= e) return b; if (b + 1 == e) { if (A[b] >= target) return b; return e; } int mid = (b + e) /2; if (A[mid] == target) return mid; if (A[mid] > target) return search(A,b,mid,target); return search(A,mid+1,e,target); }
b3cf857f-74d0-4839-acda-ab7b9fd3f843
4
public void update(){ up = keys[KeyEvent.VK_UP] || keys[KeyEvent.VK_W]; down = keys[KeyEvent.VK_DOWN] || keys[KeyEvent.VK_S]; left = keys[KeyEvent.VK_LEFT] || keys[KeyEvent.VK_A]; right = keys[KeyEvent.VK_RIGHT] || keys[KeyEvent.VK_D]; }
bda1b207-6307-4996-83b1-7e999a945ae8
5
@Override public Group findGroupByGroupIdAndUserId(int groupId, int userId) { Group group = null; Connection cn = null; PreparedStatement ps = null; ResultSet rs = null; try { cn = ConnectionHelper.getConnection(); ps = cn.prepareStatement(QTPL_SELEC...
6dc61d10-b2b0-4e48-ae15-1a74ba205b64
3
public static double[] getPageMargins(PrintService service, PrintRequestAttributeSet set, LengthUnits units) { PageOrientation orientation = getPageOrientation(service, set); double[] margins = getPaperMargins(service, set, units); if (orientation == PageOrientation.LANDSCAPE) { return new double[] { margins[...
cb41fc3f-0682-477d-8575-c1d77d70c7fc
0
public String getName() { return delegate.getName(); }
2f4bb655-1837-4ac0-8806-dc5f3ca44dfb
3
private static void insertSongs(int count) { int processors = Runtime.getRuntime().availableProcessors(); Thread[] threads = new Thread[processors]; int size = count / 2; for(int i = 0; i < processors; i++) { threads[i] = new InsertThread(size, size * i); threads[i].start(); } ...
72aeee6e-f4ed-4d83-99dd-35b142c5b776
8
public double obtenerPorcMateria() { double porcentajeMateria = 0; switch (getTamannoEnvase()) { case 'P': if (getGrosorEnvase() == 1) { porcentajeMateria = Constantes.PORCENTAJE_ENVASE_P_1; } break; case 'M': if (getGrosorEnvase() == 1) { porcentajeMateria = Constantes.PORCENTAJE...
9fe6da7b-5efa-44ac-a335-1c96ad77fcdd
0
public SaveAsAction(Environment environment) { super("Save As...", null); putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, MAIN_MENU_MASK + InputEvent.SHIFT_MASK)); this.environment = environment; this.fileChooser = Universe.CHOOSER; }
7832824e-ac91-4220-bbba-df8327182556
0
public synchronized void drop() { taken = false; notifyAll(); }
505c1ccb-04dc-49a2-bfc8-5e5ce3c6b883
3
public void generateParticles(){ if (ParticleSystem.enabled) for(int i = 0; i < 4 * intensity; ++i) try { ParticleSystem.addParticle(newParticle()); } catch (IllegalArgumentException e) { e.printStackTrace(); } ...
08d6b990-cf50-4d37-8bd1-07620c3148c8
2
private static boolean isUnsafe(char ch) { if (ch > 128 || ch < 0) return true; return " []$&+,;=?@<>#%".indexOf(ch) >= 0; }
fed40dda-e6eb-4778-9808-4989139a0189
2
public static String getName(Subcategorias subcat){ String sql="SELECT * FROM subcategorias WHERE idsubcategorias = '"+subcat.getId()+"'"; if(!BD.getInstance().sqlSelect(sql)){ return null; } if(!BD.getInstance().sqlFetch()){ return null; } return ...
e120fd38-1476-40e3-9567-39019729b89c
2
private void dfs(Graph G, int v) { marked[v] = true; id[v] = count; for (int w : G.adj(v)) if (!marked[w]) dfs(G, w); }
8c1cd48d-0665-4cf4-bdae-319ffdb7669a
7
@EventHandler(ignoreCancelled = true) public void weatherevent(WeatherChangeEvent event) { if(!Config.enabledWorlds.contains(event.getWorld().getName())) {return;} if(event.toWeatherState() == true) { if(Config.rainWarning) { World world = event.getWorld(); if(rand.nextInt(100) < Config.acidRainChance) ...
67b18594-c0b2-4ee7-8f75-554d19bd33c0
7
private byte[] loadJarData(String path, String fileName) { ZipFile zipFile= null; InputStream stream= null; File archive= new File(path); if (!archive.exists()) return null; try { zipFile= new ZipFile(archive); } catch(IOException io) { return null; } ZipEntry entry= zipFile.getEntry(fileName);...
3858d8b7-49c4-445e-ac94-6938a1a52362
9
final public String assignexpr() throws ParseException { /*@bgen(jjtree) ASSIGN */ SimpleNode jjtn000 = new SimpleNode(JJTASSIGN); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000);Token t; String s; String assign = ""; try { t = jj_consume_token(ASSIGN); assign += t.image.toString(...
299e90d0-1e30-4ce1-8ff3-5b7286d6c9e6
0
public void setAnswers(ArrayList<String> answers) { textAnswer=answers; }
d3e492ed-721c-49e0-b467-520c1e36e7ed
9
private void processResponse(int userInput) { switch (userInput) { case 0: //switch person to view System.out.println("Switching Person..."); currentPerson = null; break; case 1: //Add Relationship addRelationship(); break; case 2://Delete Relationship deleteRelationship(); break; case ...
ccb8b772-f9c9-4631-b4bd-71eba864e46f
7
public boolean win() { for (int i = 0; i < plateau.length; i++) { if (plateau[0][i] != null && plateau[0][i].getHaveBall() && plateau[0][i].getColor().equals("Noir") || plateau[6][i] != null && plateau[6][i].getHaveBall() && plateau[6][i].getColor().equals("Blanc")) { return true; } } ret...
2e76ce1d-7398-41be-af56-8b0abfa3f781
6
public static String oneScan(String s){ if(s==null) return null; StringBuilder result = new StringBuilder(); int end = s.length(); for(int i=s.length()-1;i>=0;i--){ if(s.charAt(i)==' '){ end = i; continue; } if(i==0||s.charAt(i-1)==' '){ if(result.length()!=0){ ...
baed5e50-44ef-4c51-8faf-bf7b60d52404
3
private MethodIdentifier findMethod(String name, String typeSig) { for (Iterator i = methodIdents.iterator(); i.hasNext();) { MethodIdentifier ident = (MethodIdentifier) i.next(); if (ident.getName().equals(name) && ident.getType().equals(typeSig)) return ident; } return null; }
916d300f-9df8-42fa-9c78-fd430e3ffc43
1
@Transactional public void doSomeThing() { TestBean bean1 = new TestBean(3,"piyoxs"); dao.update(bean1); List<TestBean> list = dao.findAll(); for (TestBean bean : list) { SimpleLogger.debug("..." +bean.toString()); } TestBean bean3 = dao.find(3); SimpleLogger.debug(bean3.toString()); ...
c804f0ce-c8b0-4906-8aaf-21ae6d6d33cf
8
@Override public Move getMove() { int thinkingTime = 0; if (playerColour == Definitions.WHITE) { thinkingTime = 750; } else { thinkingTime = 750; } System.out.println("AI Thinking (" + thinkingTime / 1000.0 + " seconds)"); long startTime = System.currentTimeMillis(); long finishTime = System.curren...
8b2ca1ca-ad0e-4d3d-b2c8-eeed928d8f1f
4
@Override public int hashCode() { boolean test = false; if (test || m_test) { System.out.println("Coordinate :: hashCode() BEGIN"); } if (test || m_test) { System.out.println("Coordinate :: hashCode() END"); } return m_X + m_Y; }
93764b15-7021-402d-9795-f391e0008c6a
5
@Override public Object[] getChildren(Object parentElement) { if (parentElement instanceof IProject) { IProject project = (IProject) parentElement; IFile gruntFile = project.getFile(GRUNT_FILE); if (gruntFile.exists()) { return new Object[] { new TaskContainer(gruntFile, getTasks(gruntFile), false...
b0f7faea-335f-46e7-9ea6-42504f7a98c6
4
public int search(CharSequence text, String pattern) { int M = text.length(); int N = pattern.length(); for (int i = 0; i < M - N; i++) { int j; for (j = 0; j < N; i++) if (text.charAt(i + j) != pattern.charAt(j)) break; if...
075429f3-1929-4e65-920c-91b3e01b3ae1
2
public StockItem getProductByName(String productName) { for (StockItem stockItem : stockList) { if (stockItem.getProduct().getProductName().equals(productName)) { return stockItem; } } return null; }
910425c0-58af-40f5-b5da-d35500a7e3b1
7
public boolean isLibrary() { if (libVisit) return false; if (library == 0 && nextCourse == Course.HUMANITIES) return true; else if (library == 1 && nextCourse == Course.MATH) return true; else if (library == 2 && nextCourse == Course.SCIENCE) return true; else return false; }
1ea3281b-9d9c-4dc8-827f-7faa25536122
9
public <T> T unmap(Map<String, ?> genericised, Class<T> type) { ReMapperMeta meta = extractMeta(genericised); if (meta == null) { //assume this is a hash map System.err.println("__ null meta: umm... what now?"); } if (meta != null) { //note: its possible for the type to change (specialisation - to a su...
048ce8a6-8713-49f0-8bd0-048d03d493eb
2
public EarningsTest() { // TODO: use/display company descriptions // TODO: add dates to price/volume graph // TODO: merge idential files / double gae output File resources = new File(REPORTS_ROOT); if (!resources.exists()) resources.mkdir(); singleton = this; programSettings = MemoryManager.restoreSett...
39a701c0-a48a-40a5-a158-d36871f5f7c3
4
private void registerShiftListener(){ KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new KeyEventDispatcher() { @Override public boolean dispatchKeyEvent(KeyEvent e) { synchronized (KeyChecker.class){ switch (e.getID()){ ...
a35fc330-39a2-45be-ba63-513d334436ab
4
public static void writePhones(ConcurrentHashSet<Long> set, String file) throws IOException { if (file == null || file.equals("")) return; FileWriter fw = new FileWriter(new File(file)); BufferedWriter bw = new BufferedWriter(fw); try { if (set.size() == 0) { bw.append("no phone numbers."); return...
e9623dcf-5d83-49f6-a67a-82ab8d19df66
0
public void updateView() { setLocationManually(myAutoPoint); }
ae53af0d-bc7c-4cd6-9336-75fce7339ff2
4
public void dumpExpression(TabbedPrintWriter writer) throws java.io.IOException { if (!isInitializer) { writer.print("new "); writer.printType(type.getHint()); writer.breakOp(); writer.print(" "); } writer.print("{ "); writer.startOp(writer.EXPL_PAREN, 0); for (int i = 0; i < subExpressions.len...
e6603db1-7649-4aab-8bcb-03926a2f349e
8
public SetGUI(Client c) { client = c; setResizable(false); //cannot expand game to keep background image looking spiffy /* * Standard setup for contentPane, notice that it is a layered pane * so we are able to have a good-looking background */ getContentPane().setLayout(null); setDefaultCloseOper...
cbc0d253-5e0c-4deb-ade0-538af198ebe9
9
public String simplifyPath(String path){ if (path == null || path.length() == 0) return "/"; Stack<String> stack = new Stack<String>(); for (String s : path.split("/")){ if (s.length() == 0 || s.equals(".")) continue; else if (s.equals("..")){ if (!stack....
9d7d975a-fc0d-47a6-9fbc-7c910dc0ad26
5
private boolean tryFindPath() { for (Node neighbour : neighbours) { if (neighbour.x == n || neighbour.y == 0) { return true; } if (!neighbour.isReachable()) { neighbour.setReachable(); if (neighbour.tryFindPath()) { return true; } } } return false; }
8e2bd2ba-d2cb-4df6-bf81-5197e1ac3a76
3
public Object getValueAt(int row, int col) { if(row>-1 && col>-1 && data!=null) return data[row][col]; else return null; }
60618812-7861-487b-a5ab-a4f60d31ac67
6
public static void main(String[] args) throws ClassNotFoundException, IOException, InterruptedException { // TODO Auto-generated method stub // // Testing try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { ...
697bf56f-80e8-4d50-a146-0a6f0415ea62
2
private void finishFileReceiverThread() { if (this.fileReceiverThread != null) while (this.fileReceiverThread.isAlive()) { this.fileReceiverThread.interrupt(); this.log.fine("FileReceiver thread is interupt"); stopFileReceiver(); } }
d8686d68-69c8-442b-86df-139a10e44811
8
public void run() { while (pause) { Thread.yield(); } paused = true; while (running) { if (DO_VALIDATION) { boolean done = false; while (pause) { if (!done) { System.out.println("Thread " + Thread.currentThread().getId() + ": Stope...
25179d3f-8270-44f7-a18f-e99f66b9ab3b
4
@Override public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { if (qName.equals("rowset")) { String name = getString(attrs, "name"); factions = name.equals("factions"); factionWars = name.equals("factionWars"); } else if (qName.equals("row")) { if...
3f1f941f-9417-48ba-8241-060ccb8eeee7
3
@Override public void execute(double t) { try { if (input.getDic() != null && input.getDic().getSource() != null) output.setOutput(input.getDic().getInput()); } catch (OrderException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
fa743a66-bb27-442f-b314-7098827e0886
4
public void createMap(int size) { if (!edit) { gui.console("Click \"Edit Graph\" button"); return; } clearGraph(); boolean directed = graph.isDirected(); graph.setDirected(false); int center_x = rel(getWidth() / 2); int center_y = rel(ge...
932a8b90-dec9-4712-a8ca-a955b0276147
7
public boolean mouseDown (Event event, int x, int y) { dragStart = new Point (x, y); dragged = false; if (selectionAllowed && wave != null) { if ((event.modifiers & Event.META_MASK) != 0 || (event.modifiers & Event.ALT_MASK) != 0 || (event.modifiers & Event.CTRL_MASK) != 0) { sele...
41066396-4bbf-4b9e-ac25-922794edb40e
3
public byte[] getTiledImageData() { byte[] palettedImage = new byte[width * height]; int tileCount = width * height / 64; int tileWidth = width / 8; for (int t = 0; t < tileCount; t++) for (int y = 0; y < 8; y++) for (int x = 0; x < 8; x++) ...
2f61488e-77dc-4419-913c-6a86409f16d8
1
public void fillObject(CreditProgram crProg, ResultSet result) { //Заполняем кредитную программу try { crProg.setId(result.getInt("ID")); crProg.setName(result.getString("CREDITNAME")); crProg.setMinAmount(result.getLong("CREDITMINAMOUNT")); crProg.setMaxA...
54c432d2-45e7-4532-84c4-e97367896f82
9
@SuppressWarnings("unchecked") public void configFromJSONFile(String fileName) throws IOException, JSONException, ClassNotFoundException{ File file=new File(fileName); FileInputStream fileStream=new FileInputStream(file); BufferedReader reader=new BufferedReader(new InputStreamReader(fileStream)); ...
054cd41b-3e0b-49ea-90bd-6623561e985e
7
private void changeMapInternal(final MapleMap to, final Point pos, MaplePacket warpPacket) { if (NPCScriptManager.getInstance().getCM(client) != null) { NPCScriptManager.getInstance().dispose(client); } if (eventInstance != null) { eventInstance.changedMap(this, to.getId(...
eaa88985-6138-4ae0-85a1-ce5c934f35f3
9
public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub if(e.getSource() == btAddCopy) { this.dispose(); new AddCopy(user); } else if(e.getSource() == btAddDoc) { this.dispose(); new AddDocTypeChooseFrame(user); } if(e.getSource() == btDltCopy){ this.dispose(); ...
aba2f7df-bc0b-4987-81dd-ebd3a8496893
7
private int processOrderList(ArrayList<Trade> trades, OrderList orders, int qtyRemaining, Order quote, boolean verbose) { String side = quote.getSide(); int buyer, seller; int takerId = quote.gettId(); int time = quote.getTimestamp(); while ((orders.getLength()>0) && (qtyRemaining>0)) { int...
9ec50c09-cf06-4401-b0fa-e04702f450c1
0
public TypeConvert() { }
8f0545df-6376-4311-938f-1e3befb07fce
3
public static int readVarInt(ByteBuf byteBuf) { int out = 0; int bytes = 0; byte in; while (true) { in = byteBuf.readByte(); out |= (in & 0x7F) << (bytes++ * 7); if (bytes > 5) { throw new IllegalStateException("Integer is bigger than m...
d1ff49c1-637a-4266-bfab-ceed791c53fa
7
public void run() { try { //Obtenemos datos como el NICKNAME entrada=new ObjectInputStream(conexion.getInputStream()); this.nickname=(String)entrada.readObject(); //Actualizamos usuarios usuarios.add(nickname); ...
3ccd91cd-acee-4ea0-a9bc-4552c3c01f2b
0
public CreatePDFRaport() { }
0cacd99b-b0d8-468d-9a6a-b49dd848b2a6
9
public static SpMat getAddReqEdges(GraphModel gILU, SpMat m, SpMat mR, SpMat mP,Vector<Integer> order) { SpMat addM = new SpMat(m.rows(),m.cols()); //for (int i = 0; i < m.getRowDimension(); i++) { // for (int j = 0; j < m.getColumnDimension(); j++) { for(int i : order) { ...
325af7e2-4708-494a-abbb-8d3b82e59009
3
public void generate_test() { boolean lowerTail = true; for (int i = 0; i < numTests;) { int N = rand.nextInt(MAX) + 1; int D = rand.nextInt(N) + 1; int n = rand.nextInt(N) + 1; int k = Math.max(rand.nextInt(Math.min(n, D)), 1); if (Hypergeometric.get().checkHypergeometricParams(k, N, D, n)) { d...
548e1e89-f88d-44fa-bf5b-9e9a593ce411
2
public boolean checkWord(String word) { word = word.toLowerCase(); // This is very inefficient for (int i = 0; i < m_dictionary.length; i++) { if (m_dictionary[i].equals(word)) { return true; } } return false; }
98dcd8ad-bd4a-466c-b586-3e9c260a3cfa
7
private void batchEstimateDataAndMemory(boolean useRuntimeMaxJvmHeap, String outputDir) throws IOException { //File mDataOutputFile = new File(outputDir, "eDataMappers.txt"); //File rDataOutputFile = new File(outputDir, "eDataReducers.txt"); File mJvmOutputFile = new File(outputDir, "eJvmMappers.txt"); File ...
985a927d-16a8-4914-b7d5-86e8965232a0
7
public static Boolean isTypeAllowed(Class<?> clazz) { // Logger.getAnonymousLogger().info("checking type : " + clazz.getName()); if (clazz.isPrimitive() || getAllowedTypes().contains(clazz)) { return true; } Set<Class<?>> allowedTypes = getAllowedTypes(); for (Class<?> allowedType : allowedTypes) { ...
2d9d38fe-dc0d-4614-902a-ac3408691672
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://...
14607fff-cc86-485f-8948-b9f2a752ba5a
1
public synchronized int SelctUrls(String url) { int id = 0; try { ResultSet re = tags_ste.executeQuery("SELECT * from zhangyu_sca.article_urls WHERE (list_url = '" + url + "');"); re.next(); id = re.getInt("article_id"); } catch (SQLException e) { ...
dbb65fa8-c69e-4678-ae9a-e0138d85d62b
2
public Player play() { Output out1 = _player1.draw(); Output out2 = _player2.draw(); int outcome = determineWin(out1, out2); if(outcome == 0) { return null; } else if(outcome == 1) { return _player1; } ...
85393cd3-d4f4-4957-abd3-294474dd892b
6
public View create(Element elem) { String kind = elem.getName(); if (kind != null) { if (kind.equals(AbstractDocument.ContentElementName)) { return new WrapLabelView(elem); } else if (kind.equals(AbstractDocument.ParagraphElementName)) { return new ParagraphView(elem); } else if (kind.equals...