method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b2eccfdd-650c-4104-96a0-3d45f0b51a3f
4
public boolean continueStream() { if( this.eoiReached || this.isClosed ) return false; if( this.stopMarkReachedIndex == -1 ) return true; for( int i = this.stopMarkReachedIndex; i >= 0; i-- ) { // true means: override EOI // because: the underlying stream(s) returned -1 because a stop mark ...
69f10d39-58cd-44b2-a54c-42cfa75a6983
4
@SuppressWarnings("unused") private boolean canReachForwards( Node from, Node to, int version ) { while ( from != null && from != to ) { Arc a = from.pickOutgoingArc( version ); if ( a.versions.cardinality() != 1 ) return false; if ( from != null ) from = a.to; } return from == to; }
3a54c62b-72cf-4e45-bbc2-4746b5b40e17
5
private String createInsert() { StringBuilder sb = new StringBuilder(); sb.append( "\n" ); sb.append( TAB + "<insert id=\"create\" parameterType=\"" + table.getPackage() + ".domain." + table.getDomName() + "\">\n" ); // if the 1st column does not have: sequence disabled...
6134c501-7254-469f-9d3b-1d7b272782ca
7
private static void loadPackedNPCCombatDefinitions() { try { RandomAccessFile in = new RandomAccessFile(PACKED_PATH, "r"); FileChannel channel = in.getChannel(); ByteBuffer buffer = channel.map(MapMode.READ_ONLY, 0, channel.size()); while (buffer.hasRemaining()) { int npcId = buffer.getShort() & ...
54b8dc5b-dc85-427c-9b74-e09598c8942c
5
@SuppressWarnings ("unchecked") protected final void append(final BaseItem item) throws NullPointerException, IllegalArgumentException { switch (item.state()) { case Item.CREATE_STATE: case Item.REMOVE_STATE: case Item.UPDATE_STATE: if (!this.equals(item.pool())) throw new IllegalArgumentException(); ...
b8394f7d-046e-4a4e-ae24-61c4a289b0de
5
public void move(long time) { if (list.size() > 0) { for (Message message : list) { message.move(time); } for (Message message : list) { if (message.state == DeliverState.delivered) continue; if (message.stat...
b7c18d88-797d-4c16-a3cb-493bdfb50044
1
public static void main(String[] args){ Base game = new Base(); if(!windowed){ game.frame.setExtendedState(JFrame.MAXIMIZED_BOTH); game.frame.setUndecorated(true); } game.frame.setResizable(false); game.frame.setTitle(game.title); game.frame.add(game); game.frame.pack(); game.frame.setDefaultClose...
ae7bff6a-cc4c-41b2-b717-acefe3a8e219
0
public int getIdTpv() { return idTpv; }
35f84a61-d9ee-45b5-a232-7710c91d8236
8
@Override public boolean equals(Object obj){ if (obj == null || getClass() != obj.getClass()){ return false; }else{ final EnsEtat other = (EnsEtat) obj; if(this.isEmpty() && other.isEmpty()) return true; for(Etat etat : this){ if(other.getEtat(etat.hashCode()) == null) return false; } for(E...
7247b254-f7c6-438f-9e8d-52a989d2045c
6
public static ArrayList<LinkedList<TreeNode>> level(TreeNode root) { if (root == null) { return null; } int level = 0; ArrayList<LinkedList<TreeNode>> result = new ArrayList<LinkedList<TreeNode>>(); LinkedList<TreeNode> levelList = new LinkedList<TreeNode>(); // Added root to the level list so that it ca...
9af59878-dce7-4bb8-831b-75751b20424a
3
@Override public void messageReceived(IoSession session, Object message) throws Exception { String text = UTFCoder.decode(message); System.out.printf("Recieved : %s \n", text); String[] parameter = parse(text); if(parameter.length>=2){ if (parameter[0].equalsIgnoreCase("prepare")) { this.sendPromise(par...
b2295b99-6b8d-4186-bb6c-073910d2790f
9
@SuppressWarnings("unchecked") public static void main(String[] args) throws Exception { // The Magic Words are Squeamish Ossifrage String M = "f20bdba6ff29eed7b046d1df9fb7000058b1ffb4210a580f748b4ac714c001bd4a61044426fb515dad3f21f18aa577c0bdf302936266926ff37dbf7035d5eeb4"; String M1 = "f20b...
fe15b8c8-e4f0-4d14-accb-d295c1afac16
7
private static SphereCluster calculateCenter(ArrayList<Cluster> cluster, int dimensions) { double[] res = new double[dimensions]; for (int i = 0; i < res.length; i++) { res[i] = 0.0; } if (cluster.size() == 0) { return new SphereCluster(res, 0.0); } ...
fc030370-e770-4c36-82b7-b464c4e43e10
0
public void setHasConnected(boolean hasconnected){ this.HasConnected = hasconnected; }
8b1dd26a-19ff-47c3-a788-db1cd5cbfcad
7
private void writeFile(String data, boolean isAppend) { if (!exists()) { try { createNewFile(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } BufferedWriter bfWriter = null; try { FileWriter flWriter = null; if (isAppend) { flWriter = new Fi...
1c065e8f-a12d-474a-be1c-53d1373f8554
9
public String toString() { final StringWriter sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw, true); pw.println("Context of caches in CachingBloatContext..."); pw.println(" Class Infos"); Iterator iter = classInfos.keySet().iterator(); while (iter.hasNext()) { final Object key = it...
751309d1-b88a-47a1-857e-e21f593bdd12
7
public final void init() throws IOException, ZipException { boolean downloadSDK = false; logger.log(Level.INFO, "Initializing SDK Manager. Checking for SDK directories..."); logger.log(Level.INFO, "Checking downloads dir..."); if (!new File(toolkitDir.getAbsolu...
72c278fc-9de6-406c-ae9d-f82cb9ceb0c8
5
public NPC getCurrent() { Filter<NPC> i = new Filter<NPC>() { public boolean accept(NPC entity) { return (entity.getId() == 7138 || entity.getId() == 7139 || entity.getId() == 7140) && entity.getInteracting() != null && entity.getInteracting().equals(Players.getL...
52fc03fd-43c5-4aa2-ba71-1fb436f7afa5
3
public static boolean checkSignature(String signature, String timestamp, String nonce) { String[] arr = new String[] { token, timestamp, nonce }; // tokentimestampnonceֵ Arrays.sort(arr); StringBuilder content = new StringBuilder(); for (int i = 0; i < arr.length; i++) ...
75efd640-8312-4a9f-9690-722145cce254
1
public Canvas(Paint paint) { // setBackground(new Color(Color.TRANSLUCENT)); // use buffered image b/c when you call repaint the canvas will clear - // so need to draw to image and then draw that to canvas // A = alpha = transparent pixels layers = new BufferedImage[4]; for (int i = 0; i < 4; i++) { la...
6b2886f7-1a7a-4d48-9694-091cdd07e925
3
@Override public void paint(Graphics g) { if (gameScreen != null) { do { try { g = bs.getDrawGraphics(); paintBackground(g); gameScreen.paint(g); } catch (Exception e) { e.printStackTrace(); } bs.show(); g.dispose(); } while (bs.contentsLost()); } }
98f620cb-bffc-4376-adae-ed65caea74b6
7
public long get(long key) { int hash = hashFn(key); int initialHash = -1; while (hash != initialHash && (table[hash] == DeletedEntry.getUniqueDeletedEntry() || table[hash] != null && table[hash].getKey() != key)) { ...
dbc048eb-8ce4-4aac-b05f-712550f0c1e1
7
public static int PretvoriCharUInt(String in){ if (in.length() == 4){ // mora biti jedan od ovih if (in.charAt(2) != 't') return (int)('\t'); if (in.charAt(2) != 'n') return (int)('\n'); if (in.charAt(2) != '0') return (int)('\0'); if (in.charAt(2) != '\'') return (int)('\''); if (in.charAt(2) != '"...
eaddaf87-7f0c-4b80-a239-14378ec5bb21
4
public void roque(Piece p, Point point) { if (point.equals(new Point(6, 0)) || point.equals(new Point(6, 7))) { deplacementPetitRoque(p); } if (point.equals(new Point(2, 0)) || point.equals(new Point(2, 7))) { deplacementGrandRoque(p); } }
165431dc-30f2-4475-b1d0-c742f38157f8
9
public static void main(String[] args) { // TODO code application logic here boolean validar=true; int valor1=0; int valor2=0; double resultado; char continuar; int opcion=0; Scanner teclado=new Scanner(System.in); Operaciones oOp...
c637a071-1f33-4699-993b-d7526ed68519
9
public static void writeBottomSection(org.powerloom.PrintableStringWriter stream) { stream.print("<input TYPE=button NAME=\"show\" VALUE=\"Show\" onClick=\"loadContextURL('content', 'show', this.form)\">\n"); if (OntosaurusUtil.savingAllowedP()) { stream.print("<input TYPE=button NAME=\"save\" VALUE=\"S...
2ffee6ae-8e64-4bb4-b377-b254112847c5
3
public static Class<?> resolveClassName(String className, ClassLoader classLoader) throws IllegalArgumentException { try { return forName(className, classLoader); } catch (ClassNotFoundException ex) { throw new IllegalArgumentException("Cannot find class [" + className + "]", ex); } catch (LinkageEr...
84df12bc-9f85-44da-ac25-563a02a69d0f
6
public Noeud getClicked(MouseEvent e) { if (plan == null) return null; List<Noeud> noeuds = plan.getNoeuds(); Noeud selected = null; // Pour tous les noeuds for (Noeud n : noeuds) { int x = screenX(n.getX()); int y = screenY(n.getY()); // on regarde si le click de la souris est contenu dans la zon...
24937e11-a89f-43a4-93b5-b165f3062806
3
public static void lagElevliste() { //Lager en Arraylist til tilleggsklassen "Elev" ArrayList<Elev> Elevliste = new ArrayList<Elev>(); //Oppretter String og Int variabler String Fornavn, Etternavn; int nivaaElev, flereOrd; int flereord=0; while (true){ //Er dette riktig? int elevTellerer=0; try{...
e658bf3e-a355-4be7-9e83-2616c24a118e
2
public static void main(String[] args) { LinkedStack<String> lss = new LinkedStack<String>(); for (String s : "Phasers on stun!".split(" ")) lss.push(s); String s; while ((s = lss.pop()) != null) System.out.println(s); }
f5323743-d3ef-4bcd-83f2-2ff95b3b7817
7
public boolean firespell(int castID, int casterY, int casterX, int offsetY, int offsetX, int angle, int speed, int movegfxID,int startHeight, int endHeight, int finishID, int enemyY,int enemyX, int Lockon) { fcastid = castID; fcasterY = casterY; fcasterX = casterX; foffsetY = offsetY; foffsetX = offsetX; fangle = angl...
d373b475-835a-4f44-a7f2-c2e648188003
1
public void setPaused(final boolean p) { paused.set(p); if (isPaused()) { SoundStore.get().pauseLoop(); } else { setMusicPlaying(musicPlaying); } }
c7a01ebd-85b0-4741-9672-bc0950167a14
2
public void setCommandButtonFont(String font) { if ((font == null) || font.equals("")) { this.buttonComFont = UIFontInits.COMBUTTON.getFont(); } else { this.buttonComFont = font; } somethingChanged(); }
0a53b81b-8173-48f9-b77f-a6517744d2f4
5
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void onPlayerQuit(PlayerQuitEvent e) { Player quitPlr = e.getPlayer(); if(quitPlr.hasPermission("combattag.ignore.pvplog")){ return; } if (quitPlr.isDead()) { plugin.entityListener.onPlayerDeath(quitPlr); } else if (plugin.inTagg...
11ee635b-8ceb-4c88-a154-4f3580e1279c
6
@Override public void keyReleased(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_UP: System.out.println("Stop moving up"); break; case KeyEvent.VK_DOWN: currentSprite = anim.getImage(); robot.setDucked(false); break; case KeyEvent.VK_LEFT: robot.stopLeft(); break; case KeyEv...
b63da1f2-67bd-484c-82f6-0171d5203ad3
5
@Override public String getColumnName(int columnIndex) { switch (COLUMNS.values()[columnIndex]) { case ID: return java.util.ResourceBundle.getBundle("cz/muni/fi/pv168/autorental/gui/Bundle").getString("customers_table_id"); case FIRSTNAME: return java.util.ResourceBundle.getBundle("cz/muni/fi/pv168/a...
5fce174e-f101-4934-a8af-8784fc786e88
9
@Override public void keyTyped(KeyEvent e) { switch (e.getKeyChar()) { case 's': case 'S': case 'w': case 'W': getScreen().switchInputMode(new ShootingMode(getScreen(), this)); getScreen().getCurrentInputMode().keyTyped(e); break; case 'j': case 'J': getScreen().jump(); break; case KeyEv...
ec0d3947-b495-4168-bcde-3dd683489d61
0
public SpiderMask() { setTitle("Super Web Crawler"); JPanel panel = new JPanel(); JTextArea area = new JTextArea("text area"); area.setPreferredSize(new Dimension(100, 100)); // JFileChooser fc = new JFileChooser(); // panel.add(fc); JLabel urlL...
e73a3944-0271-4874-a311-77729cd17ee5
4
public void zeroLessThan(float cutOff) { for(int i=0; i < data.length; i++) { float[] block = data[i]; for(int j=0; j < block.length; j++) { if (block[j] != 0.0f && block[j] < cutOff) block[j] = 0.0f; } } }
89d2c93c-0be4-46d3-81d1-0f79c23a4fd9
2
public void execute(String content, boolean isAdmin) { if (requiresAdmin) { if (isAdmin) runCommand(content); } else runCommand(content); }
18a22d39-0533-44b3-ba9e-f165e8af40a6
9
public int[] searchRange0(int[] nums, int target) { int[] pos = new int[]{-1, -1}; int start = 0, end = nums.length-1; while(start <= end) { int mid = start + (end-start)/2; if(nums[mid] == target) { for(int i = mid-1; i >= -1; i--) { ...
f16c481f-07fc-454e-88e6-0239ab1887fa
7
private ConfigurationObjectProperties parseConfigurationObject() throws InterruptedException, SAXException { AttributeMap attributes = _xmlStream.pullStartElement().getAttributes(); final String pid = attributes.getValue("pid"); final String id = attributes.getValue("id"); long idValue = 0; final String trimm...
113fa9ae-10f0-487f-a522-ce4491c41ec4
3
private boolean compareDates(GregorianCalendar gc) { return ((gc != null) && (get(GregorianCalendar.DAY_OF_MONTH) == gc.get(DAY_OF_MONTH)) && (get(GregorianCalendar.MONTH) == gc.get(GregorianCalendar.MONTH)) && (get(GregorianCalendar.YEAR) == gc .get(GregorianCalendar.YEAR))); ...
d94ef7f5-95f3-4834-a948-fd39af5ae4c4
3
@Override public boolean accept(SceneObject obj) { return obj.getId() == Constants.IVY_ID[0] || obj.getId() == Constants.IVY_ID[1] || obj.getId() == Constants.IVY_ID[2] || obj.getId() == Constants.IVY_ID[3]; }
3c5aa041-2ec3-40ce-b087-619585146139
4
public VectorMatrixView(IMatrix matrix) { if (matrix.getColsCount() != 1 || matrix.getRowsCount() !=1) { throw new IncompatibleOperandException( "Can not convert matrix to vector."); } this.matrix = matrix; dimension = matrix.getColsCount() == 1 ? matrix.getRowsCount() : matrix.getColsCount(); ro...
f422e678-62de-42cc-8992-26a071a03dbe
9
private final void FillBuff () throws java.io.IOException { // Buffer fill logic: // If there is at least 2K left in this buffer, just read some more // Otherwise, if we're processing a token and it either // (a) starts in the other buffer (meaning it's filled both part of //...
511c61a3-5ef8-4cc0-8891-82fe4b181662
0
@Override public void setSelect (boolean select) { this.select = select; }
babcf4e7-d661-4818-9103-1e3fd93978df
6
public String get(int n) { if (capitalword_) return null; int len = grams_.length(); if (n < 1 || n > 3 || len < n) return null; if (n == 1) { char ch = grams_.charAt(len - 1); if (ch == ' ') return null; return Character.toString(ch); } else ...
fa031250-6e8f-409e-9944-f7636b4e045b
3
public static void main(String[] args) { Scanner dictionaryInput = new Scanner( TestAutoComplete.class.getResourceAsStream( "dictionary.txt" ) ); List<String> dictionary = new ArrayList<String>(); long t0 = System.nanoTime(); while (dictionaryInput.hasNextLine()) { dict...
1e609f08-007f-46bc-abec-e3618d33abd6
3
public static void noSpace(String string) throws JSONException { int i, length = string.length(); if (length == 0) { throw new JSONException("Empty string."); } for (i = 0; i < length; i += 1) { if (Character.isWhitespace(string.charAt(i))) { throw...
c81646ba-27e4-449d-9c22-47aab9ece210
7
@Override public void endElement(String uri, String localName, String qName) throws SAXException { if(!open_tag.equals(qName)){ throw new SAXParseException("XML malformed, missmatched '"+ open_tag +"' tag in XML file." , null); } switch (qName) { case "color": this.color = new BeadColor(this.c...
93f4288b-cd8a-4d51-887c-251a26a1a9f9
9
@Override public String getColumnName(int column) { if (column == CHECK_COLUMN_INDEX) { return "Ausgewählt"; } String line1, line2; switch (column) { case ID_MANDAT_COLUMN_INDEX: line1 = "MandatsID"; bre...
fc77063d-fe41-4f91-aa79-99370c2917bb
2
public void tryAgain(Displayable form) { Alert error = new Alert("Login Incorrect", "Please try again", null, AlertType.ERROR); error.setTimeout(900); // error.setImage(imge); Form login = (Form) form; TextField userName; TextField password; for (int i = 0; i ...
90f593d6-1763-480f-bfb9-516c59272b08
0
public RegPumpingLemmaChooser() { myList = new ArrayList(); //old languages myList.add(new AnBn()); myList.add(new NaNb()); myList.add(new Palindrome()); myList.add(new ABnAk()); myList.add(new AnBkCnk()); myList.add(new AnBlAk()); myL...
4cbe7981-7b1a-4417-9017-4d88de395b9b
3
@Override public List<Action> process(Board board) { List<Action> actions = new ArrayList<Action>(); for (int x = 0; x < board.w; x++) for (int y = 0; y < board.h; y++) { if (!board.cells[x][y]) continue; // Get best square from here int radius = getBestSquare(board, x, y); actions.add(n...
15cbcbfe-94a7-45db-a9a2-b3bd8470281e
2
public void sendReplyFlooding(){ //Dispara o flooding das respostas dos nodos com papel BORDER e RELAY if ((getRole() == NodeRoleOldBetHopSbet.BORDER) || (getRole() == NodeRoleOldBetHopSbet.RELAY)) { this.setColor(Color.GRAY); //Pack pkt = new Pack(this.hops, this.pathsToSink, this.ID, 1, this.sBet, TypeMes...
233b297e-91c8-4903-b419-cf12264e8294
1
public int getFollowingGlieder() { return nextGlied != null ? nextGlied.getFollowingGlieder() + 1 : 1; }
25e89766-4a12-46bd-8aaa-3952b59ae7dc
3
@Test public void testTargetLocationLastVisited(){ ComputerPlayer player = new ComputerPlayer(); player.setLastVistedRoom('B'); int enteredRoom = 0; int loc_7_5Tot = 0; board.calcTargets(6, 7, 3); //pick a location with at least one room as a target that already been visited for(int i = 0; i < 100; i++) ...
65577b61-e9dd-422b-91b7-d54641a316b8
1
public void connectDb() { startSQL(); try { Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection(url, user, password); st = con.createStatement(); } catch (Exception e) { e.printStackTrace(); } }
6364e4e8-981f-423c-bb3a-1bc5407bb211
2
private void checkInvariants() { assert elements[tail] == null; assert head == tail ? elements[head] == null : (elements[head] != null && elements[(tail - 1) & (elements.length - 1)] != null); assert elements[(head - 1) & (elements.length - 1)] == null; }
0bae2c30-4c83-4ca2-9935-164fb66f545d
6
public boolean getBoolean(int index) throws JSONException { Object o = get(index); if (o.equals(Boolean.FALSE) || (o instanceof String && ((String)o).equalsIgnoreCase("false"))) { return false; } else if (o.equals(Boolean.TRUE) || (o in...
7381e70b-bbd7-46d8-b8fa-1a6898ae0a72
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(this.ID())!=null) { mob.tell(target,null,null,L("<S-NAME> alread...
cac40491-c64d-4f04-8cef-a1535d8c0e42
3
private static void createTopology(ArrayList gisList, ArrayList resList, ArrayList userList) throws Exception { int i = 0; double baud_rate = 1e8; // 100 Mbps double propDelay = 10; // propagation delay in millisecond int mtu = 1500; ...
1923e112-7d8e-4b7b-8d70-250f9ae132f3
0
public boolean available() { return this.seen > 0; }
7eecc8f3-19d8-4df2-a1c5-f510a9ec78fe
8
public void firstQuery() throws SQLException { String errorMessages = ""; ConnectToDatabaseSys connectDB = new ConnectToDatabaseSys(); int errorCount = 0; //FORMAT orno = validateInputs.formatStringSpaces(orno); ordetail = validateInputs.formatStringSpaces(or...
b8382d6f-059f-4579-8c9b-97d77cb886c0
1
@Override public Grid generate() { List<PowerFailure> effects = getPowerFailureList(); for(PowerFailure p : effects) { grid.addEffectToGrid(p); factory.addObservable(p); factory.addObserver(p); } factory.registerToNewObservables(); return grid; }
899fce23-e4d7-4c6f-b6a7-e8ab6934fc10
8
public void actionPerformed(ActionEvent ae) { if ("Hit".equals(ae.getActionCommand())) { if (playerSum < 21) { player.playersHand.addACard(table.deal()); repaint(); playerSum = player.playersHand.getTotalValue(); } if (playerSum > 21) { setWallet(getWallet()); score....
ca178bbb-d624-4bab-bea2-bab2ebe89809
0
@Override public void addUnsearchQueue(WebPage unsearchQueue) { // TODO Auto-generated method stub }
dd9ac6e9-c855-48bb-af43-4540607bb48c
0
public String[] getElementsLineEnder() { return this.ELEMENTS_LINE_ENDER; }
910685b2-c2bd-4d98-9c39-6e4fa889bca9
7
private static void addSomeMetadata( OtuWrapper wrapper, BufferedReader reader, BufferedWriter writer) throws Exception { writer.write("sampleID\tpatientID\truralUrban\ttimepoint\tshannonDiversity\tshannonEveness\tunRarifiedRichness"); String[] topSplits = reader.readLine().split("\t"); for( int x=1;...
13bcd0b2-b474-466b-812f-23c1cc50b4bd
0
public void addUndoQueueListener(UndoQueueListener l) { undoQueueListeners.add(l); }
733e1774-5717-4a0e-8643-2228ecc6007f
7
public Location placeShip(int size, boolean retry) throws ArrayIndexOutOfBoundsException, InputMismatchException { shipSize = size; randomRow = (int) (Math.random() * (SIZE - 2)); randomCol = (int) (Math.random() * (SIZE - 2)); Random random = new Random(); horizontal = random.nextBoolean(); // System...
df145712-fbc3-4755-a881-d9dcf3382e61
2
@Override public boolean isSavingNotRequired() { Path p; try { p = Paths.get(getChildrenSaveTo()); if (Files.isDirectory(p)) return true; } catch (IOException e) { Main.log(Level.WARNING,null,e); } return false; }
ce5ae3d2-eea7-4154-9532-42d2ae01f999
9
protected Pane addMenuButtons() { GridPane mainPane = new GridPane(); mainPane.setVgap(20); HBox chartGroupPane = new HBox(); chartGroupPane.setAlignment(Pos.CENTER); //Stworzenie przycisków do wyboru typu wykresu (liniowy, świecowy) final ToggleGroup chartGroup = new ...
f7d6c662-c72c-44a5-9ee2-cb7b98bae20c
4
public void postLogin(String userId, ModelAndView view) { int deptId = m_user.getDepartment(); String viewName = null; if (deptId == 10) viewName = "employee"; else if (deptId == 20) viewName = "manager"; else if (deptId == 30) viewName = "hrdepartment"; else if(deptId == 40) viewName = "trainin...
147dc760-448b-4128-8b00-2323c3ed638b
7
public Message(@NotNull MessageType type, String title, @NotNull String content, Runnable yes) { String path = null; yesAction = yes; buttons = new ArrayList<GuiButton>(); switch (type) { case INFO: path = "message/infoLogo"; break; ...
76f3550f-de9a-4312-acd8-28ffad074e63
7
public static int minJump(int[] input) { if(input == null || input.length == 0 || input[0] == 0){ return -1; } int[] minJump = new int[input.length+1]; minJump[0] = 0; for(int i = 1; i<= input.length; i++) { minJump[i] = Integer.MAX_VALUE; f...
9aa4bcda-5ae7-456c-a227-589fa771f63d
3
private void updateCart() { shoppingCartArea.clear(); if (currentCart.size() == 0) { shoppingCartArea.add(emptyLabel); } else { int price = 0; for (final Product p : currentCart) { if (p.getInCurrentCart() == 0) { cartRemoveTemp.add(p); price += p.getPrice() * p.getInCurrentCart(); ...
2dc8ff67-6b25-460f-9417-26731b2af202
0
public CheckResultMessage error(String message) { return new CheckResultMessage(message, CheckResultMessage.CHECK_ERROR); }
cf5879ad-d601-4afc-97c4-fec4c1494c6b
2
static void realRead(InputStream is, byte[] buffer, int bytesToRead) throws IOException { int read = 0, value; while (read < bytesToRead) { value = is.read(); if (value < 0) { throw new RuntimeException("EOF!"); } buffer[read++] = (byte) value; read += is.read(buffer, read, bytesToRead - read); ...
a5fc6614-d16b-4f80-b12a-827e8cb6d830
9
public void copyFile(File source, File dest) throws IOException { BufferedInputStream bis = null; BufferedOutputStream bos = null; FileInputStream fis = null; FileOutputStream fos = null; try { fis = new FileInputStream(source); fos = new FileOutputStream...
082fc214-3aab-4e8f-a43e-9f1139d6428f
0
public String getName() { return name; }
61657d3c-5d10-4cd1-a59a-c2dca772d323
4
private Door[] sortDoors(int whichWall) { ArrayList<Door> doorTempList = new ArrayList<>(); doorTempList.addAll(doors.get(whichWall)); //copy doors into temp list Door[] temp = new Door[doors.get(whichWall).size()]; if (temp.length > 0) { for (int i = 0; i < temp...
fac6d415-6cbc-4f1f-8c09-56c449c6e99e
8
@Override public boolean generate(World world, Random random, int i, int k, int j) { // TODO Auto-generated method stub if (world.getBlockId(i, k, j) != VoidMod.hardenSpaceTimeStructure.blockID) { return false; } // size Generator int aid = random.nextInt(3) + ...
1529e892-9e0c-41f8-adc5-8a55a8dd83f8
5
@Override public void render(float delta) { Gdx.gl.glClearColor(0.56f, 0.165f, 0.1f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); timeElapsed += delta; gameOverView.render(delta); /** * If the round score is higher than the highscore it will be saved * as new highscore * */ if(!doneCheckingFor...
def69de2-779f-4349-a870-2b8817954016
3
public void deleteTheSame() { // - Parcours de matrixb à la recherche des boules identifiées // comme appartenant à une famille. // - Suppression des boules corrrespondantes (remise à zéro dans matrix) for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { if (matrixb[i][j]) matrix[i][j] = 0;...
f7c0fe26-dedf-4ba1-87ee-b5af5766009e
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 feel. * For details see http://down...
628c16fe-5ce8-44c3-b802-cf75fdb6a625
6
@Override public void run() { while (popups != null) { console.displayMsg("Update"); synchronized (popups) { while (popups.isEmpty()) { try { popups.wait(); } catch (InterruptedException ex) { ex.printStackTrace(); } } for (int i = 0; i < popups.size(); i++) {...
8e223763-1f16-4a76-b77c-a49b7eeffff3
4
public boolean equals(Object obj) { try { if (!obj.getClass().equals(audioClass.class)) { throw new Exception(); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return (obj != null) && ((audioClass) obj).toString().equals(this.filePath) && ((audioClass...
bfbd247c-f0cf-47f6-9d64-633ee751a3e3
9
@Override public MultiMenuPlacePlanetChoices doSelection(Factory factory) { updateState(); while (state != -1) { Menu<?> menu = getMenu(state, factory); switch (state) { case 1: choices.setChosenPlanet((Planet) menu.selectChoice(false)); break; case 2: rotatePlanetChoice = (StaticChoice) m...
a496b4d3-6581-4f36-8888-9bf4095a430d
0
public int getBoardWidth() { return this.w; }
0ddf74b0-1d9d-4828-bafd-2d130bfed9ed
7
@Override protected void deserialize_() throws IOException { if (this.in == null) { return; } this.io.startProgress("Reading data base of previous run", -1); // init this.in.registerProgressMonitor(this.io); this.io.setProgressTitle("Reading data base of previous run"); // set // message...
46cc9575-ac54-4cd1-88c7-37a48fb7e3ef
5
public static void disposeImages() { // dispose loaded images { for (Image image : m_imageMap.values()) { image.dispose(); } m_imageMap.clear(); } // dispose decorated images for (int i = 0; i < m_decoratedImageMap.length; i++) { Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decora...
b8851a33-dd46-4c56-912d-b0cb262621c1
9
public void run() { while (mRun) { try { EventDescriptorObject lObject = mDataStorage.getData(); if (lObject == null) { mRun = false; } // if if (mRun) { EventObject lEventObject = mDataOperator.readEvent(lObject .getType(), lObject.getIndex()); String lMessa...
857668a7-4d01-4c3d-b102-02183ab648ec
2
@Override public boolean canAttack(Board board, Field currentField, Field occupiedField) { return this.validSetupForAttack(currentField, occupiedField) && currentField.inDiagonalPathWith(occupiedField) && board.clearPathBetween(currentField, occupiedField); }
3cc7b9c9-daaa-446e-ace9-29c7cf493bf3
7
public static void figureOutParamDeclarations(PrintStream w, Object... comps) { Map<String, Access> m = new HashMap<String, Access>(); for (Object c : comps) { ComponentAccess cp = new ComponentAccess(c); // System.out.println("// Parameter from " + objName(cp)); // ...
f7ea3cdf-20b0-4309-a365-2ec8dd11630f
5
public E get(int index) throws IndexOutOfBoundsException { if(index >= size || index < 0) throw new IndexOutOfBoundsException(); int count; Node temp; //Occurs if index is towards the end of the list if(index > size/2){ count = size; temp = tail; while(--count >= index) temp = temp.prev; r...
62b6d997-fc30-43e8-9fad-da377ec5f6a3
9
public ExcFile(File f) throws IOException { srgMethodName2ExcData = new HashMap<String, ExcData>(); srgParamName2ExcData = new HashMap<String, ExcData>(); // example lines: // net/minecraft/util/ChunkCoordinates=CL_00001555 // net/minecraft/world/chunk/storage/AnvilChunkLoade...
518ed878-7f48-4509-a293-41521590688a
0
public MapData(int a_data,int b_data){ this.a_data = a_data; this.b_data = b_data; }
d4cb4e47-d075-4ebf-a45c-db5c9f472446
4
public void decreaseKey(int i, Key key) { if (i < 0 || i >= NMAX) throw new IndexOutOfBoundsException(); if (!contains(i)) throw new NoSuchElementException("index is not in the priority queue"); if (keys[i].compareTo(key) <= 0) throw new IllegalArgumentException("Calling decreaseKey() with given...