method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
f06d196b-e652-492d-acf5-36617c1b3d19
7
void begin() { try { int testC = Integer.valueOf(br.readLine()); // System.out.println("test cases: "+testC); for(int i=0;i<testC;i++) { int numBoxes = Integer.valueOf(br.readLine()); // System.out.println("boxes in test case "+(i+1)+" "+numBoxes); ...
95e6d8b7-1b7f-4b5d-9d7c-c8581788752f
8
@Override public String toString() { StringBuilder sb = new StringBuilder(); boolean first = true; if(!full) { for(int cnt2=0;cnt2<cnt;cnt2++) { if(first) { first = false; sb.append(buffer[cnt2]); } else { sb.append(", " + buffer[cnt2]); } } } else { int cntHigh = cnt + size...
1ca62d2b-ff6b-46b5-a5a0-016ae31bc9f9
6
private int testaaPisteXAkselilla(int nopeus) { // Iteraattori int xTestattava = 0; // Suunnan apumuuttuja int suunta; // Koodia selkeyttävä apumuuttuja int absNopeus = xNopeus; if (xNopeus > 0) { /* Emme käytä xSuuntaa, koska jos p...
cf0ff391-fd58-4892-b1e4-65eea812b23c
5
public boolean isInView(int marginx,int marginy) { if (!getTileBBox(temp_bbox_copy)) { temp_bbox_copy.x = (int)x; temp_bbox_copy.y = (int)y; temp_bbox_copy.width = 0; temp_bbox_copy.height = 0; } if (temp_bbox_copy.x + temp_bbox_copy.width < viewxofs-marginx) return false; if (temp_bbox_copy.y +...
d80688ff-9d3c-4568-a718-6cab4eca2a0a
0
public void setPostalAddress(String postalAddress) { this.postalAddress = postalAddress; }
ea5fe708-da80-4f54-a4f3-544bb0c09133
7
private void listen() { try { // Listen for messages from server Object dataFromServer; while (true) { if (this.isConnected()) { if ((dataFromServer = in.readObject()) != null) { receive(dataFromServer); } } else { this.close(); } } } catch (EOFException|SocketException...
3fd23920-1cfd-4340-a23c-4c360571523b
9
void signRequest(String method) throws IOException, InvalidKeyException, NoSuchAlgorithmException, IllegalStateException { StringBuilder buff = new StringBuilder(); buff.append(method).append("\n"); if (headers.containsKey(CONTENT_TYPE_HEADER)) { buff.append(headers.get(CONTENT_TYPE_HEADER).toLowerCase()...
e254fa1e-2b44-45b1-a9a5-afa3fe490c8d
6
public UsuarioSistema Abrir(int id) throws Exception{ UsuarioSistema usuario_sistema = null; try{ PreparedStatement comando = banco .getConexao().prepareStatement("SELECT * FROM usuarios_sistema " + "WHERE id = ? "); ...
4a6e29e3-3b07-4ef6-a8bc-faa5e875b123
4
private List<DateTime> getSortedArriveDateTimeList(List<ContainerData> containers) { // Create List<DateTime> dateTimes = new ArrayList(); // Find all unique DateTimes for(ContainerData container : containers) { DateTime dateTime = container.getEnterDateTimeFrom(); ...
696b8f7b-8f27-4a0a-91db-e97352d8500c
1
@Test public void testParseInvalidPredicateBrackets() throws Exception { Parser parser = new Parser(); try { parser.parsePredicate("father*of(P, C("); fail("The brackets of this predicate do not match."); } catch (ParseException ex) { // Expected exception...
fc42e579-5c46-4c93-9e8b-4db588f6d5e0
2
public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException { // クラス名からClassを取得 @SuppressWarnings("unchecked") Class<Person> pClazz = (Class<Person>) Class .forName("demo.bean.Person"); System.out.println(pClazz); // クラスからパラメータ取得 Field[] fie...
77dfb6ac-3c26-4f1b-ae52-69780f3710cb
8
public static final void UseScriptedNPCItem(final SeekableLittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) { slea.skip(4); final byte slot = (byte) slea.readShort(); final int itemId = slea.readInt(); final IItem toUse = chr.getInventory(MapleInventoryType.USE).g...
a8d175bc-c115-49db-96e1-a7c7a6fb0487
2
public static void main( String[] args ) { try { AudioInputStream aistream0 = AudioSystem.getAudioInputStream(new File(args[0])); AudioInputStream aistream1 = AudioSystem.getAudioInputStream(new File(args[1])); float sampleRate = aistream0.getFormat().getSampleRate(); AudioFormat format = new AudioFormat(samp...
29229b55-c36b-42cb-9c70-3d20bc58bd73
2
public ProduktBatchKompDTO getProduktBatchKomp(int pbId, int rbId) throws DALException { ResultSet rs = Connector.doQuery("SELECT * FROM produktbatchkomponent WHERE pb_id = " + pbId + " AND rb_id = " + rbId); try { if (!rs.first()) throw new DALException("Produktbatchkomponenten " + pbId + ", " + rbId + " findes...
7f31fbfd-ed16-4dae-91d2-09a121194ec7
0
public JTextArea getjTextAreaBilan() { return jTextAreaBilan; }
fa4838dc-b302-496a-94c8-25d18775b98e
9
public String getMessage() { if (!specialConstructor) { return super.getMessage(); } StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSeq...
a36dd865-7087-4d3e-be45-58f26a38790f
0
@Override public void setReliefValveState(int reliefValveState) { this.reliefValveState = reliefValveState; }
9b62373b-1f45-4266-ad6d-a089f65abea0
3
@Override public void run() { init(); while (listening){ byte[] recv= new byte[1024]; try { int cnt = is.read(recv); if (cnt==-1){ listening=false; break; } this.recv(recv,cnt); } catch (IOException e) { e.printStackTrace(); } } shutdown(); }
a839f5d4-747c-4d18-a8c1-578684745caa
9
public Map.Entry getMatch(String path) { Map.Entry entry; if (path==null) return null; int l=path.indexOf(';'); if (l<0) { l=path.indexOf('?'); if (l<0) l=path.length(); } // try exact match ...
3ead362e-c9af-4a77-b151-adb6347063df
2
public void filter (String text,TableRowSorter sorter) { if (text.length() == 0) { sorter.setRowFilter(null); } else { try { sorter.setRowFilter( RowFilter.regexFilter(text)); } catch (PatternSyntaxException e...
060c77da-0fbe-43ff-ae21-db2566765237
6
public void renderTiles(Screen screen, int xOffset, int yOffset) { if (xOffset < 0) xOffset = 0; if (xOffset > ((width << 3) - screen.width)) xOffset = ((width << 3) - screen.width); if (yOffset < 0) yOffset = 0; if (yOffset > ((height << 3) - screen.height)) yOffset = ((height << 3) - screen.height...
30e99d08-4b00-4841-90b2-a4cf1da0bf53
7
public int storeAccount(Account acc) { int result = 0; ResultSet rs = null; PreparedStatement statement = null; try { statement = conn.prepareStatement("insert into Accounts (Username, Password, Manager) values (?,?,?)", Statement.RETURN_GENERATED_KEYS); MessageDigest digest = MessageDigest.getInstance...
faa8570c-45df-4789-8f03-333b147ec9ee
4
public void cubicInterpolation(){ if(this.nAnalyteConcns<2)throw new IllegalArgumentException("Method cubicInterpolation requres at least 2 data points; only " + this.nAnalyteConcns + " were supplied"); this.methodUsed = 1; this.sampleErrorFlag = false; this.titleOne = "Cubic interpolati...
aaca7810-16ec-41c4-b132-9bd255d78661
4
void testit() { SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd hh:mm:ss" ); book = new WorkBookHandle( file ); try { sheet = book.getWorkSheet( sheetname ); } catch( WorkSheetNotFoundException e ) { log.error( "",e ); } // get a date-time CellHandle a1 = null, a2 = null, a3 = null;...
c3a3d599-e444-46ab-8ece-91b8a28db145
5
@Test public void shouldTransformToPixelArray() { Pixel[] pixels = editor.toPixels(); assertTrue(pixels[0].red == 255 || pixels[10].red == 255 || pixels[0].green == 255 || pixels[10].green == 255 || pixels[0].blue == 255 ...
49c491f1-d3b9-4df2-8696-c2b9344d34b6
4
float b(int i, float t) { switch(i) { case -2: return (((-t + 3) * t - 3) * t + 1) / 6; case -1: return (((3 * t - 6) * t) * t + 4) / 6; case 0: return (((-3 * t + 3) * t + 3) * t + 1) / 6; case 1: ...
6f9049d8-2c02-4d45-9483-ca36c07c96ff
1
public boolean go(GameContainer container, GameBoard board) { this.board = board.board; if(wPlayer){ this.mPieces = board.Pwhite; this.oPieces = board.Pblack; } else{ this.oPieces = board.Pwhite; this.mPieces = board.Pblack; ...
20bf1e05-2090-43d7-a905-7826ff6fd2ad
6
@RequestMapping(value = "/katalog", method = RequestMethod.GET) public String biblioteka(Locale locale, Model model, HttpServletRequest request) { boolean zmiana = false; int id = 0; int atrybut = 0; String wyrazenie = ""; if (request.getParameter("filter") != null) { ...
08ac995b-74aa-45ca-8da1-c80dc9413b17
0
public String getKeywords() { return hostName; }
44ddc97a-77fe-4b5c-88c6-6c0d09121e5a
6
@EventHandler public void ZombieNausea(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getZombieConfig().getDouble("Zombie.Nausea.D...
0fba5cff-3d5c-4786-8109-ac1ea439b6f9
4
public Main(){ //public void callMe(){} //Hey, I just met you. I made a function. So here is callMe(). So call it maybe? //Tried running this code inside of a VM. I died within the first try :( //[ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo *Click* s = new Server("CirnoServer", 10, this); main = new J...
167f4641-898f-476d-81b2-4a9e44d194b2
0
public listByDay() { this.requireLogin = true; this.info = "list all appointments in a given day"; this.addParamConstraint("timestamp", ParamCons.INTEGER); }
fef17d80-c5f5-40fd-b76a-787e2173d0af
9
public ArrayList<Integer> top_features_overall(int num,ca_table t1,ca_table t2) { int[] t1_totals=new int[t1.columns()]; int[] t2_totals=new int[t1.columns()]; int[] t1_totals_copy=new int[t1.columns()]; int[] t2_totals_copy=new int[t1.columns()]; for(int i=0;i<t1.columns();i++) { t1_totals[i]=t1.colum...
255f57f2-e594-4f5c-828e-07c37da95e06
9
public StringBuffer printExpression(int indent, StringBuffer output) { // handle some special char..... output.append('\"'); for (int i = 0; i < source.length; i++) { switch (source[i]) { case '\b' : output.append("\\b"); //$NON-NLS-1$ break; case '\t' : output.append("\\t"); //$NON-NLS...
89b91d22-08ff-473d-b337-ecc7bc4d0b5f
9
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; /* * First fill the circle buffer with as many characters as are in the...
006e7536-e170-4e1d-9316-25f7a99b9fb9
2
public void printPlayerInfo(Player sender, Player check) { if(check == null) return; Fruit f = getFruitByPlayer(check); if(f != null) { sender.sendMessage(ChatColor.GREEN + "" + check.getName() + " has eatin the " + f.getName()); } else { sender.sendMessage(ChatColor.GREEN + "" + check.getName() + ...
75783e56-6f00-4af5-b2c8-727732db5b6d
9
private DVector determineAllSortedScores(boolean faceUpOnly) { final DVector unsortedScores=new DVector(2); for(int p=0;p<pot.size();p++) { final MOB mob=(MOB)pot.elementAt(p,1); HandOfCards hand=theDeck().getPlayerHand(mob); if(hand==null) continue; // if only the face cards count, we will pull...
652d7189-2963-4dc0-afd2-39bc31f3888a
1
public void Render(Shader shader, RenderingEngine renderingEngine) { for(GameComponent component : m_components) component.Render(shader, renderingEngine); }
f4b12793-33ad-432b-b3c2-a3d911bd2970
1
public void testEra() { assertEquals(1, EthiopicChronology.EE); try { new DateTime(-1, 13, 5, 0, 0, 0, 0, ETHIOPIC_UTC); fail(); } catch (IllegalArgumentException ex) {} }
620185fb-1bb7-4380-9ba1-28be196e2f88
7
public String makeCommand(Object... parts) { if ((parts == null) || (parts.length != parms.length)) return ""; final StringBuilder str = new StringBuilder(toString()); for (int i = 0; i < parms.length; i++) { if (parts[i] == null) return ""; else if (parms[i] == String[].class) {...
540b7d45-923b-4322-a27f-043a7c5af5fa
9
private void buildGameDatabase() { ArrayList<String> goodRoms = new ArrayList<String>(); ArrayList<String> bestRoms = new ArrayList<String>(); ArrayList<String> badRoms = new ArrayList<String>(); TreeSet<String> tmp = new TreeSet<String>(); sortMameExecs(); for (MameExecutable i : mameExecutables) { ba...
32404286-14af-49be-a7d1-a4e315beed0c
2
public File encode(Serializable structure, File file, Map parameters) { try { ObjectOutputStream stream = new ObjectOutputStream( new BufferedOutputStream(new FileOutputStream(file))); stream.writeObject(structure); stream.flush(); stream.close(); return file; } catch (NotSerializableException e...
3a7728ed-0d71-4a36-b3b0-54d62015dbba
8
@Action public void open() { if (!saved) { int option = JOptionPane.showConfirmDialog(this.getFrame(), "Do you want to save changes to your current file?", "Open", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); switch (option) { case JOptionPane.YES_O...
3353164d-5318-45c0-a42a-876662383131
5
@Override public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception { Object msg = e.getMessage(); if (msg instanceof ServiceRequest) { ServiceRequest request = (ServiceRequest) msg; if (request.getId() != ServiceRequest.SERVICE_ONDEMAND) { e.getChannel().close(); } els...
b1eb31c5-6601-49cb-9602-02e4426f5148
0
public TablaClientes() { initComponents(); this.mostrarClientes(); this.setTitle("Listado de Clientes"); }
d3a56153-fcc3-48a6-88ce-1bc318fb556c
0
public void setY(double y) { this.y = y; }
1f017e77-8041-42c1-ad5c-b205afe80e25
8
* @param <code>target</code> the element to remove from the tree */ protected BSTNode<E> remove( BSTNode<E> node, E target ) { if ( node == null ) { // element isn't in the tree : base case - failure return null; } // System.out.println("current node's element = " + node.element ); ...
0de61db6-1ace-4202-80b2-77404ccd6c47
2
public FileProtocol getProtocol(String protocolName) { for (int i = 0, limit = protocols.size(); i < limit; i++) { FileProtocol protocol = (FileProtocol) protocols.get(i); if (protocol.getName().equals(protocolName)) { return protocol; } } return null; }
5bcb8822-e606-4723-ba12-fb7353c7b1de
4
public static void deleteGroupsById(long[] groupids) throws MoodleRestGroupException, UnsupportedEncodingException, MoodleRestException { StringBuilder data=new StringBuilder(); String functionCall=MoodleCallRestWebService.isLegacy()?MoodleServices.MOODLE_GROUP_DELETE_GROUPS:MoodleServices.CORE_GROUP_DE...
15a29a31-ef0d-4ea0-8297-3973a4bc29ed
1
public final void register() { for (PluginListener<T> listener : this.listeners.values()) { listener.register(); } registered = true; }
364bcd5e-af06-48b9-af1d-058d3759db60
9
private void setOutputFormatNumeric() { if (m_Indices == null) { setOutputFormat(null); return; } FastVector newAtts; int newClassIndex; StringBuffer attributeName; Instances outputFormat; FastVector vals; // Compute new attributes newClassIndex = getInputFormat().clas...
74444a7c-9652-478a-8db9-2acb162752e5
3
private ClassST _class(String _package, List<String> imports, String signature, String cname) throws UnexpectedTokenException, SyntaxError { ClassST clazz = new ClassST(ACC.parse(signature), _package, cname); for(String _import : imports) clazz.imports.add(_import); this.expect(LBRACE); this.nextToken(); ...
66061ffa-16ca-46d4-b920-865dd6fe17c1
7
private boolean initialize() { CommPortIdentifier portID = null; Enumeration ports = CommPortIdentifier.getPortIdentifiers(); System.out.println("Trying ports:"); while(portID == null && ports.hasMoreElements()) { CommPortIdentifier testPort = (CommPortIdentifier) ports.nextElement(); System.out.printl...
1456e065-70f7-4a53-b3bb-9d17800a7bc0
9
private int read() throws Exception { this.readBuffer.clear(); int count = this.socketChannel.read(this.readBuffer); this.readBuffer.flip(); if (count > 0) { if (GlobalUtil.SHOW_SYSTEM_OUT) System.out.println(Thread.currentThread().getId() + " Read " + count + " bytes from socketChannel."); this.messa...
ba6cfea4-5615-4c75-9d76-63b515760345
3
public static void main(String[] args) { Array array = new Array(); array.fillArrayRandom(100); //заполняем массив 100 элементами System.out.println(""); Array arrayDouble = new Array(); System.out.println("Двумерный массив 8 x 5"); arrayDouble.doubleDimensions(8, 5); ...
a9f178a3-c80a-476c-9036-a593e0b578a4
8
public BufferedImage read() throws IOException { ImageInputStream iis = ImageIO.createImageInputStream(is); if (iis == null) { throw new IOException("Could not open InputStream."); } Iterator<ImageReader> readers = ImageIO.getImageReaders(iis); if (!readers.hasNext()) { throw new UnsupportedF...
9a21d6f8-5f27-4f6f-9ad1-738552aac86d
7
public static void exitSave(HousePetList hpArray) { /* check whether HousePetList has been modified since start of program */ boolean isSaved = hpArray.isSaved(); //if hasBeenSaved == false: // asks user if they want to save before exiting // if yes: // call ...
d8e23e22-1f5d-4635-b10c-abf8f7292c44
5
public PlayerEditorComponent(GUIComponentGroup superGroup) { super(superGroup); rowsActive = new boolean[Game.MAX_PLAYERS]; for (int i = 0; i < Game.MAX_PLAYERS; i++) { rowsActive[i] = true; } Grid grid = new Grid(6, Game.MAX_PLAYERS*2 + 1); grid.setColumnWi...
357f840a-53fe-4f49-94f9-a86bbade3913
7
private void construirePlanAPartirDeDOMXML(Element elemReseau,ArrayList<Noeud> listeARetourner )throws XmlParserException { try { NodeList listeDeNoeudsXML= elemReseau.getChildNodes(); Node noeudXML= null; ArrayList<Element> listeDesNoeud= listeDesNoeudsFils(elemReseau, "Noeud"); boolean premierTourB...
ce4c9913-4164-4287-9423-d2c62124d723
7
public AcctsRecTransRec get() { String addCode = "A"; String changeCode = "C"; String deleteCode = "D"; AcctsRecTransRec result; if (sc.hasNext()) { line = sc.nextLine(); tokens = line.split("[ ]++"); if (tokens.length == 0 || tokens[0].length() != 1) { ...
7f0317b8-ba21-46a2-9e1f-67043cddd27b
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AssRule other = (AssRule) obj; if (a == null) { if (other.a != null) return false; } else if (!a.equals(other.a)) return false; if ...
0cea9b45-d70f-4aff-b468-6cd65a570d46
3
private static void addRandomGold(WorldMap w, Random r) { boolean valid = false; while (!valid) { int x = rnd(r); int y = rnd(r); if (!(x == 1 && y == 1)) { valid = true; w.addGold(x, y); } } ...
152eef64-499a-4bf4-9a4f-3f7b6da296a5
7
public static int find(int[] input, int start, int end, int key) { if(start > end) { return -1; } int mid = (start + end)/2; if(input[mid] == key) { return mid; } // first half is sorted if(input[mid] >= input[start]) { if(key...
aafc2823-ae32-44aa-ad92-c38043d5c546
4
public void firstAcceptAndTotleCounter() { String s[]; firstNum = 0; try { BufferedReader reader = new BufferedReader(new FileReader(new File("E:\\doc\\"+ username + "_solvedproblem.txt"))); String line = reader.readLine(); line = reader.readLine(); line = reader.readLine(); ...
ad9bf23d-e9d9-4846-bacc-25fc3e3a3a35
2
@FXML private void handleMenuItems(ActionEvent event) { final Node pos = rootPane.getChildren().get(0); if (pos.getId().equals("borderPaneRegister")) { return; } final Region registerItem; try { registerItem = FXMLLoader.load(PosApplication.class.getR...
360c5d7d-07d2-497b-9863-f197b08ab0e2
2
public void vote(boolean up) { System.out.println("Derp: " + this.currentSongID); String vh = sha(this.roomid + (up ? "up" : "down") + this.currentSongID); String th = sha(String.valueOf(Math.random())); String ph = sha(String.valueOf(Math.random())); Object[][] _rq = { { "api", "room.vote" }, { "roomid", thi...
0b4d50db-eb43-48f5-918d-6f30be2271d7
7
public int longestValidParenthesesII(String s) { if (s == null || s.length() < 2) return 0; Stack<Integer> S = new Stack<>(); for (int i = 0; i < s.length(); i++) { if (!S.isEmpty() && s.charAt(i) == ')' && s.charAt(S.peek()) == '(') S.pop(); e...
26cb47e1-adaf-4328-a81c-51fa9913033c
5
public static void main(String[] args){ File archivo = new File("C:\\Users\\AARON\\Desktop\\musica\\Boom Boom (Official Remix) (ElCorilloRD.Com) [Magnate & Valentino Ft J Alvarez & Nova & Jory - ].mp3"); if(archivo != null){ try { System.out.println(archivo.getAbsolutePath()...
70084f6b-5ed5-43bf-a6c4-18b511229bc8
5
@Override public boolean isCorrectlyConfigured() { if (props == null) { return false; } if (!props.containsKey("driver")) { return false; } if (!props.containsKey("url")) { return false; } if (!props.containsKey("username"))...
01d08967-e818-4574-a0a1-0d40db43fab1
3
public void DiscardPackets(int TIME, Queue<RouterPacket> []outputBuffer, int bufferNumber, Event current, PriorityQueue<Event> pQ) { //remove the amount of packets specified to be removed in the //CLASSCONSUMPTIONRATES section of the config file for(int y=0;y<current.GetSequence();y++) ...
14a98642-0e3e-4e5f-ac76-a9d3f85f954e
9
public NodeList readCEWWTitleEntries(String input, String type) throws IOException, CWRCException { List<Title> output = new ArrayList<Title>(); if (!StringUtils.isBlank(input)) { Reader reader = new StringReader(input); int val = 0; StringBuilder builder = new Strin...
7feed209-38ab-4f1b-954d-d82fdaff377b
6
public DateTime add(DateTime dateTime) { int year = this._year + dateTime.getYear(); int month = this._month + dateTime.getMonth(); int day = this._day + dateTime.getDay(); int h = this._h + dateTime.getHour(); int m = this._m + dateTime.getMinute(); ...
093d4949-184d-4f59-894a-3c755a4cf757
3
private void routesComboItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_routesComboItemStateChanged selectedRoute = (String) routesCombo.getSelectedItem(); if(selectedRoute.equals("383")) route = 65; if(selectedRoute.equals("384")) route = 66; i...
1223d66e-3723-4c6f-8cdd-cd7b7346ec03
7
public void sendFirst () { tradeElGamal(true); com.sendTo(1, "elgamal check."); final int n = 4; // rand.nextInt(10)+1; final BigInteger p_a = new BigInteger(52, 100, rand); { BigInteger tmp; do { tmp = new BigInteger(p_a.bitLength()-8...
91f37055-5bd3-4763-a9ff-b011f140233d
8
public void onGetPacket(String packet) { String temp = packet.substring(1,2);//Header byte if (temp.equals("R")) { int firstroll = Integer.parseInt(packet.substring(3, packet.indexOf(":", 3))); int secondroll = Integer.parseInt(packet.substring(packet.indexOf(":", 3) ...
996e32a5-4a7f-4b4a-90fe-03aca2c11ecb
5
public static Vector<String> getTags(File mp3) { try { //System.out.println("Getting tags for file " + mp3.getAbsolutePath()); AudioFile f = AudioFileIO.read(mp3); Tag tag = f.getTag(); Vector<String> song = new Vector<String>(); song.add(tag.getFirst(FieldKey.ARTIST)); song.add(tag.getFirst(FieldKe...
11c60d9f-3b1f-4753-b6a6-c71332640f11
1
public void visitAttribute(final Attribute attr) { checkEnd(); if (attr == null) { throw new IllegalArgumentException( "Invalid attribute (must not be null)"); } fv.visitAttribute(attr); }
2eaf0679-a5fb-4ff1-a164-2873e4c54309
5
public String getNextString() { if ( position < 0 ) return ""; StringBuilder newString = new StringBuilder(); char ch; while ( position < buffer.length() ) { ch = buffer.charAt(position++); if (ch != ' ') newString.append(ch); ...
0a06403a-545b-42a6-abf8-b2afe13275bb
0
public Alloy(long[] params1, double[] params2, int x, int t, String[] hn) { this.initTemps = params1; this.constants = params2; this.threshold = t; stable = 0; updating = 1; this.hostNames = hn; initializeCommonRegions(x); this.size = x; }
39ec28c9-cf43-4cf9-9f9c-81f7771fc30a
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Pos other = (Pos) obj; if (x != other.x) return false; if (y != other.y) return false; return true; }
4cd9b213-1c27-4f83-ade8-b35357a865ad
8
void verifySuspectWithICMP(Address suspected_mbr) { InetAddress host=suspected_mbr instanceof IpAddress? ((IpAddress)suspected_mbr).getIpAddress() : null; if(host == null) throw new IllegalArgumentException("suspected_mbr is not of type IpAddress - FD_ICMP only works with these"); tr...
1d1788a0-434b-4e43-b7b4-539c0b5a34e2
3
private void putBlinds(Dealer dlr, Table tbl) { for (Player plr : players) { if (plr.isSmlblnd()) { plr.postSmlblnd(dlr); //players put the small and big blinds to table }else if (plr.isBgBlnd()) { plr.postBglblnd(dlr,tbl); tbl.setPntOfRaise(players.indexOf(plr)); tbl.setCheck(true); ...
742c26a9-479f-4873-ba8b-e918519ec343
7
protected void redraw() { if (graphic.get() != null) { graphicContainer.getChildren().setAll(graphic.get()); } else { graphicContainer.getChildren().clear(); } path.setFill(backgroundVisible.get() ? (mouseOn && backgroundMouseOnFill.get() != null ? backgroundMouseOnFill .get() : backgroundFill.get()...
36b2cadc-120e-48f7-98d8-9f3c40b4c9bc
8
public SequenceDiagramFileMaker(SequenceDiagram sequenceDiagram, Skin skin, FileFormatOption fileFormatOption, List<BufferedImage> flashcodes) { // HtmlColor.setForceMonochrome(sequenceDiagram.getSkinParam().isMonochrome()); this.flashcodes = flashcodes; this.diagram = sequenceDiagram; this.fileFormatOption ...
a4fc3a3e-e5b0-4d9d-bd41-e9c17e81560a
3
private String convertPath( String path ) { File f = new File( path ); char flag = path.charAt( path.length() - 1 ); if ( path.charAt( 0 ) != '/' ) { String fullPath = f.getAbsolutePath(); fullPath = "/" + fullPath; if ( flag == '\\' || flag == '/' ) { fullPath = fullPath + '/'; } fullPat...
6d5c86ba-67eb-4a3f-b95f-30152cf4e9f6
5
@Override public void mouseReleased(MouseEvent e) { if (!potentialDrag) { return; } source.removeMouseMotionListener(this); potentialDrag = false; if (changeCursor) { source.setCursor(originalCursor); } ...
2cb97d8a-6629-495b-95c0-e5e8c84ec05c
3
public void visitTypeVariable(final String name) { if (type != TYPE_SIGNATURE || state != EMPTY) { throw new IllegalStateException(); } CheckMethodAdapter.checkIdentifier(name, "type variable"); state = SIMPLE_TYPE; if (sv != null) { sv.visitTypeVariable(name); } }
48c433b4-50bd-405a-9810-a6536dfe413c
4
private void calculate(){if(bombadil.nextBoolean()){active = true;}else{active = false;} if(ages){ if(active){ age = bombadil.nextInt(1024);}else{ age = bombadil.nextInt(1024)*-1;} state = agify(age);} else{if(active){state = 1;}else{state = 0;}} }
e859750f-5f29-4d15-80e3-8d44744b5d32
9
private static WireConnection[] removeWire(WireConnection[] currentArray, WireConnection toBeRemoved){ if(currentArray == null || currentArray.length == 0){ return new WireConnection[0]; } if(currentArray.length == 1 && currentArray[0].equals(toBeRemoved)){ return new WireConnection[0]; } int idx = -1; ...
7dc4581c-5eec-4829-bf17-0be03e8258f1
5
private void addDoor(int x, int y) { Transform doorTransform = new Transform(); boolean xDoor = (level.getPixel(x, y - 1) & 0xFFFFFF) == 0 && (level.getPixel(x, y + 1) & 0xFFFFFF) == 0; boolean yDoor = (level.getPixel(x - 1, y) & 0xFFFFFF) == 0 && (level.getPixel(x + 1, y) & 0xFFFFFF) == 0;...
bf6dc6db-677f-40a8-a831-89b978abdbfd
5
public final void spawnDoor(final MapleDoor door) { spawnAndAddRangedMapObject(door, new DelayedPacketCreation() { public final void sendPackets(MapleClient c) { c.getSession().write(MaplePacketCreator.spawnDoor(door.getOwner().getId(), door.getTargetPosition(), false)); ...
d2dc554c-cfb3-4783-a06b-ab7c540afa0c
0
public ImageIcon getImageIcon(String img) { return new ImageIcon(this.getClass().getResource("/img/" + img)); }
5b6d10d1-7212-406f-ac83-b5993e5315fa
5
private void pop(char c) throws JSONException { if (this.top <= 0) { throw new JSONException("Nesting error."); } char m = this.stack[this.top - 1] == null ? 'a' : 'k'; if (m != c) { throw new JSONException("Nesting error."); } this.top -= 1; ...
9a5e6939-e47e-499c-bdb4-3c9c516bc912
5
public boolean collect( File file ) { boolean back = false ; // return value -> default : not loaded // splitt the filename JavaBundleFile firstLoadFile = new JavaBundleFile( file ) ; String suffix = firstLoadFile.getFileExtension() ; if ( suffix.toLowerCase().hashCode() == ".properties".hashC...
9cd79cba-8b49-4a8b-b08f-10b4a2e5ab4b
0
private BitfieldMessage(ByteBuffer buffer, BitSet bitfield) { super(Type.BITFIELD, buffer); this.bitfield = bitfield; }
dd61ee1b-6a80-44f7-a440-7ed0069185f0
8
public boolean containsNearbyAlmostDuplicate(int[] nums, int k, int t) { if (nums.length < 2 || k < 1 || t < 0) return false; ValuePosPair[] valPosArr = new ValuePosPair[nums.length]; for (int i = 0; i < nums.length; i++) valPosArr[i] = new ValuePosPair(nums[i], i); Arrays.sort(valPosArr); for (int i = ...
0284218c-9f94-4aa1-acd7-33c468362029
7
void menu() { Integer option; String s; boolean exit = false; while (!exit) { UI.printHeader(); System.out.println("Selecciona una acción a continuación:"); System.out.println("1) Ver agentes configurados"); System.out.println("2) Añadir un agente"); System.out.println("3) Eliminar un agente");...
b29e1a14-30c7-4767-b448-baca755b0bed
6
public void analyzeCurrentMemoryStatus() { System.out.println("================= Current Memory Status ================="); System.out.println("## Current framework objects"); // analyze framework objects if(!allocatedBuffers.isEmpty()) { System.out.println("| FrameworkObj | InnerObj | bytes | Reason |"); ...
04c8da96-7b9a-4733-8acc-3f9bbada4eee
7
public void start() { if (running) { return; } Log.i(LOG_TAG, "start()"); running = true; executor.execute(new Runnable() { public void run() { try { while (running) { Log.i(LOG_TAG, "Listening for new connections"); Socket socket = serve...
9f8244de-94c1-4c3e-8c1e-947da10bbc8f
3
public boolean validPixel(int i, int j) { return i >= 0 && j >= 0 && i < getWidth() && j < getHeight(); }