method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f79f4242-946e-46a6-a471-7e726b635231
9
@Test (timeout = 1000) public void testLeave() { //start server processor ServerProcess processor = new ServerProcess(); processor.start(); try { //writer and reader for file PrintWriter writer = new PrintWriter(new FileWriter("src/server/test.txt", false)); BufferedReader in = new BufferedReader(n...
fd26c8dd-1b74-432e-ae07-30a7a61f7c54
7
protected void loadRegulation() { String name = "Regulation"; String fileName = dirName + name + ".txt"; if (verbose) Timer.showStdErr("Loading " + name + " from '" + fileName + "'"); int i = 1; for (String line : Gpr.readFile(fileName).split("\n")) { // Parse line String rec[] = line.split("\t"); S...
e40fc643-cd4d-4765-8603-42b41d87d193
8
public byte[] processProxyMessage( int messageReference, boolean messageIsRequest, String remoteHost, int remotePort, boolean serviceIsHttps, String httpMethod, String url, String resourceType, String statusCode,...
291cc57e-0cda-495a-9c91-25e6ffad0166
1
private String getPagina(URL url) { StringWriter writer = new StringWriter(); try {IOUtils.copy(url.openStream(), writer);} catch (IOException ex) {Logger.getLogger(WebCrawler.class.getName()).log(Level.SEVERE, null, ex);} String contenidoString = writer.toString(); retu...
8ebfe739-afe2-49ba-839f-f49a03bb4f9f
4
public boolean equals(Object object) { try { PDATransition t = (PDATransition) object; return super.equals(object) && myInputToRead.equals(t.myInputToRead) && myStringToPop.equals(t.myStringToPop) && myStringToPush.equals(t.myStringToPush); } catch (ClassCastException e) { return false; } ...
5c945338-de4f-4531-b64e-5dfd5f0a71e9
7
@Override protected void onStarted() { GlobalUtil.threadExecutor().execute(new Runnable() { @Override public void run() { FileReceivingController receiver; int percent; int speed; while (isRunning()) { for (CoreFileInfo file : receivingFiles.keySet()) { if (file != null) { rec...
6f34861f-1cc2-4e3c-9c19-3ee174ecbe1e
6
public synchronized void attack(Attack attack){ /* Funcion de ataqueProvisional*/ attackPool.add(attack); Actor attacker = (attack.caster); for(Map.Entry actor : actores.entrySet()) { Actor a = (Actor)actor.getValue(); // Con este if evitamos el fuego ...
e27fbf59-3dc2-4eb2-bd6b-0905bf21ea84
6
public String getIP(){ if(HOSTIP != null){ return HOSTIP; } else { try { for ( final Enumeration< NetworkInterface > interfaces = NetworkInterface.getNetworkInterfaces( ); interfaces.h...
21d6ddfd-7853-4a4f-9fc2-404824e5c0f0
9
void createHMlut(int [] kernel, int [] lut){ int i, j, match, toMatch; for(i=0;i<512;i++) lut[i]=1; toMatch=0; for(j=0;j<9;j++){ if (kernel[j]!=2) toMatch++; } //System.out.println("Debug: to match: "+toMatch); //make lut for(i=0;i<512;i++){ match=0; for(j=0;j<9;j++){ if (kernel[j]...
78af7e93-9acb-4c65-bc82-99c310ef760d
9
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); Connection con=(Connection)Konekcija.konekcija(); ...
8d3dc576-40e7-4689-b12d-96100f40e94d
7
private void clearNearCache(Block block) { String selfMeta = null; String neighborMeta = null; if (block.getType() == Material.WALL_SIGN) { selfMeta = FILTER_INVENTORY; neighborMeta = HopperFilter.MATCHERS; } else if (block.getType() == Material.HOPPER) { ...
74c65b2c-2baa-4643-8e9c-aa3618c24d28
3
@Override public void paintComponent(Graphics g) { super.paintComponent(g); // Draws the background paintBackground(g); // Creates or destroys the triple buffer as needed if (tripleBuffered) { checkTripleBuffer(); } else if (tripleBuffer != null) { destroyTripleBuffer(); } ...
ad78c452-1824-402a-b54e-c9fefd9380f4
5
public PDFObject dereference() throws IOException { if (type == INDIRECT) { PDFObject obj = null; if (cache != null) { obj = (PDFObject) cache.get(); } if (obj == null || obj.value == null) { if (owner == null) { ...
8cf41f68-be59-41ed-ad53-be8292a0b2d4
1
public String bestQuestion() { if(questionStats.size() > 0) { QuestionStatistic max = Collections.max(questionStats); return max.questionText + ", " + max.correctAnswers + " times."; } return "no statistics found!"; }
bda443a4-43f4-4be1-9d19-607f617b6031
0
public void setRightBranch(ClusterNode rightBranch) { this.rightBranch = rightBranch; }
05e1ec5c-360f-47da-990e-9f3e8bba5651
6
public ListNode getIntersectionNode(ListNode headA, ListNode headB) { // find length of A int alen = findLength(headA); if (alen == 0) return null; // find length of B int blen = findLength(headB); if (blen == 0) return null; // move the difference ListN...
2aea5450-4b7f-4001-bd19-31403fad4d6c
6
public static double deltaAngle(double angle1, double angle2) { while (angle2 <= -180) angle2 += 360; while (angle2 > 180) angle2 -= 360; while (angle1 <= -180) angle1 += 360; while (angle1 > 180) angle1 -= 360; double r = angle2 - angle1; return r + ((r > 180) ? -360 : (r < -180) ? 360 : 0);...
675695b7-f330-47b7-bcc9-c3aeaa317e7a
1
@Test public void testGetSingleTransactionRecordById() { CardPaymentRequest paymentRequest = getCreditCardPaymentRequest( getRandomOrderId("TEST"), "90.00"); try { PaymentResponse payment = beanstream.payments().makePayment(paymentRequest); Assert.assertNotNull("Payment w...
426855a6-c86a-47c3-8364-1c3f317200d1
1
public List<QuadTree> getBottomNeighbors() { QuadTree sibling = this.getBottomSibling(); if ( sibling == null ) return new ArrayList<QuadTree>(); return sibling.getTopChildren(); }
46e166e3-216b-400f-8265-df0277eb6a24
9
public Quiz buildQuiz(Quiz q, TreeMap<SubjectType, Integer> subjects) { Random random = new Random(); for(SubjectType s : subjects.keySet()) { int[] selections = new int[subjects.get(s)]; for(int i = 0; i < selections.length; i++) selections[i] = -1; ...
47e91273-2df1-4720-b547-4d556e2f3678
1
@Override public void cleanUp() { stopSound(); if (source != null) { source.projectileReturned(); } }
87800687-76c4-43cf-a8ed-32900f886c05
3
public void addOneToBasket(int productId) { boolean isAdded; if (basket.containsKey(productId)) { isAdded = basket.get(productId).addOneProduct(); } else { ProductInBasket prod = new ProductInBasket(); ProductDAO dao = DAOFactory.getInstance().getProductDAO(); isAdded = prod.setProduct(dao.findProduct...
d74f40a0-3237-4399-82fc-7df035eccc1c
4
private void light(int x, int y) { int key = genKey(x, y); if (actorHashMap.containsKey(key)) { currentSenses.putActor(key, actorHashMap.get(key)); } if (tileHashMap.containsKey(key)) { currentSenses.putTile(key, tileHashMap.get(key)); } if (player...
e1a2c640-d8c0-46e5-91c6-4db228ff141b
7
protected MOB getCharmer() { if(charmer!=null) return charmer; if((invoker!=null)&&(invoker!=affected)) charmer=invoker; else if((text().length()>0)&&(affected instanceof MOB)) { final Room R=((MOB)affected).location(); if(R!=null) charmer=R.fetchInhabitant(text()); } if(charmer==null) ...
f32989d7-2db4-470f-abf1-9c0a4a112cb5
7
public static Digraph rootedInDAG(int V, int E) { if (E > (long) V * (V - 1) / 2) throw new IllegalArgumentException("Too many edges"); if (E < V - 1) throw new IllegalArgumentException("Too few edges"); Digraph G = new Digraph(V); SET<Edge> set = new SET<Edge>(); // fix a topological order int[] ver...
1a26f5ea-871a-41be-912e-539fcef8cf24
0
public boolean showAddDialog() { this.setTitle("ҪӵѧϢ"); canceled = false; this.getRootPane().setDefaultButton(button); this.setVisible(true); return !canceled; }
f796edd8-4876-45cf-b93a-f183dfd6e748
9
public ViewerMain(final Book book) { this.book = book; pageId = 7; loadPage(pageId); setLayout(new BorderLayout()); add(new JLabel() { private static final long serialVersionUID = 1L; @Override public Dimension getPreferredSize() { return new Dimension(1500, 600); } @Override public v...
76e05aae-e013-4cf1-bcb5-44ca72d1e8cc
3
public SourceFixe(String arg) { informationGeneree = new Information<Boolean>(); informationEmise = informationGeneree; //Parcourir l'argument saisi par l'utilisateur for (int i = 0; i < arg.length(); i++) { //Si le caractere en cours est un 0 if (arg.charAt(i) == '0') //Ajouter false a la liste inf...
d221f650-48e2-4dc2-9c8e-991d17aa4528
6
public void saveShieldsToFile() { if (plugin.getListener() == null || plugin.getListener().getShields() == null) { return; } if (!shieldsFile.exists()) { try { shieldsFile.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } try { shieldsDB.save(shieldsFile); ...
81a54272-78f7-49a1-a06d-f1d689c45c00
5
public static void main(String args[]) throws InterruptedException { int i = 1; ThreadExecutor executor = new ThreadExecutor(); long startTime = System.currentTimeMillis(); while ((System.currentTimeMillis() - startTime) < 1 * 60 * 1000) { HttpAsyncClientImpl httpImpl = new HttpAsyncClientImpl(i); try { ...
d9639414-61e8-43e6-9bf8-b6fd383a4fca
4
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; for (int i = characters.size() - 1; i > -1; i--) { characters.get(i).paintCharacter(g2); } for (int i = projectiles.size() - 1; i > -1; i--) { projectiles.get(i).paintProjectile(g2); } for (int i = 0; i < blocks.size(); i++) { ...
c444dce8-ab59-47f4-a118-028dfd7e37c6
9
int insertKeyRehash(long val, int index, int hash, byte state) { // compute the double hash final int length = _set.length; int probe = 1 + (hash % (length - 2)); final int loopIndex = index; int firstRemoved = -1; /** * Look u...
f4d1bdcb-7834-4026-8c5b-28caff73ceb6
6
public LoperFrame(final Sponsorloop loop) { this.loop = loop; sf = null; setSize(200, 200); lab1 = new JLabel("Lopers", JLabel.CENTER); lab2 = new JLabel(); updateAantal(); listModel = new DefaultListModel(); list = new JList(listModel); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); d...
61386d16-eaeb-469c-9581-02c6bd6fd3ee
3
public int split(int i, int j) throws Exception { if (i > j) throw new Exception("Invalid Matrix sequence"); if (i > n || j > n) throw new Exception("Non existent matrix specified"); return split[i][j]; }
94e85e32-1aca-4848-bba3-2e34c72e884d
5
public int getBlue(int row, int col) { if (row >=0 && row < rows && col >= 0 && col < columns && grid[row][col] != null) return grid[row][col].getBlue(); else return defaultColor.getBlue(); }
8bfece78-8fad-45fe-98f4-e7a48ae61739
0
public ROPacketTransmitter getPacketTransmitter() { return packetTransmitter; }
ded69b7b-c052-4ce0-8adb-b5488885ba4d
8
public String isOkay(String e, boolean anyOfSuit){ int h = convert(e); if (h < 0 || h > _hand.size()-1){return "Illegal move. Please select a card in your hand.";} Card d = _hand.get(h); String retStr = ""; if ( isLeading == true && isBroken == false && d.getSuit() == 0) {retStr ...
4526d073-2a4b-4a8f-b1ef-cb29b8cf44fb
0
public double modulo(){ return sqrt(x*x + y*y + z*z); }
a7a8c55b-4500-484c-9891-c4a630dec62b
0
public void setLHS(String lhs) { myLHS = lhs; }
6d677058-62d0-41a4-afdc-1f7744876177
4
@Override public boolean executeValidation(CreditCard creditCard) { log.fine("Starting credit card validation"); boolean isValid = true; isValid = validateCardNumber(creditCard.getCardNumber()) && isValid; // Only check the type if the number was valid, since the type depends // on it if (isValid) { i...
27be6256-73fc-41e7-a4ff-919d568a345e
8
@Override public void onAnalog(String name, float isPressed, float tpf) { float pos = isPressed / tpf; if (name.equals("Accelerate Vehicle")){ if (car != null) { car.throttlePressed(pos); } } if (name.equals("Brake Ve...
06ba3e1d-883d-4406-99b4-c1b9ea318d26
6
public String changeKeyboardLayout() { String previous = pref.getKeyboardLayout(); String[] layouts = pref.getExistingKeyboardLayouts(); // TODO: pass current item name ChooseFromExisting dialog = new ChooseFromExisting(layouts); dialog.dispose(); String newLayout = dia...
79fdae00-c728-41ec-8bec-7df8c9275c58
9
public Element handle(FreeColServer server, Player player, Connection connection) { ServerPlayer serverPlayer = server.getPlayer(connection); Unit unit; try { unit = player.getFreeColGameObject(unitId, Unit.class); } catch (Exception e) { ...
ee821b50-8984-4d11-8b29-a1d4e898dce3
9
public MyGraph computeCover4() { MyGraph cover = new MyGraph(this); ArrayList<MyNode> hightDegreeNodes = new ArrayList<MyNode>(); for (MyNode n : cover.getNodes()) { if (n.getDegree() > 2) { hightDegreeNodes.add(n); } } for (MyNode node : hightDegreeNodes) { for (MyEdge edge : cover.outEdges(node...
833313a6-c021-4f2b-88f5-812d393f2105
7
@Test public void testGetSubset() { DoubleIntervalMap<double[]> map = new DoubleIntervalMap<double[]>(); StupidDoubleIntervalMap stupid = new StupidDoubleIntervalMap(); RandomIter iter = new RandomIter( getSeed(), 0, 1000 ); final int testCount = 2000; final int subtestCount...
1a44cba7-cd74-4d39-b6c6-afc99d6b5f9f
7
@Deprecated private Mesh calculateTesselator() { ArrayList<Vector3f> vertices = new ArrayList<Vector3f>(); ArrayList<Integer> indices = new ArrayList<Integer>(); int z = -fraction / 2; int x; while ( z <= fraction / 2 ) { x = -fraction / 2; while ( x <= fraction / 2 ) { float rand1 = MathHel...
708156b1-65cd-4c9e-b4d1-31b673fb1d8f
5
public Writer write(Writer writer) throws JSONException { try { boolean b = false; int len = length(); writer.write('['); for (int i = 0; i < len; i += 1) { if (b) { writer.write(','); } Obj...
cce37ab0-ce69-4ca9-9edd-2ae659e8a8f3
4
public void compareJvmCost() { String rMapperFile = "realMapper.txt"; String rReducerFile = "realReducer.txt"; String realJvmCostDir = bigBaseDir + bigJobName + "/RealJvmCost/"; String estiJvmCostDir = compBaseDir + compJobName + "/estimatedDM/"; String compJvmCostDir = compBaseDir + compJobName + "/compJvmC...
51a5d6e0-dc6c-4bac-89af-9ddcd63a0cbc
5
protected short parse_config_param(final String param_title, final String param_content) { short ret = MsgDumperCmnDef.MSG_DUMPER_SUCCESS; boolean found = false; for (int index = 0 ; index < title_len ; index++) { if (param_title.indexOf(title[index]) == 0) { switch(index) { case 0: serv...
9ba7d05c-0c3d-4459-83e2-46f86d58bba8
9
public static boolean CheckUserProfile(Map<String, String> ProfileData) throws SQLException { boolean success = false; boolean found = false; for (int j = 0; j < GlobalData.UserProfileRecs.size(); j++) { UserProfileRec rec = GlobalData.UserProfileRecs.get(j); if (rec.username.equalsIgnoreCase(ProfileData...
92075111-7d7f-4019-8ec4-ec9b78c8effb
5
public void update(String player, String element, String value) { Node players = doc.getFirstChild(); NodeList playerNode = null; NodeList list = players.getChildNodes(); for(int i = 0; i < list.getLength(); i++) { Node node = list.item(i); if(player.equals(node.getNodeName())) playerNode = nod...
ce65815a-9894-4de8-8efe-c7e8e9b37e81
0
public void keyReleased(KeyEvent e) { }
9db2bbfb-0dd0-41d2-857f-ab32e3f042ae
7
Point3f getMax() { if (max == null) max = new Point3f(); if (list.isEmpty()) { max.set(0, 0, 0); return max; } Cuboid c = getCuboid(0); max.x = c.getMaxX(); max.y = c.getMaxY(); max.z = c.getMaxZ(); synchronized (list) { int n = count(); if (n > 1) { for (int i = 1; i < n; i++) { ...
ea27a42e-56e7-434a-a646-08ca380040b0
7
private void constructBoard() { for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (chessGame.gameState[i][j].getColor() != ChessPiece.COLOR_RED && chessGame.gameState[i][j].getColor() != ChessPiece.COLOR_BLUE) { if (j % 2 == 0) { if (i % 2 == 0) { chessGame.gameState[i][j] = new ...
bb344302-5fc3-414a-bd88-f02177f4b7ea
9
protected boolean isAttribute(ResTable_Map map) { return map.name == ATTR_TYPE || map.name == ATTR_MIN || map.name == ATTR_MAX || map.name == ATTR_L10N || map.name == ATTR_OTHER || map.name == ATTR_ZERO || map.name == ATTR_ONE || map.name == ATTR_TWO || map.name == ATTR_FEW || map....
5f64c933-56d7-4d6b-98ba-2240fa284bd5
2
private String saveTmpFile(ByteBuffer b, int offset, int len) { String path = ""; if (len > 0) { FileOutputStream fileOutputStream = null; try { TempFile tempFile = tempFileManager.createTempFile(); ByteBuffer src = b.duplic...
79fa2b1c-66a6-4810-a7f0-a88f3a50db14
8
public Tffst toSingleInputLabelTransitions() { Tffst simpleTffst = new Tffst(); HashMap<State, State> m = new HashMap<State, State>(); State last; Set<State> states = getStates(); for (State s : states) { System.out.println(s.toString()); if (m.get(s) == null) { last = new State(); m.put(s, la...
d6a292ca-b8b3-4ed2-b4f7-e215eb35bc9c
8
public static Map<String, Object> formatResponseAsMap(InputStream stream) throws Exception { Map<String, Object> mapResponse = new LinkedHashMap<String, Object>(); try { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = docFactory.newDocumentBuilder(); Docu...
82fe7254-092b-44c5-9e8d-2439fa2547bf
0
public void setUpcomingEventsCount(int upcomingEventsCount) { this.upcomingEventsCount = upcomingEventsCount; }
f0a6d131-a82c-4a0f-9649-3dd6b8bb9d79
9
private static String[] getSubjectAlts( final X509Certificate cert, final String hostname) { int subjectType; if (isIPAddress(hostname)) { subjectType = 7; } else { subjectType = 2; } LinkedList<String> subjectAltList = new LinkedList<String>(...
5f5c3af3-173f-4662-9a27-595e6aa48fd1
0
public DreamerNini() { super(); courseTitles= new ArrayList<String>(); works= new ArrayList<String>(); }
b5826fe9-7129-4c67-82e9-3f41eb5f02cb
2
@Override public void logOut(String username) { ResultSet rs; try { PreparedStatement statement = connection.prepareStatement( "SELECT * FROM Users " + "WHERE username = ?", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); statement.setString(1, username); rs = statement.e...
1c61a540-ba22-4488-9e08-462d934dc31a
2
public float getX(float y) { if (isVertical) { return value; } else if (isHorizontal) { return Float.NaN; } else { return (y - this.b) / this.k; } }
1fc621ff-d17a-4ce2-a5ed-461b76958fc0
3
public Boolean actualizar_estado(String estado, String estadoNuevo) { Boolean est = false; List DNList = new cDN().leer_por_estado(estado); Transaction trns = null; sesion = HibernateUtil.getSessionFactory().openSession(); try { trns = sesion.beginTransaction(); ...
8ed2e1a8-0c94-40b0-89d6-874aacb21b46
7
public static JSONObject listMessages(int id, int nb, int off,String last) throws emptyResultException { try { JSONObject json = new JSONObject(); Mongo m = new Mongo(BDStatic.mongoDb_host,BDStatic.mongoDb_port); DB db = m.getDB(BDStatic.mysql_db); DBCollection collection = db.getCollection("messages...
d6d9ccc2-fc7a-48c0-a1ba-6686c8bff207
5
private final String getChunk(String s, int slength, int marker) { StringBuilder chunk = new StringBuilder(); char c = s.charAt(marker); chunk.append(c); marker++; if (isDigit(c)) { while (marker < slength) { c = s.charAt(marker...
873d0035-d1e1-4291-8949-ec22174e38ce
3
public double getSpeedBalance() { return 0.5 * ((GUI.controls != null && GUI.controls.get("p_auto-speed") != null && GUI.controls .get("p_auto-speed").isActive()) ? stableSpeedBalance : 1); }
e3f38ff8-7102-4bcf-99ff-10f57372b9fa
0
public void setX(double _x) { x = _x; }
ac1ec38f-1155-45e1-9b9c-66146084d5ab
2
private void init() { VerticalLayout layout = (VerticalLayout) this.getContent(); layout.setMargin(true); layout.setSpacing(true); Label message = new Label("<b>Please type your website URL to begin making your E-book! (e.g. www.example.com)</b>"); message.setContentMode(Label...
c5b78be9-99bc-4375-b0a8-13a15922c542
9
private void doTunnelHandshake(final Socket tunnel, final String host, final int port) throws IOException { final OutputStream out = tunnel.getOutputStream(); final String msg = "CONNECT " + host + ":" + port + " HTTP/1.0\n" + "User-Agent: BoardPad Server" + "\r\n\r\n"; byte b[]; try { //We really do ...
c6cb4b9c-0692-42af-a4a7-69ff39e3bd16
5
public static void loadInput(String inFile, int linesToRead) throws IOException { int lines = readLines(inFile); if (linesToRead != -1 && linesToRead < lines) { lines = linesToRead; } word1 = new String[lines]; word2 = new String[lines]; Buffer...
f6de6c64-5298-4659-b109-0626fae50725
5
void init(int n) { bitrev = new int[n / 4]; trig = new float[n + n / 4]; log2n = (int) Math.rint(Math.log(n) / Math.log(2)); this.n = n; int AE = 0; int AO = 1; int BE = AE + n / 2; int BO = BE + 1; int CE = BE + n / 2; int CO = CE + 1; ...
978fd6e6-735c-47b2-82ab-d50a328a5fe0
2
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { int progress = 0; if (value instanceof Float) { progress = Math.round(((Float) value)); } else if (value instanceof Integer) { ...
4f198bed-307e-4f76-891c-af8c1a1b3ee3
4
private boolean isOnMap(int x, int y) { if(x < 0 || x >= getXSize() || y < 0 || y >= getYSize()) { return false; } else { return true; } }
ba8f5e55-8ae9-46e7-a39e-f056d6af8aec
3
@Override public String getDetails() { StringBuffer sb = new StringBuffer(); Rectangle2D b = gp.getBounds2D(); sb.append("ShapeCommand at: " + b.getX() + ", " + b.getY() + "\n"); sb.append("Size: " + b.getWidth() + " x " + b.getHeight() + "\n"); sb.append("Mode: "); ...
b95224af-9185-41b9-ab30-bd0f515f177c
7
public static void adminstrate(StanzaAndType s, FilterChain chain, Attachment aAtt) throws JAXBException { StanzaProperties stanzaProperties = StanzaProperties.getInstance(); if(s.getStringType().equals(stanzaProperties.getMessageName())) { XmppParserMessage parser = new XmppParserMessage(s.getStanza(), jabber.s...
7ba36fc7-2084-4516-8f3a-8de74140ba70
9
private static double det(double[][] arr) { int N = arr.length; double[][] M = new double[N][N]; for (int i = 0; i < arr.length; i++) System.arraycopy(arr[i], 0, M[i], 0, N); double mult = 1; for (int r = 0; r < N; r++) { int k = r; while (M[k][r] == 0) { k++; if (...
e1046a2e-f8e9-4299-8af1-7dc98bd55a39
8
private void drawControlPanel(Graphics2D g, int x, int y) { if (startIcon != null) { g.setStroke(thinStroke); startIcon.setColor(getContrastColor(x, y)); startIcon.paintIcon(this, g, x - startIcon.getIconWidth() * 3 - 12, y); } if (resetIcon != null) { g.setStroke(thinStroke); resetIcon.setColor(ge...
b85ffb11-f58d-4346-8388-3ac583a2bafa
5
@Override public void mouseDragged(MouseEvent e) { if (tempCard == null) { return; } int newx = tempCard.getXpos() - tempX + e.getX(); int newy = tempCard.getYpos() - tempY + e.getY(); int margin = TCard.H() / 2; if (newx < margin) { newx = mar...
92016b74-ed1d-49c3-a3e9-c0c81da550e3
9
private static boolean isDifferent(Tile t1, Tile t2, boolean biome) { if (biome) { if (t1 == null || t2 == null) { return false; } else { if ((t1.tile == t2.tile && !(Tiles.getPrecedence(t1.tile) > Tiles.getPrecedence(t2.tile)) || t1.floor != t2.floor)) return false; else return true; } } ...
deb466c4-cab3-478f-82a2-0b23a68ae512
3
public String getUnit(URL url) { String detail = ""; Document doc; try { doc = tidy.parseDOM(url.openStream(), null); System.out.println(getUnitOutline(doc)); getUnitStats(doc); getProductionStats(doc); getCombatStats(doc); getFieldManual(doc); getStrongAgainst(doc); getWeakAgainst...
1efb8016-d34f-4dde-b6c2-f0e83cf344bf
2
public void i2c_write(short address, byte[] data) throws IOException { if (data.length==0) { throw new IOException("no data"); } if (data.length==1) { this.write_single(address, data[0]); } else { this.write_multiple(address, data); } }
0205bcbe-ec87-40ef-97d9-9fae100067e4
7
*/ public boolean canRecruitFoundingFather() { Specification spec = getGame().getSpecification(); switch (getPlayerType()) { case COLONIAL: break; case REBEL: case INDEPENDENT: if (!spec.getBoolean("model.option.continueFoundingFatherRecruitment")) return fals...
6df4ff48-16e9-4678-8f32-efed89241ffc
3
public void randDnaSeqGetBasesTest(int numTests, int numTestsPerSeq, int lenMask, long seed) { Random rand = new Random(seed); for( int t = 0; t < numTests; t++ ) { String seq = ""; int len = (rand.nextInt() & lenMask) + 10; // Randomly select sequence length seq = randSeq(len, rand); // Create a random s...
c81bb9a5-1236-4dee-866b-3ebce3404ee9
5
public Copy getCopy(int copyId){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { Statement stmnt = conn.createStatement(); String sq...
6648e66b-e1b2-4c0b-9e6a-bf85b1ba0b20
0
public void addType(Scanner sc) { System.out.println("Add a type"); System.out.print("Enter type name: "); String nameType = sc.nextLine(); System.out.println(); System.out.print("Enter type price: "); double price = Double.parseDouble(sc.nextLine()); System.out.p...
4b9d7b04-e0ab-4abe-910d-038339b8dcf4
9
public void pedirNumero(){ try{ FileReader fr = new FileReader("Datos.txt"); BufferedReader br = new BufferedReader(fr); String cadena; // char valor; //String uno = Integer.toString(numero); while ((cadena=br.readLine())!=null){ ...
6435fdfc-2069-4cc6-8de4-f39769e52ba0
7
private void createActiveCluster(double[] timeVector, String user) { double[] post_count = timeVector; double totalPost = 0.0; for (double i : post_count) { totalPost += i; } double threshHold = (20 * totalPost) / 100; double firstClusterSize = post_count[0] + post_count[1] + post_count[2] + post_c...
6fbc3861-9e66-45ff-a0c2-50472bbca16e
1
public void setSelected(TreeNode node, boolean select) { if (select) selectedNodes.put(node, null); else selectedNodes.remove(node); }
93d69d16-3f24-4e12-9d14-88737f101696
4
public void Move(Direction direction) { switch(direction) { case Down: super.translatePosition(0, +1, 0); break; case Left: super.translatePosition(0, -1, 0); break; case Right: super.translatePosition(+1, 0, 0); break; case Up: super.translatePosition(-1, 0, 0); break; default: ...
606ef812-a999-4860-96c8-3db78c098bcb
3
public int cdlDarkCloudCoverLookback( double optInPenetration ) { if( optInPenetration == (-4e+37) ) optInPenetration = 5.000000e-1; else if( (optInPenetration < 0.000000e+0) || (optInPenetration > 3.000000e+37) ) return -1; return (this.candleSettings[CandleSettingType.BodyLong.o...
5cd84999-fc38-48dc-b82f-9201598616de
2
public void assureIntegrity(){ MessageDigest digest; try { digest = MessageDigest.getInstance("MD5"); messageDigest=digest.digest((username+message).getBytes("UTF-8")); }catch (NoSuchAlgorithmException e1){ e1.printStackTrace(); } catch(UnsupportedEncodingException e2){ e2.printStackTrace()...
6b5a6327-106d-4bdb-b708-324de0e672a5
7
public void CreateAANakedTorsoAlternativeTexturesFemales() throws Exception { SPProgressBarPlug.setStatus("Create AA naked torso alternative textures for females"); NumberFormat formatter = new DecimalFormat("000"); List<ARMA> ListRBSAANakedTorso = new ArrayList<>(); for (ARMA sourceAA :...
17c6512b-3920-49f9-93cf-1d2926cf944a
4
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == cancelButton) { dispose(); } else if (e.getSource() == nextButton) { switchToPage(currentPage.getNextPage()); } else if (e.getSource() == previousButton) { switchToPage(currentPage.getPreviousPage()); } else if (e.getSource() ...
630b93c4-c3e9-4385-8c6e-dd071256fca7
0
@Test public void testReadField_public() { Assert.assertEquals( "public", ReflectUtils.readField(new Bean(), "_field4") ); }
056ab04b-026b-460e-9018-a1409b5afe5a
1
private static String getString(ByteBuf packetPDU) { String value = ""; byte nextChar = -1; while ((nextChar = packetPDU.readByte()) != 0x2F) { // read until a '/' is encountered value += ((char) nextChar); } return value; }
cf331aab-600c-443b-b2cd-9e2c8d585732
5
private int getSyndromeIndex(String recievedi) { int[] recieved = new int[7]; for(int i = 0; i < 7; ++i) { recieved[i] = recievedi.charAt(i) == '0' ? 0 : 1; } int[] syndrome = new int[3]; Arrays.fill(syndrome, 0); // calc syndrome by z=Hr for(int i = 0; i < 3; ++i) for(int k = 0; k < 7; ++k...
93f6fb09-7b03-463d-b390-af4b0648e17e
5
public static void main(String[] args) { System.out.println("Введіть розмірність ->"); Scanner ku = new Scanner(System.in); int size = ku.nextInt(); int vector[] = null; vector = new int[size]; System.out.println("Введіть мінімум -->"); int min = ku.nextInt(); System.out.println("Введіть максимум -->"...
e3770c60-dec3-43da-a1e4-382d75cec1de
0
public String getStyle(String lineEnding) { return FileTools.readFileToString(this.styleName, lineEnding); }
94ea4f5e-d64d-4182-ad86-b2e672618f77
6
@Override public void handleEvent(Event event) { if (event.getType() == EventType.PLAYER_STATUS_CHANGE && event.getOriginator() instanceof Player) { Player player = (Player) event.getOriginator(); if (player.getPlayerStatus() == PlayerStatus.WON) { getGrid().getEventManager().sendEvent(new Event(EventType....