method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
cfd0fcec-127c-41d4-a040-60373bc344bb
0
public void setjCheckBoxQuit(JCheckBox jCheckBoxQuit) { this.jCheckBoxQuit = jCheckBoxQuit; }
52a3be46-35d6-4e0f-a4fc-b9852e8d688b
1
@Override public byte[] getPayload() throws IOException { byte[] payload=null; try { payload = reload(); } catch (FileNotFoundException ex) { this.log(Level.WARNING,"file not found retrieving payload "+ex.toString()); } return payload; }
a049444f-813c-4171-8d87-e513d7b0014f
3
public void setFullScreen(DisplayMode dm, JFrame window){ //Display mode: 4 param 2 resolution (X Y), bit depth, refresh rate window.setUndecorated(true); //titlebars scrollbars window.setResizable(false); vc.setFullScreenWindow(window); //check if(dm != null && vc.isDisplayChan...
e1b27c5e-7b74-431c-a66b-5f0fbed0faec
0
@Override public int filterRGB(int x, int y, int rgb) { return (rgb & 0xff000000) | amount; }
d962d850-2ad0-4f99-8840-f41b274e80cf
9
private void decodeHeader(BufferedReader in, Properties pre, Properties parms, Properties header) throws InterruptedException { try { // Read the request line String inLine = in.readLine(); if (inLine == null) return; StringTokenizer st = new StringTokenizer( inLine ); if ( !st.hasMoreToken...
8e5925d5-3555-491e-989b-dbcb36cb3a24
1
public static void SQLencrypted (String host, String port, String db, String user, char [] pw) { try { String newPW = String.valueOf(pw); // See also Encrypting with DES Using a Pass Phrase. SecretKeyFactory keyFactory = SecretKeyFactor...
9e1739a9-39b7-47bb-a877-33b7c90d093d
5
private int handleCC(String value, DoubleMetaphoneResult result, int index) { if (contains(value, index + 2, 1, "I", "E", "H") && !contains(value, index + 2, 2, "HU")) { //-- "bellocchio" but not "bacchus" --// if ((index =...
1ab9a9fe-794c-408f-9e71-abf88956fdf1
0
public Neuron getOutputNeuron() { return outputNeuron; }
8a31e921-8ba4-430d-b179-1c7b2166482a
7
public void mouseClicked(MouseEvent me) { Point cell = me.getPoint(); if (me.getClickCount() == 1) { int col = tabel.columnAtPoint(cell); int row = tabel.rowAtPoint(cell); if (col == 4) { CounterParty counterParty = (CounterParty) tabel.getValueAt(row, col); if (counterParty == null) { ...
0b80fa89-92ff-45a2-ade3-9501bdc7459a
2
@Override public Object invoke(Context context,List<Object> arguments) { context = context.subContext(); int nArgs = Math.min(arguments.size(), variables.size()); for (int i=0;i<nArgs;i++){ context.setVariable(variables.get(i), arguments.get(i)); } for (Statement statement: statements){ sta...
9f73517d-affa-46ee-82a0-8eca579a6bc7
9
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); PrintWriter out = response.getWriter(); String destino = null; ArrayList order = new ArrayList(); ...
bb38d27c-3db6-4718-a418-97080f150db4
7
public void testNodeRemoval2b() { setTree(new TreeNode("dummy")); TreeNode root = new TreeNode("root", 1); TreeNode leaf = new TreeNode("leaf"); root.setBranch(new TreeNode[]{ leaf }); Map tree = Collections.synchronizedMap(new HashMap()); tree.put(root, new TreeNode[]{ l...
8853cb40-be73-4c94-a5fa-750eb84da9ea
8
private void appendSource(int position) { final int limit = 4; int start; final int skip = position - limit + 1; if (skip <= 0) { start = 0; } else { if (skip == 1) { htmlStrings.add("... (skipping 1 line) ..."); plainStrings.add("... (skipping 1 line) ..."); } else { htmlStrings.add("......
0e894910-efb2-41b9-82ec-bdd2e71632e9
7
public void updateLoggers() { log.trace("Syncing up JDK logger levels from Log4j"); final Map<Logger, java.util.logging.Logger> loggerMap = this.loggerMap; final LevelMapper levelMapper = this.levelMapper; loggerMap.clear(); final Logger rootLogger = Logger.getRootLogger(); ...
0a63e9b7-d78a-4280-aa71-d1d7bebd98d3
4
@SuppressWarnings("static-access") public static CommandLine createOptions(String[] args) { CommandLine cmd=null; //create the options Options options = new Options(); options.addOption("h", "help", false, "prints the help content"); options.addOption(OptionBuilder.withArgName("json-file").hasArg().withDesc...
8c5b7729-9cc3-4349-b312-b947df670f63
8
public static void mult( RowD1Matrix64F a, D1Matrix64F b, D1Matrix64F c) { if( c.numCols != 1 ) { throw new MatrixDimensionException("C is not a column vector"); } else if( c.numRows != a.numRows ) { throw new MatrixDimensionException("C is not the expected length"); ...
efbd1ea9-716d-4c0d-9a52-c465397002c4
2
public static boolean isDinheiro(String valor) { final String NUMEROS = "0123456789."; for (int i = 0; i < valor.length(); i++) { char caracter = valor.charAt(i); if (NUMEROS.indexOf(caracter) == -1) { return false; } } return true; ...
052055c0-390a-45d0-ab57-3abfbfed6cfe
1
@Override public boolean execute() { Boolean val = true; try { this.document.loadFromFile(filePath); } catch (Exception ex) { ex.printStackTrace(); val = false; } return val; }
0ab30740-92fc-4e94-8c61-8d7742108bdd
1
public final void setDefaultAction(Action a) { if(a == null) defaultAction = unknownCommandAction; else defaultAction = a; }
f7c7662b-4275-4efa-bef4-55b315166d64
5
public void run(Graphics g){ if(!closed){ g.drawImage(img, x,y,x+(3*8), y+(3*8), 0, 0, 3, 3, null); g.drawImage(img, x,y+(3*8), x+(3*8), y+h-(3*8), 0, 3, 3, 6, null); g.drawImage(img, x,y+h-(3*8), x+(3*8), y+h, 0, 6, 3, 9, null); g.drawImage(img, x+3*8,y,x+w-(3*8), y+(3*8), 3, 0, 6, 3, null); g.drawIma...
d6cebe6c-2984-473d-8db8-f69b2389db8c
7
private JSONArray readArray(boolean stringy) throws JSONException { JSONArray jsonarray = new JSONArray(); jsonarray.put(stringy ? readString() : readValue()); while (true) { if (probe) { log("\n"); } if (!bit()) { if (!bit()) {...
dc1f02c3-4d60-41aa-8228-08763702db01
6
synchronized public void start(int number_of_threads){ // start the number of threads concurrently that have been given to the initial start if(_recordings.size() > 0){ // check that the recordings to download is larger than the number of threads to initial start with // if it is smaller then there is n...
8b76ab38-1f1f-4627-8c32-8366353e1e15
1
public long read2bytes() throws IOException { long b0 = read(); long b1 = read(); if (le) return b0 | (b1 << 8); else return b1 | (b0 << 8); }
0dbcd05f-c935-4083-a30d-f9349e305720
4
public ScoreBoardCon() { scores = new ArrayList<Score>(); // Sets the path to the users current working directory/save/highscores.save fs = System.getProperty("file.separator"); path = Paths.get(System.getProperty("user.dir") + fs + "save" + fs + "highscores.save"); File file = new File(path.toString()); ...
84020fb5-cabd-40a3-a516-057d6638efdf
5
@Override public Exam create(Exam toCreate) { try (Connection con = getConnection(); PreparedStatement insertExam = con.prepareStatement(queryInsertExam, new String[]{columnExamId}); PreparedStatement insertQuestion = con.prepareStatement(queryInsertQuestion, new String[]{columnQu...
96e7392e-1c67-44ad-848d-8fffcdbd7b58
0
public BodyPart getBodypart(){ return bodypart; }
9b61a004-ce5f-4ccb-83ec-c82bf37cd298
5
public static Field parseField(String raw) { if (Strings.isEmpty(raw) || !raw.contains(": ")) { return null; } Builder fieldBuilder = new Builder(); String[] partArray = raw.split(":"); // I originally used a For Each, but that requires hacky access to the internal ...
3afb92d9-3c4b-42b8-86f1-e6ef61db85bf
8
public void intersection(SFormsFastMapDirect map) { for (int i = 2; i >= 0; i--) { FastSparseSet<Integer>[] lstOwn = elements[i]; if (lstOwn.length == 0) { continue; } FastSparseSet<Integer>[] lstExtern = map.elements[i]; int[] arrnext = next[i]; int pointer = 0; ...
ac00477a-de24-49d0-bf6f-8bd2a3b86cc6
4
private void preciomedicamentosFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_preciomedicamentosFieldKeyTyped // TODO add your handling code here: if (!Character.isDigit(evt.getKeyChar()) && evt.getKeyChar() !='.' && !Character.isISOControl(evt.getKeyChar())) { ...
831050cc-bc4f-436a-b4de-716e5382f40b
7
public InfoNode Add(int key, String value, Node node){ if(node instanceof LeafNode){ if(((LeafNode) node).size < BPlusTreeIntToString60.maxDegree + 1){ node.add(key, value); return null; } else{ return SplitLeaf(key,value,node); } } if(node instanceof InternalNode){ for(int i = 1; i <= ...
5b48ff39-8c9f-4d84-92a0-a08a9bd13d56
6
private String DELETE_Request(String url, String url_params) { StringBuffer response; String json_data = ""; HttpsURLConnection con = null; try { // url = "https://selfsolve.apple.com/wcResults.do"; // url_params = "sn=C02G8416DRJM&cn=&locale=&caller=&num=12345"; // URL obj = new URL(url); // con =...
1e8cd83d-bf7d-446f-a9a7-2649e4b8dab9
7
public void keyReleased(KeyEvent e) { int code = e.getKeyCode(); if(code == P) { keyP = false; } if(code == R1 || code == R2) { rightKey = false; } if (code == L1 || code == L2) { leftKey = false; ...
12f48ef4-2f9d-40b6-870c-a715569a58e7
9
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = null; if (sender instanceof Player) { player = (Player) sender; } String PlayerName; if(args.length != 2){ sender.sendMessage("/addowner <ChannelName> <PlayerName>"); return...
aec129aa-db2b-4782-8e28-63ab4101584a
5
public static Pair<String> minmax(String[] a) { if (a == null || a.length == 0) return null; String min = a[0]; String max = a[0]; for (int i = 1; i < a.length; i++) { if (min.compareTo(a[i]) > 0) min = a[i]; if (max.compareTo(a[i]) < 0) max = a[i]; } retur...
aff9ca1e-62e2-4521-a309-935cdd34bfff
0
public String getChargeTermid() { return ChargeTermid; }
85553488-ad74-40a1-b1df-b4b669516a45
7
protected boolean renewPoints() { int points = ctx.summoning.points(); for (GameObject obelisk : ctx.objects.select().id(OBELISK).within(20).first()) { if (ctx.camera.prepare(obelisk) && obelisk.interact("Renew")) { Timer t = new Timer(10000); while (t.running()) { if (ctx.players.local().inMotion(...
6467490e-f853-4fb8-9c01-66dc71028ede
0
public void setEmailType(String emailType) { this.emailType = emailType; }
23a6ac86-05b6-4d5b-9beb-2f1283957997
7
@Override public boolean tick(Tickable ticking, int tickID) { if(!super.tick(ticking, tickID)) return false; if(ticking instanceof MOB) { final MOB mob=(MOB)ticking; if((mob.amFollowing()==null)||(mob.amFollowing().isMonster())||(!CMLib.flags().isInTheGame(mob.amFollowing(), true))) { if(mob.ge...
84ab744d-fafa-4a6c-94af-198c7f0e2ab1
4
public static Hashtable<Integer, Double> GrowthContains(int start, int range, int averageCount) { Random rnd = new Random(); Hashtable<Integer, Double> NTable = new Hashtable<Integer, Double>(); //Go through the range for (int n = start; n < range+1; n+=500) { int warm = 0; while (warm < 1...
8e8a899b-ecbf-4950-aa7b-d90a8b22d811
6
public boolean moveActorIfPossible(Actor actor, GridPoint destination) { int x = destination.getColumn(); int y = destination.getRow(); if (y < 0 || y >= this.height || x < 0 || x >= this.width) { return false; } Tile currentTile = this.tiles[y][x]; if (currentTile.isImpassable()) { return false; } ...
50b824ef-d660-4b65-9e9d-29b8efedc047
5
public Component getTableCellRendererComponent (JTable table, Object value, boolean selected, boolean focused, int row, int column) { setEnabled(table == null || table.isEnabled()); if(column==0) { setHorizontalAlignment(SwingConstants.CENTER); ...
f2c359c5-632a-4824-9d45-8800cc2a668e
3
public Map<String,String> parseArguments(String[] argv) { Map<String, String> optionsValueMap = new HashMap<String, String>(); fileNameArguments = new ArrayList<String>(); for (int i = 0; i < argv.length; i++) { // Cannot use foreach, need i Debug.println("getopt", "parseArg: i=" + i + ": arg " + argv[i]); ...
25bd5900-ce45-4195-b987-45d37751b788
3
@Override public void KeybindTouched(KeybindEvent e) { if(e.getKeybind().equals(Keybind.CONFIRM) && e.getKeybind().clicked()) { if(textFill < getLength()) { textFill = getLength(); setSize(getWidth((int) textFill + 1), getHeight((int) textFill + 1)); removeTimeListener(timeListener); }...
fd094901-863a-4fd4-8844-51609757f369
9
public int[] oneTrainIn(){ /*if(eventIndex>numF1){ //System.out.println("!!!Error @ an unexperienced event RECORDED BY SEQUENCE LEARNER!!!"); return null; } curSeqWeight.add(new Double(tho)); curSeq.add(new Integer(eventIndex)); tho-=v;*/ ...
013688ce-25f4-4e48-a948-6d8c5a5e3972
7
public String getTargetTypeName(int targetType) { Integer targetTypeKey = getTargetTypeKey(targetType); if (null == targetTypeKey) { return "UNKNOWN TYPE 0x" + Integer.toHexString(targetType); } switch(targetTypeKey.intValue()) { case TARGET_T...
4e19f189-ad6f-4f38-b2ae-ab166572d6df
1
public AnimationData(int frameCount, long frameDelay, float initialX, float initialY, float frameW, float frameH) { this.frames = new ArrayList<FrameData>(); for(int i = 0; i < frameCount; i++) { frames.add(new FrameData(initialX+i*frameW, initialY, frameW, frameH)); } ...
9eb1543a-2ca7-45fc-ae17-0da9fbf60731
3
private void setModDownloads() { String downloadModList = util.getModDownloads(); dlModList = downloadModList.split(";"); con.log("Log","Downloadable mods found... " + dlModList.length); lblModDlCounter.setText("Downloadable mod Count: " + dlModList.length); if(tglbtnNewModsFirst.isSelected()){ for(int ...
17c58557-eb91-43b4-a0b6-ad5e2dd84978
0
@Id @GenericGenerator(name = "generator", strategy = "increment") @GeneratedValue(generator = "generator") @Column(name = "person_id") public int getPersonId() { return personId; }
1940efe6-f457-4224-8f5e-0c2efbb473d6
2
public int turn(Turn.direction dir) { switch (dir) { case LEFT: return (this.direction + 5) % 6; case RIGHT: return (this.direction + 1) % 6; default: return -1; } }
66f1faa7-f989-490f-bdaf-1052e6430235
7
public void setPoints() { if (x2 - x > sizeX * cspc2 && this == sim.getDragElm()) { setSize(2); } int hs = cspc; int x0 = x + cspc2; int y0 = y; int xr = x0 - cspc; int yr = y0 - cspc; int xs = sizeX * cspc2; int ys = sizeY * cspc2; ...
4bd5e4cb-2e77-42b8-a45b-eb642d36c6c6
3
public void generatePif(List<pif> p, String filename) { FileWriter outputStream = null; try { outputStream = new FileWriter(filename); for (pif f : p) { outputStream.write(f.code + " " + f.positionST + " (" + f.token + ")\n"); } } catch (IOException e) { e.printStackTrace(); } tr...
c623d23a-1399-4a2f-8195-88f694207015
7
boolean isSystemObjectTypeObjectSetUsesDifferent(SystemObjectTypeProperties property, SystemObjectType systemObjectType) { final NonMutableSet nonMutableSet = systemObjectType.getNonMutableSet("Mengen"); final List<SystemObject> directObjectSetUses = nonMutableSet.getElementsInVersion(systemObjectType.getConfigurat...
9025a2df-b485-45fe-8219-aa5b37f8c7e2
4
public static List<Integer> maxProfitPoint(int[] prices, int a, int b) { List<Integer> res = new ArrayList<Integer>(); if (a == b) {res.add(a); res.add(a); res.add(0);return res;} int profit = 0; int min = a; int minp = a, maxp = a; for(int i = a; i < b; i++) { if (pro...
964ee620-45b9-489a-91ee-23691dd5d7b0
3
private void addListeners() { newItem.setMnemonic(KeyEvent.VK_N); newItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK)); newItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { createFrame(); } }); closeItem.setMnemonic...
6211580a-4c6e-43c4-9272-773daad6009b
8
private void doExecuteScript(final Resource scriptResource) { if (scriptResource == null || !scriptResource.exists()) return; TransactionTemplate transactionTemplate = new TransactionTemplate(new DataSourceTransactionManager(dataSource)); transactionTemplate.execute(new TransactionCallback() { @SuppressWar...
96801eff-33cf-4542-9ba0-c87d5cb03b72
5
private void processDeleteMaster(Sim_event ev) { if (ev == null) { return; } Object[] obj = (Object[]) ev.get_data(); if (obj == null) { System.out.println(super.get_name() + ".processDeleteMaster(): master file name is null"); ...
5200071c-f891-4450-9611-1226ee1502e4
5
@Override public void execute(CommandSender sender, String[] args) { if (!sender.hasPermission("bungeeutils.admin")) { sender.sendMessage(new ComponentBuilder("").append(plugin.prefix + plugin.messages.get(EnumMessage.NOPERM)).create()); return; } if (args.length == ...
b4bab3c7-79d2-4409-a861-33c0f0ed3755
0
public String[] getArgs(String[] args) { String[] a = new String[args.length - 1]; System.arraycopy(args, 1, a, 0, a.length); return a; }
f423235c-7101-4a37-a4f5-b17c8b7e2942
3
public UInt64 readUInt64() { byte[] bytes = new byte[8]; for(int i = 0; i < 8; i++) { try { bytes[i] = this.readByte(); } catch (IOException e) { Client.logger.Log(e); } } UInt64 value = new UInt64((byte)0); try { value = new UInt64(bytes); } catch (InvalidUIntException e) { Client...
99ea5a2f-8f70-4ccf-9cdd-8625abc01a42
1
public void testWithFieldAdded2() { Partial test = createHourMinPartial(); try { test.withFieldAdded(null, 0); fail(); } catch (IllegalArgumentException ex) {} check(test, 10, 20); }
b931d34a-13b9-47a6-bfa9-e82ed3fb8e3a
2
private boolean isNotReady() { return closed || !initialized || listener == null; }
8c2d6ec2-8a51-44cd-b250-51edcc40c46e
2
public ArrayList<Rod> getMaximumRevenueRods(int totalLength, ArrayList<Rod> rodList) { rods = new ArrayList<Rod>(rodList); // sort rods by price length ratio rods = RodCuttingCommon.getInstance().sortByPriceLengthRatio(rods); // greedy add rods until sum of selected rods length not > total length int curren...
bd2a8c64-04a8-47b2-9f5d-3a8af89d3967
2
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed if(this.jTextField1.getText().isEmpty()){ Error np = new Error(this,true); np.ready("Debe ingresar su nombre de usuario"); np.setVisible(true); } else{ ...
37425920-b30e-46ef-b2ec-73cfa2ea10ff
2
public static void handleEpgQueryReply(HTSMsg msg, HTSPClient client) { Collection<String> requiredFields = Arrays.asList(new String[]{"query"}); if (msg.keySet().containsAll(requiredFields)){ //TODO } else if (msg.get("error") != null){ //TODO } else{ System.out.println("Faulty reply"); } }
e5f8bb3c-affb-4239-a1b1-d1a5b56155e6
2
public static String secondsToMinutes(int time) { if (time < 0) return null; int minutes = (time / 60) % 60; String minutesStr = (minutes < 10 ? "0" : "") + minutes; return new String(minutesStr); }
0b77409e-33b9-4361-b8ea-2b24e49b8866
7
@EventHandler public void WitherJump(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("Wither.Jump.Dodge...
31ec00be-6fc3-4edc-a8dd-91c937d4b0a1
3
public static MyUnits unmarshal(String filepath) { MyUnits lengthUnits = null; try { SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = sf.newSchema(new File(Launcher.SCHEMA_LOC+Launcher.SCHEMA1_NAME)); lengthUnits = (MyUnits)Factory.loadInstance(new File...
ff93cde2-bba8-404b-9c5c-9f8ca445a7b6
8
@SuppressWarnings("incomplete-switch") @Override public void fkActionEvent(FkActionEvent event) { //System.out.println( "Event data:"+ event.data ); MessageBox dialog; Boolean closeSelf=false; switch(event.type) { case ACTION_ABORTED: txtBUSYMSG.setText(Messages.NewAccountDialog_55); dialog = new...
f6134d27-48d0-4adb-aebf-48dc986b0d88
6
@Override protected void toXMLImpl(XMLStreamWriter out, Player player, boolean showAll, boolean toSavedGame) throws XMLStreamException { // Start element: out.writeStartElement(getXMLElementTagName()); // Add attributes: out.writeAttribute(ID_ATT...
12ebb4bf-d4a1-4fbf-b130-3f626245b03f
8
protected EToolsSearchResponse handleResponse(HttpResponse response, EToolsSearchResponse value, Context context) throws IOException { if (response.getStatusLine().getStatusCode() != 200) throw new IOException("status is not OK"); Document doc; { InputStream in = response.getEntity().getContent(); doc = ...
739a44d9-b84f-4ae8-98b6-d8543bc7e160
5
public String listarSeriales() { String Recorrer_seriales = ""; try { ResultSet list_SER = ele.consultarSeriales(datos_elemento); String colorEstado = ""; String iconoEstado = ""; String nomFuncion = ""; while (list_SER.next()) { ...
a327e1cc-4d89-4d63-961f-13f15bcc54ef
4
public static Document getDocumentByQuery(String query){ String youdao = "fanyi.youdao.com"; HttpClient httpclient = new DefaultHttpClient(); httpclient.getParams().setParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, false); HttpHost targetHost = new HttpHost(youdao); query = query.replace(" ", "%20"); Http...
ee50af5d-d942-4991-aaa0-2a63f5993a03
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.equal...
e1690e1a-6e94-4672-8fd4-2ca4d76bd66b
2
public ResultSet validate(String email, String password) { ResultSet res = null; try { // hash password with SHA1 algorithm String hashPass = makeSHA1Hash(password); String query = "SELECT * FROM customer where email=? and password=?"; stmnt = CONN.prepareStatement(query); // Bind Parameters ...
4ac01413-ccbf-48c5-98b6-98c6a7de5584
4
public synchronized int baseNumberPreMRna(int pos) { int count = 0; for (Exon eint : sortedStrand()) { if (eint.intersects(pos)) { // Intersect this exon? Calculate the number of bases from the beginning int dist = 0; if (isStrandPlus()) dist = pos - eint.getStart(); else dist = eint.getEnd() - p...
1e2b7fe7-599d-4d2e-9c9b-8c3f463f557b
1
public void test_getValue_long() { assertEquals(0, iField.getValue(0L)); assertEquals(12345678 / 90, iField.getValue(12345678L)); assertEquals(-1234 / 90, iField.getValue(-1234L)); assertEquals(INTEGER_MAX / 90, iField.getValue(LONG_INTEGER_MAX)); try { iField.getValu...
80120418-c9dd-4164-95e3-3cbf655f332a
6
public static String replace(String in, String match, String replacement) { // check for null refs if (in == null || match == null || replacement == null) { return in; } StringBuffer out = new StringBuffer(); int matchLength = match.length(); int inLength = in.length(); for (int i = 0; i < inL...
00a182ff-33ff-43ef-ae52-9adef77da807
1
private void updateHC() { if (this.hoveredClassroom != null) { this.name.setText(this.hoveredClassroom.getName()); this.type.setText(this.hoveredClassroom.getType().getShortName() + " (" + this.hoveredClassroom.getType().getName() + ")"); this.eff.setText(((Integer)(this.hoveredClassroom.getEffectif())).toSt...
ed263c76-b1cd-46de-8010-16ac5e53cb9c
2
public TLValue resolve(String var) { TLValue value = variables.get(var); if(value != null) { // The variable resides in this scope return value; } else if(!isGlobalScope()) { // Let the parent scope look for the variable return parent.resolve(var); } else { // Unkno...
173642cd-e439-49d2-907b-694add763fcb
8
public void doit( String finp, String sheetnm ) { WorkBookHandle book = new WorkBookHandle( finp ); WorkSheetHandle sheet = null; try { sheet = book.getWorkSheet( sheetnm ); WorkSheetHandle[] handles = book.getWorkSheets(); ChartHandle[] charts = book.getCharts(); for( int i = 0; i < charts.length;...
05f50c80-3733-44aa-9f9b-ed5960b3fe51
2
public static void main(String[] args) throws IOException, ClassNotFoundException { NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(),vlcLibraryPath); Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class); player = new EmbeddedAudioPlayer(vlcLibraryPath); ...
e291428d-526e-4d09-9c1e-0d214b9a7097
4
@RequestMapping("queryDeptById") @ResponseBody public SystemResponse<Department> queryDeptById(HttpServletRequest request, HttpServletResponse response) { SystemResponse<Department> result = new SystemResponse<Department>(); String deptId = request.getParameter("deptId"); String isCacheString = request.g...
4af37c73-339c-4ee5-9bee-919af1372ddf
6
public void reload() { if (this.maxAmmo > 0) { if (this.currentAmmo < this.maxCurrentAmmo) { if (this.maxCurrentAmmo - this.currentAmmo > this.maxAmmo) { this.currentAmmo += this.maxAmmo; this.decreaseAmmo(this.maxAmmo); SoundEffect.GUNRELOAD.play(); if (this.currentAmmo > 0) this.canShot ...
f0c42755-4498-42c3-8b82-208a49c93bdf
9
public void store() { // needed to create a store() method different from the one in // Properties class to store configurations, in order to not lose // commented out lines from config file BufferedReader br = null; StringBuilder confString = new StringBuilder(); try { br = new BufferedReader(new FileR...
c71819ea-fd4f-4397-8b20-c1d46569419d
2
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); response.setContentType("text/plain"); String date = request.getParameter("date"); // format must be yyyy-mm-dd String state = reques...
927ebdef-9b0c-4c07-9318-fd65e702b0a9
1
private void initialize() { this.setBounds(100, 100, 800, 600); sourceImagePanel = new JPanel(); sourceImagePanel.setBounds(10, 30, 293, 447); getContentPane().add(sourceImagePanel); imageSourceLabel = new JLabel(""); sourceImagePanel.add(imageSourceLabel); imageSourceLabel.setIcon(new ImageIcon(imageRe...
738b0e53-4675-4c82-8d72-5a82c6cbd518
9
public static boolean comienza(String baseDeDatos, String entrada) { /* ENTRADA DE DATOS */ String[] cadena; StringTokenizer tokenizerBD = new StringTokenizer(baseDeDatos, " "); int cantTokensBD = tokenizerBD.countTokens(); StringTokenizer tokenizerEntrada = new StringTokenizer(entrada, " "); int cantTokens...
fcfec858-e4c8-4429-8dcd-f4f73e70edb3
5
public void initialise(World world) throws PatternFormatException { String[] cellParts = cells.split(" "); for (int i=0;i<cellParts.length;i++) { char[] currCells = cellParts[i].toCharArray(); for (int j=0;j<currCells.length;j++) { if (currCells[j] != '1' && currCells[j] != '0') ...
99cfa4f7-b6b0-45c5-88cd-353a036b31aa
4
public static byte[] TripleDES_Decrypt(byte[] data,byte[][] keys) { int i; byte[] tmp = new byte[data.length]; byte[] bloc = new byte[8]; K = generateSubKeys(keys[0]); K1 = generateSubKeys(keys[1]); K2 = generateSubKeys(keys[2]); for (i = 0; i < data.length; i++) { if (i > 0 && i % 8 == 0) { blo...
333d0059-9248-44d9-ad42-cd151eb3936b
6
@Override public void deserialize(Buffer buf) { memberId = buf.readInt(); if (memberId < 0) throw new RuntimeException("Forbidden value on memberId = " + memberId + ", it doesn't respect the following condition : memberId < 0"); rank = buf.readShort(); if (rank < 0) ...
f06c0c55-443f-4d6a-854e-981ecab62c3d
3
public void visitClassType(final String name) { if (type != TYPE_SIGNATURE || state != EMPTY) { throw new IllegalStateException(); } CheckMethodAdapter.checkInternalName(name, "class name"); state = CLASS_TYPE; if (sv != null) { sv.visitClassType(name); } }
0f65b484-11be-44f0-9151-2dec13fee1aa
0
public static IBomber buildBomber(int number, int bombs, Match match, String projectFolder) throws IOException { ProcessBuilder pb = new ProcessBuilder(projectFolder + "/run.sh", Integer.toString(number), Integer.toString(Game.PORT_NO)); Map<String, String> env = pb.environment(); env.put("PATH...
8691f4a3-5790-4dd4-9bb4-162f242a0e6d
1
public void runJob() { try { JobOperator jo = BatchRuntime.getJobOperator(); long jobId = jo.start("eod-sales", new Properties()); System.out.println("Started job: with id: " + jobId); } catch (JobStartException ex) { ex.printStackTrace(); } }
ddc7d49e-872f-4075-950b-0582ffdf4b81
0
public String getDescription() { return description; }
30211420-2deb-4bca-bb75-98da68627852
5
public usb.core.Device getDevice (String portId) throws IOException { // hack to work with hotplugging and $DEVICE // /proc/bus/usb/BBB/DDD names are unstable, evil !! if (portId.startsWith("usb-@0x")) { String wanted_busnumstr = portId.substring(7); ...
3828e729-a6c4-431f-80b8-45c18d6365cc
8
static double dijsktra(int d,int h,double[][] mAdy){ int n=mAdy.length;double[] sol=new double[n]; boolean[] visitados=new boolean[n]; PriorityQueue<double[]> cola=new PriorityQueue<double[]>(n,new Comparator<double[]>(){ public int compare(double[] o1,double[] o2){ if(o1[0]<o2[0])return -1; if(o1[0]>o...
e39f5c11-c477-46bc-b102-849db05b12f5
9
public void do_interrupt(int ID) { System.out.println("Interrupt"); if (is_bit_set(7, 0xb)) { switch (ID) { // RB0 Interrupt case 1: if (is_bit_set(4, 0xb)) { STACK.add(getProgrammCounter()); setProgramCounter(4); set_Bit(1, 0xb); } System.out.println("RB0 Interrupt"); break;...
310926d7-04c9-4eaa-b0b3-a847623f8ee2
1
@Test public void testBadRange() throws Exception { final Properties config = new Properties(); final String min_uptime = "2000"; final String max_uptime = "200"; config.setProperty("min_uptime", min_uptime); config.setProperty("max_uptime", max_uptime); final Conn...
6d11b6e7-aa83-4a4c-843b-c2957a3354a6
3
@Override public boolean acceptsDraggableObject(DraggableObject object) { if(object instanceof DraggableObjectEntity) { DraggableObjectEntity fileobj = ((DraggableObjectEntity)object); if(fileobj.uuid != null) { if(!fileobj.uuid.trim().equals("")) return true; } } return false; }
c15078a7-18e2-46db-a0fe-275ad3a02f9c
5
public void setSubtotalRow(String countType, int rid, double[] subtotal, HSSFWorkbook workbook, HSSFSheet sheet) { HSSFRow row = sheet.createRow(rid); for (int k = 0; k < 10; k++) { try { switch (k) { case 3: excelUtils.setCellValue(subtotal[0], workbook, k, row, cellStyle.cellFontBoldBorderStyle);/...