method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
fb0a69b8-da39-4439-8b65-3a8e6670f978
3
static private int jjMoveStringLiteralDfa4_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(2, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(3, active0); return 4; } switch(curChar) { cas...
bffd5670-92da-4f89-9496-d40c3c458c8d
7
public void printMatrix(){ for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { switch(matrix[j][i].getState()) { case defaultState: System.out.print("[ ] "); break; case ...
799e9ffe-3465-43fd-abb9-bcd216a0c60f
6
private int tilestrToInt(String tilestr) { if (tilestr==null) return 0; switch (tilestr.length()) { case 0: return 0; case 1: return (int)tilestr.charAt(0); case 2: return (int)tilestr.charAt(0) + (int)tilestr.charAt(1)*256; case 3: return (int)tilestr.charAt(0) + (int)ti...
57bd727e-6bab-4ec4-b9a9-03d2937f5c53
1
public void nextPage() { if (isHasNextPage()) { page++; } }
a11eb544-3f4f-4164-a7a9-0d0c6daced8a
4
@Override public Value evaluate(Value... arguments) throws Exception { // Check the number of argument if (arguments.length == 1) { // get Value Value value = arguments[0]; // If numerical if (value.getType().isNumeric()) { return new Value(new Double(Math.log(value.getDouble()))); } if (val...
f0aa69dd-2189-4a04-bbc0-01f8899246e0
6
public static void main(String[] args) throws IOException, ProcessException { String simType = args[args.length - 6]; int linesToRead = Integer.parseInt(args[args.length - 5]); String inFile = args[args.length - 4]; String uniFile = args[args.length - 3]; Stri...
af36bf3d-fc27-46cd-a68f-8c29cc1965a4
0
public Pass2(File source, int labelCount) { labelFile = new File(source.getName() + ".label.tmp"); // File that contains the label information sourceFile = new File(source.getName() + ".tmp"); // File that holds the cleaned/analyzed source this.labelCount = labelCount; labelMap = new HashMap<String, Intege...
32d198b1-f99f-40b4-8dce-87ca6bffe65f
4
public static void main(String[] args) throws IOException { Scanner scan = new Scanner(System.in); StringBuilder out = new StringBuilder(); precal(); out.append("PERFECTION OUTPUT\n"); while (scan.hasNext()) { int v = scan.nextInt(); if (v == 0) break; out.append(format(v) + " "); if (v == dp...
f13705b9-4caf-4326-9202-8e7f3ecff590
0
public void SetPersonNumber(int personNumber) { this.personNumber = personNumber; }
96432b09-243d-4b53-a00c-af44e43b4188
8
@Override public boolean canSetTrapOn(MOB mob, Physical P) { if(!super.canSetTrapOn(mob,P)) return false; if(mob!=null) { final Item I=findMostOfMaterial(mob.location(),RawMaterial.MATERIAL_ROCK); if((I==null) ||(super.findNumberOfResource(mob.location(),I.material())<100)) { mob.tell(L("You'...
6b99572e-8afc-4d7e-827e-baddf519441a
8
public static boolean isLessPriority(String a, String b){ String[] operadores={a,b}; int[] valores=new int[2]; for (int i = 0; i < operadores.length; i++) { switch(operadores[i]){ case "^": valores[i] = -1; break; ...
ba4f185e-7de6-408c-a134-88c3e47bf407
7
@SuppressWarnings("RedundantIfStatement") @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SvnInfo svnInfo = (SvnInfo) o; if (repositoryUrl != null ? !repositoryUrl.equals(svnInfo.repositoryUrl) : svnInfo.repositoryUrl != null)...
fc56c189-9af8-45c1-858d-88625eb00317
1
public void visit_lcmp(final Instruction inst) { stackHeight -= 4; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } stackHeight += 1; }
23f8fed4-fd89-4e4a-ac81-e5630513356e
8
public void paint(Graphics g){ super.paint(g); Room r = GameController.getRoom(); int rw = r.getSize().width + 2;//room width int rh = r.getSize().height + 2;// and height //draw background color Color c = r.backgroundColor(); if (c != null){ g.setColor(c); g.fillRect(0, 0, rw, rh); } //TODO...
30a9d85a-a33c-4c30-b850-d12c407ee4cb
1
public Item sample() { if (isEmpty()) throw new java.util.NoSuchElementException(); return a[new Random().nextInt(next)]; }
aabdb63e-f72b-4b2f-88c4-6d306847abb4
3
private static String prepareSql(String sql, List<String> names) { logger.info("Prepare sql: " + sql); String parts[] = sql.split(":"); StringBuilder bld = new StringBuilder(); boolean first = true; for (String part: parts) { if (first) { first = false...
434d21db-3d4a-4816-9edf-c12505825534
7
@Test public void testValue() { System.out.println("value"); for (int i = 0; i < this._values.length; i++) { _equals.testValue(_instance, null, _values[i], false); _equals.testValue(_instance, _values[0], _values[i], false); _equals.testValue(_instance, _v...
a9ebd4c7-3f37-4a6c-8c44-00d8b296a4c4
3
private void GuardarEstacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_GuardarEstacionActionPerformed frecue = miRadio.getFrecuencia(); if (frecue) { miRadio.Guardar(posFM, a); posFM++; } else { miRadio.Guardar(posAM, b); ...
aa6a3b0e-bc58-425c-81a3-49ce52dd85f5
8
public void setWrapIndices(int[] indices) { checkWidget(); if (indices == null) indices = new int[0]; int count = originalItems.length; for (int i = 0; i < indices.length; i++) { if (indices[i] < 0 || indices[i] >= count) { error(SWT.ERROR_INVALID_ARGUMENT); } } for (int i = 0; i < originalItem...
8a75b026-a038-4704-9a42-8244eea18189
7
public void MainHelpMenu() { if(pHead == 0 && pBeard == 10 && pTorso == 18 && pArms == 26 && pLegs == 72 && pFeet == 42 && pHands == 33){ showInterface(3559); // Shows "design your player"-screen if you haven't already designed it. } }
f62a6c67-6c79-47a2-83a4-be2d1fac99d5
4
public float priorityFor(Actor actor) { if ((! begun()) && nursery.belongs.personnel.assignedTo(this) > 0) { return 0 ; } // // Vary priority based on competence for the task and how many crops // actually need attention- final float min = sumHarvest() > 0 ? ROUTINE : 0 ; final float...
2e0c47cd-fa22-474d-9548-f77c328eef9b
5
private void createItems() { HashSet<String> itemPaths; try { itemPaths = KvReader.getKvFiles("./items/"); } catch (IOException e){ e.printStackTrace(System.err); return; } for (String s : itemPaths) { HashMap<String, String> itemAt...
1fbde629-3e7a-49ac-99ef-8257438c9bf3
1
@Override public void run() { if( getChannels().length == 0 ) joinChannel(channel); }
e7cbb85a-0aff-49b5-99d3-31b9301e8a2e
3
public void busquedaDesordenada(T dato){ Nodo<T> nodoQ = this.inicio; while(nodoQ != null && nodoQ.getInfo() != dato){ nodoQ = nodoQ.getLiga(); } if(nodoQ == null){ System.out.println("El elmento no se encuentra en la lista"); }else{ System.out.println("EL elemento se encuentra en la lista"); } }
07d3bfa7-ca18-4df2-a4e4-a9895310a171
0
public boolean isUrlModified() { return urlModified; }
d39b7f33-e2f1-454f-9ec3-9ce060f47814
8
public boolean checkAllPortalsFor(MoveableObject object, MazeGame maze) { for (Portal portal : portals) { if (portal.intersects(object) && portal.isActive) { portal.lit = true; portal.getEndPortal().lit = true; if (!lights.contains(portal)) lights.add(portal); if (!lights.contains(portal.getEndPort...
1647c284-20bb-4164-bf68-19c5ca1ef706
7
boolean isPostingSupported(OMMMsg ommMsg) { if (!ommMsg.has(OMMMsg.HAS_ATTRIB_INFO)) return false; OMMAttribInfo ai = ommMsg.getAttribInfo(); if (!ai.has(OMMAttribInfo.HAS_ATTRIB)) return false; OMMElementList elementList = (OMMElementList)ai.getAttrib(); ...
5c804e5b-e7cc-467f-9173-618762b77ec9
6
public static ArrayList<String> splitFile() throws IOException{ DataHandler.cleanDir(preprocessFolder); ArrayList<String> fileList=DataHandler.getFileList(DataHandler.originFolder); int fileTag=0; int lineCnt=0; BufferedReader br = null; BufferedWriter bw = null; for(int i=0;i<fileList.size();i++){ Fi...
ad84e9a8-9e50-4f4b-b21e-6006d3420089
3
@Override public void initialize() { try { out = new File("src/main/resources/data/hw1-huatang.out");// Path to create my output file. bw = new BufferedWriter(new FileWriter(out)); } catch (Exception e) { e.printStackTrace(); } testfile = new File("src/main/resources/data/sample.ou...
3d029abb-6e31-456e-9550-2b483dc30871
5
public static void main(String[] args) { @SuppressWarnings("resource") Scanner scan = new Scanner(System.in); scan.nextLine(); scan.nextLine(); scan.nextLine(); TreeMap<Integer, TreeMap<String, Double>> exam = new TreeMap<>(); while(true){ String input = scan.nextLine(); if (input.contains("-"...
9cbabbe4-d4dc-4dbb-acf3-91252702c34c
8
@Override public void run() { System.out.println("Listening on port " + this.serversocket.getLocalPort()); ArrayList<String> workerList = new ArrayList<>(); // Read list of workers from configuration file try(BufferedReader br = new Bu...
0af2017e-33a3-464a-9276-42d0b665955a
1
public ArrayList<Segmento> getSegmentoPorId(String ticket) throws SQLException{ Statement stm = getConnection().createStatement(); String sql = "SELECT * FROM segmentos WHERE ticket='"+ticket+"'"; ArrayList<Segmento> segmentos = new ArrayList(); ResultSet rs = stm.executeQuery(sql); ...
d3b13a53-d0a5-46be-978c-7adaa7abae91
3
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof CmpPoint)) { return false; } CmpPoint o = (CmpPoint) obj; return this.x==o.x && this.y==o.y; }
57265aab-26c0-4af4-8d11-78e947b8c3f7
2
public void close() throws IOException { if (!this.stack.empty()) { throw new InvalidObjectException("Tags are not all closed. " + "Possibly, " + this.stack.pop() + " is unclosed. "); } if (thisIsWriterOwner) { this.writer.flush(); ...
2405209e-ae22-428b-87df-45b2e0c0463f
9
public void moveLeft() { setDirection(-90); for (TetrisBug tb : blocks){ tb.setDirection(-90); } if (rotationPos==0){ if (canMove() && blocks.get(0).canMove() && blocks.get(1).canMove() && blocks.get(2).canMove()) { for (TetrisBug tb: blocks){ tb.move(); } move(); } } if (r...
3c3cc8d1-73cc-48cf-a204-d1893256b06f
2
public static void Update() { for(int i = 0; i < NUM_KEYCODES; i++) m_lastKeys[i] = GetKey(i); for(int i = 0; i < NUM_MOUSEBUTTONS; i++) m_lastMouse[i] = GetMouse(i); }
e566706a-0271-4eb5-9bfd-670743a98acf
7
protected String getLabel(Tree tree, Node node) { if (displayAttribute.equalsIgnoreCase(TAXON_NAMES)) { Taxon taxon = tree.getTaxon(node); if (taxon != null) { if (textDecorator != null) { textDecorator.setItem(taxon); } return taxon.getName(); } else { return "unlabelled"; } } i...
0edfe808-5af9-4a71-b8fc-456822c91b82
1
public boolean canHaveAsBalance(BigInteger balance) { return (balance != null) && (balance.compareTo(this.getCreditLimit()) >= 0); }
781c676a-39ca-4619-91db-50116cef9774
9
private void markVisitedLinks() { if (!(textBody.getDocument() instanceof HTMLDocument)) return; HTMLDocument doc = (HTMLDocument) textBody.getDocument(); ElementIterator i = new ElementIterator(doc); Element e; AttributeSet as; Enumeration en; Object name; String str; SimpleAttributeSet sas; whi...
14dd235b-b386-49a3-ba5e-247d2d5b76d8
0
public static void main(String[] args) { JFrame frame = new JFrame("Mandlebrot"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(816, 638); frame.add(new MandelbrotPanelDouble()); frame.setVisible(true); // System.out.println(BigDecimal.valueOf(1...
73212c0c-e812-4cfd-9a8c-f81dc54f3eec
6
public static HashMap<Integer, Integer> backTracking(SchedulingProblem csp, ArrayList<Integer> assignmentCount) { if (isComplete(csp)) { return csp.Assignment; } Integer selectedVar; ArrayList<Integer> mostConstrainedVars = csp.getMostConstrainedMeeting(); if(mostConstrainedVars.size() != 1) { s...
34a39eb6-6558-4b0a-a18f-03af1ad23c56
7
public static double [] boundLargestEigenValue( DenseMatrix64F A , double []bound ) { if( A.numRows != A.numCols ) throw new IllegalArgumentException("A must be a square matrix."); double min = Double.MAX_VALUE; double max = 0; int n = A.numRows; for( int i = 0; i ...
6dcde0d6-16e1-4988-9996-821c26e6e56d
9
private FlagGUI() { addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { Script.stop(); dispose(); } }); setResizable(false); setTitle("Flag Viewer"); setBounds(100, 100, 766, 603); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(...
121be899-3122-4679-b0ee-388c297d96c2
3
public String getJson(String location, String city) { try { /* * Create the query url from template */ city = city.replace(" ", "_"); location = location.replace(" ", "_"); String weatherQuery = String.format(QUERY_URL, location, city); ...
0d024899-9f75-4e75-a69f-e8a8e1aff50f
7
public Template waitForMatch(Template tpl) { String queryString = ""; int i = 0; for (i = 0; i < 9; i++) { Integer min; Integer max; try { min = (Integer) PropertyUtils.getSimpleProperty(tpl, "property" + i + "_min"); max = (Integer) PropertyUtils.getSimpleProperty(tpl, "property" + i + "_max"...
d7c22c76-6049-4bc2-b607-a8155ccf372b
7
protected Trait(int type, String... descriptors) { this.traitID = nextID++ ; this.type = type ; this.descriptors = descriptors ; this.descValues = new int[descriptors.length] ; int zeroIndex = 0, min = 100, max = 0, val ; for (String s : descriptors) { if (s == null) break ; else zeroIndex+...
4a90dde6-7976-4ad9-9a54-f87404f63f69
2
public void add(int value) { if (result.size() > 0 && result.getValue((int)result.size() - 1) == value) { resultGroups.get(resultGroups.size() - 1).maxIteration++; } else { resultGroups.add(new ResultGroup((int)result.size(), (int)result.size())); } result.add(va...
897b8fc4-5842-4e6c-b612-bd96d3603ea1
1
public double getSpawnX(DodgeballPlayer p) { DodgeballTeam t = p.getTeam(); return t == TEAM_1 ? TEAM_1_SPAWN_X : TEAM_2_SPAWN_X; }
08fc02a5-d924-4afb-bb48-9b936f6a09e9
5
@Override public void add(User userBean) { try { connection = getConnection(); ptmt = connection.prepareStatement("INSERT INTO user(Name, Login, email, DateOfRegistration, password) " + "VALUES(?,?,?,?,?);"); ptmt.setString(1, userBean.getName()); ...
0e33fe4f-3cac-44eb-86f6-e5d5285a1e59
0
public double evaluate(double x) { return Math.pow(_base, x); }
5e406b01-1262-4b4e-88f5-40213cf453e1
0
public void write(String text) { textArea.append(text); int length = textArea.getText().length(); textArea.setCaretPosition(length); lastCommandOffset = length; }
5ee51c61-6047-4d3c-bcb6-756ad5e2f2e0
9
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!super.okMessage(myHost,msg)) return false; if((affected!=null)&&(affected instanceof MOB)&&(msg.amISource((MOB)affected))) { if((msg.sourceMinor()==CMMsg.TYP_ENTER) &&(msg.target() instanceof Room) &&((((Room)msg.t...
d19e24b9-bacd-4154-862c-0c591f9308eb
1
public void saveToFile() { try { FileOutputStream fileOut = new FileOutputStream(FILE); ObjectOutputStream out = new ObjectOutputStream(fileOut); out.writeObject(this); out.close(); fileOut.close(); } catch (IOException e) { e.printStackTrace(); } }
a2411229-1a10-4490-9b19-87c3978ff134
4
public void close() throws IOException { if(r != null) { r = null; ogg.close(); ogg = null; } if(w != null) { w.bufferPacket(firstPacket.write(), true); w.bufferPacket(tags.write(), false); // TODO Write the others ...
662ecd68-9dac-44df-b73d-4b3b4fff351a
0
public Square(int row, int col, Piece piece) { this.row = row; this.col = col; this.piece = piece; y = row * 80; x = col * 80; rect = new Rectangle(x, y, 80, 80); }
a64abf82-2a09-47e3-915d-1fa3765ebcf1
0
public PacketManager getPacketManager(){ return packetManager; }
dda43e81-5f3c-47ea-b1c7-fbad0d00af9a
2
private boolean checkBack(int x, int y, int z){ int dx = x - 1; if(dx < 0){ return false; }else if(chunk[dx][y][z] != 0){ return true; }else{ return false; } }
c41c82cf-4a71-414c-8474-0b7cdd7552bf
4
private void percolateDown( int hole ) { int child; T tmp = array[ hole ]; for( ; hole * 2 <= currentSize; hole = child ) { child = hole * 2; if( child != currentSize && array[ child + 1 ].compareTo( array[ child ] ) < 0 ) child++; if( array...
e7776e44-e167-4647-a235-2633e89dbcc0
3
public static boolean isSuccessResult(Option[] options){ for(int i=0,count=options.length ; i<count ; ++i){ if((options[i].getName().equals(ActionResult.RESULT)) && options[i].getValue().equals(ActionResult.SUCCESS)) return true; } return false; }
206ea26a-3ea9-4627-a4bc-35c07462c5d9
3
private void storeUpcommingEarningsPagesCustom() { try { long time = System.currentTimeMillis(); for (int i = 0; i < 14; i++) { Date days = new Date(time + 1000 * 3600 * 24 * i); String date = dateFormatForUrl.format(days); String earnings = "http://biz.yahoo.com/research/earncal/" + date + ...
6f3ec812-86ac-419d-bb4f-a1b2c4b33913
0
@Override public void onEnable() { logger = new TPLogger(getLogger()); characterManager = new CharacterManager(this); logger().log(Level.INFO, "Plugin enabled!"); }
86bc8839-8886-48ae-9b26-09ea4e4dd9bc
8
private void checkDerived(ClassScope subClass, ClassScope classScope) { for (Scope method : subClass.methods) { if (classScope.hasSymbol(method.getName())) { Scope sym = classScope.getSymbol(method.getName()); if (sym instanceof FieldScope) throw new SemanticError("semantic error at line " + met...
9bf06397-8d0d-4d10-97b7-7b5fdde46392
9
@Override public Boolean isValid() { constraintViolations = new HashMap<String, String>(); // nom if (this.nom.isEmpty()) { constraintViolations.put("NomIsValid", "Le nom est obligatoire."); } else { if (this.nom.length() > 50) { const...
66c482f8-3e87-4252-91a2-4f299b358a77
0
@Basic @Column(name = "PCA_ESTADO") public String getPcaEstado() { return pcaEstado; }
63fd3972-ce0e-4577-9821-19739a5f85c1
6
public static int calcDistance(String s1, String s2){ if (s1.equals(s2)){ return 0; } else{ int n = s1.length(); int m = s2.length(); int e[][] = new int[n+1][m+1]; for (int i=0; i<=n; i++){ e[i][0] = i; } for (int j=1; j<=m; j++){ e[0][j] = j; } for (int i=1; i<=n; i++){ ...
410190d8-4942-4ff3-89bf-67769446cd17
4
public JSONWriter key(String s) throws JSONException { if (s == null) { throw new JSONException("Null key."); } if (this.mode == 'k') { try { if (this.comma) { this.writer.write(','); } stack[top - 1].put...
3c73ab05-a1ab-4f4d-90bc-ece9dca72bc5
8
public void updateUser(HttpServletRequest request, HttpServletResponse response,String updateUserinfo) throws ServletException, IOException { /* * Here we initialize tools for making the database connection * and reading from the database */ Connection conn=null; Statem...
0acec6d8-ccce-4151-a9a3-2dba01e26138
2
public void bake() { if(pie.getDough().isEmpty()) { BuilderClient.addOutput("error - no dough found!"); return; } if (pie.getFilling().isEmpty()) { BuilderClient.addOutput("error - no filling found!"); return; } baked = true; BuilderClient.addOutput("*oven sound*"); }
f26b50a3-f927-44f9-bae6-0ab5b7ff8a01
2
public void updateGraphics() { Tuple<BufferedImage[], Integer> stateSprites = this.animation.getStateSprites(this.state); BufferedImage[] spriteFrames = stateSprites.getX(); if(disposeAfterAnimation && this.spriteFrame + 1 == spriteFrames.length * stateSprites.getY()) { disposed = true; } else { this.spri...
69f758b8-d2e1-4656-a66e-6d5186aaeff7
8
public void step() { for(int a = 0; a < agents.length; a++) { agents[a].hasMoved = false; } for(int i = 0; i < numStrategies; i++) { averageScoreStrat[i] = 0; averageEncountersStrat[i] = 0; } for(int a = 0; a < agents.length; a++) { agents[a].act(); St...
296fa467-5bf5-43c4-bf13-cad3be9559de
6
@Override public MouseAdapter thumbnailSelection() { return new MouseAdapter () { @Override public void mouseClicked(MouseEvent event) { if (selectedEMediumLabel != null) selectedEMediumLabel.setBorder(null); selectedEMediumLabel = (EMediumLabel) event.getSource(); selectedEMediumLabel.setB...
fa035120-71ac-41b0-b067-bd6354879288
4
public void rb_insert(RBNode z) { RBNode y = nil; RBNode x = root; // System.out.println(z.getKey()); while (x != nil) { y = x; if (z.getKey() < x.getKey()) { x = x.getLeft(); } else { x = x.getRight(); } ...
9dd6e182-c366-4389-a55f-5ea6035d5bf5
2
public void actionPerformed(ActionEvent e) { if (e.getSource().equals(mPreview)) { ImageIcon selectedIcon = (ImageIcon) mImageList.getSelectedValue(); String name = selectedIcon.getDescription(); ImageIcon realImage = RHImageLoader.getImageIcon(name); JDialog jd = new JDialog(this); jd.getContentPa...
5958d7f1-7012-4e62-a8d3-44f28aecf6bf
5
public void Solve() { HashMap<String, List<String>> hashMap = new HashMap<String, List<String>>(); String result = ""; for (int n = 1; n < _max; n++) { String cube = Cube(n); String key = SortString(cube); List<String> cubes = hashMap.get(key); if...
663a0f9b-11cc-465a-9ae1-dbbda7aaca2d
0
public String getIncompletedSeller() { Map<String, Object> params = ActionContext.getContext().getParameters(); String seqID = ((String[]) params.get("seqID"))[0]; seller = this.cfService.getIncompletedSeller(seqID); return SUCCESS; }
47f1d1f1-2a6d-4800-98d1-b2f49328414e
3
public boolean checkPath(String path, boolean isExistingFile) { File test = new File(path); if (isExistingFile && !test.isDirectory()) { return test.exists(); } else { if (!isExistingFile) { return test.exists(); } } return fals...
018dd6a9-e3c1-4759-b815-d269a9218fae
5
private void drawBorder(Graphics g) { //First initialise colour Color borderColour = slidePanel.getBackground(); //Set flags (for use in creating the border) for whether the zoomed //image takes the full height and/or width of the slide area Boolean isFullWidth = false; Boolean isFullHeight = false; if...
887f251b-e684-405d-8c11-f6be1e3bc70f
2
@Override public boolean evaluate(T t) { if(firstSearchString.evaluate(t) || secondSearchString.evaluate(t)){ return true; } else{ return false; } }
39959d61-8cd0-4799-864b-73e7c0e76986
0
private void btnQuitterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitterActionPerformed ((CtrlMenu)controleur).fichierQuitter(); }//GEN-LAST:event_btnQuitterActionPerformed
30fadda4-66bd-4fde-b174-56475ff492e9
8
public static void main(String[] args) { Random rnd = new Random(); for (int step = 0; step < 100_000; step++) { int n = rnd.nextInt(10) + 1; int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = rnd.nextInt(10); int k = rnd.nextInt(n); nth_element(a, 0, n, k); int[] s = a.clone(); Array...
e77f573c-6099-4e56-9217-b15968eba502
7
public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException, NoSuchAlgorithmException { boolean releaseMode = false; if (args != null) { for (String arg : args) { if (arg.equals("release")) rele...
bf73305f-e9b1-48f8-ae29-97bc3c071dc5
8
@Override public boolean execute(MOB mob, List<String> commands, int metaFlags) throws java.io.IOException { String rest="ALL"; if(commands.size()>1) rest=CMParms.combine(commands,1); Environmental target=mob.location().fetchFromRoomFavorMOBs(null,rest); if((target!=null)&&(!target.name().equalsIgnoreCa...
a801fc08-d957-4a94-876c-33cf06641ad7
8
private boolean r_verb() { int among_var; int v_1; // (, line 136 // [, line 137 ket = cursor; // substring, line 137 among_var = find_among_b(a_4, 46); if (among_var == 0) ...
45d61a96-e77c-4b2d-a811-1fe7f6d7a9af
7
@EventHandler public void GhastWeakness(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getZombieConfig().getDouble("Ghast.Weakness...
c60b4ce3-02f5-47c4-a1b3-ebde71a30c1f
4
public LOGLEVEL getLoglevel() { if(logLevel == -1) { return LOGLEVEL.Nothing; } else if(logLevel == 0) { return LOGLEVEL.Error; } else if(logLevel == 1) { return LOGLEVEL.Normal; } else if(logLevel == 2) { return LOGLEVEL.Debug; } else { return LOGLEVEL.Normal; ...
b5fcfcc5-c01a-4c5b-87c7-dbc522fde15d
4
public static void downloadFile(String fileURL, String saveDir) throws IOException { URL url = new URL(fileURL); HttpURLConnection httpConn = (HttpURLConnection) url.openConnection(); int responseCode = httpConn.getResponseCode(); // always check HTTP response code first ...
ae248725-af08-4b73-8248-a9facfb52cc9
0
public Point getAutoPoint(){ return myAutoPoint; }
340db332-031e-4815-9c2a-e911508aa399
4
public void readInput(Data data) throws NumberFormatException, IllegalChoicesException { data.resetChoices(); for (int i = 0; i < 4; i++) { JComboBox<Subject> thisBox = examComboBoxes.get(i); Subject selectedSubject = (Subject) thisBox.getSelectedItem(); resetBackgro...
ba6675ae-65ab-4ae2-bbc4-39d04a2f3c93
9
public final MiniParser.decl_return decl() throws RecognitionException { MiniParser.decl_return retval = new MiniParser.decl_return(); retval.start = input.LT(1); Object root_0 = null; Token i=null; ParserRuleReturnScope t =null; Object i_tree=null; RewriteRuleTokenStream stream_ID=new RewriteRuleToken...
118452e8-108e-417b-b528-d9c99221fd7f
5
public void doOperation() throws ArithmeticException{ if(testOperation()){ BigDecimal result; switch (operation){ case "X": total = last.multiply(total).setScale(2, RoundingMode.HALF_UP); last = null; operation =...
061572c7-ded6-4639-804c-4189eaeee230
4
private boolean internalRemove(Investment investment) { PortfolioIterator iterator = new PortfolioIterator(); Investment i; boolean removed = false; while (iterator.hasNext()) { i = iterator.next(); // case where Investment to remove is a top-level investment if (i.getUniqueId() == investment.ge...
471be386-432d-4b11-be84-a7848c891c07
7
public void readHex() { if (pos < s.length() && ((s.charAt(pos) >= '0' && s.charAt(pos) <= '9') || (s.charAt(pos) >= 'A' && s.charAt(pos) <= 'F') || (s.charAt(pos) >= 'a' && s.charAt(pos) <= 'f'))) { pos++; } else { throw new JSONPar...
dc75a121-3414-4421-9206-b83e27446074
8
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(((msg.targetMajor()&CMMsg.MASK_MALICIOUS)>0) &&(!CMath.bset(msg.sourceMajor(),CMMsg.MASK_ALWAYS)) &&((msg.amITarget(affected)))) { final MOB target=(MOB)msg.target(); if((!target.isInCombat()) &&(msg.source().getVict...
ab69da73-a0a4-46d1-82f9-9f7d74fade7a
6
public void bubbleSort(boolean printpasses) { for (int pass = 1; pass < elements.length - 1; pass++) { int swapcount = 0; for (int i = 0; i < elements.length - pass; i++) { T current = elements[i]; T other = elements[i + 1]; int compResult ...
5bb57611-b139-412e-a7f3-27d014109cd2
6
void UploadFile( HttpServletRequest request, HttpServletResponse response, String login ) { json = new JSONObject(); // Создаем фабрику для файлов хранимых на диске DiskFileItemFactory factory = new DiskFileItemFactory(); // Настраиваем контейнер для хранения файлов File repository = new File(uploadPat...
6e787527-f3cc-49d1-8fbc-dcd7bac4d355
9
public Chara talkWith() { int nextX = 0; int nextY = 0; // キャラクターの向いている方向の1歩となりの座標 switch (direction) { case LEFT: nextX = x - 1; nextY = y; break; case RIGHT: nextX = x + 1; nextY = y...
92e93f65-9a94-4a3f-88b5-2598f5629b1d
8
void dorestore () { if (PGF != null) return; FileDialog fd = new FileDialog(this, Global.resourceString("Load_Game"), FileDialog.LOAD); if ( !Dir.equals("")) fd.setDirectory(Dir); fd.setFile("*.sto"); fd.show(); String fn = fd.getFile(); if (fn == null) return; Dir = fd.getDirectory(); if (fn.ends...
97e06788-1ba7-49e4-95d6-430c1e152317
9
private void updateResults() { if (UpDown.getNumPlayers()==5 && table.getRowCount()==6) { ( (MyTableModel) table.getModel() ).removeRow(); ( (MyTableModel) table.getModel() ).removeColumn(); setTableFormat(5); } else if (UpDown.getNumPlayers()==6 && table.getRowCount()==5) { ( (MyTableModel) table.get...
f6e260c2-2228-48f7-93bd-c608a472b6d7
1
@Override public void rotateClockwise(Board board) { int rot = (getRotation()+1) % 4; if (rotateAlgorithm(board, Point.translate(getBase(), BASES[rot]), RELS[rot], getKicks()[getRotation()])) { addRotation(1); } System.out.print("Rotate " + this.toString() + "\n"); }
ce92c334-4778-4d34-a85c-66938f2678c7
7
@Override public Object exec(@SuppressWarnings("rawtypes") List arguments) throws TemplateModelException { if (arguments.size() != 1) { throw new TemplateModelException("This function expects 1 parameter"); } Object type = arguments.get(0); String ret = ""; if (type instanceof StringModel)...