method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
3f617ec6-1862-4385-8c1b-411db7e150ae
6
public void update() { Board board = Board.getInstance(); int x = board.getIntX() + (board.getIntWidth() - 11 * BoardEntity.FIELD_SIZE) / 2; int y = board.getIntY() + (board.getIntHeight() - 11 * BoardEntity.FIELD_SIZE) / 2; switch (getType()) { case RED_PLAYER: ...
fc337691-3941-4d99-bb83-2d6c1f359d2d
6
private double getMontant(String type, double max) { String choix; double montant; choix = ""; montant = 0; while(choix != null) { choix = JOptionPane.showInputDialog("["+type+"] Veuillez entrez le montant:"); if(choix == null) montant = 0; else { try { montant = Double.parseDouble(...
c709c9c3-7f08-4d3c-af70-76e676df3e6c
5
private GameState monkeyDay(GameState state, Card card, boolean output) { Color faction = card.getFaction(); //get the players' index int playerIndex = 0; for(int i = 0; i < state.getPlayerList().length; i++) { if(state.getPlayerList()[i].getFaction().equals(faction)) { playerIndex = i; } } ...
ca71bdfa-f219-448c-8137-1bc223d7e90f
9
private void drawFractalBruteForce(int image_size) { double size = fractal.getSize(); double size_2_x = size * 0.5; double size_2_y = (size * height_ratio) * 0.5; double temp_size_image_size_x = size / image_size; double temp_size_image_size_y = (size * height_ratio) / image_si...
eed34fbf-f115-4e15-a27f-4b0656e24643
2
public void visitTypeInsn(final int opcode, final String type) { mv.visitTypeInsn(opcode, type); // ANEWARRAY, CHECKCAST or INSTANCEOF don't change stack if (constructor && opcode == NEW) { pushValue(OTHER); } }
efcf6bb4-ee76-492a-b960-0dd7812e0438
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ProgramName other = (ProgramName) obj; if (m_name == null) { if (other.m_name != null) return false; } else if (...
28b1c273-75a9-441c-89c0-97c58a265d21
3
public static void main(String[] args) { String message = "This is &lt;3"; String messageToSend = Tags.CHAT_MSG_S + message + Tags.CHAT_MSG_E; try { ProtocolChatMessage pro = Communicate.getProtocolChatMessage(messageToSend); message = pro.getContent(); } catch (TagFormatException e) { // TODO Auto-gen...
272f6b1c-e210-4dbb-b3d1-8ac22cbcd324
6
private PromotionManifestParser loadManifest() throws ExFatalError { //Locate the manifest file in the base directory File lManifestFile; try { lManifestFile = resolveFile(MANIFEST_RELATIVE_FILE_PATH); } catch (FileNotFoundException e) { throw new ExFatalError("Cannot locate manife...
51ef6055-a44e-40d1-849c-1b0dde19fd2e
1
public Inventory(Coord c, Coord sz, Widget parent) { super(c, invSqSizeSubOne.mul(sz).add(new Coord(17, 1)), parent); isz = sz; if (parent.canhastrash) { trash = new IButton(Coord.z, this, tbtni[0], tbtni[1], tbtni[2]); trash.visible = true; } else { trash = null; } recalcsz(); }
54eba8c4-fa47-45c1-a216-27a04d9b90cd
6
public void liiku(Suunta suunta){ boolean liikuttiinko = false; switch (suunta) { case Pohjoinen: liikuttiinko=liikupohjoiseen(); break; case Ita: liikuttiinko=liikuitaan(); break; case Etela: ...
fb9360f1-3971-4bc8-857a-e5100067e70c
2
private void addm(int m1, int m2) { for(int i = 0; i < ms1.length; i++) { if(ms1[i] == -1) { ms1[i] = m1; ms2[i] = m2; return; } } throw(new RuntimeException("Ran out of segment buffers!")); }
7c7debd5-a7a1-4c14-9da1-220ed853df7d
5
public int readPackage(int depth, HashMap classes, String packageName, int count) { if (depth++ >= MAX_PACKAGE_LEVEL) return count; String prefix = packageName.length() == 0 ? "" : packageName + "."; Enumeration enum_ = ClassInfo.getClassesAndPackages(packageName); while (enum_.hasMoreElements()) { // ...
8d02c81b-d763-4a03-be57-6e92f40eea06
5
public static void main(final String[] args) { List<String> items = Utils.readFromFile("problem67.txt"); Collections.reverse(items); //Utils.printList(items); List<Integer[]> ints = convertToIntArray(items); /* * arr = list of each row of numbers * 04 62 98 27 23 09 70 98 73 93 38 53 6...
fbd8e958-38aa-42bc-b962-87337ccc835e
4
@Override public void run() { Socket socketFileTransfer; try { socketFileTransfer = new Socket(ipOfPeer, portFile); DataOutputStream writeFile = new DataOutputStream(socketFileTransfer.getOutputStream()); writeFile.writeUTF(Tags.FILE_DATA_BEGIN); writeFile.flush(); byte[] fileDataToByte = getBytesF...
f61cd656-a919-4a40-86da-cd5caab9b2b3
5
public Iterator<E> iterator(){ final LinkedList<Node<E>> liste = new LinkedList<Node<E>>(); if(!(root.isEmpty())){ liste.push((Node<E>)root); int i = 0; while(!(liste.get(i).smaller.isEmpty())){ liste.push((Node<E>) liste.get(0).smaller); } } return n...
ad8f7d59-fad3-4b8e-b19d-4ff37cb5d108
1
@Override public StringBuilder doInBackground() throws IOException, InterruptedException { int lineNumber = 0; Scanner in = new Scanner(new FileInputStream(file)); while (in.hasNextLine()) { String line = in.nextLine(); lineNumber++; te...
c9c9bc65-a6c7-47bc-8998-baca1de85b2e
8
public ChessGameConfiguration[] search(ChessGameConfiguration cgc,List<? extends Piece> availablePieces){ SearchEngineStep ses = new SearchEngineStep(cgc, availablePieces); this.pendingSearchSteps.add(ses); while(!this.pendingSearchSteps.isEmpty()){ SearchEngine...
10f70115-f0dc-44f4-8b48-8b9ef2c7a927
7
public static <E> Collection<List<E>> selectExactly(List<E> original, int nb) { if (nb < 0) { throw new IllegalArgumentException(); } if (nb == 0) { return Collections.emptyList(); } if (nb == 1) { final List<List<E>> result = new ArrayList<List<E>>(); for (E element : original) { result.add(C...
d5dd14f4-8b22-4354-a54b-27cf6503765f
3
public void savePlayerF() { if ((this.kits == null) || (this.PlayerF == null)) return; try { getPlayerF().save(this.PlayerF); } catch (IOException ex) { Bukkit.getLogger().log(Level.SEVERE, "Could not save config to " + this.PlayerF, ex); } }
8ec3da1f-3a3f-4898-bebd-5a1da200b53e
0
public void setTransitions(Transition[] transitions) { this.transitions = transitions; table.setModel(new TransitionTableModel(transitions)); }
0a0b16cc-34c4-4e08-b217-424f0ac46dc3
9
public Object call()throws IOException{ Message msg=new Message(); Calendar cal; while(true) { msg.receive(in); if(msg.getType()==Message.stop) { for(int i=0; i<neighborRecords.length; i++) msg.send(neighborRecords[i].getControlSocket().getOutputStream()); break; } else if(msg.get...
4a9f4494-f0c6-4671-a225-36186fca22e8
0
public String getDepartureStation() { return this._departureStation; }
3ecc31fd-559d-4e58-adfd-6899fc700568
9
private ListNode merge(ListNode leftHead, ListNode rightHead) { ListNode head = null; ListNode tail = head; while (leftHead != null && rightHead != null) { if (leftHead.val <= rightHead.val) { if (head == null) { head = leftHead; tail = leftHead; leftHead = leftHead.next; tail.next = nu...
f7b13b23-796e-4fbb-bca3-1755c1892961
0
public void warn(final String msg) { }
2ae9dda8-ff4a-4eed-a9e6-af79aa2ca093
6
private static void assertListEquals(List<LocaleCode> list1, List<LocaleCode> list2) { if (list1 == null) { if (list2 == null) { // Equals return; } else { fail(); return; ...
72289fce-5b1f-479c-ae71-3d3d0190a53e
6
public void update() { // update position getNextPosition(); checkTileMapCollision(); setPosition(xtemp, ytemp); // check flinching if (flinching) { long elapsed = (System.nanoTime() - flinchTimer) / 100000; if (elapsed > 400) { flinching = false; } } // if we hit a wall, go the other way!...
a4b9f473-c16c-4292-924a-d06a18df6082
0
public Node getNewNode() { return newNode; }
81ee118c-b3de-4378-9e3b-b2e2c542c15a
1
public void execute(MinersWife wife){ if(rand.nextFloat() < 0.1){ wife.getFSM().changeState(VisitBathroom.getSingleton()); } }
e8b1e872-c3f0-4001-8716-b608a36a41b1
3
float[] matrixMult(float[] a, float[] b, int len) { int rows = a.length / len; int cols = b.length / len; float[] out = new float[rows * cols]; for (int i = 0; i < rows; i++) { for (int k = 0; k < cols; k++) { for (int j = 0; j < len; j++) { ...
363e41d0-b225-4b05-be4a-cb4c7d3b9282
8
public Integer evaluate2(ArrayList<String> arr1, ArrayList<String> arr2) { // Be greedy, but not too greedy...limit map to 100M buckets but try for // 1000 buckets per potentially-used item. Should keep us under our // allotted default -Xmx512MB. Integer capacity = arr1.size() > 10485 ? 10485760...
73b4d08a-f20e-4a94-a626-7539abe1d493
9
public static String deLeet(String str) { String leetStr = new String(); for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case '1': leetStr += "l"; break; case '3': leetStr += "e"; break; ...
9a37512d-0f39-4ee6-9438-87fe5e2a89f3
7
public void act(List<Actor> newActor) { refresh++; if (refresh < 20) return; refresh=0; int modifier = maximumGrass- (countRabbits() / dependencies); modifier = (modifier < minimumGrass)? minimumGrass : modifier; if (amountGrass < modifier || (countRabbits() < 1000 && amountGra...
5b366d47-c075-48f3-9fe6-1a67b6baafbd
3
public boolean equals(Object obj) { if (obj == null || getClass() != obj.getClass()) { return false; } if ((this.getISBN() == ((BookRating) obj).getISBN())) { return true; } return false; }
24524ea4-70a5-45cb-87da-b49de7fb8793
0
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { propertyChangeSupport.firePropertyChange(propertyName, oldValue, newValue); }
62ada44e-2f02-47c8-9461-62acbfcd28d9
9
private static void collectItemData(String itemPath, String split_Sign) throws IOException { File file = new File(itemPath); BufferedReader buffRead = new BufferedReader(new InputStreamReader(new FileInputStream(file))); boolean flag = true; int tmp = 0 , count = 0; int[] itemIndex = new int[DataInfo...
c0239ded-6e6a-4ea1-8786-ff1b74b9e400
4
public void testForFields6() throws Exception { DurationFieldType[] types = null; try { PeriodType.forFields(types); fail(); } catch (IllegalArgumentException ex) { // expected } types = new DurationFieldType[0]; try { ...
67013dd6-ae3f-4cb9-911f-f7fb20f0d5ec
0
void initTotalAmount() { totalAmount = 0; totalAmountProperty.set("0"); }
e4dc31c0-a46e-4a49-9e96-8ce7ed82badb
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; LogEntry other = (LogEntry) obj; if (message == null) { if (other.message != null) return false; } else if (!message.equals(other.messag...
e1e1f208-fa4d-441c-af34-cf548e3c05e9
4
private void controlCursor() { if(tabbedPane.getTabCount()>0) if(closeUnderMouse(meX, meY)){ tabbedPane.setCursor(new Cursor(Cursor.HAND_CURSOR)); if(selectedTab > -1) tabbedPane.setToolTipTextAt(selectedTab, "Close " +tabbedPane.getTitleAt(selectedTab)); } else{ tabbedPane.setCurso...
629b3774-8a18-43de-b31e-99266213d48e
3
private String[] diff_halfMatchI(String longtext, String shorttext, int i) { // Start with a 1/4 length substring at position i as a seed. String seed = longtext.substring(i, i + longtext.length() / 4); int j = -1; String best_common = ""; String best_longtext_a = "", best_longtext_b = ""; Strin...
26342748-54bb-4d2a-9097-d96d5637503f
4
private AccessDB() { try { Class.forName("com.mysql.jdbc.Driver"); } catch (ClassNotFoundException cnfe) { System.err.println("Couldn't load mysql driver"); } try { // DO NOT EDIT THE FOLLOW 2 LINES (JACOB) conn = DriverManager.getConnecti...
8458e876-f001-4b8e-88f4-bfa3d9d8032a
9
public static void main(String[] args) { in = new Scanner(System.in); System.out.println("Digite o número de processos: "); int proc = in.nextInt(); System.out.println("Digite o número de blocos de memória: "); int mem = in.nextInt(); int procArray[] = new int[proc]; int memArray[] = new in...
4b93e445-a6b2-4304-b551-d3b8b100407b
0
public void registerPrototype(){ prototype = new ConcretePrototype(); Prototype copytype = (Prototype) prototype.clone(); manager.add(copytype); }
eeb96012-13c0-43aa-8808-2ddaf3a26b2c
1
public List<Funcao> getListagem() { if(listagem == null){ listagem = dao.Buscar(null); } return listagem; }
d308db16-97a1-45b5-9960-c02ba3b34e7e
2
public static void main(String[] args) throws Exception { int j = 1; while (j <= 10) { int i = 1; while (i <= 10) { System.out.print(i*j); System.out.print(" "); i++; } System.out.println(); ...
07fc21f8-8272-4533-a824-4f26239bfa5b
0
public void display() { System.out.println("Usuario: "+ username); System.out.println(timeString(timestamp)); /*System.out.println(likes + " me gusta"); if(comments.isEmpty()) { System.out.println("No hay comentarios"); } else { System.out.println("Hay " + comments.size() + " comentario(s...
7dcecd4f-e20a-45de-8d39-246e78d088a8
1
private void whileStatement() { if (accept(NonTerminal.WHILE_STATEMENT)) { enterScope(); expression0(); statementBlock(); exitScope(); } }
75a5ad8d-4488-47c6-9e96-644c26a9c908
6
int getNumOpenSets(Space space) { int num = 0; if (isOpenForPiece(board[space.pos[0]], space.piece)) num++; if (isOpenForPiece(getColumn(space.pos[1]), space.piece)) num++; if (space.diagID % 2 == 0 && isOpenForPiece(getTopDownDiag(), space.piece)) num++; if (space.diagID % 3 == 0 && isOpenFo...
e73442cf-beb3-45e0-86b9-450a8aed6509
5
private void btn_buscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_buscarActionPerformed java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("dd/MM/yyyy"); String desde = "01/01/1990"; try { desde = sdf.format(txt_fechadesde.getDate()); ...
0fca8f8a-be7b-477c-ac76-a7b9ca398a19
6
protected void evaluateTaskList() throws MasException { for (Task t : toDo) { if (myData.getCaps().get(t.getRequiredCapability()) == null ) { leftOvers.add(t); } } toDo.removeAll(leftOvers); Collections.sort(toDo, new Comparator<Task>() { public int compare(Task a, Task b) { Map<Integer,...
224490ad-cfec-43e8-9495-53080c7819ee
6
public boolean keepParentVersion(File pomFile, boolean noParent, boolean keepPomVersion) throws Exception { boolean keepParentVersion = !noParent && keepPomVersion; if (keepParentVersion && repository != null) { POMInfo pom = readPom(pomFile); if (pom.getThisPom().isPom() && pom....
190a09a4-626b-456c-ae7d-182325b75e81
4
private void computeCanBeAvail(final ExprInfo exprInfo) { final Iterator blocks = cfg.nodes().iterator(); while (blocks.hasNext()) { final Block block = (Block) blocks.next(); final Phi phi = exprInfo.exprPhiAtBlock(block); if (phi == null) { continue; } if (!phi.downSafe() && phi.canBeAvail(...
83b028ea-30c2-42f0-a7c7-d2312397850a
8
private int jjMoveStringLiteralDfa3_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(1, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(2, active0); return 3; } switch(curChar) { case 100: ...
14a093eb-ad7c-4092-a98f-f4089e0d0b0a
2
public static String getPrevious() { if ( getSize() == 0) return ""; if (position == 0) // vrátí nejstarší příkaz, pokud už jsme na konci setPosition(1); return history.get(--position); }
4256a4cb-98cc-42af-9769-f3f336a62e08
8
private double desiredDirection() { if (directions.contains(Direction.UP)) { if (directions.contains(Direction.RIGHT)) { return 45; } if (directions.contains(Direction.LEFT)) { return 315; } return 0; } if (directions.contains(Direction.DOWN)) { if (directions.contains(Direction.RIGHT)) ...
9d303bc6-7f9f-4d62-95d4-c9206ad37e06
6
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof User)) { return false; } if(object == this) { return false; } User other = (User) object; ...
38e459e9-0886-43f2-9047-517e15e26f69
5
public static void max_prod(Integer[] v) { int maxProd = 0; for (int i = 0; i < v.length; i++) { for (int j = 0; j < v.length; j++) { if( i == j) continue; int prod = v[i] * v[j]; if(prod > maxProd && prod % 3 == 0) maxProd = prod; ...
b238c02b-319c-4198-84c5-1a9b7b329768
4
@Override public int compareTo(House obj) { if ((double) this.value / (double) this.area > (double) obj.value / (double) obj.area) { return -1; } else if ((double) this.value / (double) this.area < (double) obj.value / (double) obj.area) { return 1; } else { if (this.area > obj.area) { ...
7263a3b5-f093-40c8-9731-f2871010ea76
7
public boolean accept(File f) { if (f.isDirectory()) { return true; } String extension = FileTools.getExtension(f); if (extension != null) { if (extension.equals("zip") || extension.equals("tar") || extension.equals("rar") || ...
06577f0d-4d82-4457-a54c-34327e554b8e
7
@Override public String getColumnName(int column) { Object return_object = null; switch(column){ case 0: return_object = "Имя"; break; case 1: return_object = "Фамилия"; break; case 2: return_object = "Отчество"; break; case 3: return_object = "Город"; bre...
85fe9bf5-958c-4d85-b90e-a3b0a4b9cfd1
5
private boolean labyrinth(int i, int j, int height, int length) { ArrayList<Integer> possibile = new ArrayList<Integer>(); for (int s=4;s<length-3;s=s+3) { possibile.add(s); } return j>3 && j<height-3 && (possibile.contains(i)) && j!=height/2 && j!=height/2-1; }
0b22675f-d630-45d1-b3ee-935cc6262ccd
8
public void calcFunctionData(double domainLeft, double domainRight) { double tmp; String var; dx = (intervalRight-intervalLeft)/steps; if(intervalLeft<domainLeft) { domainLeft = intervalLeft; } if(intervalRight>domainRight) { domainRight = intervalRight; } if(points == null) { ...
13cdf57a-7874-4397-b09c-d600b3d8ccf2
9
public void draw(UShape ushape, double x, double y, ColorMapper mapper, UParam param, Graphics2D g2d) { final UText shape = (UText) ushape; final FontConfiguration fontConfiguration = shape.getFontConfiguration(); final UFont font = fontConfiguration.getFont().scaled(param.getScale()); final Dimension2D dimBac...
279bdd12-debb-4203-b887-e942b686d6c1
6
public void testUseTube() { Client client = new ClientImpl(TEST_HOST, TEST_PORT); client.useTube("foobar"); // hashes are not valid in tube names try { client.useTube("foobar#"); fail("no BAD_FORMAT thrown"); } catch (BeanstalkException be) { assertEquals("BAD_FORMAT", be.getMessage()); } catch (E...
24324c2e-7448-4c69-b54d-9449de245527
3
private void initializeArrangementList() { // theList.setFixedCellSize(20); theList.getSelectionModel().selectedItemProperty() .addListener(new ChangeListener<String>() { @Override public void changed( ObservableValue<? ...
75b3f75a-179a-4baa-9b9f-ef8061538669
7
private void parseAllScreensAndPopulateMap(ArrayList screenFileList) { DocumentBuilder dBuilder = null; try { dBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); } catch (ParserConfigurationException ex) { System.out.println("ERROR ON...
39b1400c-da06-4268-8765-ec693542196e
5
protected JTableExtender initializeTable(Object obj) { boolean multiple = false; if(this.getEnvironment().myObjects!=null) multiple = true; TableModel model = InputTableModel.getModel((Automaton)getObject(), multiple); JTableExtender table = new JTableExtender(model, this); table.setShowGrid(true)...
81bcf244-8163-449e-b2a8-424f3f63fec9
0
public boolean contains(String key) { return get(key) != null; }
836fdf87-987d-42c8-bde6-ca0efc527086
6
private void doLoad(ConnectionWrapper cw) throws SQLException, ClassNotFoundException { //get the column names and types from the database StringBuilder stmt = new StringBuilder("SELECT COLUMN_NAME,COLUMN_CLASS,COLUMN_SIZE FROM "); stmt.append(Defaults.TYPE_TABLENAME); stmt.append(" WHERE OWNER_TABLE = ?"); ...
b231d0eb-3b1b-4ad6-a5b7-c05fb565f6d2
6
public static void printSymbolNameReadably(String name, PrintableStringWriter writer, boolean casesensitiveP) { { Keyword testValue000 = Stella.computeSymbolEscapeCode(name, casesensitiveP); if (testValue000 == Stella.KWD_UNESCAPED) { writer.print(name); } else if (testValue000 == Stella....
d1f3b3dc-931b-4522-89a9-dc1b854de84c
9
@Override public boolean grantsAggressivenessTo(MOB M) { if(M==null) return false; if(CMLib.flags().isBoundOrHeld(M)) return false; if((!M.isMonster())&&(!doPlayers)) return false; for(final Enumeration<Behavior> e=M.behaviors();e.hasMoreElements();) { final Behavior B=e.nextElement(); if((B!...
95a39b14-4a5c-4903-af78-ae491cd8a87f
1
@Override public void close() { try { conn.close(); } catch (SQLException e) { console.printf("SQLException: %s\n", e.getMessage()); console.printf("SQLState: %s\n", e.getSQLState()); console.printf("SQLVendorError: %s\n", e.getErrorCode()); } conn = null; }
c74015a7-5bc0-446a-9116-3e011c4fc8b7
3
private void fillBoardWithLine(String line, int row) throws GOLException { for (int column = 0; column < line.length(); column++) { if (line.charAt(column) == '0') { board[column][row] = new Cell(false); } else if (line.charAt(column) == '1') { board[colum...
46102f68-9318-4670-b3bc-4bee18a5fd9a
7
public void Sort(SorterParams s) { switch (s.getType()) { case SELECTION: SelectionSort ss = new SelectionSort(); ss.sort(s); break; case INSERTION: InsertionSort is = new InsertionSort(); is.sort...
51595f90-a334-4b88-9f76-a79c66a2bb09
1
public String toString(){ if(!isPostFix)return operator.getValue() + operand.toString(); else return operand.toString() + operator.getValue(); }
a8ba4cac-a6eb-447c-b6be-052c27bd48cf
9
public void mousePressed(MouseEvent e){ requestFocus(); int x = e.getX()-margin/2; int y = e.getY()-margin/2; currentnote = 0; if(y < blackH){ for(int i = 0; i < nblackkeys; i++){ if((blackkeystartx[i] < x)&&(blackkeyendx[i] >= x)){ currentnote = blackkeynotes[i]; break; } } } if(curren...
d656f607-b1d7-4bee-b8bd-796c23bf7fcc
1
public static void freshUI() { if (isChecking) { btnOpen.setEnabled(false); btnCheck.setEnabled(false); btnCheck1.setEnabled(false); btnSave.setEnabled(false); freshStatus("检测中"); } else { btnOpen.setEnabled(true); btnCheck.setEnabled(true); btnCheck1.setEnabled(true); btnSave.setEnabled...
42391d60-ab3e-45ec-b1cc-3785f916aa7b
9
public void guardarCodificacion(StringBuffer bf, String ruta, double p[], int alto, int ancho) { File f = new File(ruta); FileOutputStream arch_comp = null; try { arch_comp = new FileOutputStream(f); DataOutputStream data = new DataOutputStream(arch_comp); //ESCRIBO LA RESOLUCION DE LA IMAGEN EN LAS ...
5b07f184-b764-417b-a028-73e2f787ed26
9
public String outputHHweek(ResultSet weekRes, String start_date, String time) { String pg = ""; int numPizzas; double pizzaRevenue; // AdminQuery adminQuery = new AdminQuery(); try { if (weekRes.next()) { pg += "<b>Week "+time+" "+start_date+"</b><br>"; pg += "<table border='1'>"; pg += "<tr...
ea9792c3-3f3e-43b4-be6b-7aca47e6982a
7
public void logic() { //let's do one tick boolean allNull = true; for (int i = 0; i < DFOCI; i++) { //for each circle, /* We have 2 modes, "ALL AT ONCE" and "NOT ALL AT ONCE". * If we're in all-at-once mode, then we have to wait until all * of the circles get stuck...
c88c45a7-ee7a-4b82-976a-57a6a0c491d5
2
public void run() { JFrame fenetreMastermind = new JFrame() ; fenetreMastermind.setTitle("Minecraft"); fenetreMastermind.setSize(700, 900); fenetreMastermind.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); JPanel panelPrincipal = new JPanel() ; GridLayout grillePanelCombina...
a7903c46-f6fc-45f4-b02a-6a0387090a46
2
public void update(){ try{ Integer.parseInt(buynumber.getText());} catch(NumberFormatException nf){ return; } try{ Integer.parseInt(sellnumber.getText());} catch(NumberFormatException nf){ return; } calcStats(); refresh(); }
721ee92d-11bb-4f8d-9f2f-c8a380f46552
0
@Override public void setDisconnect(boolean value) { disconnect = value; }
721ead46-b8c6-4e02-a2bd-7825149d8573
2
public Hunter getHunter(AID senderAID) { Hunter hunter; for (int i=0; i<hunters.size();i++){ hunter = hunters.get(i); if (hunter.getHunterAID().equals(senderAID)) return hunter; } return null; }
b7a21d45-8fee-4ca3-8e99-6787443e9dd2
8
@Override public Makefile parse(String makefilePath) throws IOException { MakefileBuilder makefileBuilder = new MakefileBuilder(); String currentTarget = null; MakefileExecution currentExecution = null; BufferedReader lineReader = new BufferedReader(new FileReader(makefilePath)); ...
4d341aca-f99e-4680-bfcf-b50954ccc399
2
private void loadState(int state){ switch (state){ case MENUSTATE: gameStates[state] = new GameStateMenu(this); break; case GAME: gameStates[state] = new World(this); break; } }
8608a624-cff8-4a2f-80d7-6aad16f8d70a
7
public void update(Packet p) { boolean send = false; int[] minDistance = new int[4]; for(int h = 0; h < 4; h++){ int a = Math.min(distanceTable[h][0], distanceTable[h][1]); int b = Math.min(distanceTable[h][2], distanceTable[h][3]); minDistance[h] = Math.min(a, b); } ...
fac77a76-bffc-471a-8edc-8312e225ff04
7
public int trap(int[] A) { if(A.length<3) return 0; int water = 0; int maxLeft[] = new int[A.length]; maxLeft[0] = 0; int maxRight[] = new int[A.length]; maxRight[A.length-1] = 0; for(int i=1; i<A.length; i++) { if(maxLeft[i-1] < A[i-1]) { maxLeft...
08c35fcc-34c9-45ec-a01a-c91427225f17
3
@Override public BufferedImage getBufferedImage() { if (bufferedImage == null) { bufferedImage = new BufferedImage(getWidth(), getHeight(), 1); } RgbImage rgb = ImageConversionUtils.convertToRgb(this); for (int x = 0; x < getWidth(); x++) { for (int y = 0; y < getHeight(); y++) { bufferedImage.setRGB...
8e79ecf7-7105-4766-ab51-67510361ff92
5
public static void drawRoundedRectangle(int x, int y, int width, int height, int color, int alpha, boolean filled, boolean shadowed) { if (shadowed) drawRoundedRectangle(x + 1, y + 1, width, height, 0, alpha, filled, false); if (alpha == -1) { if (filled) { drawHorizontalLine(y + 1, color, width -...
e1c3f201-e569-472b-a9c6-63f03c7bdb4b
8
public static boolean fileprocess(String downloadpath, String filepath, String []paras, String sn){ int errorcode=0;// print error code in the final output file; int errornum = 12; String result=""; File downloadfile = new File(downloadpath+"\\rw_eeprom_test.txt"); File outputfile = new File(filepath);...
e1bc657f-6e97-4539-b6a7-8d9b7ec98ab8
9
private ArrayDeque<Entry> getTopResults(String query, int num_results) { if(query == null) return null; if(query.equals("")) return null; PriorityQueue<Entry> results = new PriorityQueue<Entry>(10,new Entry()); List<WordValueStore> ws = the_trie.getWordsWithPrefix(query); for(WordValueStore each_ws:ws){ if...
bfaf9cfa-ef44-437e-b7c1-756fa272b0f1
5
public int[][] getA_StarRoutedArray() { int[][] asRgb = rgb; int i = this.destI_pos; int j = this.destJ_pos; double cost = 0; if (graph[i][j].getPath() != null) { cost = graph[i][j].getDistanceFromStartPoint(); while (graph[i][j].getPath() != null) { ...
04bd1b29-281e-4845-a5a9-3c9960033ccb
2
public static void installGtkPopupBugWorkaround() { GtkMenuWorkaround workaround = new GtkMenuWorkaround(); if (workaround.shouldRun()) { if (System.getSecurityManager() == null) { workaround.run(); } else { AccessController.doPrivileged(workaround); } } }
58e5f858-95a1-4ca6-9dae-db969a125e25
2
public void reset(Deck deck) { for (Card card : getDeck()) { if (card.getOrientation()) { card.flip(); } deck.getDeck().add(0, card); } deck.shuffle(); getDeck().clear(); refreshImage(); }
acf85cb1-77dd-4c47-b2cc-3a8b333e21a1
8
public boolean Function() { if (robot != null) { if (radio < 0) { radio = 0; } if (radio > 0) { robot.antenna = true; ports[1].value = true; } else { robot.antenna = false; ...
f6b420de-3525-4571-b39f-5ec71aefa8d5
0
public IntDataType getTimeDrift() { return timeDrift; }
22c4bac5-0b92-4718-b408-ec18437fdcef
1
public int getActiveConnections() { /// Get the number of players CURRENTLY connected to the server: int activeConnections; outToServer.println("SENDACTIVECONNECTIONS"); try { activeConnections = Integer.parseInt(inFromServer.readLine()); System.out.println("Active connections on server: " + activeConnec...
e84ab640-3101-4408-bb2f-0bf80a7ff87d
4
public static void saveRentalMedia(int rentId, int prodId, String type){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { conn.setAuto...
7453863c-a76a-413c-a053-4ebaca21792f
0
public Dollar getDollar() { return dollar; }