method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
92216d31-b462-4ade-a23c-7d09109d5876
2
@Override protected void finalize() { if(m_resource.RemoveReference() && !m_fileName.isEmpty()) { s_loadedTextures.remove(m_fileName); } }
d124078f-fcc8-4c33-a28d-a8161e7c92e4
8
public static boolean search1(int[] A, int target) { int len = A.length; int low = 0; int high = len - 1; while (low <= high) { int mid = (high + low) / 2; if (A[mid] == target) { return true; } if (A[mid] > A[low]) { if (A[mid] > t...
3c541d69-a149-4382-b055-a808fe4220fb
3
public void initialize(){ rankList.clear(); for(int i=0; i <Board.BOARD_SIZE; i++){ Rank rank = new Rank(); if(i == 1) rank.initializeWhitePawn(); else if( i == 6) rank.initializeBlackPawn(); else rank.initializeEmptyPawn(); rankList.add(rank); } }
199563b6-ec56-48a5-88b6-65efc8031aed
2
public int getInt(int index) throws JSONException { Object object = get(index); try { return object instanceof Number ? ((Number)object).intValue() : Integer.parseInt((String)object); } catch (Exception e) { throw new JSONException("JSONArr...
80dc7559-3bd0-4e78-a9cb-942ecf0931a1
7
public String animate(double speedmul) { String ret = getCurrentFrame(); if (running) { phase += speed*speedmul; while (phase >= 1.0) { phase -= 1.0; framenr += increment; if (!pingpong) { if (framenr >= frames.length) framenr -= frames.length; if (framenr < 0) framenr += fr...
27280835-0761-4afb-a831-f73407ddd6b6
6
@EventHandler public void IronGolemPoison(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.getIronGolemConfig().getDouble("IronGolem...
050afaa5-6dae-4f0e-976f-d2faff494df9
1
void toggleForcerSortie(VoieExterne voieDeSortie) { if (destinationForcee == null) { destinationForcee = destination; destination = voieDeSortie; Simulateur.log(this + " sortie forcée vers " + voieDeSortie); } else { destination = destinationForcee; destinationForcee = null; Simulateur.log(this ...
b7efc30f-0a2d-4e03-98ae-f47c10554c2f
4
public static void main(String[] args) { Scanner s = new Scanner(System.in); s.useDelimiter("[, \n]"); for (int i = 0; i < SIZE; i++) { for (int j = 0; j < SIZE; j++) { array[i][j] = s.nextInt(); } s.nextLine(); } ...
ccefa153-3291-44ae-bd82-371b91050496
0
public IOnStringInput getOnStringInput() { return onStringInput; }
e024bcc7-3639-4a81-8903-a558cfc2c898
9
public void server() { ConnectionFactory factory = new ConnectionFactory(); Connection connection = null; try { connection = factory.newConnection(); Channel channel = connection.createChannel(); channel.queueDeclare(RPC_QUEUE_NAME, false, false, false, null)...
4c09bc26-34e4-4874-b7b6-3128b92269bf
3
@Override public void Write(IOClient player, Server server) { Player p = null; if (player instanceof Player) { p = (Player)player; } else return; byte[] final1 = new byte[2]; final1[0] = (byte)0x0f; final1[1] = (byte)(p.getGroup().isOP ? 0x64 : 0x00); try { player.WriteData(final1); } catch ...
9957efe4-98b7-4c57-be79-cddc00b125c6
9
public void update() { time++; if(time % (random.nextInt(50) + 30) == 0) { xa = random.nextInt(3) - 1; ya = random.nextInt(3) - 1; if(random.nextInt(4) == 0) { xa = 0; ya = 0; } } if(walking) { animSprite.update(); } else { animSprite.setFrame(0); } if(ya < 0) { ...
935f910d-28e5-4061-b1e4-ccce693359b9
3
private static void gestionarStock( Tienda tienda) { boolean salir; Integer idMusica, stock; do { System.out.print( "Introduce el Id del producto msica: "); idMusica = Integer.parseInt( scanner.nextLine()); try { System.out.println( "El stock actual de este producto es: " + tienda.getStockMu...
ccb4f557-aebb-44a8-9ac4-ca26bfc440d7
7
public void update() { removeAll(); if (ts == null) return; JPanel prev_w = null; Iterator i = ts.transforms.iterator(); while (i.hasNext()) { Transformation t = (Transformation) i.next(); JPanel p = null; if (t instanceof TransformationRotate) p = new ToolTIRotate((TransformationRotate) t)...
e313eac1-f143-4f80-9d12-9667a0a3b423
6
private static char[] removeFrontZero(char[] number, boolean minus) { int i=0; for(;i<number.length;i++) { if(number[i]!='0' && number[i]!='\u0000') { break; } } if(i==number.length) { return "0".toCharArray(); } number = Arrays.copyOfRange(number, i, number.length); if(minus){ numb...
bf61801c-962e-475e-a04c-5ca471cc9d81
7
public void startInitialPhase(){ int indexOfSet=0; Set<Production> firstSet = new HashSet<Production>(); Vector<String> res = new Vector<String>(); State state = new State(); res.add(grammar.getStartingSymbol()); Production production = new Production("Y", res, 0,0); ...
ec169817-ea90-4cc3-b0af-1a923fda0598
9
private boolean r_Step_4() { int among_var; int v_1; // (, line 140 // [, line 141 ket = cursor; // substring, line 141 among_var = find_among_b(a_7, 18); if (among_var == 0) ...
d29efef0-055a-453e-856e-23ad0edc65bc
3
protected double getNextFailureTimeSample() { double sample; if (failureTimePatternDiscrete_ != null) { sample = failureTimePatternDiscrete_.sample(); return Math.abs(sample); } else if (failureTimePatternCont_ != null) { sample = failu...
94cf7e30-7c93-4933-b84c-d15af7e9cdb4
3
@Override public void run() { isRunning = true; while (isRunning) { try { Thread.sleep(8L); if (network.hasMessageToProcess()) { network.processMessage(network.poll(EnumMessageType.PROCESS)); } } catch (InterruptedException e) { e.printStackTrace(); } } }
1ae73ca2-f72b-486c-a429-785c686f8a1d
3
@Override public Vector<Double> optimise() { assert objectiveFunction != null; int iteration = 0; do{ iteration++; if(iteration == 1){ initiateCandidateSolutions(); }else{ //make genetic operator an object crossover(); mutate(); velocityUpdate.setPosition(position); velocityUpdat...
0c2b6a81-bec9-422f-b7b0-90b6ccedb677
4
private long getCPtrAddRefBidData(BidData element) { // Whenever adding a reference to the list, I remove it first (if already there.) // That way we never store more than one reference per actual contained object. // for(int intIndex = 0; intIndex < elementList.size(); intIndex++) { Object theObject = elementLi...
4ffb666f-4279-40da-890f-3d04433154f0
5
private void checkHit(int aoe) { // Enemy e = (Enemy) getOneIntersectingObject(Enemy.class); List<Enemy> hit = getObjectsInRange(10,Enemy.class); if ( hit.size() != 0 && hit.get(0) == target) { List<Enemy> temp = getObjectsInRange(aoe/2,Enemy.class); for (int...
e078b53a-4d28-4401-ab5f-88a7db38b76f
6
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String username = request.getParameter("username").toUpperCase(); String password = request.getParameter("password"); String sistema = request.getParameter("sistema"); UsuarioDTO usuario =...
ce7b0b5d-a2f2-4916-959d-6f3581147873
6
public synchronized void close() throws IOException { if (serverSocket != null) { if (this.listening) { closing = true; for (int i = clients.size() - 1; i >= 0; --i) clients.get(i).close(); Thread.yield(); while (clients.size() > 0) { Thread.yield(); try { Thread.sleep(50);...
c2384f8e-452b-4ee5-9406-88bbec546cec
8
public void startScatter(DistVector x, Vector y) { if (x.size() != y.size()) throw new IllegalArgumentException( "Vectors must be of the same global size"); // Assemble the arrays to send for (int i = 0; i < comm.size(); ++i) if (i != comm.rank()) ...
0dee3b9f-eb8b-4c67-8c6b-4e3ba54412a8
3
private void doWork() { System.out.println("TemperatureWorker start to work!"); long start = System.currentTimeMillis(); try { TemperatureDao.instance().writeToIniFile(); long end = System.currentTimeMillis(); long period = end - start; System.out.println("TemperatureWorker cost time in millis : " + ...
f63b5c3c-6b11-4ad0-af00-9ee6862a803a
6
public static void main(String[] args) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException { int x = 1000001; int i = 6; boolean prime = false; //Scanner input = new Scanner (System.in); //System.out.println("1\n2\n3\n5"); for (;;) { prime = true; i = x / 2; while (prime =...
59ed25ea-a9c0-468c-a034-d102903e555b
0
public String toString() { return row + "," + col; }
a1ad567f-24ee-4155-ae1e-598754beacef
8
private int binaryToInt8 (BitSet bin) { int total=0; if (bin.get(0)==true) total=total+128; if (bin.get(1)==true) total=total+64; if (bin.get(2)==true) total=total+32; if (bin.get(3)==true) total=total+16; if (bin.get(4)==true) total=total+8; if (bin.get(5)==true) total=total+4; if (bin.get(6)==true) to...
7b932b74-22c2-4f5f-a707-566998e8c8ce
5
public void chcur(Gob cur) { this.cur = cur; GobHealth hlt = cur.getattr(GobHealth.class); fx = null; if (hlt != null) fx = hlt.getfx(); if (cur.highlight != null) { long t = System.currentTimeMillis() - cur.highlight.time; if (t > 5000) { cur.highlight = null; } } ...
77777fbd-bebf-4165-9b21-7be5880327f2
6
public static Map<String, Object> parseObjectToMap(Object obj, Class<?> oc) { Map<String, Object> data = new LinkedHashMap<String, Object>(); Class<?> c = null; try { c = Class.forName(oc.getName()); } catch (ClassNotFoundException e) { LOG.error("未找到类" + oc.getName(), e); } Field[] fields = c.getDecl...
91f9d3c7-762c-4844-9744-911ad3fa4b7f
2
public String toStringVcfNmd() { StringBuilder sb = new StringBuilder(); for (Gene gene : genesNmd) { if (sb.length() > 0) sb.append(','); // Separate by comma double perc = percentOfTranscriptsAffected(gene, transcriptsNmd); VcfNmd nmdent = new VcfNmd(gene, perc); sb.append(nmdent.toString()); } ...
5fb8ce81-4b40-45c0-bebd-c0c28cb175ea
6
private void setData(OMMData data) { switch (data.getType()) { case OMMTypes.ARRAY: { setArray((OMMArray)data); } break; case OMMTypes.RMTES_STRING: { OMMDataBuffer db = (OMMDataBuffer)data; ...
07b2f799-8ea4-42b7-9c6e-d71644f9baae
7
private static BigInteger f(int i, int j) { if( i >= m.length || j >= m.length ) return BigInteger.ZERO; if(mem[i][j] != null ) return mem[i][j]; if( m[i][j] == '#' ) return mem[i][j] = BigInteger.ZERO; if( i == m.length-1 && j == m.length-1 ){ return (m[i][j] == '#') ? (mem[i][j] = BigInteger.ZE...
2e29ec10-a68e-45d0-af3e-1886a78721b8
8
public static boolean isUpgradeable(ItemStack is){ if(!(is.getType() == Material.WOOD_SWORD || is.getType() == Material.GOLD_SWORD || is.getType() == Material.IRON_SWORD || is.getType() == Material.DIAMOND_SWORD))return false; if(is.hasItemMeta()){ ItemMeta im = is.getItemMeta(); if(im.hasLore()){ for(...
dcbe0e2c-6fb6-4201-8c7d-e10c96928fc0
3
void deallocChannel(int channelPtr) { if (HydnaDebug.HYDNADEBUG) { DebugHelper.debugPrint("Connection", channelPtr, "Deallocating a channel"); } if (isDestroying()) { // Ignore if we are destroying. ...
2b57c26a-405b-425b-b185-ff8bec51a6ff
1
private void closeConnection() { System.out.println( "\nClosing connection" ); // setTextFieldEditable( false ); // disable enterField try { output.close(); // close output stream input.close(); // close input stream client.close(); // close socket } // end ...
b13b4ad5-9d93-4351-a48b-a052c9216b1f
6
final boolean runTask() { final Runnable t; synchronized (this.taskPool) { while (this.taskPool.isEmpty()) { if (this.closed) { return false; } try { this.taskPool.wait(); } catch (final InterruptedException e) { this.master.interrupt(); return false; } } ++this.runn...
c2643076-2e98-4626-b936-290514a48cb7
7
@SuppressWarnings({"unchecked", "rawtypes"}) private static void _marshal(Object jaxbObject, Object xml, Map<String, Object> props) { try { JAXBContext context; if (jaxbObject instanceof JAXBElement) { context = getContext(((JAXBElement<?>) jaxbObject).getDeclaredTyp...
1a7760a5-62b1-4e50-be38-2568e58ce49e
9
public static boolean uu(int a, int b, int[][] p) { if (b > 8) { a++; b = 0; if (a > 8) return true; } if (p[a][b] != 0) return uu(a, b + 1, p); int[] uu = new int[10]; for (int k = 0; k < 9; k++) { uu[p[a][k]]++; uu[p[k][b]]++; } int w = a / 3, t = b / 3; for (int k = w * 3; k < w...
2ed533b0-b37a-4fbb-94b4-172417e8a289
7
public static boolean searchStringMatchP(String inputstring, Cons matchlist) { if (matchlist == Stella.NIL) { if (inputstring.length() == 0) { return (true); } else { return (false); } } if (Stella_Object.symbolP(matchlist.value)) { { StringWrapper firstnonwild ...
fcd80c38-2a4e-404c-a90f-768532e65b92
4
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null && line.length() != 0) { int test = Integer.parseInt(line.trim()), v[]; for...
844c95b0-d45f-4aa7-a0f4-9feaa75a6e39
6
@Override public Value find(ArrayList<Unit<Key, Value>> haystack, Key needle) { if (needle == null || haystack.isEmpty()) { return null; } ++numberofCalls; int splitPos = haystack.size() / factor; Key splitKey = haystack.get(splitPos).key; int comparisonR...
688fc216-841f-4798-a91e-244b309ac061
8
public ArrayList<Car> FindCarById(int id){ ArrayList<Car> result = new ArrayList<Car>(); for(int i=0;i<RaceCar1list.size();i++){ if(RaceCar1list.get(i).getId()==id) { result.add(RaceCar1list.get(i)); } } for(int i=0;i<RaceCar2list.size();i++){ ...
97a10262-eeb5-45af-8d4b-2dbbfde7ce1a
9
public static void main(String[] args) { Oak object = new Oak(); while(true) { object.menu(); Scanner scan = new Scanner(System.in); System.out.println("Input menu"); int input = scan.nextInt(); switch(input) { case 1: { object.addOak(); break; } case 2: { obj...
84cf362a-c2ea-4469-9187-f8f1ea812387
0
@Override public void startSetup(Attributes atts) { super.startSetup(atts); }
d48ad2f7-c102-483a-a8ce-829be0d498dd
9
protected static boolean isSuperior( Method A, Method B ){ Class<?> aReturn = A.getReturnType(); Class<?> bReturn = B.getReturnType(); if ( !aReturn.equals(bReturn) ){ if ( aReturn.isAssignableFrom(bReturn) ) return false; if ( bReturn.isAssignableFrom(aReturn) ) return true; } Class<?> aOwner = A....
6cfdd0f1-88cc-4820-b4ac-ff89859d6f67
8
private Component cycle(Component currentComponent, int delta) { int index = -1; loop : for (int i = 0; i < m_Components.length; i++) { Component component = m_Components[i]; for (Component c = currentComponent; c != null; c = c.getParent()) { if (component == c) { index = i; break loop; } ...
79222545-dd5e-466f-88f7-4cffe9e6748c
0
public MyCustomEventApplicationEventMessageConverter(MessageConverter delegate, MapToJsonStringConverter converter) { this.delegate = delegate; this.converter = converter; }
33643ef3-7c9b-4b0d-850d-59c0d2783468
5
private void setChoices(String[] choices) throws IllegalArgumentException { if (choices == null || choices.length == 0) { throw new IllegalArgumentException("invalid choices"); } for (int i = 0; i < choices.length; i++) { if (choices[i] == null || choices[i].length() == 0) { ...
3e83322d-7757-46d3-a085-067c82e343c7
1
private void checkEnabled() { Tag tag = environment.getTag(environment.getActive()); if(environment.tabbed.getTabCount() == 1){ setEnabled(false); } else setEnabled(!(tag instanceof PermanentTag)); }
6f7ee6ec-b12c-47b0-a48f-f1ea311dc247
6
private void usage(String str) { switch (COMMAND.getCommand(str)) { case A: System.out.println("Usage: -a \"filename\""); break; case C: System.out.println("Usage: -c <number>"); break; case F: System.out.println("Usage: -f \"filename\""); break; case H: System.out.println("Usage: -h <hos...
d23cc229-6bd0-4860-b0f5-39af33dce54c
0
public Rook(boolean isWhite, ImageIcon imgIcon) { super(isWhite, imgIcon); this.setIcon(); }
6ab31790-edcf-4d2b-b765-7afd92af1062
0
@Override public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) { calculateEnabledState(e.getDocument()); }
7f1cc402-a63d-40f2-be1b-4f4196d93d28
3
public void logout(String message) { synchronized (channels) { if (!channels.isEmpty()) { // is logged in for (Channel channel : channels) { channel.leave(this); if (message != null) { send(PacketCreator.kick(channel.getName(), message)); } } channels.clear(); saveStats(); ...
573add92-0efb-4ea1-9219-0c7fa44be997
4
public int compareTo(Card card) { if(card.getType() == type) { if(card.getColorType() == colorType) { return 0; } if(card.getColorType() > colorType){ return -1; } return 1; } if(card.getType() > type) return -1; return 1; }
b79fe354-5295-494c-8e9a-8e194cc53a98
5
@Override public void readAllSequence() throws IOException, FileFormatException { String[] s; String[] q; while ((s = seqReader.read()) != null) { q = qualReader.read(); if (q == null) throw new FileFormatException("Quality file is too short"); if (!s[ID].equals(q[ID])) { String error = String.f...
4265b58c-9280-4ab3-a85d-54e9ccb8c978
2
public Table(String tableName, List<String> columnNames) throws DataBaseTableException { this.name = tableName; if (columnNames.size() == 0) { throw new DataBaseTableException("table must contain more than 0 columns"); } this.columnNames = new ArrayList<String>(); f...
7f693d07-09e5-4d62-a4b8-21475f40e2c5
0
public MyCustomEventApplicationEvent(Object source, Map myCustomEvent) { super(source); this.myCustomEvent = myCustomEvent; }
6214220b-b33b-4226-a1d7-5ae9d8e0be49
8
Server() // constructor { /* * the constructor of the server class is basically doing 2 functions * 1) obtaining the ip address of the pc * 2) generating a 4 digit session id * */ serverObj=this; InetAddress i = null; OsCheck.OSType ostype=OsCheck.getOperatin...
b80acd42-17ec-4916-9253-91ec33e81d41
2
public IdentificadorVariavelVetor(String nome, int deslocamento, Tipo tipoElementos, Tipo tipoIndice, int limiteInferior, int limiteSuperior) throws SemanticError { super(nome, deslocamento, Tipo.VETOR); if(tipoIndice != Tipo.INTEIRO && tipoIndice != Tipo.CARACTERE) throw new SemanticError("O tipo do índ...
7f56f57e-240f-47c8-a563-b63e57ea0554
7
public ListNode deleteDuplicates(ListNode head) { if (head == null || head.next == null) { return head; } ListNode cur = head; while (cur != null) { ListNode nextNonDup = this.findNextNonDup(cur); // if(nextNonDup != null){ // if (cur == head) { if (nextNonDup == null) { if (cur == head) {...
dabefcd3-1e21-49ae-93c1-6566e0454458
4
public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; Image image = null; if(random == 0) image = makeImageIcon("/images/Enlightened_Green.png").getImage(); else if(random == 1) image = makeImageIcon("/images/Resistance_Blue.png").getI...
643ed0d3-94aa-4070-9f6f-193c94f093a8
5
public boolean hasCycle(ListNode head) { boolean res = false; if(head == null){ return res; } if(head.next==null){ return res; } ListNode fastP = head; ListNode slowP = head; while ( fastP.next != null ){ ...
47d735d6-14c4-43aa-acf6-222f061b3097
6
public boolean matchesPlan(Plan p) { if (p == null || p.getClass() != this.getClass()) return false ; for (int i = 0 ; i < signature.length ; i++) { final Object s = signature[i], pS = p.signature[i] ; if (s == null && pS != null) return false ; if (! s.equals(pS)) return false ; } ret...
9417f102-fe8f-433f-85ee-bbe1cbd91ff3
8
public ArrayList<Franchise> GetAllFranchises() throws UnauthorizedUserException, BadConnectionException, DoubleEntryException { Statement statment = null; ResultSet results = null; String statString = "SELECT * FROM Franchise WHERE Active = 'Y'"; ArrayList<Franchise> BPL...
56019488-dcbd-45d5-8679-e814e1f44121
7
public UnpublishedWork(UniqueURIGenerator uniqueNumberGen, ArrayList<String> newEntry, AuthorCompiler aC, Publication pub) { super(uniqueNumberGen, pub.getURI()); if(!pub.getExistsInVIVO()) { addType("<http://purl.org/ontology/bibo/Document>"); addTyp...
9b1b8084-9843-4021-837e-2dd77fa9b18d
8
public static void processPageByPagination(String url, String UrlText, boolean ParentUrlContainDiscussionLits, ArrayList<String> exclusionKeyWords, ParsingPostsOnWebPage parsingPostsOnWebPage, WriteToCsvPostsFile writeToPostCSVFile) { Logger.getLogger(Crawler.class).debug("Process page by pagination "+ url+ "...
1076fa2b-00be-46a5-b3ff-ca470d07088f
8
public int getRegisterInt(String register) { switch (register) { case "R0": return 0; case "R1": return 1; case "R2": return 2; case "R3": return 3; case "R4": return 4; case "R5": return 5; case "R6": return 6; case "R7": return 7; } return -1; }
13d8f64f-578a-4e63-b82c-a2039067b2e6
4
private void addSpecial(int blueValue, int x, int y) { if(blueValue == 16) addDoor(x,y); if(blueValue == 1) { player = new Player(new Vector3f((x + 0.5f) * SPOT_WIDTH, 0.4375f, (y + 0.5f) * SPOT_LENGTH)); } if(blueValue == 128) { } ...
741e43ed-bc53-48dd-9bab-9285bc178cdd
1
public static String getHostIP() { String hostIP = ""; try { hostIP = InetAddress.getLocalHost().getHostAddress(); } catch (UnknownHostException uhe) { BmLog.error("Failed to get host IP: ", uhe); } return hostIP; }
6a085227-20e8-4262-9793-0a228f3774ac
4
private void updateFilter(String filterText) { mModel.removeAllElements(); mFilteredEntries.clear(); for(SimpleAutoCompleteEntry entry : mAllEntries) { if(entry.isUsableForFilterString(filterText)) { DisplayPair pair = new DisplayPair(); pair.title = entry.getTitle(); pair.description = entry...
8e57924f-dde1-435b-8c65-04c5d364503a
2
public static Terrain loadTerrain(String filename) throws IOException { Terrain terrain = new Terrain(); BufferedImage bi = ImageIO.read(new File(filename)); for (int i = 0; i < bi.getWidth(); i++) { for (int j = 0; j < bi.getHeight(); j++) { float color = new Color(bi.getRGB(j, i)).getRed(); color /=...
22a2561d-f5c5-4273-bcb2-c45b0656ccf6
6
public static void setSuper(ClassNode node, String superClass) { node.superName = superClass; ListIterator<?> mli = node.methods.listIterator(); while (mli.hasNext()) { MethodNode mn = (MethodNode) mli.next(); if (mn.name.equals("<init>")) { ListIterator<?> ili = mn.instructions.iterator(); while (i...
7c0a6cb9-1dd3-4ee8-a2a6-a6868d88744f
2
public static String xml2json(String xml) { StringReader input = new StringReader(xml); StringWriter output = new StringWriter(); JsonXMLConfig config = new JsonXMLConfigBuilder().autoArray(true) .autoPrimitive(true).prettyPrint(true).build(); try { XMLEventReader reader = XMLInputFactory.newInstance() ...
07eba769-369e-4ad8-adf0-844bb0e5a647
5
public void fadeOutIn( FilenameURL filenameURL, long milisOut, long milisIn ) { if( filenameURL == null ) { errorMessage( "Filename/URL not specified in method 'fadeOutIn'." ); return; } if( milisOut < 0 || milisIn < 0 ) { ...
8fabd32f-8354-43fc-bb94-815c556d08cd
0
public LocalDate getStartDate() { return this._startDate; }
114dde48-f663-4705-b8b8-accfbeb44a46
8
private void expand1(byte[] src, byte[] dst) { for(int i=1,n=dst.length ; i<n ; i+=8) { int val = src[1 + (i >> 3)] & 255; switch(n-i) { default: dst[i+7] = (byte)((val ) & 1); case 7: dst[i+6] = (byte)((val >> 1) & 1); case 6: dst[i+...
cd6febd7-fc43-4db8-8981-739c112c0e3f
9
private void buildBuilders() { StringBuilder importBuilder = new StringBuilder(); StringBuilder hint = new StringBuilder(); for (Class<?> modelClass : this.classesToBuild) { importBuilder.append("import ") .append(modelClass.getName()) .append(";\n") .append("import ") .append(modelClass.get...
8a23f6da-ef0d-4755-8826-3e067de2cf02
3
public void receber(HttpServletRequest request) { String[] acao = request.getParameter("action").split("-"); if (ATUALIZAR.equals(acao[0])) { int indice = Integer.parseInt(acao[1]); Disciplina d = new Disciplina( request.getParameter("curso"+indice), request.getParameter("nome"+indice), reques...
e67e3102-24ae-465f-9227-a10eb3bc6665
4
public Aleatoire(int taille,Gestion g,boolean methode){ //lancement du compteur start=System.currentTimeMillis(); plat=new Plateau(taille); listePolyo=new ArrayList<Polyominos>(); this.g=g; this.methode=methode; //ajout des polyo suivant la taille du plateau passé en parametre switch(taille){ ...
e43c6c2d-f53f-4e09-a095-442fc0d09246
0
public List findByUsername(Object username) { return findByProperty(USERNAME, username); }
a469924d-d753-4970-8ce0-b73202383d7a
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if((mob.isInCombat())&&(!auto)) { mob.tell(L("Not while you're fighting!")); return false; } if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; Physical target=mo...
df736090-cfac-4f32-99bd-9071d6c1bd89
6
public static String translateBack(String back) { StringBuilder builder=new StringBuilder(back); String reverse = builder.reverse().toString(); String result = ""; for(int i=0; i<reverse.length();i++) { Character a = reverse.charAt(i); if(a==' ') {...
3d3f20e5-514f-496b-a8ef-ba95aaa6aabc
3
public void setSeason2(String season2) { if (season2.equals("pre") || season2.equals("reg") || season2.equals("pst")) this.season2 = season2; }
2cde2668-0174-435d-85e3-b39ad188cf7e
3
private void movieTableMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_movieTableMousePressed if(movieTable.rowAtPoint(evt.getPoint()) == -1){ movieModel.fireTableDataChanged(); //purkkaviritys, koska movieTable.clearSelection() //jättää solun valinnan ...
dbcdbbb4-4600-456c-bfaa-65fe89a4ca58
8
private JPanel getRightComponent(boolean b) { JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); if (textField == null) textField = new TextField(); panel.add(textField, BorderLayout.CENTER); textField.setColumns(1...
b7f3c104-c7ec-4645-a463-a4bcf0865d03
8
void loadExcelGazetteer() { try { fileInputStream = new FileInputStream(params.gazetteerFile); try { workbook = WorkbookFactory.create(fileInputStream); } catch (InvalidFormatException e1) { e1.printStackTrace(); } FormulaEvaluator evaluator = workbook.getCreationHelper...
6bb69007-0070-45d5-a030-12cf4a236afb
4
@Override public void catchViewEvent(ViewEvent ev) { Class vClass = ev.getSource().getClass(); if (vClass == WorldTextView.class) { System.out.println("Choose the action that you want to perform. Help => (h) :"); this.observed = 1; }else...
00718ecf-4fba-414b-9de3-1d86516dd9f2
7
public String equals(){ if(operator == null){ return this.numberBuffer; }else{ float operand = Float.parseFloat(this.numberBuffer); this.operand2 = operand; float cal = 0; // +, -, *, / requires two operands if(operator.equals("+"...
9a4cb510-32da-48bc-a8f7-f4d7b059658c
6
public int maxProduct(String[] words) { if(words==null || words.length<2) return 0; int[]arr=new int[words.length]; int[]len=new int[words.length]; for(int i=0;i<words.length;++i){ arr[i]=toInt(words[i]); len[i]=words[i].length(); } int max=0; ...
e0111d4c-2cb9-45c2-8a67-7215ce7ea67c
3
@Override public Ship getNearestTarget() { Ship closest = null; double distance = Double.MAX_VALUE; for (Ship ship : world.getShips()) { if (!ship.isPlayer()) { double newDistance = Math.pow(this.getRect().x - ship.getRect().x, 2) + Math.pow(this.getRect().y - shi...
cd047665-5fb4-497b-a136-8d8106ec3105
5
public org.omg.CORBA.portable.OutputStream _invoke (String $method, org.omg.CORBA.portable.InputStream in, org.omg.CORBA.portable.ResponseHandler $rh) { org.omg.CORBA.portable.OutputStream out = null; java.lang.Integer __method = (java.lang.Integ...
be91788c-f59f-4a47-a196-19a83f958bfd
6
private void start() { // Create property file, at least File file = new File("properties.conf"); try { if (!file.exists()) file.createNewFile(); } catch (IOException e) { e.printStackTrace(); } Properties properties = new Properties(); tr...
8cea980f-4d57-4064-b694-10b3c87191d9
9
public void run(){ boolean running = true; while(running){ Message message = null; try { if(socket.isConnected()){ while((message = ((Message) in.readObject())) != null){ switch(message.getType()){ case TEXT: gameHandler.sendMessage(message); break; case ...
905e739c-72d7-42ba-9443-978b383152c7
2
public void visitGotoStmt(final GotoStmt stmt) { if (CodeGenerator.DEBUG) { System.out.println("code for " + stmt); } genPostponed(stmt); final Block target = stmt.target(); if (target != next) { method.addInstruction(Opcode.opcx_goto, stmt.target().label()); } }
b49c9049-5a83-4fa1-ae00-b1fd5f139bee
0
public NoNextEmailKontaktFoundException(String message) { super(message); }
842b349c-556a-4991-871d-783d0c51e49a
2
private static void parseStyles(Map<String, String> styles, String inlinedStyles) { String[] keyValues = inlinedStyles.split("[,;]"); for(String keyValue : keyValues) { String[] kv = keyValue.split(":"); if(kv.length>1) styles.put(kv[0].trim(), kv[1].trim()); ...
e7b43ebb-aaef-4f5e-afe8-e2081773d578
9
private void processEndPortalEvent(PlayerPortalEvent event) { final Player player = event.getPlayer(); final World fromWorld = player.getWorld(); if (event.getFrom().getWorld().getEnvironment() == Environment.THE_END) { World mainOverworld = null; for (final World world : this.plugin.getServer().getWorlds()...
4ffac476-c30a-4603-b22d-735d0890c88c
5
public void addUsed(int localSlot) { if (usedLocals.get(localSlot)) return; usedLocals.set(localSlot); if (dependent instanceof StackLocalInfo) ((StackLocalInfo) dependent).enqueue(); else if (dependent instanceof JSRTargetInfo) ((JSRTargetInfo) dependent).addUsed(localSlot); else if (depend...