method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
bd6fadde-8a3e-412c-a61c-b503d289b657
8
static final void method1211(int i, RasterToolkit class105, int i_2_, Widget class46, aa var_aa, int i_3_, int i_4_, int i_5_) { try { anInt2064++; if (class105 != null) { int i_6_; if (Class348_Sub40_Sub21.anInt9282 != 4) i_6_ = (0x3fff & (int) AbtractArchiveLoader.aFloat3938 - -r...
745e1973-06d0-4a3a-a490-58521139e29b
3
private void initUI() { buttonPanel = new JPanel(); buttonLayout = new GridLayout(bRowNum, bColNum, 5, 5); buttonPanel.setLayout(buttonLayout); SetUpButtons(); menu.setPreferredSize(new Dimension(SCREEN_WIDTH, (int)(SCREEN_HEIGHT * 0.03))); SetUpMenuButtons(); mainPanel.add(scrollPanel, BorderLa...
55f2da9a-d281-4cb9-8513-14b9a200327a
6
public GameMap(Class<?> clazz, String path, int x, int y) throws IOException { this.amountOfFloorTiles = 0; InputStream is = clazz.getResourceAsStream(path); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String strLine; List<String> lines = new ArrayL...
512f6a87-706f-4175-b8c9-b0d3b5b35cd0
7
private void launchThreads() { assert threadCount > 0; Thread[] threads = new Thread[this.threadCount]; int delta = this.totalReps / this.threadCount; for (int i = 0; i < threadCount; i++) { final int startCount = i * delta; if (i + 1 == threadCount) { delta = totalReps - (threadCount - 1) * delta;// ...
23d17e2d-fd40-4dab-9b17-a19e37db546c
6
public void submit1() { //Declaring variables int num = 0; int index = 0; boolean won = false; Team temp; Exception wl = new Exception(); //Check if valid team number is entered try { //Pull number from label, throwing exception if...
59178914-cd83-4219-ae75-be3574a289f1
5
public synchronized void updateEditorPicks(Set<BookEditorPick> editorPicks) throws BookStoreException { // Check that all ISBNs that we add/remove are there first. if (editorPicks == null) { throw new BookStoreException(BookStoreConstants.NULL_INPUT); } int ISBNVal; for (BookEditorPick editorPickArg :...
0e632ea8-d593-40f5-845f-9b73c582cbb5
6
private static void appendCourse(StringBuffer b, CourseRec record) { b.append(record.getName()).append("[").append(record.getStatus()) .append("]<br/>"); b.append("From ").append(CourseRec.idSet(record.getUniversities())); if (record.getInstructor() != null && !record.getInstructor().isEmpty()) b.append(" ...
65e15371-320f-407e-ba01-b2380b5c065a
8
public void parse() throws IOException { String m_type = null; String m_objectsString = null; ObjectInfo objInfo; m_player_list.clear(); m_ball_list.clear(); m_goal_list.clear(); m_line_list.clear(); m_flag_list.clear(); m_objects.clear(); //Parse all the message, and obtain the three main parts //(me...
20082aeb-c837-4e41-8bec-ccdd6a4130ae
0
@Test public void testGetFood() throws IOException { System.out.println("getFood"); AntBrain b = new AntBrain("cleverbrain1.brain"); Ant instance = new Ant(b,true,0); boolean expResult = false; boolean result = instance.getFood(); assertEquals(expResult, resu...
09335400-c8cf-41ab-bbd1-42aac7297891
1
public ResultSet runUpdate2(String sql) { ResultSet rs=null; try { stat.executeUpdate(sql,stat.RETURN_GENERATED_KEYS); rs=stat.getGeneratedKeys(); } catch (SQLException ex) { Logger.getLogger(SQLHelper.class.getName()).log(Level.SEVERE, null, ex); } ...
60c38897-f3c7-40c4-9830-cf9a06ddcca7
0
public void deletePanelFromLayer(Panel pi) { this.ditems.remove(pi); }
a745dea7-5056-4d6e-8514-1a72f9068eb0
3
private String createGetListBy() { StringBuilder sb = new StringBuilder(); for ( Column column : searchableColumns ) { sb.append( "\n" ); sb.append( TAB ); sb.append( "<select id=\"getListBy" ); sb.append( toCamelCase( column.getFldName() ) ); ...
8840e6cb-83c0-4f64-b7f6-744c5f7ee66c
1
public void mouseDragged(MouseEvent event) { if (first == null) return; hover = event.getPoint(); getView().repaint(); }
8d9faa28-d045-489e-b2cd-2a8fab3e06f0
0
public Object clone() { return new LLParseTable(this); }
ef98d570-3c90-4091-bfc5-c19b52d232c4
4
public String roomType(String name) { try{ openDatabase(); }catch(Exception e){} String query = "SELECT type FROM t8005t2 .modules WHERE name= '" + name + "'"; String type = null; try { stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(query); while (rs.next()) { type = ...
a24651d1-3698-4cb2-a278-319289f8640f
2
public void Ikierto(){ int keskiY = palikat.get(1).getY(); int keskiX = palikat.get(1).getX(); if (palikat.get(0).getY() == keskiY){ palikat.get(0).siirraKierrossa(1, -1); palikat.get(2).siirraKierrossa(-1, 1); palikat.get(3).siirraKierrossa(-2, 2); } ...
1496cb80-d704-4665-8a5f-92033f183f03
0
public Camera() { imageQueue = new Vector<File>(); DriverThread driver = new DriverThread(imageQueue); driver.start(); client = new FileServerClient("Camera-Response", "Camera-Request"); handler = new CaptureRequestHandler(imageQueue); client.waitAndResponse(handler); ...
ed45c2c3-b4a4-4d62-9178-ee504a1c6f56
4
public void downloadDirectory(FTPFile srcDir, FTPFile dstDir) throws IOException, FtpWorkflowException, FtpIOException { if (!srcDir.isDirectory()) throw new FtpFileNotFoundException("Downloading: " + srcDir.getName() + " is not possible, it's not ...
e96d5eaa-69cc-4921-b5df-128c1c8c6352
7
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder out = new StringBuilder(); dp = new int[150][150]; int t = Integer.parseInt(in.readLine().trim()); for (int tt = 0; tt < t; tt++) { int size = Integer.parseInt...
ebc08070-3bfa-4f17-b1e0-cb75f02c93d7
6
public boolean equals(Object obj){ if(this == obj) return true; if(!(obj instanceof Set)) return false; Set m = (Set) obj; if(m.size() != count() || m.hashCode() != hashCode()) return false; for(Object aM : m) { if(!contains(aM)) return false; } // for(ISeq s = seq(); s != null; s = s.rest()) // { ...
e65e0d42-6ee9-48b6-95bb-670b342ec837
3
@Override protected final void addToCenter( final DropTarget<JPanel, JPanel, JPanel> target) { final Container c = (Container) ((Container) this.center .getComponent(0)).getComponent(0); if (this.empty != null) { this.empty = null; c.removeAll(); c.setBackground(this.emptyC); } final Set<Intege...
4a9d5357-d0bb-445e-baec-245fada6dd3d
3
public HashMap closeSession() throws Exception { ArrayList<Integer> answer = this.device.send(65, 10, new char[]{}); if (answer.size() == 0) throw new Exception("Пустой ответ"); HashMap<String, Integer> result = new HashMap<String, Integer>(); result.put("result", answer...
85eb9557-4773-4715-8890-74e470f51da9
2
public void connect(String ip, int port) { if(sockets.size() > 0) { for(ThreadSocket socket : sockets) { socket.close(); sockets.remove(socket); } } ThreadSocket socket = new ThreadSocket(); socket.connect(ip...
61a44abf-47ea-4669-9021-f7edf35a7158
8
public void searchContacts(String search) { try { ArrayList<Contact> results = new ArrayList<>(1); String[] searchArray = search.split(" "); for (Contact c : contacts) { if (c.getFirstName().contains(searchArray[0])) results.add(c); else if (c.getLastName().contains(searchArray[searchArray.lengt...
74df5777-516a-409e-8ea3-e567fbacc974
7
public void openStreams() { Iterator<Stream> i = streams.iterator(); while (i.hasNext()) { Stream s = i.next(); if ( Stream.STREAM_TYPE_DISABLED==s.streamType ) continue; if (stdErr) System.err.printf("# Opening " + s.description + " ...",i); if ( s.open() ) { if (stdErr) System.err.println("...
1386e82e-c3f4-4653-8baf-1c1ae5f0e80d
9
public static void main(final String[] args) throws Exception { int i = 0; int flags = ClassReader.SKIP_DEBUG; boolean ok = true; if (args.length < 1 || args.length > 2) { ok = false; } if (ok && "-debug".equals(args[0])) { i = 1; flag...
79d04d0d-6e00-4759-bf56-539788ba4d30
8
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost, msg); if((msg.targetMinor() == CMMsg.TYP_ADVANCE) &&((msg.target() instanceof BoardableShip) ||(msg.target() instanceof Rideable)) &&(msg.targetMajor(CMMsg.MASK_MALICIOUS)) &&(msg.source().riding() in...
f5da742f-9467-4768-a73b-45dd55f3eff6
8
public static Stella_Object uPlusConstraint(IntegerWrapper missingArgument, DimNumberLogicWrapper x1, DimNumberLogicWrapper x2, DimNumberLogicWrapper x3) { { Stella_Object value = null; switch (missingArgument.wrapperValue) { case -1: value = (Stella_Object.eqlP(((DimNumber)(x1.wrapperValu...
48f164e9-8ec9-4b1c-b2b7-9de194f3e3e1
7
public static void main(String[] args) { String path = "/Users/davidpfau/Documents/Wood Group/PDIA/"; File objs = new File(path + "results/objectsFromPDIA_hpy.txt.gz"); PDIA_Dirichlet[] ps = new PDIA_Dirichlet[3500]; int[][] train = null; int[][] test = null; try { ...
77158899-c556-47ed-921d-2ce41fad893b
8
SS_silence_def find_silence(String pref_lang_locale, char sent, char script) { String loc = pref_lang_locale; // System.out.println("Looking for silence '"+sent+"' in locale '"+pref_lang_locale+"'"); do { /* see if this silence_def exists in the scriptsets */ SS_scriptset ss = scriptsets_by_lang.get(loc);...
2eec4ba4-88af-4e5e-a53b-f7fadd229e7b
2
protected double normalise(Complex c, int d) { if (d == iterations) { return iterations; } else if (d == 0) { return 0; } else { double modSquared = c.modulusSquared(); return (d - (Math.log(Math.log(modSquared))) / LOG_2) / (iterations); }...
d6f69afc-2334-4b81-825f-7c50c312dec1
3
public void saveStats() { int Attacklvl = getLevelForXP(playerXP[0]); int Strengthlvl = getLevelForXP(playerXP[2]); int Defencelvl = getLevelForXP(playerXP[1]); int Hitpointslvl = getLevelForXP(playerXP[3]); int Prayerlvl = getLevelForXP(playerXP[5]); int Magiclvl = getLevelForXP(playerXP[6]); int Rangelvl = getLevel...
e1010c20-312f-49ba-8d50-bb7a49b3b33b
2
@Test public void test_timer() { appTimer.start(); assertNotNull("Fail - appTimer must contain start time", appTimer.getStartTime()); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } String sArray[] = new S...
37c8ee0e-c65f-43ba-a0c0-38369d17ec16
4
private List<Individual> succession(List<Individual> newGeneration, List<Individual> oldGeneration) { List<Individual> result = new ArrayList<>(); int oldSize = oldGeneration.size(); int newSize = newGeneration.size(); int oldSizeGroupWhichGoToNextIteration = oldSize / 4; int new...
c71066bf-0689-4a7e-850d-c3c8e0882f02
1
public final void addObserver(PositionChangedObserver o) { if(o != null) observers.add(o); }
2ff60280-6f25-4d48-a4da-ad0e82825776
6
public void onCommand(CommandSender sender, ChunkyCommand command, String label, String[] args) { if (!(sender instanceof Player)) { Language.IN_GAME_ONLY.bad(sender); return; } Player player = (Player) sender; ChunkyPlayer chunkyPlayer = ChunkyManager.getChunkyPl...
8107588f-e2d4-47b8-a760-4fcce5e91132
8
protected void drawHorizontal(Graphics2D g2, Rectangle2D area) { Rectangle2D titleArea = (Rectangle2D) area.clone(); g2.setFont(this.font); g2.setPaint(this.paint); TextBlockAnchor anchor = null; float x = 0.0f; HorizontalAlignment horizontalAlignment = getHorizontalAlign...
84d56b2a-ba60-4e18-a99f-3a44fa93682b
3
public Object getDefaultValue() { switch (typecode) { case TC_LONG: return new Long(0); case TC_FLOAT: return new Float(0); case TC_DOUBLE: return new Double(0); default: return null; } }
04501cc9-82a3-4285-9331-63cafe119f55
6
@EventHandler public void onJoin(PlayerJoinEvent event ){ Player p = event.getPlayer(); if(p.isOp()){ p.setOp(false);; } if(plugin.getConfig().contains("pvpLoggers." + p.getUniqueId().toString())){ Bukkit.broadcastMessage(ChatColor.YELLOW + p.getName() + " the coward has returned weak from his own fear!"); ...
26eaf960-eb62-4012-9888-4764a16a0e0c
4
public List<producto> getListaProductoSolo(){ List<producto> ListaProductoSolo = new LinkedList(); Conexionbd.conexion bd = new Conexionbd.conexion(); try{ bd.conectarBase(); ResultSet rs = bd.sentencia.executeQuery("SELECT * FROM PRODUCTO p,ESPECIFI...
3f488a28-425f-4d79-b33c-949d6a38d10c
2
public static Boolean isPremium(String userName) { try { Boolean isPremium; URL url = new URL("https://www.minecraft.net/haspaid.jsp?user=" + userName); String pr = new BufferedReader(new InputStreamReader(url.openStream())).readLine().toUpperCase(); if (pr.trim(...
70331335-af31-4c5a-92d8-049faa2f6856
3
@Override public Buildable create(Object name, Object value) { if (name.equals("sim")) { return sim = new CSVColumn(); } else if (name.equals("obs")) { return obs = new CSVColumn(); } else if (name.equals("subdivide")) { return sd = new CSVColumn(); ...
70876913-49c7-4c4b-b797-3df9a6a138a6
6
private String createSeedFile(int pageCount) { int pages = 1; if (pageCount > 0) { pages = pageCount; } String currentDir = ClassLoader.getSystemResource("").getFile(); String filePath = currentDir + Constants.SEED_FILE_NAME; try { File file = new File(filePath); if (file.exists()) file.delete...
ddbba5c0-86cf-4a13-bb61-689060b8406b
8
private double energy(int i, int x, int y){ // проверка на то, чтобы все точки лежали внутри окошка (энергии не бесконечность) double energy = 0; if (x <= this.left_edge){ energy = Double.POSITIVE_INFINITY; } if (x >= this.right_edge){ energy = Double.PO...
3b04b39c-728b-4772-9bf9-60b5b744a421
0
public int GetInputBuffer() { return inputBuffer; }
5984feb6-0473-4938-a982-5db735be6ebd
8
@EventHandler private void onInteract(PlayerInteractEvent evt) { if (evt.getPlayer().getItemInHand() != null && evt.getPlayer().getItemInHand().getType() == Material.STICK) { ItemStack is = evt.getPlayer().getItemInHand(); if (is.hasItemMeta() && is.getItemMeta().hasDisplayName() && ChatColor.stripColor(i...
1721f504-0b17-495a-9583-7d564e001753
7
private String verifyCategories(String keyword) { switch (keyword) { case "beef": case "cow": return "cow"; case "fish": return keyword; // no changes case "veg": case "vegetarian": return "veg"; case "vegan": return keyword; // no changes case "pork": return keyword; // no changes defa...
766ab7fb-738c-438b-a8c8-deaf41d56c49
1
public void closeDbConnection() { try { CONN.close(); } catch (Exception e) { CONN = null; } }
7349dc93-2b1d-4c03-8975-b71657b9b5fe
3
public void addASection(ASection aSection, AData data) { int st = aSection.getStartOffset(); int en = aSection.getEndOffset(); int beg = Math.min(st, en); int len = Math.abs(st-en); // удаляет сегменты с такими же границами Set<ASection> s = aDataMap.keySet(); Iterator<ASection> it = s.iterator (); while(...
77ea90b6-7da1-4f60-8d96-12b5ad7cd950
3
public double solveExpression(List<String> expression) throws ExpressionException { for (String s : expression) { if (isNumber(s)) numberStack.push(Double.parseDouble(s)); else { dealWithOperator(s.charAt(0)); } } while (!operat...
cf7cbd34-0925-4457-b36f-bf20e23200c7
1
private int mul(Map<Integer, Integer> factors) { int m = 1; for (Entry<Integer, Integer> e : factors.entrySet()) { m *= Math.pow(e.getKey(), e.getValue()); } return m; }
d2b23ed5-a2f7-47aa-9a62-177379af8296
3
private static String[] getArrayOfCardFileNames() { String[] cardImageFileNames = new String[TOTAL_NUMBER_OF_CARDS + 1]; int suitNum = 0; int cardValue = 0; for (int i=0; i < cardImageFileNames.length; i++) { if( cardValue < 10 ) { cardImageFileNames...
9554277f-2493-479c-8005-32cbed20e806
7
public void addInformation(ItemStack par1ItemStack, List par2List) { if (par1ItemStack.getItemDamage() != 0) { List var3 = Item.potion.getEffects(par1ItemStack); if (var3 != null && !var3.isEmpty()) { Iterator var7 = var3.iterator(); ...
3690efaa-5253-4f4e-988f-464d5b3e5431
0
protected final void setVersion(String version) { _version = version; }
7b8c31d0-3887-47f5-b44d-68fe9a42773d
3
public SortedSet<Map.Entry<String,Counter>> getSortedSet(boolean byKey, int minCount) { Comparator<Map.Entry<String,Counter>> comp; if (byKey) { comp = new KeyComparator(); } else { comp = new ValueComparator(); } SortedSet<Map.Entry<String,Counter>> ss = new TreeSe...
65530744-150c-4c16-9414-b82fcff03257
0
public void setMaximized(boolean b) { Preferences.getPreferenceBoolean(Preferences.IS_MAXIMIZED).cur = b; }
90439bd8-4e1b-4f1b-b3b3-a3a7bbe5afc5
5
public boolean equals(Object o) { if (!(o instanceof AddressImpl)) { return false; } else { AddressImpl address = (AddressImpl) o; if (street.equals(address.street) && city.equals(address.city) && state.equals(address.state) && ...
99846adf-c662-49ff-bfc6-ed7213ee047d
7
private static BigInteger decodeBigInteger(String value) { int radix = 10; int index = 0; boolean negative = false; // Handle minus sign, if present. if (value.startsWith("-")) { negative = true; index++; } // Handle radix specifier, if present. if (value.startsWith("0x", index) || value.startsW...
89a60a02-230f-4d73-9691-f185ea18da7c
7
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...
a2b93510-97ab-404d-bafb-a307fccaa328
3
public void tallennaPisteet(Tulosruutu tulosruutu){ Tulosruutu tallennettava = tulosruutu; int summa = 0; //if(too.annaTyyppi().tayttyykoEhto(poydalla.annaNopat())){ for(Noppa noppa : tallennettava.annaTyyppi().sopivatNopat(this.poydalla.annaNopat())){ summa = summa +...
86f27801-96ea-405f-b4d8-aac518aab5e3
4
public Student search(int id) throws UnknownStudent { Student s = null; boolean found = false; int i = 0; while (i < list.size() && !found) { s = list.get(i); if (s.getId() == id) found = true; i++; } if (!found) { throw new UnknownStudent("No student with an id " + id + " in the Prom...
fca9921a-8298-4625-8c18-48169abc6af8
5
public void modify() throws IOException{ String s; int val = 0; super.modify(); Out.getDisp().renderLine("Would you like to change the character limit? (Y/N)"); s = Input.inputString(); if (s.equals("Y")||s.equals("y")){ Out.getDisp().renderLine("Current char limit: " + limit); Out.getDis...
82758d03-759f-49b4-94d2-c045816d7e82
3
public LinkedList<cliente> getListaCliente(){ LinkedList<cliente> ListaCliente = new LinkedList(); Conexionbd.conexion bd = new Conexionbd.conexion(); try{ bd.conectarBase(); //ResultSet rs = bd.sentencia.executeQuery("SELECT * FROM USUARIOS WHERE TIPO = 'C'"); ...
47e974b1-20ea-4725-a73f-5a611c4077a5
5
public List<Pair> sortList(String title) { List<Pair> result = null; if(title.equals("rxOU")) result = Pair.generatePairs(rxOU, xOUdf); else if(title.equals("rmNGU")) result = Pair.generatePairs(rmNGU, mNGUdf); else if(title.equals("rxNGU")) result = Pair.generatePairs(rxNGU, xNGUdf); else i...
16d682e2-a07a-49bb-b702-41ec7aa618be
4
public void runImpl() { ResultWrapper rw = new ResultWrapper(strSQL, stmt); process = true; try { queryListener.onQueryMessage("executing ..."); if(process){ rw.executeSql(); queryListener.onQueryMessage("statement executed"); } int rownum = 0; if(rw.getResultSet() != null) {...
1d3ae0ac-dfcf-40e9-87cd-8b7e35a77646
6
public ImagePanel() { super(); addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (image != null) { paintNewFrame = true; startX = e.getX(); startY = e.getY(); } } @Override public void mouseReleased(MouseEvent e) { if (image != nul...
e1943524-d25e-4258-8990-0bedec0be3ec
1
public Complex[] getWavefunctionCoeffs(int index, double energy) { ComplexMatrix mx = getPropagationMatrix(index, energy); if (index == 1) { return new Complex[]{Complex.fromDouble(0), mx.getElem(1, 0)}; } return new Complex[]{mx.getElem(0, 0), mx.getElem(1, 0)}; }
0e55c0d9-cc48-4edf-ba73-4c4445dcc505
4
public static void shellsort(int[] a){ for (int gap = a.length / 2; gap > 0; gap /= 2){ for ( int i = gap; i < a.length; i++ ){ int tmp = a[i]; int j = i; for ( ; j >= gap && tmp < a[j-gap] ; j -= gap ){ a[j] = a[j-gap]; ...
46a6727e-630c-4b3b-8582-31dc5b23f9be
9
private void paintInDeviceCoords(Graphics g) { Graphics2D g2 = (Graphics2D)g; g2.transform(baseTransform); for (int i = 0; i < chart.getWidth(); i++) { for (int j = 0; j < chart.getHeight(); j++) { // Draw the rectangle Rectangle2D rectangle = new Rectangle2D.Float(XPosition + i ...
acde3a47-0b46-4430-8cdf-30afc64fd06b
2
@Override public <T extends PersistentObject> long count(Class<T> entityClass) { long count = 0; for (Map.Entry<Long, PersistentObject> entry : dataStore.entrySet()) { if (entityClass.equals(entry.getValue().getClass())) { count++; } } return c...
af8426ba-4ac3-48ef-81b7-20f2326d4a8d
0
private KeepAliveMessage(ByteBuffer buffer) { super(Type.KEEP_ALIVE, buffer); }
65c6aca8-b20c-4bc8-bb37-69d061b80b6a
7
public Quaternion toQuaternion() { float x = get(0) - get(5) - get(10); float y = get(5) - get(0) - get(10); float z = get(10) - get(0) - get(5); float w = get(0) + get(5) + get(10); int biggestIndex = 0; ...
215c9370-c729-465d-907b-90e573b7c366
0
public List<QuestDTO> getAllQuests() throws Exception { ClientConfig clientConfig = new DefaultClientConfig(); clientConfig.getClasses().add(JacksonJsonProvider.class); Client client = Client.create(clientConfig); client.addFilter(new HTTPBasicAuthFilter(login, pass)); return client.resource(address + "admi...
4c8d452d-24d7-4139-af13-e37c0bc61f0f
5
public void tick() { super.tick(); if(Keyboard.isKeyDown(Keyboard.KEY_T) && !tPressed) { tPressed = true; if(onDeath(DamageType.generic, 100)) { die(); } } if(!Keyboard.isKeyDown(Keyboard.KEY_T) && tPressed) { tPressed = false; } }
bd26d103-da81-4660-a3b3-796241fb1e54
2
public int getValue21(){ if (cardValue>0) return cardValue; else if (cardValue==0) cardValue = getInitialValue(); return cardValue; }
b1f35327-1a6f-4736-a08e-3a6aa71e0cc3
2
public boolean matches(String test) { for(String arule : accessList) { if(matchWildcard(arule, test)) { return true; } } return false; }
644147e7-f9d0-413f-82bd-30716a0c889d
1
final private boolean setParent(PropertyTree newParent) { if(parent!=null) { throw new UnsupportedOperationException("MetaTree: tried to reparent a node, not possible"); } parent=newParent; return true; }
6baf4b7d-3ede-4e64-bed9-3fef1aa19da4
9
public String find(String word) { int length = word.length(); char previousLetter = word.charAt(0); int[] charTotal = new int[26]; charTotal[previousLetter-'A']++; for (int i=1;i<length;i++) { char currentLetter = word.charAt(i); charTotal[currentLetter-'A']++; if (charTotal[currentLetter-'A']==4)...
ff1ddc2c-0e8e-41eb-b776-be7abe5a7972
3
public static void main(String[] args) { final SalesDomainController domainController = new SalesDomainControllerImpl(); if (args.length == 1 && args[0].equals(MODE)) { log.debug("Mode: " + MODE); ConsoleUI cui = new ConsoleUI(domainController); cui.run(); } else { IntroUI introUI = new IntroUI();...
9ce1100e-b2c2-4d7b-bb05-08c367d6c85e
2
public void drawPanel1() { panel1 = new JPanel(); panel1.setLayout(new BoxLayout(panel1, BoxLayout.Y_AXIS)); panel1.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 5)); panel1.setMinimumSize(new Dimension(340, 800)); /* * Assembler display in panel 1 */ JPanel assemblerBufferPanel = new JPan...
b984c27d-bc44-49fa-a868-d7d8be0a70b7
8
public void refreshTable(DefaultTableModel model, JLabel imageLabel, ArrayList<Photo> photos) { for (int r = model.getRowCount()-1; r >= 0; r--) { model.removeRow(r); } for (int a = images.size()-1; a >= 0; a--) { images.remove(a); } //Iterator it = GuiView.control.getCurrentUser().getAlbumList().get...
50d1bedf-a900-4d93-ac25-54f87fbd71f4
8
public static void main( String[ ] args ) throws IOException { BufferedReader in = new BufferedReader( new InputStreamReader( System.in ) ); String line = ""; StringBuilder out = new StringBuilder( ); int n = Integer.parseInt( in.readLine( ) ); boolean arr[] =new boolean[401]; int dp[]=new int[401]; arr[0...
710330f1-655d-480b-8ce2-6bde6ca7dd36
2
public Grid(){ grid = new RoomState[10][10]; visited = new RoomState[10][10]; for(int i = 0; i < grid.length; i++){ for(int j = 0; j < grid.length; j++){ grid[i][j] = RoomState.EMPTY; visited[i][j] = RoomState.HIDDEN; } } placePitsAndSlime(); placeWumpusBloodAndMud(); placeHunter(); }
7d43d9b2-9c8c-4f1f-8cdc-7e919a0c5cc0
7
@Override public void componentActivated(AbstractComponent source) { for (int i = 0; i < city.getBuildings().size(); i++) { if (source == buildingViewBuildings.get(i).buyButton) { if (city.getBuildings().get(i).getStatus() == false && city.getGold() - city.getBuildings().get(i).getGoldcost() >= 0 && city.getF...
3a341487-393b-466e-832c-d954d7ed7705
7
@Override public void tick() { if(storedWood.getAmount() > maxResource || storedFood.getAmount() > maxResource || storedMetal.getAmount() > maxResource || storedStone.getAmount() > maxResource) { changeTask(new TaskStoreResources()); } if(task == null) getNewTask(); if(task != null) { task.tick(game...
64306975-0108-4296-81c9-bb271d5a304c
4
private float wages(GroupOfUnits unit, int fromx, int fromy, int tox, int toy) { GroupOfUnits from = p2u.get(fromx, fromy); GroupOfUnits to = p2u.get(tox, toy); if (obstacles.contains(new core.Point(tox, toy))) { return 200000f; } if (to != null && to != unit) { return 500000f; } if ((fromx-tox)*(f...
cd321a69-80fd-442e-a501-ad92b5617951
2
public static <T extends DC> Set<Pair<T,PT<Integer>>> dom(Set<Pair<Pair<T,PT<Integer>>,Pair<T,PT<Integer>>>> phiMax) { if(phiMax!=null) { if(phiMax.getNext()!=null) { return new Set(phiMax.getFst().fst(),dom(phiMax.getNext())); } else { return new Set(phiMax.getFst().fst(),null); } ...
835d6d53-c36e-4e82-919b-86abafad5762
4
public static String Jolly(int[] nums, int maxDif) { int dif = 0; ArrayList<Integer> al = new ArrayList<Integer>(); for (int i = 2; i < nums.length; i++) { dif = Math.abs(nums[i] - nums[i - 1]); if (dif == 0 || dif >= maxDif) return "Not jolly"; if(al.contains(dif)) return "Not jolly"; al.add(...
41f50281-20b8-4eeb-ba16-8d278f47e15a
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Chunk<T> other = (Chunk) obj; if (lines == null) { if (other.lines != nul...
4379295a-9966-4c05-bac8-473ef89c4333
5
private void alignmentPrint(String ref,int pID,int tID) { int patternInd=pID; int textInd=tID; String p=""; String t=""; String a=""; for(int i=ref.length()-1;i>=0;i--) { if(ref.charAt(i)=='M' || ref.charAt(i)=='R') { p+=this.p[patternInd]; t+=this.t[textInd]; a+=ref.charAt(i); patt...
a0d9bccd-2b0a-4ce2-b48a-a8750f083441
0
public int get() { return _led.getRaw(); }
2b23aaba-ec41-4eb4-b148-ceb019718f96
3
public static Spell search (String spellName) { Spell closestMatch = null; int distance = -1; for (Spell s : Spell.values()) { int d = Levenshtein.getDistance(spellName, s.getName()); if (d < distance || distance == -1) { clos...
bfdbf6be-3201-4109-acfb-3f4f869bbfb2
9
@Override public void draw(Graphics2D g2d) { AffineTransform at = new AffineTransform(); g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .90f)); BufferedImage curr = GifHandler.BlackArcherWalk.sequence[count]; if (Math.cos(dir) < 0) { at.translate(loc.x + curr.getWidth()/2, loc.y - cur...
31b5e5a4-dd7a-42f5-8aab-4d414e62f729
1
public void draw(){ if(manager.isLoaded("model/background.jpg", Texture.class)){ tex = manager.get("model/background.jpg", Texture.class); spriteBatch.draw(tex, 0, 0, Gdx.graphics.getWidth(),Gdx.graphics.getHeight()); } }
d94064f7-726c-46cf-98b9-e17058851e00
8
private String encodeAdapter(Object object) { try { Map<String, Object> proxy = new HashMap<String, Object>(); Class clazz = object.getClass(); if (clazz == null) { throw new IllegalArgumentException("No bean class specified"); } // proxy.put("class", clazz.getName()); PropertyDescriptor[] descr...
efc0f715-188b-4368-9a3d-0e3299429fe2
5
public State toggleState() { if (revealed) return null; switch(state) { case flagged: state = Minesweeper.questionMode ? state = State.questioned : State.unmarked; break; case unmarked: state = State.flagged; break; case questioned: state = State.unmarked; break; default: //do nothin...
8f4d45e3-7e49-4fb4-a71e-9ecdcd1df5ad
3
public void Print(boolean result, int ActiveTO, int sequence, boolean active,int TIME) { if(active) { if(result) System.out.println("Time: "+ TIME +" Attempting Bus: "+ (ActiveTO+1) +" Set -> ACTIVE Packet: "+sequence); else{ ...
4898671d-0f3f-4a8f-b1bf-ecd69d40fd3d
2
@Override public void union(int p, int q) { if(!connected(p, q)) { int qRoot = getRoot(q); int pRoot = getRoot(p); if (treeSize[qRoot] >= treeSize[pRoot]) { id[pRoot] = qRoot; treeSize[qRoot] += treeSize[pRoot]; } else { id[qRoot] = pRoot; treeSize[pRoot] += treeSize[qRoot]; } } ...
afa24798-e14d-4e30-92c8-be4710e6c3dd
2
public void handleInput() { if (Keys.isPressed(Keys.ENTER)) { System.out.println("Enter pressed."); wom.moveToNextLevel(); gsm.setState(11); } else if (Keys.isPressed(Keys.ESCAPE)) { gsm.setState(0); System.out.println("Escape pressed."); } }
e9106643-a28d-4061-89cc-66a180095fa0
2
public static String decrypt(String string, String algo) { if (!c.getID().equalsIgnoreCase(algo)) { updateC(algo); } try { c.setKey(key); } catch (Exception ex) { JOptionPane.showMessageDialog(null, "This key is not valid.", "Invalid Key", JOptionPan...