method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
0f977a80-062d-42b3-a6ad-ccdb0126cb2a
3
private void sendPublicKey(short crt, APDU apdu) { RSAPublicKey key = null; short len, l; switch(crt) { case (short)0xb600: key = (RSAPublicKey)keySign.getPublic(); break; case (short)0xb800: key = (RSAPublicKey)keyDecrypt....
2328f514-392f-45c4-9b62-f2ffc130ea1f
3
public void updateViewRegisters() { if(memory[XREG_ADDRESS] != xReg.get(xReg.size() - 1)) xReg.add(memory[XREG_ADDRESS]); if(memory[YREG_ADDRESS] != yReg.get(yReg.size() - 1)) yReg.add(memory[YREG_ADDRESS]); if(memory[ACCUMULATOR_ADDRESS]!= acc.get(acc.size() - 1)) acc.add(memory[ACCUMULATOR_ADDRESS])...
fc61de89-db75-4af6-9886-afe179adc211
6
private void getFlipInstruction() { currentState = new BrainState(BrainState.INSTRUCTION_FLIP); char read = (char) readAhead; readNext(); if(checkCharacter(read, 'l')) { read = (char) readAhead; readNext(); if(checkCharacter(read, 'i')) { read = (char) readAhead; readNext(); if(checkCharact...
0008b7c0-bbea-44ba-b2c1-0853eea2a21e
5
private ArrayList<ArrayList<E>> getPossibleCombos(List<Node> nodes) { ArrayList<ArrayList<E>> toReturn = new ArrayList<ArrayList<E>>(); for (Node n : nodes.get(nodes.size() - 1)) { ArrayList<Node> newFoundTiles = new ArrayList<Node>(); for (int i = 0; i < nodes.size(); i++) newFoundTiles.add(nodes.get(i))...
c2afe1b1-5ffe-47e1-875b-500b919f51b3
0
public double getX(){ return x; }
1e0eea1b-b7f8-4dfc-99e2-902a67302545
6
public static void run(RobotController myRC) { rc = myRC; RobotType t = rc.getType(); try { if (t == RobotType.SOLDIER) { Soldier.soldierCode(rc); } else if(t == RobotType.HQ) { HQ.hqCode(rc); } else if(t == RobotType.GENERATOR || t == RobotType.SUPPLIER) { Supplier.supplie...
ca5b0780-50ee-4a63-89cd-1b3692a3c80b
4
public void sort1(List<Integer> list) { if (list.size() < 2) return; int count = 0; // double for-loop and both are related with variable "end" // O(n^2) int end = list.size(); boolean swapped; do { swapped = false; for (int id...
3d226ed9-b6ca-41e7-80bb-c81a0c609697
7
public static void startupGuiServerApi() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/POWERLOOM-SERVER/GUI-SERVER", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpeci...
82ca0776-e783-40bf-916e-1248fae8fc6f
0
public static String getJdbcString() { return "jdbc:postgresql://" + host + ":" + port + "/" + database; }
9416ed3d-347e-4231-ae12-7ee3cc7cfe21
7
@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) return false; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; boolean success=proficienc...
20e4a1e8-be0a-4c7f-bef9-b5345e474bec
2
public void calculate_pcm_samples(Obuffer buffer) { compute_new_v(); compute_pcm_samples(buffer); actual_write_pos = (actual_write_pos + 1) & 0xf; actual_v = (actual_v == v1) ? v2 : v1; // initialize samples[]: //for (register float *floatp = samples + 32; floatp > samples; ) // *--floatp = 0.0f; ...
d566dcf4-b9e2-4f41-b116-60fd359c8c8d
1
private void processMoveFromAcePile(MouseEvent e) { int index = (int) (e.getY() / (CARD_Y_GAP + CARD_HEIGHT)); if (index < 4) { activeMove = new CardMoveImpl(index, CardMoveImpl.MOVE_TYPE_FROM.FROM_ACE_PILES); } }
2aa59d28-3b3e-4576-9d9d-ccbb3fc6d86c
3
public static byte[] gzip(String input) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); GZIPOutputStream gzos = null; try { gzos = new GZIPOutputStream(baos); gzos.write(input.getBytes("UTF-8")); } catch (IOException e) { e.printStackTrace...
c7ade068-2830-43b0-aa5a-76c69410d28f
2
public static void debug(int level, String format, Object... args) { if (level > 0 && level <= _messageLevel) { System.err.printf(format, args); System.err.println(); } }
4d029f0f-136b-4395-8858-cd2d058c41be
4
private void createViewPanel() { viewContent.removeAll(); JPanel viewPanel = new JPanel(); viewPanel.setBorder(BorderFactory.createTitledBorder("View")); viewPanel.setLayout(new BoxLayout(viewPanel, BoxLayout.Y_AXIS)); viewContent.add(viewPanel, JLayeredPane.DEFAULT_LAYER); JButton viewPanelMinimizeB...
c59dbcad-8997-418b-940e-9da1c8c2d24e
7
public void paint(Component component, Graphics g, int x, int y, int width, int height, Direction direction, boolean horizontalFlip, boolean verticalFlip) { ...
1726c73c-6b94-4aff-a818-d79ba4003e79
6
public void infoFile(){ try{ if( file.exists() ){ System.out.println("Ver Nombre: " + file.getName()); System.out.println("Ver Path: " + file.getPath()); System.out.println("Ver Absoluta: " + file.getAbsolutePath()); if...
cbb4d057-cfe9-48d9-83de-2b0b74d8a6fc
8
public int recurSearch(int[] A, int target, int start, int end){ if(start == end && A[start] == target) return start; if(start > end) return -1; int center = (start + end)/2; if(A[center] >= A[start]){ if(A[start] <= target && target <= A[center]){ re...
0542ce79-91e9-4449-a413-28c3cef2f457
1
@SuppressWarnings("unchecked") public Book combineBooks(String newBookName, Book... books) { List<Contact> contacts = Lists.newArrayList(); for (Book book : books) { contacts = ListUtils.sum(contacts, book.getListOfAllContacts()); } return new Book(newBookName, contacts); }
f2f7a198-6c8e-4c9b-8a55-1c034fc08416
3
public Menu(HtmlMidNode parent, HtmlAttributeToken[] attrs){ super(parent, attrs); for(HtmlAttributeToken attr:attrs){ String v = attr.getAttrValue(); switch(attr.getAttrName()){ case "label": label = Label.parse(this, v); break; case "type": type = Type.parse(this, v); break; ...
b8ee5219-6e7f-41c5-961b-2d5f7627ea41
9
private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed try { parameter.setName(txfName.getText()); } catch (CantSetException e) {} try { parameter.setDescription(txfDescription.getText()); } catch (CantSetException e) {} try { parameter.setYear(...
7ae857d8-834c-4c0a-9893-90c1e3f40676
6
@Override public boolean mutate(Mutation.Type type) { switch (type) { case SWAP: case REPLICATE: return false; case REMOVE: Mutation.replaceExpr(this, expr); return true; case COPY_TREE: return Mutation.copyExprTree(this); case COPY: return unaryCopy(); case CREATE_PARENT: Mutation.crea...
c7f9d1c5-4bcc-48b8-8aa4-752718e04c14
8
public void paintLineHighlights(Graphics g) { int count = lineHighlights==null ? 0 : lineHighlights.size(); if (count>0) { int docLen = textArea.getDocument().getLength(); Rectangle vr = textArea.getVisibleRect(); int lineHeight = textArea.getLineHeight(); try { for (int i=0; i<count; i++) { ...
fb3b181e-43a8-4559-9115-b98dd13d918f
3
private static <T> Map<String, Object> serializeArray(Class<?> type, T[] arr) { Map<String, Object> data = new HashMap<String, Object>(); data.put("T", type.getComponentType().isPrimitive() ? type.getName() : ("[L")); data.put("class", arr.getClass().getComponentType().getName()); data.p...
6e02df95-1030-4373-ada9-428dea08870b
7
private static ArrayList<Monster> initiative(ArrayList<Monster> monsters, Player p, boolean atRange, boolean faster) { int target = 0; if(atRange) { target = p.getSpeed() + utils.random(0, 7); } else { target = p.getSpeed() + utils.random(-3, 4); } ArrayList<Integer> speeds = new Arr...
837564bf-f5f1-4636-92da-9215520f2405
8
public static void showReportsTable(ResultSet rs, String reportsQuery, String subject) { int numCols; ResultSetMetaData rsmd; JTextArea tableTitle = null; JTable table = null; try { rsmd = rs.getMetaData(); numCols = rsmd.getColumnCount() + 1; String columnNames[] = new String[numCols]; for (...
c9189bc4-7bcd-41aa-a68f-d147e43d1438
3
public String execute() throws Exception { if(addListStore != 0 && addListItem != 0) if(!add()) return "inputError" ; return SUCCESS; }
a96c256b-ab9e-4941-8bbb-7fc7e9fb59b8
3
@Override public FileSequenceWriter createWriter(OutputStream out, OutputStream... out2) { if (out == null || out2 == null || out2.length == 0) throw new IllegalArgumentException( "You must declare two valid input streams"); return new FastaQualitySequenceWriter(out, out2[0]); }
f5cda877-1e1e-4599-bf63-94a688045e42
9
public static NumericDocValues wrap(SortedNumericDocValues sortedNumeric, Type selector, SortField.Type numericType) { if (numericType != SortField.Type.INT && numericType != SortField.Type.LONG && numericType != SortField.Type.FLOAT && numericType != SortField.Type.DOUBLE) { throw ne...
de85e255-865b-4311-b03e-b526b18b38d9
5
private void loginAndSaveCookie(){ HttpPost loginpost = new HttpPost(loginUrl); List<NameValuePair> params = null; try { String html = this.GetPageContent(loginUrl); params = getFormParams(html,"htsdeploy@gmail.com","hsbc123456"); } catch (UnsupportedEncodingException e2) { e2.printStackTrace();...
10f22e53-7fd9-4085-9882-6ba327657b0a
6
private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed // TODO add your handling code here: String textoCorreo = tfIdCorreo.getText().trim(); if (!textoCorreo.equals("")) { try { if (rbtnCorreo.isSelected())...
3c8493de-8a22-426f-aed8-515c467c578a
5
public static void main(String argv[]) { if (argv.length == 0) { System.out.println("Usage : java MyScanner <inputfile>"); } else { for (int i = 0; i < argv.length; i++) { String fileName = null; try { fileName = argv[i]; Parser parser = new Parser(new Scanner(new java.io.FileReader(fileNam...
1144f4d3-b0f9-44e2-89d5-88f2109887b9
7
public int _offsetToX(int line, int offset) { TokenMarker tokenMarker = getTokenMarker(); /* Use painter's cached info for speed */ FontMetrics fm = painter.getFontMetrics(); getLineText(line,lineSegment); int segmentOffset = lineSegment.offset; int x = horizontalOffset; /* If syntax coloring is disa...
2f1da820-305b-4acb-95bd-c929b6c503c3
8
@Override public int writeString(String encoding, String val, int length) throws IOException { Charset charset = Charset.forName(encoding); CharsetEncoder enc = charset.newEncoder(); CharBuffer bin = CharBuffer.allocate(1); ByteBuffer bout = ByteBuffer.allocate(8); int le...
14918fc8-a8d0-4e68-8653-a2fc91da1f33
0
public static Animation bulletAnimationLeft(){ Animation anim = new Animation(); anim.addFrame(loadImage("bullet1.png"), 50); anim.addFrame(loadImage("bullet2.png"), 50); anim.addFrame(loadImage("bullet3.png"), 50); return anim; }
4aca9a79-a082-4692-aa14-e4b00b2b2b20
1
public String readLine() throws IOException { if (_acceptable) { throw new IOException("You must call the accept() method of the DccChat request before you can use it."); } return _reader.readLine(); }
964082b1-39ba-4df1-be33-bd72561885fc
2
private String getSessionId(URLConnection con){ for(String data:con.getHeaderFields().get("Set-Cookie")){ if(data.indexOf("JSESSIONID")!=-1){ return data.substring(0,data.indexOf(";")); } } return null; }
219857bb-81e7-4925-86c4-7f3643dda00f
2
public static boolean areTerminalsOnRHS(Production production) { String rhs = production.getRHS(); for (int k = 0; k < rhs.length(); k++) { char ch = rhs.charAt(k); if (isTerminal(ch)) return true; } return false; }
ece02f96-551a-4edd-94d9-2bcfaeab5683
1
public void DrawGameOver(Graphics2D g2d, Point mousePosition, long gameTime) { Draw(g2d, mousePosition); //draws the text to restart //g2d.drawString("Press space or enter to restart.", Framework.frameWidth / 2 - 100, Framework.frameHeight / 3 + 70); //draw text to say whether you won ...
1b7a832e-4d98-4f66-a112-596e2bbf1deb
2
public String toString() { if (id != null) { if (dataId > 0) { return id.toString() + ":" + dataId; } return id.toString(); } return name; }
276cb579-2779-407b-afd4-4bbf88c05bde
9
public synchronized ZePlayoutElement<E> get() { /* sample current absolute time. */ now = playoutToSystem(); leftInterval = now-playoutHalfPer; rightInterval = now+playoutHalfPer; /* sample it once from the master and use * the same value for the whole playout request * to avoid inconsistencies (mpo...
62b9b369-588b-42b8-8685-4fbaed07b5eb
8
@Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){ if (cmd.getName().equalsIgnoreCase("getmute")){ if (args.length <= 0) { sender.sendMessage(Msg.$("getmute-usage")); return true; } ...
28301c56-81a8-486d-a90f-ca9f75375d47
8
public TheDocument(String htmlFile) { file = new File(htmlFile); isWrapped = false; isIndented = true; isSaved = true; setFilepath(htmlFile); reader = new DocumentReader(); care = new DocCaretaker(); if(!file.exists()){ try { ...
b3606ed8-329b-4940-88da-8d47e7bca4dd
5
public void chooseOption() { switch (cursorLoc) { case 1: game.startSetup(); break; case 2: break; case 3: try { java.awt.Desktop.getDesktop().browse( new URI("http://www.signalytical.com/")); } catch (IOException e) { e.printStackTrace(); } catch (URISyntaxException e) { e....
874ee483-8932-43d2-afbd-ec6797a6c7a4
9
@Override public List<Map<String, ?>> List_Plazo(String tipo) { List<Map<String, ?>> lista = new ArrayList<Map<String, ?>>(); try { this.conn = FactoryConnectionDB.open(FactoryConnectionDB.ORACLE); String sql = ""; sql +="select id_plazo,no_plazo,det_alerta ,to_c...
5a4aa8c6-0829-4563-8110-6af8a0900d2d
7
public NoAddReason getNoAddReason(Locatable locatable) { Unit unit = (locatable instanceof Unit) ? (Unit)locatable : null; return (unit == null) ? NoAddReason.WRONG_TYPE : (units == null) ? NoAddReason.CAPACITY_EXCEEDED : (!isEmpty() && units.get(0).getOwn...
c4ef59cf-8d88-4efa-ac6c-22bbc01fb97d
8
public String[][][] getLog(String mode, String sv) throws IOException { String storeAccess = null; String storeAccessUpdate = null; if (mode.equals("past")) { storeAccess = "text"; storeAccessUpdate = "past_update"; } else if (mode.equals("ranking")) { storeAccess = "rank"; storeAccessUpdate = "rank...
b37ebd67-929a-45c6-8540-ae8e902dcd47
2
public void onMouseEvent() { if (Mouse.hasWheel() && Mouse.isButtonDown(0)) { int angleZ = -Mouse.getDX(); double teta = Math.toRadians(angleZ); double xprime = (this.position.getPositionX() * Math.cos(teta)) + (this.position.getPositionY() * Math.sin(teta)); doub...
20edcf1a-ad58-460f-8f5d-d3ef98b50543
2
@Override public void writeValue(NBTOutputStream output) throws IOException { int len = this.size(); for (int i = 0; i < len; i++) { NamedBinaryTag value = this.getTag(i); if (value != null) { output.writeNBT(value); } } output.writeEnd(); }
49385082-4333-457c-923d-2d70733485cf
4
public String getMimeType() { if (format >= 0 && format < MIME_TYPE_STRINGS.length) { if (format == FORMAT_JPEG && progressive) { return "image/pjpeg"; } return MIME_TYPE_STRINGS[format]; } else { return null; } }
597cd698-b6ec-4474-b5e6-4b251604814f
9
private boolean decode5(ByteArrayOutputStream baos) throws PDFParseException { // stream ends in ~> int[] five = new int[5]; int i; for (i = 0; i < 5; i++) { five[i] = nextChar(); if (five[i] == '~') { if (nextChar() == '>') { ...
110d63c0-99d9-44e0-9f51-7affdb54d8d9
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...
8e0711b8-dce4-474c-8083-3d466ce88cb1
3
private float limit(float eq) { if (eq==BAND_NOT_PRESENT) return eq; if (eq > 1.0f) return 1.0f; if (eq < -1.0f) return -1.0f; return eq; }
fff41e4d-f963-4530-b191-54eafa4eaa75
1
List<Position> getPositions() { final List<Position> parts = new ArrayList<Position>(); for (LightTrailPart part : lightTrail) parts.add(player.getGrid().getElementPosition(part)); return parts; }
46aad0be-2445-4330-a438-7a5a6482df59
1
private boolean isLowPriorityOperator(String o) { return o.equals(OPERATION_MINUS) || o.equals(OPERATION_PLUS); }
8ad9397b-a290-4630-a557-a40a19068049
8
private void saveCheck(final String address) { int opt = -1; if (saveReminder != null && saveReminder.isChanged()) { opt = isRemote() ? JOptionPane.NO_OPTION : saveReminder.showConfirmDialog(this, FileUtilities.getFileName(pageAddress)); } boolean readAction = true; switch (opt) { case JOptionPane.YES_OP...
4ebaa1c9-2e3f-4d54-9503-a71cebc8bc22
2
public Merchant(int reg_num) { SQLiteJDBC db = new SQLiteJDBC(); String sql = String.format("SELECT * FROM merchants WHERE reg_num ='%d'", reg_num); ResultSet resultSet = db.query(sql); try { if(resultSet.next()) { this.reg_num = resultSet.ge...
8001a500-7f37-41de-b8de-4451724d5579
5
static final void method2947(boolean bool, int i, int i_4_, int i_5_, int i_6_, int i_7_) { anInt6837++; if (bool != true) method2950(121); if ((((Class348_Sub51) BitmapTable.aClass348_Sub51_3959) .aClass239_Sub26_7272.method1838(-32350) ^ 0xffffffff) != -1 && i_5_ != 0 && Message.anInt2021 <...
97f6b92e-a180-45f5-9d44-438a507f72c8
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Sales)) { return false; } Sales other = (Sales) object; if ((this.id == null && other.id != null) || (this.id !...
6651404c-9509-4869-83ef-5b539ac5cb8e
4
private static Path getOutputModuleFile(CommandLine line) throws IOException { if (!line.hasOption(OUTPUT_MODEL)) { return null; } String outputPathName = line.getOptionValue(OUTPUT_MODEL); Path outputPath = Paths.get(outputPathName); if (!Files.exists(outputPath)) { Files.createDire...
5d00a2e9-af14-4a3d-99a9-bfb78b0808a6
0
public boolean isManagesConnection(TVC con) { return managedConnections.contains(con); }
79947d08-18c4-435d-8c76-e99c47666a3c
0
private void updateUploadInfo(String status) { long delta = (System.currentTimeMillis() - startTime) / 1000; request.getSession().setAttribute("uploadInfo", new UploadInfo(totalFiles, totalToRead, totalBytesRead,delta,status)); }
67114bd5-d337-4df7-9369-ce52ef538ed0
1
public static void putReverseSortedInput(Comparable[] a) { for (int i = a.length; i > 0; i--) a[i] = i; }
d03b0547-78bc-454c-9c33-a8c64ef0de9e
7
public static boolean pointInside(Positioned other, double x, double y, boolean notOnTheEdge) { if (notOnTheEdge) return x > other.leftBorder() && x < other.rightBorder() && y > other.topBorder() && y < other.bottomBorder(); else return x >= other.leftBorder...
5143710c-cfd5-4331-af74-45cd8e1a1e91
0
public void set(int index, String datum) { RangeCheck(index); data[index] = datum; }
2fe07fa4-aa2a-474c-a7ed-e3a34dc94ac8
1
private void AddVertices(Vertex[] vertices, int[] indices, boolean calcNormals) { if(calcNormals) { CalcNormals(vertices, indices); } m_resource = new MeshResource(indices.length); glBindBuffer(GL_ARRAY_BUFFER, m_resource.GetVbo()); glBufferData(GL_ARRAY_BUFFER, Util.CreateFlippedBuffer(vertices), G...
31f7bc47-639e-4876-8b41-fb85988c910a
0
public String getRemoteIP() { return remoteIP; }
37d63dd9-ca9a-4480-b364-a5e9eb03ac91
7
public void setProjectStateEnabled(boolean enabled){ //Enabled tool bar, except new and open project for(int i=2; i<mainToolBar.getComponentCount(); i++){ if(!(mainToolBar.getComponent(i) instanceof JToolBar.Separator)){ mainToolBar.getComponent(i).setEnabled(enabled); ...
13d4e2c5-eb2d-4dbd-8442-e5ffd77f56b1
1
@Override public ArrayList<Node> getListOfNodes() { if (isParsed) { return nodes; } else { initiateParsing(); return nodes; } }
03bed746-fcba-450c-91cf-f25bc3756afd
8
public static void main(String[] args) throws IOException { int option; Scanner input = new Scanner(System.in); System.out.println("What would you like to do?"); System.out.println(); System.out.println("<1> Add or delete a student"); System.out.println("<2> Change student grades or schedule"); System....
3c2a9f1d-a97c-4202-b7cc-9a8873c86093
6
private boolean flushTable(JobConf conf) { initializeAccumuloConnector(); TableOperations ops = accumuloConnector.tableOperations(); String rowKeyRangeStart = conf.get("rowKeyRangeStart"); String rowKeyRangeEnd = conf.get("rowKeyRangeEnd"); boolean flushRangeAvailable = (rowKe...
490c0a36-f476-4aff-940a-99961891104b
2
private boolean inMergeSource(MultiType source) { while (source != null) { if (source == this) return true; source = source.mergeSource; } return false; }
c13b4c04-cf45-4164-a8cc-0a1c8ebdcac2
8
@Override public void tickTock(int howManyHours) { final TimeOfDay todCode=getTODCode(); if(howManyHours!=0) { setHourOfDay(getHourOfDay()+howManyHours); lastTicked=System.currentTimeMillis(); while(getHourOfDay()>=getHoursInDay()) { setHourOfDay(getHourOfDay()-getHoursInDay()); setDayOfMont...
8e69a5d2-69c2-44ed-9459-200e09614f66
9
public static boolean dumpItem(int itemId) { String pageName = ItemDefinitions.getItemDefinitions(itemId).getName(); if (pageName == null || pageName.equals("null")) return false; pageName = pageName.replace("(p)", ""); pageName = pageName.replace("(p+)", ""); pageName = pageName.replace("(p++)", ""); pa...
2ca5835c-c62c-4227-9350-5752700a00ad
9
public String GenerateIndividu() { int jum1 = 0; int jum2 = 0; int jum3 = 0; int i = 0; String ind; while (i < 8) { ind = getRandom(bahan); if ((ind.equals(bahan[0])) && (jum1 < 3)) { jum1++; individuRandom[i] = i...
10c0c08a-a98e-4cfb-97ee-f2f58d8f0a4e
3
public List<Session> getTeamMembers(ChatColor color) { List<Session> sessions = new ArrayList<Session>(); for (Session session : HyperPVP.getGameSessions().values()) { if (session.getTeam() != null && session.getTeam().getColor() == color) { sessions.add(session); } } return sessions; }
f405b0cf-4d1f-465e-8f45-272cde2986d9
9
public static void textPack(byte packedData[], java.lang.String text) { if (text.length() > 80) text = text.substring(0, 80); text = text.toLowerCase(); int carryOverNibble = -1; int ofs = 0; for (int idx = 0; idx < text.length(); idx++) { char c = text.charAt(idx); int tableIdx = 0; for (int i =...
c3c94eeb-5dc0-49bd-928c-a0537acd8624
4
public int getContentLength(){ SipcHeader header = this.getHeader(SipcHeader.LENGTH); if (header != null && header.getValue() != null) { String value = header.getValue(); if (value.length() < 1) { return -1; }else if (value.indexOf(';') != -1) { return Integer.parseInt(value.substring(0,value.i...
8f85dd73-ac17-4fa9-aaf1-e35f3560214b
1
public void writeToUser(String user, String text){ try{ bw.write("PRIVMSG "+ user +" :"+text+"\n"); bw.flush(); }catch(IOException e){ System.out.println("IRC: Failure when trying to write to server: "+e.getMessage()); } }
8e14e2c4-2d97-4f73-b2a1-e8b7b336a8c3
5
@SuppressWarnings("unchecked") public boolean delete( Comparable key ) { ListNode<T> before = null; ListNode<T> after = front; // Traverse the list to find the ListNode before and after our deletion point. while ((after != null) && (key.compareTo(after.getData()) != 0)) {...
d854e384-7888-45a5-9a04-5b858249afa0
6
public String[][] getDifferences(LLParseTable table) { if (!Arrays.equals(variables, table.variables) || !Arrays.equals(terminals, table.terminals)) throw new IllegalArgumentException( "Tables differ in variables or terminals."); ArrayList differences = new ArrayList(); for (int v = 0; v < entries.len...
de6d1522-5f58-4447-93e0-0ce6504edf32
8
@SuppressWarnings("unchecked") void readGaussianBasis() throws Exception { /* * standard Gaussian format: * * [GTO] 1 S 3 172.2560000 2.0931324849764 25.9109000 2.93675143488078 5.5333500 1.80173711536432 * * 1 SP 2 3.6649800 -0.747384339731355 1.70917757609178 0.7705450 0.712661025209793 0.88562206...
c1290e9a-f9e3-4a98-91ff-b06d1657057a
8
private static void pickSatisfyMinLeaves(BswabePolicy p, BswabePrv prv) { int i, k, l, c_i; int len; ArrayList<Integer> c = new ArrayList<Integer>(); if (p.children == null || p.children.length == 0) p.min_leaves = 1; else { len = p.children.length; for (i = 0; i < len; i++) if (p.children[i].sa...
c6230430-08d9-4206-a45a-93a0fcb17c21
3
public ArrayList<MainMenuHeroSlot> reloadHero(){ ArrayList<MainMenuHeroSlot> temp = new ArrayList<MainMenuHeroSlot>(); while( heroTurn.peek() != null ){ BattleHeroSlots slot = heroTurn.remove(); slot.setExp(); temp.add(new MainMenuHeroSlot(slot)); } int count = temp.size(); if(count <Con...
47e2f003-9d31-4a4c-bd1f-b7ba5c4cbb46
6
@Override public void onAttack() { Alteration buff; MathTools math = new MathTools(); CombatLog log = CombatLog.getInstance(); int dmg; // Proc surging charge buff = engine.getPlayer().getAlterations().get("surgingCharge"); if (buff != null && (engine.getTime() - this.lastCharge) >= 0){ if (math.ch...
e5d0d8f2-145a-4d64-bee3-79ea520387c2
0
public String getFacebookRsvpUrl() { return facebookRsvpUrl; }
e2b514f0-242d-4c71-93dd-516574b4f224
7
public static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double)o).isInfinite() || ((Double)o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); ...
0464f2dc-b47b-4056-9e2b-f5dc8342a3e7
8
@Override protected void controlRender(RenderManager rm, ViewPort vp) { float newDistance; int level; BoundingVolume bv = spatial.getWorldBound(); Camera cam = vp.getCamera(); float atanNH = FastMath.atan(cam.getFrustumNear() * cam.getFrustumTop()); float ratio = (Fas...
6d418fb0-6bf9-46aa-8b34-1b571ac6a278
5
public static void readMessage(String input, Core output) { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder; Document xmlFile = null; try { builder = factory.newDocumentBuilder(); xmlFile = builder.parse(new InputSour...
2dba042b-910e-400a-893d-153dccc11a0f
5
private float[] kernel(float[] x, float[] w, int n, int n2, int n4, int n8){ // step 2 int xA=n4; int xB=0; int w2=n4; int A=n2; for(int i=0;i<n4;){ float x0=x[xA] - x[xB]; float x1; w[w2+i]=x[xA++]+x[xB++]; x1=x[xA]-x[xB...
5022fa52-f023-4ee3-bea1-fa567ae3053e
6
protected void processClients(Map<Integer, ClientInfo> connectedClients) { // Don't process if previous map is null, i.e. not yet initialized if(map == null) return; // Loop through all of the clients in the previous mapping for(ClientInfo client : map.values()) { // Send a...
0da8b3a6-51dc-48c4-be18-884144f7cf80
1
public String getBillForCustomer(String[] orders) { for (String personOrder : orders) { item = personOrder.split(SPLIT); foodName = item[0]; foodPrice = item[1]; bill = bill + Double.valueOf(foodPrice); order = order + foodName + SPACE + Double.parseDo...
d3ce3b05-478f-49d1-8eca-89af65bfca38
3
@Override public void run() { while (true) { // This loop goes forever, since we don't want our game // logic to stop. // TODO: Add game mechanics here. // Update all game objects. for (RenderObject object : objectsToRender) { object.update(inputHandler, objectsToRender); } //...
24eaa965-16aa-42ca-ae8d-576a7168d7b1
3
public Tree additiveExpressionDashPro(Tree firstConditionalExpression){ Tree secondConditionalExpression = null; Symbol operator = null; if((operator = accept(Symbol.Id.PUNCTUATORS,"(\\+|-)")) != null){ if((secondConditionalExpression = multiplicativeExpressionPro()) != null){ firstConditionalExpression =...
375797c0-7074-45d1-8d54-3be41eaa26b9
6
private static void trip(String mapFileName) { Reader mapParser = null; try { mapParser = new FileReader(mapFileName); } catch (FileNotFoundException e) { throw new RuntimeException("No file found"); } makeMap(mapParser); Scanner reqParser = new S...
3031ae2a-366e-4597-a92e-3939cecb661b
0
public static void expandAllSubheads(Node currentNode) { currentNode.ExpandAllSubheads(); currentNode.getTree().getDocument().panel.layout.redraw(); return; }
6b5ea005-d10e-4bd3-81bb-448758f42991
8
public float priorityFor(Actor actor) { final Item[] available = available(this.actor) ; if (available.length == 0) return 0 ; final float rangePenalty = ( Plan.rangePenalty(actor, origin) + Plan.rangePenalty(actor, destination) + Plan.rangePenalty(origin, destination) ) / (driven...
193664ee-43f8-4f76-9933-31cb946db27b
3
private Location rechercherLocation(int numero){ System.out.println("ModeleLocations::rechercherLocation()") ; Location location = null ; int i = 0 ; while(i < this.locations.size() && location == null){ if(this.locations.get(i).getNumero() == numero){ location = this.locations.get(i) ; } else { ...
c2ff3eeb-aefb-41e2-a2d1-d45946516052
1
static long amod(long dividend, long divisor) { long mod = mod(dividend, divisor); return (mod == 0) ? divisor : mod; }
d7314ca1-4f2b-4141-9f25-3a37d7140dec
2
public static synchronized void removeUser(int id) { for(int i = 0; i < usersOnline.size(); i++) { if(usersOnline.get(i).getId() == id) { usersOnline.remove(i); return; } } }