method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b41b57ed-0c0b-4736-86e7-ad6b7d50e15d
0
public void setIdHistorialClinico(Integer idHistorialClinico) { this.idHistorialClinico = idHistorialClinico; }
88e6e9dc-bc44-447a-8a02-8f0188ca9d01
7
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 int[m...
99a69854-40be-44a7-b89d-0475186e00aa
9
public static Role getBankRole(int shift) { Map<Role, Boolean> shiftRoles = sRolesFilled.get(shift); //Master Teller (1) - first priority for (Role iRole : shiftRoles.keySet()){ if (iRole instanceof BankMasterTellerRole){ //find role if (shiftRoles.get(iRole) == false){ //if role not filled shiftRo...
140ead5b-2919-4978-93d9-7bf512933ed5
5
@Override public void execute(CommandSender sender, String worldName, List<String> args) { this.sender = sender; if (worldName == null) { error("No world given."); reply("Usage: /gworld setgamemode <worldname> <survival|creative|adventure>"); } else if (!hasWorld(worldName)) { reply("World not found:...
0da1af40-56c8-4184-8330-9c74cb1514e4
4
private void init(JSONObject json) throws WeiboException { if(json!=null){ try { id = json.getString("id"); screenName = json.getString("screen_name"); name = json.getString("name"); province = json.getInt("province"); city = json.getInt("city"); location = json.getString("location"); d...
ad9a9021-e637-43a5-9ed8-53cedca8b822
2
public void stop() { if(AnimationPlayer != null && AnimationPlayer.isAllive()) { AnimationPlayer.stopAnimation(); } }
b75112ed-9dd1-4180-9fa8-4f7d05158947
5
@Override public void run() { ParkingPlace parkingPlace = null; for (IParking parking : parkings) { LOG.info(toString() + " trying to park on " + parking + "!!!"); try { parkingPlace = take(parking); using(parkingPlace); } catch (ParkingException e) { LOG.info(toString() + "---Parking failed--...
69cfdffc-3680-4927-8f55-d5fdec19303b
1
public static Boolean ToggleQuestionRejection(int QDbId, boolean isRejected) { String statement = String.format("Update question set isRejected = %s where QuestionID = %d", isRejected ? "TRUE" : "FALSE", QDbId); return runStatement(statement); }
50833131-8d79-4d61-ad83-2c82b2237c87
9
private StreamNegotiator getOutgoingNegotiator(final FormField field) throws XMPPException { String variable; boolean isByteStream = false; boolean isIBB = false; for (Iterator<String> it = field.getValues(); it.hasNext();) { variable = it.next(); if (...
5fea7bc9-2488-42fa-a3f3-3239d386f85f
2
static boolean Prime(long a) { for (int i = 2; i < a / 2 + 1; i++) { if (a % i == 0) { return false; } } return true; }
77a517e0-b7cc-469f-bb16-791b4547cecd
8
static final public void ClassDeclaration() throws ParseException { jj_consume_token(CLASS); Identifier(); jj_consume_token(LBRACE); label_2: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BOOLEAN: case INTEGER: case IDENTIFIER: ; break; def...
73ff1a48-dc53-4bf9-979a-cf2de55e3aa5
7
@Override public String getSensesDescList(Physical obj, boolean useVerbs) { if(obj == null) return ""; final int senses = obj.phyStats().sensesMask(); final StringBuffer buf=new StringBuffer(""); if(useVerbs) { for(int i=0;i<PhyStats.CAN_SEE_VERBS.length;i++) if(CMath.isSet(senses,i)) buf.app...
da658e30-2442-4d52-8f6e-7e3e0a1ee6dc
9
public Say(Main main, CommandSender sender, String[] args) { if (args.length == 1 || args.length == 2) { sender.sendMessage(ChatColor.GREEN + "Usage: /sudo say <player> <message>"); return; } if (args[1].equalsIgnoreCase("all")) { if (sender.hasPermission("sudo.say.all")) { int arg; String string...
59cddcce-cbd2-4c4d-bc54-febeeb64f24d
8
public static void main(String[] args) { Method[] ms = LongStream.class.getMethods(); Arrays.sort(ms, (a, b) -> a.getName().compareTo(b.getName())); for (Method m : ms) { if (m.getParameters().length == 1 && !Modifier.isStatic(m.getModifiers())) { System.out.println("...
d986c026-6806-4ba4-9bdd-d79e77bb90e1
0
public String getAdresse() { return adresse; }
24245bc8-aa0a-4af7-80b6-db6aca67b5ca
8
private List<String> parseResponse(String Response) { // 返回的数据的格式一般为 // status = '', code => '', 'msg' => , 'data' => '' // 如果返回的数据没有包含 status:ok, 则整个数据返回空 // {"status":"error","code":"200","msg":"invial password","data":[]} ResponseStatus = this.parseResponseStatus(Response); ...
02f525b7-c320-40bb-8979-602c1dca0711
0
public long getMaxQueueLength() { return maxQueueLength; }
651f3802-9185-464b-add8-607933123f43
8
final public void DropTable() throws ParseException { /*@bgen(jjtree) DropTable */ ASTDropTable jjtn000 = new ASTDropTable(JJTDROPTABLE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { jj_consume_token(DROP); jj_consume_tok...
0654c995-65bd-4452-b054-d2e76f3c7fb0
9
@Override public double calculateFractalWithPeriodicity(Complex pixel) { iterations = 0; check = 3; check_counter = 0; update = 10; update_counter = 0; period = new Complex(); Complex tempz = new Complex(pertur_val.getPixel(init_val.getPixel(pixel...
3b999c36-7c24-40be-80ce-cc514d07ba2d
7
private void AddItem() { if (jtfTitle.getText().isEmpty()) title = "Unknown"; else title = jtfTitle.getText(); if (jtfAuthor.getText().isEmpty()) author = "Unknown"; else author = jtfAuthor.getText(); try { if (jtfRating.getText().isEmpty()) rating = 0; else rating = Integer....
97ec9230-54cc-42b6-83d1-56f74c454ed4
6
public String getPath(XmlNode nodefrom, XmlNode nodeto) { String path = ""; String path1, path2; path1 = nodefrom.path; path2 = nodeto.path; if (path1.equals(path2)) return null; String [] strarray1 = path1.split(":"); String [] strarray2 = path2.split(":"); int i; for (i = 0; i ...
93d50784-6853-4050-b43f-906b52af4f4b
3
@Override public String[] getUsersForService(String serviceName) { ResultSet rs, rsSearch; PreparedStatement statement, searchService; List<String> usersList = new ArrayList<String>(); try { // find active sellers statement = connection.prepareStatement("SELECT * FROM Users " + "WHERE type = ? AND ...
c4e6716e-dba8-4e2a-9d16-129b528659f7
1
private void updateTiles() { for (int i = 0; i < tilearray.size(); i++) { Tile t = (Tile) tilearray.get(i); t.update(); } }
83518ff1-9774-4693-a124-895aaed6e374
9
public void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D)g; //Rectangle treeSelectionBox = null; if (mouseDrag) { g2d.setColor(Color.white); g2d.fill(prevRect); } int boxWidth = (int)(getWidth()/(double)cols); int boxHeight = (int)(getHeight()/(double)rows); boundsRect.wid...
a50d43ec-a5d9-484d-b441-3c523c103af9
6
public static EffectWithArgs parseArg(String arg) { arg = arg.replaceAll(",", ":"); String split[] = arg.split(":"); EffectWithArgs ewa = new EffectWithArgs(); try { MobEffectList mel = getEffect(split[0]); if (mel == null) return null; ewa.mel = mel; if (split.length > 1){try{ewa.strength = Int...
3d9414a8-6083-4d73-bd65-558e51a20419
8
public boolean hasSubmerged(int xa, int ya) { int xMin = 2; int xMax = 8; int yMin = 8; int yMax = 10; for (int x = xMin; x < xMax; x++) { if (isLiquidTile(xa, ya, x, yMin)) { return true; } } for (int x = xMin; x < xMax; x+...
ec139123-faa5-499c-8339-2b32ec81adbb
3
public void xor(BitSet set) { int wordsInCommon = Math.min(wordsInUse, set.wordsInUse); if (wordsInUse < set.wordsInUse) { ensureCapacity(set.wordsInUse); wordsInUse = set.wordsInUse; } // Perform logical XOR on words in common ...
045df5e1-37cd-456a-86b7-1a674c82dffc
8
public ZipHandler(File album) { Logger.getLogger(ZipHandler.class.getName()).entering(ZipHandler.class.getName(), "ZipHandler", album); try { zipFile = new ZipFile(album, Charset.forName("IBM437")); } catch (IOException ex) { Logger.getLogger(ZipHandler.class.getName()).l...
0570a4c6-5b3f-4334-b8ce-55ccbe966682
0
public Exception getException() { return ex; }
53d098cc-01c4-47b7-b5f5-596bfbf217cb
9
private String toJSCompositeRuleName(int rule) { switch (rule) { case AlphaComposite.CLEAR: return "xor"; case AlphaComposite.SRC_IN: return "source-in"; case AlphaComposite.SRC_OUT: return "source-out"; case AlphaCo...
fdd89cde-d242-4fef-a706-a838fe57ec15
9
public static double toDouble(Object object, double dDefault) { if(object == null) return dDefault; if(object instanceof Number) { return ((Number) object).doubleValue(); } if(object instanceof Collection) { return toDouble(getFirst(object), dDefault); } if(object.getClass().isArray()) { return...
a8f2fa3f-f58b-4314-aca9-948410f557ac
4
public void unzip(String zipFilePath, String destDirectory) throws IOException { File destDir = new File(destDirectory); if (!destDir.exists()) { destDir.mkdir(); } ZipInputStream zipIn = new ZipInputStream(new FileInputStream(zipFilePath)); ZipEntry entry = zipIn.get...
85e245b9-a1fa-4b4f-abe3-44b43ba3ae07
0
public String getDisplacement() { return displacement; }
46e9b769-1ed7-4f14-a545-076f350c3ed1
3
protected void writeFile(String fileName, String value) throws RuntimeException { try { // check for permission FileOutputStream fos = new FileOutputStream(fileName); fos.write(value.getBytes()); fos.close(); } catch (FileNotFoundException fnfe) { throw new RuntimeException("Permission denied to G...
ad7192eb-cf97-4c5e-b020-0ab06cb83c10
1
private Element getElementHighestPriority(List<Element> elements) { if (elements.size() > 0) return elements.get(0); return null; }
ca1c0afc-fbba-418d-9e72-f9ceaf4dd6dd
9
public boolean similar(Object other) { try { if (!(other instanceof JSONObject)) { return false; } Set<String> set = this.keySet(); if (!set.equals(((JSONObject)other).keySet())) { return false; } Iterator<St...
2750f6ec-7556-4318-9194-95263f26c49e
8
private void cluster(Node less) { Node similiar1 = null; Node similiar2 = null; int sim1 = 0; int sim2 = 0; double distance = 8000.0; // suche die aehnlichsten Blaetter for (int i = 0; i < less.getNodes().length; i++) { Node node1 = less.getNode(i); if (node1 ...
1e08e6a1-90ef-4dad-bf82-9c8a0879f063
6
@Override public void run() { // System.out.println("Socket Sender"); while ( true && !isClose) { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } String s = stringWritable.read(); if ( s != null ) { buffer.clear(); buffer.put(s.getBytes()); buff...
6c17058e-8723-48f7-ae7b-5f5f47ba9f71
5
@Override public void render(Graphics g) { if (hasPlants) { g.drawImage(game.getRes().plants[getPlantGrowth()], getX(), getY(), game); } else if (!hasPlants) { g.drawImage(game.getRes().tiles[getTileID()], getX(), getY(), game); } if (game.showGrid) { // If the player wants to draw grids g.setColor(C...
696cb0c6-c200-4d9d-8fe5-ab8d7d97e16d
2
public void testGetFieldType() { MonthDay test = new MonthDay(COPTIC_PARIS); assertSame(DateTimeFieldType.monthOfYear(), test.getFieldType(0)); assertSame(DateTimeFieldType.dayOfMonth(), test.getFieldType(1)); try { test.getFieldType(-1); } catch (IndexOutOfBoundsExc...
b9c30aa5-30b5-4043-b224-689b758211c7
0
public void moveTo(Point3 p) { pos.add(p.minus(pos)); //System.out.println("Gone to " + p); }
3e46c25b-2797-4f92-8c7c-34e0878ae335
0
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButton9ActionPerformed {//GEN-HEADEREND:event_jButton9ActionPerformed world.choiceMade("put"); }//GEN-LAST:event_jButton9ActionPerformed
39046863-f840-407c-bb6b-4cf6a2f79ed4
2
public void clear() { int h = head; int t = tail; if (h != t) { // clear all cells head = tail = 0; int i = h; int mask = elements.length - 1; do { elements[i] = null; i = (i + 1) & mask; } while (i != t)...
78c037dd-2d69-4ef9-bbc2-7fb3591b2cc8
1
public static void initSessionFactoryAdd(String configFile) { try { // Create the SessionFactory from resource X URL resource = HibernateUtil.class.getClassLoader().getResource(configFile); Configuration configure = new Configuration().configure(resource); sessionFactory = confi...
6d0a0b38-9dd2-4ff5-b622-680910293424
8
public void saveWorld(World world){ if(worlds.containsKey(world)){ //Alright let's do this! File ymlFile = new File(plugin.getDataFolder(),world.getName()+".circuits.yml"); if(!ymlFile.exists()) { try { ymlFile.createNewFile(); ...
cec46475-e88b-4d29-a852-3529c88beef9
8
private BigInteger compileConstValue() throws ParseException, IOException { BigInteger val = BigInteger.ZERO; BigInteger tmp; char lastOperator = '+'; do { switch (tokenizer.tokenType()) { case Tokenizer.IDENTIFIER: ConstExpression constExpr = Consts.fromName(tokenizer.getIdentifier()); ...
97168c11-feed-4d83-8509-e7ad76852d25
7
public void autoriserDragDropJoueur(boolean autorisation) { if (autorisation) { // Activation du Drag & Drop for (Case c : this._j1.getCases()) { if (c.getBateau() != null) { this.addMouseEvent(c, true); } else { ...
cb3e4e8d-c1d4-4324-b90f-574515f100f7
5
public String toString() { String s = ""; s += "(" + xx + ", " + yy + "): " + getal + " b: " + bekend + ", g: " + gevuld + "\t"; for (int h=0; h<3; h++) { for (int w=0; w<3; w++) { s += (omgeving[w][h] == null ? "." : (omgeving[w][h] ? "1" : "0")); } if (h<2) s += " "; } return s; }
c8b494bb-a7e0-46ef-bede-cd4d335f9536
6
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if(args.length > 0) { // todo: add help subcommand if(args[0].equalsIgnoreCase("reload")) { if(!sender.hasPermission("acidrain.reload")) { if(sender instanceof Player) { sender.sendMessage(ChatCo...
d0c7c17b-95cb-4083-9c64-11156c975f82
4
public Ocean toOcean() { // Creates an Ocean object with width, height, and starveTime equal this RunLengthEncoding // object's respective values. The method then iterates through each node of the list in // order to set the Oceans tiles to the appropriate values according to each run. Ocean returnOcean...
bd87c2b4-880a-4b45-8ac2-f9cf1effe8c9
3
public static DataType fromString(String value) { if (StringUtils.isEmpty(value)) { return null; } for (DataType dataType : DataType.values()) { if (dataType.toString().equalsIgnoreCase(value)) { return dataType; } ...
4356b098-a4f5-4743-b582-62c3e62798bd
3
public ArrayList<Location> getOccupiedLocations() { ArrayList<Location> theLocations = new ArrayList<Location>(); // Look at all grid locations. for (int r = 0; r < getNumRows(); r++) { for (int c = 0; c < getNumCols(); c++) { // If there's an...
f8580a21-0d6f-471f-8e4e-fbb333b6d0db
6
public int getSolutions(BigInteger n) { BigInteger[] res; BigInteger x; BigInteger y; int count = 0; for (BigInteger i = n.add(ONE); ; i = i.add(ONE)) { res = (i.multiply(n)).divideAndRemainder(i.subtract(n)); x = res[1]; y = res[0]; ...
72962ee7-d2aa-4405-94ce-0c90e0194d5d
5
public static boolean leaveGuild(String[] args, CommandSender s){ //Various checks if(Util.isBannedFromGuilds(s) == true){ //Checking if they are banned from the guilds system s.sendMessage(ChatColor.RED + "You are currently banned from interacting with the Guilds system. Talk to your server admin if you beli...
7c6d7396-c15e-4102-adc5-4e852c1efe92
3
public void send(DistanceVectorMessage message) { String result = ""; boolean hayError = false; for (Target t : message.getList()) { try { Socket clientSocket = new Socket(t.getIp(), port); DataOutputStream outToServer = new DataOutputStream(clientSock...
00e30165-42fa-40b5-ac89-975976fc7469
9
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((author == null) ? 0 : author.hashCode()); result = prime * result + ((category == null) ? 0 : category.hashCode()); result = prime * result + ((description == null) ? 0 : description.hashCode()); res...
8a91dbe7-9d30-4d84-bf09-33c1515ed63f
1
public boolean isClicked() { if(type!=-1) return true; return false; }
04d1c957-61dd-4617-985e-bb68cd6505f5
5
static final void method366(Object[] objects, byte i, int[] is) { do { try { Class279.method2092(is.length - 1, 0, is, -119, objects); anInt514++; if (i <= -97) break; method367(-67); } catch (RuntimeException runtimeexception) { throw Class348_Sub17.method2929(runtimeexception, ("ifa.B...
a6aa57cc-3e84-43cd-ad97-f61ca2d94ee0
4
public void convertArray(int[] array) { spaces = new String[9]; for(int i = 0; i < array.length; i++) { if(array[i] == 1) { spaces[i] = "X"; } else if(array[i] == 2) { spaces[i] = "O"; } else if(array[i] == 0) { spaces[i] = " "; } } }
ffbc7591-cd33-41bc-961f-edd390d6be7b
9
public boolean cal(int[] A, int target, int l, int r) { if (l > r) return false; int mid = (l + r) / 2; if (target == A[mid]) return true; //reach duplicate point if (A[l] == A[mid] && A[r] == A[mid]) return cal(A, target, l + 1, mid - 1) || cal(A, target, mid + 1, r...
3c00de93-e025-4cb9-ba64-4ef6ed472f54
3
public void run() { long lastTime = System.nanoTime(); double nanoPerUpdate = 1000000000D/60D; double delta = 0D; init(); while(running) { long now = System.nanoTime(); delta += (now - lastTime) / nanoPerUpdate; lastTime = now; boolean shouldRender = false; while(delta >= 1) { ...
eb483f8f-afa4-4854-a656-8f89fef99268
3
private void txtMember_Mobile_NumberKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtMember_Mobile_NumberKeyPressed if (evt.getKeyCode() == 40) { txtMember_Father_Name.grabFocus(); } else if (evt.getKeyCode() == 39) { txtHome_telephone_Number.grabFocus(); } else if (evt.getKeyCo...
4ae26eca-c4f9-47de-b2ff-6d643a37dcb6
8
static final public void valeur() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case entier: jj_consume_token(entier); expression.empiler(ENTIER); yvm.iconst(YakaTokenManager.entierLu); break; case ident: jj_consume_token(ident); switch ((jj_ntk==-1)?jj...
1f2475b2-8481-4a39-9c04-3e72f8de618c
0
public void setSomeMap(Map<String, String> someMap) { this.someMap = someMap; }
e4989488-3978-4d6c-bf9b-f7ed5daaae55
9
private void addItem(int numToAdd, ArrayList<Location> locations, boolean checkTargets) { Random rand = new Random(); //Random number generate to determine locations of spaces randomly for(int i = 0; i < numToAdd; i++) { //Generate random location Location newItem = new Location(rand.nextInt(MAX_X),rand....
eb412455-e011-4d47-abd6-7cc3cb966cc4
3
public synchronized Client addClient(Client client) { if (client != null) { try { listClient.put(client); logger.info("Client: " + client.getName() + " successfully added!"); } catch (InterruptedException e) { e.getMessage(); } catch (NullPointerException e) { e.getMessage(); } re...
e0c3d08c-35fc-4675-92dd-b61b22a96722
2
public void addWeather(int weatherType) { switch(weatherType) { case(0): weather = new Rain(2); break; case(1): weather = new Snow(2, 0); break; default: System.out.println("That's no weather system!"); } }
075746d9-a595-4a51-9672-2c4fa6b8a431
8
protected void getDlModData() { //Display the data from the mod selected in Download Mods String[] modData = dlModList[trow].split("~"); lblDMModTags.setText("Mod Tags: " + modData[3]); //Set description text size smaller if too large if(util.getStringWidth("Mod Description: " + modData[4])>800){ txtrDMModDe...
a1976af2-c34c-43e2-9193-e93f80f43855
7
public static void updateRotation(int delta) { //Mouse Input for looking around... if (Mouse.isGrabbed()) { float mouseDX = Mouse.getDX()*0.128f; float mouseDY = Mouse.getDY()*0.128f; if (rotation.getZ()+mouseDX>=360) rotation.setZ(rotatio...
635a15cb-35f8-4dd8-aae3-634a4c8afbfe
3
void setItemForeground () { if (!instance.startup) { table1.getItem (0).setForeground (itemForegroundColor); } /* Set the foreground color item's image to match the foreground color of the item. */ Color color = itemForegroundColor; if (color == null) color = table1.getItem (0).getForeground (); TableIte...
db2885aa-d2e8-4556-bc00-64d77ad58b66
5
Cloud prevCloud(Vector3d p) { int j = -1; float dy_min = RANGE * p.z; for (int i = clouds.size() - 1; i >= 0; i--) { Cloud cloud = clouds.elementAt(i); if (cloud.getY(p.z) <= p.y && cloud.age < 10) { float dy = p.y - cloud.getY(p.z); if (d...
65c412db-a114-4edc-ba78-61c605aaf409
0
public void setSoundInventoryList( ArrayList<Boolean> soundInventoryList) { this.soundInventoryList=soundInventoryList; }
d46d8c23-39c8-4ebd-97b9-48016f8f0ec5
0
public void requestTransform(){ transformNeedsReform = true; repaint(); }
1b055cf8-08ef-4035-84c3-d127475d92d3
9
@Override public String toString() { return "UserEntity [" + (id != null ? "id=" + id + ", " : "") + (firstName != null ? "firstName=" + firstName + ", " : "") + (lastName != null ? "lastName=" + lastName + ", " : "") + (username != null ? "username=" + username + ", " : "") + (email != null ? "email...
44236801-53b4-4476-9916-f9e915ce037c
8
public static void main(String argv[]) { //--------------------------------------------------------------- // Parse arguments. //--------------------------------------------------------------- CommandArgs cmd = new CommandArgs (argv, // arguments to parse "CD...
61b08f83-7207-48ad-9991-dc108b3bab1d
1
@Override public int compareTo(BinaryOperator o) { return priority < o.getPriority() ? 1 : 0; }
c885306c-5226-4135-972b-c8dc32996790
9
@Override public void run() { String inputFolder = Props.getInputFolderPath(); //set of files obtained during current folder scan Set<String> toSubmit = new HashSet<String>(); //set of files which were submitted to processing List<String> submitted = new ArrayList<String>(); ...
00fa0fd8-0cea-48f9-8f63-a7f6feea4b82
4
public static void main(String[] args) { if ( DEBUGGING ) { try { // read test file CSVReader csv = new CSVReader(new FileReader("src/strangebrew/data/malts.csv"), ',', '\"', true, false); try { while ( true ) ...
4aae3d02-5104-494b-9599-dffcc88930e6
1
@Override public void adjust() { setEnabled(mURI != null && Desktop.isDesktopSupported()); }
3e356f5c-f091-4cde-808f-225b051470a3
3
public double cdf(double p, int k, int n) { if (k < 0) return 0; if (k >= n) return 1.0; double cdf = 0; for (int i = 0; i <= k; i++) cdf += pdf(p, i, n); cdf = Math.min(1.0, cdf); return cdf; }
57c419ce-ad05-4b2c-8625-cb7e3ffcf6c1
8
private void signalObservers(String from,String method,String url) { String ourl = url; int pos = url.lastIndexOf("/"); while (pos!=-1) { // we need to walk up the tree to check // only works for one entry now, daniel (no dubs in urls) // check for direct matches Object obs = observers.get(url); ...
521bd757-5e47-452c-bbf0-2b96b3c26359
8
public static String findcachedirORIG() { String as[] = { "c:/windows/", "c:/winnt/", "d:/windows/", "d:/winnt/", "e:/windows/", "e:/winnt/", "f:/windows/", "f:/winnt/", "c:/", "~/", "/tmp/", "", "c:/rscache", "/rscache" }; if (Signlink.storeid < 32 || Signlink.storeid > 34) { Signlink.storeid = 32; } String...
79823489-db06-42bb-8069-afa67411c1ab
8
protected void setStateInMainAndForkChannels(InputStream in) { try(DataInputStream input=new DataInputStream(in)) { for(;;) { String stack_name=Bits.readString(input); String ch_name=Bits.readString(input); int len=input.readInt(); if(l...
68464521-b0fb-496a-996e-1edeecdef177
3
public static void main(String[] args) { TC1 = new TelnetService(prop.getProperty("server1"), 23); server1 = new Thread (new GosLink2(1)); TNH.put(1, TC1); server1.start(); SH.put(1,server1); if (!prop.getProperty("server2").equals("none")){ TC2 = new TelnetService(prop.getProperty("...
1408fa29-c30f-44bf-bec9-245e9c4be97b
9
@Override public void keyReleased(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_W) upPressed = false; if(e.getKeyCode() == KeyEvent.VK_S) downPressed = false; if(e.getKeyCode() == KeyEvent.VK_A) leftPressed = false; if(e.getKeyCode() == KeyEvent.VK_D) rightPressed = false; if(e.getKeyCode() == KeyEvent.VK_1...
b0b5cc04-c2e8-466e-9f0d-d6987c4f94f2
5
public void setupDeltaTable(BaseDeltaTable delta) { Statement stmt = null; ResultSet rs = null; try { dbCon.createStatement(); stmt = dbCon.createStatement(); String deltaCountSql = "select count(1) from information_schema.tables where table_schema='mysqlmv' ...
2e3dbed8-5ea1-45b3-bb63-9607549e50a1
8
public void testContains() throws IOException { int sliceLength = 1000; int maxSliceCount = 1000; List<TestSet> sets = allSets(maxSliceCount, sliceLength); Set<String> languages = identifier.getLanguages(); for (String language : languages) { System.out.println(langu...
13319b3f-da6c-4260-af3c-332df823bce1
1
private void doubleArraySize() { Person[] biggerArray = new Person[queueSize*2]; for (int i = 0; i < queueSize; i++) { biggerArray[i] = this.personArray[i]; } this.personArray = biggerArray; }
12d8a774-fdf4-4b45-ba59-bb8d2823a8f6
3
private void parseBody() throws IOException { mState = 5; mBody = mBuffer.toByteArray(); mBuffer = null; if (HttpMethod.POST.equals(mMethod)) { if ("application/x-www-form-urlencoded".equals(getFirstHeader("content-type"))) { BufferedReader in = new BufferedReader(new InputStreamReader(new ByteArrayInput...
540448ba-4e5d-48da-9d46-193aab05e536
2
public void updateNet(Elem tek){ //Set INPUT OUTPUT LAYERS for(int i = 0; i < inputNo; i++) inputNodes[i].setActivation(tek.X[i]); for(int i = 0; i < outputNo; i++){ outputNodes[i].setYAccuali(tek.actualY[i]/scale); outputNodes[i].setActivation(0); } }
4ec1330e-51ad-49a3-b47d-6b84d260522c
3
public boolean setTile(int x, int y, Tile t) { if(x < gridWidth) if(y < gridHeight) if(tileGrid != null) { tileGrid[y][x] = t; return true; } return false; }
e9304d23-7058-49e2-ba9d-4d27be8d0270
8
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { final String nomb = (String) model.getValueAt(jTable1.getSelectedRow(), 0); if (tipoLista.equals(LISTA_CLIENTES)) { List<Programa> lista = null; try { S...
e7cdb781-465a-48d7-ade3-cfc0bbf7d348
6
public Map<String,Integer> countType() { //System.out.println("55555"); String profile ="E:\\doc\\"+ username + "_profile.txt"; String sort = "E:\\doc\\sort.txt"; Map<String, String> sort_map = new HashMap<String, String>(); Map<String, Integer> ret = new HashMap<String, Integer>...
381ce846-f33f-4115-a7d1-35410881a6e2
9
public void afficher(Tuple tailleEcran) { if(isRunning) { switch (direction) { case HAUT :courirH.draw(tailleEcran.x/2*32, tailleEcran.y/2*32);break; case BAS :courirB.draw(tailleEcran.x/2*32, tailleEcran.y/2*32);break; case GAUCHE :courirG.draw(tailleEcran.x/2*32, tailleEcran.y/2*32);break; case DR...
5920ffac-86ef-44c9-bc38-223abf7c1d8b
1
private void writeUnderHandler(byte[] bytes) { try { stream.write(alignBigEndToFourByteBoundry(bytes)); } catch (IOException e) { throw new RuntimeException("You're screwed:" + " IOException writing to a ByteArrayOutputStream"); } }
0a33ef77-b88d-4307-be42-1f5cba228162
6
public static final void setIndentString(String indent) { if (indent.equals(" ") || indent.equals(" ") || indent.equals(" ") || indent.equals(" ") || indent.equals(" ") || indent.equals("\t")) { indentString = indent; } else throw new Error("setIndentString: invalid indent string, expected...
5a64a00b-4f64-45fa-9559-40fd20d8a70a
3
@Override public void displaySingleVision(int Seer, int Target, byte Vision) { if(Target == 0){ // Do Nothing. } else { String role = null; switch (Vision) { case WolvesUI.VISION_INNO: role = "INNOCENT"; break; case WolvesUI.VISION_WOLF: role = "WHEREWOLF"; break; } displayStri...
a23c0a6a-f793-4590-b5f9-abcbb7d5fee0
1
public synchronized void adicionar() { try { new PesquisadorView(this); } catch (Exception e) { } }
d9b319d4-8da5-4f39-8bc6-b68873b2c660
0
@Override public void display(UserInterface ui) { ui.signalNeedToDisplayFunction(); }
f9f019de-76cf-431c-8c10-87f8854d678d
4
public ArrayList<Section> getList(String whereString) { StringBuffer sql = new StringBuffer(""); sql.append("SELECT Section_ID,Exam_ID,Section_Name,TimeLimit"); sql.append(" FROM `Section`"); if (whereString.trim() != "") { sql.append(" where " + whereString); } ...