method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9ab5a558-bd00-44f8-927f-ff9023fe2434
0
public Segmentator(MatlabProxy proxy, MatlabTypeConverter processor){ this.proxy = proxy; this.processor = processor; }
fa8ec30b-b577-440b-9804-cdbf9bdec8b4
5
public void setJumping(boolean b) { if(knockback) return; if(b && !jumping && falling && !prevDoubleJump) { doubleJump = true; } jumping = b; }
79cd50c0-82ec-4b9e-89b9-95d3c9c77752
5
public static Boolean checkDate(int roomID, String dateOut, String dateIn) { try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } Statement stmnt = nu...
36e38fb3-bda7-4635-b261-d17e1f573903
4
public static void init() { // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS try { driveTrainRightFront = new CANJaguar(5); } catch (CANTimeoutException ex) { ex.printStackTrace(); } try { driveTrainRightBack = new ...
e3cba8b1-ecf4-4daf-b58b-9ea42b02f9bb
9
private ArrayList<Dot> findAvailableDots(Dot dot, Capture capture) { ArrayList<Dot> result = new ArrayList<Dot>(); // converts "i" into dots coordinates, starting from from the top dot, // counterclockwise int x = dot.getX() + 1; int y = dot.getY() - 1; for(int i = 0; i <...
73efc594-7631-424b-bbf3-4105d1e83abf
6
@Override public List<AssemblyLine> generate(Context context) { final List<AssemblyLine> lines = Lists.newLinkedList(); if (Compiler.debug) { lines.add(new Comment("Start return")); } Function function = context.getFunction(context.getName()); ...
e08383fa-3c0d-4e9d-8222-9b1c5cf57999
2
private static void consumer() throws InterruptedException { Random random = new Random(); while (true) { Thread.sleep(100); if (random.nextInt(10) == 0) { Integer value = queue.take();//if queue is empty waits System.out.println("Taken value: " + ...
099d0460-250d-45c6-a53a-4726d88062fd
9
public Ast.AstPrefixGenericName parse_PrefixGenericName() { int at = m_current; if (!ok()) { return null; } // PrefixGenericName : PrefixGenericSymbol Decoration if (peek(TozeTokenizer.TOKEN_PSETONE) || peek(TozeTokenizer.TOKEN_FS...
fee5c622-acc0-46ad-995d-80ed0481b34e
4
public static ArrayList<?> removeDuplicates(ArrayList<?> list) { ArrayList<Object> temp = new ArrayList<Object>(); for(Object i : list) { if(!temp.contains(i)) { temp.add(i); } } return temp; }
04fddaa8-6aea-46b3-9233-b746675c7e9a
9
private void recalcularDistancia() { double dist=0; if(secuencia.size()!=0) { if(carro!=null){ Nodo primer= darPrimerNodo(); if(primer!=null) { if(primer.getPosX()==carro.getPosX() || carro.getPosY()==primer.getPosY()) { dist++; }else{ dist+=Math.sqrt(2); } } ...
864362c2-a138-45ff-83e3-b64dcb295c0a
2
public static boolean email(String email){ if(email.matches("(\\w)+(\\.(\\w)+)*@(\\w)+(\\.(\\w)+)*\\.[a-z]{3}")&&email.length()<100) return true; return false; }
a9c70d13-1d2f-4e06-842f-0f40dbe02fe9
7
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!super.okMessage(myHost,msg)) { return false; } final MOB source=msg.source(); if((!msg.source().Name().equals(text()))&&((msg.source().getClanRole(text())==null)) &&(msg.tool() instanceof Ability)&&(msg.target()==aff...
32431b63-3f80-40c7-bf8a-b2f3fe096714
5
private short try_connect_mysql() { MsgDumperCmnDef.WriteDebugSyslog(__FILE__(), __LINE__(), "Try to connect to the MySQL database server..."); try { // Java要連接資料庫時,需使用到JDBC-Driver,連接MySQL資料庫使用Connector/j,下載後解開壓縮,mysql-connector-java-5.1.15-bin.jar就是MySQL的JDBC-Driver了. // Go to http://blog.yslifes.com/archives/...
b4aa8671-e761-4c31-84de-4fdbeeb1f2f7
9
protected void rebuildBeanConnections(Vector deserialized, Object key) throws Exception { int i; int n; int sourcePos; int targetPos; String event; boolean hidden; Vector ...
ad9ca6b9-bd03-4e2d-b48d-0f81cb67b58a
2
protected static void comm(final String s) { if (PersistentBloatContext.DB_COMMIT || BloatContext.DEBUG) { System.out.println(s); } }
5ac38126-33ea-4779-b8b9-912bb8296a13
8
@Override public void run() { System.out.println("Starting statistics run"); long time = System.currentTimeMillis(); List<Individual> indv = new ArrayList<Individual>(); for(int k = 0; k < INDIVIDUALS; k++){ System.out.println("Evolving tracker "+(k+1)); List<Individual> ...
d8d3b607-63c9-4cc0-8ea1-bff4388dc5bd
1
public static void upData(String sql){ String currentPath = System.getProperty("user.dir"); ComJdbc.connection(currentPath + File.separator + "configdb.properties"); int rc = ComJdbc.execUpdate(sql); if(rc != -1) { SuccessFrame sf = new SuccessFrame(); sf.setTitle("Successful !"); sf....
e146f525-8ff4-41e8-a433-f9b791d41678
0
public JComboBox getCbSecteur() { return jComboBoxSecteur; }
ebe83983-f64f-4fba-9281-90739fa1c640
6
private Map<String, Field> getAllInstanceFields(Object object) { Map<String, Field> fields = new HashMap<String, Field>(); Class<? extends Object> c = object.getClass(); while (c != null) { for (Field f : c.getDeclaredFields()) { try { if (!Modifier.isStatic(f.getModifiers()) && !fields.contai...
deca26ab-d5fd-46ea-a9b9-f86f71a9e06d
7
public void rearangeAround(T value) { Node<T> lessTail = null; Node<T> lessRoot = null; Node<T> moreTail = null; Node<T> moreRoot = null; Node<T> node = root; Node<T> prev = null; while (node != null) { Node<T> nextNode = node.next; if (node.value.compareTo(value) != 0) { if (prev == null) {// r...
df591e98-a397-4d64-857d-e767d5ba5f10
0
@After public void tearDown() { }
915f8da5-ded9-48f9-8482-7d3bbf57970d
9
public void moveToPoint(Point a, Point b) { reachedGoal = false; self = a;// new Point(x, y); double distance = a.distance(b); double steps = Math.round(distance / (speedMod * speed)); double deltaY = Math.round((b.getY() - a.getY()) / steps); double deltaX = Math.round((b.getX() - a.getX()) / steps); in...
58e08a0b-89e9-4a43-875a-c3d4f8d04999
3
public LibraryBean getLibrary(int id){ LibraryBean bean = null; try { PreparedStatement statement = connection.prepareStatement(GET_LIBRARY_BY_ID); statement.setString(1, new Integer(id).toString()); ResultSet resultSet = statement.executeQuery(); if(resultSet.next()) bean = readLibrary(result...
5abfeef5-96be-465a-bc3f-8ecf67148c84
3
public void quickLoot() { for (int i = 0; i < inventorySize; i++) { int qty = inventory.getQtyFromSlot(i); if (qty > 0) { int oldQty = qty; String name = inventory.getNameFromSlot(i); int level = inventory.getLevelFromSlot(i); ...
d113eb9d-f0d0-4c15-bd88-9cd03e188086
6
public static boolean playAgain() { Vector<Player> tempList = new Vector<Player>(); boolean playAgain; String temp = ""; for (Player p : playerList) { System.out.printf("%s, you have $%.2f.\n", p.getName(), p.getWallet()); System.out.print("Would you like to play again (yes or no)? "); do { ...
daf80c0b-cc15-4ebe-9081-bfd4e7f9d648
3
public void uniq_words() { try { for(int i=0;i<list.size();i++) writer.write(list.get(i)+"\r\n"); } catch (IOException e) { e.printStackTrace(); } try { writer.close(); } catch (IOException e) { e.printStackTrace(); } }
1098f7f6-1626-49d6-8c87-44a82bda0683
0
public void setName(String name) { this.name = name; }
38db4afb-86b3-4e4c-927c-b775107fb40e
8
public void createNewFile(File f) { if(!f.getName().endsWith(".wip")) { JOptionPane.showMessageDialog(frame, "File must end with \".wip\""); return; } if(f.exists()) { int overwrite = JOptionPane.showConfirmDialog(frame, f.getName() + " already exists. Do you want to overwrite it?", "Overwrite?", JOptio...
25868a25-63b3-43be-82f2-ade5f43ba7ee
3
private void startSever(){ ServerSocket welcomeSocket; Socket connectionSocket; int counter = 0; try { welcomeSocket = new ServerSocket(PORT); console.log("Listening Port " + PORT); while (true) { connectionSocket ...
2f16a309-dabe-47b3-829d-7c5b70c0ee58
6
public void insert(K key, V value) { //Make a new node so we don't need to later RBTreeNode<K, V> insertedNode = new RBTreeNode<K, V>(key, value, Color.RED, null, null); //If root is null, set the new node to root (inserting it as the only pair in the tree) if (root == null) { ...
facfb57c-b006-4643-aa32-e16e76b34764
9
public Perceptron(){ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // ファイルから点を読み込み、配列に格納する。 List<String[]> pointData = FileUtil.getStringsByQuot(inFileAddress); Hyouhonpoint[] hyouhonpoints = new Hyouhonpoint[pointData.size()]; for(int i = 0; i < pointData.size(); i++){ h...
1c86f4e9-6dad-45d3-b567-3df729bfee4f
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 fe...
0796b950-6b03-47c1-9605-918dadcfab21
0
public SevenTally(int diceCount) { diceScoreTracker = new int[diceCount]; }
afabe5a3-5ce5-494c-b4fe-f7bb6ca9c631
4
public Output(HtmlMidNode parent, HtmlAttributeToken[] attrs){ super(parent, attrs); for(HtmlAttributeToken attr:attrs){ String v = attr.getAttrValue(); switch(attr.getAttrName()){ case "for": forr = For.parse(this, v); break; case "form": form = Form.parse(this, v); break; ca...
7f5e939e-1824-47c8-9846-cf3ac44b7bf7
1
public JPanel getNametextInTileChangesMenu() { if (!isInitialized()) { IllegalStateException e = new IllegalStateException("Call init first!"); throw e; } return this.nametextTilePanel; }
469fd39b-d773-4b2b-98c3-19a8535bf39f
9
@SuppressWarnings("rawtypes") @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; MapEntry other = (MapEntry) obj; if (key == null) { if (other.key != null) return false; } else if (!key....
fc529d47-c804-44e1-beb2-baf56c81d5c0
6
@Override public void setStateBasedOffString(String status) { switch(status) { case "FirstRound": state = new FirstRound(); break; case "SecondRound": state = new SecondRound(); break; case "Playing": state = new Playing(); break; case "Discarding": state = new Discarding(); break;...
462792b8-d5da-4a2a-83c4-170a261582e0
9
private boolean _jspx_meth_html_form_0(javax.servlet.jsp.tagext.JspTag _jspx_th_html_html_0, PageContext _jspx_page_context) throws Throwable { PageContext pageContext = _jspx_page_context; JspWriter out = _jspx_page_context.getOut(); // html:form org.apache.struts.taglib.html.FormTag _jspx_t...
9acc017a-5b0e-4dd9-9fd9-71e9c0418327
4
@Override public Event next() { try { input = br.readLine(); } catch (IOException e1) { } if(input == null || input.equals("")) { return new UserHomeState(as, name); } else{ try{ as.bid(name, Integer.parseInt(input)); } catch(Exception e){ // System.out.println("somet...
b26f3dfd-d825-42c5-aeda-415877e13bd7
2
private void drawFirstSelectedCase(Graphics g) { if (selectedI != -1 && selectedJ != -1) { g.setColor(Color.ORANGE); g.fillRect(selectedI * caseWidth + 1, selectedJ * caseHeight + 1, caseWidth - 1, caseHeight - 1); } }
4c61547d-9a47-467e-b4b7-1737e231393e
4
public void run() { String msg = this.read(); if(msg.matches("^NEW\\s([a-zA-Z0-9]+)$")){ /* Create User */ String name = msg.substring(4); String host = socket.getInetAddress().toString().substring(1); this.user = new User(name, host); ...
cc03f7d7-820e-4e63-bd5f-c52ea8a54f3c
6
public static void main(String[] args) { String[] liste_nouveaux_sujets = null; if ( args.length > 0 ) { liste_nouveaux_sujets = args; } if ( liste_nouveaux_sujets == null ) { System.out.println("Usage : "+ "FounisseurDeSujet" + " <new_channel_name> [<new_channel_name>...
c678cfbd-8deb-4595-bf81-591b93ffae4c
1
void shiftOff(){ try{ Robot r = new Robot(); r.keyRelease(KeyEvent.VK_SHIFT); }catch(Exception e){ System.out.println(e); } jButton6.setBackground(Color.white); jButton6.setForeground(Color.black); isShift = false; }
d7a3756c-42a8-4f8f-bc8f-e5416bad6401
1
public Activite2012_2014(JSONObject json) throws Exception { erreurs = new ArrayList<>(); description = json.getString("description"); categorie = json.getString("categorie"); heures = json.getInt("heures"); dateString = json.getString("date"); try { date ...
89393e31-e66d-496f-a1a2-6da8fa404bdc
3
public static String diff(double[] o, double[] p) { String status = "ok."; if (o.length != p.length) { status = "o.length != p.length"; } else { for (int i = 0; i < o.length; i++) { if (o[i] != p[i]) { status += "error"; ...
e95b413a-ba97-47cc-8a99-16c2ded3d750
6
@Override protected final XYDataset createDataset() { DefaultXYDataset dataset = new DefaultXYDataset(); //Map the name of the player to his energy HashMap<String, double[]> map = new HashMap<>(); Turn t = _gameHistory.getCurrentTurn(); int turnCount = _gameHistory.count(); ...
c3e79907-d3df-46ec-99dc-f633adeee8a8
2
private void refreshList() { for (IDrawable d: tmpAddList) { drawList.add(d); } for (IDrawable d: tmpRemoveList) { drawList.remove(d); } tmpAddList = new ArrayList<IDrawable>(); tmpRemoveList = new ArrayList<IDrawable>(); Collections.sort(drawList, new DrawComparator()); }
6a6e4ac8-de6b-4e6f-9e97-06adabe8556a
7
public TileLayer(BufferedReader reader, String tileSet, Point2D offset) { String line; int y = 0; try { while((line = reader.readLine()) != null && !line.contains("/layer")) { if(!line.contains("data")) { String[] temp = line.split(","); for(int x = 0; x<temp.length; x++) { if(Integer.parse...
f355d1b8-2528-44a0-94ac-ef14526ce502
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...
53cc401f-d02b-4dd6-8399-a376558f8e03
8
public int countNumberOfMerges(int n){ int count = 0; for (int i = 0; i < 4; i++) { for (int j = 1; j < 3; j++) { if (this.board.get(i, j) == n) { if (this.board.get(i, j) == this.board.get(i, j + 1)) { count++; j++; } } } } for (int j = 0; j < 4; j++) { for (int i = 1; ...
f97c022a-5ada-4d50-a918-20e2ecc5223f
0
public void collideVertical() { setVelocityY(0); }
7aaffffc-3ad4-4ba4-8d00-1c7137f42ff4
7
void radf4(final int ido, final int l1, final float in[], final int in_off, final float out[], final int out_off, final int offset) { final float hsqt2 = 0.707106781186547572737310929369414225f; int i, ic; float ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4, w1r, w1i, w2r,...
e304a61a-246a-4049-b264-18eb21ee2cbc
5
public boolean containsKey(String var) { for (String line : this.lines) { if (line.trim().length() == 0) { continue; } if (line.charAt(0) == '#') { continue; } if (line.contains("=")) { int delimPositio...
a056e5b1-5bf0-4997-98b0-534aa9e18256
4
public AabbToAabbParameters getPointToPlaneParameters(AABB aabbscnd, MovingObject mo){ AABB aabbfst = mo.getPredictedAABB(); Vec2 expandedExtent = aabbscnd.getHalfExtent().addTo(aabbfst.getHalfExtent()); Vec2 expandedCenter = aabbscnd.getCenter(); Vec2 centersDifference = expandedC...
9c1b7406-ee0d-4f5d-b2f7-bcacf2115ef7
8
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(this.ID())!=null) { mob.tell(target,null,null,L("<S-NAME> <S-IS...
37b9dac3-6cab-4383-89e4-4b4fe696583a
0
public static GlobalTimes getInstance() { return instance; }
dbd8e1e3-08dd-4c2e-b5df-73fac01ac524
2
private void initBoard() { JPanel bottomLabel = new JPanel(new GridLayout(1, 8)); for (int i = 0; i < 8; i++) { bottomLabel.add(new JLabel("" + (char) ('a' + i), SwingConstants.CENTER)); } JPanel sideLabel = new JPanel(new GridLayout(8, 1)); for (i...
12dba984-41e1-4791-b2ff-b092d1e20c45
7
public void setMetricType (SelectedTag d) { if (d.getTags() == TAGS_SELECTION) { m_metricType = d.getSelectedTag().getID(); } if (m_significanceLevel != -1 && m_metricType != CONFIDENCE) { m_metricType = CONFIDENCE; } if (m_metricType == CONFIDENCE) { setMinMetric(0.9); ...
368d808d-d244-4eae-aa42-7c8affb73ef3
7
@Override public void renderTileLayer(TileLayer tilelayer, TileDrawTarget target, int originX, int originY, float alpha) { int tilewidth = map.getTileWidth(); int tileheight = map.getTileHeight(); int width = map.getWidth(); int height = map.getHeight(); // The origin point of every tile to-be-drawn is...
3d629d85-221e-46cb-97f0-0d9d35c583d5
5
public void asignarColumnaLetrasB(String nombreRespuesta, int numeroRespuesta){ switch(numeroRespuesta){ case 0: _jlbl6.setText(nombreRespuesta); break; case 1: _jlbl7.setText(nombreRespuesta); break; case 2: _jlbl8.setText(nombreRespuesta); ...
a5aa7dcd-1148-4192-904b-dd40881d696c
2
public void addItemsToCombobox(ArrayList<StockItem> list) { comboboxItems.clear(); String item = ""; if (driver.getStockDB().getStockList().size() > 0) { for (StockItem stockItem : list) { item = stockItem.getProduct().getProductName(); comboboxItems.add(item); } } else { comboBox.removeAllIt...
c6087a9a-57bf-4c9b-939b-28980bcbf24a
0
public Object getField2() { return field2; }
5cd88a06-4447-4582-827e-432a42828cc9
7
@Override public void unInvoke() { int drunkness=this.drunkness; MOB mob=null; if(affected instanceof MOB) { mob=(MOB)affected; if((CMLib.dice().rollPercentage()<(drunkness*10))&&(!((MOB)affected).isMonster())) { final Ability A=CMClass.getAbility("Disease_Migraines"); if(A!=null) A.invo...
5c27c2a8-fe1a-4ec0-b3f0-2ffc0c892d04
7
public Object clone() { ADTree clone = new ADTree(); if (m_root != null) { // check for initialization first clone.m_root = (PredictionNode) m_root.clone(); // deep copy the tree clone.m_trainInstances = new Instances(m_trainInstances); // copy training instances // deep copy the...
2ded3a55-5c64-44a6-8f46-7d454aec7ecf
4
@Override public void startElement(String uri, String localName, String qName, Attributes attr) { switch (qName.toLowerCase().toString()) { case "bd": addDb(attr); break; case "tabela": addTable(attr); break; ...
6f443213-e1bd-4684-8f01-589211082fab
6
public static HashMap<String, String> readSrgFile() { File srgFile = new File("notch-srg.srg"); if (!srgFile.exists()) { return null; } HashMap<String, String> mcClassMap = new HashMap<String, String>(); try { BufferedReader reader = n...
564f27b3-f0d1-4f85-8c42-34c49e92e29f
0
@Override public void mousePressed(MouseEvent e) {}
cb7a60c1-b636-4506-abcc-83856f3f9a50
4
public void doPost (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { String output = "You have successfully signed up"; User user; // See if the user exists in the database try { int a = Integer.parseInt(req.getParameter("age")); boolean own = true; // Create...
2a59f1f2-dda1-48a2-a0bc-2135eaa12612
3
@Override public void updateGameState(eGameState state) { switch (state) { case abort: JOptionPane.showMessageDialog(this.getParent(), "Oponent left the current game"); break; case won: ImageIcon winIcon = new ImageIcon(PlayingWindow.cl...
ca991711-e687-4755-8e81-2e3055cd9ec9
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Transducer that = (Transducer) o; if (lowerRangeLimit != that.lowerRangeLimit) return false; if (type != that.type) return false; if (u...
39f127a8-7c6a-47ff-ac27-107968e78aa2
0
public void setSignatureMethod(SignatureMethodType value) { this.signatureMethod = value; }
5eb0817e-f775-447b-b5fc-4df13ba4bd92
9
public static String translateValue(String value,String locale) throws Exception { if(debug) { System.out.println("TranslateValue:"+value); if(value.equals("Password")) return "密码"; else if(value.equals("OK")) return "确认"; else if(value.equals("okButton")) return "确认按钮"; else if(value...
cb5a1197-5f74-4a09-9caa-a67f5ecb8c95
5
public ListNode deleteDuplicates(ListNode head) { if (head == null) return head; if (head.next == null) return head; if (head.val == head.next.val) { int val = head.val; while (head != null && head.val == val) head = head.next; return deleteDuplicates(head); } h...
e19b270f-8aa5-4707-a802-bd1236b5f630
9
private void addAnnotations(AnnotationTypeDoc annotationDoc, LinkInfoImpl linkInfo, ContentBuilder annotation, AnnotationDesc.ElementValuePair[] pairs, int indent, boolean linkBreak) { linkInfo.label = new StringContent("@" + annotationDoc.name()); annotation.addContent(getLink(l...
f0fe9ded-12c0-4593-8aad-9b56a7b6d7ed
7
public void init() { for (int i = 0; i < actions.size(); i++) { TimedAction action = actions.get(i); if (action.from == 0 && action.getNextAction().type == Type.HRAM && action.getNextAction().position == GbConstants.LCDC) { if (initialLcdc != -1) throw new RuntimeException("f...
1114f6f0-b4c7-4552-81bb-33ea84503bdf
4
public static void PRM(Partition p) { double hyperperiod = p.getHyperPeriod() * 1.0; Logger log = new Logger("plot1"); for (double i = 1.0; i <= hyperperiod; i += 1.0) { double per = 0.01; System.out.println(p.getPartitionDBF(p.getHyperPeriod())); System.out.println(getPRMsbf(p.getHyperPeriod(), i * p...
1e43b6ec-db94-484e-8045-10dfe0d2b3c0
3
public void getCredential() throws IOException, GeneralSecurityException { LOG.debug("Generating MyProxyLogon object.."); MyProxyLogon myProxyLogon = getConnection(); LOG.debug("Retrieving credentials from the MyProxy server.."); try{ myProxyLogon.getCredentials(); }catch(SSLHandshakeException e){ //Av...
8a907576-05f9-41cb-8973-dde76c78ec0a
5
public static Map<String,String> getPluginFileMap() { Map<String,String> pluginList = new HashMap<String,String>(); try { File jarLocation = new File(ControllerEngine.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath()); String parentDirName = jarLocation.getParent(); // to get the...
390139b4-4e75-4388-82ae-d1f362ab4f4e
3
public List<T> pesquisarComCondicaoComAlias(String alias, String propriedade, List<LogicalExpression> listExpress, String ordem) throws ValidacaoException { List<T> lista = new ArrayList<T>(); try { Criteria criteria = session.createCriteria(classe); criteria.createAlias(propried...
249f0bcd-0e1d-4d48-a934-61006e73642d
6
public StringBuffer printInterfaces(Class<?> cls, StringBuffer message){ if(cls.getInterfaces() != null){ Class[] iArray = cls.getInterfaces(); for(int i = 0; i < iArray.length; i++){ if(iArray[0] != null && i == 0){ message.append(" implements "); } message.append(iArray[i].getSimpleName()...
2e279e76-3866-4294-a65d-e3e247196a7a
4
@Override public Solution solve(Bean input) { // TODO Auto-generated method stub Solution solution = new Solution(); ArrayList<Summit<String>> summits = new ArrayList<Summit<String>>(); DirectedGraph dgraph = new DirectedGraph(); //This loops creates the summits based on the number of summit there are ...
7f8f3030-7890-4928-b6aa-79bbcfd3c12f
6
public void testReopenOnCommit() throws Throwable { Directory dir = new MockRAMDirectory(); IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), new KeepAllCommits(), IndexWriter.MaxFieldLength.UNLIMITED); for(int i=0;i<4;i++) { Document doc = new Document(); doc.add(new Field("id...
81d65254-067b-4e35-9662-d6702928844d
6
public double[][] readFile(String pathname) throws Exception { double[][] values = new double[Card.VALUE.values().length][Card.VALUE.values().length]; for(int i = 0; i < values.length; i++) { for (int j = 0; j < values[i].length; j++) { values[i][j] = 0; } } File file = new File(pathname); FileRe...
caaf353e-9cec-42fa-930f-9786fe3bff22
5
public BufferedImage doScreenShot() { BufferedImage bfImage = null; try { // 2. get Input and Output streams byte[] doScreenShot = ClientMessageEncoder.encodeDoScreenShot(); out.write(doScreenShot); out.flush(); // System.out.println("client executes command: screen shot"); //Read the message he...
b2e085dc-3354-404d-b1aa-2e65c23718b1
5
private int checkInputForTextField(JTextField toTest, int maxNumber){ if(!toTest.getText().equals("")){ int result = 0; String text = toTest.getText(); boolean takeAwayLast = false; if(text.length()> 2) text = text.substring(0, 2); ...
f34ce93b-57c5-4ff5-a52c-708ea20c6511
2
@Override public T set(int index, T element) { if (index <= size()) { MyList<T> node = first; for(int i = 1; i < index; i++) { node = node.right; } T temp = node.value; node.value = element; return temp; } return null; }
3099ca04-52d3-4b70-812c-0b29b052faca
5
public static void main(String[] args) throws IOException { // TODO code application logic here BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int choice = 0; database = new PwdDB(); Banner(); System.out.print("\nDATABASE FILENAME [even new one...
b9dfcf78-0ae6-401a-8b6f-934790d71593
8
public static HashMap<String, HashSet<Integer>> getFileLineMap( ) throws Exception { System.out.println("Reading annotations..."); HashMap<String, HashSet<Integer>> map = new HashMap<String, HashSet<Integer>>(); BufferedReader reader = new BufferedReader(new FileReader( new File(ConfigReader.getCREOrtho...
b58ebcf0-3532-4c39-ae3b-ebb36b20808d
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if((!mob.isInCombat())||(mob.rangeToTarget()<1)) { mob.tell(L("You really should be in ranged combat to cast this.")); return false; } for(int i=0;i<mob.location().numItems();i++) { fi...
d29715ac-9d7b-46bd-85c2-51961167f92f
0
public int getQuantite() { return quantite; }
11243957-2d28-456c-90c8-36d9389af18c
3
@Override public void collideWith(Element e) { if (e instanceof Player) { Player player = (Player) e; for (int i = player.getRemainingActions(); i > 1; i--) player.decrementAction(); } else if (e instanceof IdentityDisc) ((IdentityDisc) e).decrementLifetime(); }
65f72323-4e82-4e2c-9d74-ea4ad4183297
4
public boolean getColison() { colBox.x += vec.x; colBox.y += vec.y; colBox.setBounds((int) (colBox.x), (int) (colBox.y), colBox.width, colBox.height); for (int i = 0; i < world.tiles.length; i++) { for (int j = 0; j < world.tiles[0].length; j++) { if (colBox.intersects(world.tiles[i][j]) && world.tiles[i...
c97b96b1-8475-4978-a212-fcee4877dda2
7
@Override protected void runImpl() throws ExecutionFailedException { List<List<Long>> features = new ArrayList<List<Long>>(); for (File featuresFile : featuresFiles.get()) { try { features.add(readVector(featuresFile)); } catch (IOException e) { ...
6571185c-2d1b-484f-aa54-9f0fd48ff9d3
6
public boolean pickAndExecuteAnAction() { if(!paused) { synchronized(openChecks) { for(Check c : openChecks) if(c.state == CheckState.Created) { ComputeCheck(c); return true; } } synchronized(openChecks) { for(Check c : openChecks) if(c.state == CheckState.Paying) { M...
721e41df-7a59-4c45-b71d-fe2c82667b36
0
public void eleShift() { }
5acce865-8bde-4570-bb2f-b0b2c5efce7d
7
public int look(int bits){ int ret; int m=mask[bits]; bits+=endbit; if(endbyte+4>=storage){ if(endbyte+(bits-1)/8>=storage) return (-1); } ret=((buffer[ptr])&0xff)>>>endbit; if(bits>8){ ret|=((buffer[ptr+1])&0xff)<<(8-endbit); if(bits>16){ ret|=((buffer[p...
83cff694-af28-4089-a284-3d0bdc6cf247
1
public boolean equals(Object o) { Hexpos other = (Hexpos) o; return ((row == other.row) && (col == other.col)); }
4ba1ade9-6980-469b-bcfc-0610f8238455
8
public void highlightBloc(Point bloc) { // RICORDARSI DI METTERE UNA COLORAZIONE DIVERSA NEL CASO // DI UNA CELLA CON VALORE ALTERNATIVO! Point baseCell = new Point(); baseCell.x = (m_t - 1) * bloc.x + 1; baseCell.y = (m_t - 1) * bloc.y + 1; int c, r; this.clearHighlightColors(); ...
d1f05638-4d52-428e-bbf3-106b7480b6f4
2
@Override public void main() { cleanOutput(); List<OldMachine> machines = new ArrayList<OldMachine>(); machines.add(new CoffeeMachine()); machines.add(new Microwave()); machines.add(new Adapter()); for (OldMachine machine : machines) { machine.launch(); } addOutput("all machines are working...
52dc42d1-b8a1-479a-b3be-36abac2badcf
3
public static void loadMessagesFile() { // Create if missing File file = new File(PlayerChat.plugin.getDataFolder(), "messages.yml"); try { if (file.createNewFile()) { Messenger.info("messages.yml created."); YamlConfiguration yaml = Msg.toFile(); ...