method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
da1dcd67-b69b-4b81-9300-bf9e7af506a4
7
public void func_48708_d() { this.blockRefCount = 0; this.tickRefCount = 0; for (int var1 = 0; var1 < 16; ++var1) { for (int var2 = 0; var2 < 16; ++var2) { for (int var3 = 0; var3 < 16; ++var3) { int var4 = ...
98c6f588-b9f4-4f7a-8fd6-d42e908a760f
8
public static ArrayList<MstxInfo> getMstxRecommend() { ArrayList<MstxInfo> result = new ArrayList<MstxInfo>(); Connection con = DBUtil.getConnection(); PreparedStatement pstmt = null; ResultSet rs = null; try { pstmt = con .prepareStatement("select info_title,info_dis,info_lon,info_lat,a.info_time,a.u...
faff320e-7eb1-43e3-bb6d-98c34a273c30
0
public void setFile(String file) { this.file = file; this.path = assemblePath(this.path_list); }
fd2433e8-6323-4a5f-9b37-a3124f29cfa3
5
public void keyReleased(KeyEvent e){ // int key = e.getKeyCode(); if (key == KeyEvent.VK_RIGHT || key == KeyEvent.VK_LEFT){ acceleration = 0; stance = Stance.forward; img = imgForward; } if (speed == 0){ stance = Stance.nomove; img = imgForward; } if (key == KeyEvent.VK_UP || key == Ke...
65d106a4-d496-412a-bc4d-55a918378ab0
6
public GMLTokenMarker() { super(); schemes.add(new BlockDescriptor(S_DOC_COMMENT, "/\\*(?=\\*)", "\\*/", profile)); //$NON-NLS-1$ //$NON-NLS-2$ schemes.add(new BlockDescriptor(S_BLOCK_COMMENT, "/(?=\\*)", "\\*/", profile)); //$NON-NLS-1$ //$NON-NLS-2$ schemes.add(new BlockDescriptor(S_DOC_LINE_COMMENT, ...
744fbca0-de37-4cf6-bb42-ad6d4aa9ad58
2
public void load(String file) throws UnknownHostException, PersistencyException, FileNotFoundException { RoutingTable routingTable = new RoutingTable(); PersistencyDelegate bootstrapService = new XMLPersistencyService(); bootstrapService.load(file, routingTable); context_.setRoutingTabl...
e47194eb-25a8-49d2-96fc-e45af30a06cf
2
public int indexOf(int[] array, int x){ for (int i =0 ; i < array.length ;i++ ) { if(array[i] == x) return i; } return -1; }
ae246c1d-8af1-473f-bf6f-10903b1b6835
6
public static void main(String[] args) { System.out.print("Enter the array's length\n"); int userNumber = sc.nextInt(); int[] array = new int[userNumber]; for (int i = 0; i < userNumber; i++){ array[i] = r.nextInt(100); } Syst...
7c92b4c5-e0d3-4ea5-9969-d0386454688a
5
private void setup() { try { bom = BookingOptionsManager.getInstance(); } catch (IOException ex) { Logger.getLogger(OptionsGui.class.getName()).log(Level.SEVERE, null, ex); } try { options = bom.getAll(); } ...
21fb4256-d31e-40bf-93a2-589442d137a2
1
private CubeSerializable getPlayerTeamArea(DodgeballPlayer p) { if(p.getTeam() == TEAM_1) { return TEAM_1_AREA; } else { return TEAM_2_AREA; } }
a6e76327-3f49-4264-a90d-efe94f212833
1
public static void update() { for (int i = 0; i < NUM_KEYS; i++) { prevKeyState[i] = keyState[i]; } }
a04a8e2f-38a5-4d0d-8347-0dda07332765
9
public void clear(int v) { // Remove v from the list of vertices if (startVertex == v) { startVertex = vertices[v]; } else { int i = startVertex; while (vertices[i] != v) { i = vertices[i]; if (i == -1) { return; } } vertices[i] = vertices[v]; } vertices[v] = -1; numVertices-...
35a1d672-c130-4620-85af-2c0a48e7a6ff
9
public static JSONObject JSONObjectOfGenomeFromId(JSONArray organizedJson, int id){ int len = organizedJson.length(); int i,j,k,l; JSONObject json = new JSONObject(); boolean ok = false; for(i = 0; i < len && !ok; i++) { JSONArray groups = organizedJson.getJSONObject(i).getJSONArray("groups"); int le...
c8d96790-684c-4f99-a841-110d5dbc23c6
7
private void comandoSenao() { //<senao> ::= “senao” “{“ <lista_comandos> “}” “;” System.out.println("To no Senão"); if (tipoDoToken[1].equals(" senao")) { if (!acabouListaTokens()) { nextToken(); if (tipoDoToken[1].equals(" {")) { i...
c8c39a58-06be-43b4-8cea-fb40da596982
2
public static void closeQuietly(Closeable closeable) { try { if (closeable != null) { closeable.close(); } } catch (IOException ioe) { // ignore } }
cd8ba1c9-b116-4d77-b7bb-6bd3664227ca
6
public Color(double iR, double iG, double iB) { R = iR < 0 ? 0 : iR > 1 ? 1 : iR; G = iG < 0 ? 0 : iG > 1 ? 1 : iG; B = iB < 0 ? 0 : iB > 1 ? 1 : iB; }
f92e59b5-1968-489a-bd8c-e5c684f8da19
7
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void handleHangingEntities(HangingBreakByEntityEvent event) { if (!(event.getRemover() instanceof Player)) return; Player player = (Player) event.getRemover(); User user = EdgeCoreAPI.userAPI().getUser(player.getName()); ...
47a1dd69-7d3b-499a-ae41-cb7aac2fd975
2
@Override public void displayHistory(List<PlayerAction> AllActions, List<PlayerAction> ReleventActions) { final String newline = "<br>"; String HistoryText = "<html>"; for(PlayerAction Action : ReleventActions){ HistoryText += Action.print() + newline; } HistoryText += "</html>"; String CompleteTex...
281784e8-3056-450f-9e88-5148321f68d8
0
public static void main(String[] args) { // Working with Stacks Stack<String> pez = new Stack<String>(); pez.push("Candy 1"); pez.push("Candy 2"); pez.push("Candy 3"); pez.push("Candy 4"); String candy4 = pez.pop(); String candy3 = pez.pop(); System.out.println(candy4); System.out.printl...
5d342456-f404-499d-8ff0-58e5a2d37479
4
private void capture( Unit unit, State state ){ state.setProvLoyalty(unit.getLoyalty()); state.setInCapture(true); Turn.addEvent(new com.nasser.poulet.conquest.model.Event(1, state.getProductivity() , state, new Callback<State>(){ public void methodCallback(State state) { ...
fbc99cfc-cc7c-445a-aa29-9d064f884710
6
@Override public void onMessage(String channel, String sender, String login, String hostname, String message) { for ( IRCMsgResponse response : mResponses ) { if ( response.canHandleMessage(sender, message) ) { response.handleMessage(sender, message); List<String> replies = response.getReplies(...
7ffe460d-27bf-46ba-9ad6-7ee66160f041
7
public static String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String string = Double.toString(d); if (string.indexOf('.') > 0 && string.indexOf('e') < 0 && ...
04132079-4c34-4a99-be41-08d12a79ffc8
1
public void DBWrite(String[] insert) { try { Date d1 = null; Date d2 = null; d1 = form.parse(insert[5]); d2 = form.parse(insert[4]); long t = d1.getTime() - d2.getTime(); Date dt = new Date(); dt.setTime(t); //System...
ea3047cc-dd66-4c4e-92f3-0d14aa572ac9
3
private boolean promptSaveState() { DisplayState state = this.constructDisplayState(); if(state.equals(study.getDisplayState())) // Don't warn if nothing to save. return true; //Custom button text Object[] options = {"Yes", "No", ...
8ac2f35a-9788-4982-af5a-064bb9938558
1
public void setMovie(Movie movie) { if (movie == null) { throw new NullObjectInsertionException(); } this.movie = movie; }
e6a5b3bf-cde7-4e81-a0a4-c361dd5a8e0c
4
public static Map initMap(Map newPopMap){ Map newMap = null; for(int i=0; i<=newPopMap.populationDensity; i++){ newMap = populateMap(newPopMap); } for(int i = 0; i<= newMap.tileMap[0].length-1; i++){ for(int c = 0; c<= newMap.tileMap.length-1; c++){ if(newMap.tileMap[c][i] == null){ newMap...
8f48b1ec-cf45-4967-a678-d42694476d68
5
private static void findEnemyFlag(Board b) { int row, col; row = enemyHQL.getRow(); col = enemyHQL.getCol(); // if it is certain that enemy flag is on the left if (b.getPiece(row, col).getRank().equals(Rank.Flag) && !b.getPiece(row, col).getOurSide()) { ene...
127adcb2-905d-40a2-a762-3e4e3be7efaa
5
public static int parseTime(String format) { // Parses XhYm format and turns it into seconds int total = 0; if (!format.matches("[0-9]*h?[0-9]*m?")) return -1; if (format.matches("[0-9]+")) return (Integer.parseInt(format)) * 60; if (format.matches("[0-9]+m")) return (Integer.parseInt(f...
215209d8-99de-437f-9f11-3ca21bb28406
5
private List<SplitCell> detectPotentialSplit(double[][] costs, int[] assigns, SegmentedImage A, SegmentedImage B, double ep){ List<SplitCell> result = new ArrayList<SplitCell>(); for(int i = 0; i < costs.length; i++){ List<ProcessedCell> temp = new ArrayList<ProcessedCell>(); if(assigns[i] == -1) continue; ...
aae3a710-0096-4b29-9f99-639c7ffbef5a
6
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (!sender.hasPermission("under50.teleport")) { sender.sendMessage(ChatColor.RED + "No access"); return true; } Player who, toWhom; if (args.length == 1 &...
e7b80ae6-a75a-42f4-82b4-3f815ebd698d
6
public static final void charSelected(final SeekableLittleEndianAccessor slea, final MapleClient c) { final int charId = slea.readInt(); final String macs = slea.readMapleAsciiString(); if (loginFailCount(c) || !c.login_Auth(charId)) { c.getSession().close(); return; ...
7fb15f56-3488-400c-860a-86346e46c2fe
9
public static void print_array (int n, int[] Arr_1, int[] Arr_2) { if ( n < 6 ) { for (int i = 0; i<n; i++) { System.out.println (Arr_1[i] + " " + Arr_2[i]); } } if ( n >= 6 && n != 10) { for (int i = 0; i<5; i++) { System.out.println (Arr_1[i] + " " + Arr_2[i]); ...
0d6b11ca-9219-40ce-ab38-f3a3e29e256c
5
@Override public Object getValueAt(int rowIndex, int columnIndex) { switch (columnIndex) { case 0: return ((Invoice) data.values().toArray()[rowIndex]).getNumber(); case 1: return ((Invoice) data.values().toArray()[rowIndex]).getClient().getSortKey(); ...
e4cad11a-6736-452c-b8ce-b3668369721c
4
private byte[] checkUserPassword( byte[] userPassword, byte[] firstDocIdValue, int keyBitLength, int revision, byte[] oValue, byte[] uValue, int pValue, boolean encryptMetadata) throws GeneralSecurityException, EncryptionUnsupportedByProductExcepti...
d89d3596-c7c1-4e1c-a478-9ef234bbac91
4
protected String getStatus() { StringBuilder buf = new StringBuilder(); buf.append("Turns left: ").append(turns).append("\n"); for (int i = 0; i < map.length; i++) { for (int j = 0; j < map[i].length; j++) { buf.append(map[i][j].toString()); } ...
56cd673d-bd34-4a5c-b0b9-40406cdfb321
2
public void waitForClientToStart() throws IOException { while (true) { String msg = inStream.readLine(); if ("START".equals(msg)) { break; } } }
d90ad278-bd17-408e-993a-6dec1b109fff
9
public void syncDatabase(int syncType, String syncData, HttpServletResponse response) { try { if(syncType == SyncTypes.SYNC_TRANSACTION) { // IF TRANSACTION IS SYNCED THEN RUN THE DATA QUERY IN THE SERVER TABLES new WriteBase().execute(syncData, new Object[]{}); sendResponse(response, Boolean.TRU...
c220fa20-a564-42b7-8eed-0ba2047724e3
2
public String getPasswordByUID(Statement statement,String phonenumber)//根据用户名获取密码 { String result = null; sql = "select password from Users where phonenumber = '" + phonenumber +"'"; try { ResultSet rs = statement.executeQuery(sql); while (rs.next()) { result = rs.getString("password"); } } ...
3ece564b-660e-4a69-ae82-c7b355627a67
7
public static String doubleToString(double d) { if (Double.isInfinite(d) || Double.isNaN(d)) { return "null"; } // Shave off trailing zeros and decimal point, if possible. String string = Double.toString(d); if (string.indexOf('.') > 0 && string.indexOf('e') < 0 ...
dfa36f2f-e3ba-4717-b85c-3e88c44e2c63
1
public void incrementRound(Player roundWinner) throws IOException{ // Round complete, add a score to the winner clock.stop(); roundWinner.setScore(roundWinner.getScore() + 1); if(roundWinner.getScore() < maxScore){ // continue playing roundCount++; set...
489d3990-0536-4490-b8da-88bd5bcce5f5
6
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof Cell) { Cell<?> other = (Cell<?>) obj; return getRow() == other.getRow() && getColumn() == other.getColumn() && Objects.equal(getValue(),...
253ce1ed-85ad-40aa-96b3-c5e50c30e0b0
7
@Override public void run() { Elevator elevator = null; while (elevator == null) { if (this.currentFloor > this.requestedFloor){ elevator = this.building.CallDown(currentFloor); } if (this.currentFloor < this.requestedFloor){ elevator = this.building.CallUp(currentFloor); } } synchronized(...
71784cba-c7cd-4f04-8953-a3e097112fd5
6
private static void offerAction() { println( "Now, choose what to do." ); println( "(d)isplay all urinals, (o)ccupy urinal, (s)hake at urinal, (q)uit game: " ); while( true ) { print( "Action: " ); String input = scanner.next(); if( input.equalsIgnoreCase( "d" ) ) { displayAllUrinals(); } else if(...
27636285-4555-40d2-9eea-7c9a2e4d78d7
7
private void doSend(final CEMILData f, final KNXnetIPConnection.BlockingMode m, final boolean positiveConfirmation) throws KNXTimeoutException, KNXConnectionClosedException { l.received = null; t.send(f, m); if (m == noblock) { while (t.getState() == ConnectionBase.ACK_PENDING) try { Thread.sleep...
981bfb55-f47e-463b-9a97-45646869a539
3
public int getLargestSequence(int[] input) { int sum = 0; int maxSum = 0; for (int i = 0; i < input.length; i++) { sum += input[i]; if (maxSum < sum) { maxSum = sum; } if (sum < 0) { sum = 0; } } return maxSum; }
a188c817-af34-4766-bee0-f762b2c01279
0
public String getMyUsername() { return ClientFinder.getInstance().getUsername(); }
3d7aca07-de5a-478d-b24d-6ccd05e680da
5
private void loadPropFile() { try { BufferedReader br = new BufferedReader(new FileReader(pf)); for (String s = ""; (s = br.readLine()) != null;) { String[] p = s.split(":"); if (p[0].equals("name")) { name = p[1]; ServerGame.logger.info("Name set to " + name); } else if (p[0].equals("por...
ed97fd7f-b494-4351-88a9-e693bc889db5
8
public void init() { if (inited) { return; } Log.info("Initialising sounds.."); inited = true; AccessController.doPrivileged(new PrivilegedAction() { public Object run() { try { AL.create(); soundWorks = true; sounds = true; music = true; Log.info("- Sound works"...
f107ae51-922d-4503-b816-c0ac75100d22
0
public void setStandardDeviation(int standardDeviation) { this.standardDeviation = standardDeviation; }
6d8fac3f-9db0-4888-9bb6-913323af86eb
5
public static void doSearch(final Environment env, final String outFileName, final long endTime) { // Create a new search and attempt to do our setup Search search = new Search(env, endTime); search.setup(); if (search.getSolveable()) { // If we haven't already exceeded the time limit... if (System.c...
ae899cab-ebfc-4bff-acf5-9814412f7fa4
8
public void setCle(String s){ cle = s.toLowerCase(); for(int i=0 ; i<cle.length() ; i++) if(((int)cle.charAt(i) < 97 || (int)cle.charAt(i) > 122) || (cle.indexOf(cle.charAt(i)) != cle.lastIndexOf(cle.charAt(i)))) cle = ""; if(!s.equals("")){ for(int i=0 ; i<cle.length() ; i++) referenceCle[i] = cle...
8e33dd5b-c5a0-4c03-b10a-9385a159a5e8
1
private JPanel createGeneralSettingsPanel() { JPanel jp = new JPanel(); jp.setBorder(default_border); BoxLayout bl = new BoxLayout(jp, BoxLayout.PAGE_AXIS); jp.setLayout(bl); JPanel ip; // inner panel used for layout. ip = new JPanel(); ip.add(new JLabel("Font Smoothing")); ...
69a27c3b-656c-4763-a2af-9b79613aa8e7
6
@Override public void commit() { for(Entity entity: entities.keySet()) { switch(entity.getState()) { case Changed: entities.get(entity).persistUpdate(entity); break; case Deleted: entities.get(entity).persistDelete(entity); break; case New: entities.get(entity).persistAdd(e...
184268a4-4686-43a9-87f1-a2ca8d5f8f05
2
public static BufferedImage loadSplashImage(String path) { BufferedImage splashImage = null; try { splashImage = ImageIO.read(new File(path)); } catch (IllegalArgumentException e) { // TODO if no file found e.printStackTrace(); } catch (IOException e) { // TODO other problems e.printStackTrace();...
13f982cf-c0ca-4bc2-b6a9-6a0c32a20bce
0
public String getName() { return this.name; }
4bb36b19-afe3-40c5-8a04-52fc8e701443
0
public void setWidth(double width) { this.width = width; }
4e24733f-ae62-4791-87bd-16051822bf29
7
public float getCurrentLevel() { switch (state) { case ATTACKING: lerpProgression = (System.currentTimeMillis() - triggerTime) / (float) attackDuration; if (lerpProgression >= 1) { state = ADSRStates.DECAYING; triggerTime = Syst...
ee095a3d-4768-4322-962a-e0aec5c88c19
5
public static void main(String[] args) throws Exception { //System.err.println("ARGS:"+Arrays.toString(args)); for (String key : System.getenv().keySet()) { System.out.println(key + " " + System.getenv(key)); } Map<String, List<String>> argsMap = prepareArgs(args); if...
fab04009-e106-4cee-a12e-cae93238f0b5
4
private String resolve(String str) { if (str != null && str.contains("${")) { Matcher ma = null; while ((ma = varPattern.matcher(str)).find()) { String key = ma.group(1); String val = get(key); if (val == null) { ...
748d0986-fba1-4187-ade2-f0d6ea2ce7df
6
@Override public void run() { while (true) { try { Thread.sleep(300); } catch (InterruptedException e) { LOG.info(this.toString() + " was interrupted"); } Integer smallestValue = philosophers.get(0).getMealsAmount(); for (Philosopher p : philosophers) { if(p.getMealsAmount() < smallestVal...
070b2f24-b3b7-4b24-9f92-a9389376c078
0
@Override public String toString() { return "Skill [skillName=" + skillName + ", skillId=" + skillId + "]"; }
2e19210e-f3f1-4a71-9ae1-24d18f4c47c0
9
protected static boolean isOurCanvas(String name) { return name.equals("draw.Canvas") || name.equals("idraw.Canvas") || name.equals("adraw.Canvas") || name.equals("funworld.Canvas") || name.equals("impworld.Canvas") || name.equals("appletworld.Canvas") || name.equals("javalib.worldcanvas.WorldCanvas") ...
78104a92-b714-4f91-af8e-befebfb2d01b
0
public int getIdDetalle() { return idDetalle; }
a81c9bcc-5945-4f1b-9c87-02f35415c950
5
@Override public Color[][] getColors(double[][] heightmap, boolean[][] watermap) { Color[][] c = new Color[calc.length][calc.length]; for (int x = 0; x < heightmap.length; x++) for (int y = 0; y < heightmap[x].length; y++) if (watermap[x][y]) if (calc[x][y] <= 0.1) c[x][y] = Color.cyan; else...
60e137fd-f6ec-4c5f-9d8c-770352bfe55a
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...
45c9b1e9-4b87-4cee-b8ba-aebd3d2b1e7d
5
public static void countRight2(ArrayList<Integer> list, TreeNode node, String s){ if(node == null ) return; StringBuilder sb = new StringBuilder(); sb.append(s); while(node != null){ sb.append(String.valueOf(node.val)); if(node.right == null && node.left == null){ list.add(I...
63fad4e1-a550-4f99-a54b-1ecf76fbbcfa
5
private void configureSpawnRequest(GameObjectSpawnRequest spawnRequest) { int uid = 0; int id = -1; int type = 0; int face = 0; if (spawnRequest.objectType == 0) uid = worldController.getWallObjectHash(spawnRequest.x, spawnRequest.y, spawnRequest.z); if (spawnRequest.objectType == 1) uid = worldC...
453172f3-608f-4291-9624-23026223d63d
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Estado other = (Estado) obj; if (estFinal != other.estFinal) return false; if (inicial != other.inicial) return false; if (nome == null...
32c6cf6e-fddc-4d66-ac0b-a7cc7bb0f5e0
4
private int wordstart(int from) { while((from > 0) && !wordchar(line.charAt(from - 1))) from--; while((from > 0) && wordchar(line.charAt(from - 1))) from--; return(from); }
ac30d29c-8a38-4e5a-9dd1-3edd09075523
8
boolean contains(float inX, float inY) { float frontFace; if (face == FACE_CURVY) frontFace = 2; else frontFace = 1; if (orientation == Orientation.X) { return (inY >= y0 - frontFace && inY <= y0 + 1 && inX > x0 && inX < x0 + 2 + spineLength); } e...
66679908-5226-4266-8e1f-75b8d8d188f2
3
@Override protected void done() { NameData[] nd = null; try { nd = this.get(); } catch(Exception e) { ptm.updateStatus(spContainer, "Data Error!"); } if(nd != null && nd.length > 0) { ptm.updateStatus(spContainer, "Ready!"); fc.addResult(nd[0].getMediaName(), nd, crawledData); } el...
8b6807c1-533b-4b02-9e4e-7d1c4a139892
6
public static Entry wrapSrampArtifact(BaseArtifactType artifact) throws URISyntaxException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException { // TODO leverage the artifact->entry visitors here Entry entry = new Entry(); if (artifact.getUu...
f6ac0cfb-db96-49d1-9955-528b3817515b
4
public JSONWriter key(String string) throws JSONException { if (string == null) { throw new JSONException("Null key."); } if (this.mode == 'k') { try { stack[top - 1].putOnce(string, Boolean.TRUE); if (this.comma) { this...
2cc36c15-5f60-4520-ac6d-289f7045ef42
3
@Override public void run() { ++elapseTime; if (state == EnumStopWatchState.RUNNING) { ++tick; } log.info("stopwatch state:" + state + ", elapseTime:" + elapseTime); if (listener != null) { if (date == null) { date = new Date(); } date.setTime(System.currentTimeMillis()); listener.countdow...
296c49bf-0e2c-47a8-a0d9-3a492f2a28e7
7
public static void printCompanyDataToFile(String file, Company company) { BufferedWriter output; FileWriter streamFiles; try { streamFiles = new FileWriter(file, true); output = new BufferedWriter(streamFiles); if(ReadFromFile.getNumberFromFile(file) < 2) { for(int i = 0; i < 9; i++) { if(i!= 8)...
ceb588f6-bca4-4242-aab7-481b231e34cb
2
public static boolean isSorted(double[] input) { for (int i = 1; i < input.length; i++) { if (input[i-1] > input[i]) { return false; } } return true; }
bbe69893-7f58-4abb-9dd1-ef17bf76cbdf
2
public List<Seance> getSeances() { List<Seance> seances = new ArrayList<Seance>(); Seance tempSeance; int tempIndex; for (Ticket ticket : tickets) { tempSeance = ticket.getSeance(); tempIndex = seances.indexOf(tempSeance); if (tempIndex == -1) { seances.add(tempSeance); }...
c7acba64-3210-4cd2-bd09-8f297d827ad6
5
public void printTop(String type) { if(type.equals("blank")) { System.out.println(); System.out.println("Type 'get help' for help and instructions."); System.out.println(); } if(type.equals("help")) printHelp(); if(type.equals("win")) { System.out.println(); ...
5ba754f8-8362-43f8-9202-536580c70d51
4
@Override public void mouseReleased(MouseEvent e) { if (graphComponent.isEnabled() && isEnabled()) { Iterator<mxCellHandler> it = handlers.values().iterator(); while (it.hasNext() && !e.isConsumed()) { it.next().mouseReleased(e); } } reset(); }
3674995d-d1e0-46ce-8b09-c6015e4ad453
5
public static String matchMovieFromRT(String jsonResponse, Movie movie) throws JSONException { JSONObject jsonObject = new JSONObject(jsonResponse); JSONArray jsonArray = jsonObject.getJSONArray("movies"); for (int i = 0; i < jsonArray.length(); i++) { JSONObj...
117ff563-7bfc-43ad-a094-5c05d326e976
8
public static boolean isConflict(ConclusionType ct1, ConclusionType ct2) { if (DEFINITE_PROVABLE.equals(ct1) && DEFINITE_NOT_PROVABLE.equals(ct2)) return true; if (DEFINITE_NOT_PROVABLE.equals(ct1) && DEFINITE_PROVABLE.equals(ct2)) return true; if (DEFEASIBLY_PROVABLE.equals(ct1) && DEFEASIBLY_NOT_PROVABLE.equals...
ad348de7-5697-4f8d-9cca-64503d196c8a
5
public Method getBestMethod(Object receiver, String methodName, Class<?>[] parameterTypes) { Class<? extends Object> c = receiver.getClass(); while (c != null) { try { return c.getDeclaredMethod(methodName, parameterTypes); } catch (NoSuchMethodException e) { } catch (SecurityException e) { } ...
2f901ebc-8f51-40bd-87a6-e27f29ef1f51
6
private static double removeCommonDigit(int numerator, int denominator) { int numDig1 = numerator / 10; int numDig2 = numerator % 10; int denDig1 = denominator / 10; int denDig2 = denominator % 10; if (numDig2 == 0 && denDig2 == 0) return -1; if (numDig1 == denDig1) return ((double) numDig2) / denDig2...
9a859106-7991-4a5b-80a2-234034cfb408
2
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed if(!cdb.getText().isEmpty()){ Administrador.Buscar adbc = new Administrador.Buscar(); adbc.setVisible(true); } else{ if(!idb.getText().isEmpty()...
b4ab480f-40f5-42d8-a24f-2a7b5c1c0fb4
0
public String poprawOsobe(){ return "dodaj"; }
a6ca65b0-1d72-4806-bccb-edc8f7578809
4
int checkHours(RoomScheme chromo, int code){ int counter=0; int auxCounter=0; for(int a=0; a<5; a++){ for(int b=0; b<6; b++){ if(chromo.rooms[a][b].getCode() == code){ auxCounter++; if(auxCounter > 2){ counter--; } ...
5cc7547a-1888-4974-9e3e-dbb9c5277b02
1
public static int getInt(CSProperties p, String key) throws ParseException { String val = p.get(key).toString(); if (val == null) { throw new IllegalArgumentException(key); } return Integer.parseInt(val); }
76add281-d698-4e54-822d-e1087a7249f7
7
public static float[][] getFirstCenter(float[][][] p, int cluster, int min, int max) { int k = max - min + 1; float temp[][] = new float[k][p[0][1].length + 1]; // cluster centroid,the first dimension is index float dis[][] = new float[p.length][p.length];// distance of samples float maxdis = 0;// maximum di...
429ee2fd-0422-4f9b-8647-44019b3cfeca
2
private void create(String initialValue, Color bg, String title, boolean addTransparentBtn) { setPreferredSize(this.preferredDim); if (title != null) { setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(title), BorderFactory.createEmptyBorder(5,...
c8e63f19-9102-4658-900c-6d9ee67f3519
1
public static void main(String[] args) throws JDOMException, IOException { SAXBuilder saxBuilder = new SAXBuilder(); File file = new File("D:\\Java SE\\src\\xml\\jdom\\file.xml"); Document document = (Document)saxBuilder.build(file); Element node = document.getRootElement(); Lis...
5c9e87f7-d6b9-48a2-9862-607da4f2399b
4
private static HashMap<Integer, Integer> generateListOfPrimes(Integer NumberofPrimes) { HashMap<Integer, Integer> HashMapofPrimes = new HashMap<Integer,Integer>(); HashMapofPrimes.put(1,2); HashMapofPrimes.put(2,3); for (int i = 4; i < NumberofPrimes; i++) { setDividibleBySomething(false); primInteger = i...
11dd8e22-d1d8-4e6b-ba8a-1ad13d0e6651
7
@Override public int[] sort(int[] target, boolean asc) { int length = target.length; int gap = length / 2; if (asc) { do { for (int i = 0; (i + gap) < length; i++) { int tmp = target[i + gap]; if (target[i] > tmp) { target[i + gap] = target[i]; target[i] = tmp; } } gap...
b758e932-b8f6-4dba-902c-1f4aef455d8f
8
@Override public void run() { try { System.out.println( "Client has connected" ); if( client_num == FIRST_CLIENT ) { serverLock.lock(); try { while(...
25fa019d-78aa-4598-839e-4abd2516a255
5
public JView getViewByTitle(String title) { if (title == null || title.trim().length() == 0) return null; load(); if (views.size() == 0) return null; for (JView view : views) { if (title.trim().equalsIgnoreCase(view.getDisplayName())) return view; } return nul...
16392fb4-8b26-4640-851f-652e534fa4e6
9
public void luoKaydytRuudut(JPanel paneeli, Labyrintti l, Pino polku) { for (int j=0; j<this.koko; ++j) { for (int i=0; i<this.koko; ++i) { boolean lahto = false; boolean maali = false; boolean kayty = false; boolean path = false; ...
c80fe34e-44ec-4c13-bbe3-9277ef949a15
3
public void setDestination(Teleporter destination) { if (destination == null || destination.position.equals(position)) throw new IllegalArgumentException("The given Teleporter is invalid!"); if (this.destination != null) throw new IllegalStateException("Destination is already set!"); this.destination ...
269fa23d-3dbe-48b4-a827-b507d6dd7d95
8
public void terminal() { try { run(); InputStreamReader isReader = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(isReader); System.out.print(">> "); String command = br.readLine(); while (true) { if (command.startsWith("detect ")) { St...
b4b5e4b9-1216-453d-968e-6d076ad4d677
7
public <V> Adapter.Setter<V> makeSetter(String methodName, Class<V> _class) { try { final Method method = version.getClass().getMethod(methodName, _class); return new Adapter.Setter<V>() { public void call(V value) { try { Transaction me = Thread.getTransaction(); ...
174e4b53-98e5-458c-8dc0-d94fcbea4850
5
public double getValue(double x) { if (len.length == 0) { return Double.NaN; } if (len.length == 1) { if (len[0] == x) { return pos1D[0]; } else { return Double.NaN; } } int index = Arrays.binarySearch(len, x); if (index > 0) { return pos1D[index]; } index = - (...
ec289aee-a380-4225-b05f-c855d7a58efa
3
private int num(int n){ if(n==1) return 1; int cnt=0; int max=n; for(int i=1;i<max/2;++i){ if(n%i==0){ cnt+=2; max=n/i; } } return cnt; }