method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
347fd681-039f-478a-b3a0-2c2aa95c2521
3
public int getClosestColor(int c) { if (c == 0) return 0; int bestInd = 0; float bestDif = Util.colorDiff(pal[0], c); for (int i = 0; i < pal.length; i++) { float d = Util.colorDiff(pal[i], c); if (d < bestDif) { ...
6d46a97f-fc13-4d83-aecd-a503c5656ab6
8
public static void _pf_mark_area(Coord start, Coord end) { Coord s1 = start.sub(MapView.tilefy_ns(start)); Coord s2 = end.sub(MapView.tilefy_ns(end));// .add(MCache.tileSize); // Coord s1 = new Coord(start.x, start.y); // Coord s2 = new Coord(end.x, end.y); // Coord st_trans = st...
2a56710c-bb58-459a-86c3-695be13e88f5
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...
bb517e49-e67c-48da-9daf-3d663e224661
1
public UninstallApplicationMenu(Logger logger, boolean debug, ADBController adbController, SettingsManager settings, LangFileParser parser, Device device) { initComponents(); this.setLocationRelativeTo(null); this.setIconImage(new ImageIcon(this.getClass().getResource("/eu/m4gkbeatz/androidtoolk...
942c1409-b384-4fd5-9ac4-03dd6aa0d779
4
public void showColorKmean(int K, boolean useNativeColors) { try { Kmean kmean; if(useNativeColors) kmean = new Kmean(portableMap.getHeight(), portableMap.getWidth(), 3, portableMap.getColorData()); else kmean = new Kmean(portableMap.getHeight(), portableMap.getWidth(), 3, null); kmean.setK(K); ...
268aadaa-ca2a-4096-9e54-8d06aa5dcb89
5
@Override public void update(int mouseX, int mouseY, boolean pressed) { if(this.x <= mouseX && mouseX <= this.x+this.width && this.y <= mouseY && mouseY <= this.y+this.height) if(pressed) this.state = 2; else this.state = 1; else this.state = 0; super.update(mouseX, mouseY, pressed); }
8e91efdd-7e02-49c9-b92a-c072435ef36d
6
private BaseObject GetNearestObjectByMat( Enums.GMaterials material ) { if (visible_objs.size() == 0) return null; BaseObject obj = null; for (BaseObject element : visible_objs) { if (element != null && element.GetMatCountByType(material) > 0) {...
48a3e7ca-be2e-4324-b010-0dbc3c972c6b
8
public boolean doubleUp(int upcard, int total, boolean soft) { if (upcard == 1) return false; if (soft) { return upcard <= 6 && total <= 18 && total + 2*upcard >= 23; } else { return total <= 11 && total >= 9 && upcard != 10 && (total != 9 || upcard >= 7); } }
7aaa690b-9e39-4886-a8fc-1fb16d484259
1
public void addFieldFilter(String fieldName, String pattern) { if (!fieldFilters.containsKey(fieldName)) { fieldFilters.put(fieldName, new LinkedList<String>()); } fieldFilters.get(fieldName).add(pattern); }
76532eef-c2fb-412c-a4a8-2aff20c0e457
3
public JSONObject getBefehl() { JSONObject now = null; try { JSONObject file = new JSONObject(read()); if (file.getJSONArray("Befehl").length() == 0) { return null; } now = file.getJSONArray("Befehl").getJSONObject(0); file.getJSONArray("Befehl").remove(0); write(file.toString()); } catch...
08e6acff-1999-4c2d-bd10-5ede3b03a067
8
public void run(File subjectSortedInput, File indexOutput) { try { IndexWriter indexWriter = new IndexWriter(indexOutput); NQuadParser parserIn = new NQuadParser(subjectSortedInput); PrintStream out = new PrintStream(indexOutput); while (parserIn.hasNext()) { NQuad nq = parserIn.next(); if ((nq.ob...
573e8cec-c43a-4e7e-8cd5-0cbc7b15025b
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...
c351278c-8fe2-4b84-af62-0a6dbf15ca03
6
private void writeFiles(DataOutputStream dataOut, TempFileInfo[] fileToWrite, int resolution) throws IOException, FileNotFoundException { final int sizeOfBuffer = 1024; byte[] byteTempArray = new byte[sizeOfBuffer]; for (TempFileInfo info3 : fileToWrite) { ...
32f92a3d-5dfb-4074-87f3-9df6635c4c48
4
@Override protected boolean isValidUrl(String url) { if ((url.startsWith(URL_PREFIX_HTTPS) || url.startsWith(URL_PREFIX_HTTP)) && !url.endsWith("/")) { //$NON-NLS-1$ try { new URL(url); return true; } catch (MalformedURLException e) { } } return false; }
afdbb9b3-682a-4e45-8661-39ce874d8f2b
0
public String deleteblogDetails() { FacesMessage doneMessage = null; String outcome = null; blogDelegate.deleteByKey(this.blogId); doneMessage = new FacesMessage("Deleted Successfully "); outcome = "/admin/success"; FacesContext.getCurrentInstance().addMessage(null, do...
38a23c6f-37a2-450e-8ffa-c36de7b11dd1
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=proficiencyCheck(mob,0,auto); if(!success) mob.tell(L("Your plant senses fail you.")); else {...
6809df4a-48ea-4289-8be3-111f8ffdaa75
2
public static void createAppdataFolder() { File appdata = new File(System.getenv("APPDATA") + "\\CatSigner"); if (!appdata.exists() || !appdata.isDirectory()) { appdata.mkdirs(); System.out.println("AppData folder is created successfully!"); } else { System.out.println("Skipping creation of AppDat...
3aecb1a0-5ee5-48a3-89d4-da93282edfb2
9
@Override protected void setStatementParameters(PreparedStatement preparedStatement, WhereClause whereClause) throws IOException { int index = 0; for (WhereConstraint constraint : whereClause.getWhereConstraints()) { for (Object parameter : constraint.getParameters()) { if (parameter == null) { ...
f136919c-bc08-40e8-8a00-23ee0b90c7cb
2
public static void main(String args[]) { try{ Socket socket=new Socket("127.0.0.1",6888); //向本机的6888端口发出客户请求 BufferedReader sin=new BufferedReader(new InputStreamReader(System.in)); //由系统标准输入设备构造BufferedReader对象 PrintWriter os=new PrintWriter(socket.getOutput...
b0bee575-87f0-4203-9599-5b308664480c
1
public boolean push(final LocalExpr expr) { final Boolean b = (Boolean) pushes.get(expr); return (b != null) && b.booleanValue(); }
02391798-b85b-45a9-aeea-34ccae08f068
9
private String currentCategory() { if (places[currentPlayer] == 0) return "Pop"; if (places[currentPlayer] == 4) return "Pop"; if (places[currentPlayer] == 8) return "Pop"; if (places[currentPlayer] == 1) return "Science"; if (places[currentPlayer] == 5) return "Science"; ...
2ecd3c83-adbb-420d-bc21-13337291468b
6
public PackDetails(String packName, String keyboardSourceFile, String dictionarySourceFile, String themeSourceFile) { PackageName = packName; KeyboardSourceCodeFile = keyboardSourceFile != null && keyboardSourceFile.startsWith(".") ? PackageName ...
1763481d-e1ea-4074-87e5-d7a6e3e03bd2
5
@EventHandler public void onBlockBreak(BlockBreakEvent event) { BlockState block = event.getBlock().getState(); if (block instanceof Sign) { Sign sign = (Sign) block; if (!sign.getLine(0).equals("[Class]")) return; World world = event.getBlock().getWorld(); ...
edaf9cfc-94fd-4798-941c-9c41d5e79825
9
private byte[] generateCode(String encodedSource) { boolean hasScript = (scriptOrFnNodes[0].getType() == Token.SCRIPT); boolean hasFunctions = (scriptOrFnNodes.length > 1 || !hasScript); String sourceFile = null; if (compilerEnv.isGenerateDebugInfo()) { sourceFile = scri...
19b91911-3c41-4ebc-873f-70d4f0f4323e
8
@Override public void remove(int i, int j) throws BadLocationException { if(!this.autoCompletion) { super.remove(i, j); return; } int k = getSelectionStart(); if(k > 0) k--; if(getText(0, k).equals("")) { super.remove(0, getLength()); return; } String s...
8cad3f6e-f94c-4121-8996-a2f002d3a815
7
@Override public void i3channelSilence(MOB mob, String channel) { if((mob==null)||(!i3online())) return; if((channel==null) ||(channel.length()==0) ||(Intermud.getLocalChannel(channel).length()==0)) { mob.tell(L("You must specify an actual channel name.")); return; } if(Intermud.removeFak...
c16ac9a9-252d-4c85-a939-8aef2edbdb10
3
private Set<Point> generateDoors(Room room, Direction existingDirection) { Set<Point> doors = new LinkedHashSet<Point>(); for (Direction direction : Direction.values()) { if (direction == existingDirection) continue; if (generator.nextDouble() <= generationProbability) {...
678dfeb2-4a45-45fc-9239-b20de401f41a
1
public void testThatDequeueOnEmptyThrowsIndexOutOfBoundsException() { boolean exceptionOccurred = false; try { Agent o = q.dequeue(); } catch (java.util.NoSuchElementException e) { exceptionOccurred = true; } Assert.assertTrue(exceptionOccurred); }
83826ec6-d962-4c8e-8f43-4b622917f90e
0
public void drawState(Graphics g, Automaton automaton, State state, Point point, Color color) { super.drawState(g, automaton, state, point, color); drawStateOutput(g, state, point, color); }
e2dd1f23-9e0a-4760-8a91-b27eda5328da
5
final int method2679(int i, int i_7_, int i_8_) { anInt4232++; if (i_8_ != 1595) return 38; int i_9_ = (Class348_Sub42_Sub8_Sub2.windowHeight <= i ? i : Class348_Sub42_Sub8_Sub2.windowHeight); if (Class186_Sub1.aClass341_5808 == this) return 0; if (this == Class237_Sub1.aClass341_5821) return ...
263b8bd0-57bc-4247-9326-25e6b06e702c
6
public void init() { boolean debug = CommandLine.booleanVariable("debug"); if (debug) { // Enable debug logging Logger logger = Logger.getLogger("com.reuters.rfa"); logger.setLevel(Level.FINE); Handler[] handlers = logger.getHandlers(); ...
7a150bca-975b-4618-8281-1e30db8c7a14
6
@Test public void fillMap () { String map = "ghi\n"; map += "def\n"; map += "abc\n"; System.out.println (map); char[][] myMap = new char[3][3]; int row = 2, col = 0; for (int i = 0; i < map.length (); i++) { char c = map.charAt (i); if (c == '\n') { ...
99fe1afa-b1f7-4fb1-b115-a9858ee53a7d
5
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException { player = new Player(320 / 2, 240 / 2, this); player.init(gc, sbg); worldEntities.add(player); for(int x = 0; x < sizeX; x++) { for(int y = 0; y < sizeY; y++) { if(data[x][y] == wall) { worldTiles.add(new WallTile(x*til...
c198612c-68ff-445b-925d-65121f705676
0
public int getSecondID(){ return second_city.getID(); }
eb531643-6bde-48db-a8c7-e99aca29ca9b
4
@SuppressWarnings("unchecked") @Override public T deleteAt(int index) throws DAIndexOutOfBoundsException { T returner = null; if((index >= 0) && (index <= size - 1)) { returner = (T)array[index]; // starts at index and shifts every object down by 1 System.arraycopy(array, index + 1, array, in...
6d9d5b59-cc43-432f-9ec6-73d3af05f504
7
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 ht...
04c614cf-20f0-4e2c-8891-5f314998dd17
0
@Override public void startSetup(Attributes atts) { super.startSetup(atts); addActionListener(this); }
98f643a8-f7b3-4e73-840d-370ed3e31ee1
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (!(obj instanceof AbstractFreightCarriage)) return false; AbstractFreightCarriage other = (AbstractFreightCarriage) obj; if (curCapacity != other.curCapacity) return false; if (m...
7373abd6-43df-4172-951c-e6cec1555171
7
public void tick(){ if (x + xa>0 && x + xa <GamePanel.WIDTH - width) { x = x + xa; } if (collision2()) { BlockModeState.block = new FallingBlocks(Random(15, 120),Random(15, 120)); FallingBlocks.lives--; Sound.playBlockHit(); } if (collision3()) { BlockModeState.block2 = new FallingBlocks(Rand...
4a34c141-03b8-4048-a972-4f1308548855
8
public boolean baca(String no_beli){ boolean adaKesalahan = false; Connection cn = null; this.no_beli = no_beli; listKwitansi = null; try{ Class.forName(Koneksi.driver); } catch (Exception ex){ adaKesalahan = true; JOptionPane.showMessageDialog(null,"JDBC Drive...
8dfab0a6-0f94-4c48-95ad-aaaa753ffa35
8
public int compare(String o1, String o2) { String s1 = (String)o1; String s2 = (String)o2; int thisMarker = 0; int thatMarker = 0; int s1Length = s1.length(); int s2Length = s2.length(); while (thisMarker < s1Length && thatMarker < s2Length) { ...
caf3d268-e726-4749-9feb-9f4a9a8afb6a
1
private boolean jj_3_7() { if (jj_3R_25()) return true; return false; }
b4be51bc-cb00-4614-8928-1084c3ed79c2
9
@Override protected ElementHandler createHandler(String name) { if ("name".equals(name)) { return new StringValueBuilder(parentContext, new FinishCallback<String>() { @Override public void handle(String value) { CSGOperationNodeBuilder.this.op...
c29b0aba-8ff2-4999-9cc0-9f61b8959831
0
public void setCanonicalizationMethod(CanonicalizationMethodType value) { this.canonicalizationMethod = value; }
c5167939-2b5d-43a5-9763-6ea5f930496d
7
public void drawCW(Bitmap bitmap, int xo, int yo) { for (int y = 0; y < bitmap.width; y++) { int yy = y + yo; if (yy < 0 || yy >= this.height) continue; for (int x = 0; x < bitmap.height; x++) { int xx = bitmap.height - x + xo; if (xx < 0 || xx >= this.width) continue; int color = bitmap...
936d1023-4f9f-4ad1-8b73-9c0d553ee6d7
1
public static void DBClose() { try { con.close(); } catch (SQLException e) { e.printStackTrace(); } }
65245d1b-ea6e-4b10-be8c-dbd706b9d34d
5
public ExtDecimal negate() { if (type == Type.NUMBER) { return new ExtDecimal(content.negate()); } else if (type == Type.POSITIVEZERO) { return new ExtDecimal(Type.NEGATIVEZERO); } else if (type == Type.NEGATIVEZERO) { return new ExtDecimal(Type.POSITIVEZERO);...
0df0cf80-c08a-4359-928c-1e25c4685cc5
2
public Address getAddress(Class<?> clazz) { ArrayList<Address> adrList = addresses.get(clazz); if (adrList != null) { return adrList.get(random.nextInt(adrList.size())); /* TODO smart balancing */ } else { return null; } }
b24f266c-4472-4299-85b0-7226ff6e971f
4
public static void main(String[] args) throws IOException { theme = new Theme(); MetalLookAndFeel.setCurrentTheme(theme); try { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); } catch (ClassNotFoundException ex) { Logger.getLogger(TODOManager....
b18e4fa4-3eaf-403a-8b54-29d7d4233deb
7
public static void insertActionLog( int uid, int bid, int auctionID, int actionType, String summary, String description ) throws DatabaseException { Connection conn = null; ResultSet rs = null; PreparedStatement ps = null; long nowTimeMillis = (new Date()).getTime(); String q = "INSERT INTO action...
3dcf087b-e485-4a78-97eb-83895bebf87f
9
private HashSet<Integer> selectSample(Hashtable<Integer,List<Integer>> coi, int sampleRate){ HashSet<Integer> res = new HashSet<Integer>(); List<Integer> lst_aux = new ArrayList<Integer>(); Enumeration<Integer> e = coi.keys(); while(e.hasMoreElements()){ lst_aux.add(e.next...
bc28f223-feb8-4776-833d-ac1876584edd
3
@EventHandler public void onDropItem(PlayerDropItemEvent e) { if (e.getPlayer().getGameMode() != GameMode.CREATIVE) { if (!plugin.getConfig().getBoolean("can-drop-hat-item")) { if (e.getItemDrop().getItemStack().equals(ItemStackUtil.getHatItem())) { e.getItemDrop().remove(); e.getPlayer().getInvento...
d37d1bb9-6c0a-4a7d-b7f3-203b0d1894e0
3
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { loggedInUser = (User) request.getSession().getAttribute("user"); //Check is user is logged in for session if (loggedInUser == null) { response.sendRedirect(request.getContextPath() + "/l...
af984519-04eb-4dc4-9cda-2732743c989d
5
public static boolean startsWithIgnoreCase(String str, String prefix) { if (str == null || prefix == null || prefix.length() > str.length()) { return false; } final char[] inputCharArray = str.toCharArray(); final char[] prefixCharArray = prefix.toCharArray(); for (i...
6a02de4c-bc2d-4546-8985-9939b47771e8
8
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<html><body>"); // Retrieving the username and password ...
833b706f-fc24-4105-84c9-1039c0791956
5
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == nextPlayer) { // check if human is done if (( (HumanPlayer) game.getPlayers().get(0)) .getHumanMustFinish()) { JOptionPane.showMessageDialog(game, "You need to finish your turn!", "Next Player", JOptionPane.INFORMATION_MESSA...
33ae8396-240f-4062-8244-a16f3f391724
3
private static String pluralityValue( ArrayList<HashMap<String, String>> examples, String goalAttribute) { Set<String> set = new HashSet<String>(); for (HashMap<String, String> example : examples) { set.add(example.get(goalAttribute)); } int largestFreq = 0; String value = ""; for (String s : set) { ...
9d60a3ee-ede6-43d2-a45a-6b46e8e324ec
3
private int getNextNode() { int id = -1; int value = Integer.MAX_VALUE; for(int i = 0; i < nodes.size(); i++) { if(!nodes.get(i).isVisited() && nodes.get(i).getValue() < value) { id = i; value = nodes.get(i).getValue(); } } return id; }
85a53964-0bb2-4ea0-952f-17d992f5a9d7
0
public AbstractAttributesPanel() { model = new AttributeTableModel(this); setModel(model); setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // Setup Remove Column TableColumn removeColumn = getColumnModel().getColumn(0); removeColumn.setMinWidth(80); removeColumn.setMaxWidth(80); removeCo...
8ec9ace5-2395-4c9b-a93f-3e83159e59c4
8
public static int[] getNeighboorsSlow(final int nb) { final int result[] = new int[36]; final int v1 = nb % 10; int root = nb - v1; int cpt = 0; for (int i = 0; i < 10; i++) { final int candidat = root + i; if (candidat == nb) { continue; } result[cpt++] = candidat; } final int v2 = (nb /...
a661eb26-e4c9-4599-8695-808d8ffd739e
5
public int GetCLCooking(int ItemID) { if (ItemID == 10758) { return 100; } if (ItemID == 10760) { return 100; } if (ItemID == -1) { return 1; } String ItemName = GetItemName(ItemID); if (ItemName.startsWith("Cooking cape")) { return 100; } if (ItemName.startsWith("Cooking hood")) { return 1...
b4edc789-2cb4-4204-955d-ea7a83ac973e
0
@Override public String getDesc() { return "Default"; }
f944d3c9-d3af-4fb9-ae78-eea815885596
1
public Preferences() throws FileNotFoundException, IOException { initComponents(); /* Load saved preferences if there are any */ File prefFile = new File(System.getProperty("user.home") + "/Documents/AcerX/settingsYM.txt"); if (prefFile.exists()) { BufferedReader pre...
616b6b79-76da-47e4-aada-90c9f591332d
4
public String displayToilets( char charForFreeToilet, char charForTrappedToilet, char charForOccupiedToilet, int widthBetween ) { String status = ""; for( int i = 0; i<urinalCount(); i++ ) { switch( urinalVOs.get( i ).getStatus() ) { case FREE_SAVE: status += generateSpaces( widthBetween ) + ...
90896d1c-eec1-4c7d-9a41-f0f2433a9399
6
private void dropTable(String sql, StringTokenizer tokenizer) throws Exception { try { // Get table name String tableName = tokenizer.nextToken(); // Check for the semicolon String tok = tokenizer.nextToken(); if (!tok.equals(";")) { throw new NoSuchElementException(); } // Check if ther...
66920a22-9ba7-473e-b4ab-eef180e7254f
4
@Override public void run() { String insert="insert into TermIDList (term,IDList) values(?,?)"; String IDList=""; int count=0; try { PreparedStatement statement = sqLconnection.conn .prepareStatement(insert); while(rsSet.next()) { String term=rsSet.getString("term"); ResultSet rs=null; ...
f5398618-2a8e-496d-b4b8-307ffc69a769
2
protected static void modificar(){ //leer hasta encontrar que fila quiero modificar try{ BufferedReader stdin=Files.newBufferedReader(path, java.nio.charset.StandardCharsets.UTF_8); String linea=""; while((linea=stdin.readLine())!=null){ String [] part=linea.split(";"); } ...
872d4bad-9e7e-4909-95ca-10c47cbe386e
8
private static int getTableIndex(float[] elem, float threshold) { int tableIndex = 0; if(elem[0] < threshold) { tableIndex |= 1; } if(elem[1] < threshold) { tableIndex |= 2; } if(elem[2] < threshold) { tableI...
50d464da-bcbf-4452-bddb-2dfe4ec185bd
2
public double getMaxMemory (){ double maxMemory = 0; for(int i = 0; i<memory.length; i++){ if(memory[i]>maxMemory) maxMemory = memory[i]; } return maxMemory; }
e88d3cdd-3bf6-416c-b3dc-079030a27496
0
public String toString() { return super.toString() + ": \"" + getLabel() + "\""; }
a28a415f-ea4c-4137-8d7c-d8a7dd4dc167
5
public boolean isBlockIndirectlyGettingPowered(int var1, int var2, int var3) { return this.isBlockIndirectlyProvidingPowerTo(var1, var2 - 1, var3, 0) ? true : (this.isBlockIndirectlyProvidingPowerTo(var1, var2 + 1, var3, 1) ? true : (this.isBlockIndirectlyProvidingPowerTo(var1, var2, var3 - 1, 2) ? true : (this...
b96e9d87-5ad7-4548-ba79-94722c4be63f
1
public boolean insertTicket(Ticket tic) throws SQLException{ Connection con = getConnection(); ArrayList<Ticket> ticket = getTicket(tic); if (ticket.size()!=0) { return false; } con.createStatement().executeUpdate("INSERT INTO ticket("+campos_ticket+") VALUES('" ...
23e9d86b-730c-4d79-afc9-c7ab68ba20bd
7
String ChangeEmissionFilter(int Current_Item){ int Move_Item=Current_Item;//-Global.Emi_Previous_Item; //if (Move_Item<0) {Move_Item=Move_Item+6;} String CI=Integer.toString(Current_Item); //Global.Emi_Previous_Item=Current_Item; try{ if (Move_Item...
c6e8fe6f-ed8f-4ab0-bb9e-072fe81654b0
9
void run(){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(), W = sc.nextInt(), K = 0; int[] w = new int[15], f = new int[15], s = new int[n+1]; for(int i=1;i<=n;i++){ int k = sc.nextInt(); while(k--!=0){ w[K] = sc.nextInt(); s[i]+=1<<K; f[K++] = i; } } int[] sum = ne...
1b886236-6a97-48b0-a9bc-9d7940fc2e59
9
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int page=1; if(request.getParameter("page")!=null){ page=Integer.parseInt(request.getParameter("page")); } request.setAttribute("page", page); String name=""; if( request.ge...
6ab922d7-986c-4f2f-acb6-48586c38c5e6
0
InternalTestLinkId(final Long id) { super(id); }
0e294ca2-a0b6-4913-aca4-fb3cb0481639
7
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 size = Integer.parseInt(line); for (int i = 0;...
3eb9cc68-87ac-44eb-aede-f35451683c8f
9
public int compareTo( Object obj ) { if( obj == null ) { return( 1 ); } else if( obj instanceof GenKbTagByNameIdxKey ) { GenKbTagByNameIdxKey rhs = (GenKbTagByNameIdxKey)obj; if( getRequiredTenantId() < rhs.getRequiredTenantId() ) { return( -1 ); } else if( getRequiredTenantId() > rhs.getRequir...
4080de33-21d7-4ad4-bcc1-6e907de3fb08
2
public static void saveAttunment(String player, String bWorld, double x, double y, double z, float yaw, float pitch) throws SQLException { String table = Config.sqlPrefix + "Attunements_v2"; Connection con = getConnection(); PreparedStatement statement = null; int success = 0; String query = "UPDATE `" + ta...
0fb9ee2d-af5b-46c1-ad3b-e326937b3ed8
9
protected void computeRect(Raster[] sources, WritableRaster dest, Rectangle destRect) { int formatTag = MediaLibAccessor.findCompatibleTag(sources,dest); MediaLibAccessor srcAccessor1 = new MediaLibAccessor(sources[0], destRect...
64f9ab9c-3a9a-4917-9dac-dd212ce5ec0c
7
public void renderPlayer(EntityPlayer par1EntityPlayer, double par2, double par4, double par6, float par8, float par9) { ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem(); modelArmorChestplate.heldItemRight = modelArmor.heldItemRight = modelBipedMain.heldItemRight = itemstack == null...
b6c6e0b5-b807-4dfa-a85b-5cc6935f10b7
7
private void handleEnterEvent(MouseEvent event) { gotEnterAfterExit = true; ArrayList exitables = new ArrayList(enteredComponents); ArrayList enterables = new ArrayList(); Component c = (Component) event.getSource(); while (c != null) { if (hoverableComponents.contains(c)) { exitable...
a7fb783e-0b20-42d6-82e1-2d33e973641f
4
public boolean equals(User user){ return name.equals(user.getName()) && password.equals(user.getPassword()) && interest.equals(user.getInterest()) && followed.equals(user.getFollowed()) && followers.equals(user.getFollowers()); }
0f80c3ef-eb59-4871-88fe-6e94274fca25
6
@Override public void remoteSignal(String from, String method, String url) { // TODO Auto-generated method stub String[] urlSplits = url.split(","); String sourceUrl = urlSplits[0]; String[] sourceUrlSplits = sourceUrl.split("/"); String type = sourceUrlSplits[sourceUrlSplits.length - 2]; String id = sourc...
dbf53225-cb06-4f0a-8d2c-970039fcf355
8
public void loadChannelHooks() { for(Map.Entry<String, Channel> entry : channels.entrySet()) { if(!(config.contains("channels." + entry.getKey() + ".linkedChannels"))) { continue; } List<String> links = config.getStringList("channels." ...
74006c48-b908-4204-aed3-2dbf093b3b6d
5
public void traverse(Node child,DefaultMutableTreeNode parent){ int type = child.getNodeType(); if(type == Node.ELEMENT_NODE){ Element elm = (Element)child; DefaultMutableTreeNode node = new DefaultMutableTreeNode("<" + elm.getTagName() + ">"); parent.add(node); ...
53b85478-2371-4d2d-a19f-e62cc1e72cb0
2
public static <T extends DC> Set<DC> dMax(Set<Pair<T,T>> phiMax) { if(phiMax!=null) { if(phiMax.getNext()!=null) { return new Set(phiMax.getFst().fst().delta(phiMax.getFst().snd()).diff(),dMax(phiMax.getNext())); } else { return new Set(phiMax.getFst().fst().delta(phiMax.getFst().snd()).di...
adf7899d-01e7-421f-897f-2365c24881bc
1
private void copyAndClose(InputStream inputStream, FileOutputStream outputStream) throws IOException { byte[] buffer = new byte[2048]; int read; try { while((read=inputStream.read(buffer))>0) { outputStream.write(buffer, 0, read); } } final...
47fefd37-b9aa-4254-b96b-77ccc4a302b6
6
public cellPicker(){ cellpick = new JComboBox(Cells); MBOTPick = new JComboBox(MBOTCells); jack = new JLabel("Born"); jill = new JLabel("Survives"); rulab = new JLabel(); //labels for wolfram rules wlab[0] = new JLabel("111"); wlab[1] = new JLabel("110"); wlab[2] = new JLabel("101"); wlab[3] = new JLabel("100...
1bbb0d35-5c60-41c9-ba1b-362e66e70c18
5
public static OSType getOperatingSystemType() { if (detectedOS == null) { String OS = System.getProperty("os.name", "generic").toLowerCase(); if ((OS.indexOf("mac") >= 0) || (OS.indexOf("darwin") >= 0)) { detectedOS = OSType.MacOS; } else if (OS.indexOf("win") >= 0) { detectedOS = ...
3afd7362-7dc5-4b88-acd0-205ff30b4a1a
0
public void addAll(IntArrayBag addend) { ensureCapacity(manyItems + addend.manyItems); System.arraycopy(addend.data, 0, data, manyItems, addend.manyItems); manyItems += addend.manyItems; }
eb90ad94-ba9c-4295-a35e-92c75348faf2
4
public DataBase getGameData(TreeItem item){ if(item == null || item == rootItem){ return null; } DatabaseTreeItem dataItem = (DatabaseTreeItem) item; DataBase data = dataItem.gameData; if(data == null){ File file = new File(ProjectMgr.get...
d7ee23f7-9bb5-426f-8ca6-68be394b9252
1
static boolean isPiece(int i, int j) { return isWhitePiece(i, j) || isBlackPiece(i, j); }
b49c95de-f538-429a-b326-a40ca0a8073b
7
public final CompilationUnitContext compilationUnit() throws RecognitionException { CompilationUnitContext _localctx = new CompilationUnitContext(_ctx, getState()); enterRule(_localctx, 0, RULE_compilationUnit); int _la; try { enterOuterAlt(_localctx, 1); { setState(195); switch ( getInterpreter().a...
f752f1a9-7d86-4fb5-8605-05ae2139fb5f
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...
e661c5b9-b4a6-4683-9fbf-b2506b131dd5
2
static void input(double[][] matrix){ for(int i = 0; i < matrix.length; i++){ for(int j = 0; j < matrix[i].length; j++){ matrix[i][j] = scan.nextDouble(); } } }
a9df59bb-3936-4138-8ce2-fa998f7ad0c5
4
private void printAll(TreeNode root, TreeNode parent, Node parentNode, int i) { Node p; int parentPosition = getRectNextLeft(i); if (root != null && parent == null) { p = makeNode(String.valueOf(root.key), new Point(parentPosition, getRectNextTop(0)), Node.COLOR_PARENT, i); ...
044577e4-a99d-4d9d-9c9b-88c5d970a48b
3
public static AttackType getAttackType(WeaponType type) { switch (type) { case mel_sword: return AttackType.SLASH; case mel_hammer: return AttackType.BASH; case rng_bow: return AttackType.PIERCE; } return Attack...
deaedef6-91b4-4e10-bf71-78d57c240cf0
5
public void action() { BoundBox r; r = new BoundBox( entity.boundingBox.x, entity.boundingBox.y, entity.sprite.getWidth(), entity.sprite.getHeight()); entity.setBounds(r); entity.location = new Point2D.Double(r.getCenterX(),...
fddb07c0-677b-40d6-8a36-3b4aaa101206
4
@Override public void keyPressed(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_UP: Game.VK_UP = true; break; case KeyEvent.VK_DOWN: Game.VK_DOWN = true; break; case KeyEvent.VK_LEFT: Game.VK_LEFT = true; break; case KeyEvent.VK_RIGHT: Game.VK_RIGHT = true; break; } }