method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
0c652723-b575-4cbb-a237-1133dc9a20e7
6
public String getType(Symtab st) { if (type != null) return type; else { if (ident != null) { SymtabEntry identEntry = st.lookup(ident.toString()); if (identEntry == null) Main.error("variable does not exist (" + ident.toString() + ")"); return identEntry.getType(); } else if (oa !=...
c728dd43-690c-4563-a6d7-f319e7216ee0
2
public IrcClient getClient(String name){ for(IrcClient c : AllClients){ if(c.getName().equals(name)) return c; } return null; }
2431e39c-9246-490a-b3d8-7f2e368cb3cd
1
public static double[][] splineCubicoNatural(Punto[] puntos) { Arrays.sort(puntos); // Se ordenan los puntos para que se respete que Xi+1 >= Xi double[] z = gaussTriDiag(puntos); // Se obtienen los coeficientes z a traves del metodo de gauss para resolver la matriz int n = puntos.length-1; ...
0fe9e6c4-6c45-4466-ac2a-8411a5dbd46d
9
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); while ((line = in.readLine()) != null && line.length() != 0) { int nSet = Integer.parseInt(line.trim()); for (int...
8f9bc9d3-fddd-4e34-bb5f-2f889f79ecf6
7
private Item getFireSource(MOB target) { Item fireSource=null; for(int i=0;i<target.numItems();i++) { final Item I=target.getItem(i); if((CMLib.flags().isOnFire(I))&&(I.container()==null)) { fireSource=I; break; } } if(fireSource==null) for(int i=0;i<target.location().numItems();i++) ...
b1dd203c-bb8c-4637-bf68-6b3c03702977
5
static final ClientScript getClientScript(int i, int i_2_) { anInt4101++; ClientScript class348_sub42_sub19 = ((ClientScript) Class322.aClass308_4036.method2302((long) i_2_, (byte) -68)); if (class348_sub42_sub19 != null) return class348_sub42_sub19; byte[] is = Class113.indexLoader12.getChildArch...
8b796d77-3516-43dc-b0b5-96a84444d88e
5
public BuddyWnd(Coord c, Widget parent) { super(c, new Coord(400, 370), parent, "Kin"); instance = this; bl = new BuddyList(new Coord(10, 5), new Coord(180, 280), this) { public void changed(Buddy b) { if (b != null) BuddyWnd.this.wdgmsg("ch", b.id...
31e4383a-a362-49b2-9529-4af50832600c
9
@Override public void mouseClicked(MouseEvent e) { int x = e.getX(); int y = e.getY(); if(mode == null) { if(search == null) return; Node n = getNodeAt(x, y); if(n == null) return; if(first == null) { first = n; first.setColor(Color.RED); } else { List<Node> path = search.searc...
89c1abad-4c90-45a1-8c28-ba1ed4d20f33
3
public void subscribeEvent(String eventName, String function, Object className) { HashMap<Object, String> eventCallbacks = this.eventMap.get(eventName); if(eventCallbacks == null) { eventCallbacks = new HashMap<Object, String>(); this.eventMap.put(eventName, eventCallbacks); } if(!(eventCallbacks.contain...
32b1f8a0-9897-441a-9136-707986a74e14
7
public ListNode deleteDuplicates2(ListNode head) { if(head == null) return null; if(head.next == null) return head; ListNode prev = head; ListNode p = head.next; ListNode dummy = new ListNode(0); dummy.next = head; ListNode pprev = dummy; while(p != null...
e052c5bf-06d4-469a-b06e-870576b3090b
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...
abb07f39-3bbf-48c7-88e0-fb95ffff99ed
9
public void decrypt(BigInteger candidateHpwd){ try { deserializeObejct(init.getUserName() + "_" + FILE_NAME); //deserializing the history file } catch (IOException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } // setup AES cipher in CBC mode with PKCS #5 padding Cipher ci...
f6d240fb-89d1-46cb-85f6-57e83f74170c
3
synchronized public static org.omg.CORBA.TypeCode type () { if (__typeCode == null) { synchronized (org.omg.CORBA.TypeCode.class) { if (__typeCode == null) { if (__active) { return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); } ...
8f1a8606-f5f4-48a5-bdfc-856233f867a7
6
/* */ private static OS getPlatform() { /* 42 */ String osName = System.getProperty("os.name").toLowerCase(); /* 43 */ if (osName.contains("win")) return OS.windows; /* 44 */ if (osName.contains("mac")) return OS.macos; /* 45 */ if (osName.contains("solaris")) return OS.solaris; /* 46 */ if (os...
09983d4c-0611-4e4d-8209-df80aa48c975
3
public List<LoginEntry> readPlayersDate(String date) { List<LoginEntry> retList = new ArrayList<LoginEntry>(); try { ResultSet rs = _sqLite.query("SELECT p.playername AS name, j.newest as newest, j.time_online as online FROM player AS p JOIN " + " (SELECT id, id_player, max(time_login) AS newest, tim...
c2cd8d4a-9af9-4e43-bb93-a9523f7fe53a
9
public Color brighter() { int r = getRed(); int g = getGreen(); int b = getBlue(); /* From 2D group: * 1. black.brighter() should return grey * 2. applying brighter to blue will always return blue, brighter * 3. non pure color (non zero rgb) will eventually re...
15cc86ed-8b04-411a-abf6-106b69520c3f
7
private void dispose(final GSSContext context) { if (null != context) { try { SpnegoHttpURLConnection.LOCK.lock(); try { context.dispose(); } finally { SpnegoHttpURLConnection.LOCK.unlock(); } ...
18ec1ac9-43e1-4439-a43d-c766feefbdee
2
public boolean store(){ if(this.account_num == -1) return false; SQLiteJDBC db = new SQLiteJDBC(); String sql = String.format( "INSERT INTO card_accounts(account_num,loyalty_program, user_id,expiry_date,issuer,points_earned)" + "VALUES('%d','%d','%d', '%s','%d...
8efbaa0f-43ca-4482-94de-a4f740d37334
0
@Test(expected=IllegalNumberOfOperandsException.class) public void testIllegalNumberOfOperandsTimes(){ calculator.pushOperand(7.0); calculator.pushTimesOperator(); calculator.evaluateStack(); //assertTrue("An IllegalNumberOfOperandsException should heve been thrown here.", false); }
c50c485b-b1d7-4160-83a4-18c23edf2fb6
1
@Test public void twoCompCircular() throws Exception { try { C c = new C(); fail(); } catch (RuntimeException E) { assertTrue(E.getMessage().contains("Circular")); } }
b37f9ce0-171a-47e6-8529-81f863eb783c
1
public ChatWindow() throws IOException { setSize(500, 600); setLocationRelativeTo(null); setTitle("Chat"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); chatHistory = new JTextArea(); chatHistory.setEditable(false); chatText = new JTextField(500); chatText.addActionListener(new ActionListener() { ...
cdb46c3c-ddfa-4427-ae43-27820b4a159a
4
public void readEntityList(ByteBuffer toRead) { boolean done; world.entityList.clear(); done = false; try { while (!done) { if (!toRead.hasRemaining()) break; String className = Server.getString(toRead); Cl...
13eebbbb-6462-459a-9baa-389b51962cab
3
public DeleteActivityWindow() { setTitle("Eliminar actividad"); this.activityService = ActivityService.getInstance(); setResizable(false); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(100, 100, 344, 109); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); s...
c6c1f3d4-97ab-495e-afb0-56b30c152291
4
public static Boardable nearestHaven(Actor actor, Class prefClass) { Object picked = null ; float bestRating = 0 ; for (Element e : actor.mind.awareOf()) { final float rating = rateHaven(e, actor, prefClass) ; if (rating > bestRating) { bestRating = rating ; picked = e ; } } if (pic...
64c0745b-01da-4653-b2b0-5a02e4f0977e
8
private static int extendCdata(final char[] buf, int off, final int end) throws InvalidTokenException { while (off != end) { switch (charType(buf[off])) { case CT_LEAD2: if (end - off < 2) return off; check2(buf, off); off += 2; break; case CT_RSQB: case CT_NONXML: case CT_MAL...
a496ca47-acf1-4e39-8477-684ca8e9923b
6
public void setReturn2() { String src_region = null; String src_agent = null; String src_plugin = null; if(getParam("src_region") != null) //plugin { setMsgRegion(src_region); src_region = new String(getParam("src_region")); if(getParam("src_agent") != null) //plugin { src_agent = ...
e73305a3-b42f-48cf-81bd-d762f5143aa4
5
private boolean moveable(int x, int y) { if(Game.inMap(x, y)) //If within board { if((Game.map.getUnit(x, y) == null || Game.map.getUnit(x, y).getTEAM() == team)) //If tile is open { if(movement[x][y] == 0 && Game.map.getGrid()[x][y].getType() == 1) ...
694a7855-f667-454f-872b-e9647e0bb76d
3
public void inicializarObservables(ArrayList<Carro> carros, ArrayList<Nodo> huertos) { pCarros.inicializarObservables(carros); ArrayList<Huerto> huertosV= new ArrayList<Huerto>(); Huerto h=null; for(Nodo n : huertos){ if(!huertosV.contains(n)) { h=n.getHuerto(); if(h!=nul...
78ac1d47-9eb8-471c-8e8c-b51beb57f07b
3
public static void remove(SocketAddress sa){ synchronized(map){ if(map.containsKey(sa)){ int i = map.get(sa); System.out.println(i); if(i > 1){ map.put(sa, i-1); }else if(i == 1){ map.remove(sa); } } } }
08d3836c-5783-4ae7-94af-6d7eb0d0d749
3
public static DatabaseInterface db(boolean isKrak) { if(isKrak) { if(db == null){db = new DatabaseHandler();} return db; } else { if(osmParser == null){osmParser = new OSMParser();} return osmParser; } }
6927f05e-ddc5-4216-9f8c-2a35df7c2e82
2
public String getLigneDispo(){ String s=""; for (int i = 1; i < TabLigne.length; i++) { if(TabLigne[i]==true){ s+="LIGNE "+i+","; } } return s; }
3a8a32a5-d220-4dd7-9879-6de1c569a277
3
public void sortArray() { this.arrayAccess = 0; this.comparisions = 0; /** * Pass the array once. This time from the back so that the inner loop * works well. */ for (int i = this.array.length - 1; i > 0; i--) { /** * The loop for the...
25ebe278-4279-4ce9-baa7-091dea752915
5
private static double[] getSupportPoints(int lineNumber, double[] lowPrices) { double[] sPoints = new double[lineNumber]; for(int i =0;i<lineNumber-1;i++){ double price = 999999999; for(int j=-5;j<=0;j++){ if((i+j>=0) && (i+j<lineNumber-1) && lowPrices[i+j]<pri...
bce8da2c-c18c-4e49-a882-e7a470df4b84
4
@Override protected void paintComponent(Graphics g) { super.paintComponent(g); BufferedImage image = drawImage("/imgs/menu/background.jpg"); int iw = image.getWidth(this); int ih = image.getHeight(this); if (iw > 0 && ih > 0) { for (int x = 0; x < getWidth(); x += iw) { for (int y = 0; y < getHeight()...
8ef03dbc-dd49-46d3-be84-c2d581e08cfe
5
public Hypergeometric(int N, int K, int n) throws ParameterException { if (N < 0 || K < 0 || K > N || n < 0 || n > N) { throw new ParameterException("Hypergeometric parameters N >= 0, 0 <= K <= N, 0 <= n <= N."); } else { this.N = N; this.K = K; this.n = n; } }
f5fd292d-54eb-4429-b319-6019ad38ee4e
7
public void dispose() { //System.out.println(" Shapes Images vector size " + images.size()); for (Image image : images) { image.flush(); } // one more try to free up some memory images.clear(); images.trimToSize(); //System.out.println(" Shapes Sh...
99bf7a28-b1c7-4788-9238-f61a779ce811
4
public AWTConsole() { // create all components and add them frame=new Frame("Console"); Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize=new Dimension((int)(screenSize.width/2),(int)(screenSize.height/2)); int x=(int)(frameSize.width/2); int y=(int)(frameSize.height/2);...
41e018e9-ef63-4ca1-a231-7f47002bb81b
8
public static void main(String[] args) throws Exception { String playerPath, configPath, timingPath; String sep = File.separator; // players path if (args.length > 0) playerPath = args[0]; else playerPath = DEFAULT_PLAYER; // config if ...
7187e455-2085-4737-b07e-a4d1d4d7ca51
0
public static void setEventStreet(String eventStreet){ EventDescriptionWindow.eventStreet.setText(eventStreet); }
3d1cd82a-a10e-4801-89bb-542aa5236c37
4
public static int getBookID(String isbn){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } int bookID = 0; try { PreparedStatement stmn...
6270c750-8091-4ea5-aacd-2206e1e6f3ac
7
public void setObject(Object obj) { if(obj instanceof Collection){ System.out.println("HistoricoAlunoViewer.setObject: "+obj.toString()); for(Object o : (Collection)obj ){ System.out.println(o.toString()); } Collection<? extends Object...
f2936ba2-ee5e-410c-8bfe-8f77f789579d
4
public GraphProperties(Graph G) { bfs = new BFS[G.V()]; for (int v = 0; v < G.V(); v++) bfs[v] = new BFS(G, v); diameter = 0; radius = Integer.MAX_VALUE; for (int v = 0; v < G.V(); v++) { if (diameter < bfs[v].eccentricity()) diameter = bfs[v].eccentricity(); if (radius > bfs[v].eccentricity...
bd867ccb-5f9c-4976-9997-a390abbf4190
4
public Image getTile(int x, int y) { if (x < 0 || x >= getWidth() || y < 0 || y >= getHeight()) { return null; } else { return tiles[x][y]; } }
d0d62f9c-6b2e-4f67-a251-43ab080275d6
4
public boolean startsWithTitle() { Document document = Jsoup.parseBodyFragment(getContent()); Element firstNode = document.body().children().first(); if(firstNode == null) return false; if(firstNode.tagName().equals("div") && firstNode.attr("id") != null && firstNode.attr("id").equals("toc")) { firstNo...
8be2fa24-5a7d-4927-8694-a36c703427e7
8
public NOAAHurricaneData(String urlPrefix, String indexURL) throws MalformedURLException, IOException { if(log.isDebugEnabled()) log.debug("Fetch index from " + indexURL); this.urlPrefix = urlPrefix; indexContent = new WebPage(indexURL).getContents(); if(log.isDebugEnabled()) log.debug("Get Storms....
acc97247-bb99-4eb6-949d-5e84bbbbd08b
5
@Override public void run() { try { List<OfertaRecursos> ofertasNovas = recursosFromResultSet(conexao.getStatement().executeQuery("select * from " + NOME_TABELA_OFERTAS_RECURSOS + " where " + RECURSOS_COLUNA_ESTADO_OFERTA + " = " + "'" + Oferta.ESTADO_OFERTA.APROVADO.name() +...
e7358704-b23d-45d2-9057-5f66e7af14de
6
public void collision() { Rectangle parre = PeopleParents.getBounds(); Rectangle sadRec = Sad.getBounds(); Rectangle wfRec = PeopleWife.getBounds(); for (int i = 0; i < Game.flyers.size(); i++) { Flying plt = (Flying)Game.flyers.get(i); if(getBounds().intersects(plt.getBo...
a5817308-77f5-457d-b53f-8e81c297b443
1
public void save(Problem transientInstance) { log.debug("saving Problem instance"); try { Session session = getSession(); Transaction tr = session.beginTransaction(); session.save(transientInstance); tr.commit(); session.flush(); session.close(); log.debug("save successful"); } catch (Runtime...
5bb95f36-c521-4f58-a283-99c149f3b032
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...
b1d771fc-2b8f-49a6-bd56-20c129655e5f
3
static private int jjMoveStringLiteralDfa11_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(9, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(10, active0); return 11; } switch(curChar) { ...
49cd1901-801b-40a5-8fd4-8787451b437b
9
public static int getResourceBrickColor(int res) { switch (res) { case 1: return 106; case 2: return 1; case 10: return 23; case 11: return 1011; case 20: return 1014; case 21: return 194; case 22: return 26; case 30: return 21; case 40: return 45; default: System.err.println("Invalid ...
b59e93b5-45a1-46c9-a098-735067e581cc
9
public void update(float dt){ lifeTime+=dt; animation.update(dt); if((ID.equals("boulderFist") && lifeTime>=1.5f*ANIM_RATE && lifeTime<=3*ANIM_RATE) || !ID.equals("boulderFist")) for(Entity e: victims.keySet()){ if(victims.get(e)<=0){ applyDamageEffect(e); victims.put(e, (float) (2*e.resi...
b64c3aea-417b-48f1-be71-22ae0b2c4e1c
8
public void pressedEncrypt() { String imgPath = txtImage.getText(); String filePath = txtFile.getText(); if (imgPath.isEmpty() || filePath.isEmpty()) { displayError("Error", "Choose image and file!"); return; } String imageSuffix = imgPath.substring(imgPath.lastIndexOf('.'), imgPath.length()); if (!...
41fd687c-eae5-417c-9200-ac3079672c7d
4
private void SaveJButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_SaveJButtonMouseClicked //Check if the user exisit already if(Customer.userExist(newCustomerJPanel.getEmail())){ JOptionPane.showMessageDialog(mainJFrame, "A user already exist with this em...
3874f101-aca4-4a7e-98ed-ebafa9e7fdc1
1
@Test public void testTimeStep_ANNUAL_MEAN_YAMPA_Feb() throws Exception { printDebug("----------------------------"); printDebug("Annual Mean with Period Yampa startig in Feb: " + this.toString()); printDebug("----------------------------"); CSTable t = DataIO.table(r2, "obs"); ...
1daef952-7436-44bb-9587-8f9c8f39f67a
9
public void forwardToRoom(String msg) { if (myRoom == null) return; //Ungag person if they are past their gag time if (System.currentTimeMillis() >= gagTime) isGagged = false; if (isGagged) { sendChat("You are gagged, your message was not heard."); return; } //If this chat is above t...
4d44fb68-4979-41b1-b0fd-64fd55012761
4
@Override public Sub addHandler(final Object handler) { Method[] methods = handler.getClass().getMethods(); for (final Method method : methods) { Subscribe subscriber = method.getAnnotation(Subscribe.class); if (subscriber != null) { for (final String event : events(subscriber)) { ...
78806bd1-a1f1-4183-a0a7-5760794d562b
9
public static ItemType promote(ItemType v1, ItemType v2, TypeHierarchy typeHierarchy) { ItemType t1 = (typeHierarchy.isSubType(v1, BuiltInAtomicType.NUMERIC) ? v1 : BuiltInAtomicType.DOUBLE); ItemType t2 = (typeHierarchy.isSubType(v2, BuiltInAtomicType.NUMERIC) ? v2 : BuiltInAtomicType.DOUBLE); ...
92e52da2-2303-4d70-8f0b-e5945cc74b19
8
public static ArrayList<Player> getEnemies(Player player) { ArrayList<Player> emenies = new ArrayList<Player>(); if (!getTeamFriends(Teams.getTeamOfPlayer(player)).contains( Teams.getPlayersOfTeam(BLUE)) && Teams.getPlayersOfTeam(BLUE) != null) { // not friends with blue emenies.add(Teams.getPlayersO...
a6a3d82b-484b-4b58-84d7-cad9c7c44e3f
8
public boolean isUserInRole(Principal p, String role) { if (p instanceof CommunityAccount) { logger.finer("isUserInRole " + p + " / " + role); CommunityAccount cast = (CommunityAccount)p; if( cast.isAdmin() && role.equals("bozo") == false ) { logger.finest("Admin " + p + " is also " + role...
bf16c7e4-d8d0-4f13-8056-d31118192869
2
public static ArrayList<Blob> getMstxImage(int[] mid) {// ArrayList<Blob> result = new ArrayList<Blob>(); for (int i = 0; i < mid.length; i++) { ArrayList<MstxImage> temp = getMstxImageList(mid[i]); if (temp.size() > 0) { MstxImage mi = temp.get(0);// 用于手机端显示,只取第一张图片即可 Blob b = mi.getB(); result.a...
00e47414-6611-405c-a769-22eca14f9b16
3
@Override protected void onAction(Player player, Location from, Location to) { if(task == null) { if (active) { if (!getCuboid().intersects(to)) { update(false); } } else { update(true); } } ...
95058f38-2382-41e7-b721-41897f882148
6
@Override public boolean execute(AdrundaalGods plugin, CommandSender sender, String... args) { //Shrine creation for players only! if(!(sender instanceof Player)) return false; if(args.length < 2) return false; /* * adding a shrine to cache */ Player player = (Player) sender; Se...
e02fc3de-2fa5-4b57-8ded-bc2a607da378
6
final private boolean jj_3R_96() { if (jj_3R_42()) return true; if (jj_3R_32()) return true; Token xsp; xsp = jj_scanpos; if (jj_3R_182()) jj_scanpos = xsp; if (jj_3R_183()) return true; while (true) { xsp = jj_scanpos; if (jj_3R_184()) { jj_scanpos = xsp; break; } } retu...
7401e850-7d43-4d59-ba03-87779fab89fe
7
public int showConfirmDialog(final Component parent, final String filename) { if (!changed || !enabled) return JOptionPane.NO_OPTION; String s2 = Modeler.getInternationalText("SaveConfirmation"); if (changeCausedByRun) { String s = Modeler.getInternationalText("DoYouWantToSaveModelState"); return JOption...
14f44f8b-1c79-4832-9c46-bc88e9788581
0
public void setIgnoreCase(boolean ignoreCase) { this.ignoreCase = ignoreCase; }
537ce4d2-4b13-4c8e-94ac-0930fa1ab3a5
2
public static final boolean isCSS(String fileName) { for (String file : CSS) { if (file.equals(fileName)) { return true; } } return false; }
349c0fa5-c3e2-42ad-94ce-5973b027fb30
4
@Override protected int calculateQualityDifference() { int d = super.calculateQualityDifference(); if (sellIn <= 10) d++; if (sellIn <= 5) d++; if (sellIn <= 0) d = -quality; if (quality >= 50) d = 0; return d; }
64dc664f-bdc8-4a9c-90c3-7ff9a9be130c
6
@EventHandler(priority = EventPriority.HIGHEST) public void onBlockBreak(BlockBreakEvent event){ Block block = event.getBlock(); boolean isSign = false; Sign sign = null; if(block.getState() instanceof Sign){ BlockState blocker = block.getState(); sign...
afa28f40-0640-4a6d-8083-04b394cc9f4b
4
private void resaveParamsShowDirection(SessionRequestContent request) { String validTourStatus = request.getParameter(JSP_TOUR_VALID_STATUS); if(validTourStatus != null) { request.setAttribute(JSP_TOUR_VALID_STATUS, validTourStatus); } String invalidTourStatus = request.getP...
ec114d26-d33e-432c-ae52-ffac39c0136d
0
@Test public void testTruncate_dash() { String s = "If we encounter dashes—like this—don't include them."; Assert.assertEquals( "If we encounter dashes—like this…", _helper.truncate(s, 35) ); }
5395d6c9-4ef1-40bf-aa0a-cfb941507c50
2
void resetRound(int rnd) { round = rnd; bowlId = 0; // reset choices choices = new int[players.length]; hasBowl = new boolean[players.length]; for (int i = 0; i < players.length; i++) { hasBowl[i] = false; choices[i] = rnd == 0 ? players.length - ...
a5a87b42-8ff0-4da8-b338-5fbba522252b
2
public boolean pass(int[] bowl, int bowlId, int round, boolean canPick, boolean musTake) { counter++; System.out.printf("\n counter is %d\n", counter); record[counter-1]=score(bowl); if (musTake){ return true; } if (round==0) { ...
7589cb2e-500d-4a58-af34-cca325118456
2
@Override public void run() { //Thread.currentThread().setPriority(Thread.MAX_PRIORITY); while(true) { // Map Map.view.setBounds(MainFrame.view.getInsets().left + 10, MainFrame.view.getInsets().top + 42, MainFrame.view.getWidth() - 10, MainFrame.view.getHeight() - 42 - OutTex...
18e89762-1322-4a5f-bd57-858a5e103721
9
public LinkedList<int[]> emptyBoardMoves() { LinkedList<int[]> positions = new LinkedList<int[]>(); // All positions in the current file and rank for (int i = 0; i < 8; i++) { int[] positionOne = {row, i}; int[] positionTwo = {i, col}; positions.add(positionOne); positions.add(positionTwo); } /...
df9d7d30-01b1-481f-b078-58e4268b9090
1
private void renderItemChose() { if (validChosenItemIndex()) { label.setText("Choosen index is: " + getChosenItemIndex()); } }
a67c1963-d623-4092-a667-cb4dd71c80c1
8
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {try { //GEN-FIRST:event_jButton1ActionPerformed list = new DinnerDao(); } catch (SAXException ex) { Logger.getLogger(addItemToDinnerMenu.class.getName()).log(Level.SEVERE, null, ex); } catch (ParserConfigurati...
d8ab9a5c-c0cd-4998-87f7-f8a04892618e
0
public void setExperience(int experience) { this.experience = experience; }
094d4daf-29b0-42c5-923a-c7e4319f0898
2
private void fixArray() { if (streamAlive.size() < streamName.size()) { streamAlive.add(false); fixArray(); } if (streamAlive.size() > streamName.size()) { streamAlive.clear(); fixArray(); } }
38915722-984d-4855-b928-7256fc3e0d07
7
public void loadLevel() { SpriteSheet sprites = new SpriteSheet("/res/images/floorTile.png", 1, 1); Image floor = sprites.getSprite(0); for (int x = 0; x < WIDTH; x += 2) for (int y = 0; y < HEIGHT; y += 2) addObject((BufferedImage)floor, x, y, true); sprites...
2074b492-b478-451c-9b79-3b4146d08c8c
4
private void workerAddFileDetails(final File file) { final String nameString = file.getName(); final String dateString = dateFormat.format(new Date(file.lastModified())); final String sizeString; final String typeString; final Image iconImage; if (file.isDirectory()) { typeString = getResourceString("...
c46cf1a1-f95b-4837-a376-aaf6ddd35f01
8
public ParseException generateParseException() { jj_expentries.clear(); boolean[] la1tokens = new boolean[13]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 1; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if...
73e70e6f-702c-4ed0-b04c-4086ba2888f1
4
@Override public void run() { try { //While client is sending while(this.accepting) { //Read input stream byte[] bytes = readInputStream(); if (bytes == null) break; //Create command string String json = new String(bytes, "UTF8"); Command command = new Command(json...
79668f39-5ead-4b94-a324-53e762ba3a06
7
public Corpus concatCorpus(Corpus other) { // Double-check vocab match assert(this.vocab.size() == other.vocab.size() && this.vocab.get(0).equals(other.vocab.get(0))); // Concatenate corpus (need to adjust document indices) this.w = MiscUtil.intArrayConcat(this.w, other.w); this.d = MiscUtil....
5b3cba96-916a-41d7-8f7c-b87f22408c17
7
public void addBlockHitEffects(int par1, int par2, int par3, int par4) { int var5 = this.worldObj.getBlockId(par1, par2, par3); if (var5 != 0) { Block var6 = Block.blocksList[var5]; float var7 = 0.1F; double var8 = (double)par1 + this.rand.nextDouble() * ...
e5760545-c687-480a-8b00-3f50bb299da0
8
@Override public void run() { try { try (WatchService watchService = FileSystems.getDefault().newWatchService()) { path.register(watchService, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_DELETE); //sta...
8061ba09-94c1-414a-9196-5f6b5977ca60
7
@Override public void endElement(String namespaceURI, String localName, String qName) { String elementName = (String) elements_stack.peek(); Attributes atts = (Attributes) attributes_stack.peek(); String text = ((StringBuffer) characters_stack.peek()).toString(); if (qName.equals(ELEMENT_OUTLINE)) { Node...
a6af29f9-131b-40e7-b77f-91dd8d7ded12
9
public void mousePressed(MouseEvent event) { if (getDrawer().getAutomaton().getEnvironmentFrame() !=null) ((AutomatonEnvironment)getDrawer().getAutomaton().getEnvironmentFrame().getEnvironment()).saveStatus(); initialPointClick.setLocation(event.getPoint()); lastClickedState = getDrawer().stateAtPoint...
b292ca86-9cdf-49d3-9ed7-a4679bdcbfbe
7
@Override public SinglyLinkedList<T> subList(int arg0, int arg1) { if (arg0 < 0 || arg1 >= size || arg0>arg1) throw new IndexOutOfBoundsException("Out of range "+", Size: "+size); SinglyLinkedList<T> OutList= new SinglyLinkedList<T>(); Node<T> current = head; for(int i=0;i<this.size;i++){ if(i>...
61ff7afa-61a0-42d6-be63-2ae05233316a
5
private int blackPosition(int i) { int blackPos; switch (i) { case 2: blackPos = 1; break; case 4: blackPos = 2; break; case 6: blackPos = 3; break; case 9: blackPos = 5; break; case 11: blackPos = 6; break; default: blackPos = 1; } return blackPos; }
d16e2ced-cea1-495c-b998-93baacfda8d4
4
public void exitQueuedState(int exitTime) throws VehicleException { this.exitTime = exitTime; if (isParked() == true) { throw new VehicleException("Vehicle is parked."); } else if (isQueued() != true) { throw new VehicleException("Vehicle is not in queue."); } else if (exitTime < getArrivalTime()) { th...
888444c5-d92a-4266-9496-a7461b2d9a68
8
public byte[] getEContent() { SignerInfo signerInfo = getSignerInfo(signedData); ASN1Set signedAttributesSet = signerInfo.getAuthenticatedAttributes(); ContentInfo contentInfo = signedData.getEncapContentInfo(); byte[] contentBytes = ((DEROctetString) contentInfo.getContent()) .getOctets(); if (signedAt...
cab75a82-3f45-4a4a-a3fe-6c46d7d94071
5
public void actionPerformed(java.awt.event.ActionEvent evt) { if (evt.getSource() == saveButton) { RegistroMedicamentos.this.saveButtonActionPerformed(evt); } else if (evt.getSource() == proveedoresButton) { RegistroMedicamentos.this.proveedoresButtonA...
f44cc5e1-6c44-4553-bd8a-ce4f0eb2288f
7
private String aboutSoft() { loggerAboutDialog.entry(); StringBuffer license = new StringBuffer(100); try { InputStream inputStream = AboutProject.class.getResourceAsStream("/license_template.lic"); BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); String line; while ((li...
868b0c7d-2ce8-4fa7-b791-a8131df5a704
4
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (HAS_PORTAL ? 1231 : 1237); result = prime * result + ((bank == null) ? 0 : bank.hashCode()); result = prime * result + ((currentPlanet == null) ? 0 : currentPlanet.hashCode()); result = prime * result + (...
99f01a93-f0c0-47df-a1e9-14ddd7013644
2
private final boolean removeB(final K key) { final HashCounter hc = new HashCounter(key); for (Integer i : hc.hashs) { if (!off[i].remove(new Entry<K,V>(key))) { return false; } offsize--; cbf.dec(i); } return true; }
ef1f61e9-6ea5-4056-931c-5c9295b871b8
4
@Override public void draw(Graphics2D g) { for (int i = 0; i < array.length; i++) { int latest = getContext().settings.get(i); if (array[i] != latest) { if (latest != -1) { getContext().getBot().getLogger().log(new LogRecord(Level.INFO, "index " + i + " changed from value " + array[i] + " to " + lates...
2bb031e2-b8ba-4442-8d0a-384a32e8c608
5
public static void balanced_brackets2(String s) { int c = 0, o = 0; for(int i = 0; i<s.length(); i++){ if(s.charAt(i) == ')' ){ c++; } if(s.charAt(i) == '('){ o++; } if(c > o){ break; ...
c7a8dfb4-d356-4e43-9105-26debfd711f4
6
public static byte[] getFileContent(String path) throws IOException { FileConnection file = null; if (path.startsWith("file://")) path = path.substring(7); else if (!path.startsWith("/")) path = "/" + path; try { file = (FileConnection) Connector.open("file://" + path, Connector.READ); int ...
63d256c1-121b-44ff-a7f7-f1d8b36e1e73
3
protected void runMainLoop() { for( int i=0; i<30; i++ ){ // here be the main client thread loop // loop is number blocks broadcasted by each client try { sleep( rand.nextInt(1000) ); // now generate a block SignedBlock newBlock = null; try { n...