method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
721e0872-017b-40d6-bd91-6377f38dde4c
2
public Menu_seleccion(ArrayList<Guerrero> array,int desp,Juego juego) { initComponents(); ImageIcon iconLogo = new ImageIcon(IMG.getImage("menu_soldados.png")); jLabel1.setIcon(iconLogo); ImageIcon iconLogo2 = new ImageIcon(IMG.getImage("Label_nombre.png")); int x=60; int y=80; JLabel dinero=new JLabel(); ImageIcon iconLogo1 = new ImageIcon(IMG.getImage("Label_dinero.png")); dinero.setIcon(iconLogo1); dinero.setOpaque(false); jLabel1.add(dinero); dinero.setLocation(600, 10); dinero.setSize(200,52); dinero.setFont(new Font("Arial Black",0, 15)); dinero.setText(juego.getOro()); dinero.setForeground(Color.WHITE); dinero.setIconTextGap(-100); dinero.setVisible(true); for(int i=0;i<array.size();i++){ if(juego.nivel_aparicion(i, array)){ lab=new JLabel(iconLogo2); lab.setOpaque(false); jLabel1.add(lab); lab.setLocation(x, y); lab.setSize(200,52); lab.setVisible(true); lab.setIconTextGap(-140); lab.setText(((Guerrero) array.get(i)).getNombre()); lab.setFont(new Font("Arial Black",0, 15)); lab.setForeground(Color.WHITE); System.out.println(((Guerrero) array.get(i)).getMainImg()); ImageIcon iconLogo3 = new ImageIcon(IMG.getImage(((Guerrero) array.get(i)).getMainImg())); lab=new JLabel(iconLogo3); lab.setOpaque(false); jLabel1.add(lab); lab.setLocation(x+295, y); lab.setSize(28,28); lab.setVisible(true); ImageIcon iconLogo4 = new ImageIcon(IMG.getImage(((Guerrero) array.get(i)).getImagen_mov())); lab=new JLabel(iconLogo4); lab.setOpaque(false); jLabel1.add(lab); lab.setLocation(x+250, y); lab.setSize(28,28); lab.setVisible(true); lab=new JLabel(((Guerrero) array.get(i)).getCosto()+" $"); jLabel1.add(lab); lab.setLocation(x+350, y); lab.setVisible(true); lab.setFont(new Font("Arial Black",0, 15)); lab.setForeground(Color.WHITE); lab.setSize(50, 50); bot=new menu_seleccion_boton(x, y, i+desp,jLabel1, juego,dinero,i,array); y+=90; } menubutton1 bot2=new menubutton1(jLabel1,600, 545,this,juego); } }
fcae4b1b-9ed3-41b9-9bc7-5550612a5a6f
0
public static void main(String[] args) { final int A = 1234; final int B = 9876; System.out.println("A = " + Integer.toBinaryString(A)); System.out.println("B = " + Integer.toBinaryString(B)); System.out.println("A & B = " + Integer.toBinaryString(A & B)); System.out.println("A | B = " + Integer.toBinaryString(A | B)); System.out.println("A ^ B = " + Integer.toBinaryString(A ^ B)); System.out.println("A >> 4 = " + Integer.toBinaryString(A >> 4)); System.out.println("A << 4 = " + Integer.toBinaryString(A << 4)); System.out.println("~A = " + Integer.toBinaryString(~A)); System.out.println("-A = " + Integer.toBinaryString(-A)); System.out.println("-A >> 4 = " + Integer.toBinaryString(-A >> 4)); System.out.println("-A >>> 4 = " + Integer.toBinaryString(-A >>> 4)); }
681dce28-56ff-4526-91f0-c564554a2a47
1
@Override public String toString() { StringBuilder builder = new StringBuilder(); try { XIO.write( this, builder ); } catch( IOException e ) { throw new XException( e ); } return builder.toString(); }
f58061ae-449c-4c27-bf9b-e45cc5104612
0
public Board(City_Graph city_graph){ this.city_graph = city_graph; // set Variables boardOffset = 200; citySquareSize = 40; neutralColor = new Color(190,190,190); romColor = new Color(210, 20, 20); cathargoColor = new Color(20, 20, 210); // init jframe jframe = new JFrame("test"); jframe.setSize(city_graph.getBiggestX() + boardOffset, city_graph.getBiggestY() + boardOffset); jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); buttonMap = new HashMap<Integer, JButton>(); setLayout(null); setSize(jframe.getWidth(), jframe.getHeight()); jframe.add(this); jframe.setVisible(true); repaint(); }
4ab23c04-6105-472a-8788-07fefc5fa185
1
public Builder id(int receivedId) { if (receivedId < 0) { log.warn("Wrong ID. receivedId ={}", id); throw new IllegalArgumentException("Id must be integer value more than 0. Received value =" + receivedId); } this.id = receivedId; return this; }
1834a8ff-4e37-48e6-b05d-96aadd71c53d
7
public boolean containsFieldAliasDirectly(String fieldName, String typeSig, IdentifierMatcher matcher) { for (Iterator i = fieldIdents.iterator(); i.hasNext();) { Identifier ident = (Identifier) i.next(); if (((Main.stripping & Main.STRIP_UNREACH) == 0 || ident .isReachable()) && ident.wasAliased() && ident.getAlias().equals(fieldName) && ident.getType().startsWith(typeSig) && matcher.matches(ident)) return true; } return false; }
43c72e60-156c-408c-81b1-f91d16845cdb
4
public void mouseClicked(MouseEvent e) { if( e.getX() >= 5 && e.getX() <= 45 && e.getY() >= 5 && e.getY() <= 45){ this.mainFrame.backToMenu(); } }
9ab6a5f2-2ccd-4fe1-8ece-2cc90aa1dccc
1
public static int abs(int num, int n) { /** * This method had to simple cases, either the number was negative or positive. I created a mask of the correct bit * length to test if the number was negative. If it was positive I would just return the number given. If it was negative * I did a simple negation, and then addition to convert the correct part into a positive number, and then shifted the bits * to get rid of leading bits that were converted. */ int mask = 0x1; mask = mask << n-1; if((mask & num) != 0x0){ num = ~num; num ++; num = num << (32 - n); num = num >> (32 - n); } return num; }
59d920d0-fb0d-4e55-90cb-270bb05135c6
4
public void getVal() { try { //System.err.println("DBThread Runs"); Class.forName("com.mysql.jdbc.Driver"); connect = DriverManager.getConnection("jdbc:mysql://localhost/cdr_data?user=root&password=root"); preparedStatement = connect.prepareStatement("select ID_CDR_Syslog, DisconnectCause from cdr_inbound"); ResultSet rs = preparedStatement.executeQuery(); while (rs.next()) { ID = rs.getInt("ID_CDR_Syslog"); DestCause = rs.getString("DisconnectCause"); if (!"null".equals(DestCause) && ID > 2503) { String st = String.valueOf(Integer.parseInt(DestCause, 16)); //System.err.println(ID + " : " + DestCause + " ----- > " + st); insertConverted(ID, st); } else { System.err.println("null"); } i = ID; } } catch (SQLException | ClassNotFoundException e) { Logger.getLogger(ConvertDestCauseToInt.class.getName()).log(Level.SEVERE, String.valueOf(i), e); } }
812b696d-2a03-4f10-acf7-c9218cb7195d
5
public boolean compare(String file1, String file2, String type) { // Check if both the files are present if(!CompareFiles.checkIfFileExists(file1) || !CompareFiles.checkIfFileExists(file2)) { if(!CompareFiles.checkIfFileExists(file1)) System.out.println(file1+" does not exist"); if(!CompareFiles.checkIfFileExists(file2)) System.out.println(file2+" does not exist"); return false; } // If no type is specified, do txt comparison by default. if(type.equalsIgnoreCase("xml")) { // todo System.out.println("Utility does not support xml comparison"); return false; } else { return CompareFiles.compareTxtFiles(file1, file2); } }
b58acac4-040f-4266-821f-691cf51876ae
0
public MyByteArrayInputStream(byte[] b) { this.data = b; }
901d22ab-b8c4-4f8b-93d6-8a1c574c323e
9
private void btn_aceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_aceptarActionPerformed if (lab_modo.getText().equals("Alta")){ if (camposCompletos()){ ocultar_Msj(); insertar(); menuDisponible(true); modoConsulta(); updateTabla(); } else{ mostrar_Msj_Error("Por favor, complete todos los campos solicitados"); } } else{ if (lab_modo.getText().equals("Baja")){ if (!field_codigo.getText().equals("")){ if(!existe(Integer.parseInt(field_codigo.getText()))){ mostrar_Msj_Error("Ingrese un codigo que se encuentre registrado en el sistema"); field_codigo.requestFocus(); } else{ ocultar_Msj(); eliminar(); menuDisponible(true); modoConsulta(); vaciarCampos(); updateTabla(); } } else{ mostrar_Msj_Error("Por favor, complete todos los campos solicitados"); } } else{ if (lab_modo.getText().equals("Modificación")){ if (!field_codigo.getText().equals("")){ if(!existe(Integer.parseInt(field_codigo.getText()))){ mostrar_Msj_Error("Ingrese un codigo que se encuentre registrado en el sistema"); field_codigo.requestFocus(); } else{ if (camposCompletos()){ ocultar_Msj(); modificar(); menuDisponible(true); modoConsulta(); updateTabla(); } else{ mostrar_Msj_Error("Por favor, complete todos los campos solicitados"); } } } else{ mostrar_Msj_Error("Por favor, complete todos los campos solicitados"); } } } } }//GEN-LAST:event_btn_aceptarActionPerformed
ef1c9e6b-63b7-427a-8db2-ce1c01311c16
0
@Column(name = "PRP_MOA_CONSEC") @Id public int getPrpMoaConsec() { return prpMoaConsec; }
8cc72ee0-b155-46bb-8cfa-7877ab61cae8
5
public boolean matches(Dependency dependency) { return groupRule.match(dependency.getGroupId()) && artifactRule.match(dependency.getArtifactId()) && typeRule.match(dependency.getType()) && versionRule.match(dependency.getVersion()) && scopeRule.match(dependency.getScope()) && classifierRule.match(dependency.getClassifier()); }
41d5e6be-ccc7-4674-a34e-743965082da5
9
static private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); } else { jj_lastpos = jj_scanpos = jj_scanpos.next; } } else { jj_scanpos = jj_scanpos.next; } if (jj_rescan) { int i = 0; Token tok = token; while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } if (tok != null) jj_add_error_token(kind, i); } if (jj_scanpos.kind != kind) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; return false; }
709a81b0-cd8f-4552-9ece-399821f67163
3
@Override public void deserialize(Buffer buf) { super.deserialize(buf); days = buf.readShort(); if (days < 0) throw new RuntimeException("Forbidden value on days = " + days + ", it doesn't respect the following condition : days < 0"); hours = buf.readShort(); if (hours < 0) throw new RuntimeException("Forbidden value on hours = " + hours + ", it doesn't respect the following condition : hours < 0"); minutes = buf.readShort(); if (minutes < 0) throw new RuntimeException("Forbidden value on minutes = " + minutes + ", it doesn't respect the following condition : minutes < 0"); }
59196c88-c950-460a-b259-ae3f21ea9d44
6
private JPanel constructBreakpointPanel() { JPanel mainPanel = new JPanel(); mainPanel.setBorder(new TitledBorder("Breakpoints")); mainPanel.setLayout(new GridLayout(1,2)); try { JPanel panel = new JPanel(); mainPanel.add(panel); panel.setBorder(new TitledBorder("Program Counter")); GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); panel.setLayout(gbl); GUIUtilities.initializeGBC(gbc); gbc.anchor = GridBagConstraints.NORTHWEST; final DefaultListModel listModel = new DefaultListModel(); final JList bpList = new JList(listModel); bpList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); bpList.setVisibleRowCount(4); JScrollPane scrPane = new JScrollPane(bpList); scrPane.setPreferredSize(new Dimension(80, 40)); final MaskFormatter formatter = new MaskFormatter("0xHHHH"); formatter.setPlaceholder("0x8000"); final JFormattedTextField hexField = new JFormattedTextField(formatter); hexField.setBorder(new BevelBorder(BevelBorder.LOWERED)); { String title = "Add"; String tooltip = "Add CPU Breakpoint"; ActionListener actListener = new ActionListener() { public void actionPerformed(ActionEvent e) { String hexVal = hexField.getText(); Integer intVal = Integer.decode(hexVal); _debugger.addCPUBreakpoint(intVal.intValue()); if (!listModel.contains(hexVal)) { listModel.addElement(hexVal); } } }; JButton button = new JButton(title); button.setToolTipText(tooltip); button.addActionListener(actListener); gbc.weightx = 0; gbc.weighty = 0; gbc.gridx = 1; gbc.gridy = 2; gbl.setConstraints(button, gbc); panel.add(button); } { String title = "Remove"; String tooltip = "Remove CPU Breakpoint"; ActionListener actListener = new ActionListener() { public void actionPerformed(ActionEvent e) { String hexVal = hexField.getText(); Integer intVal = Integer.decode(hexVal); _debugger.removeCPUBreakpoint(intVal.intValue()); if (listModel.contains(hexVal)) { listModel.removeElement(hexVal); } } }; JButton button = new JButton(title); button.setToolTipText(tooltip); button.addActionListener(actListener); gbc.weightx = 0; gbc.weighty = 0; gbc.gridx = 0; gbc.gridy = 2; gbl.setConstraints(button, gbc); panel.add(button); } gbc.weightx = 0; gbc.weighty = 0; gbc.gridx = 1; gbc.gridy = 0; JLabel label = new JLabel("Address:"); gbl.setConstraints(label, gbc); panel.add(label); gbc.weightx = 0; gbc.weighty = 0; gbc.gridx = 1; gbc.gridy = 1; gbl.setConstraints(hexField, gbc); panel.add(hexField); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 2; gbc.fill = GridBagConstraints.BOTH; gbl.setConstraints(scrPane, gbc); panel.add(scrPane); } catch (Exception e) { e.printStackTrace(); } // Opcode breakpoints try { JPanel panel = new JPanel(); mainPanel.add(panel); panel.setBorder(new TitledBorder("Opcode")); GridBagLayout gbl = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); panel.setLayout(gbl); GUIUtilities.initializeGBC(gbc); gbc.anchor = GridBagConstraints.NORTHWEST; final DefaultListModel listModel = new DefaultListModel(); final JList bpList = new JList(listModel); bpList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); bpList.setVisibleRowCount(4); JScrollPane scrPane = new JScrollPane(bpList); scrPane.setPreferredSize(new Dimension(80, 40)); final MaskFormatter formatter = new MaskFormatter("0xHH"); formatter.setPlaceholder("0x00"); final JFormattedTextField hexField = new JFormattedTextField(formatter); hexField.setBorder(new BevelBorder(BevelBorder.LOWERED)); { String title = "Add"; String tooltip = "Add Opcode Breakpoint"; ActionListener actListener = new ActionListener() { public void actionPerformed(ActionEvent e) { String hexVal = hexField.getText(); Integer intVal = Integer.decode(hexVal); _debugger.addOpcodeBreakpoint(intVal.byteValue()); if (!listModel.contains(hexVal)) { listModel.addElement(hexVal); } } }; JButton button = new JButton(title); button.setToolTipText(tooltip); button.addActionListener(actListener); gbc.weightx = 0; gbc.weighty = 0; gbc.gridx = 1; gbc.gridy = 2; gbl.setConstraints(button, gbc); panel.add(button); } { String title = "Remove"; String tooltip = "Remove Opcode Breakpoint"; ActionListener actListener = new ActionListener() { public void actionPerformed(ActionEvent e) { String hexVal = hexField.getText(); Integer intVal = Integer.decode(hexVal); _debugger.removeOpcodeBreakpoint(intVal.byteValue()); if (listModel.contains(hexVal)) { listModel.removeElement(hexVal); } } }; JButton button = new JButton(title); button.setToolTipText(tooltip); button.addActionListener(actListener); gbc.weightx = 0; gbc.weighty = 0; gbc.gridx = 0; gbc.gridy = 2; gbl.setConstraints(button, gbc); panel.add(button); } gbc.weightx = 0; gbc.weighty = 0; gbc.gridx = 1; gbc.gridy = 0; JLabel label = new JLabel("Opcode:"); gbl.setConstraints(label, gbc); panel.add(label); gbc.weightx = 0; gbc.weighty = 0; gbc.gridx = 1; gbc.gridy = 1; gbl.setConstraints(hexField, gbc); panel.add(hexField); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 2; gbc.fill = GridBagConstraints.BOTH; gbl.setConstraints(scrPane, gbc); panel.add(scrPane); } catch (Exception e) { e.printStackTrace(); } return mainPanel; }
f409742d-d0eb-40a2-ad4d-e465498942f2
0
@Test public void twentyInchesIsBetterThanOneFoot(){ ArithmeticQuantity twenty_inch = new ArithmeticQuantity(20, Distance.INCHES); ArithmeticQuantity one_foot = new ArithmeticQuantity(1, Distance.FEET); assertTrue(twenty_inch.isBetter(one_foot)); assertTrue(!one_foot.isBetter(twenty_inch)); }
b2231a6d-c2d1-41e0-bb29-5344675469fe
4
public void handleClass(String clName) { int i = 0; while (i < clName.length() && clName.charAt(i) == '[') i++; if (i < clName.length() && clName.charAt(i) == 'L') { clName = clName.substring(i + 1, clName.length() - 1); Main.getClassBundle().reachableClass(clName); } }
56bfbf7e-3b52-464b-b9a8-17ad495c4ecb
1
private void insertCast(BinExpr expr, int type1, int type2) throws CompileError { if (CodeGen.rightIsStrong(type1, type2)) expr.setLeft(new CastExpr(type2, 0, expr.oprand1())); else exprType = type1; }
240d9cc3-68ba-459b-b7ae-85509d0d4c63
2
private boolean topRightCorner(int particle, int cubeRoot) { for(int i = 1; i <= cubeRoot; i++){ if(particle == i * cubeRoot * cubeRoot - 1){ return true; } } return false; }
8a69b761-9d66-4643-9bb0-c0dbd71086eb
4
private void init() { try { Boolean append = true; // append messages to the log file -> default yes path = new Control_GetPath().getStreamRipStarPath() + "/output.log"; //delete here the log file first, if it has a large size File logFile = new File(path); //if its larger then ~0.5MB, overwrite it if(logFile.length() > 500000) { append = false; } writer = new BufferedWriter(new FileWriter(path,append)); log("StreamRipStar in version "+StreamRipStar.releaseVersion+ " and revision "+ StreamRipStar.releaseRevision + " has been started"); //print out the old messages log("\n\n=== now the old messages from start ====\n\n"); for(int i=0; i < tmpMessages.capacity(); i++) { log(tmpMessages.get(i)); } log("\n\n=== old messages done! ====\n\n"); //now delete all old messages for the next time tmpMessages.removeAllElements(); tmpMessages.setSize(0); tmpMessages.trimToSize(); //say we have init done successful hasInitDone = true; } catch (IOException e) { System.err.println("Error in SRSOutput: Can't open the file for StreamRipStar"); e.printStackTrace(); } catch (Exception e) { System.err.println("Error in SRSOutput: Unkown error"); e.printStackTrace(); } }
225e332e-e8b3-4505-a81f-54b24567f1dc
2
public OperatoerDTO getOperatoer(int oprId) throws DALException { ResultSet rs = Connector.doQuery("SELECT * FROM operatoer WHERE opr_id = " + oprId); try { if (!rs.first()) throw new DALException("Operatoeren " + oprId + " findes ikke"); return new OperatoerDTO (rs.getInt(1), rs.getString(2), rs.getString(3), rs.getString(4), rs.getString(5)); } catch (SQLException e) {throw new DALException(e); } }
9827e30d-b29f-42e6-82e0-eeac0d51163a
4
public static Reference getReference(String className, String name, String type) { int hash = className.hashCode() ^ name.hashCode() ^ type.hashCode(); Iterator iter = unifier.iterateHashCode(hash); while (iter.hasNext()) { Reference ref = (Reference) iter.next(); if (ref.clazz.equals(className) && ref.name.equals(name) && ref.type.equals(type)) return ref; } Reference ref = new Reference(className, name, type); unifier.put(hash, ref); return ref; }
34f37627-0293-4cad-9bf0-67b5d52d2937
6
@Override public int compareTo(final ArraySection<GArray> section) { final GArray array1 = this.array(), array2 = section.array(); int startIndex1 = this.startIndex(); int startIndex2 = section.startIndex(); final int finalIndex1 = this.finalIndex(); final int finalIndex2 = section.finalIndex(); final int size1 = this.finalIndex() - startIndex1; final int size2 = section.finalIndex() - startIndex2; if (size1 < size2) { for (final int delta = startIndex2 - startIndex1; startIndex1 < finalIndex1; startIndex1++) { final int comp = this._compareTo_(array1, array2, startIndex1, startIndex1 + delta); if (comp != 0) return comp; } return -1; } else { for (final int delta = startIndex1 - startIndex2; startIndex2 < finalIndex2; startIndex2++) { final int comp = this._compareTo_(array1, array2, startIndex2 + delta, startIndex2); if (comp != 0) return comp; } if (size1 == size2) return 0; return 1; } }
4f6130ed-024d-4aad-9e0e-cd6a4648d67b
6
public void doMotion() { if( (xSpeed < 0.05) && (xSpeed > -0.05) ) { xSpeed = 0; }; if( (ySpeed < 0.05) && (ySpeed > -0.05) ) { ySpeed = 0; }; if( (zSpeed < 0.05) && (zSpeed > -0.05) ) { zSpeed = 0; }; x += xSpeed; y += ySpeed; z += zSpeed; zoom += zoomSpeed; }
2fecdf36-9733-49be-a0fd-06a2a15adbf1
3
public void updateTripList () { if (tripListModel == null) return; tripListModel.removeAllElements(); for (Trip t : MainWindow.tripDB.getAllTrips (targetDay.getTime())) tripListModel.addElement (new TripComponent (t)); tfRoster.setText(MainWindow.tripDB.getRosterCount(targetDay.getTime()) + "/" + availableRosters); updateParticipantsPanel (); panelPreview.updateTripList (); if (tripList.getSelectedIndex() <0) tripList.setSelectedIndex(0); }
eb431b8b-5fff-4d5d-a80b-b78caf31a756
2
private static Set<String> permutate(Set<String> digits){ if (digits.size()==1) return digits; Set<String> set = new HashSet<String>(); Set<String> newDigits = new HashSet<String>(); newDigits.addAll(digits); for(String n : digits){ newDigits.remove(n); // System.out.println(newDigits.size()); addAll(set, permutate(newDigits), n); newDigits.add(n); // System.out.println("level "+newDigits.size()+" size "+set.size()); } return set; }
5843af6b-d2cc-45e4-b441-b3bc3ee84556
0
public void setRegip(String regip) { this.regip = regip; }
2a96fdc5-5486-4ca1-822e-ea16fafd935e
3
public Music() { Debug.println("Music.Music()"); paused = false; AudioInputStream as = null; URL MUSIC = getClass().getClassLoader().getResource("Sounds/music.wav"); try { as = AudioSystem.getAudioInputStream(MUSIC); } catch (UnsupportedAudioFileException e) { e.printStackTrace(); return; } catch (IOException e) { e.printStackTrace(); return; } try { music = (Clip) AudioSystem.getClip(); music.open(as); } catch (Exception e) { } }
b42eadc6-9678-4822-8be3-164af89501a3
2
public CustomButton(int x, int y, int width, int height) { //Construct the button super(); setBounds(x, y, width, height); //Set all the visibility to false, besides the text this.setBorder(null); setBorderPainted(false); setOpaque(true); setContentAreaFilled(false); this.setFocusPainted(false); //Set hover to false hover=false; //default color backgroundColor=Color.black; hoverBackgroundColor=Color.white; foregroundColor=Color.white; hoverForegroundColor=Color.black; //Apply default color this.setBackground(backgroundColor); this.setForeground(foregroundColor); /***************************************************************** * Add Mouse Listener to play sounds, change hover status, * foreground Color and cursor *****************************************************************/ this.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent evt) { CustomButton.this.setForeground(hoverForegroundColor); //Sets the cursor to hand cursor CustomButton.this.setCursor(new Cursor(12)); //only play if the sound is not null if(hoverSound!=null) { hoverSound.play(); } CustomButton.this.hover=true; } public void mouseExited(MouseEvent evt) { CustomButton.this.setForeground(foregroundColor); CustomButton.this.hover=false; } public void mouseClicked(MouseEvent evt) { //only play if the sound is not null if(clickSound!=null) { clickSound.play(); } } }); /*****************************************************************/ }
62dbfafc-7382-4f65-8caf-000747285217
5
public void initFilter(boolean g) { sun = new DirectionalLight(); sun.setDirection(new Vector3f(1f, -1, 0f).normalizeLocal()); sun.setColor(new ColorRGBA(1f, 0.96f, 0.91f, 1f).mult(0.1f)); if(g) rootNode.addLight(sun); sun1 = new DirectionalLight(); sun1.setDirection(new Vector3f(-1f, -1, 0f).normalizeLocal()); sun1.setColor(new ColorRGBA(1f, 0.96f, 0.91f, 1f).mult(0.05f)); if(g) rootNode.addLight(sun1); sun2 = new DirectionalLight(); sun2.setDirection(new Vector3f(0f, -1, 1f).normalizeLocal()); sun2.setColor(new ColorRGBA(1f, 0.96f, 0.91f, 1f).mult(0.025f)); if(g) rootNode.addLight(sun2); sun3 = new DirectionalLight(); sun3.setDirection(new Vector3f(0.5f, -1, -0.5f).normalizeLocal()); sun3.setColor(new ColorRGBA(1f, 0.96f, 0.91f, 1f).mult(0.1f)); if(!g) rootNode.addLight(sun3); AmbientLight al = new AmbientLight(); al.setColor(ColorRGBA.White.mult(0.9f)); rootNode.addLight(al); fpp = new FilterPostProcessor(assetManager); ssaoFilter = new SSAOFilter(3f, 1f, 0.2f, 0.1f); //fpp.addFilter(ssaoFilter); fog = new FogFilter(); fog.setFogColor(new ColorRGBA(1f, 1f, 1f, 1f)); fog.setFogDistance(400f); fog.setFogDensity(1.0f); if(!g) viewPort.addProcessor(fpp); }
ab90f088-b0ec-4ff1-8872-aa5d9b28d746
3
private void firtsFase() { while (y < start.HEIGHT*80/100) { time = (1000 / start.FPS) - (System.currentTimeMillis() - time); if (time > 0) { try { down(); Thread.sleep(200); } catch (Exception e) { } } } }
9f184770-d47a-44e7-ac71-b2bdc052365a
8
private float readFloat() { switch ( type ) { case MatDataTypes.miUINT8: return (float)( buf.get() & 0xFF); case MatDataTypes.miINT8: return (float) buf.get(); case MatDataTypes.miUINT16: return (float)( buf.getShort() & 0xFFFF); case MatDataTypes.miINT16: return (float) buf.getShort(); case MatDataTypes.miUINT32: return (float)( buf.getInt() & 0xFFFFFFFF); case MatDataTypes.miINT32: return (float) buf.getInt(); case MatDataTypes.miSINGLE: return (float) buf.getFloat(); case MatDataTypes.miDOUBLE: return (float) buf.getDouble(); default: throw new IllegalArgumentException("Unknown data type: " + type); } }
9edd3428-8aea-40b9-beaa-6cf35ccdfb12
6
public boolean dealerHit() { if (this.hand.totalvalues()[0] < 17 && this.hand.totalvalues()[0] == this.hand.totalvalues()[1]) { return true; } else if (this.hand.totalvalues()[0] <= 17 && this.hand.totalvalues()[0] != this.hand.totalvalues()[1]) { return true; } else if (this.hand.totalvalues()[1] < 17 && this.hand.totalvalues()[0] != this.hand.totalvalues()[1]) { return true; } return false; }
f3b501d4-5622-4173-b8a2-67267edc3dac
4
private static void setLookAndFeel() { try { OUTER: for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { //System.out.println(info.getName()); switch (info.getName()) { case "Windows": javax.swing.UIManager.setLookAndFeel(info.getClassName()); break OUTER; case "GTK+": javax.swing.UIManager.setLookAndFeel(info.getClassName()); break OUTER; } } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) { } }
7924906a-b5f7-4e89-8038-d55abd29a7a2
5
public static List<GroupDetailInfo> getGroupsByUser(int userId) throws HibernateException { List<GroupDetailInfo> userGroupsList = null; Session session = HibernateUtil.getSessionFactory().getCurrentSession(); try { // Begin unit of work session.beginTransaction(); String hqlString = "select distinct g from GroupInfo as g" + " left join g.groupUsers as gu" + " where gu.userId=" + userId + " and gu.userStatus>=0"; Query query = session.createQuery(hqlString); @SuppressWarnings("unchecked") List<GroupInfo> list = query.list(); if (list.size() > 0) { userGroupsList = new ArrayList<GroupDetailInfo>(); for (int i = 0; i < list.size(); i++) { GroupInfo groupInfo = list.get(i); GroupDetailInfo groupDetail = new GroupDetailInfo(); groupDetail.setGroupInfo(groupInfo); Set<GroupUserInfo> groupUsers = groupInfo.getGroupUsers(); int ownerId = groupUsers.iterator().next().getUserId(); String hqlString2 = "from UserInfo as u where u.userId=" + ownerId; Query query2 = session.createQuery(hqlString2); @SuppressWarnings("unchecked") List<UserInfo> list2 = query2.list(); if (list2.size() > 0) { groupDetail.setOwnerInfo(list2.get(0)); } else { groupDetail.setOwnerInfo(null); } userGroupsList.add(groupDetail); } } // End unit of work session.getTransaction().commit(); } catch (HibernateException hex) { logger.error(hex.toString()); HibernateUtil.getSessionFactory().getCurrentSession() .getTransaction().rollback(); } catch (Exception ex) { logger.error(ex.toString()); HibernateUtil.getSessionFactory().getCurrentSession() .getTransaction().rollback(); } return userGroupsList; }
f8dec326-075d-4dc9-ad19-1c8826108b23
4
public static void deleteDirectory(Path directory) throws IOException { if (!FileUtil.controlDirectory(directory)) { return; } Files.walkFileTree(directory, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if (file.toFile().canWrite()) { Files.delete(file); } return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { if (exc != null) { Main.handleUnhandableProblem(exc); } if (dir.toFile().canWrite()) { Files.delete(dir); } return FileVisitResult.CONTINUE; } }); }
0f1f4f93-7cb7-40fa-a04a-af7ab3033c3f
2
public void revertAndAppend(char c) { if (c != '0' && c != '1') { throw new IllegalArgumentException("Argument must be '0' or '1'"); } append(revert(c)); }
6b4406de-ce2b-4218-b30f-a0ff91833e11
9
public void refresh() { if(!hasBeenActivated) return; synchronized(mutex) { //If any resize operations are in the queue, execute them resizeScreenIfNeeded(); Map<TerminalPosition, ScreenCharacter> updateMap = new TreeMap<TerminalPosition, ScreenCharacter>(new ScreenPointComparator()); for(int y = 0; y < terminalSize.getRows(); y++) { for(int x = 0; x < terminalSize.getColumns(); x++) { ScreenCharacter c = backbuffer[y][x]; if(!c.equals(visibleScreen[y][x]) || wholeScreenInvalid) { visibleScreen[y][x] = c; //Remember, ScreenCharacter is immutable, we don't need to worry about it being modified updateMap.put(new TerminalPosition(x, y), c); } } } Writer terminalWriter = new Writer(); terminalWriter.reset(); TerminalPosition previousPoint = null; for(TerminalPosition nextUpdate: updateMap.keySet()) { if(previousPoint == null || previousPoint.getRow() != nextUpdate.getRow() || previousPoint.getColumn() + 1 != nextUpdate.getColumn()) { terminalWriter.setCursorPosition(nextUpdate.getColumn(), nextUpdate.getRow()); } terminalWriter.writeCharacter(updateMap.get(nextUpdate)); previousPoint = nextUpdate; } terminalWriter.setCursorPosition(getCursorPosition().getColumn(), getCursorPosition().getRow()); wholeScreenInvalid = false; } terminal.flush(); }
cfad89d9-bbee-4976-854d-b4eb0f6dd469
2
public TestBoGenerator( Table table ) { super( table ); this.daoName = "Test" + table.getDomName() + "Bo"; filePath = "src/test/java/" + packageToPath() + "/bo/" + daoName + ".java"; for ( Column column : table.getColumns() ) { if ( column.isKey() ) { compoundKeys += toJavaCase(table.getDomName()) + ".get" + toTitleCase(column.getFldName()) + "(), "; } } compoundKeys = compoundKeys.substring(0, compoundKeys.length() - 2); }
b097e1e8-ce03-43f8-b96d-e7322315ffa1
0
public CtrlVisiteur(CtrlPrincipal ctrlPrincipal) { super(ctrlPrincipal); vue = new VueVisiteur(this); actualiser(); }
844260eb-d059-47fc-a82f-e694a83d9355
4
@Override public void removeAllWorkSheets() { try { Object ob = mybook.getTabID().getTabIDs().get( 0 ); mybook.getTabID().getTabIDs().removeAllElements(); mybook.getTabID().getTabIDs().add( ob ); mybook.getTabID().updateRecord(); } catch( Exception ex ) { ; } WorkSheetHandle[] ws = getWorkSheets(); try { for( WorkSheetHandle w : ws ) { try { w.remove(); } catch( WorkBookException e ) { ; } // ignore the invalid WorkBook problem } } catch( Exception e ) { ; // in case sheets already gone... } sheethandles.clear(); mybook.closeSheets(); // replaced below with this /* WHY ARE WE DOING THIS??? // init new book // save records then reset to avoid ByteStreamer.stream records expansion Object[] recs= this.getWorkBook().getStreamer().getBiffRecords(); // keep Excel 2007 status boolean isExcel2007= this.getIsExcel2007(); WorkBookHandle ret = new WorkBookHandle(this.getBytes()); ret.setIsExcel2007(isExcel2007); this.getWorkBook().getStreamer().setBiffRecords(Arrays.asList(recs)); this.mybook = ret.getWorkBook(); /**/ }
56f6d154-9952-4436-90a4-f6e6b7705ff5
5
public static String velocityUnitIndexToString(int index) { switch (index) { case 0: return "kph"; case 1: return "mph"; case 2: return "m/s"; case 3: return "kn"; case 4: return "kts"; default: return "kph"; } }
3ac44ac7-13eb-483d-9245-f0e0359b2dae
6
private void updateTrend() { if (getSkinnable().isTrendVisible()) { switch (getSkinnable().getTrend()) { case UP: trendUp.setOpacity(1); trendRising.setOpacity(0); trendSteady.setOpacity(0); trendFalling.setOpacity(0); trendDown.setOpacity(0); break; case RISING: trendUp.setOpacity(0); trendRising.setOpacity(1); trendSteady.setOpacity(0); trendFalling.setOpacity(0); trendDown.setOpacity(0); break; case STEADY: trendUp.setOpacity(0); trendRising.setOpacity(0); trendSteady.setOpacity(1); trendFalling.setOpacity(0); trendDown.setOpacity(0); break; case FALLING: trendUp.setOpacity(0); trendRising.setOpacity(0); trendSteady.setOpacity(0); trendFalling.setOpacity(1); trendDown.setOpacity(0); break; case DOWN: trendUp.setOpacity(0); trendRising.setOpacity(0); trendSteady.setOpacity(0); trendFalling.setOpacity(0); trendDown.setOpacity(1); break; default: trendUp.setOpacity(0); trendRising.setOpacity(0); trendSteady.setOpacity(0); trendFalling.setOpacity(0); trendDown.setOpacity(0); break; } } }
547e25bc-4653-4a28-90fb-85f6106d9847
6
private ViterbiNode parseImpl(CharSequence text) { final int len = text.length(); final ArrayList<ArrayList<ViterbiNode>> nodesAry = new ArrayList<ArrayList<ViterbiNode>>(len+1); final ArrayList<ViterbiNode> perResult = new ArrayList<ViterbiNode>(); nodesAry.add(BOS_NODES); for(int i=1; i <= len; i++) nodesAry.add(new ArrayList<ViterbiNode>()); for(int i=0; i < len; i++, perResult.clear()) { if(nodesAry.get(i).isEmpty()==false) { wdc.search(text, i, perResult); // 単語辞書から形態素を検索 unk.search(text, i, wdc, perResult); // 未知語辞書から形態素を検索 final ArrayList<ViterbiNode> prevs = nodesAry.get(i); for(int j=0; j < perResult.size(); j++) { final ViterbiNode vn = perResult.get(j); if(vn.isSpace) nodesAry.get(i+vn.length).addAll(prevs); else nodesAry.get(i+vn.length).add(setMincostNode(vn,prevs)); } } } ViterbiNode cur = setMincostNode(ViterbiNode.makeBOSEOS(), nodesAry.get(len)).prev; // reverse ViterbiNode head = null; while(cur.prev != null) { final ViterbiNode tmp = cur.prev; cur.prev = head; head = cur; cur = tmp; } return head; }
58b9fc8a-b5e9-4356-bf22-12ffd8104427
8
public void debugPrint() { System.out.println("---------- DEBUG PRINT ----------"); System.out.println("W - Worm"); System.out.println("b - Bacteria"); System.out.println(". - Empty slot"); System.out.println(); for (int y = 0; y < size_y; ++y) { for (int x = 0; x < size_x; x += 2) { if (tiles[x + y * size_x] instanceof Worm) { System.out.print("W "); } else if (tiles[x + y * size_x] instanceof Bacteria) { System.out.print("b "); } else { System.out.print(". "); } } System.out.print("" + y + "\n "); if (y == size_y - 1) { break; } for (int x = 1; x < size_x; x += 2) { if (tiles[x + y * size_x] instanceof Worm) { System.out.print("W "); } else if (tiles[x + y * size_x] instanceof Bacteria) { System.out.print("b "); } else { System.out.print(". "); } } System.out.print("\n"); } System.out.print("\n"); }
5d56e66e-a655-4223-bc89-8491ea95b43b
5
public void rafraichir() { Color[] colors = Constantes.COLORS; int colorInc = 0; boutonChargerLivraisons.setEnabled(false); boutonCalculerItineraire.setEnabled(false); HashMap<Integer, Itineraire> itineraires = manager.getItineraires(); Set<Map.Entry<Integer, Itineraire>> set = itineraires.entrySet(); for(Map.Entry<Integer, Itineraire> entry : set) { Itineraire itineraire = entry.getValue(); if (itineraire != null) { VueItineraire vi = new VueItineraire(null, 0, 0, 0, 0, colors[colorInc]); zone.ajouterVueItineraire(vi); VuePlan vp = zone.getVuePlan(); // VueItineraire vi = zone.getVueItineraire(); vi.setCalculated(false); vi.setItineraire(null); if (itineraire.testPlanCharger()) { vp.setPlan(itineraire.getPlan()); boutonChargerLivraisons.setEnabled(true); if (itineraire.testItineraireCharger()) { vi.setItineraire(itineraire); boutonCalculerItineraire.setEnabled(true); vi.setMinMax(vp.getMinX(), vp.getMaxX(), vp.getMinY(), vp.getMaxY()); if (itineraire.testTourneeCalculee()) { vi.setCalculated(true); } } } } zone.repaint(); colorInc = (colorInc + 1) % Constantes.NB_COLORS; } }
a4dc3133-bb7b-4263-9d68-e96094e1acf5
6
private boolean checkSideCollision(Hitbox prospective, Cell[][] tiles){ int prospectiveY = prospective.getY()/Cell.CELL_HEIGHT; if (prospectiveY > 0 && prospectiveY < tiles.length){ for(int i = 0; i < tiles[0].length; i++){ if(tiles[prospectiveY][i] != null && tiles[prospectiveY][i].getHitbox() != null && prospective.checkCollision(tiles[prospectiveY][i].getHitbox())){ return true; } } } return false; }
aa283e10-83a9-4efc-afcc-81de2d8b760c
4
private void validate() throws IOException, NullPointerException { if(IndexConfig.statLoc == null ) throw new NullPointerException(); statFolder = new File(IndexConfig.statLoc); if( statFolder.isDirectory() ) { System.err.println("Directory at STAT_LOC already exists, please delete it and run again."); throw new IOException(); } if( statFolder.isFile() ) { System.err.println("File found at STAT_LOC while expecting nothing, please delete it and run again."); throw new IOException(); } boolean isDirectoryCreated = statFolder.mkdir(); if( isDirectoryCreated == false ) { System.err.println("Something went wrong with directory creation; please check STAT_LOC once again."); throw new IOException(); } IndexConfig.convFilePath = IndexConfig.statLoc + File.separator + "conv.txt"; convFile = new File(IndexConfig.convFilePath); IndexConfig.numUsersVsFreqFilePath = IndexConfig.statLoc + File.separator + "num_users_vs_freq.txt"; numUsersVsFreqFile = new File(IndexConfig.numUsersVsFreqFilePath); IndexConfig.convLengthVsFreqFilePath = IndexConfig.statLoc + File.separator + "conv_length_vs_freq.txt"; convLengthVsFreqFile = new File(IndexConfig.convLengthVsFreqFilePath); IndexConfig.minutesVsFreqFilePath = IndexConfig.statLoc + File.separator + "minutes_vs_freq.txt"; minutesVsFreqFile = new File(IndexConfig.minutesVsFreqFilePath); }
39c973c4-36f2-4427-8456-3849b59bb649
6
@Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); switch (cmd.charAt(0)) { case '1': // Send button main.questionG(getInput()); chat.setCaretPosition(chat.getDocument().getLength()); input.grabFocus(); break; case '2': // Start start(); break; case '3': // Stop stop(); break; case '4': // Change file openFile(); break; case '5': // Exit setMsgToChat(main.sayGoodBye()); close(); break; case '6': // About aboutDialog(); break; } }
c722be3c-0ce1-40ab-a6b6-d8785fb46bbb
3
public void testCompareTo() { MonthDay test1 = new MonthDay(6, 6); MonthDay test1a = new MonthDay(6, 6); assertEquals(0, test1.compareTo(test1a)); assertEquals(0, test1a.compareTo(test1)); assertEquals(0, test1.compareTo(test1)); assertEquals(0, test1a.compareTo(test1a)); MonthDay test2 = new MonthDay(6, 7); assertEquals(-1, test1.compareTo(test2)); assertEquals(+1, test2.compareTo(test1)); MonthDay test3 = new MonthDay(6, 7, GregorianChronology.getInstanceUTC()); assertEquals(-1, test1.compareTo(test3)); assertEquals(+1, test3.compareTo(test1)); assertEquals(0, test3.compareTo(test2)); DateTimeFieldType[] types = new DateTimeFieldType[] { DateTimeFieldType.monthOfYear(), DateTimeFieldType.dayOfMonth() }; int[] values = new int[] {6, 6}; Partial p = new Partial(types, values); assertEquals(0, test1.compareTo(p)); try { test1.compareTo(null); fail(); } catch (NullPointerException ex) {} try { test1.compareTo(new LocalTime()); fail(); } catch (ClassCastException ex) {} Partial partial = new Partial() .with(DateTimeFieldType.centuryOfEra(), 1) .with(DateTimeFieldType.halfdayOfDay(), 0) .with(DateTimeFieldType.dayOfMonth(), 9); try { new MonthDay(10, 6).compareTo(partial); fail(); } catch (ClassCastException ex) {} }
04076fc6-9468-4c12-9394-7b1336b0cfe0
9
public void undoMove(CheckersMove move, Player turn) { int x1 = move.start.x; int x2 = move.destination.x; int y1 = move.start.y; int y2 = move.destination.y; CheckersPiece captured = move.captured; CheckersPiece moved = array[x2][y2]; array[x2][y2] = null; array[x1][y1] = moved; array[x1][y1].move(new BoardSquare(x1, y1)); // Check if the move to be undone was a capture if (null != captured) { // capture array[(x1+x2)/2][(y1+y2)/2] = captured; // restore captured piece // Restore counts of pieces if (captured.getColor() == Color.RED) { redPieces++; if (captured.isKing()) { redKings++; } } if (captured.getColor() == Color.BLACK){ blackPieces++; if (captured.isKing()) { blackKings++; } } } // Remove king status, if applicable if (Player.BLACK == turn && move.madeKing) { array[x1][y1].makeRegular(); blackKings--; } if (Player.RED == turn && move.madeKing) { array[x1][y1].makeRegular(); redKings--; } }
90ad42c2-622e-46e2-9f9c-84e798ed0c4b
3
@Override public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException{ if(setWidth){ width=gc.getWidth(); height=gc.getHeight(); MenuManager.initClick(sbg, width, height); setWidth=false; } if(MenuManager.getMenuType()==0) MenuManager.menuSelect(gc,sbg,g); else if(MenuManager.getMenuType()==1) MenuManager.levelSelect(gc,sbg,g); }
08f23853-b4f8-46eb-b7ab-f7a07a747d97
5
private void qSortBase(int array[], int left, int right){ if(left>=right) return; int l = left, r = right; int pivot = array[r]; do{ while(array[l]<pivot) l++; while(pivot<array[r]) r--; if(l<=r){ swap(array,l,r); l++; r--; } }while(l<r); qSortBase(array, left, r); qSortBase(array, l, right); }
f36917dd-de9e-4330-8baf-1ca4209045a4
3
public void startApp() { effect = new EnergyCalculation(); InputStream is = getClass().getResourceAsStream(fileName); try { E = effect.calcEnergy(is, 0, 3000); is.close(); } catch (Exception ex) { ex.printStackTrace(); } System.out.print("E = ["); for (int frame = 0; frame < E[0].length; frame++) System.out.print(" " + E[0][frame]); System.out.print(";"); for (int frame = 0; frame < E[1].length; frame++) System.out.print(" " + E[1][frame]); System.out.print("];\n"); }
f764c45f-65b6-413f-a5c5-c091cb25d2bc
1
public boolean isValid() { int sum = 0; for(int i = digits.length; i > 0; i--){ int coeff = digits.length - i+1; sum += (digits[i-1]*coeff); } return sum%11 == 0; }
ddf6797c-4210-48c4-b364-ce77d6b16df9
4
private DataPacket ProcessDataPacket(DataPacket dpkt) { DataPacket retval = null; if (dpkt.UltimateDestination == this.MeZone) { // data found me! stop doing everything and eat the data! this.MyColor = new Color(0.0f, 1.0f, 0.0f);// bright green return retval; } int FirstZoneDex = dpkt.ZoneDex; while (!this.Routing.containsKey(dpkt.CurrentDestination)) { dpkt.RotateTarget();// keep shifting packet targets until we find one that we know about if (dpkt.ZoneDex == FirstZoneDex) { break;// snox, not thought out } } //if (dpkt.ZoneDex != FirstZoneDex) { if (this.Routing.containsKey(dpkt.CurrentDestination)) { retval = dpkt.CloneMe(); } return retval; }
611600bb-fe36-4a0d-85a4-cadc2552373a
3
public static String sendHttpGet(String url, Header[] headers) { // initializes new HTTP client and GET request CloseableHttpClient httpclient = HttpClients.createDefault(); HttpGet httpGet = new HttpGet(url); // sets content type httpGet.setHeaders(headers); // sends HTTP GET request CloseableHttpResponse response1 = null; try { response1 = httpclient.execute(httpGet); } catch (ClientProtocolException e1) { e1.printStackTrace(); return null; } catch (IOException e1) { e1.printStackTrace(); return null; } // gets the response as string String output = null; try { HttpEntity entity1 = response1.getEntity(); output = EntityUtils.toString(entity1, "UTF-8"); EntityUtils.consume(entity1); response1.close(); } catch (IOException e) { e.printStackTrace(); return null; } return output; }
76fa8578-ffd8-41c1-99bc-29d4a30d602b
2
public static List<? extends Chewable> printSize( List<? extends Chewable> list) { // Line 10 System.out.println(list.size()); return list; }
d6cf335b-ea0e-416f-8f25-e048e314da2a
7
private WSResponse addFSQData(WSResponse response, FSQData fsqData) { if(fsqData!=null){ if(fsqData.getEvents()!=null && fsqData.getEvents().size()>0){ for (FSQEvent fsq : fsqData.getEvents()) { Events event=new Events(); event.setMessage(fsq.getMessage()); event.setMood(fsq.getMood().getType()); event.setSource("foursquare"); event.setTime(fsq.getTime()); event.setLocation(fsq.getLocation()); event.setLat(fsq.getLat()); event.setLon(fsq.getLon()); if(fsq.getTags()!=null && fsq.getTags().size()>0){ Tags tag=new Tags(); ArrayList<String> tags=new ArrayList<>(); for (String string : fsq.getTags()) { tags.add(string); } tag.setName(tags); event.setTags(tag); } response.getEvents().add(event); response.setFoursquare(response.getFoursquare()+1); response.setScore(response.getScore()+fsq.getMood().getScore()); } } } return response; }
341a1ebe-fb43-4c6a-8419-401faccb2852
7
public void testDirectInstantiation() throws Exception { File path = new File(System.getProperty("tempDir")); int sz = 3; Directory[] dirs = new Directory[sz]; dirs[0] = new SimpleFSDirectory(path, null); dirs[1] = new NIOFSDirectory(path, null); dirs[2] = new MMapDirectory(path, null); for (int i=0; i<sz; i++) { Directory dir = dirs[i]; dir.ensureOpen(); String fname = "foo." + i; String lockname = "foo" + i + ".lck"; IndexOutput out = dir.createOutput(fname); out.writeByte((byte)i); out.close(); for (int j=0; j<sz; j++) { Directory d2 = dirs[j]; d2.ensureOpen(); assertTrue(d2.fileExists(fname)); assertEquals(1, d2.fileLength(fname)); // don't test read on MMapDirectory, since it can't really be // closed and will cause a failure to delete the file. if (d2 instanceof MMapDirectory) continue; IndexInput input = d2.openInput(fname); assertEquals((byte)i, input.readByte()); input.close(); } // delete with a different dir dirs[(i+1)%sz].deleteFile(fname); for (int j=0; j<sz; j++) { Directory d2 = dirs[j]; assertFalse(d2.fileExists(fname)); } Lock lock = dir.makeLock(lockname); assertTrue(lock.obtain()); for (int j=0; j<sz; j++) { Directory d2 = dirs[j]; Lock lock2 = d2.makeLock(lockname); try { assertFalse(lock2.obtain(1)); } catch (LockObtainFailedException e) { // OK } } lock.release(); // now lock with different dir lock = dirs[(i+1)%sz].makeLock(lockname); assertTrue(lock.obtain()); lock.release(); } for (int i=0; i<sz; i++) { Directory dir = dirs[i]; dir.ensureOpen(); dir.close(); assertFalse(dir.isOpen); } }
2585306f-236a-4525-8d6c-dd92e5b7bac2
5
public void run() // Execution { try { NetObjectReader input = new NetObjectReader(socket); //try create a reader with the socket while (true){ //constant loop String updatemsg = (String) input.get(); // create string from the reader.get Scanner sc = new Scanner(updatemsg); //create a scanner using the string double movement; // a double to identify movement movement = 2; // movement can't be 1 or 0 for(int i = 0; i < 1; i++) { movement = sc.nextDouble(); // get the doble from the string } sc.close(); //close the scanner if (movement == 0){ // if movement is 0 model.getBat(playerNumber).moveY(10); //move 10 to the Y direction for the current player } if (movement == 1){ // if momvement is 1 model.getBat(playerNumber).moveY(-10); // move 10 to the opposite direction for the current player } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
bfb2512d-23c7-4450-9f0f-121d3b7239e1
1
private void decq(int q) { if (q < 0) { this.quality = q; hq = false; } else { int fl = (q & 0xff000000) >> 24; this.quality = (q & 0xffffff); hq = ((fl & 1) != 0); } }
c8416094-346d-480a-b9bf-16d9d35c18a4
8
public void repair(int count,Node n,Node badLink) throws ClassNotFoundException, IOException{ Node neighborL = new Node(); Node neighborR = new Node(); if( count !=0 && n.links.get(count -1) !=null){ neighborL = save.read(n.links.get(count -1)); } if(count+1 < n.links.size() && count+1 != n.links.size()){ neighborR = save.read(n.links.get(count+1)); } if( neighborL.keys.size() > (neighborL.MAXKEYS/2)-1){ n.rotateRight(badLink,neighborL,count); } else if( neighborR.keys.size() > (neighborR.MAXKEYS/2)-1){ n.rotateLeft(badLink,neighborR,count); } else if(count == 0){ n.mergeRight(neighborR, badLink, count); } else{ n.mergeLeft(neighborL,badLink, count -1); } for(Node t: n.getNode()){ save.write(t); } save.write(n); }
ce60bfe7-dcc2-4297-98b0-d40cab832b4a
9
public static int numDistinct(String S, String T) { int slen = S.length(); int tlen = T.length(); if (slen < tlen) return 0; int[][] num = new int[slen][tlen]; for (int i = 0; i < slen; i++) { for (int j = 0; j < tlen; j++) { if (i < j) num[i][j] = 0; else if (j == 0) { if (i == 0) {if (S.charAt(0) == T.charAt(0)) num[i][j] = 1;else num[i][j] = 0;} else if (S.charAt(i) == T.charAt(j)) num[i][j] = num[i - 1][j] + 1; else num[i][j] = num[i - 1][j]; } else if (S.charAt(i) == T.charAt(j)) { num[i][j] = num[i][j] + num[i - 1][j - 1]; num[i][j] = num[i][j] + num[i - 1][j]; } else { num[i][j] = num[i][j] + num[i - 1][j]; } } } return num[slen - 1][tlen - 1]; }
315468a8-05b9-41cb-b4e2-1c9d57240706
5
public void randomize() { Random r = new Random(); Piece[][] temp = new Piece[8][8]; for (int i = 0; i < temp.length; i++) { for (int j = 0; j < temp.length; j++) { temp[i][j] = null; } } for (int i = 0; i < arr.length; i++) { for (int j = 0; j < arr.length; j++) { int a = r.nextInt(8); int b = r.nextInt(8); while (temp[a][b] != null) { a = r.nextInt(8); b = r.nextInt(8); } temp[a][b] = arr[i][j]; } } arr = temp; }
bd510647-4b1b-4082-8d77-b4556aadde0e
3
private boolean isClassEntry(final ZipEntry ze) { String name = ze.getName(); return inRepresentation == SINGLE_XML && name.equals(SINGLE_XML_NAME) || name.endsWith(".class") || name.endsWith(".class.xml"); }
444065d8-6c2b-4e91-ae4d-0d302d68bb8a
4
public int compareTo(Comp o) { if (value != o.value) { return value < o.value ? 1 : -1; } int res = Long.valueOf(count).compareTo((long) o.count); if (res == 0) { res = Integer.valueOf(key.getRank()).compareTo(o.key.getRank()); } return res != 0 ? res : key.getSku().compareTo(o.key.getSku()); }
8e27436e-9c1f-4a1d-ae9f-1522f9871310
5
public static void bringPlayer(Player player, String playerName, String teleportPlayerName) { if (player == null) { StefsAPI.MessageHandler.buildMessage().addSender("$") .setMessage("error.onlyIngame", AdminEye.messages).build(); return; } ArrayList<Player> teleportPlayers = AdminEyeUtils .requestPlayers(teleportPlayerName); if (teleportPlayers == null && teleportPlayerName != null) { StefsAPI.MessageHandler.buildMessage().addSender(playerName) .setMessage("error.playerNotFound", AdminEye.messages) .changeVariable("playername", teleportPlayerName).build(); return; } String teleportedPlayers = ""; for (Player teleportPlayer : teleportPlayers) { teleportPlayer.teleport(player.getLocation()); teleportedPlayers += "%A" + teleportPlayer.getName() + "%N, "; } teleportedPlayers = (teleportPlayerName.equals("*") ? teleportedPlayers = AdminEye.config .getFile().getString("chat.everyone") + "%N, " : teleportedPlayers); AdminEye.broadcastAdminEyeMessage(playerName, "bring", "bring", "playernames", teleportedPlayers); }
93388245-91eb-468d-a708-d6919e1c3aba
7
public static void addByChance(LivingEntity entity, MobAbilityConfig ma) { if (entity == null || ma == null) return; if (isValid(entity) && ma.babyRate <= 1.0F && ma.babyRate != 0.0F) { // If the random number is higher than the baby chance we don't turn the mob into a baby if (ma.babyRate == 1.0F || RandomUtil.i.nextFloat() < ma.babyRate) { ability.addAbility(entity); } } }
c8b3855a-13f8-4045-9348-736b05040fcb
8
public MapObject doNextDeathSpinAction(MapEngine engine, double s_elapsed) { if (!death_spin_started) { death_spin_started = true; death_spin_direction = direction; death_spin_time_left = DEATH_SPIN_TIME; move_speed /= DEATH_SPIN_MOVE_SPEED_DIVISOR; death_spin_delta_direction = turn_speed * DEATH_SPIN_TURN_SPEED_MULTIPLIER; if (previous_turn.equals(TurnDirection.CLOCKWISE) || (previous_turn.equals(TurnDirection.NONE) && Math.random() < 0.5)) { death_spin_delta_direction *= -1; } } else { death_spin_direction = MapUtils.normalizeAngle(death_spin_direction + death_spin_delta_direction * s_elapsed); if (death_spin_time_left < 0.0) { MapObject created_object = handleDeath(engine, s_elapsed); return created_object; } if (!doNextMovement(engine, s_elapsed)) { death_spin_time_left = 0.0; } death_spin_time_left -= s_elapsed; } if (shields < -max_death_spin_damage_taken) { death_spin_time_left = -1.0; } if (Math.random() * MIN_TIME_BETWEEN_DAMAGED_EXPLOSIONS < s_elapsed) { playSound(engine, "effects/explode2.wav"); } return createDamagedExplosion(); }
e25da6f2-16f3-4aa5-9014-967178a05734
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://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(RecordInterest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(RecordInterest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(RecordInterest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(RecordInterest.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new RecordInterest().setVisible(true); } }); }
7760576b-f4ea-41bf-abab-11c63ef5885b
3
protected void thinkOfNewTask() { //System.out.println(getName() + " is thinking of a new task to do."); String desiredTask = "reproduce"; //"wear a backpack" is not programmed yet //if(getBackpack() == null) {desiredTask = "wear a backpack";} if(getHealth() < 1) //CHANGE 1 to 100 or something {desiredTask = "gain health";} if((double)getHunger() / getMaxEnergy() > .2 ) //if hungry {desiredTask = "eat";} if(!desiredTask.equals(getTask())) {setTask(desiredTask);} }
6eb403a6-08fb-419a-998b-b878c504867c
3
public void setFlowBlock(FlowBlock flowBlock) { if (this.flowBlock != flowBlock) { this.flowBlock = flowBlock; StructuredBlock[] subs = getSubBlocks(); for (int i = 0; i < subs.length; i++) { if (subs[i] != null) subs[i].setFlowBlock(flowBlock); } } }
ac08057d-3e8b-42f2-9e86-c9ec51559252
3
public void setRelativeMouseMode(boolean mode) { if (mode == isRelativeMouseMode()) { return; } if (mode) { try { robot = new Robot(); recenterMouse(); } catch (AWTException ex) { // couldn't create robot! robot = null; } } else { robot = null; } }
5d1f7fe1-246a-4bd1-b118-4a290128ccfc
9
@SuppressWarnings("unchecked") public Map<String, Object> readDaily(String file) { Map<String, Object> result = new LinkedHashMap<String, Object>(); try{ // Open the file FileInputStream fstream = new FileInputStream(file); // Get the object of DataInputStream DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String sDate = ""; String strLine; int soNgay = 0; int soGiai = 0; int soGiaiPhu = 0; int n = 0; String oldDB = ""; while ((strLine = br.readLine().trim()) != null) { // if(strLine.trim().isEmpty()) continue; Map<String, String> cac_giai_cua_ngay = new LinkedHashMap<String, String>(); //Keep the date if(strLine.startsWith("===")){ System.out.println("Start of day !!!!!!!!!!!!!!!!!!!!!"); //clean "=" strLine = strLine.replaceAll("=", ""); //clean "Ngay" strLine = strLine.replaceAll("Ngay", ""); sDate = strLine.trim(); result.put(sDate, cac_giai_cua_ngay); soNgay++; soGiai=1; soGiaiPhu=1; n=1; continue; } else { cac_giai_cua_ngay = (Map<String, String>) result.get(sDate); } //restric so ngay if(soNgay > 30){ break; } String ten_giai = getTenGiai(soGiai, soGiaiPhu).trim(); //System.out.println("ten_giai========= '"+ten_giai); String giai = strLine.trim(); //System.out.println("giai=========xxxx '"+giai); cac_giai_cua_ngay.put(ten_giai, giai); result.put(sDate, cac_giai_cua_ngay); lastDate = sDate; // if(ten_giai.equalsIgnoreCase(DB_GIAI)) { // if(soNgay > 1){ DB.add(giai); } } // if(isChangeGiai(n)){ soGiai++; soGiaiPhu=0; } if(n >= 27) { //reset vars System.out.println("so giai is "+n); } // n++; soGiaiPhu++; } }catch (Exception e){ System.err.println("readData: " + e.getMessage()); } return result; }
bb213ea1-3e8b-4cd8-b1e2-0aa4cfcbab6d
2
static void copy(InputStream in, OutputStream out) throws IOException { while (true) { int c = in.read(); if (c == -1) break; out.write((char)c); } }
304d4e40-9bcd-4c5e-bc16-3fc79be007b6
7
private void resetQuest(int reason) { if(text().length()>0) { Quest theQ=null; for(int q=0;q<CMLib.quests().numQuests();q++) { final Quest Q=CMLib.quests().fetchQuest(q); if((Q!=null)&&(""+Q).equals(text())) { theQ=Q; break; } } if((theQ==null)||(!theQ.running())) affected.delEffect(this); else { Log.sysOut("QuestBound",CMMsg.TYPE_DESCS[reason]+" message for "+(affected==null?"null":affected.name())+" caused "+theQ.name()+" to reset."); theQ.resetQuest(5); } } else affected.delEffect(this); }
c78e129b-5732-4963-971b-36aa46239ecd
3
public boolean within(final int chunkX, final int chunkZ) { return chunkX >= this.minChunkX && chunkX <= this.maxChunkX && chunkZ >= this.minChunkZ && chunkZ <= this.maxChunkZ; }
3caa207a-cd5f-4bfd-b0c0-a56dd6a35d34
8
public String vypisAuto(int i, Auto auto){ String str = "Auto "+ i +"\n"; double potrebaNaloz = 0; for(int k = 0; k < auto.getUdalost().size(); k++){ potrebaNaloz += auto.getUdalost().get(k).getDobaNakl(); } /*System.out.println(potrebaNaloz);*/ str += "Potreba nalozit: " + (1000.0 / 30.0)*potrebaNaloz + "\n"; double vyklad = 0; for(int k = 0; k < auto.getUdalost().size(); k++){ Udalost ud = auto.getUdalost().get(k); str +="Udalost " + k + " \n"; str +="Cilove mesto: " + Mapa.getIndexMest(auto.getUdalost().get(k).getMesto()) + "\n" ; str += "Vyklad: " + auto.getUdalost().get(k).getDobaNakl()*(1000.0/30.0) + "\n"; str += "Stav udalosti: "; if(ud.isCeka()){ str +="Ceka na prideleni letiste" + "\n"; } if(ud.isNaklada()){ str +="Naklada" + "\n"; str +="Soucasne nalozeno: " + this.getDobaNaklada()*(1000.0/30.0) + "\n"; str +="Ujeta vzdalenost: 0" + "\n"; } if(ud.isJede()){ str +="Jede" + "\n"; str +="Soucasne nalozeno: " + this.getDobaNaklada()*(1000.0/30.0) + "\n"; str +="Ujeta vzdalenost: " + this.getDobaJede()*(40.0/60.0) +"\n"; } if(ud.isVyklada()){ str +="Vyklada" + "\n"; str +="Soucasne nalozeno: " + (this.getDobaNaklada()*(1000.0/30.0)-this.getDobaVyklada()*(1000.0/30.0)) + "\n"; str += "Vylozeno: " + this.getDobaVyklada()*(1000.0/30.0) + "\n"; str +="Ujeta vzdalenost: " + ud.getDobaJizd()*(40.0/60.0) +"\n"; } if(ud.isDokonceno() || ud.isKonec()){ str +="Dokoncena" + "\n"; str +="Soucasne nalozeno: 0" +"\n"; str += "Vylozeno: " + ud.getDobaNakl()*(1000.0/30.0) + "\n"; str +="Ujeta vzdalenost: " + ud.getDobaJizd()*(40.0/60.0) +"\n"; } } return str; }
a070319f-56dc-4b9b-96e3-743336cf5c96
0
public JSeparator getjSeparator1() { return jSeparatorTitre; }
230f4559-3fd2-4856-88a9-623987d1deb2
3
private static void getCollection() { try { Mongo mongo = new Mongo("localhost", 27017); DB db = mongo.getDB("paldb"); boolean auth = db.authenticate("pal", "admin123".toCharArray()); logger.debug("authenticated: " + auth); Set<String> collections = db.getCollectionNames(); for (String collectionName : collections) { logger.debug("collectionName: " + collectionName); } DBCollection collection = db.getCollection("users"); logger.debug("collection: " + collection.toString()); } catch (UnknownHostException e) { e.printStackTrace(); } catch (MongoException e) { e.printStackTrace(); } }
a628b2bf-5ad3-47ff-8167-e69dd99e0028
5
public BufferedImage use(BufferedImage src, Vector<SOMVector> inputVectors) { BufferedImage result = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_INT_RGB); SOMVector tempVec = null; if (closestType) { for (int i = 0; i < getWidth(); i++) { for (int j = 0; j < getHeight(); j++) { SOMNode node = getNode(i, j); node.setWeights(closestVect(node.getVector(), inputVectors)); setNode(i, j, node); } } } for (int i = 0; i < src.getWidth(); i++) { for (int j = 0; j < src.getHeight(); j++) { double percent = (i / (double)src.getWidth() * 100); System.out.println(percent + " %"); Color c = new Color(src.getRGB(i, j)); tempVec = new SOMVector(scale(c.getRed()), scale(c.getGreen()), scale(c.getBlue())); SOMNode winner = getWinner(tempVec); SOMVector colorVector = winner.getVector(); Color resC = new Color(unscale(colorVector.get(0)), unscale(colorVector.get(1)), unscale(colorVector.get(2))); result.setRGB(i, j, resC.getRGB()); } } return result; }
90a12246-a32a-4806-bd15-1d6c4bad8a11
1
public WidgetStack(int width, int height, int size, int layers, int r, int c) { super(); //setCursor(PointingHandCursor); row = r; col = c; layer = new WidgetHolder[layers]; setMinimumSize(width, height); for (int i=0; i<layers; ++i) { layer[i] = new WidgetHolder(this, width, height, null); layer[i].setParent(this); } }
79262065-0861-4898-acb2-44cab768104d
2
public static String readFirstLine(InputStream inputStream){ try { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); String line = bufferedReader.readLine().trim(); return line; } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }
452acf4b-5e7a-454e-a8e8-dd19f69a37fa
1
public List<TransformType> getTransform() { if (transform == null) { transform = new ArrayList<TransformType>(); } return this.transform; }
323b629e-3f11-4a22-a447-3f8ec6584c82
1
public static boolean intToBoolean(int bool) { if(bool == 0) return false; else return true; }
37cd33a0-3676-40a2-a76a-14d50c6c450e
0
public void setPrpMoaTipo(BigInteger prpMoaTipo) { this.prpMoaTipo = prpMoaTipo; }
4d8d53a0-639d-487c-be62-9b540aeb170e
5
public static void main(String[] args) { char[] message = {79,59,12,2,79,35,8,28,20,2,3,68,8,9,68,45,0,12,9,67,68,4, 7,5,23,27,1,21,79,85,78,79,85,71,38,10,71,27,12,2,79,6,2,8,13,9,1,13,9, 8,68,19,7,1,71,56,11,21,11,68,6,3,22,2,14,0,30,79,1,31,6,23,19,10,0,73, 79,44,2,79,19,6,28,68,16,6,16,15,79,35,8,11,72,71,14,10,3,79,12,2,79,19, 6,28,68,32,0,0,73,79,86,71,39,1,71,24,5,20,79,13,9,79,16,15,10,68,5,10, 3,14,1,10,14,1,3,71,24,13,19,7,68,32,0,0,73,79,87,71,39,1,71,12,22,2,14, 16,2,11,68,2,25,1,21,22,16,15,6,10,0,79,16,15,10,22,2,79,13,20,65,68,41, 0,16,15,6,10,0,79,1,31,6,23,19,28,68,19,7,5,19,79,12,2,79,0,14,11,10,64, 27,68,10,14,15,2,65,68,83,79,40,14,9,1,71,6,16,20,10,8,1,79,19,6,28,68, 14,1,68,15,6,9,75,79,5,9,11,68,19,7,13,20,79,8,14,9,1,71,8,13,17,10,23, 71,3,13,0,7,16,71,27,11,71,10,18,2,29,29,8,1,1,73,79,81,71,59,12,2,79,8, 14,8,12,19,79,23,15,6,10,2,28,68,19,7,22,8,26,3,15,79,16,15,10,68,3,14, 22,12,1,1,20,28,72,71,14,10,3,79,16,15,10,68,3,14,22,12,1,1,20,28,68,4, 14,10,71,1,1,17,10,22,71,10,28,19,6,10,0,26,13,20,7,68,14,27,74,71,89,68, 32,0,0,71,28,1,9,27,68,45,0,12,9,79,16,15,10,68,37,14,20,19,6,23,19,79, 83,71,27,11,71,27,1,11,3,68,2,25,1,21,22,11,9,10,68,6,13,11,18,27,68,19, 7,1,71,3,13,0,7,16,71,28,11,71,27,12,6,27,68,2,25,1,21,22,11,9,10,68,10, 6,3,15,27,68,5,10,8,14,10,18,2,79,6,2,12,5,18,28,1,71,0,2,71,7,13,20,79, 16,2,28,16,14,2,11,9,22,74,71,87,68,45,0,12,9,79,12,14,2,23,2,3,2,71,24, 5,20,79,10,8,27,68,19,7,1,71,3,13,0,7,16,92,79,12,2,79,19,6,28,68,8,1, 8,30,79,5,71,24,13,19,1,1,20,28,68,19,0,68,19,7,1,71,3,13,0,7,16,73,79, 93,71,59,12,2,79,11,9,10,68,16,7,11,71,6,23,71,27,12,2,79,16,21,26,1,71, 3,13,0,7,16,75,79,19,15,0,68,0,6,18,2,28,68,11,6,3,15,27,68,19,0,68,2,25, 1,21,22,11,9,10,72,71,24,5,20,79,3,8,6,10,0,79,16,8,79,7,8,2,1,71,6,10, 19,0,68,19,7,1,71,24,11,21,3,0,73,79,85,87,79,38,18,27,68,6,3,16,15,0,17, 0,7,68,19,7,1,71,24,11,21,3,0,71,24,5,20,79,9,6,11,1,71,27,12,21,0,17,0, 7,68,15,6,9,75,79,16,15,10,68,16,0,22,11,11,68,3,6,0,9,72,16,71,29,1,4,0, 3,9,6,30,2,79,12,14,2,68,16,7,1,9,79,12,2,79,7,6,2,1,73,79,85,86,79,33, 17,10,10,71,6,10,71,7,13,20,79,11,16,1,68,11,14,10,3,79,5,9,11,68,6,2,11, 9,8,68,15,6,23,71,0,19,9,79,20,2,0,20,11,10,72,71,7,1,71,24,5,20,79,10, 8,27,68,6,12,7,2,31,16,2,11,74,71,94,86,71,45,17,19,79,16,8,79,5,11,3,68, 16,7,11,71,13,1,11,6,1,17,10,0,71,7,13,10,79,5,9,11,68,6,12,7,2,31,16,2, 11,68,15,6,9,75,79,12,2,79,3,6,25,1,71,27,12,2,79,22,14,8,12,19,79,16,8, 79,6,2,12,11,10,10,68,4,7,13,11,11,22,2,1,68,8,9,68,32,0,0,73,79,85,84, 79,48,15,10,29,71,14,22,2,79,22,2,13,11,21,1,69,71,59,12,14,28,68,14,28, 68,9,0,16,71,14,68,23,7,29,20,6,7,6,3,68,5,6,22,19,7,68,21,10,23,18,3,16, 14,1,3,71,9,22,8,2,68,15,26,9,6,1,68,23,14,23,20,6,11,9,79,11,21,79,20, 11,14,10,75,79,16,15,6,23,71,29,1,5,6,22,19,7,68,4,0,9,2,28,68,1,29,11, 10,79,35,8,11,74,86,91,68,52,0,68,19,7,1,71,56,11,21,11,68,5,10,7,6,2,1, 71,7,17,10,14,10,71,14,10,3,79,8,14,25,1,3,79,12,2,29,1,71,0,10,71,10,5, 21,27,12,71,14,9,8,1,3,71,26,23,73,79,44,2,79,19,6,28,68,1,26,8,11,79,11, 1,79,17,9,9,5,14,3,13,9,8,68,11,0,18,2,79,5,9,11,68,1,14,13,19,7,2,18,3, 10,2,28,23,73,79,37,9,11,68,16,10,68,15,14,18,2,79,23,2,10,10,71,7,13,20, 79,3,11,0,22,30,67,68,19,7,1,71,8,8,8,29,29,71,0,2,71,27,12,2,79,11,9,3, 29,71,60,11,9,79,11,1,79,16,15,10,68,33,14,16,15,10,22,73}; for (char a = 'a'; a <= 'z'; a++) for (char b = 'a'; b <= 'z'; b++) for (char c = 'c'; c <= 'z'; c++) { boolean yes = xor(message, a, b, c); if (yes) { String s = new String(message); int index = s.indexOf(" the "); if (index > 0) System.out.println((a+b+c)+": (" + a + ", " + b + ", " + c + ") " + s + " " + sum(message) + "\n\n"); xor(message, a, b, c); // un-XOR the message. } } }
3a9c9a44-2b4e-4a1f-9e8b-9bb63b14f4b6
0
public void setFeatures(List<Feature> features) { this.features = features; }
28b90d0c-1c25-400d-bc26-4f080ea51ede
8
void chequearTecla(KeyEvent evento) { //jugador 1 if (evento.getKeyCode() == 38) { System.out.println("Mover Arriba"); mover_arriba(); } if (evento.getKeyCode() == 40) { System.out.println("Mover Abajo"); mover_abajo(); } if (evento.getKeyCode() == 37) { System.out.println("Mover Izquierda"); mover_izquierda(); } if (evento.getKeyCode() == 39) { System.out.println("Mover Derecha"); mover_derecha(); } //jugador 2 if (evento.getKeyCode() == 87) { System.out.println("Mover Arriba"); mover_arriba2(); } if (evento.getKeyCode() == 83) { System.out.println("Mover Abajo"); mover_abajo2(); } if (evento.getKeyCode() == 65) { System.out.println("Mover Izquierda"); mover_izquierda2(); } if (evento.getKeyCode() == 68) { System.out.println("Mover Derecha"); mover_derecha2(); } }
b88fbac1-4414-49e4-9558-902246cc4753
0
private void addActionListeners() { addBackground1btn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { getPicturesPath(background1Field); } }); addBackground2btn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { getPicturesPath(background2Field); } }); addBackground3btn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { getPicturesPath(background3Field); } }); addLogoBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { getPicturesPath(logoField); } }); addButtonBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { getPicturesPath(buttonField); } }); delBackground1btn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { background1Field.setText(""); } }); delBackground2btn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { background2Field.setText(""); } }); delBackground3btn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { background3Field.setText(""); } }); delLogoBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { logoField.setText(""); } }); delButtonBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { buttonField.setText(""); } }); okBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setSettings(); dispose(); } }); btnCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dispose(); } }); }
284ac5f5-91d1-4a07-8536-c5057eda7dd3
4
public static LuaTable make(boolean weakkeys, boolean weakvalues) { LuaString mode; if (weakkeys && weakvalues) { mode = LuaString.valueOf("kv"); } else if (weakkeys) { mode = LuaString.valueOf("k"); } else if (weakvalues) { mode = LuaString.valueOf("v"); } else { return LuaTable.tableOf(); } LuaTable table = LuaTable.tableOf(); LuaTable mt = LuaTable.tableOf(new LuaValue[] { LuaValue.MODE, mode }); table.setmetatable(mt); return table; }
95386e06-1d34-49d1-9ac2-7d55120d6f50
6
public List<Room> getPath() { List<Room> list = new ArrayList<Room>(); HousePath path = this; while (path != null) { list.add(path.last); path = path.getPrevious(); } Collections.reverse(list); final int index = script.roomStorage.getIndex(ctx.players.local()); if (index != -1) { // Clean up path remove already traversed parts int removeBefore = -1; for (int i = 0; i < list.size(); i++) { Room room = list.get(i); if (room.getIndex() == index) { removeBefore = i; break; } } if (removeBefore > -1) { for (int i = 0; i < removeBefore; i++) { list.remove(0); } } } return list; }
699efe31-c000-48b8-98d8-06ac7c0f9da0
7
public void accept(final ClassVisitor cv) { FieldVisitor fv = cv.visitField(access, name, desc, signature, value); if (fv == null) { return; } int i, n; n = visibleAnnotations == null ? 0 : visibleAnnotations.size(); for (i = 0; i < n; ++i) { AnnotationNode an = (AnnotationNode) visibleAnnotations.get(i); an.accept(fv.visitAnnotation(an.desc, true)); } n = invisibleAnnotations == null ? 0 : invisibleAnnotations.size(); for (i = 0; i < n; ++i) { AnnotationNode an = (AnnotationNode) invisibleAnnotations.get(i); an.accept(fv.visitAnnotation(an.desc, false)); } n = attrs == null ? 0 : attrs.size(); for (i = 0; i < n; ++i) { fv.visitAttribute((Attribute) attrs.get(i)); } fv.visitEnd(); }
2842742a-f525-4e6f-805e-16bf80d10a10
5
public static String generateCard() { String temp = new String(); String newCard = new String(); int tmp; Random rand = new Random(); int cardDigits[] = new int[16]; // For Visa, 1st digit is always 4 cardDigits[0] = 4; newCard += cardDigits[0]; // Initialize the 2nd-15th digit to a random number for (int i = 1; i < 15; i++) { cardDigits[i] = rand.nextInt(10); newCard += cardDigits[i]; } String luhnString = new String(); for (int i = 14; i >= 0; i--) { if (i%2 == 0) { tmp = cardDigits[i] * 2; } else tmp = cardDigits[i]; luhnString += tmp; } int luhnSum = 0; for (int i = 0; i < luhnString.length(); i++) { temp = Character.toString(luhnString.charAt(i)); luhnSum += Integer.parseInt(temp); } // Calculate the check digit based on the luhnSum int checkDigit = 10 - (luhnSum%10); if (checkDigit == 10) checkDigit = 0; cardDigits[15] = checkDigit; newCard += cardDigits[15]; return newCard; }
635eadfa-586b-4981-845b-6a6c981b7652
1
public static void downloadFile(RestS3Service ss, String bucketName, String objectName, File outputFile, byte[] bytes) throws IOException, ServiceException { // Download an object from its name S3Object downloadedObjectNew = TransferServer.downloadObject(ss, bucketName, objectName); OutputStream output = new FileOutputStream(outputFile); InputStream input = downloadedObjectNew.getDataInputStream(); // Write into a local file int read = 0; while ((read = input.read(bytes)) != -1) { output.write(bytes, 0, read); } input.close(); output.flush(); output.close(); }
b86a13a3-c8cc-403d-aedc-9fa3d3bfc166
8
private boolean displayModesMatch(DisplayMode mode1, DisplayMode mode2) { if (mode1.getWidth() != mode2.getWidth() || mode1.getHeight() != mode2.getHeight()) return false; if (mode1.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && mode2.getBitDepth() != DisplayMode.BIT_DEPTH_MULTI && mode1.getBitDepth() != mode2.getBitDepth()) { return false; } if (mode1.getRefreshRate() != DisplayMode.REFRESH_RATE_UNKNOWN && mode2.getRefreshRate() != DisplayMode.REFRESH_RATE_UNKNOWN && mode1.getRefreshRate() != mode2.getRefreshRate()) { return false; } return true; }
46239c3c-9145-4626-984b-3d2f0f85a818
5
private void addItemToHrefs(String href) { if (href.contains("https")) { String properHref = href.replace("https://" + base_url, ""); if (!(temporaryInternalHrefs.contains(properHref))) temporaryInternalHrefs.add((properHref)); } else if (href.contains("#")) { String properHref = href.replace("#", "/#"); if (!(temporaryInternalHrefs.contains(properHref))) temporaryInternalHrefs.add((properHref)); } else if (!(temporaryInternalHrefs.contains(href))) temporaryInternalHrefs.add(href); }