method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
03873ac8-b0d0-4b91-beb9-d40d34b8404c
4
private String runCommand(String cmd, boolean result) { StringBuilder buf = new StringBuilder(); String rt = "-1"; try { Process pos = Runtime.getRuntime().exec(cmd); pos.waitFor(); if (!result) { rt = String.valueOf(pos.exitValue()); ...
50a57feb-b301-42ce-8d71-e220ea75237d
2
@Override public boolean reachesDestination(Packet p) { // TODO Auto-generated method stub Iterator<Edge> edgeIt = p.origin.outgoingConnections.iterator(); EdgeBetEtx e; while(edgeIt.hasNext()){ e = (EdgeBetEtx) edgeIt.next(); if(e.endNode.equals(p.destination)){ etxLink = e.getEtx(); } } d...
56552c96-cd01-42f4-abdd-4099cbd6b90b
0
public String getName() { return name; }
fbb39f17-8656-40ab-8471-2ecbcfe22cb7
4
public boolean isSupported(int secType) { Iterator<Integer> i; for (i = enabledSecTypes.iterator(); i.hasNext();) if ((Integer)i.next() == secType) return true; if (secType == secTypeVeNCrypt) return true; if (secType == secTypeTight) return true; return false; }
30938ce7-fcfa-428e-a3a3-1087a9416e94
1
@Test public void runTestUnreachableCode() throws IOException { InfoflowResults res = analyzeAPKFile("GeneralJava_UnreachableCode.apk"); if (res != null) Assert.assertEquals(0, res.size()); }
e3de224a-dc68-4570-8eec-297624a64bd6
8
public Hashtable<String, Tuple<String, String>> extract_InSentence_naive(LinkedList<Tuple<String, String>> sentence) { Hashtable<String, Tuple<String, String>> relations = new Hashtable<String, Tuple<String, String>>(); for(int i = 0; i < sentence.size(); i++){ String relation = ""; if(voc.containsKey(sentenc...
acb5f56c-afaf-407c-9b85-82fe07c6e642
9
public void attack(String attack_msg){ Debug.println("Entered attack.attack()"); if(conditions ==null){ Debug.println("Conditions is null"); } Debug.println("Number of conditions = " + conditions.size()); if(conditions.size() != 0){ Debug.println("Size != 0"); boolean check = true; for(TriggerCond...
59c9ce46-f80c-4a39-a903-c7e6290ca073
4
private static void encode(String word, OutputStream out) throws UnsupportedEncodingException, IOException { byte bytes[] = word.getBytes("UTF-8"); int len = bytes.length; if (len < 0x80) { out.write(len); } else if (len < 0x4000) { len = len | 0x8000; ...
e9fb0369-b754-4942-af6c-a90ad0b5c22e
0
public PhotoPost(String username, String filename, String caption) { super(username); this.filename = filename; this.caption = caption; }
6f2899a9-0237-48b1-902f-00c657f8da02
2
public void run() { String input; try { while ( (input=reader.readLine()) != null ) { handler.receiveMessage(input); } } catch (IOException e) {} handler.connectionClosed(); }
7e12ed5f-8feb-425a-9072-b073cc6a310b
4
@Override public void shoot(Spieler gegner) { boolean invalidInput = true; String input = null; // Einleseschleife while (invalidInput) { try { input = generateRandomKoordinate(); } catch (Exception e) { e.printStackTrace(); } Koordinate zielKoordinate = eingabe.string2Koord(input); i...
6f3f63eb-8e0b-43fe-a66d-ca1fb57f8767
8
private void construct(VKUserDto user) { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); setBounds(screenSize.width / 3, screenSize.height / 4, 300, 400); setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; ...
8bc91758-852e-47bf-872d-6f9d4519682d
7
public void calculateProbability(){ double denominator = 0; for(int i = 0; i < 16; i++){ for(int j = 0 ; j < 30 ; j++){ denominator += (Math.pow(cPI_.getPointsInformation(i, j).getFeromon(),betha_)); } } double counter; for(int i = 0; i < 16; i++){ for(int j = 0 ; j < 30 ; j++){ counter = ( ...
0a12ed8a-98e2-47a8-b4e2-9f6b5f37d22c
7
private Object getObjectFromInputStream(InputStream in) throws SQLException{ if (in == null){ return null; } ObjectInputStream objIn = null; try { objIn = new ObjectInputStream(new BufferedInputStream(in)); return objIn.readObject(); } catch(IOException e){ throw new SQLException("将Blob类型字段里的...
6d38d2f9-3d4d-43cd-8aec-b9471885d686
9
public int createTeam() throws IOException { File file = new File(repositoryManager.getRobotsDirectory(), teamCreatorOptionsPanel.getTeamPackage().replace('.', File.separatorChar) + teamCreatorOptionsPanel.getTeamNameField().getText() + ".team"); if (file.exists()) { int ok = JOptionPane.showConfirmDial...
a494dbde-bed6-4ae6-9774-e7983b930edb
0
public static void main(String[] args) throws Exception { testWorld = new World(); testWorld.generateRandomContestWorld(); //testWorld.printWorld(); initialiseGUI(); //newTournament(); }
4a717475-3158-4ca5-9832-26cb28649a68
7
private int convertVoltage() { if (ADMUX_reg.isSingleEnded()) { // single ended conversions don't require amplification ADCInput dev = connectedDevices[ADMUX_reg.getSingleIndex()]; float vin = dev != null ? dev.getVoltage() : 0; // TODO: select...
1ac03240-bc3a-400a-98df-955a790a1ee9
1
private Frame readNextFrame() throws BitstreamException { if (framesize == -1) { nextFrame(); } return header; }
326a0772-af9b-40dc-b80d-d76780eddcf8
0
public void setStart(Vertex start) { this.start = start; }
27c87ab9-5eec-4dd5-8d55-347dabfc778b
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://downl...
6c8a9921-6283-4aa7-99aa-541629a56f83
9
@Override public void doAction() { Maze maze = session.getMaze(); for (int i = 0; i < maze.getWidth(); i++){ for (int j = 0; j < maze.getHeight(); j++){ Room room = maze.getRooms().get(i).get(j); if (room != null){ if (!room.isLocked()){ if (maze.getPlayer().getPosition().getRoom() != room){ ...
6a4b99e8-60fb-48e7-8fd5-1468c206baaf
0
public Component getLastComponent(Container container) { return m_Components[m_Components.length - 1]; }
4118d7c5-b708-43b7-9f32-06941e2612db
3
@Override public ArrayList<? extends Object> getOptions() { if (options == null) { options = new ArrayList<Status>(); for (Status s : Status.getAll()) options.add(s); } return options; }
ca21fee6-b200-481e-9f15-8a4072b7d818
0
public String getToolTip() { return "Undoer - Click anywhere in the editor pane after clicking me."; }
d32d9c53-4126-4f08-a6a0-05564c59e38a
1
private void loginBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loginBtnActionPerformed String uName = unameField.getText(); char[] pwd = pwdField.getPassword(); String pwds = new String(pwd); //int[] uDetails = DbAccess.GetUser(uName, pwds); User newUser = DbA...
253f7ecc-ac83-4ef5-8f4e-df140246b6df
5
@Override public void actionPerformed(ActionEvent e) { JButton source = (JButton) e.getSource(); //if (e.getStateChange() == ItemEvent.SELECTED) { list = (map.get(source)); incr++; //} source.setIcon(new javax.swing.ImageIcon(getClass().getResource("/frontend/...
f8317cee-a638-4fd5-9a1e-a0930d61d21d
9
IndexTable(byte[] src, int crc, byte[] digest) { try { ((IndexTable) this).checksum = Class59_Sub1.getChecksum(5126, src.length, src); if(!Client.skipUpdate) { if (crc != ((IndexTable) this).checksum) throw new RuntimeException(); if (digest != null) {...
f4350ce2-bf78-4613-993d-41e2e218b625
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...
ffc36ba1-574a-48f4-b71a-88cf3cc292fa
8
public static List<List<Integer>> zigzagLevelOrder(TreeNode root) { List<List<Integer>> results = new ArrayList<List<Integer>>(); if (root == null) return results; LinkedList<TreeNode> q = new LinkedList<TreeNode>(); q.add(root); boolean left = false; while (!q.isEmpty()) { int size ...
be028163-1684-4a7e-8372-961221d61d16
8
public Tile bestToImprove(City c) { //ArrayList<TileEntity> imprTiles = new ArrayList<TileEntity>(); Tile bestestTile = null; int bestestSum = -1; for (Tile t: c.land) { if (t.improvement != null && t.improvement.name.equals("City")) continue; //Find the best improvement for this individual tile t ...
1e7f31ef-969a-4155-8181-163fca5f9b81
1
private void distribuirEquipos(List<Jugador> jugadores) { equipo1 = new Equipo(); equipo2 = new Equipo(); if (distribucionEquipos == 5) { equipo1.setJugadores(Lists.newArrayList(jugadores.get(0),jugadores.get(2),jugadores.get(4),jugadores.get(6),jugadores.get(8))); equipo2.setJugadores(Lists.newArrayLis...
f01ad7d9-0c01-444f-a84e-0fcd81fc2ab2
8
public Set<String> getFriendlyURLs() { populate(); Set<String> urls = new HashSet<String>(); URL url = null; if (classURL != null) { url = classURL; } else if (propertiesURL != null) { url = propertiesURL; } if (url != null) { String sUrl = url.toString(); String urlNoType = sUrl.substring(0...
f96e6700-9fbc-45fc-a0fc-b1a7f88309ae
3
@Override protected void paintComponent(Graphics g) { if (numLines != -1) { System.out.println("Painting"); if (numLines < currentNumLines) { //We have to clear the grid g.clearRect(0, 0, WIDTH, WIDTH); } int gap = 512/numLines; g.setColor(Color.white); for (int i=0; i < 512; i+= gap) { ...
17425117-dcf8-4f10-b29d-c1b5edaa969a
9
public PedometerData filter(SensorSingleData sensorSingleData) { double x = sensorSingleData.getAccX(); double y = sensorSingleData.getAccY(); double z = sensorSingleData.getAccZ(); checkForPeakX(x); checkForPeakY(y); checkForPeakZ(z); PedometerData pedometerData = new PedometerData( sensorSingleDa...
ac2f2908-6fb3-4903-a18f-2dc43cd2fb55
0
@Override public ProductA factoryA() { return new ProductA1(); }
d98cc4fc-a886-4f15-93f2-10bb1e24b0cc
7
private static int[] createServingBowl(String distPath, int nfruits) throws Exception { double[] dist = new double[12]; int[] bowl = new int[12]; Scanner sc = new Scanner(new File(distPath)); // read the first 11 possibilities for (int i = 0; i < 11; ++i) dis...
bc87af2b-c7d2-4178-beb3-f7bc302c98d4
4
public int compareTo(Object date) { if (date == null) { throw new NullPointerException("用于比较的指定日期对象不能为null。"); } else if (this == date) { return 0; } long diff = calendar.getTimeInMillis() - getTimeOfDate(date); if (diff == 0) return 0; return diff > 0 ? 1 : -1; }
6c438e82-7776-4c98-9581-bed0062eec31
6
@Override public ImplicitMod deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { for (String s : Constants.ESCAPED_MODS) { Pattern p = Pattern.compile(s); Matcher m = p.matcher(jsonElement.getAsString()); ...
13e40a07-9c86-4ff3-b0cc-d1f73e5dc046
6
private void loadFilters() { messageFilterList.clear(); userFilterList.clear(); String line = ""; FileReader fr = null; try { fr = new FileReader(BotCore.FILTERSFILEPATH); } catch (FileNotFoundException e) { e.printStackTrace(); } ...
d48112d8-90c7-4ee7-8251-14edab7f025d
6
public void tableChanged(TableModelEvent e) { // If we're not sorting by anything, just pass the event along. if (!isSorting()) { clearSortingState(); fireTableChanged(e); return; } // If the ta...
bbf1bca0-da70-414e-89e0-1cc92dee56a8
6
public static String removeTemplate(String wikitext, String[] removeName) { if (removeName == null) { String[] array = { "Cite web", "Reflist", "JPN", "Cite journal", "Voice-stub", "Cite book", "声優", "存命人物の出典明記", "Notice", "出典の明記", "記事名の制約", "正確性", "BLP unsourced", "独自研究" }; removeName = array.clone()...
d16ad284-f8e2-4361-bdd2-76c43e611f37
8
private void moveTowardsTarget(int[] theTarget) { if(theTarget[0] < position[0]) { position[0]-=speed; } else if(theTarget[0] > position[0]) { position[0]+=speed; } else { // i.e. direction[0] == x // do nothing, we're on track! } if(theTarget[1] < position[1]) { position[1]-=speed; } else if(th...
4546a434-a34b-4015-b815-00dcc57fe510
4
public String toString() { switch (this) { case USE: return UserInterface.getLang().getString("use"); case INSPECT: return UserInterface.getLang().getString("inspect"); case THROW: return UserInterface.getLang().getString("t...
63a9e2ea-ab01-4dff-9977-b1f425d71224
6
static void begin() throws IOException { final InputStream inputStream = socket.getInputStream(); final OutputStream outputStream = socket.getOutputStream(); final DynamicObjectInputStream in = new DynamicObjectInputStream(inputStream); final ObjectOutputStream out = new ObjectOutputStream(outputStream); ...
db039ec3-df35-41a2-b108-9157eacef513
6
private void gerarPdf(){ try { PdfWriter.getInstance(document, new FileOutputStream("Relatorios\\"+nomePaciente+".pdf")); document.open(); // adicionando um parágrafo no documento Font f = new Font(FontFamily.TIMES_ROMAN, 20, Font.BOLD); Paragraph titulo = new Paragraph(...
15b3949e-e9ae-4b27-a378-d881d05144b8
8
public void cetakLaporan(String pembeli, String telepon){ boolean adaKesalahan = false; Connection cn = null; try{ Class.forName(Koneksi.driver); } catch (Exception ex){ adaKesalahan = true; JOptionPane.showMessageDialog(null,"JDBC Driver tidak ditemukan atau rusak\n"+ex,"...
7248fbb1-6938-4a78-a4c1-ace81215fce3
5
protected void assertEqualsish( Object a, Object b ) { if( a instanceof byte[] && b instanceof byte[] ) { byte[] baa = (byte[])a, bab = (byte[])b; assertEquals( baa.length, bab.length ); for( int i=0; i<baa.length; ++i ) assertEquals(baa[i], bab[i]); } else if( a instanceof Number && b instanceof Number ) ...
08c722e9-edd8-4f8b-bd9e-dbcbf807de0d
0
@Test public void testGetPosition() throws IOException { System.out.println("getPosition"); AntBrain b = new AntBrain("cleverbrain1.brain"); Ant instance = new Ant(b,true,0); int[] result = instance.getPosition(); assertEquals(-1, result[0]); assertEquals(-1,...
6f284fb0-8dff-4da3-89ba-816e5213da79
7
public int crearPregunta(Pregunta p) { try { if (con.isClosed()) { con = bd.conexion(); } String consulta; Object ob = null; if (p.getDespuesDePregunta().getCodigo() != 0) { ob = p.getDespuesDePregunta().getCodigo(); ...
0af55fc0-ade5-4a2a-a016-b1d8835a7541
7
private void formMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMousePressed if (evt.isPopupTrigger()) { byte c = (byte) getCountryAt(evt.getPoint()); if (c != -1 && me.equals(board.countries[c].owner)) { if (selectedCountry != -1 && board.countries[selectedCountry].armies > 1 ...
eb503856-ebf6-452c-bc03-933368125086
6
public void Affichage(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // Dessin du serpent for (Case c : this.listeCasesSerpent) { ...
2490a872-52e7-4b8b-98a8-1b0e45fe28a8
3
@SuppressWarnings("unchecked") public <T extends Sprite> T[] getAllOf(Class<? extends T> clazz) { List<T> objs = JavaHelp.newArrayList(); for (int i = 0; i < size(); i++) { Sprite s = get(i); if (s.getClass().isAssignableFrom(clazz)) { objs.add(clazz.cast(s)); } } return objs.toArray((T[]) A...
a976463c-3017-4429-bcd1-163bd423ae01
0
public static void main(String[] args) { new BatchOS(); }
18ee996c-82ad-4539-92a6-4f20f93bcfb8
3
public BufferedImage getImage() throws IOException, IllegalArgumentException { BufferedImage leftTool = null, rightTool = null; //Note that some of this code currently shows up as dead, //but is necessary if reducing ABILITIES_PER_UNIT is to be possible. if (abilities.size() > 1) { leftTool = ImageLoader.ge...
87a42046-fd50-46f8-a3bc-f09578713dcc
6
public void mouseClicked(MouseEvent e) { int x = e.getX(); int y = e.getY(); // Find the Agent they've clicked on. for (int i = 0; i < agents.size(); i++) { Agent agent = (Agent)agents.elementAt(i); int agentX = 0; ...
27e75547-8bed-428a-a6aa-635b036d511f
4
@Override protected long onFill() { // This algorithm will ensure each stack of buffers is taking up the // same amount of memory. So a stack for 128 will have 2 buffers // for every buffer on a stack for 256. I figure even distribution of // the current memory usage is a fair algorithm to fill the cache. ...
74dd866f-de9a-4a0f-99c4-8e1bc7ea8fd6
6
private static boolean modifyEmployee(Employee bean, PreparedStatement stmt, String field) throws SQLException{ String sql = "UPDATE employees SET "+field+"= ? WHERE username = ?"; stmt = conn.prepareStatement(sql); if(field.toLowerCase().equals("pass")) stmt.setString(1, bean.getPass()); else if(field...
6fd20ab4-a907-46bc-88b0-961c21891eb0
8
public static int search(int a[], int target) { int l=0, u=a.length-1; while (l <= u) { int m = l + (u-l)/2; // different from book's "(l+u)/2": to prevent overflow if (target == a[m]) { return m; } else if (target < a[m]) { // normal if (target >= a[l] || a[l] >= a[m]) { u = m-1; }...
18d482fd-b298-488f-8b6b-25062eafbe7a
3
@Override public void callLogOut(String username) { Service service = new Service(); Call call; try { call = (Call)service.createCall(); Object[] inParams = new Object[]{username}; call.setTargetEndpointAddress(new URL(SERVICES_URL)); call.setTargetEndpointAddress(SERVICES_URL); call.setOp...
fc484cc5-44d4-4955-b1fa-f152ee5a0f76
9
public static void radixSortVarLengthMsd( String []words, int maxLen ) { java.util.List<java.util.List<String>> lengthBuckets = new ArrayList<java.util.List<String>>(); for (int i = 0; i < words.length; i++) lengthBuckets.add(new ArrayList<String>()); // create buckets for each l...
d44a62f4-98f4-4578-8d94-5913a20d8831
2
public void close() { if (myFileName == null) return; try { myInFile.close(); } catch (IOException e) { e.printStackTrace(); } setConsoleReader(); }
e571b70c-d140-4d1e-9f39-ed953cdf7305
5
@Test public void getOverflowCount() { ChainingHashSet test = new ChainingHashSet(10); try { test.getOverflowCount(0); } catch (Exception e) { fail("Unexpected Exception"); } try { test.insert(23); test.insert(55); test.insert(10); test.insert(33); test.insert(65); test.insert(20); ...
de3418c2-e665-4075-8fc8-17042bc56f76
7
public boolean isEmpty() { if (!isPruned()) { for (Object child : this.children) { if (child instanceof TagNode) { if (!((TagNode) child).isPruned()) { return false; } } else if (child instanceof ContentN...
8d75f911-9467-4d17-be29-9fea7bdbb250
9
static final public MInsert InsertStatement() throws ParseException { MInsert ins; String s; Vector v; MQuery q; jj_consume_token(K_INSERT); jj_consume_token(K_INTO); s = TableReference(); ins = new MInsert(s); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { ...
ab502461-e079-49e1-b6f6-a5c56612f8c6
9
static boolean matchA(String str, String pat, String matches[]) { int i = 0; // move through str int j = 0; // move through matches int pos = 0; // move through pat while (pos < pat.length() && j < matches.length) { char p = pat.charAt(pos); if (p ...
1e93e3bc-8c45-40e5-8073-a7cde562ef84
7
@Override public void drawGui() { super.drawGui(); if (this.dice != null) { this.dice.button.disabled = true; this.dice.drawGui(); this.dice.button.disabled = false; } if (this.countdown > 0) { if (this.countdown == 1) { if (this.count > 0) { this.player.position++; this...
f930c769-55df-49bf-b2e1-4733e29c1727
9
public static void reactToSkolemValueUpdate(Skolem skolem, Stella_Object oldvalue, Stella_Object newvalue, boolean toplevelupdateP) { { Proposition proposition = skolem.definingProposition; if (toplevelupdateP && Proposition.nativeSlotPropositionP(proposition)) { { Relation slot = Logic.get...
b767e9a3-a9aa-49a4-8572-23ee4f53f323
5
protected TiledWorld() { super("tiled world"); // Populate our tiles tiles = new Tile[tileWeights[0].length][tileWeights.length]; for (int y = 0; y < tileWeights.length; y++) { for (int x = 0; x < tileWeights[0].length; x++) { /** * NOTE :: Try to choose tile weights which don't actually ...
6eb14830-b637-4aaf-bff2-e079cf72f08a
5
@Override public void adjust() { boolean enable = false; Component comp = getFocusOwner(); if (comp instanceof JTextComponent && comp.isEnabled()) { JTextComponent textComp = (JTextComponent) comp; if (textComp.isEditable()) { try { enable = comp.getToolkit().getSystemClipboard().isDataFlavorAvail...
9c5f9ab0-803a-497a-82ad-b02af0c0bb04
3
private boolean charIsWhitespace() throws EOSReachedException { char c = this.getChar(); return c == ' ' || c == '\n' || c == '\t' || c == '\r'; }
1cffe558-a393-4ea7-b0fe-d48ee32ff9eb
0
public void reset() { mySlider.setMaximum(START_MAX); setVal(0); setText(""); myLengthDisplay.setText(""); }
4b75e5c6-dc71-4496-8c27-e80ab8db9d4d
5
Class326(GameMode class230, int i, IndexLoader class45) { do { try { aClass45_4085 = class45; if (aClass45_4085 == null) break; aClass45_4085.getAmountChildEntries(11); } catch (RuntimeException runtimeexception) { throw Class348_Sub17.method2929(runtimeexception, ("dc.<init>(" + (...
ce27921f-61ac-4563-9e9a-de08b609aba8
3
public void onCommand(CommandSender sender, ChunkyCommand command, String label, String[] args) { String worldName = null; if (args.length < 1) { if (!(sender instanceof Player)) { Language.IN_GAME_ONLY.bad(sender); return; } worldName ...
ecf651e7-05ce-4512-bdac-3e32344aa677
2
private Result getMatchingResult(Object match) { for(Result sr : results) { if(sr.getValue().equals(match)) { return sr; } } return null; }
d531c141-21e5-464c-b8e8-fd7ac9bf2c47
2
@Override public void drop(DropTargetDropEvent event) { if (mDragState != null) { event.acceptDrop(event.getDropAction()); mDropReceived = true; event.dropComplete(mDragState.drop(event)); } else if (mAlternateDragDestination != null) { UIUtilities.convertPoint(event.getLocation(), this, mAlternateDrag...
5294c00f-b796-40e3-ba0e-26ab78681d9f
2
public void play() { //se sale si el sonido no a sido cargado if (!isLoaded()) return; //vuelve a empezar el sound clip clip.setFramePosition(0); //Reproduce el sonido con repeticion opcional. if (looping) clip.loop(Clip.LOOP_CONTINUOUSLY); else clip.loop(repeat); }
188b889a-7e1e-4dd4-8622-55c7509cdcc9
7
public void actionPerformed(ActionEvent arg0) { if (arg0.getSource() == addUrgency) { AddUrgency frame = new AddUrgency(this); } if (arg0.getSource() == deleteUrgency) { if (this.list.getSelectedIndex() != -1) this.listObj.remove(this.list.getSelectedIndex()); this.list.updateUI(); } ...
585fe70c-02d9-4928-b7d5-a7d84b88f418
2
private synchronized void updateMissiles() { //If any player missiles exist then check if it is outside the screen if(missile1.getEntityCount() > 0 && missile1.getEntity(0).getY() < -12) {missile1.removeEntity(0);} drawMissiles(); }
b6cff099-d115-4052-82e9-b8c7d11290d9
1
public boolean isIPAddress(String addr) { Pattern p = Pattern.compile(IPV4_PATTERN); Matcher m = p.matcher(addr); boolean isIP = false; if (m.find()) { isIP = true; } return isIP; }
b0c11d84-6ba5-4045-bb66-5aac85036971
1
private void btnVerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVerActionPerformed if(tablaProd.getSelectedRow()==-1){ JOptionPane.showMessageDialog(null, "No hay productoseleccionado."); }else{ p = productos.get(tablaProd.getSelectedRow()); t...
7926d048-fce7-4e8e-8dc4-385d797cc4e8
9
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((date == null) ? 0 : date.hashCode()); result = prime * result + ((dueDate == null) ? 0 : dueDate.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + ((isC...
f0bdd2f9-200b-4c6c-9652-93cb45677d4f
1
protected Integer calcBPB_NumFATs() throws UnsupportedEncodingException { byte[] bTemp = new byte[1]; for (int i = 16;i < 17; i++) { bTemp[i-16] = imageBytes[i]; } BPB_NumFATs = byteArrayToInt(bTemp); System.out.println("BPB_NumFATs = " + BPB_NumFATs); return ...
2b89b4eb-c741-4398-b1c6-5a794626e2d2
2
@SuppressWarnings("unchecked") ArrayList new62() /* reduce ANonTerminal$Exprest */ { @SuppressWarnings("hiding") ArrayList nodeList = new ArrayList(); @SuppressWarnings("unused") ArrayList nodeArrayList2 = pop(); @SuppressWarnings("unused") ArrayList nodeArrayList1 = pop(); Link...
337d4599-99ab-4056-acbf-24cbf4eee348
8
public static boolean iterate(int level) { if(level > max) { max = level; } int size = list.size(); for(int i=0; i<size; i++) { int cur = list.get(0); list.remove(0); for(int k=0; k<n+1; k++) { if((graph[cur].contains(k) && k!= cur) && seen[k]==false) { seen[k] = true; list.add(k); ...
cb5d5d61-2d12-4c10-9aa1-6d862f84f765
5
public int getMinimum() { int res = -1; int min = -1; for (int i = 0; i < result.length; i++) { if (result[i] != -1 && visited[i] != 1 && (result[i] < min || min == -1)) { min = result[i]; res = i; } } return res; }
d58b33ab-e269-49e8-84b4-a2e9eed99f36
1
@Override public void actionPerformed(ActionEvent e) { if(e.getSource().equals(button)) { SensorList.this.dispose(); } }
cd6f2781-99f2-4db9-bf85-49cf5a195f27
5
public String toString() { String str = ""; for (int i = 0; i < dim; i++) { for (int j = 0; j < dim; j++) { if (i == j + 1) str += lower[j] + "\t"; else if (i == j) str += diag[i] + "\t"; else if (i == j - 1) str += upper[i] + "\t"; else str += "-\t"; } str += "\n"; } ...
4e5cbb71-e38b-4820-9c4a-169d5bce2d6c
9
static private String chooseSegment(String ns) { int off = ns.indexOf('#'); if (off >= 0) { String segment = ns.substring(off + 1).toLowerCase(); if (Naming.isNcname(segment)) return segment; } else off = ns.length(); for (;;) { int i = ns.lastIndexOf('/', off - 1); ...
d2c83984-b26e-4575-a04f-316031a7464d
9
private final synchronized void closeMergeReaders(MergePolicy.OneMerge merge, boolean suppressExceptions) throws IOException { final int numSegments = merge.readers.size(); Throwable th = null; boolean drop = !suppressExceptions; for (int i = 0; i < numSegments; i++) { final SegmentReader sr...
635f899a-6d05-47a5-96b1-0bd26cb264f8
9
@Override public void actionPerformed(ActionEvent arg0) { String btn = arg0.getActionCommand(); if (btn == "Send") { new Send(txtField.getText()); txtField.setText(""); } if (btn == "Config") { if (configToggled) { Retract(); configToggled = false; } else { Extend(); configTog...
11c8a155-1a44-4a7e-877c-775be6cd4b38
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...
c707a930-ba0f-43fd-acb4-bc48dbe1d1c7
9
private static final LookupTableJAI createContrastLUT(float K, int numBands) { byte[] contrastTable = new byte[256]; double p = 0.43F; // Generate the LUT to be applied to the color band(s). for(int i = 0; i < 256; i++) { ...
be242932-20e2-4616-9a8e-7a049443b2f6
6
private void addUnits(final HashMap<UnitType, Suggestion> suggestions, List<UnitType> have, Colony colony, int grow) { final String action = colony.getId(); final ImageLibrary lib = getGUI().getImageLibrary(); String layout = (suggestions.size() <= 1) ? null ...
88a5739a-458f-4afb-8545-90999d22a251
7
private Object readJSON() throws JSONException { switch (read(3)) { case zipObject: return readObject(); case zipArrayString: return readArray(true); case zipArrayValue: return readArray(false); case zipEmptyObject: ...
383aac24-f3ae-4a8b-b29b-65b16a525932
2
public String getOrdernumberByCarnumberAndPhonenumber(Statement statement,String carnumber,String phonenumber)//根据预定手机号和车牌号查找订单 { String result = null; sql = "select ordernumber from ParkRelation where carnumber = '" + carnumber +"' and phonenumber = "+phonenumber+"'"; try { ResultSet rs = statement.execut...
30264208-59e0-4daa-a005-f7158833ad00
4
public static Matrix multiply(Matrix x, Matrix y) { if (x.col != y.row) return null; Double[][] mat = new Double[x.row][y.col]; for (int i = 0; i < x.row; i++) { for (int j = 0; j < y.col; j++) { Double sum = 0.0; for (int k = 0; k < x.col; k++) { sum += x.matrix[i][k] * y.matrix[k][...
560fca28-d26a-4203-8e39-d9e736d9a6c6
0
public void setLuck(double luck) { this.luck = luck; }
0941818a-3b1a-4051-9ea0-1fd3526da95d
9
public static void ShellSort(int Index) { int i, j, k; // 循环计数变量 int Temp; // 暂存变量 boolean Change; // 数据是否改变 int DataLength; // 分割集合的间隔长度 int Pointer; // 进行处理的位置 DataLength = (int) Index / 2; // 初始集合间隔长度 while (DataLength != 0) // 数列仍可进行分割 { // 对各个集合进行处理 for (j = DataLength; j < Index; j++) { ...
dfa9290e-a4e6-417c-ab0c-c4e389cb8bc9
8
@Override protected void prepare() { SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy"); Sheet sh = wb.createSheet(); sh.setColumnWidth(0, 256*5); sh.setColumnWidth(1, 256*30); sh.setColumnWidth(2, 256*15); sh.setColumnWidth(3, 256*10); // Созд...
eaeb1db3-66bc-44bd-8cb7-4118a39cced3
7
public boolean setTileNoUpdate(int x, int y, int z, int side) { if (x >= 0 && y >= 0 && z >= 0 && x < width && y < height && z < length) { if (side == blocks[(y * length + z) * width + x]) { return false; } else { blocks[(y * length + z) * width + x] = (by...