method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
864fedfe-cf80-496d-b21e-0e0b815d2cbe
1
public Coord xlate(Coord c, boolean in) { if (in) { return c.div(getScale()); } else { return c.mul(getScale()); } }
64d74c79-5483-4f02-baea-1d53f6701668
4
public void setInt(int wert) { setBits(false); if (wert < 0) return; for (int i = 0; i < size; i++) { if (wert == 0) break; if ((wert & 1) == 1) bits[i] = true; wert = wert >>> 1; } }
3faed734-f0ae-48d6-bf1c-0f6993e2f487
7
public static void clOutputOneUnit(TranslationUnit unit, PrintableStringWriter stream) { { Stella_Object translation = unit.translation; if (translation == null) { System.out.println("`" + unit + "' has a NULL translation."); return; } if (unit.category != null) { if (!(Tr...
8de9cd91-af30-49e8-b1fd-a8bced22f156
0
public void setX(int x) { this.x = x; }
189d20f7-2bec-4fec-b593-0e163f4a7ca5
3
public void mouseClicked(MouseEvent e) { if (!onClickDown && e.getClickCount() == 2 && actionCommandDoubleClick != null) { callActionListenersDouble(); } }
339a96dc-fbce-421f-a449-9e279260d0a7
2
@Override public boolean equals(Object obj) { if (obj instanceof Coordinate) { Coordinate otherCoord = (Coordinate)obj; return this.row == otherCoord.row && this.col == otherCoord.col; } return false; }
22e387b4-b5c0-4cfd-b307-afbdc08951a8
8
private void initPanel() { JPanel p = new JPanel(); p.setLayout(null); for (int i=0;i<7;i++){ createLabel(p,i); createTextField(p,i); } // Add confirm button JButton confirmButton = new JButton("Confirm"); confirmButton.setBounds(WIDTH/4, 9*HEIGHT/11, WIDTH/2, HEIGHT/13); confirmButton.addActionL...
6488f466-d644-437b-937d-5adab2baed43
3
public void inserisci(T x) { AlberoBin<T> padre = cercaNodo(x); if (padre == null) { // inserisco la radice coll = new AlberoBinLF<T>(); coll.setVal(x); } else if (!padre.val().equals(x)) { AlberoBinLF<T> figlio = new AlberoBinLF<T>(); figlio.setVal(x); if (x.compareTo(padre.val()) < 0) padre.se...
d2af671f-a329-4106-8dbf-63042dc78caa
9
private String getTextAsEps(String text) { final StringBuilder sb = new StringBuilder(); for (int i = 0; i < text.length(); i++) { final char c = text.charAt(i); if (c == '\\') { sb.append("\\\\"); } else if (c == '(') { sb.append("\\("); } else if (c == ')') { sb.append("\\)"); } else if...
894f633f-cee3-4f59-8774-94f330115f13
1
private int getol(Coord tc) throws Loading { int ol = map.getol(tc); if (ol == -1) throw (new Loading()); return (ol); }
b1815ffd-a8b0-49f1-ba6c-64a13f982659
5
public synchronized void threadStart(SimThread t) { if (Constants.muCheck) { if ((Constants.muIncS += Constants.muIncUp) <= .95) { t.Constants._epsilon = this.epsilon; t.Constants._SIM_epsilon_start = this.epsilon; t.Constants._SIM_epsilon_final = this.epsilon; t.setRunNum(runNum); runNum++; ...
1eab417e-ad35-4775-a776-4dfaf89b76b7
0
public void openDoor() { System.out.println("模板共性,打开车门"); }
0d9d9b99-e30e-41db-9fe8-90dbe5dee202
2
public static boolean skipClass(ClassInfo clazz) { InnerClassInfo[] outers = clazz.getOuterClasses(); if (outers != null) { if (outers[0].outer == null) { return doAnonymous(); } else { return doInner(); } } return false; }
d10b1798-aa1b-4b24-bac8-f0e94e030e4d
7
public SubscribeEventModel buildFromXml(String xml) throws DocumentException { if (null == xml || xml.trim().isEmpty()) return null; List<Element> list = WechatUtils.getXmlRootElements(xml); SubscribeEventModel subscribeModel = new SubscribeEventModel(); for (Element element : list) { ...
171ba06b-3d2e-48e9-bce0-64fad20da12e
9
private static boolean checkHwReqs(float wfHwCpu, float wfHwMem,float wfHwStorage, String archValue, QuerySolution qs) { //iapp HW specs (in MB) float iappHwCpu = 0; float iappHwMem = 0; float iappHwStorage = 0; String iappArch = ""; String hwcpu = qs.get("?hwcpu").toString(); String...
8073d991-3b95-462c-810c-ce56b282a598
7
public final boolean equals(Object o) { if (!(o instanceof Entry)) return false; Entry e = (Entry)o; Object k1 = Integer.valueOf(getKey()); Object k2 = Integer.valueOf(e.getKey()); if ((k1 == k2) || ((k1 != null) && (k1.equals(k2)))) { Object v1 = getValue(); Object v2 ...
b57fb677-4119-4f56-b1fb-464982920adb
1
@Test public void test_saveArrayToFile() { String filePath = "testFile.txt"; // creating list with specified amount of random numbers List<Integer> list = appUtil.getRandomNumbers(10, 10); appUtil.saveArrayToFile(filePath, list); // testing existence of file File f...
1c3ffdd6-1a2c-40b0-81ae-17bb9c773ab0
6
public static int getMaxTimerFromScore(GameMode mode, int score) { if (mode == GameMode.CASUAL) { return 10000; } else { if (score < 100) { return 10000; } else if (score < 150) { return 7000; } else if (score < 200) { return 5000; } else if (score < 250) { ...
70afbd6c-e949-4959-bbc5-02524f40be4a
1
public void visitReturnExprStmt(final ReturnExprStmt stmt) { if (stmt.expr == from) { stmt.expr = (Expr) to; ((Expr) to).setParent(stmt); } else { stmt.visitChildren(this); } }
baf52591-c20c-4269-b67c-b731c38538f4
7
public Piece makePiece(String s) { boolean color = 'W' == s.charAt(0); switch (s.charAt(1)) { case 'X': return new Blank(color); case 'B': return new Bishop(color); case 'R': return new Rook(color); case 'P': return new Pawn(color); case 'Q': return new Queen(color); case 'K': ...
d6672d53-5983-4a4e-892e-bc958ef2a935
2
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String ud = request.getParameter("u"); String rd = request.getParameter("r"); response.setContentType("text/html;charset=UTF-8"); t...
dc05bcf9-d3ea-462e-a454-6bf029c37fe8
8
@Override public boolean onCommand(final CommandSender sender, final ItemStackRef itemStackRef, Command command, String label, String[] args) { // Check the player is holding the item ItemStack held = itemStackRef.get(); if (held == null || held.getTypeId() == 0) { sender.sendMes...
6250207e-a796-4751-96b4-018127607246
3
public static int singleNumber(int[] A) { HashMap<Integer, Integer> hashMap=new HashMap<>(); for(int i=0;i<A.length;i++){ if(!hashMap.containsKey(A[i])) hashMap.put(A[i], 1); else { if(hashMap.get(A[i]) == 2) hashMap.remove(A[i]); else { hashMap.put(A[i], hashMap.get(A[i])+1); } }...
1b4ca550-9662-40bd-99a6-0aa2ef4b3409
3
private static String join(final String[] args, final String delim) { if (args == null || args.length == 0) return ""; final StringBuilder sb = new StringBuilder(); for (final String s : args) sb.append(s + delim); sb.delete(sb.length() - delim.length(), sb.length()); return sb....
c768c3c4-f708-44c5-bb2c-206acd15d552
4
private String[] getClassPath() { java.util.Vector x = new java.util.Vector(); String classPath = System.getProperty("java.class.path"); String s = ""; for (int i = 0; i < classPath.length(); i++) { if (classPath.charAt(i) == ';') { x.add(s); s = ""; } e...
feaf10ed-1a60-4d2c-88ca-3d33e16ade6b
3
public void pickUpAction(int index) throws InvalidActionException { if (grid.getItemsOnPosition(grid.getElementPosition(getActivePlayer())).isEmpty()) throw new IllegalArgumentException("There is no item to be picked up on the current position!"); if (grid.getItemsOnPosition(grid.getElementPosition(getActivePlay...
834880e0-fdef-42f2-95d8-5d7b75a55f89
4
public void get_file() throws IOException { // Source //File f = new File("D://Alibaba//test.csv"); File f = new File("D://Alibaba//t_alibaba_data.csv"); InputStream is = new FileInputStream(f); try { BufferedReader reader = new BufferedReader( new InputStreamReader(is)); String lineString = reade...
5171951a-9d3d-44ba-9ecd-1b9204488d7e
9
@Override public void addJob(State s, Job j) { VM vm = null; VMType type = null; JobType jobType = j.getType(); double utilization = Double.MAX_VALUE; // Find for (Entry<VMType, UtilizationVector> e : jobType.utilizationVector.entrySet()) { UtilizationVector v = e.getValue(); double u = v.CPU.avera...
86d3095b-9218-412d-b920-df896b3aea1a
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...
54bb358b-1b73-46a8-87b1-42dad2f8e47f
9
public void visitFieldInsn( final int opcode, final String owner, final String name, final String desc){ mv.visitFieldInsn(opcode, owner, name, desc); if(constructor) { char c = desc.charAt(0); boolean longOrDouble = c == 'J' || c == 'D'; switch(opcode) { case GETSTATIC: pushValue(OTHER); ...
730bfe1c-252d-4a46-905c-e5e1776bc686
6
@Override public ILDAPRetrievalService buildService() throws LDAPServiceCreationException { ILDAPRetrievalService service = null; if (this.getLDAPResource().getServerVendor().equals(LDAPServiceProviderType.APACHEDS_SERVICE_PROVIDER.name())) { try { service = new org.sharpsw.ldap.services.apacheds.Retrieval...
814bce48-801b-4386-88d3-4403d9be5ed3
5
public static void traversal(TreeNode root, int sum) { if (null == root) return; if (null == root.left && null == root.right && sum == root.val) { stack.add(root.val); List<Integer> items = new ArrayList<Integer>(); for (Integer i : stack) { items.add(i); } res.add(items);...
0cf68a8f-b361-4377-be1b-b29df6a35572
5
public String stOpenBrowserInstance (int dataid,int expVal, String flow){ int actVal=1000; String returnVal=null; hm.clear(); hm=STFunctionLibrary.stMakeData(dataid, "Post"); String url = hm.get("URL"); String newwindowtitle = hm.get("NewWindowTitle"); try { Block : { ...
510a874c-5f5f-4709-9a6d-349f6e8ebfac
0
private void selectAnimalChange( Animal nouvelAnimal ) { animalSelect = nouvelAnimal; positions = animalSelect.getPositions(); positionsAff = animalSelect.getPositions(); nomAnimal = animalSelect.getNom(); afficherDonnees(); }
4059b4df-ff78-4fcb-93a4-93f83d685728
0
public IntTreeBag() { this.root = null; }
b4c3ad99-f8ea-4c96-81d2-f1da2dd00b8b
7
private static String escape(String str) { int len = str.length(); StringWriter writer = new StringWriter((int) (len * 0.1)); for (int i = 0; i < len; i++) { char c = str.charAt(i); switch (c) { case '"': writer.write("&quot;"); ...
74f1ec22-2f29-47ef-9564-d22dd671b584
6
public double Opera(char operando, String verificaPosicao, String [] guardaVariavel, double [] guardaValores, int linhasGuardaVariavel){ double result=0; String aux2=verificaPosicao.substring(verificaPosicao.indexOf("=")+1, verificaPosicao.indexOf(operando));//variavel antes do token + - / * % String aux3=ver...
063d2d35-bb06-41b0-a9e3-0b985e36282f
3
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed Helpers.setMinTransfer(jTextField1.getText()); String assetID = "ALL"; if (assetList != null && assetList.size() > 0 && jComboBox6.getSelectedIndex() > -1) { System.out....
439c55a0-5d25-45e0-b22a-e89fc69ab0b3
9
public static void main(String args[]) { try { //RXgN^IȂƂ͐ɂōsB if (args.length >= 1) { infroot = args[0]; if (args.length >= 2) { clusterMax = Integer.parseInt(args[1]); if (args.length >= 3) { maxIter = Integer.parseInt(args[2]); } } } } catch (Exception e) { System.out...
948e729a-7844-4330-9f54-4983a7feee85
1
public void connect() throws Exception { URLConnection yc = website.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); ...
f879dffe-88a8-4a17-9bc1-7c3657fcf257
1
public void setShortMessageFontstyle(Fontstyle fontstyle) { if (fontstyle == null) { this.shortMessageFontStyle = UIFontInits.SHORTMESSAGE.getStyle(); } else { this.shortMessageFontStyle = fontstyle; } somethingChanged(); }
bc1342a5-baca-4033-890c-1783250045f3
5
public String stFacebookSharingVerification(int dataId,int ExpVal,String flow ) { int actVal=1000; String returnVal=null; hm.clear(); hm=STFunctionLibrary.stMakeData(dataId, "Post"); String url = hm.get("URL"); String newwindowtitle = hm.get("NewWindowTitle"); String sharingtitle = hm.get("Sh...
1b3bfa2f-c720-401c-bd80-a525c39687b3
4
private ApiProfileImpl() throws ProfileExceptions { String defaultPath = new File("").getAbsolutePath().toString() + BitMusicStructure; if(!Files.exists(FileSystems.getDefault().getPath(defaultPath))) { try { Files.createDirectory(FileSystems.getDefault().getPath(defaul...
1eba0964-543d-495e-9030-c64bea248bd3
6
public void getPermissoesRelatorios() { item_relAtendimentoAnalitico.setVisible(permissoes.getRelAtendimentoAnalitico()); item_relAtendimentoSintetico.setVisible(permissoes.getRelAtendimentoSintetico()); item_relClienteByLink.setVisible(permissoes.getRelClientesByLink()); item_relCliente...
385f4d8f-0187-406b-b744-956798240730
1
public Complex log() { double rpart = Math.sqrt(re * re + im * im); double ipart = Math.atan2(im, re); if(ipart > Math.PI) { ipart = ipart - 2.0 * Math.PI; } return new Complex(Math.log(rpart), ipart); }
b2526540-f496-4d68-b080-05fc98829c06
5
public void getMultiPart(Multipart content) { try { int multiPartCount = content.getCount(); for (int i = 0; i < multiPartCount; i++) { BodyPart bodyPart = content.getBodyPart(i); Object o; o = bodyPart.getContent(); if (o instanceof String) { maildata.append(o+"\n"); } else if (o in...
d366b868-0f38-414d-981a-36e57a66bf52
7
private synchronized void sendTo(ClientThread client, ChatMessage message) { //envoyer un message à un destinataire en particulier (pour MPs et connexions) message.setDest(client.username); if (message.getSender().equals("null")) message.setSender("Serveur"); message.setTimeStamp(simpleDate.format(new Date...
d27ba5f6-9110-4146-b9ee-1a6114af72dc
3
int backward(int cur) { _optimumEndIndex = cur; int posMem = _optimum[cur].PosPrev; int backMem = _optimum[cur].BackPrev; do { if (_optimum[cur].Prev1IsChar) { _optimum[posMem].makeAsChar(); _optimum[posMem].PosPrev = posMem - 1; ...
2723c007-91dd-4fac-9a08-e00fcc69e708
1
public void moveVisibleAreaToCoord(double xCoord, double yCoord) { visibleArea.setCoord(xCoord - (visibleArea.getxLength() / 2), yCoord - (visibleArea.getyLength() / 2), visibleArea.getxLength(), visibleArea.getyLength()); searchXCoord = getWidth() / 2; searchYCoord = getHeight() / 2; timer.purge(); timer.ca...
b7735206-e890-4f51-9109-afa1332565e5
7
public VentanaPrincipal(ListaTexto textoOriginal, ListaTexto textoNuevo) { //iniciar Objetos this.miTextoOriginal = textoOriginal; this.miTextoNuevo = textoNuevo; miMaestroControlador = new MaestroControlador(miTextoOriginal, miTextoNuevo); //iniciar propiedades del frame setDefaultCloseOperation(JFrame....
4919345c-b05d-4c1e-a46f-083a49b38553
5
@Override public List<StrasseDTO> findStreetsByStartPoint(Long startPunktId, boolean b) { List<StrasseDTO> ret = new ArrayList<StrasseDTO>(); if(startPunktId ==1){ StrasseDTO s= new StrasseDTO(); s.setStartPunktId(Long.valueOf(1)); s.setEndPunktId(Long.valueOf(2)); s.setDistanz(Long.valueOf...
d5b0585a-8a9e-464b-9d4f-9dc1e450b18f
7
void generateAddrModeClasses() throws IOException { setPrinter(newInterfacePrinter("addr", hashMapImport, null, tr("The <code>$addr</code> class represents an addressing mode for this architecture. An " + "addressing mode fixes the number and type of operands, the syntax, and th...
d37bad32-55cc-42ef-9990-e4d34ffab712
3
@Override public double getTipValue() { double tip = 0.00; // always initialize local variables switch(serviceQuality) { case GOOD: tip = baseTipPerBag * bagCount * (1 + GOOD_RATE); break; case FAIR: tip = baseTipPerBag * bagCo...
ca81d6e6-01a1-48b3-9726-e2428227e4c3
0
public void windowActivated(WindowEvent e) { // TODO Auto-generated method stub }
95eee045-3971-419b-855c-2365948ae0c8
1
public int getWidth() { Window window = device.getFullScreenWindow(); if (window != null) { return window.getWidth(); } else { return 0; } }
23d60a4f-075a-43fb-8822-5387e55e1c7e
4
public int remove(Long objId){ for(Town i: towns){ if(i.getId().equals(objId)){ towns.remove(i); return 0; } } for(Airport i: aports){ if(i.getAirportId().equals(objId)){ aports.remove(i); ...
e4e4f0fa-1a58-4148-b7eb-6d952aec80e8
1
public final void setContext(String context, CLC contextController) { if(contextMap.containsKey(context)) { System.out.println("[CLC] Warning: There is already a context controller associated with the context "+ context); } contextMap.put(context, contextController); }
3d1f4a30-5340-4708-b249-04fbe2a20fb0
0
@Test public void testCancelButtonAfterCalculated() throws Exception { propertyChangeSupport.firePropertyChange(DialogWindowController.CALCULATED, 0, 1); assertEquals(view.getButton().isEnabled(), false); view.close(); assertEquals(view.getButton().isEnabled(), true); }
005cc0cc-fe1c-4da1-9bf1-bc6aa7c25876
1
public void test_getDefault_checkRedundantSeparator() { try { PeriodFormat.getDefault().parsePeriod("2 days and 5 hours "); fail("No exception was caught"); } catch (Exception e) { assertEquals(IllegalArgumentException.class, e.getClass()); } }
35297866-a0ae-4a3a-a3ca-cecbfd4d7978
8
private void writeJSON(Object value) throws JSONException { if (JSONObject.NULL.equals(value)) { write(zipNull, 3); } else if (Boolean.FALSE.equals(value)) { write(zipFalse, 3); } else if (Boolean.TRUE.equals(value)) { write(zipTrue, 3); } else { ...
b81f0198-f57d-4589-9145-ce3484b07dbf
2
private int getPlayerIndexInGame(String username, List<PlayerDescription> players) { int playerGameIndex = -1; for (int i = 0; i < players.size(); i++) { PlayerDescription pd = players.get(i); if(pd.getName().equals(username)) { playerGameIndex = i; break; } } return playerGameIndex; }
1f7590c0-67cf-49ef-b0b6-932e9e033fa4
2
public Rule.Action getMatchedAction(Message message) { for (Rule rule : this.rules) { if (rule.isMatched(message)) { return rule.getAction(); } } return null; }
0ce4a5aa-88a4-40d6-8a28-0e53be41f333
0
@Override public ArrayList<String> getGoToList() { // TODO Auto-generated method stub return null; }
47deb2ee-3d91-438a-bba1-6fd233c0e6c9
5
private void inputBestValue(){ double ansd = 0; String ans = null; ans = (String)JOptionPane.showInputDialog(this, "Best Value", "Other", JOptionPane.PLAIN_MESSAGE, null, null, String.valueOf(obj_sel.minC + (obj_sel.maxC - obj_sel.minC)/2)); //suggest the median value tr...
6bb22a8f-fa60-4f7c-9569-8d8379019fb6
3
public AbstractMatrix(int m, int n) { if (n <= 0 || m <= 0) { try { throw new Exception( "The matrix has to have a size of at least 1 x 1."); } catch (Exception e) { e.printStackTrace(); } } this.m = m; this.n = n; }
eec9885b-063f-4b4f-ab9c-d8d984424522
2
public DataModel<PacienteBean> listaPacientes() { PacienteDAO paciente = new PacienteDAO(); if (paciente.getPacientes() != null) { pacientesBean.removeAll(pacientesBean); for (PacienteDAO p : paciente.getPacientes()) { pacientesBean.add(new PacienteBean(p.getId(),...
57239bba-3bf4-46c5-ae2f-f3558a5dd577
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ProcedureCallNode other = (ProcedureCallNode) obj; if (actualParameters == null) { ...
f4633549-2368-47a0-b545-126f3629093c
1
private String getText() throws ParsingException { Characters c = lastEvent.asCharacters(); // Ignore empty content if (!c.isWhiteSpace()) { return c.toString(); } else { return ""; } }
43ef872f-5cf3-4281-ac8e-0b29bbdd1d31
5
public AlarmCreater(MainFrame parent){ this.parent = parent; try { aal = new Alarm_AccessLink(); } catch (IOException ex) { JOptionPane.showMessageDialog(parent, "An sql error has occured: " + ex.getMessage()); } initComponents(); txtTime.setValue(...
48a50308-81a5-452b-903a-f6d2fe3352a3
4
@Override public void handle(HttpExchange he) throws IOException { String method = he.getRequestMethod().toUpperCase(); response = ""; status = 0; switch (method) { case "GET": getRequest(he); break; case "POST": ...
76349e53-516c-45c9-9a9a-29fda02d947d
2
public void mousePressed(MouseEvent e) { if((e.isControlDown())&&(e.getButton()==BUTTON1)) { markerRect=new MarkerRect(MapGetter.getLatitude(e.getY()),MapGetter.getLongtitude(e.getX())); //MainView.createPoint(MapGetter.getLongtitude(e.getX()), MapGetter.getLatitude(e...
1f73b79f-4645-4084-9d27-db502e7bef9e
3
@Test public void testAwaitAsyncExecutionSuccess() { SyncProcess proc = TestUtil.executionSuccessSyncProcess(); IProcessComponent<Void> busyComp = new BusyComponent(TestUtil.executionSuccessComponent(true)); IProcessComponent<?> asyncComp = new AsyncComponent<Void>(busyComp); proc.add(asyncComp); try ...
26c4a264-8453-4365-a1a4-6df7be218339
8
private void registerButtonActionPerformed() { ArrayList<ScheduleDTO> schedule = saleTrainsTableModel.getTrains(); request.setService(Constants.ClientService.buyTicket); int row = saleTrainsTable.getSelectedRow(); if (row == -1) { JOptionPane.showMessageDialog(null, "Не вы...
688121f2-0860-4695-8da3-ddc9ea6bf061
6
public static JSONArray freeGPIOs() { JSONArray freeList = new JSONArray(); DTO dtoCreator = new DTO(); String pinmuxFile = "/sys/kernel/debug/pinctrl/"+baseOffset+".pinmux/pinmux-pins"; try { BufferedReader pinmux = new BufferedReader(new FileReader(pinmuxFile)); // get rid of the first two lines S...
1a2908e5-7358-4353-ac37-728c15249545
8
public static Image load(File imageFile) { Image input = new Image(Display.getCurrent(), imageFile.getAbsolutePath()); // go check if we have to rotate it Image result = null; try { Metadata metaData = ImageMetadataReader.readMetadata(imageFile); if (metaData.containsDirectory(ExifIFD0Directory.class...
215f97e2-90c5-4ddc-bc9b-d2e7ee47f3a4
8
public void decode( ByteBuffer socketBuffer ) { if( !socketBuffer.hasRemaining() || flushandclosestate ) return; if( DEBUG ) System.out.println( "process(" + socketBuffer.remaining() + "): {" + ( socketBuffer.remaining() > 1000 ? "too big to display" : new String( socketBuffer.array(), socketBuffer.position(...
5ee2cd47-2448-4581-9a35-9615ba51017a
6
public void actionPerformed(ActionEvent e){ if(e.getSource() == connectbutton){ try { connect(); indicator.setText("Connecting..."); indicator.setForeground(Color.blue); } catch (IOException e1) { } }else if(e.getSource() == sendbutton){ //Show Status indicator.setText("Encrypting"); ...
ff68d14d-5ffc-4ccf-9d91-99640a43a854
1
public void testGoodAnswerGameToBeLost() { System.out.println("Test 2 : gameToBeLost"); Game gameToBeLost = new Game(new GameMaster( DefaultValues.DEFAULTATTEMPTCOMBINATION1), new Board()); Answer answer; // 1. Wrong combinations input. number : Board.SIZE. for (int i = 0; i < Board.SIZE -...
a64b46aa-baf5-4112-aa5b-f74d11382877
4
public String get_username(int id) { if(users == null) return ""; List listusers = users.getChildren(); if (listusers != null){ Iterator i = listusers.iterator(); while(i.hasNext()){ Element current = (Element)i.next(); int currid = Integer.parseInt(current.getAttributeValue("id")...
f1470331-9b08-413b-af4d-3abbeefaefa0
1
ArrayList<Schedule> fitnessCalc(ArrayList<Schedule> schedule){ ArrayList<Schedule> scheduleFit = new ArrayList<>(); Schedule chromoSchedule; //for(int i=0; i) for(int a=0; a<schedule.size(); a++){ chromoSchedule = schedule.get(a); RoomScheme roomA = chromoSc...
dbe33856-84ad-4bf3-addf-84ce5bba5817
5
public static void removeFromTable(int index) throws NullPointerException { if (tableData!=null){ int datalength = tableData.length -1; Object[][] temp = new Object[datalength][5]; total -= (Integer) (tableData[index][2]) * (Integer) (tableData[index][3]); Item tempitem=new Item(); tempitem.setId((Integ...
a0cc624c-1539-4253-babe-7e4a6527b484
4
private void loginButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loginButtonActionPerformed try { String username = usernameTextField.getText(); String password = passwordTextField.getText(); if (password.equals("") || username.equals("")) { ...
114edd81-568a-41bf-8c04-5108c7750e8e
2
private int binaryToDecimal(String binaryNumber){ int len = binaryNumber.length(),sum =0,c=0; int e = 0; int multiplier = 0; for(int start=0; start<binaryNumber.length(); start++) { len--; e= (int) Math.pow(2,len); if(binaryNumber.charAt(start)...
399e35b9-c76d-475a-8df8-3e4a9ac57292
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...
0fb17bb6-dede-45d1-9142-82c36938f323
1
public void notifyPropertyChangeListeners(int oldMoney, int newMoney) { PropertyChangeEvent event = new PropertyChangeEvent(this, "money", oldMoney, newMoney); for(PropertyChangeListener listener:listeners) { listener.propertyChange(event); } }
4f7a22de-7c8b-40b5-b79d-fb3b0c81632c
1
@Override public void run() { try { sendBlockMangerData(); } catch (Exception e) { EIError.debugMsg("Error Sending Block Manager Data..." + e.getMessage()); } }
66af7436-714e-476e-a02f-775472ea0541
4
@Override public String toString() { String typ = "Illegal"; switch (type) { case TYPE_HELLO: typ = "Hello"; break; case TYPE_KNOCK: typ = "Knock"; break; case TYPE_BUSY: typ = "Busy"; break; case TYPE_BYE: typ = "Bye"; break; } return "Hello(" + typ + ", " + version + ")"; }
f37c805a-0cf3-4375-be99-ef7dc11d9c22
0
public DeviceInfoType createDeviceInfoType() { return new DeviceInfoType(); }
ed175a80-da8c-42c9-8877-2af6c738ee65
9
private static void doAddTest() { System.out.print("Testing add command "); try { File testFolder = new File( TEST_FOLDER ); // remove mvds File[] mvds = testFolder.listFiles(); for ( int i=0;i<mvds.length;i++ ) { if ( mvds[i].isFile() && mvds[i].getName().endsWith(".mvd") ) mvds[i].delet...
5b7d1673-10e1-4844-8e17-f98a58106497
4
public String[] generateTextFromPicture( BufferedImage im, int aCols ) { Raster data = im.getData(); StringBuffer ret = new StringBuffer(""); double xresolution = im.getWidth() / (double)aCols; double yresolution = xresolution * sHeightToWidthRatio; int lRows = (int) (im.getHeight() / yresolution );...
77a3ed12-5b30-4099-9c2b-ad0fd1aac189
6
@SuppressWarnings("unchecked") static boolean setThreadedLocal(String classname, String field, Object value) { if (Functions.isEmpty(classname)) return false; if (Functions.isEmpty(field)) return false; try { Class<?> c = Class.forName(cn(classname)); if (c == null) return false; if (c.isEnum()) return ...
ed4f66a5-de63-42d2-a453-6983c498c0fb
3
public List<OrderSubstatus> possibleCancellationReasons(OrderStatus for_status) { List<OrderSubstatus> ret = new ArrayList<>(); switch(for_status) { case PROCESSING: ret = Arrays.asList(USER_UNREACHABLE, USER_CHANGED_MIND, USER_REFUSED_DELIVERY, USER_REFUSED_PRODUCT, SHOP_FAILED, REPLACING_ORDER); bre...
93d683e9-22ae-4d7a-a82e-84f807f4b1f4
4
public static void updateUpdater() { File root=new File(Main.path); root.mkdir(); double version=0.0; //Get current updater jar version from web try { URL url=new URL("http://"+Main.ip+"/d0941e68da8f38151ff86a61fc59f7c5cf9fcaa2/computer/updaterVersion.html"); ...
98756d24-9c7a-4eaa-b6fc-ea3d3d196467
5
private void do_cross_validation() { int i; int total_correct = 0; double total_error = 0; double sumv = 0, sumy = 0, sumvv = 0, sumyy = 0, sumvy = 0; double[] target = new double[prob.l]; svm.svm_cross_validation(prob,param,nr_fold,target); if(param.svm_type == svm_parameter.EPSILON_SVR || param.s...
bca7721a-72f4-4ff9-8f8d-1f031b75f5ae
9
@Override public void run() { while (enabled) { if (logQueue.size() != 0) { StringBuilder stringBuilder = new StringBuilder(); while (logQueue.size() != 0) { stringBuilder.append(logQueue.poll()); ...
2119cbb0-a5bd-4c37-a737-beed8734b277
1
public DataFinder Where(String field, Object value) throws NoSuchFieldException, SecurityException { Field searchField = searchClass.getField(field); Index annotation = searchField.getAnnotation(Index.class); if (annotation == null) throw new IllegalArgumentException(field); conditions.put(annotation.Ind...
9e5c4e89-7d07-4e42-ac3a-fa9f52ab0b91
4
public void update() { if (!arrived) { if (Point2D.distance(currentTileX, currentTileY, endTile.getX(), endTile.getY()) < velocity) { currentTileX = endTile.getX(); currentTileY = endTile.getY(); arrived = true; dealDamage(); ...
27efd38b-02cc-4b53-aa7b-e9e56ccda9a9
9
private void shiftPaletteBackward() { if(color_cycling_location > 0) { color_cycling_location--; if(color_choice == palette.length - 1) { temp_color_cycling_location = color_cycling_location; } } else { return; } ...
e5b6af3f-3613-4835-b087-227087a54e65
7
private Object resume(Context cx, Scriptable scope, int operation, Object value) { if (savedState == null) { if (operation == GENERATOR_CLOSE) return Undefined.instance; Object thrown; if (operation == GENERATOR_THROW) { ...
8eb0c97f-72a6-4c52-9129-7fdf04382cda
3
private void programmerSaveButton(java.awt.event.ActionEvent evt) { JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Please Enter File Name and Choose Location"); List<String> userInput = Arrays.asList(programmerText.getText().split("\n")); PrintWriter out =...