method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
bf7335cf-903f-4c1a-ad6a-ea5497868a45
2
public boolean takeDamage(int d) { health -= d; if(health <= 0) { StatusComponent sc = (StatusComponent)owner.getComponent("StatusComponent"); if(sc.getAllegiance().equalsIgnoreCase("enemy")) { Application.get().getEventManager().queueEvent(new EnemyDestr...
d3ed33e4-e9dc-4d8b-95ad-fb009b5d3e63
9
public static String convert(String fileName) { String fileType = getFileType(fileName); String contentType = null; if (fileType.equals("html") || fileType.equals("txt")) { contentType = HttpHeaders.CONTENT_TYPE_HTML; } else if (fileType.equals("css")) { contentType = HttpHeaders.CONTENT_TYPE_C...
bd5f3203-62e5-44be-aecc-1e5536baff4a
3
private void placeZombies(int count) { Random rand = new Random(); while (count > 0) { int pos = rand.nextInt(WIDTH_FIELDS * HEIGHT_FIELDS); IField field = fieldsMatrix[pos / WIDTH_FIELDS][pos % WIDTH_FIELDS]; if (field.getType().equals("building") && field.getZombie() == null) { field.setZombie(new ...
f01befc3-9019-4919-8ccb-c6cbed286bec
4
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Year other = (Year) obj; if (year != other.year) return false; return true; }
f99cd480-8001-470e-8c8b-eff4c16b2e6f
2
public void reserveSmallConstants(GrowableConstantPool gcp) { for (int i = 0; i < fields.length; i++) fields[i].reserveSmallConstants(gcp); for (int i = 0; i < methods.length; i++) methods[i].reserveSmallConstants(gcp); }
226a2ec3-8536-4f31-9592-60b36920e68e
1
public boolean isReference() { return (desc.charAt(0) == Type.ARRAY_CHAR) || (desc.charAt(0) == Type.CLASS_CHAR); }
c0ad16a1-af5a-4d63-b039-fdd8c08e966d
0
public void setTelefono(String telefono) { this.telefono = telefono; }
fb5229bb-3421-4ccc-b00b-67bde0ab77c4
1
@Test ( timeout = 2000 ) public void clientWriteToSocketClosedByClient () throws Exception { Socket[] sockets = connectToServer(); try ( Socket serverSocket = sockets[ 0 ]; Socket clientSocket = sockets[ 1 ] ) { clientSocket.close(); // wait for close to propag...
308ab961-cc53-4732-b2b6-254acc20d148
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 http://down...
010590e0-e2f2-4739-976e-e352af808332
2
public static String strToBase16(String str) { if (StringUtil.isNullOrEmpty(str)) return ""; // 根据默认编码获取字节数组 byte[] bytes = str.getBytes(); StringBuilder sb = new StringBuilder(bytes.length * 2); // 将字节数组中每个字节拆解成2位16进制整数 for (int i = 0; i < bytes.length; i++...
dd6e19c7-48a0-45d8-9556-8cdfb5e4a807
7
@Override public void run() { String received=null;// sets up the recieved string // creates a new datagram socket to link to robbie while (constant) //for sending mesages { byte[] object = new byte[1400]; DatagramPacket packet = new DatagramPacket(object, object...
3ce7e1c2-3f1a-44fe-82ef-e04c16b045fd
1
public void setAvailDef(final Def def, final Def availDef) { if (SSAPRE.DEBUG) { System.out.println(" setting avail def for " + def + " to " + availDef); } availDefs.put(def, availDef); }
5599564c-018d-4151-8c08-aae06dcf38a7
1
public void visitForceChildren(final TreeVisitor visitor) { if (visitor.reverse()) { expr.visit(visitor); } else { expr.visit(visitor); } }
681ab2ba-739e-45fb-9983-e599c1f8bc20
4
public void run(){ if(isRunning){ System.err.println("findingLinks"); try { String endpoint = ""; if(isRedditGal(gal)){ endpoint = "https://api.imgur.com/3/gallery/r/"+gal; }else if(isAlbum(gal)){ endpoint = "https://api.imgur.com/3/album/"+gal+"/images"; }else{ endpoint = "https:...
41012be4-8f23-4faf-af60-55fa6b50ceee
6
public static void main(String[] args) { Server b = new Server(); System.out.println(System.getProperty("user.dir")); System.out.println(Constants.getRoot().getAbsolutePath()); System.out.println(Constants.getRootOfSource()); StorageDatabase storage = new StorageDatabase(); ConfigFile config = new Config...
50f85fbc-67af-4574-87ea-d9028c5f4635
1
public int exprHashCode() { int v = 6; for (int i = 0; i < params.length; i++) { v ^= params[i].exprHashCode(); } return v; }
bdba0345-5bdf-4765-b460-c352abeb7618
4
private int computeCompression(double[][] input, boolean Y) { int dcbits; int bits = 0; if(Y) dcbits = (10 - n); else dcbits = (9 - n); int[] acs = { (int)input[0][1], (int)input[1][0], (int)input[2][0], (int)input[1][1], (int)input[0][2], (int)input[0][3], (int)input[1][2], (int)input[2][1]...
c6af7a31-bb9d-47fd-8c1a-9c97feb7ed58
8
static int[] TKT(int[][] a, String[] s){//Three-of-a-Kind Triads int[] c=new int[1490]; int n=a.length; for(int i=0;i<1490;i++) { int [] b=new int[470];//For polbooks max degree<30 int k=0; for(int j=0;j<1490 ;j++){if(a[i][j]==1){b[k++]=j;}}//k=degree of i int p=0; for(int j=0;j<k;j++){for(int m=j+1;m<k;m++){...
73a87033-1012-4ca7-a8be-f550f46b5dfe
9
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String criterio = (String) request.getParameter("cri...
cc5e561f-5597-480d-8522-a6e75cc43ad9
0
public TastebudStylist(int b) { super(b); }
fa7055e8-8cb6-4059-a245-8628a9ef777f
2
public ArrayList<RecipeModel> getAllRecipes() { ArrayList<RecipeModel> recipeList = new ArrayList<RecipeModel>(); // Cr�ation de la requ�te java.sql.Statement query; try { // create connection connection = java.sql.DriverManager.getConnection("jdbc:mysql://" ...
91fb8230-343f-4989-9c7e-1911c16870e2
2
@Override public void onMoveTick(int x, int y, Game game) { SinglePlayerGame spg = (SinglePlayerGame) game; Location loc = spg.getFirstSquareNeighborLocation(x, y, 2, human.id); loc = loc == null ? Location.idleWander(x, y, 1, 60) : Location.towards(x, y, loc, 1); if (loc != null) { ...
8bf62bfc-d07f-4e87-b11a-8a6fc0e58f62
9
private void parseVar() { switch(currentToken.kind) { case Token.NAME: { parseName(); if (prefixexp1Starters()) { parsePrefixexp1(); parsePrefixexp2(); if (flag == 1) error = t...
7d847b83-9d9d-4fdf-b4c6-c37d8b5dcc95
5
public static short javaStringToInt(java.lang.String str) { StringCharacterIterator i = new StringCharacterIterator(str); i.first(); boolean neg = false; if (i.current() == '-') { neg = true; i.next(); } int value = 0; for (;i.current() != CharacterIterator.DONE; i.next()) { char c = i.curr...
e4b357df-be59-4dd0-8df9-b08e02bf6c84
4
public static String getCaminhoSelecionado(boolean excluirUltimo) { TreePath tp = tree.getSelectionPath(); String caminho = "raiz/"; if (tp != null) { Object[] no = (Object[]) tp.getPath(); //Monta a 'url' do elemento que está selecionado for (Object obj : no)...
067a597d-c1ff-4be7-acaa-ac905a0223c2
5
@Override public boolean hesapSil(String kullaniciAdi) { if(kullaniciAdi == null) return false; if(kullaniciAdi.equals("")){ JOptionPane.showMessageDialog(null, "Kullanici adı boş olamaz!", "Hata", JOptionPane.ERROR_MESSAGE); ...
6622dbda-ed34-4fd7-b2ec-8c6f25107f24
0
@Column(name = "PCA_GENERICO") @Id public Integer getPcaGenerico() { return pcaGenerico; }
a9023e8c-0d69-4d01-82e8-10089c57e5f5
8
public Set<Map.Entry<Integer,Double>> entrySet() { return new AbstractSet<Map.Entry<Integer,Double>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TIntDoubleMapDecorator.this.isEmpty(); } ...
72d3b3d3-b925-44fc-abe2-41dc45f63a79
9
void poll() throws IOException { if (!connected) return; String msg; while (in.ready()) { msg = in.readLine(); lastMessage = System.currentTimeMillis(); lastPing = 0; if (!pong(msg)) { decipherMessage(msg); } if (msg.indexOf("001") != -1) { registered = true; } } if (lastPing !...
76deab94-0407-4140-a441-7598767ac283
1
public int allWeight() { int weight = 0; for (Iterator<Confections> co = confections.iterator(); co.hasNext();) { Confections c = co.next(); weight += c.getWeight(); } return weight; }
d0037103-57ef-4275-9866-1abac87d683f
6
public static void main(String args[]) { while (true) { System.out.println("Conversion Tasks"); System.out.println("1. Hours -> Minutes"); System.out.println("2. Days -> Hours"); System.out.println("3. Minutes -> Hours"); System.out.println("4. Hours -> Days"); System.out.println("5. Elapsed time be...
6557ec82-0ea2-4469-9195-5aa3cc9d7d93
2
@SuppressWarnings("unchecked") @Override public void printAnswer(Object answer) { HashMap<Integer, Integer> answerMap; try { answerMap = (HashMap<Integer, Integer>)answer; } catch (ClassCastException e){return;} for (Integer key: answerMap.keySet()){ System.out.println(key + " -> " + answerMap.get(key...
f3d96387-a18a-4e87-8333-24189a691185
0
public void configureAndShow(DocumentSettings docSettings) { configure(docSettings); super.show(); }
479a97ae-1cd5-4b52-9894-72793fba542e
4
public void verificaLogin() { context = FacesContext.getCurrentInstance(); try { ClienteDAO dao = new ClienteDAO(); loginB = dao.getLogin(usuario); if (loginB != null) { usuario.setPasta(loginB.getPasta()); if (loginB.getNome().eq...
8d4da519-16b7-437d-80c8-a9bf32e01129
6
public boolean matchesInequality() { if (MenuBar.exampleOutput.getText().contains(">")) { if (MenuBar.exampleOutput.getText().contains("=")) { return angle < 0 || angle == 0; } else { return angle < 0; } } else if (MenuBar.exampleOutput.getText().contains("<")) { if (MenuBar.exampleOutput.getTex...
9a20d8d9-7a73-4d5a-b077-84fe64b2a08a
9
public BargraphExternal(){ System.out.println("external started"); currentQuestion = ""; size=0; participantCount = 0; buffer = 10; width = 600; height = 400; frame = new JFrame(); //graphPanel = new JPanel(); frame.setSize(width+80, height+80); this.setMinimumSize(new Dimension(width, height)); ...
720598b7-60d8-4564-be76-8e3d9375b0bc
6
@Override public boolean execute(final CommandSender sender, final String[] split) { if (sender instanceof Player) { if (MonsterIRC.getHandleManager().getPermissionsHandler() != null) { if (!MonsterIRC.getHandleManager().getPermissionsHandler() .hasCommand...
60c7f70a-6447-417f-b475-b7fc3676d343
7
public boolean executeLine(String line) { try { if (line.matches("(?i)^(authors?|about)\\s*$")) { system = PSystemVersion.createShowAuthors(); return true; } if (line.matches("(?i)^version\\s*$")) { system = PSystemVersion.createShowVersion(); return true; } if (line.matches("(?i)^testd...
87033d6a-1a2d-4551-94a2-9907e7357d53
1
@Override public void makeVisible() { super.makeVisible(); if( connection != null ) { connection.makeVisible(); } }
e8480aa4-d5cc-4b7f-bb86-da881d3c6a0c
2
@Override public boolean equals(Object obj) { if (obj == this) return true; if(!(obj instanceof Transaction)) return false; Transaction t = (Transaction) obj; return (tid == t.getTid()); }
989d301b-26b3-4c6d-b16e-a3e632e5d777
7
private void initShutdownMenuFontMenu(Color bg) { this.shutdownMenuPanel = new JPanel(); this.shutdownMenuPanel.setBackground(bg); this.shutdownMenuPanel.setLayout(new VerticalLayout(5, VerticalLayout.LEFT)); String initFontTmp = this.skin.getShutdownMenuFont(); int initFontSize...
fb922f96-e397-494c-b539-4ad38b075dea
1
public void addResult(ValidateResult validateResult) { for (int i = 0; i < result.length; i++) { result[i] += validateResult.getResult()[i]; } calculateStatistic(); }
b5c41cce-051e-42b9-9a3b-8e03011c1836
3
public void keyPressed(int key) { int i = keyMapping.getKey(key); if (i < 0) return; if ((i < 20) && (keyBuffer[(kwp & 0x3F)] == 0)) { keyBuffer[(kwp++ & 0x3F)] = (char)i; } isDown[i] = true; doInterrupt = true; }
3b776aab-9910-4fbb-8100-eb4dd95985a5
8
public void abrirSemaforo(Tren tren) { int estacion = tren.getNumEstacion(); int semaforo = tren.getNumViaEstacion(); if(estacion == 0) imagenCentral.setIcon(new ImageIcon("horizontal.png")); else imagenCentral.setIcon(new ImageIcon("vertical.png")); lists[estacion][semaforo].setSelectedValue(tre...
2ad42d79-92e7-4c7b-977c-9f7ffb4256f2
9
public static PropertySet populatePropertyHash(PropertySet toProperties, java.lang.Object toObject, IPropertySet toSecondary) { // Make a copy to protect from concurrent modification List<String> lcKeySet = new List(toProperties.keySet()); for (String lcParam : lcKeySet) ...
c5c76eaf-2e79-4ebe-a4a9-0ad1f0576463
1
protected void initView() { initTreePanel(); // Sets up the displays. JComponent pt = initParseTable(); JScrollPane parseTable = pt == null ? null : new JScrollPane(pt); GrammarTable g = initGrammarTable(grammar); JScrollPane grammarTable = new JScrollPane(g); treeDerivationPane.add(initTreePanel(), "...
84b57ac1-baa8-4c39-958c-cb69799eb5d8
0
public FileDownloadEvent(File currentFile, URL currentUrl, long length, long savedLength, boolean isCompleted, boolean isCanceled, Object source){ this.currentFile = currentFile; this.currentUrl = currentUrl; this.length = length; this.savedLength = savedLength; this.source = source; }
aaca9639-9630-4d61-b610-758d620af6f9
1
public static boolean isZombieGiant (Entity entity) { if (entity instanceof Giant) { return true; } return false; }
c70e75d0-b10c-4075-8c4a-5c22d41cb2d5
9
private String step1b (String word){ int lw = word.length(); int mbefore = 0; if(word.endsWith("eed")){ if(word.length()>3){ mbefore = getM(word.substring(0,lw-3)); if(mbefore>0){ word = word.substring(0,lw-1); } } }else if(word.endsWith("ed")){ if(word.length()>2){ Stri...
c6d1c93b-f143-45ef-b7f5-5937205d26b9
6
public void init() { try { UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName()); } catch (UnsupportedLookAndFeelException e) { System.err.println("Can't use the specified look and feel (System LookAndFeel) on this platform."); Syste...
5a573af8-1b70-4607-8b66-96d818bda52c
9
public cp_options(List<String> cmds) { for(int c=cmds.size()-1;c>=0;c--) { final String s=cmds.get(c); if(s.startsWith("-")) { for(int c2=1;c2<s.length();c2++) switch(s.charAt(c2)) { case 'r': case 'R': recurse=true; break; case 'f': case 'F': for...
c48edb33-40cc-453a-9e77-bd8b8fa61212
4
public ListNode deleteDuplicates(ListNode head) { if(head == null || head.next == null) return head; ListNode root = head; while(root.next != null){ if(root.val == root.next.val) root.next = root.next.next; else root = root.next...
4e9b7913-1abf-4f68-8905-03bd2df7312c
9
public static ArrayList<String> FetchjobsFromJobPortal(String urlForJob) { WebDriver driver1 = new FirefoxDriver(); // Code for pagination driver1.get(urlForJob); ArrayList<String> listOfJobs = new ArrayList<String>(); //WebElement ulOfPagination = divForJobs.findElement(By...
93a64d7a-e59b-47e6-8f45-e34a583f77c8
2
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); String userid=request.getParameter("sjsuid"); String password=request.getParameter("password"); HttpSessi...
e2892e19-f14d-40ad-9d33-9f3020cd0c96
3
private boolean playerStartPositionsHasNoLightGrenade(Grid grid) { List<LightGrenade> lightGrenades = getLightGrenadesOfGrid(grid); for (Player p : grid.getAllPlayersOnGrid()) for (LightGrenade lg : lightGrenades) if (grid.getElementPosition(lg).equals(p.getBeginPosition())) return false; return...
4b8237aa-87b7-4f6e-b046-a55e0d4aa679
0
public void reset() { this.goalMap.clear(); }
ca50d618-63a0-47e2-a755-ee44ce95d9d6
9
final int method1803(String s, int i, int j, int k, int l, int i1, int j1, int k1, int l1, Random random, int i2, int ai[]) { if (s == null) { return 0; } random.setSeed(i2); method1805(i1, j1, 192 + (random.nextInt() & 0x1f)); int j2 = s.length(); ...
3fe27b52-355c-488c-810d-bdf78736f996
3
public static void mkdir( File... paths ) throws IOException { IOException exception = null; for ( File eachPath : paths ) { if ( !eachPath.mkdirs() ) { exception = new IOException( "Unable to mkdir " + eachPath ); } } if ( exceptio...
87f28853-f142-4e47-a157-1e8df67efa7c
1
private RemotePaddle getRemotePaddle() { if (networkGameType == NetworkGameType.MASTER) return new RemotePaddle(width-(int)(HORIZONTAL_SCALE * width), 0, width, height, (int)(HORIZONTAL_SCALE * width), (int)(VERTICAL_SCALE * height)); else return new RemotePaddle(0, 0, width, hei...
fdc82b1f-09c3-4126-bf19-19a336ac73cf
5
public synchronized boolean hasMatched() { if (matchDataChanged) { return false; } if (matchedText == null || matchedText.length() < 1) { return false; } String text = textComponent.getText(); if (text == null || !text.equals(matchedText)) { ...
aa0a1786-b16d-4eda-b45e-d881edcf81b5
2
public void run() { /* You fill this in */ //window size setSize(700, 400); print("Enter the start point:"); int value = readInt(); int stepCounter = 0; while (value > 1) { StringBuilder sr = new StringBuilder(); sr.append(++stepCounter + ") "); sr.append(value + " is "); if ...
2d088247-cfbe-40e1-b59f-f8892f3cff08
9
public String execute() { String actionResult = ""; try { DataService dataService = new DataService(); Map param = ActionContext.getContext().getParameters(); if (!param.isEmpty()) { String[] paramValueArray = null; paramValueArray = ...
be831cf3-8db7-4941-9abd-5b814b32a74a
7
@Override public boolean onCommand(final CommandSender sender, Command command, String label, final String[] args) { if (!sender.hasPermission(command.getPermission())) { sender.sendMessage(Ultrabans.DEFAULT_DENY_MESSAGE); return true; } if (args.length < 1) ...
d94bc61a-9122-4e3e-a545-44242f4cd013
0
public double getRadius() { return _radius; }
9af23fae-c628-4019-a7b4-9b382b738ff1
1
public void resetAll() { // reset bacon number for (ActorGraphNode tmp : actors.values()) { tmp.setBaconNumber(-1); } }
b8734e97-502b-42b7-b8f2-cf5a6e446608
0
public void entering(String name, Object o, String... args) { info(StringUtils.shortName(o.getClass()) + "-" + o.hashCode() + " entering " + name + "(" + StringUtils.join(args, ", ") + ")"); }
aa6df3e8-52be-48f3-869f-4a5d2c259165
5
private static int[] findL(String s){ int[] r=new int[s.length()]; boolean first=true; int index=0; for(int i=0;i<s.length();i++){ if(s.charAt(i)=='1'&&first){ r[i]=0; index=i+1; //temp++; //r[i]=temp; first=false; }else if(s.charAt(i)=='1'&&!first){ r[i]=index; index=i+1; //temp++; /...
d6493661-ffa6-4bb9-b9fd-ebcd9cb8b544
4
@Override public Table getTable(String tableName) { checkName(tableName); String fullPath = tableDir + File.separator + tableName; File file = new File(fullPath); if ((!file.exists()) || (file.isFile())) { return null; } readLock.lock(); try { ...
52f85529-9e47-4c5b-90b6-d541dee59900
7
public void IfStatement() { if(current.getId().equals("IFSYM")) { nextToken(); ArrayList<Token> exp = LogicalExpression(); ArrayList<Token> stmts = getStatements(); if(exp == null || stmts == null) { return; } BooleanParser bp = new BooleanParser(exp); boolean run = bp.getAnswer(); ...
b32b3cdd-aaa9-40c0-a1e6-2bd401696721
1
public Throwable getCause() { return (myCause == this ? null : myCause); }
e50cf483-9e35-4d50-8ee3-dc9ba42310ad
6
public Trace [] getMultiTraces_v2(GeoTag [] geoTags){ // the returned traces object: Trace [] traces = new Trace[geoTags.length]; // ResultSet objects: ResultSet resultSet; try { // parameterIndex: int parameterIndex = 1; ...
4f9bbe5c-e281-4dc0-be7e-f7d11e6156f3
8
public static void updateBundle(Credential credential, String pid, Participant p) throws IOException{ // See if any cards of the bundle id exist. LOG.fine("Exist"); TimelineListResponse resp = MirrorClient.listItemsBundle(credential, pid); //Reverse order of cards ArrayList<TimelineItem> items = new Ar...
1f1555cd-5c35-45ab-a1ff-fee40842601a
4
public void move() { Dimension s = environment.getSize(); double newX = position.getX() + speed * cos(direction); // the reason there is a minus instead of a plus is that in our plane // Y coordinates rises downwards double newY = position.getY() - speed * sin(direction); double hw = s.getWidth() / 2; ...
effea249-39fd-4eb3-b7ec-448881676956
9
public String formatOptionHelp(BaseOption<?> o) { StringBuilder helpMessage = new StringBuilder(); StringBuilder line = new StringBuilder(); String callFormat = optionCallFormat(o); for (String name : o.getNames()) { line.append(name).append(" ").append(callFormat).append(", ...
e4806079-eec8-4b30-b615-2d47a2d14d8a
5
@Override public void run() { String res = ""; String recieve = null; while (running){ recieve = this.recieve(); if (recieve != null) { res = this.interpreter.execute(recieve); if (!res.startsWith("ERROR") && !res.equals("BYE")) { ...
012e9d57-40d3-48c5-95b9-8bd2315c4de4
5
private void initWorkArea(int vsize){ if(hn==null){ hn=new int[1]; v=new int[vsize]; c=new int[BMAX+1]; r=new int[3]; u=new int[BMAX]; x=new int[BMAX+1]; } if(v.length<vsize){ v=new int[vsize]; } for(int i=0; i<vsize; i++){v[i]=0;} for(int i=0; i<BMAX+1; i++){c[i]...
6ad209f5-8ee2-403b-abc4-bee59079952a
0
@Size(min = 2, max = 20) public String getNazwisko() { return nazwisko; }
e97f2233-4f6d-4a66-ad12-0e6bddcc54ca
1
public void addRows(List<Files> array) { FilesTableModel tableModel = new FilesTableModel(array, manager); int row = array.size(); int col = 0; for (Files data : array) { setValueAt(data, row-1, col++); } }
5d32e7ed-514d-44d5-82fc-1f1c642831e4
9
private void cssNthChild(boolean backwards, boolean ofType) { String argS = tq.chompTo(")").trim().toLowerCase(); Matcher mAB = NTH_AB.matcher(argS); Matcher mB = NTH_B.matcher(argS); final int a, b; if ("odd".equals(argS)) { a = 2; b = 1; } else if ("even".equals(argS)) { a = 2; b = 0; } else...
faf4c81e-2305-4dbb-86a8-3d0006c69c2e
4
public boolean saveNewItem(ArrayList<Item> newItem, Connection con) { boolean didItWork = true; String SQLString1 = "insert into varer values(?,?,?,?)"; String SQLString2 = "select varerseq.nextval from dual"; PreparedStatement statement = null; try { statement = co...
3c13a6e8-2411-45ce-9553-a936cd701c68
9
public GenericConverter find(Class<?> sourceType, Class<?> targetType) { List<Class<?>> sourceCandidates = getTypeHierarchy(sourceType); List<Class<?>> targetCandidates = getTypeHierarchy(targetType); for (Class<?> sourceCandidate : sourceCandidates) { for (Class<?> targetCandidate : targetCandidates) { ...
fcd459a0-8eb4-44e1-ae88-98ad73b3eeef
9
private ArrayList<String> getPlayers(String args, CommandSender sender) { ArrayList<String> players = new ArrayList(); if(PlayerCache.playerExists(args)) players.add(args); if(_bVault) { Permission permission = (Permission)Bukkit.getServer().getServicesManager().getRegis...
f2feaeba-068f-4656-bdf6-87a2f7ca10ac
0
public synchronized void addSearchedSites(String url){ this.searchedSitesList.add(url); }
5e6cd308-dbc6-4ff0-8577-11a0443bb836
2
public Collection<Library> getRelevantLibraries() { List result = new ArrayList(); for (Library library : this.libraries) { if (library.appliesToCurrentEnvironment()) { result.add(library); } } return result; }
aaeba700-eacc-4367-84a1-fd6348a55abb
6
public static String unescape(String string) { int length = string.length(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < length; ++i) { char c = string.charAt(i); if (c == '+') { c = ' '; } else if (c == '%' && i + 2 < length) { ...
c45c3d86-6a1b-4e1c-b973-e6099dc6580e
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...
f11aac90-d5b1-426b-a13e-71e499830af1
9
public void update(){ final STATE state = this.now_state; switch(state){ case STATE_GAME: //System.out.println(map.get_now_state() == Map.STATE.STATE_STOP); if(map.get_now_state() == Map.STATE.STATE_STOP){ this.now_state = STATE.STATE_NOW_LOADING; } else if(map.get_now_state() == Map.STA...
6ed7ab9c-c507-4864-beca-f6ce3b211d01
4
public ListNode merge(ListNode left,ListNode right){ ListNode head = new ListNode(-1); ListNode node = head; while(left != null && right != null){ if(left.val < right.val){ node.next = left; left = left.next; } else{ ...
17041f18-b908-4717-9f52-b8ef9bedf2d1
5
@EventHandler(priority = EventPriority.NORMAL) public void onBlockBreak(BlockBreakEvent event) throws SQLException { if (event.isCancelled()) return; Player player = event.getPlayer(); Block block = event.getBlock(); if (plugin.isLifestone(block) == true) { if (!(player.hasPermission("lifestones.breakl...
3d45d096-bfcb-4005-9a17-d9d1f06b4182
1
public static Calendar toCalendar(final String iso8601string) throws ParseException { Calendar calendar = GregorianCalendar.getInstance(); String s = iso8601string.replace("Z", "+00:00"); try { s = s.substring(0, 22) + s.substring(23); } catch (IndexOutOfBoundsExc...
3424d9f6-c340-44aa-b475-e6268151fa31
3
@Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub //EventObject e = null; JButton botonPulsado=(JButton)arg0.getSource(); if(botonPulsado==botonIniciar) { this.dispose(); vNueva nueva = new vNueva(); nueva.setVisible(true); } if(botonPulsado==boto...
ab9cd1f5-94e6-4441-87fb-0b33b248f4fc
5
private boolean[][] addSweetsIntoLandscape(){ boolean[][] gameMap = new boolean[gridSize][gridSize]; Random rand = new Random(); for(int i = 0; i < numberOfSweets; i++) { int j, k; do { j = rand.nextInt(gridSize); k = rand.nextInt(gridSize); } while (gameMap[j][k] ==...
b8665bdd-ca7e-40da-8860-df2055711a77
6
public String getColumnName(int col) { String s = ""; switch (col) { case 0 : s="De"; break; case 1 : s="Para"; break; case 2 : s="DataIni"; break; case 3 : s="DataFim"; break; case 4 : s="Historico"; break; case 5 : s="Valor"; break; } return s; }
94953c42-eb39-4212-8217-cbdcd79ac287
5
@Override public String composeText(boolean replaceTextContent, boolean recursive) { String composed = ""; //Compose from words for (int i=0; i<words.getTextObjectCount(); i++) { if (recursive) ((LowLevelTextContainer)words.getTextObject(i)).composeText(replaceTextContent, recursive); if (i > 0) co...
95e25f3f-15d9-44ad-9554-0bd0362b63e8
0
public int getCreditLimit() { return this.creditLimit; }
882ec8d9-bffe-4abc-9c2f-25e31f2fd81c
5
public void read(String map) { List<Pair> list = new ArrayList<Pair>(); File file = new File(map); BufferedReader reader = null; int counter = 0; try { reader = new BufferedReader(new FileReader(file)); String text = null; while ((text = reader.readLine()) != null) {...
9c0c2867-0da7-419a-bd1c-29d790314a13
0
public Rectangle getAbsoluteRect() { Rectangle absRect = new Rectangle(); int unitVal = unit.value; absRect.x = x * unitVal; absRect.y = y * unitVal; absRect.width = width * unitVal; absRect.height = height * unitVal; return absRect; }
c7620f11-9282-4578-af4b-ee22600af4f0
3
public boolean twoPointFiveOpt(){ int pathLength=tour.length(); boolean improved=false; for(int fromIndex=0;fromIndex<pathLength;fromIndex++){ int toIndex=Help.circleIncrement(fromIndex, pathLength); for(int j=0;j<pathLength-3;j++){ toIndex=Help.circleIncrement(toIndex, pathLength); if(tour.isBe...
9311284a-801a-47e8-9fc0-ffd09edc7f06
2
public String getMessages(String file){ StringBuffer messages = new StringBuffer(20000000); int i =0; try{ InputStream in = ftp.downloadStream(fileRep+file); try { int ch = 0; while ((ch = in.read()) >= 0) { messages.append((char)ch); i++; } } finally { in.close(); // MUST be...
ecd60934-2c4f-4674-9017-7ba11bc1641e
8
@Override public void keyPressed(KeyEvent ke) { if (!keybinding) { if (ke.getKeyCode() == switchKey) content.flip(); else if (ke.getKeyCode() == leftKey || ke.getKeyCode() == KeyEvent.VK_LEFT) content.left(); else if (ke.getKeyCode() == rightKey || ke.getKeyCode() == KeyEvent.VK_RIGHT) conten...