method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
ff9a7cde-e594-4e04-b5bc-f0c5f10682b2
3
public void refresh(){ PreparedStatement st; Integer rs; String query; query="DELETE FROM messages"; try { st = conn.prepareStatement(query); rs = st.executeUpdate(); st.close(); } catch (SQLException e) { System.out.println(e.getMessage()); } query="DELETE FROM friends"; try { st = con...
77c797ce-a979-4458-a8ce-14228d3995f7
8
public static void main(String[] args) throws Exception { // Parse the command line. String[] manditory_args = { "mode"}; createCommandLineOptions(); CommandLineUtilities.initCommandLineParameters(args, Classify.options, manditory_args); String mode = CommandLineUtilities.getOptionValue("mode"); String da...
443a707f-8865-4410-872a-ac4596209f68
2
public void update() { if(Keyboard.isPressed(getKey())) { setPressed(true); setReleased(false); } else { if(isPressed()) setReleased(true); else setReleased(false); setPressed(false); setHeld(false); } }
08cc372d-ac49-42b5-9274-60351990bdfe
9
public TranscriptRecord parseLine(String line) throws GTFParseException { String[] fields = line.split("\t"); TranscriptRecord record = TranscriptRecord.fromRefFlat(fields); //XXX skip the haplotypes and unassembled chroms if(record.getChrom().contains("_")) return null; ...
d49843bf-e066-47e7-a3a3-74476ee28712
3
public void saveDoc(){ try { if(this.pdfwriter!=null){ pdfwriter.close(); } if (document != null) { document.close(); } } catch (Exception e) { e.printStackTrace(); } }
2a31b134-a142-46c6-b690-f4e8bbdb1216
3
@SuppressWarnings("unchecked") public String loadTeams() { PreparedStatement st = null; ResultSet rs = null; JSONArray json = new JSONArray(); try { conn = dbconn.getConnection(); st = conn.prepareStatement("SELECT * FROM team"); rs = st.executeQue...
32e86c10-0fca-4300-9093-3d93399c9189
6
public void swim() { if(super.getPosition()[0] == Ocean.getInstance().getWidth()-71){ invX = true; } else if(super.getPosition()[0] == 0){ invX = false; } if(super.getPosition()[1] == Ocean.getInstance().getDepth()-71){ invY = true; } else if(super.getPosition()[1] == 0){ invY = false; } if(in...
d05b49a5-a0a9-4ed3-913c-eedf144dc3b3
2
@Override public void execute(Runnable task) { queue.add(task); if (!running) { while (!queue.isEmpty()) { Runnable nextTask = queue.remove(queue.size() - 1); running = true; nextTask.run(); running = false; } ...
28cfaf53-df72-485a-a53c-d76a8870dc75
5
public void actionPerformed(ActionEvent e) { String nick = GUIMain.userList.getSelectedValue().toString(); if (nick.startsWith("@")) { nick = nick.replace("@", ""); } else if (nick.startsWith("$")) { nick = nick.replace("$",...
086a7fb7-5d62-4a1b-aac7-7e7bfa2c5103
2
private static char [] zzUnpackCMap(String packed) { char [] map = new char[0x10000]; int i = 0; /* index in packed string */ int j = 0; /* index in unpacked array */ while (i < 30) { int count = packed.charAt(i++); char value = packed.charAt(i++); do map[j++] = value; while (--cou...
5522ba80-62c7-4f20-a27e-6f7e8cb4bff3
3
private static boolean isValidIP(String ip) { String[] parts = ip.split("\\."); if (parts.length != 4) { return false; } for (String s : parts) { try { Integer.parseInt(s); } catch (NumberFormatException e) { return false; } } return true; }
ec64fe33-11ea-4eb0-9915-1ca4faf92774
3
@Override public void insert(int i, int j, double value) { outOfBound(i - 1, j - 1); // only non zero elements are saved if (Double.compare(value, 0.0) != 0) { for (ArrayListElement elem : mArray[i - 1]) { accessCount += 1; // durchsuchen des elements if (elem.getJ() == (j - 1)) { mArray[i - 1].r...
2f4cfc7e-dc86-4526-861c-6a6c92ebcf73
1
public Set<ContactDto> convert(List<Contact> contacts) { Set<ContactDto> contactDtoSet = new HashSet<ContactDto>(); for (Contact contact : contacts) { contactDtoSet.add(new ContactDto(contact.getFirstName(), contact.getLastName(), contact.getPhone(), new AddressDto(c...
141feaa4-58db-49c3-8fee-25908ac1b8c2
4
@Override public boolean equals(Object obj) { if (super.equals(obj)) { ByteArrayTag o = (ByteArrayTag) obj; return ((data == null && o.data == null) || (data != null && data.equals(o.data))); } return false; }
fc80989a-9567-4944-9bf7-65b1cad3fe86
2
public int fib(int n) { if (n == 0) { return 0; } if (n == 1) { return 1; } else { return fib(n - 1) + fib(n - 2); } }
0c820fea-7c84-45ed-98ba-373f9a0ae94f
2
public void set_Patient(MsgParse mp) throws SQLException { try { PreparedStatement prepStmt = connection.prepareStatement( "insert into patient (mrn, last_name, first_name, birth_date, sex_code, ethnic_code, address_line1, address_line2," ...
f5553a01-08cc-436b-92ac-a9beef115a42
3
public Stack<Integer> sortStack(Stack<Integer> origStack) { Stack<Integer> resultStack = new Stack<Integer>(); int popCountOrig = 0; int pushCountOrig = 0; int n = origStack.size(); while (!origStack.empty()) { int tmp = origStack.pop(); popCountOrig++; while (!resultStack.empty() && resultStack.pe...
6eb120ff-0a68-4ad6-844a-b52279ff10db
2
public void testGet() { TimeOfDay test = new TimeOfDay(); assertEquals(10 + OFFSET, test.get(DateTimeFieldType.hourOfDay())); assertEquals(20, test.get(DateTimeFieldType.minuteOfHour())); assertEquals(30, test.get(DateTimeFieldType.secondOfMinute())); assertEquals(40, test.get(Da...
a6cfbb7f-6079-4aff-a6d5-a296fe4b8969
6
private void accessProcessing(){ String name = nameText.getText(); String pass = passText.getText(); //User is registering if(isRegistering){ if(pass.length()<8){ infoLabel.setForeground(Color.red); infoLabel.setText("Password mini...
8a7255bf-2019-4a11-b6bb-9d63e83e8ed0
5
public static void save(Frame parent, String[] name, String[][] datas) { FileDialog filedialog_save = new FileDialog(parent, "保存文件"); filedialog_save.setFile(".xls"); filedialog_save.setMode(FileDialog.SAVE); filedialog_save.setVisible(true); filesave = filedialog_save.getDirectory();// 返回文件对话框中显示的文件所属的目录 f...
a0d368d7-6429-4a9f-b6fa-cad022eed9a5
5
public static int removeElement(int[] A, int elem) { int len = A.length; for (int i = 0; i < len; i++) { while (len > 0 && elem == A[len - 1]) { len = len - 1; } if (len <= i) return len; if (elem == A[i]) { A[i] = A[len - 1]; len = len - 1;...
c414128f-be4b-45cb-8c20-9fa8611ca20c
3
@SuppressWarnings("unchecked") public Combo_Box_View_All_Accounts() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException { //MAIN FRAME super("Team J's Scheduler | View All Appointment"); setBounds(50,50,500,300); setResizable(false); setDefaultCloseOperation(JFrame.DI...
84e53a49-aa50-45f8-864c-2f7bf3513f47
4
public boolean cancel() { int bus_stop_id = database.busDatabase.find_id("path_id", "path", "route", route_id, "sequence", 1); int daily_timetable_id = database.busDatabase.find_id("daily_timetable_id", "daily_timetable", "kind", day_of_week, "route", route_id); int[] service_ids = database.busDatabase.se...
001fbcf2-8b35-43e5-b487-99c0ac32d14f
5
public boolean addCards(String type, int number) { type = type.toUpperCase(); if (type.equals("ORE")) { resCards[ResourceCard.ORE.getIndex()] = resCards[ResourceCard.ORE.getIndex()] + number; }else if (type.equals("WOOL")) { resCards[ResourceCard.WOOL.getIndex()] = ...
3b24aa1e-ed74-4f13-9b14-410a459a1d3c
4
public void update() { if(x < 0) { x = 0; } else if(x >= Game.WIDTH - 53) { x = Game.WIDTH - 53; } else if(y >= Game.HEIGHT - 80) { y = Game.HEIGHT - 80; } else if(y < 0) { y = 0; } }
d96b29ea-6bfb-4c1c-893f-97390c6e2fac
6
public void testAvailabe(int H, int V, int A) { // H&V number want be bls of // indH &indV A = index if ((this.indexH + H) >= 8 || (this.indexV + V) >= 8 || (this.indexV + V) < 0 || (this.indexH + H) < 0) { this.availableCells[A] = null; } // ok else if (myBoard.bordaCell[this.indexH + H][this.in...
c267bfe1-294e-488b-b5e3-5515bf68cc05
9
public void updateByAppendingData(TaskObserver taskObserver, RandomAccessFile randomAccessFile, LodResource resourceToImport) throws IOException, InterruptedException { taskObserver.taskProgress(resourceToImport.getName(), 0); LodEntry lodEntryToUpdate = null; float counter = 0; Ite...
4830c14d-7e72-4e95-afad-8566483df169
9
private void fixWalls() { boolean[][] blockMap = new boolean[width + 1][height + 1]; for (int x = 0; x < width + 1; x++) { for (int y = 0; y < height + 1; y++) { int blocks = 0; for (int xx = x - 1; xx < x + 1; xx++) { ...
7f545053-f7a9-417d-acd6-478ec27848c2
9
@Override public boolean equals(Object other) { if(other instanceof GameState) { GameState state = (GameState) other; if(day == state.day) { if(week == state.week) { if(time == state.time) { if(drawCards == state.drawCards) { if(pList.length == state.pList.length) ...
77081432-7b2e-4476-a8c1-8f82e7227110
1
public PathQuad(PathQuad parent, float x, float y, BufferedImage hitmap) { this.parent = parent; right = new ArrayList<PathQuad>(); down = new ArrayList<PathQuad>(); left = new ArrayList<PathQuad>(); up = new ArrayList<PathQuad>(); if(parent == null) { //box = new Rectangle2D.Float(x, y, (float)foregroun...
c992a708-0a15-465b-b5ed-1f5bb7bc48a6
6
public void fusionWithLightenFullAlpha(CPLayer fusion, CPRect rc) { CPRect rect = new CPRect(0, 0, width, height); rect.clip(rc); for (int j = rect.top; j < rect.bottom; j++) { int off = rect.left + j * width; for (int i = rect.left; i < rect.right; i++, off++) { int color1 = data[off]; int alpha1 ...
d1d71be0-499c-4448-b830-d8ab3bd780ee
4
@Override public Key readInput() { synchronized(readMutex) { if(!keyQueue.isEmpty()) return keyQueue.poll(); Key key = inputDecoder.getNextCharacter(); if (key != null && key.getKind() == Key.Kind.CursorLocation) { TerminalPosi...
624eb914-a223-47fb-b20b-91fd9691a5c1
0
public String getFilename() { return filename; }
452968fd-7bd5-436d-876c-e15c75b25d0c
5
public Norm containsNormDiferent(Action ac, NormType nt) { for ( Norm norm: getAllRestrictNorms().values() ) { Action a = norm.getNormResource().getAction(); if ( a!=null && !a.getName().equalsIgnoreCase(ac.getName()) && norm.getNormType() == nt && norm.isActive() ) { return norm; } } return...
e5eed82f-4acb-4bba-b85d-46bf8518ebe3
0
@Override public int getCorners() { return 4; }
9da10718-9fe5-4f9d-b087-5852fbfa19bf
4
public Component getTreeCellRendererComponent( JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); if (leaf && isGameObject(value)) { setIcon(UIManager.getIco...
31e80f9a-7945-43e6-b308-4f7bb868e292
9
@Test public void testWrongThreadAssertion() throws Exception { boolean assertsEnabled = false; try { assert false; } catch (AssertionError e) { assertsEnabled = true; } if (!assertsEnabled) { // Does not count as a failure Syst...
4c101055-439a-4a05-9177-a738e0a04943
7
private void ensureSubscribedState() { try { if(_subscriptionState == NOT_SUBSCRIBED) { int communicationState = ((DafDataModel)_object.getDataModel()).getRequester().subscribeConfigurationCommunicationChanges(_object); switch(communicationState) { case -2: // Objekt weder lokal noch remote gefunden ...
dc1cc94e-42fa-4998-b078-fd807a1c16c2
5
public BsGs_Key(int k) { Random rand = new Random(); do { // p waehlen this.p = new BigInteger(k, 400, rand); // Generator g>1 erzeugen factors = factorize(p.subtract(BigInteger.valueOf(1))); } while(factors==null); // wiederholen falls factorize() zu lange dauert Boolean found; do { g = ne...
16681bff-7689-4f80-888f-649843634d14
6
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed try { //metodo de impresion anterior por JTable /**try { MessageFormat headerFormat = new MessageFormat(jLabel1.getText()); MessageFormat footer...
3c83a1cd-aab4-430b-9e27-34e46a4b9cd9
5
public final boolean EOFreached() throws IOException { if (this._length < this._offset) { this._offset = this._length; } if ((this._offset == this._length) || (this._length < 0)) { fillBuff(); } if (this._length == 0) { if (this.io != null) { this.io.endProgress("Reading done"); this.io = nul...
ee2b9402-4c01-4a7f-9440-fc3135b6cf32
8
public void marcarcamino(Casilla nodo){ if(nofin2==0){ int tamVmeta=camino.tamvecinos_de_punto_partida(); for (int r=0;r<tamVmeta;r++){ if(camino.getvecinos_de_punto_partida(r).getID() == nodo.getID()){ if(imprecorrido==1)System.out.println("FIN DE TRAZAR EL CAMINO"); // ...
11289acc-1436-4095-bcb7-8aafe1e4967e
2
public static void checkedAllAttributes(Element element, String[] labels) throws SyntaxException { for (String label : labels) if (!element.hasAttribute(label)) throw new SyntaxException(String.format("Tag %s missing attribute %s.", element.getNodeName(), label)); return; }
7fcd9506-acc0-42ac-b143-9d75e598f867
2
public ZipPacker(String directory) { Path path = Paths.get(directory); String fileName=path.getFileName().toString(); String folder = directory.replaceAll(fileName, ""); fileName=fileName.replaceAll(" ",""); fileName=fileName.replaceAll("[^A-Za-z0-9]", "_"); fileName=fileName.substring...
ad805f5b-9232-40e4-9ab0-48a3d44d0543
0
public void updateChapCnt(){ }
bd474807-68ac-425b-9e98-ee96edc3f530
1
public static void main(String[] args) { if (args.length == 2) { int a = Integer.parseInt(args[0]); int b = Integer.parseInt(args[1]); double c = Math.sqrt(a * a + b * b); System.out.println(c); } }
aa83e92f-130d-4b4d-907f-4542ca49b3cb
1
public OuterValues(ClassAnalyzer ca, Expression[] head) { this.clazzAnalyzer = ca; this.head = head; this.headMinCount = 0; this.headCount = head.length; if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_CONSTRS) != 0) GlobalOptions.err.println("Created OuterValues: " + this); }
340b7c70-9255-472b-ab89-e197dc4ecf3e
2
@Override public boolean equals(Object object) { if(object instanceof ClassNode) { ClassNode n2 = (ClassNode) object; if(n2.name().equals(name())) { return true; } } return false; }
53e689db-d438-417e-b3c8-01ef4b07fdbd
0
public Leo() { super("Leo", 5500, 300, 100, 90, as); as.setSkill(0, "Ambush", 300, 100, "Leo ambushes his enemy from the nearby bush."); as.setSkill(1, "Deathly Stare", 500, 200, "Leo stares at his enemy with deathly intent."); as.setSkill(2, "LeoMonade", 700, 300, "Leo is just being himself."); as.setSkill(...
33217070-0371-47ef-a89d-74fd2ce0586a
8
public boolean inWild() { if(absX > 2941 && absX < 3392 && absY > 3518 && absY < 3966 || absX > 2941 && absX < 3392 && absY > 9918 && absY < 10366) { return true; } return false; }
65c36ad2-c666-4a04-b5b2-3b94ad8fa400
0
public String getHTTPHeader() { String fmt = "%s=%s; expires=%s"; return String.format(fmt, n, v, e); }
3fec4f34-1089-4900-ab59-a3eff91a1c92
5
public ListNode swapPairs(ListNode head) { if(head == null || head.next ==null) return head; ListNode newHead = new ListNode(-1); ListNode step = newHead; ListNode oneStep = head; ListNode twoStep = head.next; while(oneStep != null && twoStep != null){ ...
b9c50a1a-2546-474c-b4b9-e446e5b91120
0
public void setOldValue(String oldValue){ this.oldValue.setText(oldValue); }
604b02ed-1485-4aa2-ab46-96471b438f42
4
private void SHRemoveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SHRemoveButtonActionPerformed // TODO add your handling code here: //remove stakeholder from arraylist String tempName = (String) StakeholderList.getSelectedValue(); //remove stakeholder from ar...
8d6efd89-2ebf-40d3-8f7a-1928a9a9d870
2
public void setShutdownMenuFont(String font) { if ((font == null) || font.equals("")) { this.shutdownMenuFont = UIFontInits.SHDMENU.getFont(); } else { this.shutdownMenuFont = font; } somethingChanged(); }
29fe9ee1-92e5-48ba-b370-7eae887d2a62
9
public Codec waitForCodec( final Object nameLock, final long maxTime) { boolean active; Codec retval; // logError("wait + "+this+" "+nameLock); do { synchronized(nameLock) { active = isDecoding(); retval = (Codec)codecTable.get(nameLock); if(act...
b2993ce5-cb47-4c1b-9388-dbc37447cfdd
7
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jDialog1 = new javax.swing.JDialog(); jDialog2 = new javax.swing.JDialog(); jComboBox1 = new javax.swing.JComboBox(); JButton ...
d24a8059-f1dd-44d7-b2e7-fa33e5d6010f
1
public static ArrayList<Tank> getTanks(String tsS){ ArrayList<Tank> tanks = new ArrayList<Tank>(); String data[] = tsS.split(":"); for(int i=0;i<data.length;i++){ tanks.add(getTank(data[i])); } return tanks; }
fbc2f3e4-9b9c-44a0-881d-5a966c46b7cd
0
public Circle(Excel ex, int R) { begin = ex; this.R = R; setColoredExes(); }
ba66f5d8-3cf9-4e55-a82a-5528dc4d4909
2
public void actionPerformed(ActionEvent e) { final long currentAnimationTime = System.nanoTime() / 1000000; final long totalTime = currentAnimationTime - fAnimationStartTime; if(totalTime > fDuration) { fAnimationStartTime = totalTime; } float fraction = (float) totalTime / fDuration; fraction = M...
274da9f7-9975-4e27-982d-a6ef4af9855f
1
public void visit_ifeq(final Instruction inst) { if (longBranch) { final Label tmp = method.newLabel(); addOpcode(Opcode.opc_ifne); addBranch(tmp); addOpcode(Opcode.opc_goto_w); addLongBranch((Label) inst.operand()); addLabel(tmp); } else { addOpcode(Opcode.opc_ifeq); addBranch((Label) inst....
457661c7-29b8-43ed-969c-cc9366ab62b4
0
public static void main(String[] args) { Integer n1 = new Integer(47); Integer n2 = new Integer(47); System.out.println(n1.equals(n2)); }
1408f2bc-6fc1-4adf-ab7e-9ba7d11d937b
3
public Logger() { System.setOut(new ImperviumPrintStream(System.out)); if(!logDirectory.exists()) { logDirectory.mkdir(); } if(!logFile.exists()) { try { logFile.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } }
a799b64e-8eb1-4f3b-987b-18ce1b0fff44
8
public void fullHouse(int [] die, String name) { int [] counter = new int[6]; int answer = 0; int zero = 0; for (int i : die) ++counter[i - 1]; for (int i : counter) { if (i == 3) { ++zero; for (int j : counter) if (j == 2) ++zero; break; } } if (zero == 2) answer ...
07f276c4-a078-4972-b48e-1617451e2710
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; MultilingualString other = (MultilingualString) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.i...
2c8fa774-7b3f-43d5-9811-2fba9393cddb
8
public long start(String filename, InputStream in, Model modelin) { long time=-1; // Cleanup if thread already exists if (gcodepainter != null) { errormsg = null; setCmd(Commands.EXIT); // Stop thread if(pause != 0) togglePause(); try { gcodepainter.join(10000); gcodepainter.interrupt(); } ...
0543fca8-1b77-4136-98bd-965c1564a3de
4
public GameMatter findObject(int x, int y){ //search floor Surface for object GameMatter found = floor.findObject(x,y); if (found == null){ found = ceiling.findObject(x,y); if (found == null){ //if no object found we will try the back wall found = back.findObject(x,y); if (found == null){ /...
753797b4-45b8-4b45-a2df-07fe269701fb
8
Method getGetter(String aname, BaseModelMBean mbean, Object resource) throws AttributeNotFoundException, MBeanException, ReflectionException { // TODO: do we need caching ? JMX is for management, it's not supposed to require lots of performance. Method m=null; // (Method)getAttMap.get( name...
9a303011-dd04-4659-8411-854204819a27
4
@Override public void setPosition(Vector2f position) { if (!(position.getX() + getScale().getX() > lineTransform.getPos().getX() + length) && !(position.getX() < lineTransform.getPos().getX())){ super.setPosition(position); }else if(position.getX() + getScale().getX() > lineTransform.get...
42d519c7-5dca-4ee0-a772-7425aef85011
3
public void connect(Tile t){ if (isStranded() || isFullyConnected()){ throw new UnsupportedOperationException("Nowhere to connect"); } if (tile1 == null){ tile1 = t; } else { tile2 = t; } }
cb72f90a-18de-4015-b212-378640625576
4
public ArrayListaInteger insertSort(ArrayListaInteger lista){ // int costoRunTime=0; int ubicaKey,comparacionesTrue,comparacionesFalse; Nodo nodoKey=lista.getLista().getNodo().getSiguiente(); for(ubicaKey=1; ubicaKey<lista.getLista().getLongitud();ubicaKey++){ // costoRunTime++; Nodo elementoComparar = list...
b98d50f8-b251-4060-80bb-9699b05e67d1
3
public ArrayList<Piece> getOpposingNeighbors(Board board) { ArrayList<Piece> neighbors = new ArrayList<Piece>(); for(int x = this.getX() - 1, y = this.getY() - 1; y <= this.getY() + 1; x++) { if(board.placeHasColor(x, y, this.getColor().getOpposite())) { neighbors.add(board.getPiece(x,...
0016bcf8-d06c-4a7d-9cd5-969f2920ddbe
9
private int[] getStyle(int index) { if (m_styleOffsets == null || m_styles == null || index >= m_styleOffsets.length) { return null; } int offset = m_styleOffsets[index] / 4; int style[]; { int count = 0; for (int i = offset; i < m_styles.length; ++i) { if (m_styles[i] == -1) { break; ...
92946a3c-175a-40e4-ac0f-c12a9584300c
1
private static void findnextvertextotraverse() { // TODO Auto-generated method stub score = 100000000; vertextotransverse =0; int tailvertex = 1; for(int j = 0;j<exploredarray.size();j++){ tailvertex = exploredarray.get(j); findminimumgreedyscorefortailvertex(tailvertex); } }
bff19396-d812-4405-b108-7186e23c2dd0
9
public void actionPerformed(ActionEvent e) { if (e.getSource() == update) { Graph g = graphPanel.getGraph(); g.plotSettings.setMinX(Double.parseDouble(minX.getText())); g.plotSettings.setMaxX(Double.parseDouble(maxX.getText())); g.plotSettings.setMinY(Double.pars...
3651d330-ba9f-4554-9050-d598abfe9855
6
private void restoreLineThickness(Annotation annotation) { // check if we need to set line thickness to default value if (linkType == Annotation.VISIBLE_RECTANGLE && lineThickness == 0) { lineThickness = 1f; } // update the border width line thickness ...
58433788-8a6e-436b-ba3b-58ffc3967d01
1
public static int startsWith(String text, String match) { int matchLength = match.length(); int count = 0; int index = 0; while (text.startsWith(match,index)) { count++; index += matchLength; } return count; }
e91f79e8-f0ab-4b24-a252-da2c016d980d
4
public void run() { running = true; while(running) { try { Thread.sleep(iMessageDelay); } catch (InterruptedException e) { /* Wake up on interrupt */ } /* Don't run if we're not running or if we're paused */ if( running && !paused ) doRun(); } }
6d191f38-aa76-4a65-ad8c-228433d4aab7
8
public void appendANSI(String s) { // convert ANSI color codes first int aPos = 0; // current char position in addString int aIndex = 0; // index of next Escape sequence int mIndex = 0; // index of "m" terminating Escape sequence String tmpString = ""; boolean stillSearching = true; // true until...
0d2df9a9-2f73-435b-b9ee-2147d0c4d48e
5
public ConnectionEngine() throws IOException { System.out.println(System.getProperty("user.home")); String os = System.getProperty("os.name").toLowerCase(); String userHome = System.getProperty("user.home"); if(os.contains("mac os x")) { settingsDir = userHome+"/Library/Application Support/JIRCC"; } else...
e52f23db-8202-466d-b54a-97e1c519f1a7
8
private int decode_MCU(InputStream in, int PrevDC[], int temp[], int index[]) throws IOException { int value,actab[],dctab[]; int qtab[],Cs; for(Cs=0; Cs<nComp; Cs++){ qtab=qTab[Cs]; actab=acTab[Cs]; dctab=dcTab[Cs]; for(int i=0 ; i<nBlock[Cs]; i++...
713c3341-0937-4da7-8982-e5573d6e8bb2
1
@Test public void testMessages(){ User u, u2; for(int i=0;i<=X;i++){ assertNotNull(u = sys.signup("Kak"+i+"@post.aliza.com","Kat","katriel"+i+"","12345", fId)); assertNotNull(u2 = sys.signup("Kak"+i+"@post.aliza.com","Kat","katriel"+i+"","12345", fId2)); assertNotNull(sys.createMessage(fId, sfId, u, "hi"+...
521b702b-cb0b-4f52-a2fb-e2f0a5fdc5d2
8
private void jSaveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jSaveButtonActionPerformed try { if (this.jTextUsername.getText().trim().length() == 0) { //JOptionPane.showMessageDialog(null, "Please Provide a User Name", "OOPS!", JOptionPane.E...
a60a9da0-d8b3-4e80-a018-e2540eb43d8b
0
public void paintComponent(Graphics g) { super.paintComponent(g); drawTableCards(g); drawRestOfJPanelDisplay(g); }
b47b69cd-df3a-47b4-a411-4c13325d2427
9
public static void main(String[] args) { int p, m; in = new Scanner(System.in); System.out.println("Nº processos:"); p = in.nextInt(); System.out.println("Nº blocos de memória:"); m = in.nextInt(); int tamProcessos[] = new int[p]; BestFitMem segMemoria[] = new BestFitMem[m]; int i; for (i ...
eb7edbed-17e5-4c03-b39c-d70bbc879fc7
8
public static ObjectListing listObjects(String bucketName, String dirName, int max) throws SAWSException { //Fixing dirName if doesn't end with a slash if(dirName!=null && !dirName.endsWith("/")) { dirName += "/"; } List<S3ObjectPojo> result = new ArrayList<S3ObjectPojo>();...
1625bdb0-36dd-45b2-b977-c0edb27519a8
1
@Test public void ShortName() throws Exception { LoginCheck logCh = new LoginCheck(); name = "Haya"; if (kesh.containsKey(name)) { assertFalse(kesh.get(name)); } else { boolean result = logCh.validate(name); kesh.put(name, result); asse...
86d3d2ea-95bc-4360-bafb-5ef501f20c1d
7
public boolean intersectsBounds(CollisionObject object) { if (object instanceof PlaneObject) { return object.intersectsBounds(this); } Vector3d min = new Vector3d(); Vector3d max = new Vector3d(); object.getBounds(min, max); if ((boundsMax.x > min.x && boundsMax.y > min.y && boundsMax.z > min.z) &&...
525f6518-2859-4a20-a3d9-4094e93dc4ef
1
private boolean sameDate(Stat val, Date minDate) { return val != null && val.getWhen().equals(minDate); }
f673c5cd-a390-4334-a43d-907395d5c6ea
9
private int bubbleDown(int index, double x) { while (index * 3 <= size) { int target; int left = index * 3 - 1; int middle = index * 3; int right = index * 3 + 1; if (middle > size) { target = left; } else if (right > size) { if (heapArray[left] < heapArray[middle]) { target = left; ...
60ba991f-89b4-4d41-b1ee-98d6dbc65476
7
@Override public Expression evaluate(Expression leftSideOperand, Expression rightSideOperand) { if (Operator.outputMode == Calculate.OUTPUT_EXACT_MODE) { //try to use operands as exact fractions, but use them as numbers if not possible //if still not possible to use operands as numbers, then use them as ex...
576b503a-6e1c-4cce-b512-296584e0c322
3
public boolean isValidNewMove(int col, int index) { List<Card> cardList = board.get(col); for (int i = index + 1; i < cardList.size(); i++) { Card prev = cardList.get(i - 1); Card toCheck = cardList.get(i); if (toCheck.getSuit().ordinal() != prev.getSuit().ordinal() |...
58796cae-d7ab-4011-ac00-070b95b8089c
2
@Override public void dispose() { super.dispose(); if( connection != null && connection.getTargetItem() != null ) { connection.getTargetItem().removeDependent( this ); } }
bdadd44f-73bd-4514-bfad-ddcbf26b5cda
2
@Override protected void generateLevel() { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { tiles[x + y * width] = random.nextInt(4); } } }
bb429d17-4dc2-4058-91c4-7abd835cc6e5
5
private void createPrintQualityCombo(PrintRequestAttributeSet set) { PrintQuality[] qualities = (PrintQuality[]) mService.getSupportedAttributeValues(PrintQuality.class, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null); if (qualities != null && qualities.length > 0) { HashSet<PrintQuality> possible = new HashSet<>()...
4805e3b8-1ea7-4b16-9e69-57e3799e8ea0
3
private void initializeResultsFile() { // Initialize the results file FileWriter fwriter = null; FileWriter fwriterFin = null; FileWriter fwriterDropped = null; try { // overwrite existing file fwriter = new FileWriter(super.get_name() + ".csv...
e5d6f463-6fb7-4562-973a-b43931dd9d37
5
public static void main(String[] args) { if (args.length != 2) { System.out.println("使用法:java FindFile1 検索文字列 検索対象ファイル"); System.out.println("例: java FindFile1 System FindFile1.java"); System.exit(0); } String findstring = args[0]; System.out.println("検索文字列は「" + findstring + "」です。"); String filenam...
11f59543-4e3a-4565-9f1f-d4cbcb364a73
3
public void createTrainerImages() { URL url; if(trainer!=null) { if(trainer.type==Trainer.TrainerType.GYM_LEADER||trainer.type==Trainer.TrainerType.ELITE) { url = Pokemon.class.getResource("Sprites/trainers/"+ trainer.name + ".png"); enemyTrainerImage=Toolkit.getDefaultToolk...
992657fb-6d1c-4eda-92ad-b3b40744f8ac
7
private void add(LocalVarEntry li) { LocalVarEntry prev = null; LocalVarEntry next = list; while (next != null && next.endAddr < li.startAddr) { prev = next; next = next.next; } /* * prev.endAddr < li.startAddr <= next.endAddr */ if (next != null && li.endAddr >= next.startAddr) { if (next.ty...
7bebd764-2dcb-4bf0-9744-4cce17dd8b92
6
public static void main(String[] args) { try { List<String> warnings = new ArrayList<String>(); boolean overwrite = true; File configFile = new File(ClassLoader.getSystemResource(runXMLAUTHORITY).getFile()); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = cp.parseConf...