method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
42d7c447-7ad2-4b12-8ece-ce4a39c15970
5
@Override public boolean execute(AdrundaalGods plugin, CommandSender sender, String... args) { // Grab the argument, if any. String arg1 = (args.length > 0 ? args[0] : ""); if(Bukkit.getPlayer(arg1) == null && !arg1.isEmpty()) { Messenger.sendMessage(sender, Message.playerNotFound); return t...
8bdea214-af51-4f9b-80e8-0f1911ea3759
3
public void setCode(int code) { if(code <= MAX_PLAYER_NUM) { this.owner = code; this.status = FREE_OPT; } else if(code <= MAX_PLAYER_NUM*2) { this.owner = code - MAX_PLAYER_NUM; this.status = SURROUNDED_OPT; } else if(cod...
18462d7c-9c73-41ff-9962-054fb4240f02
9
public static boolean hasReturn(Statement s){ if (s instanceof Skip || s instanceof Assignment) return false; if (s instanceof Conditional){ Conditional c = (Conditional)s; return hasReturn(c.thenBranch()) || hasReturn(c.elseBranch()); }if (s instanceof Loop){ return hasReturn(((Loop)s).body()); }if...
082afe73-f46e-4b5f-b394-af564dff1689
8
public static Map<Vector, Map<Vector, Integer>> distances(Set<Vector> tiles) { // Initialize distances Map<Vector, Map<Vector, Integer>> distances = new HashMap<Vector, Map<Vector, Integer>>(); for (Vector a : tiles) { Map<Vector, Integer> m = new HashMap<Vector, Integer>(); ...
606e3e86-b423-484c-9390-766c58fd9e74
1
public void schemeEditorAddInput() { if(ce_input.getText().length() == 0) return; String inputName = ce_input.getText(); scheme.getInputs().add(inputName); ce_input.add(inputName); Contact contact = new Contact(inputName, -1); ce_source.add(contact.toString()); se...
d90fbd57-8da3-4a3c-8987-7aa54bff5822
3
private void getbof() { if(recno<0) { recno = 0; if(Idx!=null) Idx.recno = recno; else if(cdx_file) Cdx.recno = recno; } bof = (recno<1); }
1baf9a87-8d34-4b10-885f-cb577f968d79
8
@Override public void keyPressed(KeyEvent e) { System.out.println("K"+e.getKeyCode()); if(e.getKeyCode()==87){ //W-UP cp.moveDir('u', 1); }else if(e.getKeyCode()==83){ //S-Down cp.moveDir('d', 1); }else if(e.getKeyCode()==68){ //A-Right cp.moveDir('r', 1); }else if(e.getKeyCode()==65){...
2cd8d6d8-6c9a-4568-9702-cf2c0d3362fa
4
private static String holder(String base) { int div = base.length() / SizeSix; char[][] six = new char[div + 1][SizeSix]; for (int i = 0, j = 0, k = 0; k < base.length(); i++, k++) { if (i >= SizeSix) { j++; i = 0; } six[j][i] = base.charAt(k); } String[] end = new String[div]; for (int...
eab1239b-1d6d-41e9-a462-d3c73b1387c5
7
@Override public String execute() { Usuario usuario = FabricaDAO.getUsuarioDAO().getUsuario(email); if(usuario != null) { if(senhaAtual.length() == 0) { addFieldError("senhaAtual", getText("erro.senha.obrigatorio")); } else if(!senhaAtual.equals(us...
32a5a9f4-1af8-47b8-a0aa-c572dc7de9fa
0
public void setProvincia(String provincia) { this.provincia = provincia; }
70fb000d-9910-4547-a3a4-2ffe5ca627a7
2
public static contractTypes intToContractType(int type) { for (contractTypes tmpType : contractTypes.values()) { if (tmpType.ordinal() == type) { return tmpType; } } return contractTypes.CALLWORKER; }
bc200006-a8e7-4cc2-aac4-e7079cc7cc39
4
public void paint(GC gc, int width, int height) { if (!example.checkAdvancedGraphics()) return; Device device = gc.getDevice(); String fontFace = (String)fontNames.get(fontFaceCb.getSelectionIndex()); int points = fontPointSpinner.getSelection(); int style = styleValues[fontStyleCb.getSelectionIndex()]; Font ...
a000966c-3850-423a-8441-116457cb9154
9
private String encodeAsString(Packet obj) { StringBuilder str = new StringBuilder(); boolean nsp = false; str.append(obj.type); if (BINARY_EVENT == obj.type || BINARY_ACK == obj.type) { str.append(obj.attachments); str.append("-"); ...
48f2d4c7-c9fd-424c-bc6e-2ca32298190c
4
public DevBukkitSite(PluginUpdateInfo pui, String url) throws MalformedURLException { if (!url.startsWith("http://")) { url = "http://" + url; } if (!url.endsWith("files") || !url.endsWith("files/")) { if (!url.endsWith("/")) { url += "/files/"; }else{ url += "files/"; } } targetPlugin = p...
e62802a2-414c-490e-a4f7-9c4fc933d2b7
1
public static Article selectArticleByRef(String ref) throws SQLException { String query; Article article = new Article(); ResultSet resultat; query = "SELECT * from ARTICLE where ARTREF =? "; PreparedStatement pStatement = ConnectionBDD.getInstance().getPreparedStateme...
2a836a1c-2227-495b-a8b6-98d75e2c1d1b
3
public static String getMaxPublisherID(){ try { ResultSet rs=DB.myConnection().createStatement().executeQuery("select max(PublisherID) from publisher"); String x="x"; while(rs.next()){ x="y"; int publisherId=Integer.parseInt(rs.getString(1))+1; ...
bdb6fa53-d048-46e7-bb4c-0fe44675c19b
6
@Override public boolean setFromString(String frameString) { String[] strs=frameString.split("\\/"); boolean failed=false; if(strs.length>0) { try { this.position=new Integer(Integer.parseInt(strs[0])); } catch (NumberFormatException ex) { fa...
c032cdf3-f979-42cd-a471-e56688a4b06d
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=this.getTarget(mob, commands, givenTarget); if((target==null)||(target==mob)) return false; final Room R=mob.location(); if(R==null) return false; if(!super.invoke(mo...
b55c402b-7e63-42fe-bd47-d1fad7d9891b
7
public void actionPerformed (ActionEvent e) { if (e.getSource()==Dirs) { String s=Dirs.getSelectedItem(); if (s==null) return; if (s.equals("..")) dirup(); else dirdown(s); } if (e.getSource()==Files) { if (e instanceof ListerMouseEvent) { ListerMouseEvent em=(ListerMouseEvent)e; if (em.clickCo...
752ac612-7582-4e53-96d8-7cdfa40183d9
7
@Override public int hashCode() { int result = firstName != null ? firstName.hashCode() : 0; result = 31 * result + (lastName != null ? lastName.hashCode() : 0); result = 31 * result + (patronymic != null ? patronymic.hashCode() : 0); result = 31 * result + (DOB != null ? DOB.hashCod...
241dddb9-0ad5-4624-9701-6e97175d364b
2
public void drawLines() { Graphics g = this.getGraphics(); Graphics2D g2d = (Graphics2D) g; int w = getWidth(); int h = getHeight(); RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VA...
97949c4e-5268-405e-b6ab-7c146fe70f6a
7
private final void loadVideoFromFile() { final GUI self = this; // Create the image selector JFileChooser fc = new JFileChooser(this.videoLastSearchDir); fc.setAcceptAllFileFilterUsed(false); if (this.videoExtensions != null) { fc.addChoosableFileFilter(new FileFilter(){ @Override public final boo...
7609329d-7544-4a69-9f84-60746cf82a03
8
private double get_w_value(int idx, int label_idx) { if (idx < 0 || idx > nr_feature) { return 0; } if (solverType.isSupportVectorRegression()) { return w[idx]; } else { if (label_idx < 0 || label_idx >= nr_class) { return 0; ...
feff78f1-6e7f-405c-85e1-1755a78ca745
1
public void showHistory(){ for (int i = 0; i < currentStep; i++){ history[i].showField(); } }
c1362c8f-5453-498b-88e8-3e241c139d0b
0
public void setDrawable(ArrayList<DrawableItem> drawn) { this.ditems = drawn; }
f2cd072d-5327-4770-845d-4cdf580eeb7f
8
@Test public void testNameEnumeration() { CCNxMallNE _networkHandler = new CCNxMallNE(); ArrayList<ContentName> _contentList = new ArrayList<ContentName>(); CCNHandle incomingHandle = null; CCNHandle outgoingHandle = null; try { incomingHandle = CCNHandle.open(); outgoingHandle = CCNHandle.ope...
e49959ae-1888-41e9-aa31-045254bc5260
9
public static void editCourseWork(Course tempCourse){ if(tempCourse.getCourseWork()==null){//add percentage of coursework System.out.print("Please Input Total Weighted Percentage of the Coursework : "); int weightage; while(true){//only int input accepted if(sc.hasNextInt()){ weightage = sc.nextInt(...
4e81600c-df2a-4d67-955d-809bb028ad7a
5
public void askUserType(List<String> userTypes) { System.out.println(this.texts.get("userType")); String list = ""; for (int i = 0; i < userTypes.size(); i++) { list = list.concat("\t[" + (i + 1) + "]\t" + userTypes.get(i) + "\n"); } System.out.println(list); String rep = ""; int indexRep = -1...
bcf7f1a4-3b0d-468e-8ee2-776db5de9273
8
public void print() throws IOException { long curOffset = raf.getFilePointer(); raf.seek(0); System.out.println("0: checkpoint record at offset " + raf.readLong()); while (true) { try { int cpType = raf.readInt(); long cpTid = raf.readLong(); ...
dd5588e9-3e91-42f9-83ee-69f3afab1da2
1
@Override public void undo() { // Remove the Node node.getTree().removeNode(node); undoable.getTargetParent().removeChild(node); // Insert the Node undoable.getParent().insertChild(node,index); node.getTree().insertNode(node); // Set depth if neccessary. if (undoable.getTargetParent().getDepth() !=...
cfa79aaa-877c-4b52-9637-034a6126e83e
4
@Override public void update(ChiVertex<VertexDataType, EdgeDataType> vertex, GraphChiContext context) { try { /* Buffer management. TODO: think, this is too complex after adding the multiplex */ if (context.getThreadLocal() == null) { ArrayList<LocalWa...
7a264d66-b418-459e-9407-a87fc7a2f322
8
private boolean r_postlude() { int among_var; int v_1; // repeat, line 70 replab0: while(true) { v_1 = cursor; lab1: do { // (, line 70 ...
4e331e31-0f64-4997-9ee9-d754f4d84917
3
public Interpreter(String fileName, boolean debugMode) { CodeTable.init(); if (debugMode) { CodeTable.debuggerInit(); } try { if (debugMode) { bcl = new ByteCodeLoader(fileName + ".x.cod"); loadSourceLines(fileName); } e...
4e4c58bd-6163-435a-878a-235ec5a335a0
1
public static void main(String[] args) { String[] manditory_args = { "data"}; createCommandLineOptions(); CommandLineUtilities.initCommandLineParameters(args, Classify.options, manditory_args); String data_file = CommandLineUtilities.getOptionValue("data"); int num_samples = 100; if (CommandLineUtil...
074ef5b8-d62c-4c58-986d-59723f0329c3
6
private Cluster loadConfiguration(String configurationName) { try { // Get the document element from the XML file File file = new File(this.configurationsFile); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(f...
88f59e07-6828-47d3-90bd-5a9c55b8a0ed
6
public static Cons yieldNativeSlotValueSetterTree(StorageSlot slot, Stella_Object objectref, StandardObject objecttype, Stella_Object valueref) { slot = StorageSlot.canonicalSlot(slot); { boolean mixinslotP = ((Stella_Class)(slot.slotOwner.surrogateValue)).mixinP; Stella_Class objectclass = StandardObject...
1625aa0a-a35e-4b90-ae6c-c968f966c7cc
0
@Override public void init(List<String> argumentList) { identifier = argumentList.get(0); offset = Integer.parseInt(argumentList.get(1)); }
af0794e4-62d8-4a01-a486-0b59dccc1393
8
@Override public int search(CharSequence text, String pattern) { int i, j, M = text.length(), N = pattern.length(); int[][] dfa; ListOrderedSet<Character> chars = new ListOrderedSet<>(); for (int k = 0; k < N; k++) if (!chars.contains(pattern.charAt(k))) chars.add(patt...
b2cd231e-c61d-476a-9110-6934def1756b
9
public static JSONArray JSONArrayOfKingdomFromJsonArray(JSONArray organizedJson, String key){ int len = organizedJson.length(); int i,j,k,l; JSONArray json = new JSONArray(); String kingdom_name; boolean ok = false; for(i = 0; i < len && !ok; i++) { JSONObject kingdom = organizedJson.getJSONObject(i);...
2dae32f3-d6e6-4eef-a1a9-f44c6fbbc85a
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; WorkPackagePK other = (WorkPackagePK) obj; if (proj_ID != other.proj_ID) ...
1e5ca94d-d9e2-4a98-8e22-785d69820b7c
1
public void visit_invokestatic(final Instruction inst) { final MemberRef method = (MemberRef) inst.operand(); final Type type = method.nameAndType().type(); pop(type.paramTypes().length); if (type.returnType() != Type.VOID) { push(inst); } }
75118db8-4fe4-4934-88d7-d6941b3c5444
1
@Override public boolean shouldReact(Message message) { return message.text.startsWith("rss") && getCommand(message.text) != Cmds.INVALID; }
b12e4aa9-fe20-4d96-84aa-981bec03c7df
1
@Override public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception { ArrayList<String> alColumns = null; try { ClienteDao_Mysql oClienteDAO = new ClienteDao_Mysql(Conexion.getConection()); alColumns = oClienteDAO.getColumnsNames(); ...
813533a0-78e0-4ff1-b855-30086c3da667
2
private void copyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_copyButtonActionPerformed Connection destConnection = this.connectionsList.getSelectedValue(); if(destConnection == null) return; // User hasn't selected anything. String name = this.st...
ef6557a0-190f-4ace-bc2a-ba48cbd06eab
4
public void keyPressed(KeyEvent e) { int code = e.getKeyCode(); // If n key is pressed generate new maze and start from scratch if (code == KeyEvent.VK_N) { this.runBFS = false; this.runDFS = false; this.bfs.toDo.clear(); this.dfs.toDo.clear(); ...
aa7cdeb8-59f2-4ffa-bc06-19730dcbe1e2
5
public void endElement(String uri, String name, String qName) { if (!ignoreList.contains(qName)) { for (int i = 0; i < lastAttributes.getLength(); i++) { last .put(lastAttributes.getQName(i), lastAttributes .getValue(i)); } if (!(temp.toString().trim().equals(""))) { if (type == LEFT)...
c9e61936-0539-43d3-b5f2-011ef84c021a
0
@Override public void method3() { this.a = 20; System.out.println("Running: method3() a = " + a); }
381c9150-f71e-47ae-83f6-5c2e71898c2d
2
void conflictsWith(LocalInfo l) { if (shadow != null) { getReal().conflictsWith(l); } else { l = l.getReal(); if (!conflictingLocals.contains(l)) { conflictingLocals.addElement(l); l.conflictingLocals.addElement(this); } } }
453d1d59-19c6-4a6a-b885-d24c551b6d60
4
@SuppressWarnings("unchecked") public static final byte[] encode(Object o) throws BencodingException { if(o instanceof HashMap) return encodeDictionary((HashMap)o); else if(o instanceof ArrayList) return encodeList((ArrayList)o); else if(o instanceof Integer) ...
5a72143d-bba2-4909-b095-c68f3f2999a2
5
private void PopulateVRTable(String patID) { ResetVRTable(); // ResultSet rs = dbQuery.Doctor_GetPatientList(this.user.DoctorID, true, txt_FirstName.getText(), // txt_LastName.getText(), // txt_PatientID.getText(), // "2013-01-01 00:00:00", // "2015-01-01 00:00:00"); // "YYYY-MM-dd HH:mm:SS")...
0771e923-3ad1-45fe-912b-9ca531192cec
6
private static char[] removeFrontZero(char[] number, boolean minus) { int i=0; for(;i<number.length;i++) { if(number[i]!='0' && number[i]!='\u0000') { break; } } if(i==number.length) { return "0".toCharArray(); } number = Arrays.copyOfRange(number, i, number.length); if(minus){ numb...
92f730c0-312d-4178-a27d-04b95e397cb5
0
public static void main(String[] args) { // TODO code application logic here }
ced5074c-0058-4a77-83e7-bf8d62e1fba5
6
public static boolean isAnagram(String s1, String s2) { if (s1.length() != s2.length()) { return false; } int[] arr = new int[256]; for (int i = 0; i < s1.length(); i++) { arr[s1.charAt(i)]++; } for (int i = 0;...
e7d36427-f3f6-4bef-938f-03801d0956f8
7
@Override public void keyPressed(NativeKeyEvent nke) { // Save Recording if (nke.getKeyCode() == NativeKeyEvent.VK_F12) { } //Load Recording if (nke.getKeyCode() == NativeKeyEvent.VK_F10) { } //Replay Recording // if (nke.getKeyCode() == NativeKeyEvent....
42829b8f-4637-4d1a-8efa-b56d5f6814cb
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...
bacebe03-5d8a-4a73-a8ee-f0ed1353323b
9
private String constructIRRequest(ISQLNode sql) throws Exception { switch(sql.getType()) { case Root: { SQLRoot root = (SQLRoot) sql; // Root can be ignored so just // return the input relation // request from the child n...
f311b992-6482-4557-b142-a2d163bf841c
4
final public CycList existLBoundForm(boolean requireEOF) throws ParseException, java.io.IOException, UnsupportedVocabularyException { CycVariable var = null; CycObject sent = null; CycList val = new CycList(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case THEREEXISTATLEAST_CONSTANT: jj_consume_token(...
09c2ff3f-da23-41ca-a45c-f21d93ece014
9
@Override public void paint(Graphics g) { // initialize Graphics2D ga = (Graphics2D) g; ga.setColor(getBackground()); ga.clearRect(0, 0, this.getWidth(), this.getHeight()); ga.fillRect(0, 0, this.getWidth(), this.getHeight()); if (simulateUntil) { URL iconUrl = getClass().getResource("/res/icons/sos_lo...
4d3370d9-26c0-4c04-b323-fa016a844b7d
6
private Token read(Token token) throws ScriptException { while (line != null) { char ch = charAt(index); index++; if (Character.isDigit(ch)) return readInteger(token.append(ch)); if (ch == '\0') return token; if (isOpera...
d162312b-c235-46d2-8f3f-2adb73003de4
1
public static String concat(Object... args) { StringBuilder sb = new StringBuilder(); // Iterate all objects and append to our string buffer for (Object o : args) sb.append(o); return sb.toString(); }
64dbcc81-95f1-460b-9936-98464db2d677
3
public String getPathWord() { StringBuilder string = new StringBuilder(100); char[] array = new char[100]; TrieNode curNode = this; int count = 0; /*Loop up the trie up until loop * while storing each charater in an array*/ while (true) { array[count] = curNode.character; if (curNode.isRoo...
ff101b3d-2aa9-4c94-b7aa-8f643de6d127
9
private static boolean proceedInputProperties(String id, Properties props) { while (true) { printMessage("property.start1"); printMessage("property.start2"); for (String key : PROP_KEYS) { String value = props.getProperty(key); print(res.get("p...
146950ba-da9f-4d04-9415-d10b055a9c3f
3
public double[][] ImageSetDWT_Byte(int _numCoeffcient, int _y, int _x) { //transfer This byte to arraylist double[][] _doubleByte = new double[this.height][this.width]; for(int j=0;j<this.height;j++) { for (int i = _x; i < this.width; i++) { _doubleByte[j][i] = t...
6884fcda-4fee-4476-b534-f3a13b287390
7
public void mousePressed(){ toggleButtons(); if (this.editModeButton.toggle==1) { if (this.saveButton.toggle == 1){ //In edit mode, save the current layout this.save(); } if (this.newLayoutButton.toggle ==1){ //In edit mode, create a new force directed layout this.changeLayout();...
d6620405-093b-4805-b4d8-4ad0774c68a8
3
@Override public void run() { try { while(!ds.updateUIflag){ Thread.sleep(100); } cui.appendStatus("GuiUpdate startar och kommer att köra i " + sleepTime + " millisekunder."); int i = 1; while (i <= 20) { ...
e38d4945-e241-4ae4-b3d7-f47e418357b3
7
@Override protected void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g.create(); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); int h = getHeight(); int w = getWidth(); Paint p; // Fond p = (couleur==CouleurCase.BLANC)?new Color(0xEEE...
1834f773-c704-46b9-9b1b-498fe77388e4
5
public static String printBooleanArray(boolean[] array) { if (array==null || array.length==0) { return "empty"; } else { String s = "" + (array[0]?"1":"0"); for (int i=1; i<array.length; i++) { s += array[i]?"\t1":"\t0"; } retur...
18a2492a-6d28-490b-bf2e-ccaae2c40cce
4
public InterfaceReseau(Protocole proto, String adresseIP, int portLocal, int portDistant) { protocole = proto; switch(protocole) { case UDP: connexion = new ConnexionUDP(adresseIP, portLocal, portDistant); break; case TCP: try { connexion = new Connexio...
7fa591c2-3d01-4c00-aeb0-c1216782abfe
5
public void guiActionPerformed(int elementId, int action) { if (elementId == list.getId()) { switch (action) { case 0: close(); break; case 1: close(); game.showGui(new GuiLoad(game, Game.WIDTH, Game.HEIGHT).setParent(this)); break; case 2: splash = "No options, yet!"; break; ...
5ea96c9b-1267-4699-a7d1-f094d0e4ccc7
7
public ArrayList<Point> formLine(int x0, int y0, int x1, int y1) { ArrayList<Point> pointsOnLine = new ArrayList<Point>(); int dx = Math.abs(x1-x0); int dy = Math.abs(y1-y0); int sx = x0<x1 ? 1 : -1; int sy = y0<y1 ? 1 : -1; int err = dx-dy; while (true) { ...
c28b9387-cf2b-43d0-84f8-81a21ba22202
3
public String solve(){ if(status != NOT_SOLVED){ return status; } double p0 = initAprox; double p = g(p0); for(int i = 0; i < MAX_ITER; i++){ p = g(p0); if( Math.abs(p - p0) < TOLERANCE){ // we're done solution = p; iterations = i; solutionEval = g(p); status = SUCCESS; return SU...
6e0182c5-d613-4917-81fc-3d56e37272de
5
@Override public void test() { Parser p = new RecursiveParserImpl(); Expression exp = p.parse("((y xor x) xor ((x * y) * z))"); Util.Log(exp.toString()); Calculable calc = exp.toCalculable(new RecursiveCalculableFactoryImpl()); VariablesSet varSet = new VariablesSet(calc.getVariableNames()); List<String> v...
4b9903c2-db2e-4982-8600-8e61b660c35f
3
public static void compare(byte[] val1, byte[] val2, int len) { if (val1.length != val2.length) { System.out.println("2 arrays are not the same length!"); } else { for (int i = 0; i < len; i++) { System.out.print("Index " + i + ": " + Integer.toBinaryString(val1[i...
8ab1e2e0-497a-4098-8433-5c16a23d1661
6
@EventHandler public void SpiderPoison(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.getSpiderConfig().getDouble("Spider.Poison.D...
a2129d26-5e84-4005-a4a0-6b718c4c7841
1
public void serviceRegistration(ServiceRegistration... registrations) throws ServiceRegistrationException { for (ServiceRegistration registration : registrations) { registration.register(); } }
1cf776d5-160c-4165-8c60-5017223195d5
7
public String GetNextWord(){ //Pre: fetch next word from data,pos set to the one next of the word //Post: including number is also fetch as word StringBuffer tmp=new StringBuffer(); char tmp_char; ...
823cc1f9-b201-480d-ac7c-805030a834d7
7
public double computeMarginal() { // TODO: Add code here // generate samples for (int i = 0; i < numSamples; i++) { // generateHidden for (int j = 0; j < _parameters.numHiddenNodes(); j++) { generatedHiddens[i][j] = generateH(i,j); } // generateVisibles for (int j = 0; j < _parameters.numVisib...
6613138c-ef18-4f76-873f-eb4aa43665bc
9
@Override public boolean execute(WorldChannels plugin, CommandSender sender, Command command, String label, String[] args) { final Map<Flag, String> info = new EnumMap<Flag, String>(Flag.class); info.put(Flag.TAG, WorldChannels.TAG); if(sender.hasPermission(PermissionNode.OBSERVE...
5a0e78e4-e5cb-4948-aad6-b196a73b8a6a
9
protected static void parseArgs(String [] args) { if (args.length == 0) { System.out.println("Error: Missing input file argument!"); printUsage(); System.exit(-1); } else { file = args[0]; } for (int i = 1; i < args.length; ++i) { if (args[i].equals("-printtokens")) { printtokens = true...
aa9f6d73-172d-4661-8eb2-504511a164b6
4
public int getLongestIncreasingSequenceDP(int[] a) { int[] l = new int[a.length]; Arrays.fill(l, 1);// 1 case for (int i = 1; i < a.length; i++) {// max(L(i))+1 case for (int j = 0; j < i; j++) { if (a[i] > a[j] && l[i] < l[j] + 1) l[i] = l[j] + 1; } } return print(l); }
da98e82b-c23e-4c9b-9287-862a5d951a4f
1
public void setShelfCount(int shelfCount) throws CarriageException { if (shelfCount < 0) { throw new CarriageException("Shelf count is under zero"); } this.shelfCount = shelfCount; }
a9f82361-529e-4cab-adf6-18c4c6f4972c
2
private static void supplyBeverage(int choice) { if (choice <= 3) { foodFactory = BeverageFactory.getInstance(); } else { foodFactory = SandwichFactory.getInstance(); } FoodItem foodItem = foodFactory.orderFoodItem(menu.get(choice)); if (foodItem != null) { System.out.println("Your food item " + foo...
8603c7c6-b497-4d3d-ae05-204c21b40e72
7
public static OfficeFinder getFinder(final MsOfficeType contentType) { OsEnum os = OsEnum.getOS(System.getProperty("os.name")); switch (os) { case WINDOWS_XP: case WINDOWS_VISTA: case WINDOWS_SEVEN: case WINDOWS_8: if (contentType.isMsOfficeCompatible()) { return new MsOf...
666e07b0-69fa-427a-9b05-315535bc5034
4
public final int[] getFontSizes() { Registry reg = getRegistry(); int begin = reg.getInteger("MAIN", "font.sizes.minimum"); int end = reg.getInteger("MAIN", "font.sizes.maximum"); int granularity = reg.getInteger("MAIN", "font.sizes.granularity"); if (begin > end) { throw new IllegalArgumentEx...
dfe5a9e9-b924-4f01-a551-c8d66f7ec6d9
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...
3905eb9b-8b7b-465c-bf9a-5f4a59ec3149
0
public double getLatitude() { return latitude; }
26ddc8f3-6cdd-44e0-8a74-d7d12046db06
0
public JButton getButton() { return button; }
d6c6fb4a-34d4-4b61-9f48-0eb43c01f176
9
void doUnitcellStuff() { /* * really THREE issues here: 1) does a model have an associated unit cell that could be displayed? 2) are the * coordinates fractional and so need to be transformed? 3) does the model have symmetry operations that were * applied? * * This must be done for each model individu...
2604a345-4644-4b1d-9264-76bb4b0267f3
7
public static int getPointOfRotation(int l, int r) { if (l > r) return 0; if (l == r) { return l; } int mid = (l + r) / 2; if (mid < r && array[mid + 1] < array[mid]) { return mid + 1; } if (mid > l && array[mid] < array[mid - 1]) { return mid; } if (array[mid] > array[r]) { return g...
c870026e-1426-4d0f-a4da-e5f9b85fefdc
5
public void printTree(){ Stack<NodoArbol> pila = new Stack<>(); Set<NodoArbol> visitados = new HashSet<>(); pila.add(root); while(!pila.isEmpty()){ NodoArbol na = pila.pop(); visitados.add(na); System.out.print(na+" "); if(!na.getHijos().is...
6b98573c-a2b0-40be-9ecb-7e7a5b0c2dc1
4
private boolean isHovered(Lodestone lodestone) { for (Component component : ctx.widgets.widget(HOVER_TELEPORT).components()) { if (component.childrenCount() > 0) { for (Component child : component.components()) { if (child.text().toLowerCase().startsWith(lodestone.name().toLowerCase().replace('_', ' '))) ...
f0b651a3-f66c-4c10-bf76-81835fd98063
5
public void removeNonPlayerEntities() { int XC = (int)minPoint.x >> 4; int maxXC = (int)maxPoint.x >> 4; int ZC = (int)minPoint.z >> 4; int maxZC = (int)maxPoint.z >> 4; int ZCS = ZC; World w = minPoint.getWorldObj(); for(; XC <= maxXC; ++XC) { for(; Z...
2d337a68-871c-4803-ab1a-9bb1a7e91068
0
public long getSequence() { return this._sequence; }
c60baaba-d451-4737-941d-106e44d7f3eb
5
public static byte getID(int rgb) { if (rgb == GRASS_MAP.getRGB()) { int rand = Tools.randInt(1, 4); switch (rand) { case (1): return GRASS_1; case (2): return GRASS_2; case (3): return GRASS_3; case (4): return GRASS_4; }...
104ec12a-bcc1-40f3-8972-ab036b147fd9
4
public Matrix minus(Matrix B) { Matrix A = this; if (B.M != A.M || B.N != A.N) throw new RuntimeException("Illegal matrix dimensions."); Matrix C = new Matrix(M, N); for (int i = 0; i < M; i++) for (int j = 0; j < N; j++) C.data[i][j] = new DataNode(A.data[i][j].value() - B.data[i][j].value()); retu...
8f4f08ec-418d-40af-b3b7-dbd51d2abc48
3
public void helpContactPromptsForLogin(DriverGenerator dg){ // boiler plate WebDriver wd = dg.generate(); ParallelPrepHelper pph = new ParallelPrepHelper(wd); // setup boolean madeItToPage = pph.goToURL(AMAZON_HOME_PAGE); boolean helpLink = pph.clickOnVisibleElement(HELP_LINK); boolean contactUsLink = pph...
1aaa492e-c553-4077-9bb1-a2cb0d955720
8
@Override public void paint(Graphics g) { super.paint(g); // tlo g.drawImage(constantElementsImage, 0, 0, this); g.drawImage(markersImage, 0, 0, this); // wyluskiwanie elementow zmiennych ChangingEnvironmentView environmentView = environment.getChangingEnvironmentView(); //...
26c8bce6-3093-4d3a-8ff9-e9e9879cec8f
3
public void serverStopSlowAction() throws InterruptedException { // this had better fucking work... // broadcast message saying server going down in 10 seconds, // logging? // broadcast countdown (wait 1s in between) // broadcast server going down now // kickall (reason: server going down) // ...
dfc9b17e-b9a5-4762-bc92-8808fd63f0c0
6
public List<Produtos> listaProdutos() { this.getConectaBanco(); List<Produtos> listaProdutos = new ArrayList<Produtos>(); try { if (this.getConn() != null || !this.getConn().isClosed()) { this.setStmt(this.getBuscaListaProdutos()); this.setResultSetProdutos(this.getStmt().executeQuery()); this.ge...
2ffd2bc0-e6be-4095-a6a1-aaa8130510c4
1
private HttpURLConnection set_headers(String url) throws MalformedURLException { URL obj = new URL(url); HttpURLConnection con = null; try { con = (HttpURLConnection) obj.openConnection(); con.setRequestProperty("Content-Type", "application/json"); con.setRequestProperty("Accept", "application/json");...