method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
d9f4a7df-aae7-4a8b-a391-ade154534806
3
public void stop() { System.out.printf("Agent stopped - Results:%n"); List<MethodStatistics> statistics = MethodStatisticsHelper.sortDescendingByTime(methodStatistics.values()); for (MethodStatistics statistic : statistics) { System.out.println(statistic); } System.out.printf("Code Execution Path:%n"...
4f44a9d9-d261-4d38-bbf0-babda5e15d22
0
@Override public String getName() { return "group"; }
3856fc64-8fb3-4a9e-9a41-ddb61044961c
8
public static int countNeighbours(boolean [][] world, int col, int row){ int total = 0; total = getCell(world, col-1, row-1) ? total + 1 : total; total = getCell(world, col , row-1) ? total + 1 : total; total = getCell(world, col+1, row-1) ? total + 1 : total; total = getCell(world, col-1, row ) ? total + 1...
4fb633be-5e32-4672-9ba6-52f133ce7c0e
5
private boolean checkPassword(String password) { boolean hasUppercase = !password.equals(password.toLowerCase()); boolean hasLowercase = !password.equals(password.toUpperCase()); boolean isAtLeast8 = password.length() >= 8;//Checks for at least 8 characters boolean hasDigit = false; ...
16448018-3e67-4460-97ec-ce0feb33395a
6
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } BasicLink other = (BasicLink) obj; if (url == nul...
1a839d4e-7019-467f-a35d-7782fa8cb679
8
public int getSelectedIndex(Object component) { String classname = getClass(component); if ((classname == "combobox") || (classname == "tabbedpane")) { return getInteger(component, "selected", (classname == "combobox") ? -1 : 0); } if ((classname == "list") || (classname == "table") || (classname == "tree"))...
ea21f8ff-d52a-4f6d-a004-4e8b415c2c14
5
public static void speedCollisionTests(HashFunction[] funcs, Path[] paths) { System.out.println("\n--------- Speed - Collision tests ---------"); String[][] mat = new String[2 * funcs.length + 2][FileManager.Files.paths.length + 1]; mat[0][0] = " Hash"; mat[1][0] = "--------"; // Legends for (int i =...
8ee2f75e-3af6-4e6a-b9fb-1ab101ca48d6
7
private List<SendResult> parseSendResult(String text) throws Exception { List<SendResult> result = new ArrayList<SendResult>(); NodeList nodes = parse(text, "dt"); for (int i = 0; i < nodes.getLength(); i++) { SendResult smResult = new SendResult(); NodeList childNodes = ((Element) nodes.item(i)...
6fa0afec-1eda-4e6c-88f7-2f1c3218f9dc
4
public static void download(URL url, File file) throws IOException { if (!file.getParentFile().exists()) file.getParentFile().mkdir(); if (file.exists()) file.delete(); file.createNewFile(); final int size = url.openConnection().getContentLength(); log.inf...
be8cf6ff-f716-4f72-920a-87303f6e3c16
3
public static void toggleEditable(Node currentNode, JoeTree tree, OutlineLayoutManager layout) { CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree); JoeNodeList nodeList = tree.getSelectedNodes(); for (int i = 0, limit = nodeList.size(); i < limit; i++) { toggleEditableForSin...
be435593-fafa-4ca2-b996-038df08e58e3
9
public Register() { setAutoRequestFocus(true); this.pack(); setTitle("RegisterForm"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 404, 440); contentPane = new JPanel(); contentPane.setBackground(SystemColor.inactiveCaption); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); s...
43e66648-0341-4f76-a5ab-e17e47179fab
5
@Override public void show() { int option; do { System.out.println("Choose a payment method type:"); System.out.println("1. debit card"); System.out.println("2. credit card"); //System.out.println("3. cheque"); System.out.println("0. Sair\n...
d1668061-1d45-4b92-a3ac-57c47bee84b7
2
public static double sum(List<? extends Number> list) { double sum = 0; for (Number n : list) { sum += n.doubleValue(); } return sum; }
cd6d38d2-ce12-4ab0-973d-8bb1d8c7bb9a
7
public void setAttributeValue(String value) { if (value == null || value.length() < 7 || value.length() > 15) throw new IllegalArgumentException("bad IP number"); StringTokenizer tok = new StringTokenizer(value, "."); if (tok.countTokens() != 4) throw new IllegalArgumentException("bad IP number: 4 number...
2e298315-531b-4c60-a130-ce5e7d59974a
2
WebResult(JSONObject jsonObject) { this.Title = (String)jsonObject.get("title"); this.Abstract = (String)jsonObject.get("abstract"); this.URL = (String)jsonObject.get("url"); this.DisplayURL = (String)jsonObject.get("dispurl"); this.ClickURL = (String)jsonObject.get("clickurl"); String strTimeStamp = (St...
66cc8d57-b96b-4391-b5dd-0d6865d55269
9
public boolean isBoxInFrustum(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { for (int i = 0; i < 6; ++i) { float minXf = (float) minX; float minYf = (float) minY; float minZf = (float) minZ; float maxXf = (float) maxX; ...
82d007e9-eca2-40b3-9603-fb39b16fe677
4
public void tick() { if (input.pressed(KeyEvent.VK_A)) offset.x -= 2; if (input.pressed(KeyEvent.VK_D)) offset.x += 2; if (input.pressed(KeyEvent.VK_W)) offset.y -= 2; if (input.pressed(KeyEvent.VK_S)) offset.y += 2; }
416ec8eb-becd-4ca3-93f7-83409b6f4605
3
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed try{ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); NYM nym = new NYM(); String message = ""; if(jTextField3.getText().length()>0) message = "Su...
63c64977-1b50-4e99-a04e-4d6afe7c0dd5
2
public String getPIDByOrdernumber(Statement statement,String ordernumber)//根据订单号获取停车场ID { String result = null ; sql = "select PID from ParkRelation where ordernumber = '" + ordernumber +"'"; try { ResultSet rs = statement.executeQuery(sql); while (rs.next()) { result = rs.getString("PID"); } }...
fa853eeb-8c56-4e0a-8198-85cf55d042c9
2
public Node getUserNode(String uid) { NodeList userList = doc.getElementsByTagName("user"); System.out.println(userList.getLength()); for (int i = 0; i < userList.getLength(); i++) { Node node = userList.item(i); Element eElement = (Element) node; System.out....
6c2c49f0-fd3f-47d4-9b22-a965e059fb77
4
@Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append("numberOfSamples:" + numberOfSamples + "\tN:" + n + "\nSamples:\n"); // Show samples for( int ns = 0; ns < numberOfSamples; ns++ ) { sb.append(ns + ":\t"); for( int i = 0; i < n; i++ ) sb.append(samples[ns][i] + " "...
bbc48d76-4890-4b09-9a44-b96c6602e6e7
0
public void setException(Exception exception) { this.exception = exception; }
758b5800-02f4-4cc4-98df-7a9cf0173052
7
public static boolean computeCell(long world,int col,int row) { // liveCell is true if the cell at position (col,row) in world is live boolean liveCell = getCell(world, col, row); // neighbours is the number of live neighbours to cell (col,row) int neighbours = countNeighbours(world, col, row); // ...
8837a812-6e30-43fb-bc29-cbbb3d5b000b
9
public void loadItems() { items.clear(); // load items from config for (final String entry : config.getKeys(false)) { try { // Attempt to parse non data value nodes int key = Integer.parseInt(entry); if (key <= 0) { plugin.getLogger().warning( AmazoCreative.TAG + " Ze...
235e42c7-bf77-43d2-b326-3b6f43f27a29
6
public void run() { if(url != null) { // Obtain the results of the project's file feed if(readFeed()) { if(versionCheck(versionTitle)) { String fileLink = getFile(versionLink); ...
70501fe6-decb-4782-92e6-3b9dcd4a9dc1
4
public void doubleDown(Player player){ int bet = player.getBet(); System.out.println("Double down for how much? (0 - " + Math.min(bet,player.getCash()-bet) + ")"); try{ int doubleAmt = input.nextInt(); if((doubleAmt < 0 || doubleAmt > bet) || ((doubleAmt + bet) > player.getCash())){ throw(new Excepti...
970c5e24-91c6-4d3d-923d-2bf796eabcde
0
public void setUsername(String username) { this.username = username; }
064df7c7-dd0f-4110-9ece-ae2afe39fcf6
2
public List<ComboBoxInterface> getComboBoxInterfaceList() { List<ComboBoxInterface> list = new ArrayList<ComboBoxInterface>(); try { ResultSet rs = con.createStatement().executeQuery("SELECT * FROM level"); while(rs.next()) { list.add(getLevelFromRS(rs)); } rs.close(); } catch (SQLExceptio...
abf0db96-3141-4c6e-a69c-d0864f2f66c2
3
public ArrayList<String> getNetiyot() { /* * //TODO: replace the Nikudd with ktiv male as describe here: * http://hebrew-academy.huji.ac.il/hahlatot/MissingVocalizationSpelling/Pages/ikkar.aspx */ String separator = "@";// just a sing String tmp = this.netiyot; ...
ab24eed9-5972-4ca5-b335-9b0090e0876b
7
public String toString(){ String s; Exemplar cur = m_Exemplars; int i; if (m_MinArray == null) { return "No classifier built"; } int[] nbHypClass = new int[m_Train.numClasses()]; int[] nbSingleClass = new int[m_Train.numClasses()]; for(i = 0; i<nbHypClass.length; i++){ nbH...
51b4aaba-1364-4cec-ac3a-0d2212ca2aad
3
public static boolean negate(String s){ s = s.toLowerCase(); String[] words = s.split("\\s+"); int count = 0; for (int i=0; i<words.length; i++){ String currentWord = words[i].replaceAll("([a-z]+)[?:!.,;]*", "$1"); if (negations.contains(currentWord)){ count++; } } if (count % 2 == 0){ retur...
2338551f-6090-4b7b-8315-83058baeb70f
6
public void populateMapWidget() { WorldMapObject o; for (core.Point pos: p2o.points()) { QApplication.processEvents(); o = p2o.get(pos); System.out.println(o); if (o != null) { if (o.getImageFile() != null) { System.out.println(o.getImageFile()); mapWidget.objectAt(pos.y, pos.x).setLayer(...
2b190e04-b8ea-4747-9798-f92b3516f1de
5
public boolean goodBoundaries(double playerX, double playerZ, double x, double z) { int valueX = 0, valueZ = 0; try { FileInputStream fin = new FileInputStream("plugins/KCProtect/config.txt"); DataInputStream din = new DataInputStream(fin); BufferedReader reader = new BufferedReader(new InputStreamReader(d...
15f15e4c-c84a-4f1e-97b9-5dfc76f1c037
1
@RequestMapping(value = "/speakers/{hallEventId}", method = RequestMethod.GET) public ModelAndView speakersPage( final HttpServletRequest request, final HttpServletResponse response, @PathVariable(value = "hallEventId") final String hallEventIdStr ) throws IOException { ...
9786a266-9661-4771-b419-adbe76044564
6
public KeyMap() { BufferedReader reader = null; try { reader = new BufferedReader(new InputStreamReader(getClass() .getResourceAsStream("KeyMap.properties"))); String line; while ((line = reader.readLine()) != null) { line = line.tr...
cb4d12cc-9469-43a5-b1d3-0a42c8d92895
3
public Status getTrackStatus() { if (trackLocation == null) return locateTrack(); if (!tile.getWorldObj().blockExists(trackLocation.x, trackLocation.y, trackLocation.z)) return Status.UNKNOWN; if (!RailTools.isRailBlockAt(tile.getWorldObj(), trackLocation.x, trackLocation...
0536d843-0c31-45e3-9633-30464c9bcf98
4
public static void main(String[] args) { if(args.length != 3) { System.out.println("Wrong argumentcount"); } // String privateKeyfile = "MHuebner.prv"; // String datafile = "foo.ssf"; // String outputFile = "foo.pdf"; String privateKeyfile = args[0]; ...
16a1dc00-3acb-4d0a-9156-0fbe0ee8cef0
2
private Vector getResultant() { Vector resultant = new Vector(myUniverse.getDimension()); //TODO Bit of a hack here, consider cleaning for(Vector element: forceList) { try { resultant = Vector.add(resultant,element); } catch (DimensionMismatchException e) { e.printStackTrace(); } } return resul...
31e67af0-dc08-4249-9539-6535c3e5d4cc
9
public void doBackup(File directory) throws Exception { if (!directory.exists()) directory.mkdir(); RequestContext rc = RequestContext.getRequestContext(); if (this.authStore != null) { Auth auth = this.authStore.retrieve(this.nsid); if (auth == null) this.authorize(); else rc.setAuth(auth); } ...
f917d9c3-3ccd-447d-b3d8-5dc382fdc206
3
public boolean store() throws SQLException { //check if the class was created or pulled from db if(this.id !=-1) return false; SQLiteJDBC db = new SQLiteJDBC(); ResultSet resultSet = null; String sql = String.format( "INSERT INTO u...
1e4671b1-2f37-4380-be0a-ce309e6cdfd5
7
@Override public void unInvoke() { if(canBeUninvoked()) { if(affected instanceof MOB) { final MOB mob=(MOB)affected; if((buildingI!=null)&&(!aborted)) { if(messedUp) commonTell(mob,L("<S-NAME> mess(es) up making @x1.",buildingI.name(mob))); else { dropAWinner(mob,build...
7cfa9d37-b88b-4e9d-926c-df3a7b60d3f7
2
public Complex variance_as_Complex() { boolean hold = Stat.nFactorOptionS; if (nFactorReset) { if (nFactorOptionI) { Stat.nFactorOptionS = true; } else { Stat.nFactorOptionS = false; } } Complex variance = Complex.zero(); Complex[] cc = this.getArray_as_Complex(); variance = Stat.variance(c...
da4fe54d-8d6b-46aa-8aaa-9f1e2c43ce04
5
private void fillClipboard() { if (this.header.length != 3 || this.header[1] != "Artikelnummer" || this.header[2] != "Artikelbezeichnung") return; int prod_id = -1; try { prod_id = Integer.parseInt(this.table.getValueAt(this.table.getSelectedRow(), 1).toString()); } catch (Exception e) { } if (p...
a3c19507-b4fd-4fd6-9798-41c2304623a8
8
@Override public void init() { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.o...
a7bfb7f9-bc14-488c-85fd-2f7d0234859e
8
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
51e2d600-19b8-4563-830b-6b5d1a2528db
7
public void saveFile(double[] solution, int input_hidden_separator, int hidden_output_separator) { BufferedWriter bufferedWriter = null; FileWriter fileWriter; try { fileWriter = new FileWriter(file); bufferedWriter = new BufferedWriter(fileWriter); for (int i = 0; i < solution.length; i++) { ...
ccccf989-d121-4dbf-a694-d88a419c71fa
7
public Battle (Entity inpla1, Entity inpla2, DuskEngine inengGame) { try { engGame = inengGame; vctSide1 = new Vector(); vctSide2 = new Vector(); thnFront2 = inpla2; while (thnFront2 != null) { addToBattle(thnFront2,2); thnFront2 = thnFront2.ENT_FOLLOWING; } thnFront2 = inpla2.ENT_M...
295aa5a9-26bd-4869-8e45-a425071aca91
2
@Override public void setValueAt(Object aValue, int rowIndex, int columnIndex) { if(aValue != null){ MyFile file = filesList.get(rowIndex); if(columnIndex == 0){ file.setFileName((String)aValue); } } }
fdc1364a-6bd8-4075-b39d-5596c6bf2383
6
public boolean getBoolean(int index) throws JSONException { Object object = this.get(index); if (object.equals(Boolean.FALSE) || (object instanceof String && ((String)object).equalsIgnoreCase("false"))) { return false; } else if (object.equals(Boolean....
354f215d-5c6c-4edb-ba3e-736015455b25
1
public void setHourlyRate(double hourlyRate) { if (hourlyRate < 0){ throw new IllegalArgumentException("HourlyRate must be greater than or equal to zero"); } this.hourlyRate = hourlyRate; }
ca90a27a-93cb-4c3d-9a7d-640448193850
0
@Basic @Column(name = "comments") public String getComments() { return comments; }
baaf2853-0143-416a-91d1-85718dd8ce02
6
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page ...
718464bf-c95c-4ec9-9a6c-6c8ea2b9f0a3
2
public void destroy(Widget w) { int id; if(!rwidgets.containsKey(w)) id = -1; else id = rwidgets.get(w); synchronized(robots) { for(Robot r : robots) r.dstwdg(id, w); } super.destroy(w); }
2fa986bf-01c1-481e-a151-94301135b194
5
@Override public void mouseClicked(MouseEvent e) { pickCanvas.setShapeLocation(e); PickInfo result = pickCanvas.pickClosest(); if (result == null) { System.out.println("Nothing picked"); } else { Shape3D s = (Shape3D) result.getNode(); if (s != null) { System.out.println(s.getClass().getName()); ...
fc1c26dd-c19f-4ab1-b55f-cc15f97a85c6
6
public void changeToPath(int x, int y) { if (this.mapGrid[x][y].getType() != Entity.WALL && this.isCellHavePawnOn(x, y) == false && this.mapGrid[x][y].getType() != Entity.POWERUP) { putPathIn(x, y); } //Checks to see if a player is in the explosion range if (this.ma...
0861c7b0-f8b8-4bc8-8a77-c454bb2a224b
3
public boolean checkInLevel(int x, int y){ return (x >= 0 && y >=0 && x < getWidth() && y < getHeight()); }
7a4fcca9-8930-4682-9fdb-c5a9de72135e
4
public String readExpand(Key key, String valueName) throws RegistryErrorException { if(key == null) throw new NullPointerException("Registry key cannot be null"); if(valueName == null) throw new NullPointerException("Valuename cannot be null, because the default value is always a STRING! If you wa...
78fcb50c-825d-4f37-973b-4d4479c6a0e1
9
public static int getMin(String road) { if (road.length() < 2) return -1; int N = road.length(); int [] cost = new int[N]; cost[N-1] = 0; for (int i = N-2; i >= 0; i--) { char thisChar = road.charAt...
d5acf8b9-e17f-4df0-936d-7b4aacda83fc
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
af6828ee-37d8-486c-a3ec-9ad68f690fac
2
public ArrayList<clsPersona> leerFichero() { ArrayList<clsPersona> personas = new ArrayList<clsPersona>(); try{ FileReader fr = new FileReader(rutaPrincipal); BufferedReader br = new BufferedReader(fr); String linea; while((linea=br.readLine())!=null){...
285a29a1-9373-4474-b6fc-4440f5bf1ff7
9
public int firstMissingPositive(int[] A) { if (A == null || A.length == 0) return 1; for (int i = 0; i < A.length; i++) { if (A[i] <= A.length && A[i] > 0 && A[i] != i + 1 && A[A[i] - 1] != A[i]) { int tmp = A[A[i] - 1]; A[A[i] - 1] = A[i]; A[i] = tmp; i--; } } for (int i = 0; i < A.len...
e745cfa7-424b-47dd-a985-2a69bdeb6efe
5
private long toMinutes() { switch (type) { case SECONDS: return value / 60; case MINUTES: return value; case HOURS: return value * 60; case DAYS: return value * 24 * 60; case MILLISECONDS:...
417f9995-45b0-47f9-a7d8-d01168827575
1
private static void fill() { SomeClass c = null; for (int i=0;i<5;i++) { c = new SomeClass(); c.StringIndexingField = "f" + i; c.findField = "33"; c.StringNonIndexingField = "fp 1" + i + " Obj"; c.Save(); } }
b74fb0d8-ba86-4451-8903-937040488ed2
1
@Override public void mark(int boardPosition, Cell[] cellBoard, int rows, int columns) throws IllegalMark { //Find the row. int boardPositionRow = boardPosition / columns; if (boardPositionRow < rows -1){ //It's not the last row. int oneDownCellP...
ebf1f95f-40de-4f26-a93a-727cf3b81af9
1
public void renderAll( Shader shader, RenderEngine renderEngine ) { render( shader, renderEngine ); for ( GameObject child : children ) child.renderAll( shader, renderEngine ); }
96015287-9a17-4086-b908-83317c3d33c7
3
public boolean contains(Point p) { return (p.x >= x1 && p.x <= x2) && (p.y <= y1 && p.y >= y2); }
b4442334-dcb0-426a-9621-7eb5fb54cf90
9
public boolean setInputFormat(Instances instanceInfo) throws Exception { Attribute att; Attribute attNew; Vector allLabels; Enumeration enm; int i; FastVector values; FastVector atts; Instances instNew; super.setInputFormat(instanceInfo); m_AttIndex.setUpper(instanceInf...
0ab683f9-5511-4385-b197-173e748bc479
5
private void validate(Funcionario funcionario) { if (funcionario == null) { throw new SaveException("Funcionário não pode ser vazio."); } else { if (funcionario.getLogin() == null || funcionario.getLogin().equals("")) { throw new SaveException("Login não pode ser ...
63663279-7770-419c-8f8d-3cec3a22f4b6
8
public void startscan(){ worker = new SwingWorker<Void, String>(){ @Override protected Void doInBackground() throws Exception { view.SetTotalCounter(filesInDirectory.length); int index = 0; for ( File file : filesInDirectory ) { if(isCancelled()){ view.dialog.setVisible(false);...
85a8e798-1fba-4ca8-841c-56666796074a
6
public void testRemoveAllArray() { int element_count = 20; int ints[] = new int[element_count]; for ( int i = 0; i < element_count; i++ ) { ints[i] = i; } TIntList list = new TIntArrayList( 20 ); for ( int i = 0; i < element_count; i++ ) { list.ad...
9e13860e-3ecc-4d29-838d-e21223bd3924
4
public boolean onCommand(Player player, String[] args) { File fichier_language = new File(OneInTheChamber.instance.getDataFolder() + File.separator + "Language.yml"); FileConfiguration Language = YamlConfiguration.loadConfiguration(fichier_language); if(player.hasPermission(getPermission())){ if(args.lengt...
7a9c05ab-02af-43c6-85ec-03626913a9d8
1
public void createStatesForConversion(Grammar grammar, Automaton automaton) { initialize(); StatePlacer sp = new StatePlacer(); State initialState = automaton.createState(sp .getPointForState(automaton)); automaton.setInitialState(initialState); START_STATE = initialState; State intermediateState = au...
f67ac6a6-e15c-497c-838f-943c60ff2414
0
public final void voice(String channel, String nick) { this.setMode(channel, "+v " + nick); }
b6908b21-fe9b-4e50-8b36-70681fd4f56a
2
public FilterIterator(Iterator<T> delegate, Filter<T> filter) { if (delegate == null) { throw new IllegalArgumentException( "The given iteration delegate must not be null."); } if (filter == null) { throw new IllegalArgumentException( ...
713c7fe3-67db-48f1-a306-0b67e71b913e
3
@Test public void test_combination() throws Exception { HLLCounter h1 = new HLLCounter(); h1.put("a"); h1.put("b"); h1.put("c"); HLLCounter h2 = new HLLCounter(); h2.put("d"); h2.put("e"); h2.put("f"); HLLCounter h3 = new HLLCounter(); h3.put("d"); h3.put("e"); h...
2703015b-b57a-4252-b2f8-46d3e3bcd2ed
6
public static void addFeatures(FeatureContainer fc, FreeColObject fco) { FeatureContainer c = fco.getFeatureContainer(); if (fc != null && c != null) { for (Entry<String, Set<Ability>> entry : c.abilities.entrySet()) { Set<Ability> abilitySet = fc.abilities.get(entry.getKey()...
c4782dc3-6305-4e2d-8d39-fbb53522c794
0
@Test public void runTestPrivateDataLeak1() throws IOException { InfoflowResults res = analyzeAPKFile("AndroidSpecific_PrivateDataLeak1.apk"); Assert.assertEquals(1, res.size()); }
bde1b3c3-61f6-4c4e-b41b-ca09898c89da
2
public void setCredits(double credits) { if(credits < 0.5 || credits > 4.0) { JOptionPane.showMessageDialog(null, "Error: credits must be in the range 0.5 to 4.0"); System.exit(0); } this.credits=credits; }
c8807469-4832-4201-83bc-6adeaeb122e9
0
public FrameDesc[] frameTable() { return frmeTable; } // end frameTable()
88c46618-3a2b-489f-b9ab-5e8577cb112b
8
public void renderMob(int x, int y, float xOffset, float yOffset, Sprite sprite) { //if (yOffset > 0 || yOffset < 0) return; x = (int) (convertMapX(x)); y = (int) (convertMapY(y)); // xOffset = 0; // yOffset = 0; xOffset *= -1; yOffset *= -1; for (int yCounter = 0; yCounter < 32; yCounter++) { int...
d58e9680-a09a-42b9-bc79-536710c26aa4
9
private void executeJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_executeJButtonActionPerformed /* Clear terminal area if needed */ if (clearJCheckBox.isSelected() == true) { terminalJTextArea.setText(m_defaultTerminal); } if (OS.isFamilyUnix() &&...
be6bb86e-74f7-46c3-8aee-01831995fd51
1
public void setHealth(double health) { if(health < 0) this.health = 0; else this.health = health; }
b7196442-93d6-47a3-b658-1a29497f00cc
4
@Override public boolean delete(Reservation x) { Statement stm = null; try { stm = cnx.createStatement(); int n= stm.executeUpdate("DELETE FROM reservation WHERE reservationid='"+x.getReservationId()+"'"); ...
4afb1a31-0b9d-4256-8b3c-26789e4c3f07
4
private static <T extends Comparable<? super T>> T median3( T [ ] a, int left, int right ) { int center = ( left + right ) / 2; if( a[ center ].compareTo( a[ left ] ) < 0 ) swapReferences( a, left, center ); if( a[ right ].compareTo( a[ left ] ) < 0 ) swapReferenc...
406974de-1f90-47ec-baff-b99d796914db
9
protected void initData() { SAXReader xmlReader = new SAXReader(); Document doc = null; try { logger.info("reading file " + dataFilename); doc = xmlReader.read(new File(dataFilename)); } catch (DocumentException e) { e.printStackTrace(); logger.error(e.getStackTrace()); logger.error("data file...
28f5877a-453e-42e6-8fbc-7127778cba77
4
private static void getAdjMtx(ArrayList<User> users){ bigramCounterMap = new CounterMap<User, User>(); for (int i = 0; i < users.size(); i++){ for (int j = i + 1; j < users.size(); j++){ User user1 = users.get(i); User user2 = users.get(j); double JaccardSim = getJaccardBtw2User(user1, user2); if...
108e84a6-d77c-43bd-a9c0-1bd139ecdc38
2
private Expression andStatement( List<Expression> args, String caller ) { // return true by default Expression result = new Value("#t"); for( int i = 0; i < args.size(); ++i ) { result = args.get(i).eval(defSubst, caller); if ( result.show(defSubst, ...
fc82373d-463e-4d0a-9646-8b21ca4a2084
2
public final void removeScreen(int id) { for (Iterator<Screen> iter = screens.iterator(); iter.hasNext();) { Screen refScreen = (Screen)iter.next(); if (refScreen.id == id) iter.remove(); } }
5e6350b0-6f6a-49fb-ad71-89919eb34438
5
public void process(ByteBuffer buffer, Client sockector){ if(sockector.isHandShak()){// 已经握手处理 if(sockector.getProtocolVersionInt() < WebSocketConstants.SPLITVERSION6){// 通过0x00,0xff分隔数据 String msg = CoderUtils.decode(buffer); if(MyStringUtil.isBlank(msg)){ return; } log.info("the...
a7e77e09-74b5-40ec-9614-826151f9ec99
5
@Override @SuppressWarnings("UnnecessaryReturnStatement") default void vetoableChange(PropertyChangeEvent event) throws PropertyVetoException { switch (event.getPropertyName()) { case "value": { T newValue = (T) event.getNewValue(); if (getPredicate().test(newValue)) { setValue(n...
09d45084-ed22-4f8f-a0bf-9488474e8c24
5
public static double binomialCDF(double p, int n, int k) { if (p < 0.0D || p > 1.0D) throw new IllegalArgumentException("\np must lie between 0 and 1"); if (k < 0 || n < 0) throw new IllegalArgumentException("\nn and k must be greater than or equal to zero"); if (k > n) throw new IllegalArgumentException("\nk is ...
d56ca0f8-d159-450f-b38e-f54d33e208b8
6
public BigMoney parseBigMoney(CharSequence text) { checkNotNull(text, "Text must not be null"); MoneyParseContext result = parse(text, 0); if (result.isError() || result.isFullyParsed() == false || result.isComplete() == false) { String str = (text.length() > 64 ? text.subSequence(0,...
24612495-f2fa-4d06-94d8-fe3395ab59a8
3
public int hashCode() { int hc = 13 * sort; if (sort == OBJECT || sort == ARRAY) { for (int i = off, end = i + len; i < end; i++) { hc = 17 * (hc + buf[i]); } } return hc; }
a5119b07-4496-4f4b-ba20-0e4590bd9599
3
@Override public void actionPerformed(ActionEvent e) { OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched(); OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode()); if (textArea == null) { return; } Node node = textArea.n...
e1db873d-c341-4bec-adaf-6c08a9c3214b
4
public void insertString( int offs, String str, AttributeSet a ) throws BadLocationException { if ( str == null ) return; boolean proceed = true; if ( dontCheck == false ) { String tmp = super.getText(0, offs) + str + (super.getLength()>offs ? super.getText(offs,super.getLength()-offs) : ""); Matcher m = ...
c9a8ad43-27d1-43e0-a824-d9c557bccd28
7
public void updateAsScheduled(int numUpdates) { super.updateAsScheduled(numUpdates) ; if (! structure.intact()) return ; int numModes = 0 ; for (boolean b : drillOrders) if (b) numModes++ ; if (numModes > 0) { final int mode = (int) (world.currentTime() / DRILL_INTERVAL) ; for (int ...
287d0cc6-0a13-4330-bdd9-3c0f29b792d4
3
public static EntityManager getEntityManager() { if (entityManagerFactory == null) { entityManagerFactory = Persistence.createEntityManagerFactory( PERSISTENCE_UNIT); } EntityManager entityManager = threadEntityManager.get(); if (entityManager == null || !entityManager.isOpen()) { entityManage...
0e2cab48-6f49-4009-93f9-4f7ca8ef2e32
7
public static BillNames fromByte(byte b) { switch (b) { case 1: return Bill1; case 2: return Bill2; case 3: return Bill3; case 4: return Bill4; case 5: return Bill5; ...
ac888843-e20f-41e5-afb8-df8dad6a808d
3
public static byte FFMul(byte a, byte b) { byte aa = a, bb = b, r = 0, t; while (aa != 0) { if ((aa & 1) != 0) r = (byte) (r ^ bb); t = (byte) (bb & 0x80); bb = (byte) (bb << 1); if (t != 0) bb = (byte) (bb ^ 0x1b); aa = (byte) ((aa & 0xff) >> 1); } return r; }
9c0d92c1-0dd9-4827-a40f-6f7f6efa7190
5
private void renderNetz(){ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glBegin(GL_LINES); for (int j= -100; j < 100; j++){ for(int i = -100; i < 100; i++) { if(i % 5 == 0) { glColor3f(1,0,0); } else { ...