method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
d4ab28b8-0676-4191-9e3e-afc9dfc77651
3
public Description getFunctional() { Description tRequirements = new Description(); for(Property tProp : this) { if(tProp != null) { if(!(tProp instanceof NonFunctionalRequirementsProperty)) { tRequirements.set(tProp); } } } return tRequirements; }
b7728936-12c2-4aec-bed8-a37c07cadb2d
7
@Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub if(button.getText().equals("Stop Play Record")){ player.stopThread(); interf.deleteMyWindowListener(); button.setText("Start Play Record"); if(Optiums.DISABLES_BUTTONS) buttonRecorder.setEnabled(true); }e...
a0e6a89a-079b-4be1-b3b3-d118e037c16a
9
public Object[] compileToClassFiles(String source, String sourceLocation, int lineno, String mainClassName) { Parser p = new Parser(compilerEnv, compilerEnv.getErrorReporter()); Sc...
584340af-b615-434e-b20b-ef00c92964c6
3
public DataTag load() { DataTag tag = null; try { final ObjectInputStream in = new ObjectInputStream(new FileInputStream(file)); tag = (DataTag) in.readObject(); in.close(); } catch (final Exception i) { if (!i.getClass().equals(EOFException.class)) { System.err.println("Exception: " + i...
63ab51f9-3886-41ac-a117-565541a4cc16
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; MerchantsFollowed other = (MerchantsFollowed) obj; if (merId != other.merId) return false; if (mfId != other.mfId) return false; if (uI...
4d1c944c-3387-4dfa-91c3-4b0de806a23c
2
public LinkedList<Video> searchVideos(LinkedList<Pair<String, String>> whereClauses, LinkedList<String> whereConjunctions, char order) throws SQLException { LinkedList<String> select = new LinkedList<String>(); select.add("*"); LinkedList<String> from =...
6449de45-7784-4bb5-8922-1b9c0d8d08fa
4
@Test public void test_mult_skalar() { int a = 2; int b = 3; int skalar = -4; Matrix m1 = new MatrixArray(a,b); Matrix m2 = new MatrixArray(a,b); for(int i = 1; i <= a; i++){ for(int j = 1; j <= b; j++) m1.insert(i, j, (double)(2*i-j)); } for(int i = 1; i <= a; i++){ for(int j = 1; j <=...
a4f58fe1-12c4-4804-b5fa-63e3ab82c5f6
9
private JPanel custtab() { JPanel cust = new JPanel(); cust.setLayout(null); JButton newcust, edcust, delcust, viewcust; newcust = new JButton("New Customer"); edcust = new JButton("Edit Customer"); delcust = new JButton("Delete Customer"); viewcust = new JButton("View all Customers"); newcust.setBound...
739fdce0-0ea4-4706-8ec3-909d84bacf0f
0
@Override public boolean getIsUniqueAttribute() { return false; }
cf110510-137c-4cc8-94cd-244abeeff045
4
private void parseModuleConfig(String index, Element el) { NodeList nl = el.getElementsByTagName("Config"); Map<String,String> map = new HashMap<String,String>(); if(nl != null && nl.getLength() > 0) { for(int i = 0; i < nl.getLength(); i++) { ...
627b627a-fef8-4301-8e78-154281d0e49c
0
public void methode1() { }
589116e6-2de3-4021-ad9e-b135f1e531ca
2
@Override protected void setPanelPerson(User u, boolean newUser) { super.setPanelPerson(u, newUser); btnSave.setEnabled(false); if (newUser || u == null) { // we don't want any rows selected ListSelectionModel m = table.getSelectionModel(); m.clearSelection(); return; } tableModel.setR...
47c84326-b42d-4d30-97a7-7196f89a0785
7
@Override public void addProperRoom(Room R) { if(R==null) return; if(!CMLib.flags().isSavable(this)) CMLib.flags().setSavable(R,false); if(R.getArea()!=this) { R.setArea(this); return; } synchronized(myRooms) { if(!myRooms.contains(R)) { addProperRoomnumber(R.roomID()); Room R2...
6b47526b-c14d-4215-bc3a-39846894ff26
2
private static ParameterCode getParameterCode(String s) { ParameterCode[] codes = ParameterCode.values(); for (ParameterCode c : codes) { if (s.compareTo(c.toString()) == 0) return c; } return ParameterCode.NO_CODE; }
a8a64a72-56aa-43fa-8d86-bb1f088d8c3e
6
public static void main(String[] args) { int i = 0; while( i <= 100 ) { System.out.println("i = " + i); i+=2; //i=i+2; } /////////////////////////////////////////////// i = 0; while( i <= 100 ) { if( i%2 == 0 ) System.out.println("i = " + i); i++; } /////////////////////////...
73db2bb1-8a5b-4381-aeba-2855bec7a7f5
2
private static boolean checkSignature(byte[] buffer) { for(int i=0 ; i<SIGNATURE.length ; i++) { if(buffer[i] != SIGNATURE[i]) { return false; } } return true; }
d7d05991-8326-4b37-afb9-8a7b444d46cf
8
private HashMap<String,String> readQueryFromTable(HashMap<String,String> propertiesMap) { List<HashMap<String,String>> propertiesMapList = transactionQueryHistoryDao.getTableProperties(); for(HashMap<String,String> map : propertiesMapList) { QueryType queryType = QueryType.valueOf(map.g...
d1635244-cfa0-4896-8ad8-3ce36874aa8a
4
protected void enableGUI() { buildFieldRef(); for (JComponent elem : editableElements) { if (elem != null) { elem.setEnabled(true); } } for (JTextComponent elem : editableTextFields) { if (elem != null) { elem.setEditable(true); } } }
a92209ee-a4e0-499b-914f-de5b77e78576
6
private boolean edgeAndScheduleSelection(EvolvingGraph graph, Vector<Integer> tLBD){ Vector<Integer> arrivalTime = new Vector<Integer>(); boolean improved = false; eMin = new Vector<Edge>(graph.getNumOfNodes()); tMin = new Vector<Integer>(graph.getNumOfNodes()); for (int i = 0; i < graph.getNumOfNodes()...
228e49ca-e1cd-483b-b617-e9465a2a3a59
6
public static double countAdjacents(Board b) { int counter = 0; for (int i = 0; i < 4; i++){ for (int j = 0; j < 4; j++){ if ( j < 3 && Board.canCombine(b.boardState[i][j], b.boardState[i][j+1])) { counter++; } if ( i < 3 && Board.canCombine(b.boardState[i][j], b.boardState[i+1][j])) { cou...
b3b0b233-49d2-4711-bf6d-8bac7c1dff8b
1
public boolean Apagar(T obj) { try { manager.remove(manager.merge(obj)); return true; } catch (Exception ex) { return false; } }
b9376d52-3cd6-4114-b80a-8b3965934697
9
public String readUntil(String pattern) throws InterruptedException, IOException { cnt=0; char lastChar = pattern.charAt(pattern.length() - 1); StringBuffer buffer = new StringBuffer(); char ch = (char) dataIn.read(); String msg; String broken[]; while (runner==1) { ...
0a42400d-2174-4706-96d5-7b5a6d6c4b29
4
public RayIntersect fireRay(double x, double z, double angle){ double tan = math.tan(angle); int MAX_LOOPS = (int)(Math.ceil(raycaster.getCamera().getViewDistance()) + 1); RayIntersect vert = fireVerticleRay(x, z, angle, tan, MAX_LOOPS); RayIntersect horiz = fireHorizontalRay(x, z, an...
0257ef16-17f9-4d7c-a898-f84ac3a51b89
8
private static Node merge(Node odd, Node even) { // Sentinel Node Node list = new Node(0, null); Node start = list; while (odd != null || even != null) { if (odd != null && even != null) { if ((int)odd.getData() < (int)even.getData()) { list.setNext(odd); odd = odd.getNext(); list = list.g...
134d8753-f156-46e5-bab9-d6d1b8803891
5
private void setupChoosableFontProperties() { // Load fonts and add them to the combobox 'cbFonts' String[] fontNames = parent.getParentView().getAvailableFonts(); for (String font : fontNames) { this.cbFonts.addItem(font); } this.cbFonts.setSelectedItem(this.dss.get...
ab68919d-0999-44de-822e-3468ce709136
5
void processAnnotations(Annotation[] annotations) { int sourceLoaderCount = 0; int sourceCount = 0; int prefixCount = 0; int postfixCount = 0; try { for (final Annotation annotation : annotations) { if (annotation instanceof AutoConfigLoader) { AutoConfigLoader annotation2 = (AutoConfig...
efb44f9b-da40-41b9-a2af-122fae82de74
0
public void setDisplayMode(int displaymode) { this.pconnect.setDisplayMode(displaymode); }
64439a23-73fd-4b38-9790-78015a1f34ee
8
public void run(String[] args) { //--------------------------------------------------------------- // Parse arguments. //--------------------------------------------------------------- CommandArgs cmd = new CommandArgs (args, // arguments to parse ...
50e5d40a-1837-447b-9d4c-c22223945635
1
private String spaceString(int n) { StringBuffer sbuf = new StringBuffer(n); for (int i = 0; i < n; i++) { sbuf.append(' '); } return sbuf.toString(); }
ffc217bc-0153-44c9-8dd9-7853fa558ace
0
public SimulatorView getSimulatorView() { return view; }
d1a4f3d8-8bfb-4ecf-b7d7-31232f05cebf
5
@Override public void onMouseClicked(int x, int y, int button) { if(button == 0 && this.x <= x && x <= this.x+this.width && this.y <= y && y <= this.y+this.height) this.clicks++; super.onMouseClicked(x, y, button); }
547d0113-8732-48ac-bacc-8f7aec3972d1
1
public boolean findBid(Object objet, User seller){ Bid b = new Bid(new Date(), objet, seller, 0, 0); if(bidList.indexOf(b) == -1) return false; else return true; }
539eb8c7-1bc7-4302-b719-be1a1e1055de
5
@Override public int check(DiceSet diceSet) { int points = 0; Map<Integer, Integer> vals = new HashMap<Integer, Integer>(); for (int i = 0; i < diceSet.SIZE; ++i) { int key = diceSet.getValue(i); if (!vals.containsKey(key)) { vals.put(key, 1); ...
979173ca-2d50-460b-8937-72a3f017e93d
4
@Test public void test() { byte[] data = new ProtoBuilder().array("foo", new String[]{"a", "b", "c"}, "bar").build(); Object result = new ProtoParser().parse(data).result(); if (result instanceof Object[]) { for (Object obj :(Object[]) result) { if (obj instanceof Object[]) { for (Object d :(Object[]...
955fb8f0-99c5-4b95-9489-78bc482921fa
3
static public void writeLinesToFile(String filename, ArrayList<String> lines) { File file = null; try { file = new File(filename); file.createNewFile(); } catch (Exception e) { e.printStackTrace(); } try { FileWriter writer = new FileWriter(file); for (String line : lines) wr...
004fb092-4287-491e-8fc1-9fe51552ddde
1
public static String readLine() { Scanner input = new Scanner(System.in); String line = ""; if(input.hasNextLine()) { line = input.nextLine(); } return line; }
310aeb08-f5ca-4066-bcb8-400ffeed107c
2
public String toString() { return "Person[name=" + ((name == null) ? "null" : name.toString()) + ", birth=" + ((birth == null) ? "null" : birth.toString()) + "]"; }
c8ff2ceb-4d93-4132-9dd6-731142403562
2
private void validateBudgetChoice(String budget_choice) throws InvalidBudgetTypeException { if(budget_choice != ANNUAL_BUDGET && budget_choice != MONTHLY_BUDGET) { throw new InvalidBudgetTypeException("Invalid Budget Type."); } }
9b89be9c-c8c9-4514-b3f3-c742eee43439
0
public void addToLines(PathItem l) { lines.add(l); }
3b8fd243-e167-4bef-ac2f-44877abcc1c5
0
public void specialAttack2() { skill2.attack(this.getAgility(), this.getLuck()); }
bfcc57cc-d21c-4a41-bb9c-6ecf06794322
6
public void formTourList(SessionRequestContent request) throws ServletLogicException { Criteria criteria = new Criteria(); criteria.addParam(DAO_ID_DIRECTION, request.getAttribute(JSP_ID_DIRECTION)); User user = (User) request.getSessionAttribute(JSP_USER); if (user != null) { ...
6b452560-9cca-46da-98d5-0b420c93b120
1
private boolean jj_3_69() { if (jj_scan_token(SMALLER)) return true; return false; }
97b04020-d657-4638-9701-0398f7bbbde2
9
private void updateStateTellNumOfSteps(List<Keyword> keywords, List<String> terms) { //We should have come here by a keyword jump and the recipe shouldve been passed or set if (keywords != null && !keywords.isEmpty()) { for (Keyword kw : keywords) { if (kw.getKeywordData().getType() == KeywordType.RECIPE) { ...
c4a5fe4e-56aa-4763-9bc7-88b07f8fe33c
3
public String toString(String format, NumberFormat nf) throws IllegalArgumentException { if(nf == null || format == null || format.isEmpty()){ throw new IllegalArgumentException("NumberFormat and String arguments" + "must not be null or empty."); } return String.f...
65ea2e97-6b80-4e43-83c1-052b5142ef4a
5
private void setArgPosition() { int xPos; for (xPos=pos; xPos<fmt.length(); xPos++) { if (!Character.isDigit(fmt.charAt(xPos))) break; } if (xPos>pos && xPos<fmt.length()) { if (fmt.charAt(xPos)=='$') { positionalSpecification = true; argumentPositio...
6256feac-4483-4e57-be6d-976039e9f798
9
public void delete(Key key) { if(key == null) { throw new NullPointerException("Key may not be null"); } if(!membershipTest(key)) { throw new IllegalArgumentException("Key is not a member"); } int[] h = hash.hash(key); hash.clear(); for(int i = 0; i < nbHash; i++) { ...
03e29b9d-cd62-424d-92c8-fa0e1f6679bf
0
public void setNewTheme(String newTheme) { themeName = newTheme; }
a0fcd7c5-cd9e-4eda-a67f-3aa71699f7b2
7
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Venda other = (Venda) obj; if (this.codigo != other.codigo) { return false; } ...
278a9dd8-63b3-41f0-9b9b-2961a3b1b826
8
public static void parseToMe (LinkedList<String[]> programArray, Hashtable<String, Integer> labelsHash, String name) throws IOException{ BufferedReader file = new BufferedReader(new FileReader(name)); String line; int pc = 0; Pattern comline = Pattern.compile("(\\b[a-zA-Z]*\\b:\\s*)?(\\b[a-zA-Z]{2,4}\\b)[...
0e3df868-ecd2-4e6d-8b1c-98d7fa52e090
3
private void sieve(int[] p){ for (int i=2;i<1e6;i++){ if (p[i] == 1){ for (int j=i+i;j<1e6;j+=i){ p[j]=0; } } } }
e9ea7af5-a842-4f46-b0b4-47103c54df0d
7
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost,msg); if((affected!=null) &&(affected instanceof MOB) &&(msg.amISource((MOB)affected) ||msg.amISource(((MOB)affected).amFollowing()) ||(msg.source()==invoker())) &&(msg.sourceMinor()==CMMsg.TYP_QUIT...
ef6634b5-fc50-4341-a73c-93c27e0ea7e1
9
@Override public void onEnable() { config = getConfig(); config.options().copyDefaults(true); saveConfig(); cfile = new File(getDataFolder(), "config.yml"); instance = this; getServer().getPluginManager().registerEvents(this, this); this.saveDefaultConfig(); if (setupEconomy()) { FreeForAll.instance...
14050edc-92de-4775-89f0-c4a5ade580cb
1
private static void displayMostUsefulReviews(BufferedReader reader, VideoStore videoStore) { try { System.out.println("Please enter the title of the video you want to get reviews for:"); String isbn = getISBNFromTitle(reader, videoStore, reader.readLine()); System.out.printl...
0c24e35b-0e2c-482d-8690-b71834e36276
4
private void startAnnouncer() { if(announcerId != -1) { // Stop previous announcer plugin.getServer().getScheduler().cancelTask(announcerId); } if(!announcerUse || announcements.isEmpty()) { return; } final int delay = announcerInterval * minut...
4d5d1639-482d-4293-93a9-f6249e389641
7
public Object nextValue() throws JSONException { char c = this.nextClean(); String string; switch (c) { case '"': case '\'': return this.nextString(c); case '{': this.back(); return new JSONObject(this); ...
6920dd44-1842-4b68-b8d2-edda848b2cba
9
public static void main(String[] args) { //9 different table sizes are considered, and there are 169 equivalence classes of paired cards double[][][] suited = new double[9][13][13]; double[][][] unSuited = new double[9][13][13]; for(int playerCount = 2; playerCount <= 10; playerCount++){ System.out.println("...
f6a473da-f332-4df5-9295-f32827e4b93b
6
public String parseExprContent(String rawContent) { StringBuilder sb = new StringBuilder(); String s = ""; for (int i = 0; i < rawContent.length(); i++) { char c = rawContent.charAt(i); if(Character.isLetter(c)){ // When we find a letter, do a while till you cant find more digits s += c; i++; ...
a23abe88-2073-402b-afa7-43fd4d8057e8
9
@Override public void getTokenEmissionWeights(SequenceInput input, int idxTknTrain, double[] weights) { // Clear weights array. Arrays.fill(weights, 0d); /* * Index of the given sequence within the training dataset, if it is * part of one. */ int idxSeqTrain = input.getTrainingIndex(); if (!dis...
a6eaec63-9547-4535-bccc-fe42956af528
2
public void render() { BufferStrategy bs = this.getBufferStrategy(); if(bs == null) { createBufferStrategy(3); return; } Graphics g = bs.getDrawGraphics(); //Render Here map.render(g); gui.render(g); paths.render(g); ...
628dbfeb-c06a-4448-9d6d-d9faba98e58e
4
@Override public String describeValue(final boolean[] data, final int requestedNameLength) { long val = 0; for(int i = 0; i < data.length; i++) { if(true == data[i]) { val = val + (1 <<((numBits-1) -i)); } // else 0 * someth...
5a3cd5e9-3c8d-4588-9c30-0543fa711ac1
6
private void OKButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_OKButtonActionPerformed int tempX, tempY, tempMines; try { tempX = Integer.parseInt(numX.getText()); tempY = Integer.parseInt(numY.getText()); tempMines = Integer.parseInt(numMines...
e3b2d14b-024a-4e66-98c6-dfc3d4fea9be
3
private void reduce() { int[] primes = getPrimeNumbers(); for (int divisor : primes) { if(numerator < divisor) break; if(denominator < divisor) break; divide(divisor); } }
4c16cced-0a71-420a-aa84-3413f74b1ed5
3
public void setHmac(Key key){ Mac hmac = null; try { hmac = Mac.getInstance("HmacSHA256"); } catch (NoSuchAlgorithmException e) { System.err.println("NoSuchAlgorithmException (HmacSHA256 not valid): " + e.getMessage()); } try { hmac.init(key); } catch (InvalidKeyException e) { System.err.println...
cfb66725-68e8-4ee3-9e87-28edf25322ba
7
@Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!super.okMessage(myHost,msg)) return false; if(((msg.sourceMinor()==CMMsg.TYP_TELL) ||(msg.othersMajor(CMMsg.MASK_CHANNEL))) &&((msg.source()==affected) ||((msg.source().location()==CMLib.map().roomLocation(affected)...
fe127e41-a259-4ba3-8fc0-28e9f0f939dc
9
String fetch_m3u(String m3u) { InputStream pstream = null; if (m3u.startsWith("http://")) { try { URL url; if (running_as_applet) { url = new URL(getCodeBase(), m3u); } else { url = new URL(m3u); ...
6f0cc027-c872-47ca-95c4-f3ddde36e9e1
1
@Override public int getFirstSlotLocationX() { return isNotPlayerInventory() ? centerX-54 :centerX - 44; }
cc73640d-e166-4832-a873-1cb8c95c038c
1
public void affichageTableur(String pretexte, ArrayList<ArrayList<Character>> al) { System.out.println(pretexte); System.out.println("["); for(ArrayList<Character> mot : al) System.out.println("\tPosition : " + al.indexOf(mot) +"(" + tableurNonTrie.indexOf(mot) + ")\t" + mot);...
8ab627a9-4e78-4cc4-934c-f4522f0d7209
5
public static List<CharacterObject> GetConnectedPlayers(short x_centr_cell, short y_centr_cell, short dist_radius) { List<CharacterObject> list = new ArrayList<CharacterObject>(); for(int ix = x_centr_cell - dist_radius; ix < x_centr_cell + dist_radius; ix++) for(int iy = y_centr_cell -...
d831cc2d-ff37-4a85-8797-544830abce99
8
protected void genWeapon(MOB mob, Race E, int showNumber, int showFlag) throws IOException { if((showFlag>0)&&(showFlag!=showNumber)) return; final StringBuffer parts=new StringBuffer(""); Item I=CMClass.getItem(E.getStat("WEAPONCLASS")); if(I!=null) { I.setMiscText(E.getStat("WEAPONXML")); I.reco...
6f3333e1-6d82-43d6-adad-e7bac1dbe134
5
private void jBtnLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnLoginActionPerformed // TODO add your handling code here: String username = this.jTxtFldUsername.getText(); String password = this.jTxtFldPassword.getText(); Connection conn = Conexion.G...
6c2057fa-a2a5-4e9c-bddf-b4aa102cfd26
6
public static void main(String[] args) { ParamsParse params = null; /** * Тут в зависимости от параметров мы либо делаем xml файл со структурой базы, * либо сравниваем существующий xml файл с тем что есть в базе */ // Проверим число параметров. В качестве параметра д...
06b1086c-317b-41f4-aa97-bfb9d48292e1
4
public Prime(int n) { max = n; bitSet = new BitSet(max + 1); if (max > 1){ bitSet.set(0, 2, false); bitSet.set(2, max + 1, true); for (long i = 2; i * i <= max; ++i) { if (isPrime((int) i)) { for (long j = i * i; j <= max; j += i) { bitSet.se...
c9d28876-b551-43ee-be32-1c89da61f5e6
1
public static void main(String[] args) { Bank b = new Bank(NACCOUNTS, INITIAL_BALANCE); int i; for (i = 0; i < NACCOUNTS; i++) { TransferRunnable r = new TransferRunnable(b, i, INITIAL_BALANCE); Thread t = new Thread(r); t.start(); } }
a92d18bb-c16a-4cca-a1f3-a0e8f1547c0b
7
int checkID(String id) { int errorNumber = 0; char[] idCharArray = id.toCharArray(); if (id.length() == 18) { char lastChar = idCharArray[17]; for (int i = 0; i < idCharArray.length - 1; i++) { if ((int) idCharArray[i] >= (int) '0' && (int) idCharArray[i]...
ba775f05-5161-44d0-87d3-60bc0ea0fd9c
0
public Inventory(int size) { this.size = size; itemList = new Item[size]; x = 50; y = 470; w = 176; h = 40; int n = 100001 + (int)(Math.floor(Math.random() * 8)); addItem(n); n = 110001 + (int)(Math.floor(Math.random() * 7)); addItem(n)...
51a9fa79-64bc-46e0-8acd-59c0d78774c7
0
private static String getKeepAliveMsg(Neighbor from) { StringBuilder result = new StringBuilder(); result.append("From:"); result.append(Setup.ROUTER_NAME); result.append("\n"); result.append("Type:KeepAlive\n"); return result.toString(); }
9f1bb774-4f3e-41e1-b466-89b27a6876e6
8
void makeOLSAveragesTable( double[][] D, double[][] A ) { edge e,f,g,h; edge exclude; e = f = null; e = depthFirstTraverse(e); while ( null != e ) { f = e; exclude = e.tail.parentEdge; /* we want to calculate A[e.head][f.head] for all edges except those edges which a...
24f74d33-6fd1-4525-9033-7ccae86c7b62
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...
bd7f5c8e-8ea2-4031-a0c9-ede91205fb75
7
private boolean saveGame(File fout){ DataOutputStream file; try{ file = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(fout))); }catch(FileNotFoundException ex){ return false; } try{ //write status file.writeInt(score1); file.writeInt(score2); file.writeInt(level); ...
0de1c39c-6dc2-425a-ab3a-678984982a86
0
public Exception getException() { return exception; }
73660eb1-63be-4b5b-a532-4e227e6c512c
1
private String writeDropForeignKeys() { StringBuilder sb = new StringBuilder(); Table fromTable; ForeignNode node; for ( int keyNum = 0; keyNum < foreignNodeList.size(); keyNum++ ) { node = foreignNodeList.get( keyNum ); fromTable = tableMap.get( node.getFromTabl...
63da0803-8233-40d4-97ff-eccdc1bfcae3
5
public static void main(String[] args){ Deck d; decks = new DeckList(); try { FileInputStream fileStream = new FileInputStream("Deck.ser"); ObjectInputStream os = new ObjectInputStream(fileStream); Object deckList = os.readObject(); decks = (DeckList) deckList ; os.close(); } catch (Exce...
e3fc9641-11d5-4033-b897-e098a9af9b48
7
@SuppressWarnings("unchecked") // FIXME in Java7 private void filterDestinations() { DefaultListModel model = (DefaultListModel) destinationList.getModel(); Object selected = destinationList.getSelectedValue(); model.clear(); for (Destination d : destinations) { if (showO...
df5d9695-d86c-4557-bbd4-b93948ac0c06
0
public void addBomber(IBomber b){ bombers.add(b); }
0e663fa1-512a-4330-a83b-fa61eb1695b4
5
public static Graph FechoTransitivo(Graph grafo) { Graph resultado = new Graph(grafo.getNlc()); resultado.setMatriz(grafo.getMatriz()); for (int i = 0; i < resultado.getNlc(); i++) for (int j = 0; j < resultado.getNlc(); j++) { for (int k = 0; k < resultado.getNlc(); k++) { //Se existe caminho de j...
bea1d12b-d794-480a-ac34-42a3595a4af8
4
public void rimuovi(T x) { AlberoBin<T> curr = cercaNodo(x); if (curr == null || !curr.val().equals(x)) return; AlberoBin<T> padre; int pos; if (curr.sin() == null || curr.des() == null) { pos = curr.pos(); padre = curr.padreBin(); rimuoviNodo(curr); } else { AlberoBin<T> curr2 = max(curr.sin()); ...
de59fbf1-2fe2-4052-adb4-7d20dfb3e366
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; ...
1b309afc-a928-4fa7-9a7f-d764e4303d29
7
private ConfigurationArea handleObject(ConfigurationArea configurationArea, final Set<SystemObject> objects, final SystemObject systemObject, final SystemObject dynamicObject) { // alle SystemObjekte werden hier betrachtet (Konfigurations-Objekte und dynamische Objekte) // Attribute, ObjectSet, AttributeGroupUsage ...
f2d5d54b-1103-4d18-b945-e21cadf02ec5
8
private static String parseEscapedSequence(StringCharacterIterator iterator) throws UnsupportedEncodingException { char c = iterator.next(); if (c == '\\') { return new String(new byte[]{0, '\\'}, "UTF-8"); } else if (c == '"') { return new String(new byte[]{0, '\"'}, "UT...
88123afa-b5e4-4cc6-93f5-26ddfb11dc4c
3
@Override public int hashCode() { int hash = 3; hash = 97 * hash + (this.mapID != null ? this.mapID.hashCode() : 0); hash = 97 * hash + (this.map != null ? this.map.hashCode() : 0); hash = 97 * hash + (this.cell != null ? this.cell.hashCode() : 0); return hash; }
6e88a9e5-f8ff-4bbf-91b1-95ad6d37403a
2
@Override public void keyPressed(KeyEvent e) { // Synchronise the registeredListeningObjects synchronized (registeredListeningObjects) { for (IKeyboardEventable keyListener : registeredListeningObjects) { synchronized (waitingEventLists) { waitingEventLists.get(KeyEventType.KEY_PRESSED).add(new EventHo...
9e7e88de-3ba0-44cc-bca9-ab3b00efd395
7
public List getTags() { clearResultMetaInformation(); List tags = new ArrayList(); StringBuffer result = new StringBuffer(); GetMethod get = new GetMethod(apiEndpoint + DeliciousConstants.TAGS_GET); get.setDoAuthentication(true); try { httpResult = httpClien...
e891288e-d1e5-4938-9958-d627742a4c9b
5
public int getEffectTextWidth(String text) { if (text == null) return 0; int width = 0; for (int index = 0; index < text.length(); index++) { if (text.charAt(index) == '@' && index + 4 < text.length() && text.charAt(index + 4) == '@') { index += 4; } else { width += characterScreenWidth[text.char...
b055d907-9230-4183-bf2b-c7de07b85c39
0
public boolean isDirected() { return directed; }
86f64401-bc40-4084-877d-a2b42f3d329c
7
@Override protected final void onButtonClick(Button button) { if (!frozen) { if (button.active) { if (loaded && button.id < 5) { this.openLevel(button.id); } // if (finished || loaded && var1.id == 5) { // froze...
da2d5a85-5883-45ba-adbc-a00fbf6461c8
2
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { okButton = new javax.swing.JButton(); cancelButton = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); titleTextField = new javax.s...
09a1de34-601b-459e-8fbe-de97c756de60
3
public static void main(String[] args) { //Fail ResourceBundle res = ResourceBundle.getBundle("GlobalRes"); String msg; if(args.length > 0){ msg = res.getString(GlobalRes.GOODBYE); } else{ msg = res.getString(GlobalRes.HELLO); } System.out.println(msg); //Fail ResourceBundle res1 = Resource...
8b89a9e9-e24b-4b66-9108-a4776511c9b8
2
private static void sendRefuseOfferPackages(String buyer, String service, List<String> usersToRefuse) { SerializableRefuseOffer refuseOffer; SelectionKey key; for (String refusedSeller : usersToRefuse) { refuseOffer = new SerializableRefuseOffer(); refuseOffer.userName = buyer; refuseOffer.serviceNam...
202b2b50-7458-4e6c-91cf-446a44d2202c
0
public void setFesEstado(String fesEstado) { this.fesEstado = fesEstado; }
55ef4519-7d12-4494-9d2b-0e585868159a
0
@Override public String getTitle() { return "Java Blocks Game"; }