method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
a43004fb-b441-4b77-9179-207d36ea8db3
5
private void button3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_button3MouseClicked if(numberofpins < 4) { if(numberofpins == 0) { Login_form.setString1("2"); } if(numberofpins == 1) { Login_form.setString2("2"); } if(numberofpins == 2) { Login_...
b707ea8d-ebea-4467-a05f-d7e66c03eed4
1
public void makeActive() { active = true; if (!generated) { generate(); } }
b7b1f6eb-f5fa-4137-86f7-1259db907c5e
9
public void ColorierCase(int etat){ // définit le fond d'une case en fonction de son etat switch(etat){ case(0): this.setBackground(Color.BLACK); break; case(1): this.setBackground(Color.BLUE); break; case(2): ...
6fbda2ba-843f-459e-83e5-de4e4e655076
9
public static void main(String args[]) throws Exception { try { int depth=Integer.parseInt(args[2]); //int depth=3; FileReader in = new FileReader(args[0]); BufferedReader br = new BufferedReader(in); String test=br.readLine(); FileWriter out = new FileWriter(args[1]); BufferedWriter writ...
2b725a6e-ec75-41bc-a44b-8c51a781e29e
6
public static double getDouble(String prompt, double low, double high) { final int ALLOWABLE_INPUT_FAILURES = 3; // Avoid leaving a user stuck in here infinitely. If they fail to enter an int after 3 tries, bail out anyway. String response; int inputFailureCount = 0; while (true) { // use an infinite loop. Exit...
2cbb0833-a335-4fd2-b01f-c7362f024965
6
public void testCycLeaseManager() { System.out.println("\n**** testCycLeaseManager ****"); CycAccess cycAccess = null; try { try { if (connectionMode == LOCAL_CYC_CONNECTION) { cycAccess = new CycAccess(testHostName, testBasePort); cycAccess.getCycLeaseManager().addListene...
47b6c567-b017-4661-a4e1-af4e20f087e0
4
public Combo_Box_Remove_Group() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { //MAIN FRAME super("Team J's Scheduler Remove Group"); setBounds(50,50,500,300); setResizable(false); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setLayout(null); setVis...
63f66875-102a-4c4c-a85c-18cc92ede4a6
8
public void generateDoorObs(){ if (entrance.getX() == pos.getX()) { obsList.add(new Entrance(entrance,0.1f,doorSize,10f,MATERIALS.DOOR___SOLID_WOOD_PANELS)); }else if (entrance.getX() == pos.getX() + dx) { obsList.add(new Entrance(new Point(entrance.getX() - 0.1f,entrance.getY(), entrance.getZ()),0.1f,doorSiz...
2a0c735f-c3ee-48e6-8d05-8f5a7853d95e
3
protected synchronized void cleanup() { try { if(toAppStream != null) toAppStream.close(); if(toNetStream != null) toNetStream.close(); toAppStream = null; toNetStream = null; } catch (IOException tExc) { // ignore exception } toAppBuffer = null; }
560e09f7-6712-4c24-9da0-b1050b581a59
7
public void setOptions (String[] options) throws Exception { String optionString; resetOptions(); optionString = Utils.getOption('R', options); if (optionString.length() != 0) { setRaceType(new SelectedTag(Integer.parseInt(optionString), TAGS_SELECTION));...
72262367-df08-43d0-9047-99696ff64513
7
protected synchronized void imdct(final float[] frq, final float[] window, final int[] pcm) {//, float[] out){ float[] in=frq;//, out=buf; if(_x.length<n/2){_x=new float[n/2];} if(_w.length<n/2){_w=new float[n/2];} final float[] x=_x; final float[] w=_w; int n2=n>>1; int n4=n>...
1c48f1a2-c189-41d2-8855-e2277d5eb1a4
0
@Override public void setPattern(String pattern) { this.pattern = pattern; }
bb484714-1f1c-4bb2-8903-4be2d7e660d4
1
void post(int round, Data step) { for (int i = round + 1; i < r.length; i++) { Data.copyParamValues(step, r[i]); } }
e495c95a-e4d5-4cae-ba21-2a1240478b6a
0
public void sendStatus(String status) { OSCMessage message1 = new OSCMessage("/ch/status"); message1.addArgument(status); send(message1); }
618a42e9-a9fc-45d2-bef8-95688c546112
5
private void cargar_Campos (int cta){ try{ this.vaciarCampos(); r_con.Connection(); PreparedStatement pstm = r_con.getConn().prepareStatement( "SELECT *" + "FROM Cuentas "+ "WHERE Cta_Nro = "+cta); ...
96dd4498-664a-464e-92ab-d19c58b27993
7
public boolean getBoolean(String key) throws JSONException { Object o = get(key); if(o==null) return false; if (o.equals(Boolean.FALSE) || (o instanceof String && ((String)o).equalsIgnoreCase("false"))) { return false; } else if (o.equals(Bool...
9e4cd58b-69fe-44ea-aeb6-5abb19b365f4
1
public int delete(int id) { try { Statement s = StatusController.connection.createStatement(); String sql = "delete from stock where productId=" + id; s.executeUpdate(sql); return 1; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return -1; }
9a30d805-9dfd-45ab-a9a7-c722c44a3837
6
public void render(Graphics2D graphics, Model model, GroundItem ground, Color color) { if (model == null || !model.isValid()) return; Vec3[][] vectors = model.getVectors(); graphics.setColor(color); int gx = (ground.getLocation().getGx() << 7) + 64; int gy = (ground.getLocation().getGy() << 7) + 64; for (...
93f53cf3-3082-4c50-9e54-0f533d1e5744
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ReferenceType other = (ReferenceType) obj; if (this.javaType != other.javaType && (this.javaType == null ...
2392504c-8b58-4b1a-b85a-8a6e0dc9f73b
5
@Override public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { if (qName.equals("rowset")) { String name = getString(attrs, "name"); inAttackers = name.equals("attackers"); inItems = name.equals("items"); } if (qName.equals("row")) { if (inAt...
e216c14e-89c0-4f79-ad1c-098f9b4f1d4d
2
public void limpiarTabla(){ try { DefaultTableModel modelo=(DefaultTableModel) tablaProd.getModel(); int filas=tablaProd.getRowCount(); for (int i = 0;filas>i; i++) { modelo.removeRow(0); } } catch (Exception e) { JOptionPane.sh...
17b1a9bc-01f6-4978-9f21-ecaeba4cec5d
7
public static void main(String[] args) throws Exception { JobConf conf; if (args.length < 4) { System.err.println("Invalid number of arguments."); System.err.println("Usage: BuildAndComparePages <old pages dir> <new pages dir> <number of chunks> <chunk size>"); System.out.println("Output is placed on...
e6aead85-9ea4-4f30-9a64-7ee1cb36054e
8
public static boolean validateHandshake(byte[] recieved_handshake,byte[] info_hash, byte[] peer_id){ for(int i=0;i< peer_id.length;i++){ System.out.print(peer_id[i]); } //Check if the message is the correct size if(recieved_handshake.length != 68 ){ System.err.println("validateHandshake, length"); r...
9dedfde8-eddc-4789-bcfd-23c5fa1930d3
7
@Override @SuppressWarnings("empty-statement") public void run() { System.setProperty("line.separator", "\r\n"); try { InputStream in = socket.getInputStream(); String req = getLine(in); if (req.length() < 38) { throw new RuntimeExcept...
8e635ab2-4805-4cc3-9259-14a46adb3e0c
9
public void patientForm(JPanel ptPane, int loggedId){ // for welcome label StringBuffer loggedUser = new StringBuffer(); JTextPane tpLoggedStaff = new JTextPane(); for(int i = 0; i < staff.size(); i++){ if (staff.get(i).getId() == loggedId){ loggedUser.append...
97cbbd49-a582-4443-a37a-f6b015ddcfdc
6
public static void main(String[] args) { if (args.length == 0) { System.err.println("Usage: MainStarter class class [...]"); } Class[] typeParams = { args.getClass() }; for (final String clazz : args) { try { final Class<?> c = Class.forName(clazz); final Method m = c.getMethod("main", typeParams...
43e20072-4ead-48b3-9076-aa888202c50b
5
public int set_halffloat(float fpin, int offset) { // converts float to half precision with proper rounding float absfpin, signfpin; int signbit, n, man,e, halfExponent; //System.out.println("conversion constants " + HALF_MXMAG + " " + HALF_NOMRTRIG + " " + HALF_NORMFACTOR); ...
544d1a84-6361-44a7-adbd-e5f074794d48
9
private boolean iscontainsDuplicate(int[] nums, int i, int j) { int length = j - i + 1; if (length == 1) return false; if (length == 2 && nums[i] == nums[j]) return true; if (length == 2 && nums[i] != nums[j]) return false; int mid = (i + j) / 2; HashSet<Integer> set = new HashSet<>(); for (int k...
40a8626c-61ec-46e3-8cc9-edf7927f7d68
6
public String getDescription(String subject) {if (subject.equals("look")) {return myDescriptions[0];} else if (subject.equals("look detail")) {return myDescriptions[1];} else if (subject.equals("East")) {return myDescriptions[2];} else if (subject.equals("South")) {return myDescriptions[3];} else if (subje...
f1864020-4d65-45b1-a491-2b594e123517
7
public static int discrete(double[] a) { double EPSILON = 1E-14; double sum = 0.0; for (int i = 0; i < a.length; i++) { if (a[i] < 0.0) throw new IllegalArgumentException("array entry " + i + " is negative: " + a[i]); sum = sum + a[i]; } if (sum > 1.0 + EP...
6804eaea-0a64-4aa3-811a-4c4df83a5240
0
@RequestMapping({"home"}) public String home() { return "home"; }
afa1be72-4d9b-46b0-b2c8-8ff7a9b6203c
9
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: boolean validacion = true; String codigo_act = codigo_cama_editar.getText(); String area,descripcion,estado; int costo; ...
a883a8f1-1034-492b-b697-284cd7b86682
6
public void messageReceived(Client source, Message m) { if (m instanceof PingMessage) { PingMessage pm = (PingMessage) m; if (pm.isFromServer()) { this.ping = pm.getPing(); } } if (m instanceof ServerSummarizeMessage) { ServerS...
d203ffeb-b5c6-44e4-be6e-2afd74a6c340
8
public void reinicia() { //sonido = true; //tema = new SoundClip("Sounds/Breaking_Bad.wav"); //explosion = new SoundClip("Sounds/e.wav"); theme.play(); cont = 0; vidas = 3; score = 0; setSize(1000, 800); // addKeyListener(this); posX = 253;...
2d958551-5553-43a7-b601-b370aabf8381
4
static String getJavaPathUserMessage(final typeOS os) { if (os.equals(typeOS.WINDOWS)) { if (System.getProperty("os.arch").contentEquals("x86")) { Logger.getLogger(Tools.class.getName()).log(Level.INFO, "We are on x32 Java"); return "Windows x32 Java: You need to sele...
b22c031e-db05-435f-b77f-390e10134dbf
3
private void acceptButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_acceptButtonActionPerformed if(modCliente == null){ try{ taller.crearCliente(nameText.getText(),dniText.getText(), dirText.getText(),tlfText.getText(), ...
939f4932-a824-4534-b255-4c03223c7140
1
@Override public List<Integer> save(List<Role> beans, GenericSaveQuery saveGeneric, Connection conn) throws DaoQueryException { try { return saveGeneric.sendQuery(SAVE_QUERY, conn, Params.fill(beans, (Role bean) -> { Object[] objects = new Object[1]; objects[0] = ...
c47e14c3-5c8a-4ec4-9f3f-b6415a5ca2a3
8
@EventHandler(priority = EventPriority.NORMAL) public void onBlockBreak(final BlockBreakEvent event) { if (!event.isCancelled()) { final Material material = event.getBlock().getType(); if (material.equals(Material.WALL_SIGN) || material.equals(Material.SIGN) || material.equals(Material.SIGN_POST)) { f...
b0f5db4f-bb50-416f-8711-54bdd87ebbc4
3
@Override public Class getColumnClass(int column) { Class returnValue; if ((column >= 0) && (column < getColumnCount())) { if (getValueAt(0, column) == null) { return String.class; } returnValue = getValueAt(0, column).getClass(); } else { ...
b5645623-3e8f-47e5-9778-589ea06ef058
0
public void setTableFiledName(String tableFiledName) { this.tableFiledName = tableFiledName; }
ecb4a5e3-2c88-41d6-82b1-59c4f37a47f0
0
public static void main(String[] args) { }
ad513a77-ddb4-4575-ad75-3edd0bfd54c7
5
*/ public void addPlayer (String nom){ if (!this.players.contains(nom)){ this.players.add(nom); try { this.sauverPlayers(); }catch (Exception e){JOptionPane.showMessageDialog(null, e.getMessage(), "avertissement", JOptionPane.WARNING_MESSAGE);} } this.setNom(nom); for (int i=0; i<Constants.levels....
87b6c1bb-f258-4059-b5e7-404c41ee9665
5
public static String toString(long version, boolean includeQualifier) { StringBuilder buffer = new StringBuilder(); buffer.append(getMajor(version)); buffer.append('.'); buffer.append(getMinor(version)); int bugFix = getBugFix(version); long qualifier = getQualifier(version); if (bugFix != 0 || includeQua...
7dc638d4-c128-4f84-9738-0c3e6204b901
3
public boolean contains(Coordinate coord) { return coord.getCol() >= 0 && coord.getCol() < NUMBER_OF_COLS && coord.getRow() >= 0 && coord.getRow() < NUMBER_OF_ROWS; }
457cdb03-9e55-423b-816e-794ec98bfb6c
4
public void calcForce() { for(Physics p: simulators) { if(p instanceof PhysicsGravity) { MassObject3D mo; arguments = new double[sourceGravity[numObjs]]; dist = new SimpleVector[sourceGravity[numObjs]]; for(int j = 0; j < sourceGravity[numObjs]; j++) { mo = (MassObject3D)objects.get(sourceGrav...
6ee363b0-82a8-4a84-bde8-07fd3ad87cd8
4
@SuppressWarnings("unused") public ConstructAction onReceivedKeyEvent(KeyEvent e, boolean isTyping) { if(isTyping) { // Parse this as a long String pendingLiteral = (this.literal + e.getKeyChar()).toLowerCase(); if(pendingLiteral.contains("d") || pendingLiteral.contains("f")) { return ConstructAction.C...
a3794edb-f0d4-4ce3-b84d-e036bf2836a0
9
public void paintTriangle(Graphics g, int x, int y, int size) { Color oldColor = g.getColor(); int mid, i, j; j = 0; size = Math.max(size, 2); mid = (size / 2) - 1; Color enabledColor = AbstractLookAndFeel.getTheme().getButtonForegroundColor(); ...
d992dce4-7b69-4a18-b770-5d10f76901a9
7
public void actionPerformed(ActionEvent e) { if (e.getSource() == btnInserisci || e.getSource() == txtInserisci) { if (txtInserisci.getText().equals("")) { JOptionPane.showMessageDialog(null, "Inserire un valore intero!"); return; } int val; try { val = Integer.parseInt(txtInserisci.ge...
d87051af-c79a-4ae2-8bfd-78bb6f899ea5
0
public Iterator<Item> iterator() { return new ListIterator<Item>(first); }
f7a767d4-3151-4c0b-b795-a6b3f016c168
0
public int getTermFrequency() { return termFrequency; }
0a6236e6-918d-41eb-b9b4-5c7c6f7aa1e5
2
@Override public FileVisitResult postVisitDirectory(Path dir, IOException exception) throws IOException { if (exception != null) { Log.error(exception); } if (!dir.equals(mPath)) { Files.delete(dir); } return FileVisitResult.CONTINUE; }
5e462511-cad1-4ddc-a4b5-5bbb089e8465
5
public static void main(String[] args) { if (args.length == 3) { try { int version = Integer.parseInt(args[0]); int threads = Integer.parseInt(args[1]); int size = Integer.parseInt(args[2]); switch (version) { case 1: ...
ac4e182f-98da-4fd2-9f98-bc416e042722
9
@Override public void trainOnInstanceImpl(Instance inst) { boolean Change = false; for (int i = 0; i < this.ensemble.length; i++) { int k = MiscUtils.poisson(1.0, this.classifierRandom); if (k > 0) { Instance weightedInst = (Instance) inst.copy(); ...
ab1a82d4-d99c-4db3-b0e7-13c8d125e101
0
public Paladin() { super(new Gospel(), new HolyCrossAttack(), new Sacrifice(), 90.0, 40.0, 0, 30.0, 80.0, 80.0, "Paladin",300,150); } // End DVC
ce6760d1-03da-4871-bdd6-b77f08f89776
1
public DataStructures deleteData(int index){ DataStructures array = arraysBase.remove(index); if(array != null) return array; else return null; }
f20d8e98-0a48-4f73-8eac-913c5f1440b6
3
public int reverse(int x) { boolean negative = x < 0; if (negative) x = -x; int result = 0; while (x > 0) { int digit = x % 10; x = x / 10; result = result * 10 + digit; } return negative ? -result : result; }
86b09fee-695c-45fc-a700-644df7ef83d6
9
public boolean controleType(){ int a,b, op = 0; b = pileOperandes.pop(); op = pileOperateurs.pop(); a = pileOperandes.pop(); if ((a == BOOLEEN) &&( b == BOOLEEN)) { if (estOperateurEg(op) || estOperateurLogique(op)){ pileOperandes.push(BOOLEEN); return true; } else { pile...
21d171dd-f1e9-4eb7-9202-99a1e97ad4eb
2
public Object opt(int index) { return (index < 0 || index >= this.length()) ? null : this.myArrayList.get(index); }
1877f8f2-a4ab-4d89-ae9e-4ffffc92de21
3
public void legalMove(Peg a, Peg b) { int diskOnA; int diskOnB; // get the top disk from the Peg a try { diskOnA = a.disks.peek(); } catch (EmptyStackException ex) { diskOnA = -1; } // get the top disk from the Peg b try {...
d9c9287b-7001-405b-a8e7-92239fc0ab3e
6
public int setup(String arg, ImagePlus imp) { int i; ImageStatistics stats; stats=imp.getStatistics(); if (IJ.versionLessThan("1.31l")){ IJ.error("Needs ImageJ 1.31l or newer."); return DONE; } if (stats.histogram[0]+stats.histogram[255]!=stats.pixelCount){ IJ.error("8-bit binary image (0 a...
2e213d8f-2b18-4635-bda4-d80e315733cd
8
static ArrayList<Sunscreen> sortSunscreens(ArrayList<Sunscreen> sunscreens) { if (sunscreens.size() <= 1) return sunscreens; int mid = sunscreens.size()/2; ArrayList<Sunscreen> sunscreens1 = new ArrayList<Sunscreen>(); ArrayList<Sunscreen> sunscreens2 = new ArrayList<Sunscreen>(); for (int i = 0; i < mid;...
048bd205-9181-43ed-9cc3-3ec55b132f7d
0
public void setRegex(String validationRegex) { this.validationRegex = validationRegex; }
6b3143c1-bb9e-4594-9ed7-b38098588636
1
public void clearAllMessages(){ if(messages.size() > 0){ Debug.warn("Message inbox of " + username + " contained " + messages.size() + " extra messages, discarding..."); } messages.clear(); }
fb490429-aa45-47ec-a4c7-03f1322fd192
0
public static void main(String[] args) { char c = '中'; char g = '国'; String f = null; System.out.println("Hello " + c + g + f); testA(-3); }
a45fd27d-ef3e-4610-b94f-263905240ed4
5
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AuftragsNr that = (AuftragsNr) o; if (n != null ? !n.equals(that.n) : that.n != null) return false; return true; }
d6f3efde-1ef1-4eb5-9010-39d20e9d4e23
4
private LinkedList<Proveedor> combinarServicios(LinkedList<Proveedor> proveedoresDePrimerServicio, LinkedList<Proveedor> proveedoresDeSegundoServicio) { for (Proveedor unProveedor : proveedoresDePrimerServicio) { for (Proveedor otroProveedor : proveedoresDeSegundoServicio) { ...
07f21da6-697c-43df-9fc5-852461a8680d
4
public void render(GameContainer gc, StateBasedGame arg1, Graphics g) throws SlickException { Input input = gc.getInput(); Vector2 mousePos = new Vector2(input.getMouseX(), input.getMouseY()); Vector2 paintPos = GridGraphicTranslator.PixelsToGridPixels(mousePos); camera.centerOn((int)player.getPixelPos...
c78145b4-afbd-435c-8199-16c0d1bff361
3
public static ConnectionDetails fromServer(Server server) { ConnectionDetails cd = new ConnectionDetails(); cd.address = server.get("address"); String port = server.get("port"); if ( !port.isEmpty() ) cd.port = Integer.parseInt(port); String nick = server.get("nickn...
fd14d8ff-eadd-4d2d-8ca7-69cbdcd27d80
4
private void mergeFasterNonStable(T[] a, T[] aux, int lo, int mid, int hi) { // Copy a[lo..mid] to aux[lo..mid]. for (int k = lo; k <= mid; k++) aux[k] = a[k]; // Copy a[mid+1..hi] to aux[hi..mid+1]. // i.e. copy the 2nd half in decreasing order for (int k = hi, m = mid + 1; k > mid; k--, m++) aux...
780b0d64-9b8b-484b-981e-8df53b694e4b
9
public double[] distributionForInstance(Instance instance) throws Exception { String stringInstance = instance.toString(); double cachedPreds[][] = null; if (m_cachedPredictions != null) { // If we have any cached predictions (i.e., if cachePredictions was // called), look for a cached set ...
5b8a4067-6629-4d42-8fe2-4a0146cfabc2
1
public void run() { MatrixWithExtendedInput m; try{ m = new MatrixWithExtendedInput(3,4); } catch(Matrix.MatrixError e) { System.out.println("Matrix dimensions set badly."); return; } m.setMatrix("2,1,1;33,777777,8888888;444,1,1;5555,1,-10"); ...
5219462c-cd5f-4520-aa2e-e3a47977acc6
4
private List<?> createArrayContainer(ContainerFactory containerFactory){ if(containerFactory == null) return new JSONArray(); List<?> l = containerFactory.creatArrayContainer(); if(l == null) return new JSONArray(); return l; }
b15a3e19-346d-4628-83a9-31eb27c04d6f
6
public static void main(String[] args) { //1.1 Parte 1: Modelagem das estruturas de dados e leitura do arquivo Parte 1 - OKAY //1.1 Parte 1: Modelagem das estruturas de dados e leitura do arquivo Parte 2 - OKAY //1.2 Parte 2: Geração de um arquivo HTML - OKAY //1.3 Parte 3: GUI - Okay...
caadc5cd-8fa6-4ff7-beb5-faa17b0a5bc2
4
/* */ public void updateUnits(Graphics g) /* */ { /* 707 */ for (int i = 0; i < units.size(); i++) { /* 708 */ Unit u = (Unit)units.get(i); /* 709 */ if (!u.alive) { /* 710 */ units.remove(u); /* */ } /* */ else { /* 713 */ g.drawImage(u.getImage(), u.getX...
2e79fe63-2d2d-4057-9787-bcf2bba7c211
0
public static void main(String[] args) { }
877772a9-9185-4df1-99b9-f5ce3c72b3be
7
public void update() { switch (StateHandler.instance.getCurrentState()) { case MENU: synchronized (MenuObject.menuObjects) { for (Iterator<MenuObject> it = MenuObject.menuObjects .iterator(); it.hasNext();) { MenuObject object = (MenuObject) it.next(); object.update(); /* * if (o...
a41fafd5-b617-4c05-b378-f68ba48cd1ad
0
@Override public void removeClientDisconnectEventListener(DisconnectListener listener) { disconnectEventListenerList.remove(DisconnectListener.class, listener); }
200e493a-b5e0-4962-b66b-646bc34534b8
7
public ArrayList<Nucleotides> getNucleotideSequences() { if (nucleotideSequences == null) { nucleotideSequences = new ArrayList<Nucleotides>(); try { BufferedReader br = new BufferedReader(new FileReader(sequenceFile)); String line = br.readLine(); String sequenceDescription = null; StringBuffe...
52826b19-7918-4a9a-becb-5a8f8fa789cf
6
private static void addotuToFamily(HashMap<String, String> map, File f) throws Exception { BufferedReader reader = new BufferedReader(new FileReader(f)); reader.readLine(); for(String s= reader.readLine(); s != null; s = reader.readLine()) { String[] splits = s.split("\t"); String lastToken = ...
ba86974c-3dab-4ddd-97d9-89ecf78a8987
2
private void handleNonAcceptState() { if (dfa.isInErrorState()) throw new LexicalException(handler.getLineNo() + 1, handler.getCharNo() + 1); else if (dfa.isInSpaceState()) dfa.reset(); }
0963b887-6ab0-408b-b36c-d1402ce56563
4
public String getLevel(){ String result = ""; char mapChar = 'a'; for(int y=0; y<level[0].length; y++){ for(int x=0; x<level.length; x++){ if(level[x][y] == null){ result += " "; } else{ if(!levelMapping.containsKey(level[x][y])){ levelMapping.put(level[x][y], mapChar); map...
d52a2b93-79d3-4a30-8ef7-bd86f7312315
4
private void added (DeviceImpl dev) { if (Linux.trace) System.err.println ("notify add " + dev); // call synch'd on devices for (int i = 0; i < listeners.size (); i++) { USBListener listener; listener = (USBListener) listeners.elementAt (i); try { listener.deviceAdded (dev); } catch (Ex...
26f38034-aa6f-46db-8aa2-18d4d0e1ea27
8
public Sign findNearBySign( Block var1, String var2 ) { Sign found = null; List<Block> possible = new ArrayList<Block>(); if ( var1 == null ) return null; possible.add( var1.getRelative( BlockFace.UP ) ); possible.add( var1.getRelative( BlockFace.NORTH ) ); possible.add( var1.getRelative( Block...
ff0483b3-a58d-4ad2-9071-42a4bc0147b6
3
public void setSelected (boolean selected) { isSelected = selected; if (!(isSelected || champion == null)) { reset (false); if (oldChampion != null) updateChampion (oldChampion); } repaint(); }
b1ea5781-daba-4a27-b37d-70e1057688b3
7
public void readCompressedMap() { Scanner scan; try { scan = new Scanner(new File(maps.get(mapNum))); height = scan.nextInt(); width = scan.nextInt(); tiles = new Cell[width][height]; String tempLine; int linesBeen = 0; while(scan.hasNext()){ tempLine = scan.nextLine(); Scann...
a08af630-1b71-4c04-b949-2607cac86e0a
8
public static void main(String[] args) throws RemoteException { StreamsterApiInterfaceProxy proxy = new StreamsterApiInterfaceProxy(); Bar[] bars = proxy.getBars("EUR/USD", "5 Minutes", "f"); List<BigDecimal> open = Arrays.asList(bars).stream().map(c -> c.getOpen()).collect(Collectors.toList())...
a165d2c8-3a49-443e-913c-2cbcc5b9433e
2
public static void printList(ArrayList<String>[] arrayOfStringList) { for (ArrayList<String> list: arrayOfStringList) { for (String s : list) { System.out.println(s); } } }
b10eab39-9205-4e26-a508-54dc401dfd2f
7
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { RequestEnvelope env = new RequestEnvelope("en_US"); SendInvoiceRequest sendInvoiceRequest = new SendInvoiceRequest(env, request.getParameter("invoiceID")); InvoiceService invoiceSrv...
304bed21-22c9-4d5d-bb56-33b47bc899a8
2
public void warning(String message, String sourceName, int line, String lineSource, int lineOffset) { if (line < 0) { System.err.println("[WARNING] HtmlCompressor: \"" + message + "\" during JavaScript compression"); } else { System.err.println("[WARNING] HtmlCompressor: \"" + message + "\" at line [" + l...
b5e30f16-6450-4192-aedd-7d377c7bc6ff
9
public void save() { ContentValues values = new ContentValues(); for (Field f : Database.getDBFields(getClass())) { String ff = f.getName(); try { if (Model.class.isAssignableFrom(f.getType())) { values.put(ff, ((Model<?>) f.get(this)).id); ...
f5b04a09-52c0-41fd-91c2-c0d44f073df8
8
private void parseLevelNames(byte[] wadData) { String[] temp = new String[this.lumpName.length]; Arrays.fill(temp, ""); int tempIndex = 0; List<String> listMapNames = Arrays.asList(lumpMapNames); for (int i = 0; i < this.lumpName.length; i++) { if ((i != this.lumpName.length - 1) && (this.fileSize[i] == 0)...
5fedb088-775a-4b63-9e90-1afc920d2b37
7
public void runHuckedInsertionSort(int[] array){ // start timer long startTime = System.currentTimeMillis(); // start Huck specific timer long startHuckTime = System.currentTimeMillis(); // length of array int length = array.length; // Array's statistical mean. int mean = (int)StandardDeviation.ge...
c6ac85f5-ce03-4516-8b24-8de550c9f4db
4
public void EStep(List<Instance> instances) { int insIndex = 0; for (Instance instance : instances) { // get the closest cluster. int feaIndex =0; double minDistance = Double.MAX_VALUE; for (FeatureVector cluster : clusters) { if (MathUtilities.SquaredL2Distance(cluster, instance) < minDistance) { ...
00077f95-ff29-4266-9023-af2db815f872
1
public float getRXAxisDeadZone() { if (rxaxis == -1) { return 0; } return getDeadZone(rxaxis); }
81f5b82d-986b-49ba-9362-0f2154986ca5
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; FormalParametersNode other = (FormalParametersNode) obj; if (fpsections == null) { ...
1eb3c774-dc73-4ed0-b198-5eea0696f45d
7
public static void persist(MacroEntity transientInstance) { try { EntityTransaction tx = entityManager.getTransaction(); tx.begin(); try { List<ActionEntity> actions = transientInstance.getActions(); if (actions != null && actions.size() > 0) { for (ActionEntity action : actions) { ActionE...
3226777b-1202-4175-a6a4-c1967107cefe
0
@Override public int getRowCount() { return data.size(); }
1c630326-14d8-441b-a7d1-ba4a51539d67
4
public void removeItem(String referenceToRemove){ boolean foundItem = false; for(int i=0; i < libraryItems.size(); i++){ if(libraryItems.get(i).getReference().equals(referenceToRemove)){ foundItem = true; if(libraryItems.get(i).getStatus() == ItemStatus.IN){ ...
414d894d-313c-45c0-a847-b4d600cee1f8
9
final public void CommentTag() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case Comment1: jj_consume_token(Comment1); label_4: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case CommentText1: ; break; default: j...
44c21c18-9e40-402c-aeed-bebe63a68d18
3
private void fillGenQueue(int x, int y, int s) { if(x >= xSize || y >= zSize) return; if (s == 1) addTaskToQueue(x, y, 0); else { int s2 = s / 2; fillGenQueue(x + s2, y + s2, s2); fillGenQueue(x, y + s2, s2); fi...