query
stringlengths
7
33.1k
document
stringlengths
7
335k
metadata
dict
negatives
listlengths
3
101
negative_scores
listlengths
3
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
TODO Autogenerated method stub
@Override public void onClick(View v) { Intent i = new Intent(MainActivity.this, ActivityB.class); i.putExtra("name", textBox.getText().toString()); i.putExtra("job", textBox1.getText().toString()); i.putExtra("boolean", textBox2.getText().toString()); i.putExtra("amount", textBox3.getText().toString()); startActivity(i); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExr...
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.608016...
0.0
-1
Handle action bar item clicks here. The action bar will automatically handle clicks on the Home/Up button, so long as you specify a parent activity in AndroidManifest.xml.
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { //Toast.makeText(getApplicationContext(), "Thank You @Cc_Hub", Toast.LENGTH_LONG).show(); return true; } return super.onOptionsItemSelected(item); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public boolean onOptionsItemSelected(MenuItem item) { Handle action bar item clicks here. The action bar will\n // automatically handle clicks on the Home/Up button, so long\n // as you specify a parent activity in AndroidManifest.xml.\n\n //\n // HANDLE BACK BUTTON\n ...
[ "0.79044175", "0.7806529", "0.77667165", "0.772694", "0.76315796", "0.76219255", "0.75851756", "0.75312436", "0.7488551", "0.7458599", "0.7458599", "0.74389243", "0.74213", "0.7403157", "0.7392013", "0.73872125", "0.73794484", "0.73704696", "0.73621285", "0.7356082", "0.73457...
0.0
-1
Este metodo serve para retornar o alvo que esta decrito no JSON
private Alvo retornaAlvo(JSONObject jsonAlvo){ Alvo alvoTemp = null; String divisao = ((JSONObject) jsonAlvo).get("divisao").toString(); String tipo = ((JSONObject) jsonAlvo).get("tipo").toString(); alvoTemp= new Alvo(tipo, divisao); return alvoTemp; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Path(\"/productos\")\n @GET\n @Produces(MediaType.APPLICATION_JSON) //Por que una track si la aceptaba (ejemplo) pero un producto no?\n public String productos(){\n return test.getProductos().get(\"Leche\").toString();\n\n }", "@GET\n @Produces(MediaType.APPLICATION_JSON)\n public Strin...
[ "0.692742", "0.681112", "0.6636768", "0.6567738", "0.6537581", "0.6408511", "0.63295925", "0.63295925", "0.63295925", "0.6313578", "0.6312587", "0.62614155", "0.6240915", "0.62336177", "0.6227993", "0.6149919", "0.61307544", "0.61292624", "0.61229306", "0.60866046", "0.608452...
0.61510026
15
Este metodo vai verificar se a divisao tem mais que um Inimigo
public Inimigo retornaInimigo(String divisaoaux, JSONArray jsonInimigos){ for (Object inimigos:jsonInimigos) { String nome = ((JSONObject) inimigos).get("nome").toString(); Integer poder = Integer.parseInt(((JSONObject)inimigos).get("poder").toString()); String divisao = ((JSONObject) inimigos).get("divisao").toString(); if(divisaoaux.equals(divisao)){ // verificar se existe algum inimigo repetido for (Object inimigosVerificacao:jsonInimigos) { String nomeVerificacao = ((JSONObject) inimigosVerificacao).get("nome").toString(); Integer poderVerificacao = Integer.parseInt(((JSONObject)inimigosVerificacao).get("poder").toString()); String divisaoVerificacao = ((JSONObject) inimigosVerificacao).get("divisao").toString(); if(divisao.equals(divisaoVerificacao) && !nome.equals(nomeVerificacao)){ poder = poder+poderVerificacao; } } Inimigo temp = new Inimigo(nome,(double)poder,divisao); return temp; } } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void handleIndivisible() {\n\t\n}", "public boolean verificarMinerosComodin() {\r\n int oro = 0;\r\n int plata = 0;\r\n int bronce = 0;\r\n int comodin = 0;\r\n\r\n for (int i = 0; i < listadeMineros.size(); i++) {\r\n if (\"ORO\".equals(listadeMineros.get(i)...
[ "0.58611524", "0.5857423", "0.58037037", "0.5586829", "0.5565371", "0.55213916", "0.548475", "0.5445661", "0.5420599", "0.5376619", "0.5369965", "0.5357316", "0.5328118", "0.53127295", "0.53102493", "0.53019077", "0.52986795", "0.5282357", "0.5280704", "0.52608114", "0.522411...
0.6131221
0
Este metodo vai percorrer todos os vertices do grafo com a travessia em largura comparando quais nao contem inimigo
private String[] guardaDivisoes() throws EmptyExcpetion{ String[] salasSemInimigo = new String[this.divisoes.size()]; int contador=0; for(int i=0;i<this.getDivisoes().size();i++){ String divisao = this.getDivisoes().iteratorBFS(i).next(); if(verificaSeEInimigo(divisao)==false){ salasSemInimigo[contador]=divisao; contador++; } } return salasSemInimigo; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private List<Vertice> pegaVerticesFolha() {\n List<Vertice> verticesFolha = new ArrayList<Vertice>();\n\n for (Vertice vertice : this.pegaTodosOsVerticesDoGrafo()) {\n if (this.getGrauDeSaida(vertice) == 0) {\n verticesFolha.add(vertice);\n }\n }\n\n ...
[ "0.6639431", "0.6427557", "0.61404115", "0.60104185", "0.59356564", "0.58986205", "0.58888453", "0.5883023", "0.5814847", "0.58061224", "0.5805326", "0.57672536", "0.576528", "0.57583255", "0.57495874", "0.5744372", "0.57158923", "0.5671707", "0.56504977", "0.56423765", "0.56...
0.0
-1
Corre um array de divisoes e escolhe uma divisao aliatoriamente
public String randomRoom() throws EmptyExcpetion{ String[] divisoes = guardaDivisoes(); Random random = new Random(); int temp=0; do{ temp = random.nextInt(divisoes.length); }while(divisoes[temp]==null); return divisoes[temp]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static void div(int[] numbers) {\n\t\tint sum=-1;\n\t\ttry {\n\t\t\tsum = numbers[0] / numbers[1];\n\t\t\tSystem.out.println(sum);\n\t\t} catch (ArithmeticException ex) {\n\t\t\tSystem.out.println(\"Sie dürfen um gottes Willen nicht durch NULL dividieren!\");\n\t\t\tex.printStackTrace();\n\t\t}\n\t\t\n\t}"...
[ "0.6261789", "0.6210613", "0.60051775", "0.5947086", "0.5916758", "0.5904879", "0.58920306", "0.5859013", "0.5701771", "0.5696831", "0.56702244", "0.56410027", "0.5638765", "0.5627765", "0.56001985", "0.5598775", "0.55940473", "0.55773604", "0.55082214", "0.55075824", "0.5503...
0.0
-1
If the specified RemoveRandom is empty, remove it. LOCKING: Must be called with no locks held, particularly no locks on the RemoveRandom, because we take locks in order!
public void maybeRemove(RemoveRandom r, ObjectContainer container, ClientContext context);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public T removeRandom();", "public T removeRandom ();", "public T remove() {\r\n \r\n if (this.isEmpty()) {\r\n return null;\r\n }\r\n \r\n Random r = new Random();\r\n // Randomly selects element to remove and stores in rValue.\r\n int rValue = r.nextInt(size);\r\n // S...
[ "0.7167599", "0.7076875", "0.63807184", "0.62446153", "0.6191354", "0.61082435", "0.6072256", "0.600413", "0.5875558", "0.55506265", "0.5517037", "0.5510043", "0.5419906", "0.54049724", "0.53315717", "0.52849823", "0.5256337", "0.523424", "0.5230986", "0.5219428", "0.5188676"...
0.67302996
2
Get the account lockout key to check or modify.
@Nullable public String getKey() { return key; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getUnlocker();", "String getLockOwner();", "protected UUID getCurrentUtilityKey() {\n Authentication auth = SecurityContextHolder.getContext().getAuthentication();\n AuthenticatedUser user = null;\n\n if (auth.getPrincipal() instanceof AuthenticatedUser) {\n user =...
[ "0.58077985", "0.57124436", "0.5541464", "0.54772425", "0.54565334", "0.54029244", "0.53949755", "0.53784347", "0.5331166", "0.5310123", "0.5253816", "0.52279437", "0.52165157", "0.5212374", "0.5211568", "0.5199561", "0.5189442", "0.5189442", "0.5178641", "0.5174036", "0.5172...
0.0
-1
Set the account lockout key to check or modify.
@Nonnull public LockoutManagerContext setKey(@Nullable final String k) { key = k; return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void unlock(int key);", "public void setLockKey( Long lockKey ) {\n this.lockKey = lockKey;\n }", "public void setLockoutManager(@Nullable final AccountLockoutManager manager) {\n checkSetterPreconditions();\n lockoutManager = manager;\n }", "void onKbsAccountLocked(@Nullabl...
[ "0.6072722", "0.58783776", "0.5851613", "0.5487868", "0.52896595", "0.52018136", "0.5194538", "0.51739603", "0.51449525", "0.51215315", "0.50942", "0.5093214", "0.5086348", "0.5070089", "0.5067239", "0.5060967", "0.5048915", "0.50486845", "0.50305635", "0.5028827", "0.4998918...
0.5287465
5
check trade history is correct
@Test public void testGetTradeHistory() { // all the previous trades for the dummy stock List<TickEvent<Trade>> completedTrades = exchange.getTradeHistory(stock); // check they are in the correct order for(int i = 0; i < completedTrades.size()-1; i++) { assertTrue(completedTrades.get(i).compareTo(completedTrades.get(i+1)) < 0); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean recordTrade(Trade trade) throws Exception;", "boolean hasTradeDate();", "@Then(\"^verify order is placed successfully in Order History$\")\r\n\tpublic void verifyOrderHistory() throws Exception {\n\t assertTrue(new ProductCheckout(driver).isOrderPlaced());\r\n\t}", "@Test\n void showStor...
[ "0.63742226", "0.60804224", "0.58986425", "0.5889927", "0.57919496", "0.5644258", "0.56355023", "0.5635432", "0.56099766", "0.55804765", "0.5574207", "0.5553625", "0.5536196", "0.5535758", "0.5530773", "0.5523995", "0.5491941", "0.5488283", "0.5481154", "0.54800284", "0.54719...
0.7469473
0
get the best bid and check it matches the best simulated bid
@Test public void testGetBestBid() { assertEquals("Best bid incorrect", buyOrder2, exchange.getBestBid(stock)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n public BidDetails determineNextBid() {\r\n\r\n double time = negotiationSession.getTime();\r\n\r\n // for the first 20% of the time, offer the bid which gives max utility\r\n if(time < Offer_Max_Util_Time){\r\n BidDetails maxBid = null;\r\n try {\r\n ...
[ "0.6821758", "0.64601773", "0.63994557", "0.6207962", "0.6189005", "0.6110189", "0.60213387", "0.60171556", "0.60099864", "0.60006344", "0.59951586", "0.5980042", "0.59711933", "0.5943161", "0.5926772", "0.58967394", "0.58937114", "0.58649063", "0.58514833", "0.5826185", "0.5...
0.7026436
0
get the best offer and check it matches the best simulated offer
@Test public void testGetBestOffer() { assertEquals("Best bid incorrect", sellOrder1, exchange.getBestOffer(stock)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Object getBest();", "private static int getAcceptDecision(Offer offer) {\n\t\treturn 0;\n\t}", "@Override\r\n public BidDetails determineNextBid() {\r\n\r\n double time = negotiationSession.getTime();\r\n\r\n // for the first 20% of the time, offer the bid which gives max utility\r\n if...
[ "0.63084424", "0.6131732", "0.60406655", "0.5829993", "0.582309", "0.58074635", "0.5693967", "0.56783164", "0.56726706", "0.5623803", "0.56189626", "0.5603902", "0.56013924", "0.5543335", "0.55053884", "0.54939026", "0.54889435", "0.5472125", "0.5469024", "0.54569644", "0.545...
0.6794383
0
Getter da bala do personagem.
public Bullet getBullet() { return this.bullet; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Nodo_B getPrimero(){\n return this.primero;\n }", "public java.lang.String getBloqueado(){\n return localBloqueado;\n }", "public int getBloco() {\r\n\t\treturn bloco;\r\n\t}", "public int getVelocidadBala() {\n return velocidadBala;\n...
[ "0.6909965", "0.66715163", "0.6659726", "0.6558575", "0.6537406", "0.6474761", "0.6452354", "0.6434729", "0.6397986", "0.6397986", "0.63885343", "0.63885343", "0.63221616", "0.6299058", "0.6259316", "0.6222143", "0.62093335", "0.6209182", "0.62074745", "0.6204603", "0.6194824...
0.0
-1
Setter da bala do personagem.
public void setBullet(Bullet bullet) { this.bullet = bullet; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void asignarAutomovilPersona(){\r\n persona.setAutomovil(automovil);\r\n }", "public void setEmpresa(Empresa empresa)\r\n/* 89: */ {\r\n/* 90:141 */ this.empresa = empresa;\r\n/* 91: */ }", "public void setBloqueado(java.lang.String param){\n \n ...
[ "0.67467684", "0.6721641", "0.67033756", "0.6696775", "0.6653414", "0.65612864", "0.6428183", "0.64150655", "0.64027554", "0.64019936", "0.63572013", "0.63522595", "0.63309175", "0.63248193", "0.6312173", "0.62764674", "0.6251463", "0.62257427", "0.62244356", "0.6219533", "0....
0.0
-1
Getter do nome do personagem.
public String getName() { return name; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getNome() {\r\n\t\treturn nome;\r\n\t}", "public String getNome() {\r\n\t\treturn nome;\r\n\t}", "public String getNome()\r\n\t{\r\n\t\treturn nome;\r\n\t}", "public String getNome()\r\n\t{\r\n\t\treturn nome;\r\n\t}", "String getNome();", "public String getNome() {\n\t\treturn nome;\n\t}",...
[ "0.776213", "0.776213", "0.7758236", "0.7758236", "0.76936984", "0.76880693", "0.76880693", "0.76880693", "0.76880693", "0.76880693", "0.76880693", "0.76880693", "0.76880693", "0.76880693", "0.7625644", "0.76235664", "0.7575862", "0.7570001", "0.7570001", "0.7560303", "0.7560...
0.0
-1
Setter do nome do personagem.
public void setName(String name) { this.name = name; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setName(String name)\r\n\t{\r\n\t\tthis.nome = nome;\r\n\t}", "public void setName(String name) {\n\t\tthis.nome = name;\n\t}", "void setNome(String nome);", "public void setNome(String nome) {\r\n\t\t// QUALIFICADOR = THIS\r\n\t\tthis.nome = nome;\r\n\t}", "public void setName (String n) {\n ...
[ "0.8031733", "0.79221785", "0.77404183", "0.7452004", "0.74070853", "0.7397259", "0.7386407", "0.7386132", "0.73740566", "0.7336995", "0.73328465", "0.73008734", "0.7296149", "0.72904944", "0.72499347", "0.72499347", "0.71919894", "0.7179916", "0.7152659", "0.7152609", "0.714...
0.0
-1
Getter de vidas do personagem.
public int getLives() { return lives; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getVid() {\r\n return vid;\r\n }", "public Integer getVid() {\n return vid;\n }", "public java.lang.String getVid() {\r\n return localVid;\r\n }", "public int getVideos() {\n return videos;\n }", "public List<Video> getVideo() {\n\t\treturn null;\n...
[ "0.72075367", "0.7021209", "0.6654529", "0.6626327", "0.63308376", "0.6157437", "0.6147101", "0.60899967", "0.6087818", "0.6056954", "0.6012463", "0.5982784", "0.591003", "0.5900699", "0.5815794", "0.5811905", "0.5807783", "0.58001316", "0.5730044", "0.5711306", "0.571086", ...
0.0
-1
Setter de vidas do personagem.
public void setLives(int lives) { this.lives = lives; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setVidas (int vidas)\r\n\t{\r\n\t\tthis.vidas= vidas;\r\n\t}", "public void setVid(int value) {\r\n this.vid = value;\r\n }", "public void setVid(Integer vid) {\n this.vid = vid;\n }", "void setVida(int vida)\n\t{\n\t\t// variable declarada anteriormente igual a la declarada e...
[ "0.74424803", "0.6702681", "0.64983743", "0.6342604", "0.62480766", "0.61671245", "0.6118479", "0.5838453", "0.57972586", "0.5753622", "0.5684398", "0.56615764", "0.56314063", "0.5591525", "0.55665416", "0.55530417", "0.5545565", "0.5484682", "0.5467985", "0.546526", "0.54487...
0.0
-1
Faz com que seja descontado 1 no total de vidas do personagem.
public void lostLife(){ this.lives--; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void pierdeUnaVida() {\n numeroDeVidas--;\n }", "public void somaVezes(){\n qtVezes++;\n }", "public void mostrarVideojuegosNumeradosPorOrdenDeRegistro()\n {\n int posicActual = 0;\n while (posicActual < listaDeVideojuegos.size()) {\n System.out.println((p...
[ "0.6389026", "0.61263484", "0.5828802", "0.5738575", "0.5705123", "0.5656298", "0.5647127", "0.5576242", "0.5527997", "0.5508955", "0.5482994", "0.5429879", "0.53898585", "0.5368554", "0.53646183", "0.53424966", "0.5335926", "0.5323444", "0.5284575", "0.5259723", "0.524969", ...
0.0
-1
Faz com que o personagem perca uma vida caso um alvo encoste nele.
public void killed(Target target){ if(this.crashed(target.getShape())) this.lives--; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void aggiungiPecoraCasualmente() {\n\t\tif (((int) (Math.random() * 3)) >= 1) {\n\t\t\tPecoraAdulta nuovaPecoraAdulta = new PecoraAdulta();\n\t\t\tpecore.add(nuovaPecoraAdulta);\n\t\t\tif (nuovaPecoraAdulta.isMaschio())\n\t\t\t\tnumMontoni++;\n\t\t\telse\n\t\t\t\tnumPecoreFemmine++;\n\t\t} else {\n\t\t\tpec...
[ "0.64418095", "0.6433997", "0.63712066", "0.6360756", "0.6351867", "0.6319188", "0.6287344", "0.6264079", "0.6225655", "0.6219447", "0.61978143", "0.6188394", "0.6178063", "0.61646855", "0.6143667", "0.61253315", "0.6094948", "0.6080231", "0.60747045", "0.60658467", "0.605560...
0.0
-1
Getter de pontos do personagem.
public int getPoints(){ return this.points; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public SystemeAmendesInt.Personne getProprietaire() {\n return proprietaire;\n }", "public List<Propriedade> getPropriedadesDoJogador() {\r\n return propriedadesDoJogador;\r\n }", "public Patient getProprietaire() {\n\t\treturn proprietaire;\n\t}", "public abstract DtPropuesta[] getPropue...
[ "0.6904533", "0.6786748", "0.66621614", "0.6661818", "0.6637426", "0.6580559", "0.65638155", "0.64813554", "0.6458739", "0.64423734", "0.64062524", "0.63951486", "0.6387938", "0.63854665", "0.6376622", "0.6326372", "0.6320527", "0.6316915", "0.63094616", "0.6300218", "0.62881...
0.0
-1
Gerencia o tiro do personagem.
public void isShooting(GameContainer gc) throws LineUnavailableException{ if(gc.getInput().isKeyPressed(Input.KEY_SPACE) || gc.getInput().isKeyPressed(Input.KEY_UP)){ if(!this.bullet.isMoved()){ this.playSound(); animation = this.shooting; this.bullet.position.x = super.getShape().getCenterX(); this.bullet.position.y = super.getShape().getCenterY(); this.getBullet().setMoved(true); return; } } if(this.getBullet().isMoved()){ this.bullet.move(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic String getTipoPersona() {\n\t\treturn \"alumno del curso \" + curso + \" de \" + grupo + \" de \" + tipoEstudios ;\r\n\t\t\r\n\t}", "void crearNuevaPersona(Persona persona);", "public JogadorTradutor() {\n this.nome= \"Sem Registro\";\n this.pontuacao = pontuacao;\n i...
[ "0.72368324", "0.6812848", "0.66806346", "0.6624993", "0.65794855", "0.6513436", "0.6459159", "0.64345896", "0.643047", "0.6333398", "0.6304873", "0.62943757", "0.6215135", "0.62107754", "0.61841035", "0.6141409", "0.613129", "0.610901", "0.6106043", "0.6083094", "0.6060553",...
0.0
-1
Tells whether the the user is Authorized or not
public boolean isAuthorized(){ return authorized; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "boolean getIsAuthorized();", "private boolean isAuthorized() {\n return true;\n }", "public Boolean isAuthorized(String userId);", "public boolean getAuthorisedUser() {\n return authorisedUser;\n }", "public boolean isAuthorized() {\n return authorized;\n }", "public boolean isAut...
[ "0.77592754", "0.7751337", "0.76383984", "0.7506", "0.75051755", "0.7407797", "0.7128761", "0.7112434", "0.7054827", "0.69424367", "0.68881834", "0.6758398", "0.67485046", "0.6703518", "0.66991055", "0.6622541", "0.6596706", "0.65945315", "0.6592952", "0.6528163", "0.65220624...
0.7667757
2
Gets the Cookies if the User is Authorized, else throws exception
public String[] getCookies() throws GGException{ if(!authorized){ throw new GGException(GGErrorCodes.GG_UNABLE_TO_AUTH); } return cookies; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Cookie[] getCookies();", "public abstract Cookie[] getResponseCookies();", "public Collection<Cookie> getCookies()\n\t{\n\t\tparseCookiesIfNecessary();\n\t\tif (this.cookies != null)\n\t\t\treturn this.cookies.values();\n\t\telse\n\t\t\treturn null;\n\t}", "private void authorize(){\n\t\t\n\t\tURL authURL = ...
[ "0.6196375", "0.60313374", "0.5854217", "0.57500494", "0.57367057", "0.55937", "0.55750626", "0.5484647", "0.54797196", "0.54626083", "0.5435413", "0.5426013", "0.53773546", "0.5372409", "0.53649807", "0.5364862", "0.5351818", "0.5257485", "0.52570194", "0.5196876", "0.511175...
0.66683185
0
Private method to do the authorization.
private void authorize(){ URL authURL = null; URL homeURL = null; URLConnection homeCon = null; String loginPage = GG.GG_LOGIN+"?ACCOUNT="+GG.GG_UID +"&PASSWORD="+GG.GG_PASS; String cookieString = ""; String cookieString1 = ""; try{ homeURL = new URL(GG.GG_HOME); homeCon = homeURL.openConnection(); // Look At the headers Map headerMap = homeCon.getHeaderFields(); // Look for the Cookie if(headerMap.containsKey("Set-Cookie")){ // this gets the exact value of the header // otherwise gets some formatted string cookieString = homeCon.getHeaderField("Set-Cookie"); //log.finest("cookie1: "+cookieString); authURL = new URL(loginPage); HttpURLConnection.setFollowRedirects(false); HttpURLConnection loginCon = (HttpURLConnection) authURL.openConnection(); // doOutput must be set before connecting loginCon.setAllowUserInteraction(true); loginCon.setUseCaches(false); loginCon.setDoOutput(true); loginCon.setRequestProperty("Cookie", cookieString); loginCon.connect(); // Look At the headers Map headerMap1 = loginCon.getHeaderFields(); cookieString1 = loginCon.getHeaderField("Set-Cookie"); //log.finest("cookie2: "+cookieString1); if(!Pattern.matches(".*\\."+GG.GG_UID+"\\.\\d+.*", cookieString1)){ return; } String location = loginCon.getHeaderField("Location"); URL gotURL = new URL(location); HttpURLConnection gotCon = (HttpURLConnection) gotURL.openConnection(); // doOutput must be set before connecting gotCon.setAllowUserInteraction(true); gotCon.setUseCaches(false); gotCon.setDoOutput(true); gotCon.setRequestProperty("Cookie", cookieString); gotCon.setRequestProperty("Cookie", cookieString1); gotCon.connect(); // Got the Cookies cookies[0] = cookieString; cookies[1] = cookieString1; }else{ log.info("Unable to find the Cookie"); } }catch(Exception e){ e.printStackTrace(); } authorized = true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void authorize() {\r\n\r\n\t}", "public void doAuthorize() {\n authorizeBehavior.authorizd();\n }", "protected abstract String getAuthorization();", "private Boolean authorize() {\n\n return Session.getInstance().login(user.getText(), password.getText());\n }", "private boolean ...
[ "0.8113572", "0.76707864", "0.6782716", "0.6773423", "0.6711626", "0.6676545", "0.66534775", "0.6636616", "0.6615567", "0.63970864", "0.62690467", "0.6258649", "0.6244614", "0.62271047", "0.6146323", "0.61348474", "0.6115224", "0.6005322", "0.5999823", "0.59864455", "0.591282...
0.6498032
9
referenced by another leetcode user
public int minCostClimbingStairs(int[] cost) { // We initialize an array of size = cost, and it means the minimun cost of reaching n^th stair int[] dp = new int[cost.length]; // We assign values to the first 2 numbers in the array because it can´t be smaller than 3 dp[0] = cost[0]; dp[1] = cost[1]; // We iterate from n=2 to n-1, and in each position we save the min // value to reach the stair, the MIN is (dp[i-1] + cost[i] , dp[i-2] + cost[i] // that is so that the min way of reaching that stair is either using the n-1 or n-2 for (int i = 2; i < cost.length; i++) { dp[i] = Math.min(dp[i - 1] + cost[i], dp[i - 2] + cost[i]); } // We return the min value of the last 2 stairs because both can reach the end return Math.min(dp[cost.length - 1], dp[cost.length - 2]); /* cost[1,100,1,1,1,100,1,1,100,1] 1.- Imagine this is the array dp[] 2.- We add the first two values dp[1,100] 3.- Iterate form 2 to n This is a representation of the first one dp[2] = Math.min(1+1, 100+1) dp[2] = Math.min(2,101) dp[2] = 2 dp[1,100,2] After the for, this is how it should look dp[1,100,2,3,3,103,4,5,105,6] 4.- Select the min between last 2 because both can reach last step return min (105,6) return 6 It should have a space complexity of O(n) becuase we´re using an array of n size The time complexity should also be O(n) because we have to iterate through all the array once */ }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void solution() {\n\t\t\n\t}", "protected int algo() {\r\n result = algo(root, -2000000000, 2000000000);\r\n\r\n // Nach Terminierung des Algorithmus\r\n lang.nextStep();\r\n setExplain(200, result, 0);\r\n colorNode(root, seenNodeColor);\r\n code.unhighlight(14);\r\n return result;\r...
[ "0.59473", "0.5926908", "0.5809289", "0.5796199", "0.5646837", "0.56259096", "0.5566277", "0.555495", "0.54787725", "0.54787725", "0.5448292", "0.5447347", "0.5420506", "0.54141223", "0.53988844", "0.53291905", "0.5319503", "0.53007716", "0.5285911", "0.5283722", "0.52824104"...
0.0
-1
method used by both comp and player for a turn
static int turn(int score, String user){ int turnScore=0; // initialize turn score to 0 boolean rollAgain=true; // parameter for the following loop, starts as true while (rollAgain) { int rollScore = roll(turnScore, user); //start loop with calling method roll turnScore += rollScore; //increment local turn score System.out.printf(user + " scored %d this roll \n", rollScore);//display roll score if (rollScore+score>=100) break; //check if user won if (rollScore == 0) { //if roll returns 0, ie rolled one 1, reset turn score and break loop, ending turn turnScore=0; break; } System.out.printf(user + " current score is %d \n", turnScore+score); if (turnScore+score>=100) break; //check if user won again if (rollScore == 25) rollAgain=true; //auto roll again for double ones else if (user == "comp") rollAgain=compRollAgain(score, turnScore);//if its the comp rolling, consult the algorithm for rollagain else rollAgain= rollagain(); //otherwise it is the user, so consult the user rollagain method } return turnScore; //do i need to explain this?no }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected abstract void takeTurn(int player);", "protected abstract int getTurn();", "private void humanTurn() \n {\n \n playTurn();\n }", "int getTurn();", "int getCurrentTurn();", "boolean isPlayerTurn();", "public void playTurn() {\r\n\r\n }", "public void beginTurn(){\n ...
[ "0.71649176", "0.71486795", "0.7015066", "0.6875868", "0.6814826", "0.67916447", "0.67828804", "0.6779285", "0.67637604", "0.6738928", "0.67350817", "0.6718954", "0.66976905", "0.66376317", "0.6575155", "0.65666765", "0.6553227", "0.65468895", "0.65206623", "0.6519854", "0.65...
0.0
-1
computer algorithm, uncommented because it is a secret
static boolean compRollAgain(int score, int turnScore) { if (turnScore+score>90) return true; //lol if (turnScore>20) {System.out.println("comp decided to end turn");return false;}else return true;}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "String algorithm();", "static int getComputerCard(Card playerCard) {\n //The computer will iterate through different possible cards it might choose to play.\n //This represents a chosen card at any given time.\n Card possibleCard = null;\n //The position in the computer's hand whe...
[ "0.6219617", "0.6116912", "0.6104521", "0.59120494", "0.5803767", "0.5748957", "0.5728884", "0.5726857", "0.5678149", "0.5663395", "0.56394553", "0.5620669", "0.5609737", "0.5582226", "0.55373365", "0.5528369", "0.5515192", "0.5505787", "0.55046314", "0.55021024", "0.54720044...
0.0
-1
i didnt really like the strategy alan gave us for random numbers and this orks just fine
static int roll() { Random rand = new Random(); //get large random number int num2 = rand.nextInt(); //convert from long to int return Math.abs(num2%6)+1; //num between 1 and 6 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private int randomNum() {\r\n\t return((int)(Math.random() * 100));\r\n\t }", "private void random() {\n\n\t}", "private void setRand(){\n rand = generator.nextInt(9) + 1;\n }", "public static void main(String[] args) {\n\r\n\t\tRandom rr=new Random();\r\n\t\t\r\n\t\tSystem.out.println(Math.rando...
[ "0.75911367", "0.75397116", "0.72897875", "0.7272908", "0.7271741", "0.7248562", "0.72414434", "0.72162706", "0.7198048", "0.7195712", "0.71949416", "0.7176044", "0.7151451", "0.712085", "0.71188825", "0.7095033", "0.70900005", "0.70838636", "0.70590556", "0.6986315", "0.6984...
0.0
-1
stores as many points on circle as the param lineAmount is in ArrayList onCirclePoints
public void generatePointsOnCircle(int lineAmount, Circle circle) { for (int i = 0; i < lineAmount; ++i) { // cosinus = ankathete / hypo | sinus = gegenkathete / hypo final double angle = Math.toRadians(((double) i / lineAmount) * 360d); // generating new point and declaring calulated coordinates to it onCirclePoints.add(new Point2D.Double(Math.cos(angle) * circle.getRadius() + circle.getMidpoint().getX(), Math.sin(angle) * circle.getRadius() + circle.getMidpoint().getY())); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void drawCircle() {\n mMap.clear();\n // Generate the points\n mMap.addPolygon(new PolygonOptions().addAll(points).strokeWidth(5).strokeColor(Color.RED).fillColor(Color.TRANSPARENT));\n // Create and return the polygon\n for (int i=0;i<points.size();i++){\n Log....
[ "0.62785274", "0.61697185", "0.61681104", "0.5900169", "0.5842977", "0.582654", "0.5814216", "0.5788633", "0.57568586", "0.57240784", "0.56899375", "0.56833047", "0.56664884", "0.5658884", "0.5623702", "0.5623075", "0.56166995", "0.5594599", "0.55865496", "0.55779004", "0.555...
0.79401517
0
/ Initialize the event handler
@Override public void onEnable() { setGMEventHandler(new GroupManagerEventHandler(this)); onEnable(false); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tprotected void initEvents() {\n\t\t\r\n\t}", "private void initializeEvents() {\r\n\t}", "private void eventhandler() {\n\r\n\t}", "public void init() {\r\n setEventType(4);\r\n }", "@Override\r\n\tpublic void initEvent() {\n\r\n\t}", "public void initEventsAndProperties() {\r\n ...
[ "0.79296315", "0.78209746", "0.74354905", "0.7368418", "0.7336461", "0.72025937", "0.7154433", "0.71273965", "0.71203536", "0.7082328", "0.70365953", "0.6956832", "0.6935094", "0.6920438", "0.69000995", "0.6782885", "0.676704", "0.6761415", "0.6757891", "0.6757891", "0.675327...
0.0
-1
Called when a command registered by this plugin is received.
@Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { boolean playerCanDo = false; boolean isConsole = false; Player senderPlayer = null, targetPlayer = null; Group senderGroup = null; User senderUser = null; boolean isOpOverride = config.isOpOverride(); boolean isAllowCommandBlocks = config.isAllowCommandBlocks(); // PREVENT GM COMMANDS BEING USED ON COMMANDBLOCKS if (sender instanceof BlockCommandSender && !isAllowCommandBlocks) { Block block = ((BlockCommandSender)sender).getBlock(); GroupManager.logger.warning(ChatColor.RED + "GM Commands can not be called from CommandBlocks"); GroupManager.logger.warning(ChatColor.RED + "Location: " + ChatColor.GREEN + block.getWorld().getName() + ", " + block.getX() + ", " + block.getY() + ", " + block.getZ()); return true; } // DETERMINING PLAYER INFORMATION if (sender instanceof Player) { senderPlayer = (Player) sender; if (!lastError.isEmpty() && !commandLabel.equalsIgnoreCase("manload")) { sender.sendMessage(ChatColor.RED + "All commands are locked due to an error. " + ChatColor.BOLD + "" + ChatColor.UNDERLINE + "Check plugins/groupmanager/error.log or console" + ChatColor.RESET + "" + ChatColor.RED + " and then try a '/manload'."); return true; } senderUser = worldsHolder.getWorldData(senderPlayer).getUser(senderPlayer.getUniqueId().toString()); senderGroup = senderUser.getGroup(); isOpOverride = (isOpOverride && (senderPlayer.isOp() || worldsHolder.getWorldPermissions(senderPlayer).has(senderPlayer, "groupmanager.op"))); if (isOpOverride || worldsHolder.getWorldPermissions(senderPlayer).has(senderPlayer, "groupmanager." + cmd.getName())) { playerCanDo = true; } } else { if (!lastError.isEmpty() && !commandLabel.equalsIgnoreCase("manload")) { sender.sendMessage(ChatColor.RED + "All commands are locked due to an error. " + ChatColor.BOLD + "" + ChatColor.UNDERLINE + "Check plugins/groupmanager/error.log or console" + ChatColor.RESET + "" + ChatColor.RED + " and then try a '/manload'."); return true; } isConsole = true; } // PERMISSIONS FOR COMMAND BEING LOADED dataHolder = null; permissionHandler = null; if (senderPlayer != null) { dataHolder = worldsHolder.getWorldData(senderPlayer); } String selectedWorld = selectedWorlds.get(sender.getName()); if (selectedWorld != null) { dataHolder = worldsHolder.getWorldData(selectedWorld); } if (dataHolder != null) { permissionHandler = dataHolder.getPermissionsHandler(); } // VARIABLES USED IN COMMANDS int count; PermissionCheckResult permissionResult = null; ArrayList<User> removeList = null; String auxString = null; List<String> match = null; User auxUser = null; Group auxGroup = null; Group auxGroup2 = null; GroupManagerPermissions execCmd = null; try { execCmd = GroupManagerPermissions.valueOf(cmd.getName()); } catch (Exception e) { // this error happened once with someone. now im prepared... i think GroupManager.logger.severe("==================================================="); GroupManager.logger.severe("= ERROR REPORT START ="); GroupManager.logger.severe("==================================================="); GroupManager.logger.severe("= COPY AND PASTE THIS TO A GROUPMANAGER DEVELOPER ="); GroupManager.logger.severe("==================================================="); GroupManager.logger.severe(this.getDescription().getName()); GroupManager.logger.severe(this.getDescription().getVersion()); GroupManager.logger.severe("An error occured while trying to execute command:"); GroupManager.logger.severe(cmd.getName()); GroupManager.logger.severe("With " + args.length + " arguments:"); for (String ar : args) { GroupManager.logger.severe(ar); } GroupManager.logger.severe("The field '" + cmd.getName() + "' was not found in enum."); GroupManager.logger.severe("And could not be parsed."); GroupManager.logger.severe("FIELDS FOUND IN ENUM:"); for (GroupManagerPermissions val : GroupManagerPermissions.values()) { GroupManager.logger.severe(val.name()); } GroupManager.logger.severe("==================================================="); GroupManager.logger.severe("= ERROR REPORT ENDED ="); GroupManager.logger.severe("==================================================="); sender.sendMessage("An error occurred. Ask the admin to take a look at the console."); } if (isConsole || playerCanDo) { switch (execCmd) { case manuadd: // Validating arguments if ((args.length != 2) && (args.length != 3)) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manuadd <player> <group> | optional [world])"); return true; } // Select the relevant world (if specified) if (args.length == 3) { dataHolder = worldsHolder.getWorldData(args[2]); permissionHandler = dataHolder.getPermissionsHandler(); } // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } auxGroup = dataHolder.getGroup(args[1]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[1] + "' Group doesnt exist!"); return false; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly."); return false; } // Validating permissions if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "Can't modify a player with the same permissions as you, or higher."); return true; } if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) { sender.sendMessage(ChatColor.RED + "The destination group can't be the same as yours, or higher."); return true; } if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getUUID(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getUUID(), auxGroup.getName()))) { sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit."); return true; } // Seems OK auxUser.setGroup(auxGroup); if (!sender.hasPermission("groupmanager.notify.other") || (isConsole)) sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getLastName() + "' group to '" + auxGroup.getName() + "' in world '" + dataHolder.getName() + "'."); return true; case manudel: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manudel <player>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Validating permission if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher."); return true; } // Seems OK dataHolder.removeUser(auxUser.getUUID()); sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getLastName() + "' to default settings."); // If the player is online, this will create new data for the user. if(auxUser.getUUID() != null) { targetPlayer = this.getServer().getPlayer(UUID.fromString(auxUser.getUUID())); if (targetPlayer != null) BukkitPermissions.updatePermissions(targetPlayer); } return true; case manuaddsub: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) { sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed."); sender.sendMessage(ChatColor.RED + "Use /manselect <world>"); return true; } } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manuaddsub <player> <group>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } auxGroup = dataHolder.getGroup(args[1]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[1] + "' Group doesnt exist!"); return true; } // Validating permission if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher."); return true; } if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) { sender.sendMessage(ChatColor.RED + "The sub-group can't be the same as yours, or higher."); return true; } if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getUUID(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getUUID(), auxGroup.getName()))) { sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit."); return true; } // Seems OK if (auxUser.addSubGroup(auxGroup)) sender.sendMessage(ChatColor.YELLOW + "You added subgroup '" + auxGroup.getName() + "' to player '" + auxUser.getLastName() + "'."); else sender.sendMessage(ChatColor.RED + "The subgroup '" + auxGroup.getName() + "' is already available to '" + auxUser.getLastName() + "'."); return true; case manudelsub: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manudelsub <user> <group>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } auxGroup = dataHolder.getGroup(args[1]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[1] + "' Group doesnt exist!"); return true; } // Validating permission if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher."); return true; } // Seems OK auxUser.removeSubGroup(auxGroup); sender.sendMessage(ChatColor.YELLOW + "You removed subgroup '" + auxGroup.getName() + "' from player '" + auxUser.getLastName() + "' list."); // targetPlayer = this.getServer().getPlayer(auxUser.getName()); // if (targetPlayer != null) // BukkitPermissions.updatePermissions(targetPlayer); return true; case mangadd: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangadd <group>)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup != null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group already exists!"); return true; } // Seems OK auxGroup = dataHolder.createGroup(args[0]); sender.sendMessage(ChatColor.YELLOW + "You created a group named: " + auxGroup.getName()); return true; case mangdel: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangdel <group>)"); return false; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } // Seems OK dataHolder.removeGroup(auxGroup.getName()); sender.sendMessage(ChatColor.YELLOW + "You deleted a group named " + auxGroup.getName() + ", it's users are default group now."); BukkitPermissions.updateAllPlayers(); return true; case manuaddp: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length < 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manuaddp <player> <permission> [permission2] [permission3]...)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Validating your permissions if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "Can't modify player with same group than you, or higher."); return true; } for (int i = 1; i < args.length; i++) { auxString = args[i].replace("'", ""); permissionResult = permissionHandler.checkFullUserPermission(senderUser, auxString); if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) { sender.sendMessage(ChatColor.RED + "You can't add a permission you don't have: '" + auxString + "'"); continue; } // Validating permissions of user permissionResult = permissionHandler.checkUserOnlyPermission(auxUser, auxString); if (checkPermissionExists(sender, auxString, permissionResult, "user")) { continue; } // Seems Ok auxUser.addPermission(auxString); sender.sendMessage(ChatColor.YELLOW + "You added '" + auxString + "' to player '" + auxUser.getLastName() + "' permissions."); } targetPlayer = this.getServer().getPlayer(auxUser.getLastName()); if (targetPlayer != null) BukkitPermissions.updatePermissions(targetPlayer); return true; case manudelp: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length < 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manudelp <player> <permission> [permission2] [permission3]...)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } for (int i = 1; i < args.length; i++) { auxString = args[i].replace("'", ""); if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "You can't modify a player with same group as you, or higher."); continue; } // Validating your permissions permissionResult = permissionHandler.checkFullUserPermission(senderUser, auxString); if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) { sender.sendMessage(ChatColor.RED + "You can't remove a permission you don't have: '" + auxString + "'"); continue; } // Validating permissions of user permissionResult = permissionHandler.checkUserOnlyPermission(auxUser, auxString); if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { sender.sendMessage(ChatColor.RED + "The user doesn't have direct access to that permission: '" + auxString + "'"); continue; } if (!auxUser.hasSamePermissionNode(auxString)) { sender.sendMessage(ChatColor.RED + "This permission node doesn't match any node."); sender.sendMessage(ChatColor.RED + "But might match node: " + permissionResult.accessLevel); continue; } auxUser.removePermission(auxString); sender.sendMessage(ChatColor.YELLOW + "You removed '" + auxString + "' from player '" + auxUser.getLastName() + "' permissions."); } // Seems OK targetPlayer = this.getServer().getPlayer(auxUser.getLastName()); if (targetPlayer != null) BukkitPermissions.updatePermissions(targetPlayer); return true; case manuclearp: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manuclearp <player>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Validating your permissions if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "You can't modify a player with same group as you, or higher."); return true; } for (String perm : auxUser.getPermissionList()) { permissionResult = permissionHandler.checkFullUserPermission(senderUser, perm); if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) { sender.sendMessage(ChatColor.RED + "You can't remove a permission you don't have: '" + perm + "'."); } else { auxUser.removePermission(perm); } } sender.sendMessage(ChatColor.YELLOW + "You removed all permissions from player '" + auxUser.getLastName() + "'."); targetPlayer = this.getServer().getPlayer(auxUser.getLastName()); if (targetPlayer != null) BukkitPermissions.updatePermissions(targetPlayer); return true; case manulistp: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if ((args.length == 0) || (args.length > 2)) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manulistp <player> (+))"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Validating permission // Seems OK auxString = ""; for (String perm : auxUser.getPermissionList()) { auxString += perm + ", "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); sender.sendMessage(ChatColor.YELLOW + "The player '" + auxUser.getLastName() + "' has following permissions: " + ChatColor.WHITE + auxString); sender.sendMessage(ChatColor.YELLOW + "And all permissions from group: " + auxUser.getGroupName()); auxString = ""; for (String subGroup : auxUser.subGroupListStringCopy()) { auxString += subGroup + ", "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); sender.sendMessage(ChatColor.YELLOW + "And all permissions from subgroups: " + auxString); } } else { sender.sendMessage(ChatColor.YELLOW + "The player '" + auxUser.getLastName() + "' has no specific permissions."); sender.sendMessage(ChatColor.YELLOW + "Only all permissions from group: " + auxUser.getGroupName()); auxString = ""; for (String subGroup : auxUser.subGroupListStringCopy()) { auxString += subGroup + ", "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); sender.sendMessage(ChatColor.YELLOW + "And all permissions from subgroups: " + auxString); } } // bukkit perms if ((args.length == 2) && (args[1].equalsIgnoreCase("+"))) { targetPlayer = this.getServer().getPlayer(auxUser.getLastName()); if (targetPlayer != null) { sender.sendMessage(ChatColor.YELLOW + "Superperms reports: "); for (String line : BukkitPermissions.listPerms(targetPlayer)) sender.sendMessage(ChatColor.YELLOW + line); } } return true; case manucheckp: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manucheckp <player> <permission>)"); return true; } auxString = args[1].replace("'", ""); if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } targetPlayer = this.getServer().getPlayer(auxUser.getLastName()); // Validating permission permissionResult = permissionHandler.checkFullGMPermission(auxUser, auxString, false); if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { // No permissions found in GM so fall through and check Bukkit. sender.sendMessage(ChatColor.YELLOW + "The player doesn't have access to that permission"); } else { // This permission was found in groupmanager. if (permissionResult.owner instanceof User) { if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) { sender.sendMessage(ChatColor.YELLOW + "The user has directly a negation node for that permission."); } else if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { sender.sendMessage(ChatColor.YELLOW + "The user has directly an Exception node for that permission."); } else { sender.sendMessage(ChatColor.YELLOW + "The user has directly this permission."); } sender.sendMessage(ChatColor.YELLOW + "Permission Node: " + permissionResult.accessLevel); } else if (permissionResult.owner instanceof Group) { if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) { sender.sendMessage(ChatColor.YELLOW + "The user inherits a negation permission from group: " + permissionResult.owner.getLastName()); } else if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { sender.sendMessage(ChatColor.YELLOW + "The user inherits an Exception permission from group: " + permissionResult.owner.getLastName()); } else { sender.sendMessage(ChatColor.YELLOW + "The user inherits the permission from group: " + permissionResult.owner.getLastName()); } sender.sendMessage(ChatColor.YELLOW + "Permission Node: " + permissionResult.accessLevel); } } // superperms if (targetPlayer != null) { sender.sendMessage(ChatColor.YELLOW + "SuperPerms reports Node: " + targetPlayer.hasPermission(args[1]) + ((!targetPlayer.hasPermission(args[1]) && targetPlayer.isPermissionSet(args[1])) ? " (Negated)": "")); } return true; case mangaddp: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length < 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangaddp <group> <permission> [permission2] [permission3]...)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return false; } for (int i = 1; i < args.length; i++) { auxString = args[i].replace("'", ""); // Validating your permissions permissionResult = permissionHandler.checkFullUserPermission(senderUser, auxString); if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) { sender.sendMessage(ChatColor.RED + "You can't add a permission you don't have: '" + auxString + "'"); continue; } // Validating permissions of user permissionResult = permissionHandler.checkGroupOnlyPermission(auxGroup, auxString); if (checkPermissionExists(sender, auxString, permissionResult, "group")) { continue; } // Seems OK auxGroup.addPermission(auxString); sender.sendMessage(ChatColor.YELLOW + "You added '" + auxString + "' to group '" + auxGroup.getName() + "' permissions."); } BukkitPermissions.updateAllPlayers(); return true; case mangdelp: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length < 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangdelp <group> <permission> [permission2] [permission3]...)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } for (int i = 1; i < args.length; i++) { auxString = args[i].replace("'", ""); // Validating your permissions permissionResult = permissionHandler.checkFullUserPermission(senderUser, auxString); if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) { sender.sendMessage(ChatColor.RED + "Can't remove a permission you don't have: '" + auxString + "'"); continue; } // Validating permissions of user permissionResult = permissionHandler.checkGroupOnlyPermission(auxGroup, auxString); if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { sender.sendMessage(ChatColor.YELLOW + "The group doesn't have direct access to that permission: '" + auxString + "'"); continue; } if (!auxGroup.hasSamePermissionNode(auxString)) { sender.sendMessage(ChatColor.RED + "This permission node doesn't match any node."); sender.sendMessage(ChatColor.RED + "But might match node: " + permissionResult.accessLevel); continue; } // Seems OK auxGroup.removePermission(auxString); sender.sendMessage(ChatColor.YELLOW + "You removed '" + auxString + "' from group '" + auxGroup.getName() + "' permissions."); } BukkitPermissions.updateAllPlayers(); return true; case mangclearp: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangclearp <group>)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } for (String perm : auxGroup.getPermissionList()) { permissionResult = permissionHandler.checkFullUserPermission(senderUser, perm); if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) { sender.sendMessage(ChatColor.RED + "Can't remove a permission you don't have: '" + perm + "'."); } else { auxGroup.removePermission(perm); } } sender.sendMessage(ChatColor.YELLOW + "You removed all permissions from group '" + auxGroup.getName() + "'."); BukkitPermissions.updateAllPlayers(); return true; case manglistp: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manglistp <group>)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } // Validating permission // Seems OK auxString = ""; for (String perm : auxGroup.getPermissionList()) { auxString += perm + ", "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); sender.sendMessage(ChatColor.YELLOW + "The group '" + auxGroup.getName() + "' has following permissions: " + ChatColor.WHITE + auxString); auxString = ""; for (String grp : auxGroup.getInherits()) { auxString += grp + ", "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); sender.sendMessage(ChatColor.YELLOW + "And all permissions from groups: " + auxString); } } else { sender.sendMessage(ChatColor.YELLOW + "The group '" + auxGroup.getName() + "' has no specific permissions."); auxString = ""; for (String grp : auxGroup.getInherits()) { auxString += grp + ", "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); sender.sendMessage(ChatColor.YELLOW + "Only all permissions from groups: " + auxString); } } return true; case mangcheckp: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangcheckp <group> <permission>)"); return true; } auxString = args[1]; if (auxString.startsWith("'") && auxString.endsWith("'")) { auxString = auxString.substring(1, auxString.length() - 1); } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } // Validating permission permissionResult = permissionHandler.checkGroupPermissionWithInheritance(auxGroup, auxString); if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { sender.sendMessage(ChatColor.YELLOW + "The group doesn't have access to that permission"); return true; } // Seems OK // auxString = permissionHandler.checkUserOnlyPermission(auxUser, args[1]); if (permissionResult.owner instanceof Group) { if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) { sender.sendMessage(ChatColor.YELLOW + "The group inherits the negation permission from group: " + permissionResult.owner.getLastName()); } else if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { sender.sendMessage(ChatColor.YELLOW + "The group inherits an Exception permission from group: " + permissionResult.owner.getLastName()); } else { sender.sendMessage(ChatColor.YELLOW + "The group inherits the permission from group: " + permissionResult.owner.getLastName()); } sender.sendMessage(ChatColor.YELLOW + "Permission Node: " + permissionResult.accessLevel); } return true; case mangaddi: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangaddi <group1> <group2>)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } auxGroup2 = dataHolder.getGroup(args[1]); if (auxGroup2 == null) { sender.sendMessage(ChatColor.RED + "'" + args[1] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support inheritance."); return true; } // Validating permission if (permissionHandler.hasGroupInInheritance(auxGroup, auxGroup2.getName())) { sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " already inherits " + auxGroup2.getName() + " (might not be directly)"); return true; } // Seems OK auxGroup.addInherits(auxGroup2); sender.sendMessage(ChatColor.YELLOW + "Group " + auxGroup2.getName() + " is now in " + auxGroup.getName() + " inheritance list."); BukkitPermissions.updateAllPlayers(); return true; case mangdeli: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangdeli <group1> <group2>)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } auxGroup2 = dataHolder.getGroup(args[1]); if (auxGroup2 == null) { sender.sendMessage(ChatColor.RED + "'" + args[1] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support inheritance."); return true; } // Validating permission if (!permissionHandler.hasGroupInInheritance(auxGroup, auxGroup2.getName())) { sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " does not inherit " + auxGroup2.getName() + "."); return true; } if (!auxGroup.getInherits().contains(auxGroup2.getName())) { sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " does not inherit " + auxGroup2.getName() + " directly."); return true; } // Seems OK auxGroup.removeInherits(auxGroup2.getName()); sender.sendMessage(ChatColor.YELLOW + "Group " + auxGroup2.getName() + " was removed from " + auxGroup.getName() + " inheritance list."); BukkitPermissions.updateAllPlayers(); return true; case manuaddv: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length < 3) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manuaddv <user> <variable> <value>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Validating permission // Seems OK auxString = ""; for (int i = 2; i < args.length; i++) { auxString += args[i]; if ((i + 1) < args.length) { auxString += " "; } } auxString = auxString.replace("'", ""); auxUser.getVariables().addVar(args[1], Variables.parseVariableValue(auxString)); sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + ":'" + ChatColor.GREEN + auxString + ChatColor.YELLOW + "' added to the user " + auxUser.getLastName()); return true; case manudelv: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manudelv <user> <variable>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Validating permission if (!auxUser.getVariables().hasVar(args[1])) { sender.sendMessage(ChatColor.RED + "The user doesn't have directly that variable!"); return true; } // Seems OK auxUser.getVariables().removeVar(args[1]); sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + " removed from the user " + ChatColor.GREEN + auxUser.getLastName()); return true; case manulistv: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manulistv <user>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Validating permission // Seems OK auxString = ""; for (String varKey : auxUser.getVariables().getVarKeyList()) { Object o = auxUser.getVariables().getVarObject(varKey); auxString += ChatColor.GOLD + varKey + ChatColor.WHITE + ":'" + ChatColor.GREEN + o.toString() + ChatColor.WHITE + "', "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); } sender.sendMessage(ChatColor.YELLOW + "Variables of user " + auxUser.getLastName() + ": "); sender.sendMessage(auxString + "."); sender.sendMessage(ChatColor.YELLOW + "Plus all variables from group: " + auxUser.getGroupName()); return true; case manucheckv: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manucheckv <user> <variable>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Validating permission auxGroup = auxUser.getGroup(); auxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1]); if (!auxUser.getVariables().hasVar(args[1])) { // Check sub groups if (!auxUser.isSubGroupsEmpty() && auxGroup2 == null) for (Group subGroup : auxUser.subGroupListCopy()) { auxGroup2 = permissionHandler.nextGroupWithVariable(subGroup, args[1]); if (auxGroup2 != null) continue; } if (auxGroup2 == null) { sender.sendMessage(ChatColor.YELLOW + "The user doesn't have access to that variable!"); return true; } } // Seems OK if (auxUser.getVariables().hasVar(auxString)) { sender.sendMessage(ChatColor.YELLOW + "The value of variable '" + ChatColor.GOLD + args[1] + ChatColor.YELLOW + "' is: '" + ChatColor.GREEN + auxUser.getVariables().getVarObject(args[1]).toString() + ChatColor.WHITE + "'"); sender.sendMessage(ChatColor.YELLOW + "This user own directly the variable"); } sender.sendMessage(ChatColor.YELLOW + "The value of variable '" + ChatColor.GOLD + args[1] + ChatColor.YELLOW + "' is: '" + ChatColor.GREEN + auxGroup2.getVariables().getVarObject(args[1]).toString() + ChatColor.WHITE + "'"); if (!auxGroup.equals(auxGroup2)) { sender.sendMessage(ChatColor.YELLOW + "And the value was inherited from group: " + ChatColor.GREEN + auxGroup2.getName()); } return true; case mangaddv: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length < 3) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangaddv <group> <variable> <value>)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes."); return true; } // Validating permission // Seems OK auxString = ""; for (int i = 2; i < args.length; i++) { auxString += args[i]; if ((i + 1) < args.length) { auxString += " "; } } auxString = auxString.replace("'", ""); auxGroup.getVariables().addVar(args[1], Variables.parseVariableValue(auxString)); sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + ":'" + ChatColor.GREEN + auxString + ChatColor.YELLOW + "' added to the group " + auxGroup.getName()); return true; case mangdelv: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangdelv <group> <variable>)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes."); return true; } // Validating permission if (!auxGroup.getVariables().hasVar(args[1])) { sender.sendMessage(ChatColor.RED + "The group doesn't have directly that variable!"); return true; } // Seems OK auxGroup.getVariables().removeVar(args[1]); sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + " removed from the group " + ChatColor.GREEN + auxGroup.getName()); return true; case manglistv: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manglistv <group>)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes."); return true; } // Validating permission // Seems OK auxString = ""; for (String varKey : auxGroup.getVariables().getVarKeyList()) { Object o = auxGroup.getVariables().getVarObject(varKey); auxString += ChatColor.GOLD + varKey + ChatColor.WHITE + ":'" + ChatColor.GREEN + o.toString() + ChatColor.WHITE + "', "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); } sender.sendMessage(ChatColor.YELLOW + "Variables of group " + auxGroup.getName() + ": "); sender.sendMessage(auxString + "."); auxString = ""; for (String grp : auxGroup.getInherits()) { auxString += grp + ", "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); sender.sendMessage(ChatColor.YELLOW + "Plus all variables from groups: " + auxString); } return true; case mangcheckv: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangcheckv <group> <variable>)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes."); return true; } // Validating permission auxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1]); if (auxGroup2 == null) { sender.sendMessage(ChatColor.RED + "The group doesn't have access to that variable!"); } // Seems OK sender.sendMessage(ChatColor.YELLOW + "The value of variable '" + ChatColor.GOLD + args[1] + ChatColor.YELLOW + "' is: '" + ChatColor.GREEN + auxGroup2.getVariables().getVarObject(args[1]).toString() + ChatColor.WHITE + "'"); if (!auxGroup.equals(auxGroup2)) { sender.sendMessage(ChatColor.YELLOW + "And the value was inherited from group: " + ChatColor.GREEN + auxGroup2.getName()); } return true; case manwhois: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manwhois <player>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Seems OK sender.sendMessage(ChatColor.YELLOW + "Name: " + ChatColor.GREEN + auxUser.getLastName()); sender.sendMessage(ChatColor.YELLOW + "Group: " + ChatColor.GREEN + auxUser.getGroup().getName()); // Compile a list of subgroups auxString = ""; for (String subGroup : auxUser.subGroupListStringCopy()) { auxString += subGroup + ", "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); sender.sendMessage(ChatColor.YELLOW + "subgroups: " + auxString); } sender.sendMessage(ChatColor.YELLOW + "Overloaded: " + ChatColor.GREEN + dataHolder.isOverloaded(auxUser.getUUID())); auxGroup = dataHolder.surpassOverload(auxUser.getUUID()).getGroup(); if (!auxGroup.equals(auxUser.getGroup())) { sender.sendMessage(ChatColor.YELLOW + "Original Group: " + ChatColor.GREEN + auxGroup.getName()); } // victim.permissions.add(args[1]); return true; case tempadd: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/tempadd <player>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Validating permission if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher."); return true; } // Seems OK if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) { overloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>()); } dataHolder.overloadUser(auxUser.getUUID()); overloadedUsers.get(dataHolder.getName().toLowerCase()).add(dataHolder.getUser(auxUser.getUUID())); sender.sendMessage(ChatColor.YELLOW + "Player set to overload mode!"); return true; case tempdel: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/tempdel <player>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Validating permission if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher."); return true; } // Seems OK if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) { overloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>()); } dataHolder.removeOverload(auxUser.getUUID()); if (overloadedUsers.get(dataHolder.getName().toLowerCase()).contains(auxUser)) { overloadedUsers.get(dataHolder.getName().toLowerCase()).remove(auxUser); } sender.sendMessage(ChatColor.YELLOW + "Player overload mode is now disabled."); return true; case templist: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // WORKING auxString = ""; removeList = new ArrayList<User>(); count = 0; for (User u : overloadedUsers.get(dataHolder.getName().toLowerCase())) { if (!dataHolder.isOverloaded(u.getUUID())) { removeList.add(u); } else { auxString += u.getLastName() + ", "; count++; } } if (count == 0) { sender.sendMessage(ChatColor.YELLOW + "There are no users in overload mode."); return true; } auxString = auxString.substring(0, auxString.lastIndexOf(",")); if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) { overloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>()); } overloadedUsers.get(dataHolder.getName().toLowerCase()).removeAll(removeList); sender.sendMessage(ChatColor.YELLOW + " " + count + " Users in overload mode: " + ChatColor.WHITE + auxString); return true; case tempdelall: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // WORKING removeList = new ArrayList<User>(); count = 0; for (User u : overloadedUsers.get(dataHolder.getName().toLowerCase())) { if (dataHolder.isOverloaded(u.getUUID())) { dataHolder.removeOverload(u.getUUID()); count++; } } if (count == 0) { sender.sendMessage(ChatColor.YELLOW + "There are no users in overload mode."); return true; } if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) { overloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>()); } overloadedUsers.get(dataHolder.getName().toLowerCase()).clear(); sender.sendMessage(ChatColor.YELLOW + " " + count + "All users in overload mode are now normal again."); return true; case mansave: boolean forced = false; if ((args.length == 1) && (args[0].equalsIgnoreCase("force"))) forced = true; try { worldsHolder.saveChanges(forced); sender.sendMessage(ChatColor.YELLOW + "All changes were saved."); } catch (IllegalStateException ex) { sender.sendMessage(ChatColor.RED + ex.getMessage()); } return true; case manload: /** * Attempt to reload a specific world */ if (args.length > 0) { if (!lastError.isEmpty()) { sender.sendMessage(ChatColor.RED + "All commands are locked due to an error. " + ChatColor.BOLD + "" + ChatColor.UNDERLINE + "Check plugins/groupmanager/error.log or console" + ChatColor.RESET + "" + ChatColor.RED + " and then try a '/manload'."); return true; } auxString = ""; for (int i = 0; i < args.length; i++) { auxString += args[i]; if ((i + 1) < args.length) { auxString += " "; } } isLoaded = false; // Disable Bukkit Perms update and event triggers globalGroups.load(); worldsHolder.loadWorld(auxString); sender.sendMessage("The request to reload world '" + auxString + "' was attempted."); isLoaded = true; BukkitPermissions.reset(); } else { /** * Reload all settings and data as no world was specified. */ /* * Attempting a fresh load. */ onDisable(true); onEnable(true); sender.sendMessage("All settings and worlds were reloaded!"); } /** * Fire an event as none will have been triggered in the reload. */ if (GroupManager.isLoaded()) GroupManager.getGMEventHandler().callEvent(GMSystemEvent.Action.RELOADED); return true; case listgroups: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // WORKING auxString = ""; String auxString2 = ""; for (Group g : dataHolder.getGroupList()) { auxString += g.getName() + ", "; } for (Group g : getGlobalGroups().getGroupList()) { auxString2 += g.getName() + ", "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); } if (auxString2.lastIndexOf(",") > 0) { auxString2 = auxString2.substring(0, auxString2.lastIndexOf(",")); } sender.sendMessage(ChatColor.YELLOW + "Groups Available: " + ChatColor.WHITE + auxString); sender.sendMessage(ChatColor.YELLOW + "GlobalGroups Available: " + ChatColor.WHITE + auxString2); return true; case manpromote: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manpromote <player> <group>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } auxGroup = dataHolder.getGroup(args[1]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[1] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly."); return true; } // Validating permission if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher."); return true; } if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) { sender.sendMessage(ChatColor.RED + "The destination group can't be the same as yours, or higher."); return true; } if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getUUID(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getUUID(), auxGroup.getName()))) { sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit."); return true; } if (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName())) { sender.sendMessage(ChatColor.RED + "You can't modify a player using groups with different heritage line."); return true; } if (!permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName())) { sender.sendMessage(ChatColor.RED + "The new group must be a higher rank."); return true; } // Seems OK auxUser.setGroup(auxGroup); if (!sender.hasPermission("groupmanager.notify.other") || (isConsole)) sender.sendMessage(ChatColor.YELLOW + "You changed " + auxUser.getLastName() + " group to " + auxGroup.getName() + "."); return true; case mandemote: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mandemote <player> <group>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } auxGroup = dataHolder.getGroup(args[1]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[1] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly."); return true; } // Validating permission if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher."); return true; } if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) { sender.sendMessage(ChatColor.RED + "The destination group can't be the same as yours, or higher."); return true; } if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getUUID(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getUUID(), auxGroup.getName()))) { sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit."); return true; } if (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName())) { sender.sendMessage(ChatColor.RED + "You can't modify a player using groups with different inheritage line."); return true; } if (permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName())) { sender.sendMessage(ChatColor.RED + "The new group must be a lower rank."); return true; } // Seems OK auxUser.setGroup(auxGroup); if (!sender.hasPermission("groupmanager.notify.other") || (isConsole)) sender.sendMessage(ChatColor.YELLOW + "You changed " + auxUser.getLastName() + " group to " + auxGroup.getName() + "."); return true; case mantogglevalidate: validateOnlinePlayer = !validateOnlinePlayer; sender.sendMessage(ChatColor.YELLOW + "Validate if player is online, now set to: " + Boolean.toString(validateOnlinePlayer)); if (!validateOnlinePlayer) { sender.sendMessage(ChatColor.GOLD + "From now on you can edit players that are not connected... BUT:"); sender.sendMessage(ChatColor.LIGHT_PURPLE + "From now on you should type the whole name of the player, correctly."); } return true; case mantogglesave: if (scheduler == null) { enableScheduler(); sender.sendMessage(ChatColor.YELLOW + "The auto-saving is enabled!"); } else { disableScheduler(); sender.sendMessage(ChatColor.YELLOW + "The auto-saving is disabled!"); } return true; case manworld: auxString = selectedWorlds.get(sender.getName()); if (auxString != null) { sender.sendMessage(ChatColor.YELLOW + "You have the world '" + dataHolder.getName() + "' in your selection."); } else { if (dataHolder == null) { sender.sendMessage(ChatColor.YELLOW + "There is no world selected. And no world is available now."); } else { sender.sendMessage(ChatColor.YELLOW + "You don't have a world in your selection.."); sender.sendMessage(ChatColor.YELLOW + "Working with the direct world where your player is."); sender.sendMessage(ChatColor.YELLOW + "Your world now uses permissions of world name: '" + dataHolder.getName() + "' "); } } return true; case manselect: if (args.length < 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manselect <world>)"); sender.sendMessage(ChatColor.YELLOW + "Worlds available: "); ArrayList<OverloadedWorldHolder> worlds = worldsHolder.allWorldsDataList(); auxString = ""; for (int i = 0; i < worlds.size(); i++) { auxString += worlds.get(i).getName(); if ((i + 1) < worlds.size()) { auxString += ", "; } } sender.sendMessage(ChatColor.YELLOW + auxString); return false; } auxString = ""; for (int i = 0; i < args.length; i++) { if (args[i] == null) { logger.warning("Bukkit gave invalid arguments array! Cmd: " + cmd.getName() + " args.length: " + args.length); return false; } auxString += args[i]; if (i < (args.length - 1)) { auxString += " "; } } dataHolder = worldsHolder.getWorldData(auxString); permissionHandler = dataHolder.getPermissionsHandler(); selectedWorlds.put(sender.getName(), dataHolder.getName()); sender.sendMessage(ChatColor.YELLOW + "You have selected world '" + dataHolder.getName() + "'."); return true; case manclear: if (args.length != 0) { sender.sendMessage(ChatColor.RED + "Review your arguments count!"); return false; } selectedWorlds.remove(sender.getName()); sender.sendMessage(ChatColor.YELLOW + "You have removed your world selection. Working with current world(if possible)."); return true; case mancheckw: if (args.length < 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mancheckw <world>)"); sender.sendMessage(ChatColor.YELLOW + "Worlds available: "); ArrayList<OverloadedWorldHolder> worlds = worldsHolder.allWorldsDataList(); auxString = ""; for (int i = 0; i < worlds.size(); i++) { auxString += worlds.get(i).getName(); if ((i + 1) < worlds.size()) { auxString += ", "; } } sender.sendMessage(ChatColor.YELLOW + auxString); return false; } auxString = ""; for (int i = 0; i < args.length; i++) { if (args[i] == null) { logger.warning("Bukkit gave invalid arguments array! Cmd: " + cmd.getName() + " args.length: " + args.length); return false; } auxString += args[i]; if (i < (args.length - 1)) { auxString += " "; } } dataHolder = worldsHolder.getWorldData(auxString); sender.sendMessage(ChatColor.YELLOW + "You have selected world '" + dataHolder.getName() + "'."); sender.sendMessage(ChatColor.YELLOW + "This world is using the following data files.."); sender.sendMessage(ChatColor.YELLOW + "Groups:" + ChatColor.GREEN + " " + dataHolder.getGroupsFile().getAbsolutePath()); sender.sendMessage(ChatColor.YELLOW + "Users:" + ChatColor.GREEN + " " + dataHolder.getUsersFile().getAbsolutePath()); return true; default: break; } } sender.sendMessage(ChatColor.RED + "You are not allowed to use that command."); return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract CommandResponse onCommand(CommandSender sender, String label, String[] args);", "private void registerCommands() {\n }", "public void handleCommand(String command);", "CommandHandler() {\n registerArgument(new ChallengeCmd());\n registerArgument(new CreateCmd());\n }", "...
[ "0.7034979", "0.70176387", "0.6928326", "0.68536615", "0.6828531", "0.6828531", "0.68186337", "0.67533964", "0.66733444", "0.6539449", "0.6501462", "0.63953525", "0.6373059", "0.63489896", "0.6334775", "0.6264612", "0.62580913", "0.6192993", "0.61830395", "0.61286414", "0.610...
0.0
-1
Checks if a permission exists and of a lower or same priority.
private boolean checkPermissionExists(CommandSender sender, String newPerm, PermissionCheckResult oldPerm, String type) { if (newPerm.startsWith("+")) { if (oldPerm.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { sender.sendMessage(ChatColor.RED + "The " + type + " already has direct access to that permission."); sender.sendMessage(ChatColor.RED + "Node: " + oldPerm.accessLevel); return true; } } else if (newPerm.startsWith("-")) { if (oldPerm.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { sender.sendMessage(ChatColor.RED + "The " + type + " already has an exception for this node."); sender.sendMessage(ChatColor.RED + "Node: " + oldPerm.accessLevel); return true; } else if (oldPerm.resultType.equals(PermissionCheckResult.Type.NEGATION)) { sender.sendMessage(ChatColor.RED + "The " + type + " already has a matching negated node."); sender.sendMessage(ChatColor.RED + "Node: " + oldPerm.accessLevel); return true; } } else { if (oldPerm.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { sender.sendMessage(ChatColor.RED + "The " + type + " already has an exception for this node."); sender.sendMessage(ChatColor.RED + "Node: " + oldPerm.accessLevel); } else if (oldPerm.resultType.equals(PermissionCheckResult.Type.NEGATION)) { sender.sendMessage(ChatColor.RED + "The " + type + " already has a matching negated node."); sender.sendMessage(ChatColor.RED + "Node: " + oldPerm.accessLevel); } else if (oldPerm.resultType.equals(PermissionCheckResult.Type.FOUND)) { sender.sendMessage(ChatColor.RED + "The " + type + " already has direct access to that permission."); sender.sendMessage(ChatColor.RED + "Node: " + oldPerm.accessLevel); // Since not all plugins define wildcard permissions, allow setting the permission anyway if the permissions dont match exactly. return (oldPerm.accessLevel.equalsIgnoreCase(newPerm)); } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean checkPermission(Permission permission);", "boolean isHasPermissions();", "@Override\n\tpublic boolean can(String permission)\n\t{\n\t\treturn this.auth() != null && this.auth().getRole() != null && this.auth().getRole().getPermissions().parallelStream().filter(p -> Pattern.compile(p.getName()).m...
[ "0.6877882", "0.66491205", "0.63882357", "0.63589895", "0.6333975", "0.626502", "0.6259388", "0.62329936", "0.6207168", "0.61218673", "0.60808724", "0.6040488", "0.6040488", "0.6040488", "0.5989745", "0.5973831", "0.5972375", "0.5961492", "0.5952838", "0.5951377", "0.59475577...
0.57770276
29
Sets up the default world for use.
private boolean setDefaultWorldHandler(CommandSender sender) { dataHolder = worldsHolder.getWorldData(worldsHolder.getDefaultWorld().getName()); permissionHandler = dataHolder.getPermissionsHandler(); if ((dataHolder != null) && (permissionHandler != null)) { selectedWorlds.put(sender.getName(), dataHolder.getName()); sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. Default world '" + worldsHolder.getDefaultWorld().getName() + "' selected."); return true; } sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed."); sender.sendMessage(ChatColor.RED + "Use /manselect <world>"); return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected abstract void initializeWorld();", "public World()\n\t{\n\t\tinitWorld();\t\n\t}", "@BeforeClass\n\tpublic static void setup() {\n\t\tbaseWorld = new BaseWorld(1000 ,1500);\n \tGameManager.get().setWorld(new BaseWorld(1000, 1500));\n\t}", "@Override\n\tpublic void init() {\n\t\tworld = new World...
[ "0.72478825", "0.70878947", "0.6901916", "0.6901743", "0.67412", "0.6720045", "0.66934717", "0.6630383", "0.65675", "0.65396154", "0.64848447", "0.6484093", "0.6476936", "0.6414608", "0.6399229", "0.6396616", "0.638602", "0.63727665", "0.6361678", "0.6321302", "0.629667", "...
0.5818008
46
Send confirmation of a group change. using permission nodes... groupmanager.notify.self groupmanager.notify.other
public static void notify(String name, String msg) { Player player = Bukkit.getServer().getPlayerExact(name); for (Player test : Bukkit.getServer().getOnlinePlayers()) { if (!test.equals(player)) { if (test.hasPermission("groupmanager.notify.other")) test.sendMessage("§7[ §aGizemliOyuncu §7] §e" + ChatColor.YELLOW + name + " §eAdlı Oyuncunun Yeni Yetki Grubu: §b" + msg); } else if ((player != null) && ((player.hasPermission("groupmanager.notify.self")) || (player.hasPermission("groupmanager.notify.other")))) player.sendMessage("§7[ §aGizemliOyuncu §7] §eYetki Grubun: §b" + msg); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Audit(transName=\"editGroupConfirmation\", transType=\"editGroupOwner\", beforeLog=TRUE, afterLog=TRUE)\r\n\tpublic void editGroupConfirmation(){\r\n\t\twsrdModel.setErrorMsg(\"\");\r\n\t\twsrdModel.setDuplicateErrorMsg(\"\");\r\n\t\tif(checkMultipleEdit()){\r\n\t\t\twsrdModel.setErrorMsg(WsrdConstants.UNSAVED);\...
[ "0.72457296", "0.5769485", "0.5665238", "0.5653394", "0.55118185", "0.54988337", "0.5452945", "0.5420367", "0.5358259", "0.53318614", "0.53240895", "0.531021", "0.52976644", "0.528478", "0.5265183", "0.5251021", "0.5233126", "0.5232094", "0.52240884", "0.52133745", "0.5198095...
0.57001984
2
Load a List of players matching the name given. If none online, check Offline.
private List<String> validatePlayer(String playerName, CommandSender sender) { List<Player> players = new ArrayList<Player>(); List<String> match = new ArrayList<String>(); players = this.getServer().matchPlayer(playerName); if (players.isEmpty()) { // Check for an offline player (exact match). for (OfflinePlayer player : Bukkit.getOfflinePlayers()) { if (player.getName().equals(playerName)) { match.add(player.getUniqueId().toString()); } } /* if (Arrays.asList(this.getServer().getOfflinePlayers()).contains(Bukkit.getOfflinePlayer(playerName))) { match.add(Bukkit.getOfflinePlayer(playerName).getName()); //.getUniqueId().toString()); //match.add(Bukkit.getOfflinePlayer(Bukkit.getPlayer(playerName).getUniqueId()).getName()); //.getUniqueId().toString()); } else { // look for partial matches for (OfflinePlayer offline : this.getServer().getOfflinePlayers()) { if (offline.getName().toLowerCase().startsWith(playerName.toLowerCase())) match.add(offline.getName()); //.getUniqueId().toString()); } } */ } else { for (Player player : players) { match.add(player.getUniqueId().toString()); } } if (match.isEmpty()) { sender.sendMessage(ChatColor.RED + "Player not found!"); return null; } else if (match.size() > 1) { sender.sendMessage(ChatColor.RED + "Too many matches found! (" + match.toString() + ")"); return null; } return match; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Player getPlayerFromList(String name){\n for (Player player : players){\n if (player.getName().equals(name)){\n return player;\n }\n }\n return null; //This will never happen. Will always be found. Only called from the takeoverTerritory method\n }...
[ "0.6836304", "0.6726171", "0.65788114", "0.6567154", "0.65386343", "0.6480472", "0.6405696", "0.6332147", "0.6311117", "0.6234833", "0.6185296", "0.6183707", "0.611811", "0.6024173", "0.602168", "0.59861827", "0.5984602", "0.5956229", "0.5955702", "0.59494686", "0.5947753", ...
0.5478815
59
/ /Consistency checking methods /
@Override public boolean isConsistent(List<TraceLockEntry> seq) { for (TraceLockEntry te : seq) { TraceLockLocation tll = te.getLocation(); switch (te.getEntryType()) { case PREJOIN : location_set.add(tll); break; case NOJOIN : location_set.add(tll); break; case JOIN : location_set.add(tll); have_join = true; break; default : break; } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tvoid checkConsistency()\n\t{\n\t\t\n\t}", "ConsistencyLevel consistency();", "public void checkConsistency(List inconsistencies);", "boolean consistencyCheck(){\n\n String jbbInstdir = (String)typeToDir.get(\"jbbinst\");\n String simInstdir = (String)typeToDir.get(\"siminst\");\n ...
[ "0.88670427", "0.7850428", "0.7240613", "0.6474483", "0.63593113", "0.62092143", "0.62092143", "0.6207292", "0.6194051", "0.6186655", "0.61108714", "0.6078593", "0.6076769", "0.60331035", "0.6030524", "0.59210825", "0.58806413", "0.58806413", "0.5871354", "0.5816206", "0.5815...
0.0
-1
/ /Validity testing methods /
@Override public boolean isValidated() { if (location_set.size() == 0 || !have_join) return false; return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "boolean checkValidity();", "void checkValid();", "public void validate() {}", "void validate();", "void validate();", "@Override\r\n\tpublic boolean checkValidity() {\n\t\treturn false;\r\n\t}", "@Test\n public void checkValidityTest1() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();...
[ "0.7364573", "0.7339447", "0.7186488", "0.70789456", "0.70789456", "0.7054853", "0.70267725", "0.69557023", "0.68827915", "0.6860148", "0.681845", "0.6795239", "0.67394537", "0.6735985", "0.66892403", "0.66828334", "0.6674702", "0.667121", "0.6669576", "0.66646814", "0.660653...
0.0
-1
/ /Reporting methods /
@Override public void generateReport(IvyXmlWriter xw,DyviseDatabase db,List<TraceLockLocation> used) { if (xw != null) { xw.begin("TYPE"); xw.field("KIND","JOIN"); xw.field("ID",++item_counter); for (TraceLockLocation tll : location_set) { tll.outputXml(xw,false); } xw.end("TYPE"); } used.addAll(location_set); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void report() {\n\t\t\n\t}", "abstract public void report();", "@Override\r\n\tpublic void report() {\r\n\t}", "@Override\r\n\t\t\tpublic void reporte() {\n\r\n\t\t\t}", "void printReport();", "@Override\n\tpublic void report() throws Exception {\n\t\t\n\t}", "private void printReport() {\n\t\t...
[ "0.7818932", "0.73734266", "0.7360116", "0.72084045", "0.69908774", "0.67500657", "0.66486824", "0.66392857", "0.66282135", "0.66275084", "0.6479638", "0.646037", "0.6391679", "0.6362752", "0.6323649", "0.6305884", "0.6256285", "0.62504715", "0.6246911", "0.62358135", "0.6225...
0.0
-1
/ /Debugging methods /
@Override public String toString() { return "JOIN"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void debug() {\n\n }", "public static void debugInfo() { throw Extensions.todo(); }", "@Override\r\n\t\t\tpublic void debug(String arg) {\n\t\t\t\t\r\n\t\t\t}", "public void debug()\r\n {\n \t\treload();\r\n }", "private static void debug()\r\n\t{\r\n\t\tSystem.out.println(\"Keywords:\")...
[ "0.7813157", "0.75207394", "0.71197295", "0.68726313", "0.6819712", "0.6772815", "0.6735241", "0.6713811", "0.6683939", "0.6626977", "0.6539158", "0.6527071", "0.6527071", "0.65190095", "0.65184623", "0.64967483", "0.649057", "0.64650553", "0.6464404", "0.6451148", "0.6432217...
0.0
-1
Read in the JSON from the example resources
@Test public void testOrderBookAdapter() throws IOException { InputStream is = CryptopiaAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/cryptopia/dto/marketdata/example-full-depth-data.json"); // Use Jackson to parse it ObjectMapper mapper = new ObjectMapper(); CryptopiaBaseResponse<CryptopiaOrderBook> cryptopiaOrderBook = mapper.readValue(is, CryptopiaBaseResponseCryptopiaOrderBook.class); is.close(); OrderBook orderBook = CryptopiaAdapters.adaptOrderBook(cryptopiaOrderBook.getData(), CurrencyPair.ETH_BTC); assertThat(orderBook).isNotNull(); assertThat(orderBook.getBids().size()).isEqualTo(93); // Verify all fields filled assertThat(orderBook.getBids().get(0).getLimitPrice().toString()).isEqualTo("0.07849890"); assertThat(orderBook.getBids().get(0).getType()).isEqualTo(Order.OrderType.BID); assertThat(orderBook.getBids().get(0).getOriginalAmount()) .isEqualTo(new BigDecimal("1.27390320")); assertThat(orderBook.getBids().get(0).getCurrencyPair()).isEqualTo(CurrencyPair.ETH_BTC); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n\tpublic void readJSONFromFile() {\n\t\t\n\t\tJsonPath jsonFile = new JsonPath(new File (\"C:\\\\Users\\\\cmlzd\\\\Desktop\\\\employees.json\"));\n\t\t\n\t\tSystem.out.println(jsonFile.getString(\"items.email\"));\n\t\t\n\t\t\n\t}", "private static JsonReader readJSONFromAsset(Context context) throws IOEx...
[ "0.65106744", "0.64942837", "0.621569", "0.6097948", "0.605114", "0.5976828", "0.59634453", "0.58937454", "0.5882496", "0.5728595", "0.5726738", "0.5716714", "0.5703193", "0.56933194", "0.56922007", "0.5684327", "0.5670406", "0.5665765", "0.5579029", "0.55726236", "0.5563291"...
0.0
-1
Read in the JSON from the example resources
@Test public void testTickerAdapter() throws IOException { InputStream is = CryptopiaAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/cryptopia/dto/marketdata/example-ticker-data.json"); // Use Jackson to parse it ObjectMapper mapper = new ObjectMapper(); CryptopiaBaseResponse<CryptopiaTicker> cryptopiaTicker = mapper.readValue(is, CryptopiaBaseResponseCryptopiaTicker.class); is.close(); Ticker ticker = CryptopiaAdapters.adaptTicker(cryptopiaTicker.getData(), CurrencyPair.ETH_BTC); assertThat(ticker).isNotNull(); assertThat(ticker.getLast().toString()).isEqualTo("0.07963205"); assertThat(ticker.getBid().toString()).isEqualTo("0.07963206"); assertThat(ticker.getAsk().toString()).isEqualTo("0.08003570"); assertThat(ticker.getVolume()).isEqualTo(new BigDecimal("361.93509400")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n\tpublic void readJSONFromFile() {\n\t\t\n\t\tJsonPath jsonFile = new JsonPath(new File (\"C:\\\\Users\\\\cmlzd\\\\Desktop\\\\employees.json\"));\n\t\t\n\t\tSystem.out.println(jsonFile.getString(\"items.email\"));\n\t\t\n\t\t\n\t}", "private static JsonReader readJSONFromAsset(Context context) throws IOEx...
[ "0.65106744", "0.64942837", "0.621569", "0.6097948", "0.605114", "0.5976828", "0.59634453", "0.58937454", "0.5882496", "0.5728595", "0.5726738", "0.5716714", "0.5703193", "0.56933194", "0.56922007", "0.5684327", "0.5670406", "0.5665765", "0.5579029", "0.55726236", "0.5563291"...
0.0
-1
Read in the JSON from the example resources
@Test public void testExchangeMetaDataAdapter() throws IOException { InputStream is = CryptopiaAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/cryptopia/dto/marketdata/example-currencies.json"); // Use Jackson to parse it ObjectMapper mapper = new ObjectMapper(); CryptopiaBaseResponse<List<CryptopiaCurrency>> cryptopiaCurrencies = mapper.readValue(is, CryptopiaBaseResponseCryptopiaCurrency.class); is.close(); assertThat(cryptopiaCurrencies).isNotNull(); is = CryptopiaAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/cryptopia/dto/marketdata/example-trade-pairs.json"); CryptopiaBaseResponse<List<CryptopiaTradePair>> cryptopiaTradePairs = mapper.readValue(is, CryptopiaBaseResponseCryptopiaTradePair.class); is.close(); assertThat(cryptopiaTradePairs).isNotNull(); ExchangeMetaData exchangeMetaData = CryptopiaAdapters.adaptToExchangeMetaData( cryptopiaCurrencies.getData(), cryptopiaTradePairs.getData()); assertThat(exchangeMetaData).isNotNull(); assertThat(exchangeMetaData.getCurrencies()).containsKey(Currency.ETH); assertThat(exchangeMetaData.getCurrencies().get(Currency.ETH).getScale()).isEqualTo(8); assertThat(exchangeMetaData.getCurrencyPairs()).containsKey(CurrencyPair.ETH_BTC); assertThat( exchangeMetaData .getCurrencyPairs() .get(CurrencyPair.ETH_BTC) .getTradingFee() .toString()) .isEqualTo("0.20000000"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n\tpublic void readJSONFromFile() {\n\t\t\n\t\tJsonPath jsonFile = new JsonPath(new File (\"C:\\\\Users\\\\cmlzd\\\\Desktop\\\\employees.json\"));\n\t\t\n\t\tSystem.out.println(jsonFile.getString(\"items.email\"));\n\t\t\n\t\t\n\t}", "private static JsonReader readJSONFromAsset(Context context) throws IOEx...
[ "0.65106744", "0.64942837", "0.621569", "0.6097948", "0.605114", "0.5976828", "0.59634453", "0.58937454", "0.5882496", "0.5728595", "0.5726738", "0.5716714", "0.5703193", "0.56933194", "0.56922007", "0.5684327", "0.5670406", "0.5665765", "0.5579029", "0.55726236", "0.5563291"...
0.0
-1
Read in the JSON from the example resources
@Test public void testTradesAdapter() throws IOException { InputStream is = CryptopiaAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/cryptopia/dto/marketdata/example-trades.json"); // Use Jackson to parse it ObjectMapper mapper = new ObjectMapper(); CryptopiaBaseResponse<List<CryptopiaMarketHistory>> cryptopiaMarketHistory = mapper.readValue(is, CryptopiaBaseResponseCryptopiaMarketHistory.class); is.close(); assertThat(cryptopiaMarketHistory).isNotNull(); Trades trades = CryptopiaAdapters.adaptTrades(cryptopiaMarketHistory.getData()); assertThat(trades).isNotNull(); assertThat(trades.getlastID()).isEqualTo(1501995183); assertThat(trades.getTradeSortType()).isEqualTo(Trades.TradeSortType.SortByTimestamp); assertThat(trades.getTrades().size()).isGreaterThan(1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n\tpublic void readJSONFromFile() {\n\t\t\n\t\tJsonPath jsonFile = new JsonPath(new File (\"C:\\\\Users\\\\cmlzd\\\\Desktop\\\\employees.json\"));\n\t\t\n\t\tSystem.out.println(jsonFile.getString(\"items.email\"));\n\t\t\n\t\t\n\t}", "private static JsonReader readJSONFromAsset(Context context) throws IOEx...
[ "0.65106744", "0.64942837", "0.621569", "0.6097948", "0.605114", "0.5976828", "0.59634453", "0.58937454", "0.5882496", "0.5728595", "0.5726738", "0.5716714", "0.5703193", "0.56933194", "0.56922007", "0.5684327", "0.5670406", "0.5665765", "0.5579029", "0.55726236", "0.5563291"...
0.0
-1
TODO: Warning this method won't work in the case the id fields are not set
@Override public boolean equals(Object object) { if (!(object instanceof FacilityCarrierShipment)) { return false; } FacilityCarrierShipment other = (FacilityCarrierShipment) object; if ((this.facilityCarrierShipmentPK == null && other.facilityCarrierShipmentPK != null) || (this.facilityCarrierShipmentPK != null && !this.facilityCarrierShipmentPK.equals(other.facilityCarrierShipmentPK))) { return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void setId(Integer id) { this.id = id; }", "private Integer getId() { return this.id; }", "public void setId(int id){ this.id = id; }", "public void setId(Long id) {this.id = id;}", "public void setId(Long id) {this.id = id;}", "public void setID(String idIn) {this.id = idIn;}", "public void se...
[ "0.6896886", "0.6838461", "0.67056817", "0.66419715", "0.66419715", "0.6592331", "0.6579151", "0.6579151", "0.6574321", "0.6574321", "0.6574321", "0.6574321", "0.6574321", "0.6574321", "0.65624106", "0.65624106", "0.65441847", "0.65243006", "0.65154546", "0.6487427", "0.64778...
0.0
-1
Call writeCSV with default value
public void writeEvaluateResultCSV(String resultFilePath) { writeCSV(resultFilePath, evaluates()); System.out.println("write evaluate result finished:" + resultFilePath); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void createCSV() {\n\t\t// Need to integrate CSV calling logic\n\t}", "CSV createCSV();", "@Override\n\tpublic void exportToCSV() {\n\n\t}", "@Test\n public void testOutputCSV() throws Throwable {\n testOutputCSV(false);\n }", "void createCsv(String location);", "public void exportToC...
[ "0.66477", "0.6638588", "0.62938845", "0.62594235", "0.6221548", "0.6125734", "0.5953668", "0.5935491", "0.5921604", "0.59018165", "0.5852815", "0.5806592", "0.5726085", "0.566148", "0.5652624", "0.5636286", "0.56339395", "0.5609062", "0.5592106", "0.558335", "0.5577311", "...
0.0
-1
Print metrics and evaluate results in each file.
private MetricsSet getTotalResultPerFile(String[][] contents) { String[] csvHeaders = MetricsSet.METRICS_PER_FILE; MetricsSet thisFileResult = new MetricsSet(); int caseSize = csvHeaders.length - 2; Double[] RowSum = new Double[caseSize]; Integer[] RowCount = new Integer[caseSize]; for (int i = 0; i < caseSize; i ++) { RowSum[i] = 0.0; RowCount[i] = 0; } for (String[] row: contents) { for(int i = 0; i < caseSize; i++) { // if (row[i + 2].equals("NaN")) continue; Double tmp = Double.parseDouble(row[i + 2]); if (tmp < 0) continue; RowSum[i] += tmp; RowCount[i] += 1; } } thisFileResult.topk = Integer.parseInt(contents[1][1]); thisFileResult.precision = new Metrics(RowCount[0], RowSum[0]); //thisFileResult.recall = new Metrics(RowCount[1], RowSum[1]); //thisFileResult.fMeasure = new Metrics(RowCount[2], RowSum[2]); thisFileResult.MAP = new Metrics(RowCount[1], RowSum[1]); thisFileResult.MRR = new Metrics(RowCount[2], RowSum[2]); //thisFileResult.NDCG = new Metrics(RowCount[5], RowSum[5]); //thisFileResult.firstPos = new Metrics(RowCount[6], RowSum[6]); thisFileResult.time = new Metrics(RowCount[3], RowSum[3]); thisFileResult.queryNumb = this.ranks.length; return thisFileResult; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void printResults() {\n resultMap.entrySet().stream().forEach((Map.Entry<File, String> entry) -> {\n System.out.println(String.format(\"%s processed by thread: %s\", entry.getKey(), entry.getValue()));\n });\n System.out.println(String.format(\"processed %d entries\", ...
[ "0.63030785", "0.6199326", "0.619724", "0.607292", "0.60275763", "0.59314257", "0.5924799", "0.5897387", "0.5886385", "0.58571476", "0.58431345", "0.57948214", "0.57406366", "0.57268286", "0.5709052", "0.57031214", "0.569583", "0.56823415", "0.56443846", "0.5635499", "0.56050...
0.52930933
56
Write your code here
public static TreeNode<Integer> maxSumNode(TreeNode<Integer> root){ if(root==null) { return null; } int sumRoot = sum(root); int max=Integer.MIN_VALUE; TreeNode<Integer> maxNode = null; for(int i=0;i<root.children.size();i++) { TreeNode<Integer> maxNode1 =maxSumNode(root.children.get(i)); int sum = sum(maxNode1); if( max < sum ) { max = sum; maxNode = maxNode1; } } if( sumRoot > max ) { return root; } return maxNode; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void generateCode()\n {\n \n }", "public void logic(){\r\n\r\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "private static void cajas() {\n\t\t\n\t}", "void pramitiTechTutorials() {\n\t\n}", "public void ganar() {\n // TODO implement here\n }", "@Override\r...
[ "0.6385292", "0.62825674", "0.6094859", "0.59705144", "0.59174407", "0.5879631", "0.58751583", "0.58699447", "0.5869017", "0.58553624", "0.5826625", "0.5825323", "0.58233553", "0.577183", "0.576982", "0.5769503", "0.57691693", "0.5748044", "0.57379705", "0.573767", "0.5728572...
0.0
-1
/ Show confirmation dialog that prompts user to log in.
private void showMustLogInMessage(String message, String dialogTag) { ConfirmationDialogFragment dialog = ConfirmationDialogFragment.getInstance(message, getString(R.string.log_in), REQUEST_CONFIRM_LOG_IN, true); dialog.show(getSupportFragmentManager(), dialogTag); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected void confirmLogin() {\n String nameString1 = this.adminName.getText();\n String passwordString1 = this.adminPassword.getText();\n UserType userType = (UserType) this.user_type_combobox.getSelectedItem();\n if (\"系统管理员\".equals(userType.getName())) {\n AdminDao admin...
[ "0.69781506", "0.6585632", "0.64603776", "0.640116", "0.62673175", "0.62477654", "0.62228596", "0.62027925", "0.599699", "0.59799665", "0.5921426", "0.5881411", "0.5860122", "0.5801773", "0.57983494", "0.57957804", "0.57792985", "0.57557595", "0.5755726", "0.57458955", "0.573...
0.5659769
30
/ Update menu item for user logging in/out according to user's current status.
private void updateLogInMenuItem() { if (mLogInMenuItem != null) { if (mUserService.isSignedIn()) mLogInMenuItem.setTitle(R.string.board_menu_my_profile); else mLogInMenuItem.setTitle(R.string.menu_log_in); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void checkMenuItemStatus() {\n\t\tif (VozCache.instance().getCookies() == null) { // not logged in yet\n\t\t\tlogoutMenu.setVisible(false);\t\t\t\n\t\t\tloginMenu.setVisible(true);\n\t\t\tloginWithPresetMenu.setVisible(true);\n\t\t} else { // logged in\n\t\t\tlogoutMenu.setVisible(true);\t\t\t\n\t\t\tlogin...
[ "0.6811728", "0.65876675", "0.65771437", "0.6548815", "0.65228707", "0.64740837", "0.64174956", "0.636971", "0.63619", "0.63436216", "0.63246435", "0.62814516", "0.6272906", "0.6239266", "0.6235069", "0.616676", "0.61647725", "0.61546785", "0.61522853", "0.6140179", "0.613376...
0.78397703
0
/ Show confirmation dialog to confirm logging out.
private void showConfirmSignOutDialog() { ConfirmationDialogFragment dialog = ConfirmationDialogFragment.getInstance(getString(R.string.log_out_confirm), getString(R.string.log_out_confirm_option_yes), REQUEST_CONFIRM_LOG_OUT, true); dialog.show(getSupportFragmentManager(), DIALOG_CONFIRM_LOG_OUT); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void logout() {\n Utils.showConfirmationDialogCallBack(MainActivity.this, getString(R.string.logout_sure), this);\n }", "public void logoutDialog() {\n new AlertDialog.Builder(this)\n .setIcon(android.R.drawable.ic_dialog_alert)\n .setTitle(\"Logout\")\n ...
[ "0.74362296", "0.738368", "0.72921884", "0.7183586", "0.68058383", "0.65120643", "0.646362", "0.64144045", "0.64113426", "0.6391181", "0.6344662", "0.6330394", "0.62265795", "0.6218855", "0.6203315", "0.6150747", "0.6150192", "0.6149658", "0.6144994", "0.6125998", "0.6123832"...
0.7561222
0
obj = () element; return obj.someMethod();
@Override public String getText(Object element) { return "test"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void element() {}", "SomeClass someClass();", "public void lambaAsObjectExample() {\n }", "public void method(){}", "Object element();", "Object element();", "void method();", "void method();", "void mo67921a(Object obj);", "public abstract Object mo26777y();", "public T caseElement(Element ...
[ "0.6052916", "0.59961116", "0.5737088", "0.5512692", "0.550904", "0.550904", "0.5508685", "0.5508685", "0.5472092", "0.5428739", "0.53995365", "0.5375618", "0.5340038", "0.53204834", "0.5318751", "0.52849615", "0.5237378", "0.5230123", "0.5215885", "0.520501", "0.52029234", ...
0.0
-1
obj = () element; return obj.someMethod();
@Override public String getText(Object element) { return "test5"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void element() {}", "SomeClass someClass();", "public void lambaAsObjectExample() {\n }", "public void method(){}", "Object element();", "Object element();", "void method();", "void method();", "void mo67921a(Object obj);", "public abstract Object mo26777y();", "public T caseElement(Element ...
[ "0.6052916", "0.59961116", "0.5737088", "0.5512692", "0.550904", "0.550904", "0.5508685", "0.5508685", "0.5472092", "0.5428739", "0.53995365", "0.5375618", "0.5340038", "0.53204834", "0.5318751", "0.52849615", "0.5237378", "0.5230123", "0.5215885", "0.520501", "0.52029234", ...
0.0
-1
TODO Autogenerated method stub
@Override public Iterator<Word> iterator() { return new Iterator<Word>() { @Override public boolean hasNext() { return lword.hasNext(); } @Override public Word next() { return lword.next(); } @Override public void remove() { throw new UnsupportedOperationException(); } }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExr...
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.608016...
0.0
-1
Created by zhangye on 20151008.
public interface OtoCommand<R> { void execute(); void execute(IContext context); void execute(IContext context, Handler<R> resultHandler); void executeFuture(CommandContext context, Future<R> future); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void perish() {\n \n }", "private stendhal() {\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "private static void cajas() {\n\t\t\n\t}", "@Overrid...
[ "0.60607076", "0.6051254", "0.5994905", "0.59941316", "0.5957668", "0.594577", "0.5938891", "0.5938891", "0.5899588", "0.5880545", "0.5848571", "0.5833516", "0.5817947", "0.58174527", "0.581552", "0.5812191", "0.5807855", "0.5806288", "0.5800787", "0.57799935", "0.57799935", ...
0.0
-1
just change all string to integer as hout60 + minutes
public int findMinDifference(List<String> timePoints) { List<Integer> p = new ArrayList<>(); for(String time:timePoints){ String[] hm = time.split(":"); int h = Integer.parseInt(hm[0]); int m = Integer.parseInt(hm[1]); p.add(h*60 + m); if(h<12){ p.add((h+24)*60+m); } } int diff = Integer.MAX_VALUE; Collections.sort(p); for(int i=1; i<p.size(); i++){ diff = Math.min(p.get(i)-p.get(i-1), diff); } return diff; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private String getMinutesInTime(int time) {\n String hour = String.valueOf(time / 60);\n String minutes = String.valueOf(time % 60);\n\n if(minutes.length() < 2) {\n minutes = \"0\" + minutes;\n }\n\n return hour + \":\" + minutes;\n\n }", "public static int conve...
[ "0.7127264", "0.7083368", "0.6920192", "0.69176996", "0.6824133", "0.67617065", "0.6716678", "0.6688213", "0.6673724", "0.6654055", "0.6623503", "0.6569787", "0.656605", "0.6552848", "0.64127314", "0.63985115", "0.63717586", "0.6345859", "0.6312922", "0.63061154", "0.6290701"...
0.0
-1
Instantiates a new list expenses DAOSQL.
public ListExpensesDAOSQL() { this.queryHandler = new QueryHandler(this.url,this.login,this.passwd); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public List<DBExpensesModel> getAllExpenseList() {\n List<DBExpensesModel> expenseArrayList = new ArrayList<DBExpensesModel>();\n\n String selectQuery = \"SELECT * FROM \" + TABLE_EXPENSE;\n Log.d(TAG, selectQuery);\n\n SQLiteDatabase db = this.getReadableDatabase();\n Cursor c ...
[ "0.63628703", "0.59589595", "0.5938438", "0.5892213", "0.5876866", "0.58520967", "0.57638913", "0.5722207", "0.5653934", "0.56238365", "0.5564083", "0.5370996", "0.5342507", "0.52655995", "0.52551734", "0.5224359", "0.5198823", "0.5191511", "0.51797163", "0.5129849", "0.51120...
0.77041
0
Checks if is exist.
private boolean isExist(String name, Date date) { String sql = "SELECT * from `expenses` WHERE Name='"+name+"' AND Date='"+date+"';"; ResultSet rs = this.queryHandler.executeQuery(sql); try { boolean exist = false; while(rs.next()) { exist = true; } return exist; } catch (SQLException e) { e.printStackTrace(); } this.queryHandler.close(); return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract boolean doesExist();", "public boolean exist() {\n\t\treturn false;\n\t}", "@Override\r\n\tpublic boolean isExist() {\n\t\treturn false;\r\n\t}", "public boolean exists()\n\t{\n\n\t\treturn true;\n\t}", "public abstract boolean exists();", "boolean exists();", "boolean exists();", "pu...
[ "0.8233473", "0.8115012", "0.8088675", "0.78389513", "0.7808673", "0.76863796", "0.76863796", "0.76446164", "0.764029", "0.7596503", "0.75854754", "0.7505967", "0.7503808", "0.74896854", "0.7471488", "0.74190784", "0.7396904", "0.7388098", "0.73090345", "0.72983843", "0.72016...
0.0
-1
Adds a status bar to an array which will be rendered later
public void addBar(String title, int bars, int color) { // More that 4 bars are not allowed at the moment // TODO: Allow more bars if(totalBars > 4) return; // TODO: Allow user to decide which image to use as a bar count barTitle[totalBars] = title; // Bars are stored in two variables in the following way // [ title 1, title 2 ] // [bar#, barColor, bar#, barColor] barData[totalBars * 2] = bars; barData[(totalBars * 2) + 1] = color; ++totalBars; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void createStatusBar(JPanel bar) {\n bar.setPreferredSize(new Dimension(getWidth(), 25));\n bar.setBackground(Color.LIGHT_GRAY);\n\n // add into container\n bar.add(paintModule.sizeLabel);\n bar.add(paintModule.coordinate);\n\n }", "private Component getStatusBar() {\...
[ "0.7049141", "0.6825802", "0.67866534", "0.66603875", "0.66602916", "0.6643857", "0.66400254", "0.6464015", "0.6461032", "0.6456419", "0.6441359", "0.6248069", "0.62349516", "0.6229974", "0.61747783", "0.6107508", "0.60131395", "0.5982549", "0.5972918", "0.5910906", "0.58615"...
0.0
-1
Create render format for the bars
private String renderBar(String title, int barQty, char symbol) { StringBuilder bar = new StringBuilder(); bar.append(title); bar.append(": "); for(int i = 0; i < barQty; i++) bar.append(symbol); return bar.toString(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private BarData generateBarData() {\n ArrayList<BarEntry> entries2 = new ArrayList<BarEntry>();\n\n /*\n for (int index = 0; index < itemcount; index++) {\n entries1.add(new BarEntry(0, 25));\n\n // stacked\n entries2.add(new BarEntry(0, new float[]{13, 13}));\...
[ "0.6583482", "0.6471658", "0.63389355", "0.63263774", "0.6322981", "0.60692644", "0.59031564", "0.5811182", "0.5759212", "0.5752496", "0.57519346", "0.5707148", "0.56827825", "0.5676971", "0.55912995", "0.5583856", "0.5560941", "0.55568314", "0.55541396", "0.5551368", "0.5522...
0.5862632
7
TODO Bar changing code goes here
@Override public void update(GameContainer gc) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void setBar(){\n lastBarHitId = beats.get(lastBeatHitId).getContainedIn();\n }", "public void visitBumpBar( DevCat devCat ) {}", "public void setBars(List<Bar> bars) { this.bars = bars; }", "private void updateBar() {\n\t\tString resources = String.format(\"Money: $%d\\nAgents: %d\\nMedia r...
[ "0.6873399", "0.6447074", "0.63208884", "0.6153133", "0.614336", "0.6139106", "0.6077405", "0.6033865", "0.6033865", "0.6006549", "0.5980527", "0.5956701", "0.59069246", "0.5862451", "0.5839797", "0.57415", "0.57150227", "0.5712228", "0.5709557", "0.57044435", "0.5703975", ...
0.0
-1
TODO Autogenerated method stub
public static void main(String[] args) { int a; int b; int c; a=10; b=20; c=a+b; System.out.println("Sum of a and b is "+ c); System.out.println(1212); System.out.println("hello"); System.out.println("same line"); System.out.println(a>b); if(a>b) { System.out.println("a is greater than b"); } else if(a==b) { System.out.println("a and b are same"); }else { System.out.println("a is not greater than b"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n public void perish() {\n \n }", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "@Override\n\tpublic void anular() {\n\n\t}", "@Override\n\tprotected void getExr...
[ "0.6671074", "0.6567672", "0.6523024", "0.6481211", "0.6477082", "0.64591026", "0.64127725", "0.63762105", "0.6276059", "0.6254286", "0.623686", "0.6223679", "0.6201336", "0.61950207", "0.61950207", "0.61922914", "0.6186996", "0.6173591", "0.61327106", "0.61285484", "0.608016...
0.0
-1
/ The method asks the question and returns a answer.
@Override public String ask(String question) { return answers[position++]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "String ask();", "java.lang.String getCorrectAnswer();", "protected abstract String answer();", "String userInput(String question);", "public abstract String chooseAnswer();", "boolean hasCorrectAnswer();", "String getAnswerResponse();", "public String askSomething(String question, String titel);", ...
[ "0.7843002", "0.7611323", "0.74769735", "0.7280621", "0.69535214", "0.67510515", "0.66985786", "0.6686789", "0.6652097", "0.6631929", "0.6629203", "0.66194504", "0.66137725", "0.6591108", "0.6568494", "0.656445", "0.65365607", "0.6509434", "0.6507397", "0.64678824", "0.644689...
0.7200313
4
/++++ CARGA EL USERNAME DEL USUARIO EN EL DRAWER ++++
@Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); try { Thread.sleep(300); } catch (InterruptedException e) { e.printStackTrace(); } FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if (user != null) { String username = user.getDisplayName(); if (username == null || username.isEmpty()) { navUsername.setText(R.string.no_user); } else { navUsername.setText(username); } } else { navUsername.setText(R.string.no_user); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "java.lang.String getUserName();", "java.lang.String getUserName();", "java.lang.String getUserName();", "@Override\n public java.lang.String getUserName() {\n return _partido.getUserName();\n }", "public String usuarioconectado() {\n\t\tString nome;\n\t\tObject principal = SecurityContextHolde...
[ "0.749591", "0.749591", "0.749591", "0.745007", "0.7376616", "0.731764", "0.731764", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7138344", "0.7057902", "0.70392084", "0.703902", "0.70279896", "0.698...
0.0
-1
/++++ CARGA EL USERNAME DEL USUARIO EN EL DRAWER ++++
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_main, container, false); toolbar = v.findViewById(R.id.toolbar); recyclerView = v.findViewById(R.id.recyclerViewMain); drawerLayout = v.findViewById(R.id.drawerLayout); bottomNavigationView = v.findViewById(R.id.bottomNavigation); searchView = v.findViewById(R.id.searchView); contents = v.findViewById(R.id.mainFragmentContents); imageContents = v.findViewById(R.id.imageContent); NavigationView navigationView = v.findViewById(R.id.navigationView); View headerView = navigationView.getHeaderView(0); navUsername = headerView.findViewById(R.id.nameUserDrawer); /*+++++++ LOG OUT +++++++*/ ImageButton logOutButton = v.findViewById(R.id.logOutButton); logOutButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if (user != null){ FirebaseAuth.getInstance().signOut(); navController.navigate(R.id.action_mainFragment_to_homeScreenFragment); }else{ Toast.makeText(getContext(), "NO HAY NADIE LOGEADO", Toast.LENGTH_SHORT).show(); } } }); /*+++++++ LOG OUT +++++++*/ ((AppCompatActivity) requireActivity()).setSupportActionBar(toolbar); setUpRecycler(recyclerView); toolbar.setNavigationOnClickListener(v1 -> drawerLayout.open()); bottomNavigationView.setOnNavigationItemSelectedListener(this::bottomMenu); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { filtrarRecycler(query); return false; } @Override public boolean onQueryTextChange(String newText) { filtrarRecycler(newText); return false; } }); return v; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "java.lang.String getUserName();", "java.lang.String getUserName();", "java.lang.String getUserName();", "@Override\n public java.lang.String getUserName() {\n return _partido.getUserName();\n }", "public String usuarioconectado() {\n\t\tString nome;\n\t\tObject principal = SecurityContextHolde...
[ "0.749591", "0.749591", "0.749591", "0.745007", "0.7376616", "0.731764", "0.731764", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7138344", "0.7057902", "0.70392084", "0.703902", "0.70279896", "0.698...
0.0
-1
/ DBUtils.uploadPost(new Post("MWYgVorRGpajcRNoj", new User("onlyforjazzmemes"), "8h", "version 8.0", " 20, 113, 0)); / ConexionBBDD.uploadPost(new Post("MWYgVorRGpajcRNok", new User("DeveloperNightshade"), "10h", "Hmm, fuck it", " 24, 3800, 456));
private void setUpRecycler(RecyclerView recyclerView) { recyclerView.setLayoutManager(new LinearLayoutManager(requireContext())); FirebaseRecyclerOptions<Post> options = new FirebaseRecyclerOptions.Builder<Post>() .setQuery(DBUtils.getReferencePost(), Post.class).build(); adapter = new PostAdapter(options, requireContext()); recyclerView.setAdapter(adapter); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@POST(\"posts\")\n public Call<Post> UploadPost (@Body Post post);", "@FormUrlEncoded\n @POST(\"posts\")\n Call<Post> createPost(@Field(\"userId\") int userId, @Field(\"title\") String title, @Field(\"body\") String text);", "int insert(WpPostsWithBLOBs record);", "Post save(Post post) throws Excep...
[ "0.6978259", "0.62852126", "0.6274799", "0.6229603", "0.61948085", "0.6186675", "0.61219484", "0.6096513", "0.602889", "0.60226893", "0.592868", "0.58915687", "0.5881311", "0.5873496", "0.586645", "0.58658504", "0.58535355", "0.58142954", "0.58012974", "0.5800722", "0.5790103...
0.0
-1
Time complexity : O(n) Space complexity : O(1)
public static int f(Relationship relationship) { int n = relationship.people(); int candidate = 0; for (int i = 1; i < n; i++) { if (relationship.knows(candidate, i)) { // if candidate knows i, candidate can not be the mayor candidate = i; } } // check that the last candidate can be the mayor for (int i = 0; i < n; i++) { if (!relationship.knows(i, candidate)) { return -1; } if (candidate != i && relationship.knows(candidate, i)) { return -1; } } return candidate; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static int f2(int N) { \n int x = 0; //O(1)\n for(int i = 0; i < N; i++) // O(n)\n // O(n)`\n for(int j = 0; j < i; j++) \n x++;\n return x;\n }", "public static int f1(int N) {\n int x = 0; //O(1)\n for(int i = 0; i < N; i++...
[ "0.71008056", "0.7068778", "0.6518176", "0.63393646", "0.6095544", "0.6081848", "0.6060391", "0.6034665", "0.6032773", "0.6010068", "0.60010105", "0.5918397", "0.5863614", "0.58377576", "0.5806524", "0.5800207", "0.5766363", "0.572054", "0.56917137", "0.56645703", "0.56618", ...
0.0
-1
First the sections content.
private void populateOutputFile(List<String> sectionIds, Map<String, DocumentSection> sections) { for (String sectionId : sectionIds) { String id = sections.get(sectionId).getId(); String description = sections.get(sectionId).getDescription(); Utils.println(id + " " + description); mOutputBuilder.addDocumentSection(id, description); } // Then the RTM content. mRTMSectionExtractor.populateOutputFile(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Section getSection();", "public String getSection(){\n return sectionsText;\n }", "@Override\r\n\tpublic T first() {\n\t\treturn head.content;\r\n\t}", "@Override\n\tpublic int getSectionForPosition(final int arg0) {\n\t\treturn 0;\n\t}", "public Element first() {\n if(isEmpty()) return nu...
[ "0.629519", "0.6213155", "0.6207658", "0.5957308", "0.5887884", "0.58599913", "0.5701986", "0.5701986", "0.56733704", "0.56702155", "0.56475896", "0.56237", "0.55981654", "0.55928516", "0.5577602", "0.5573668", "0.5527401", "0.55165595", "0.5512742", "0.55058086", "0.5486175"...
0.0
-1
determine whether all items emitted by an Observable meet some criteria
@Test public void all() { Observable.just(1, 2, 3, 4, 5) .doOnNext(System.out::println) .all(x -> x < 10) .subscribe(mList::add); assertEquals(mList, Collections.singletonList(true)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void contains() {\n Observable.just(2, 30, 22, 5, 60, 1)\n .contains(22)\n .subscribe(mList::add);\n assertEquals(mList, Collections.singletonList(true));\n }", "public boolean isInterestedInAllItems();", "boolean hasAll();", "boolean hasAll();...
[ "0.62928134", "0.61174715", "0.6015697", "0.6015697", "0.5925942", "0.55633956", "0.5483238", "0.54624104", "0.5442704", "0.54270655", "0.5371708", "0.53533375", "0.53340274", "0.5326717", "0.5322112", "0.5310353", "0.5303436", "0.5303436", "0.53002834", "0.52739936", "0.5248...
0.6431606
0
determine whether an Observable emits a particular item or not
@Test public void contains() { Observable.just(2, 30, 22, 5, 60, 1) .contains(22) .subscribe(mList::add); assertEquals(mList, Collections.singletonList(true)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void observableGetBooleanLogicOperationAndReturnBooleanValue() {\n assertTrue(Observable.just(10)\n .map(intValue -> intValue == 10)\n .toBlocking()\n .single());\n }", "boolean hasFeedItem();", "boo...
[ "0.5830063", "0.56573015", "0.55223143", "0.549936", "0.5440647", "0.5348925", "0.5298871", "0.5288653", "0.5275086", "0.52728194", "0.52728194", "0.52728194", "0.52728194", "0.52728194", "0.52728194", "0.52728194", "0.5201429", "0.51767933", "0.51765734", "0.5149197", "0.513...
0.5719111
1
determine whether two Observables emit the same sequence of items
@Test public void sequenceEqual() { Observable<Long> o1 = Observable.just(1L, 2L, 3L, 4L, 5L) .delay(1000, TimeUnit.SECONDS, mTestScheduler); Observable<Long> o2 = Observable.interval(20, TimeUnit.SECONDS, mTestScheduler) .skip(1) .take(5); Observable.sequenceEqual(o1, o2) .subscribe(mList::add); mTestScheduler.advanceTimeBy(1200, TimeUnit.SECONDS); assertEquals(mList, Collections.singletonList(true)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static <T> Observable<Boolean> sequenceEqual(\r\n\t\t\tfinal Iterable<? extends T> first,\r\n\t\t\tfinal Observable<? extends T> second) {\r\n\t\treturn sequenceEqual(first, second, Functions.equals());\r\n\t}", "@Nonnull \r\n\tpublic static <T> Observable<Boolean> sequenceEqual(\r\n\t\t\t@Nonnull final O...
[ "0.6903077", "0.68513095", "0.57861686", "0.5726465", "0.566286", "0.5648589", "0.558773", "0.5585471", "0.54760545", "0.5452018", "0.54351336", "0.53699374", "0.53461105", "0.5317674", "0.5290966", "0.5286816", "0.52699345", "0.5267013", "0.52380323", "0.51913446", "0.514708...
0.6993693
0
given two or more source Observables, emit all of the items from only the first of these Observables to emit an item
@Test public void amb() { Observable<Integer> o1 = Observable.just(20, 40, 60) .delay(500, TimeUnit.SECONDS, mTestScheduler); Observable<Integer> o2 = Observable.just(1, 2, 3) .delay(200, TimeUnit.SECONDS, mTestScheduler); Observable<Integer> o3 = Observable.just(0, 0, 0) .delay(1000, TimeUnit.SECONDS, mTestScheduler); Observable.amb(o1, o2, o3) .subscribe(mList::add); mTestScheduler.advanceTimeBy(1000, TimeUnit.SECONDS); assertEquals(mList, Arrays.asList(1, 2, 3)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void combineLatest() {\n\n System.out.println(\"# 1\");\n\n /*\n Emits item every second\n */\n Observable sourceInterval = Observable.interval(1L, TimeUnit.MILLISECONDS).take(10);\n\n /*\n Emits string items\n */\n Observable s...
[ "0.66469926", "0.61594313", "0.60391575", "0.6023723", "0.5931326", "0.5930799", "0.5920521", "0.5846604", "0.58452606", "0.57642984", "0.5739642", "0.5728281", "0.57160664", "0.5692876", "0.5681739", "0.56561697", "0.5589964", "0.5586143", "0.55635756", "0.55519444", "0.5461...
0.52277833
32
emit items from the source Observable, or a default item if the source Observable emits nothing
@Test public void defaultIfEmpty() { Observable.empty() .defaultIfEmpty("geniusmart") .subscribe(mList::add); assertEquals(mList, Collections.singletonList("geniusmart")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void just() {\n Observable<List<String>> myObservable = Observable.just(Utils.getData());\n myObservable.subscribe(consumerList);\n }", "public static <T> T single(\r\n\t\t\t@Nonnull Observable<? extends T> source,\r\n\t\t\t@Nonnull Func0<? extends T> defaultSupplier) {\r\n\t\tClos...
[ "0.5813816", "0.54221344", "0.5303871", "0.52481997", "0.52066034", "0.5166435", "0.51394546", "0.51177526", "0.50643444", "0.50517976", "0.5029685", "0.50000346", "0.4968154", "0.49528793", "0.4950649", "0.49500054", "0.4945329", "0.49338666", "0.4920562", "0.49134523", "0.4...
0.57069767
1
discard items emitted by an Observable until a second Observable emits an item
@Test public void skipUntil() { Observable<Long> o1 = Observable.interval(100, TimeUnit.SECONDS, mTestScheduler) .map(num -> num + 1) .take(9); Observable<Integer> o2 = Observable.just(0, 0) .delay(550, TimeUnit.SECONDS, mTestScheduler); o1.skipUntil(o2) .subscribe(mList::add); mTestScheduler.advanceTimeBy(2000, TimeUnit.SECONDS); assertEquals(mList, Arrays.asList(6L, 7L, 8L, 9L)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void skipWhile() {\n Observable.fromIterable(sData)\n .skipWhile((item) -> {\n System.out.println(\"item = \" + item);\n return item.equalsIgnoreCase(\"abc\");\n }).subscribe(new MyObserver<>());\n }", "@Test\n public ...
[ "0.6290674", "0.62014323", "0.6032369", "0.59008205", "0.58547723", "0.5716806", "0.563486", "0.5629971", "0.5576547", "0.554626", "0.5405824", "0.5399403", "0.5393011", "0.5377472", "0.53704494", "0.5330305", "0.53146935", "0.5299518", "0.5287627", "0.52634937", "0.5243095",...
0.6599678
0
discard items emitted by an Observable until a specified condition becomes false
@Test public void skipWhile() { Observable.interval(100, TimeUnit.SECONDS, mTestScheduler) .map(num -> num + 1) .take(7) .skipWhile(aLong -> aLong != 4) .subscribe(mList::add); mTestScheduler.advanceTimeBy(1000, TimeUnit.SECONDS); assertEquals(mList, Arrays.asList(4L, 5L, 6L, 7L)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void skipWhile() {\n Observable.fromIterable(sData)\n .skipWhile((item) -> {\n System.out.println(\"item = \" + item);\n return item.equalsIgnoreCase(\"abc\");\n }).subscribe(new MyObserver<>());\n }", "@Test\n public ...
[ "0.6973597", "0.6306131", "0.6217215", "0.6129408", "0.58866924", "0.58113885", "0.5677299", "0.5667031", "0.5526006", "0.5486568", "0.53770137", "0.5367651", "0.532584", "0.5288527", "0.5269547", "0.51674324", "0.51368463", "0.5083244", "0.50727755", "0.5068088", "0.50574833...
0.6285179
2
discard items emitted by an Observable after a second Observable emits an item or terminates
@Test public void takeUntil() { Observable.just(1, 2, 3, 4) .takeUntil(integer -> integer > 2) .subscribe(mList::add); assertEquals(mList, Arrays.asList(1, 2, 3)); mList.clear(); Observable.just(1, 2, 3, 4) .takeUntil(integer -> integer < 10) .subscribe(mList::add); assertEquals(mList, Collections.singletonList(1)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void ignoreElements() {\n Observable.fromIterable(Utils.getData())\n .ignoreElements()\n .subscribe(new MyCompletableObserver());\n }", "private static void exSwitchMapTwo() {\n\n Observable.interval(5,TimeUnit.SECONDS)\n .switchMap(call -...
[ "0.60827214", "0.6078709", "0.60710627", "0.5975292", "0.5929827", "0.5683883", "0.5563117", "0.54974735", "0.5456722", "0.5456454", "0.53902227", "0.5383282", "0.5350695", "0.5304079", "0.5238655", "0.5233044", "0.51832956", "0.51791036", "0.5164402", "0.51333797", "0.513045...
0.5381867
12
discard items emitted by an Observable after a specified condition becomes false
@Test public void takeWhile() { Observable.interval(100, TimeUnit.SECONDS, mTestScheduler) .map(num -> num + 1) .take(7) .takeWhile(aLong -> aLong != 4) .subscribe(mList::add); mTestScheduler.advanceTimeBy(1000, TimeUnit.SECONDS); assertEquals(mList, Arrays.asList(1L, 2L, 3L)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void skipWhile() {\n Observable.fromIterable(sData)\n .skipWhile((item) -> {\n System.out.println(\"item = \" + item);\n return item.equalsIgnoreCase(\"abc\");\n }).subscribe(new MyObserver<>());\n }", "public static void...
[ "0.6544702", "0.6435292", "0.6112887", "0.5933153", "0.5747507", "0.5715463", "0.5617889", "0.5563855", "0.54449296", "0.5441216", "0.5368078", "0.5350539", "0.52228236", "0.52090657", "0.5200563", "0.5182953", "0.51809883", "0.51795566", "0.5174905", "0.51722205", "0.5164731...
0.5101564
25
Make the LiveData LeagueEntity observable
public LiveData<LeagueEntity> getLeague() { return observableLeague; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public LeagueTableBase getEntity() {\n LeagueTableBase leagueTable = new LeagueTableBase();\n\n leagueTable.setId(new LeagueTableBasePK(getId().getLeagueSeasonId(), getId().getTeamNo(), getId().getPredicted(), getId().getWeekNo()));\n leagueTable.setGameDate(this.gameDate);\n leagueTable.setPla...
[ "0.5898374", "0.55082905", "0.54966277", "0.5489158", "0.5346952", "0.5340667", "0.5275813", "0.5250629", "0.5222563", "0.52117556", "0.51654214", "0.51088494", "0.5107464", "0.5106105", "0.51026964", "0.5098615", "0.50943017", "0.50819653", "0.5070841", "0.5062602", "0.50381...
0.7993114
0
Use the rule to implement the given query. This will instantiate the rule against the query, run the new query against the whole reasoner+rawdata again and then rewrite the results from that query according the rule.
public ExtendedIterator execute(TriplePattern query, InfGraph infGraph, Finder data, HashSet firedRules) { RDFSInfGraph bRr = (RDFSInfGraph)infGraph; if (query.getSubject().isVariable()) { // Find all things of type resource return new ResourceRewriteIterator(bRr.findRawWithContinuation(body, data)); } else { // Just check for a specific resource Node subj = query.getSubject(); TriplePattern pattern = new TriplePattern(subj, null, null); String var = "s"; ExtendedIterator it = bRr.findRawWithContinuation(pattern, data); if (!it.hasNext()) { pattern = new TriplePattern(null, null, subj); var = "o"; it = bRr.findRawWithContinuation(pattern, data); if (!it.hasNext()) { pattern = new TriplePattern(null, subj, null); var = "p"; it = bRr.findRawWithContinuation(pattern, data); } } BRWRule rwrule = new BRWRule(new TriplePattern(Node.createVariable(var), TYPE, RESOURCE), body); return new RewriteIterator(it, rwrule); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract void applyToQuery(DatabaseQuery theQuery, GenerationContext context);", "public Query queryRule(String rule, Object... args) throws Exceptions.OsoException {\n Host new_host = host.clone();\n String pred = new_host.toPolarTerm(new Predicate(rule, Arrays.asList(args))).toString();\n ...
[ "0.6380523", "0.6047777", "0.5560555", "0.5560522", "0.5548836", "0.5406992", "0.53491896", "0.5288504", "0.52862334", "0.5241047", "0.523306", "0.51956743", "0.518545", "0.51222074", "0.5108073", "0.5088834", "0.5088207", "0.5087702", "0.50729245", "0.5057489", "0.50429916",...
0.591743
2
Return true if this rule is a a complete solution to the given query and the router need look no further
public boolean completeFor(TriplePattern query) { return head.subsumes(query); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean matchResult() {\n return !pathMatchDependencies.isEmpty();\n }", "boolean hasQuery();", "@Override\n\tpublic boolean CheckFacts(){\n\t\tqueries.add( query );\n\t\t\n\t\t// while there are still queries to be proven\n\t\twhile ( queries.size() > 0 )\n\t\t{\n\t\t\t// take the first query...
[ "0.6158143", "0.6067928", "0.5800235", "0.5691826", "0.5659112", "0.5659112", "0.5585804", "0.5585208", "0.5580247", "0.5508721", "0.5495961", "0.547901", "0.5472578", "0.5452428", "0.5450443", "0.54491454", "0.53979164", "0.53941286", "0.5379722", "0.53637415", "0.5341885", ...
0.6662964
0
Record a new instance of Resource so long as it has not been seen before
private void push(Node resource) { if (seen.add(resource)) { lookahead[nAvailable++] = new Triple(resource, TYPE, RESOURCE); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void handleNewResource() {\n System.out.println(\"Here at VMLeaseProcessor#handleNewResource\");\n callForBackup();\n resourceManager.createRedundant();\n }", "public Resource storeResource( Resource r );", "public synchronized Resource createUniqueResource() throws ModelException {\n\n...
[ "0.6620876", "0.6457194", "0.63378215", "0.62145853", "0.61882585", "0.6116511", "0.60979986", "0.6089751", "0.6047087", "0.60297716", "0.60211396", "0.60092527", "0.59873927", "0.59863997", "0.5984354", "0.596567", "0.59055835", "0.58875585", "0.58445174", "0.5831039", "0.58...
0.56592774
29
Creates new form Registration
public Registration() { initComponents(); handler = new ClientSocketHandler(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "UserRegistrationResponse registrationPost(RegistrationForm registrationForm);", "@RequestMapping(\"/register\")\r\n\tpublic ModelAndView register(@ModelAttribute(\"registerForm\") final UserRegisterForm form) {\r\n\t\treturn new ModelAndView(\"users/register\");\r\n\t}", "@GetMapping(\"/registration\")\n\t ...
[ "0.7493379", "0.7072342", "0.702028", "0.6972466", "0.6955177", "0.6947951", "0.6920914", "0.6830332", "0.6758642", "0.67431086", "0.6665234", "0.6647349", "0.6632788", "0.6632788", "0.6632788", "0.65853876", "0.65761566", "0.65601075", "0.6548096", "0.64678967", "0.6440578",...
0.0
-1
This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { buttonGroup1 = new javax.swing.ButtonGroup(); jPanel1 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); userNameTF = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); emailTF = new javax.swing.JTextField(); jLabel7 = new javax.swing.JLabel(); ageTF = new javax.swing.JTextField(); registerBtn = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); maleRBtn = new javax.swing.JRadioButton(); femaleRBtn = new javax.swing.JRadioButton(); passwordTF = new javax.swing.JPasswordField(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); jPanel3.setBackground(new java.awt.Color(249, 171, 220)); jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Registration")); jLabel4.setText("User Name"); jLabel5.setText("Password"); jLabel6.setText("Email"); jLabel7.setText("Age"); registerBtn.setText("Register"); registerBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { registerBtnActionPerformed(evt); } }); jLabel1.setText("Gender"); buttonGroup1.add(maleRBtn); maleRBtn.setText("Male"); buttonGroup1.add(femaleRBtn); femaleRBtn.setText("Female"); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(54, 54, 54) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel4) .addComponent(jLabel5)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(userNameTF, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE) .addComponent(passwordTF))) .addGroup(jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel7) .addComponent(jLabel6) .addComponent(jLabel1)) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(39, 39, 39) .addComponent(maleRBtn) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(femaleRBtn)) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(115, 115, 115) .addComponent(registerBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(41, 41, 41) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(ageTF, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(emailTF, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE)))))) .addContainerGap(105, Short.MAX_VALUE)) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(29, 29, 29) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(userNameTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(29, 29, 29) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5) .addComponent(passwordTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(29, 29, 29) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(emailTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(34, 34, 34) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) .addComponent(ageTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(maleRBtn) .addComponent(femaleRBtn) .addComponent(jLabel1)) .addGap(32, 32, 32) .addComponent(registerBtn) .addContainerGap(61, Short.MAX_VALUE)) ); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Form() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n }", "public frmRectangulo() {\n initComponents();\n }", "public form() {\n ...
[ "0.7321245", "0.7292375", "0.7292375", "0.7292375", "0.7286756", "0.7250393", "0.7215278", "0.7208825", "0.7197639", "0.71918", "0.7185626", "0.716065", "0.71489197", "0.7094757", "0.7081307", "0.7057363", "0.69892997", "0.6978972", "0.6956389", "0.69543713", "0.69465107", ...
0.0
-1
TODO : Find a way to mock the triggers
@Test public void testDoNotifyCommitWithSingleStream() throws Exception { AccurevTrigger aMasterTrigger = setupProjectWithTrigger("host", "8080", "stream1", "depot", false); AccurevStatus spy = Mockito.spy(new AccurevStatus()); spy.doNotifyCommit(requestWithNoParameters, "host", "8080", "stream1", "1", "testPrincipal", "Updated"); Mockito.verify(spy).doNotifyCommit(requestWithNoParameters, "host", "8080", "stream1", "1", "testPrincipal", "Updated"); assertEquals("HOST: host PORT: 8080 Streams: stream1", spy.toString()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract void onTrigger();", "public void trigger(List<Entity> _trigger){\n\t\tif(event!=null){\n\t\t\tevent.activate(System.currentTimeMillis(), _trigger);\n\t\t}\n\t}", "void trigger();", "private boolean triggered() {\n\t\treturn true;\n\t}", "public interface TriggerHandler {\n\n String handl...
[ "0.68646234", "0.6657912", "0.66340166", "0.6497036", "0.6462506", "0.63940775", "0.63810295", "0.6317664", "0.63040847", "0.6251105", "0.6196133", "0.619544", "0.6147868", "0.60678947", "0.6019345", "0.5991254", "0.5987018", "0.5944322", "0.59162253", "0.5892377", "0.5892339...
0.56005526
48
TODO : Find a way to mock the triggers
@Test public void testDoNotifyCommitWithTwoStreams() throws Exception { AccurevTrigger bMasterTrigger = setupProjectWithTrigger("host", "8080", "stream2", "depot", false); AccurevTrigger aMasterTrigger = setupProjectWithTrigger("host", "8080", "stream1", "depot", false); AccurevStatus spy = Mockito.spy(new AccurevStatus()); spy.doNotifyCommit(requestWithNoParameters, "host", "8080", "stream1", "1", "testPrincipal", "Updated"); Mockito.verify(spy).doNotifyCommit(requestWithNoParameters, "host", "8080", "stream1", "1", "testPrincipal", "Updated"); assertEquals("HOST: host PORT: 8080 Streams: stream1", spy.toString()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract void onTrigger();", "public void trigger(List<Entity> _trigger){\n\t\tif(event!=null){\n\t\t\tevent.activate(System.currentTimeMillis(), _trigger);\n\t\t}\n\t}", "void trigger();", "private boolean triggered() {\n\t\treturn true;\n\t}", "public interface TriggerHandler {\n\n String handl...
[ "0.68646234", "0.6657912", "0.66340166", "0.6497036", "0.6462506", "0.63940775", "0.63810295", "0.6317664", "0.63040847", "0.6251105", "0.6196133", "0.619544", "0.6147868", "0.60678947", "0.6019345", "0.5991254", "0.5987018", "0.5944322", "0.59162253", "0.5892377", "0.5892339...
0.56991965
38
TODO : Find a way to mock the triggers
@Test public void testDoNotifyCommitWitMultipleStreams() throws Exception { AccurevTrigger aMasterTrigger = setupProjectWithTrigger("host", "8080", "stream1", "depot", false); AccurevTrigger bMasterTrigger = setupProjectWithTrigger("host", "8080", "stream2", "depot", false); AccurevTrigger cMasterTrigger = setupProjectWithTrigger("host", "8080", "stream3", "depot", false); AccurevStatus spy = Mockito.spy(new AccurevStatus()); spy.doNotifyCommit(requestWithNoParameters, "host", "8080", "stream1,stream2", "1", "testPrincipal", "Updated"); Mockito.verify(spy).doNotifyCommit(requestWithNoParameters, "host", "8080", "stream1,stream2", "1", "testPrincipal", "Updated"); assertEquals("HOST: host PORT: 8080 Streams: stream1,stream2", spy.toString()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract void onTrigger();", "public void trigger(List<Entity> _trigger){\n\t\tif(event!=null){\n\t\t\tevent.activate(System.currentTimeMillis(), _trigger);\n\t\t}\n\t}", "void trigger();", "private boolean triggered() {\n\t\treturn true;\n\t}", "public interface TriggerHandler {\n\n String handl...
[ "0.68646234", "0.6657912", "0.66340166", "0.6497036", "0.6462506", "0.63940775", "0.63810295", "0.6317664", "0.63040847", "0.6251105", "0.6196133", "0.619544", "0.6147868", "0.60678947", "0.6019345", "0.5991254", "0.5987018", "0.5944322", "0.59162253", "0.5892377", "0.5892339...
0.5850014
26
/ Affichage de la page d'inscription
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setAttribute("message", "Bienvenue sur ce site en MVC"); RequestDispatcher rq = getServletContext().getRequestDispatcher("/WEB-INF/formulaire.jsp"); rq.forward(req, resp); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void afficher() {\n super.afficher();\n System.out.println(\"Sexe : \" + getSexe());\n System.out.println(\"Numéro de sécurité sociale : \" + getNumeroSecuriteSociale());\n System.out.println(\"Date de naissance : \" + getDateDeNaissance().format(DateTimeFormatter....
[ "0.6100153", "0.59706706", "0.5853512", "0.5828847", "0.5781248", "0.5746245", "0.5718242", "0.5699265", "0.56519645", "0.56477416", "0.56224895", "0.5571309", "0.5562923", "0.5554857", "0.5507193", "0.5499366", "0.5498099", "0.5492855", "0.5447723", "0.5421949", "0.5409815",...
0.0
-1
/ Valide l'adresse mail saisie
private void validationEmail(String email) throws Exception { if (email != null && email.trim().length() != 0) { if (!email.matches("([^.@]+)(\\.[^.@]+)*@([^.@]+\\.)+([^.@]+)")) { throw new Exception("Merci de saisir une adresse mail valide."); } } else { throw new Exception("Merci de saisir une adresse mail."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String adcionarEmail() {\n\t\tpessoa.adicionaEmail(email);\n\t\tthis.email = new Email();\n\t\treturn null;\n\t}", "String getUserMail();", "public void setMailing(String mail) {\n mailing = mail;\n }", "public String getMail() {\r\n\t\treturn mail;\r\n\t}", "public synchronized String get...
[ "0.7339011", "0.705475", "0.70253354", "0.7003911", "0.68891466", "0.68231696", "0.68093234", "0.6780108", "0.6780108", "0.6780108", "0.6780108", "0.6780108", "0.6780108", "0.6774574", "0.6756112", "0.6726197", "0.66952807", "0.66726553", "0.6621977", "0.6539143", "0.65190095...
0.0
-1
/ Valide les mots de passe saisis
private void validationMotsDePasse(String motDePasse, String confirmation) throws Exception { if (motDePasse != null && motDePasse.trim().length() != 0 && confirmation != null && confirmation.trim().length() != 0) { if (!motDePasse.equals(confirmation)) { throw new Exception("Les mots de passe entrés sont différents, merci de les saisir à nouveau."); } else if (motDePasse.trim().length() < 8) { throw new Exception("Les mots de passe doivent contenir au moins 8 caractères."); } } else { throw new Exception("Merci de saisir et confirmer votre mot de passe."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Password getPsw();", "@Override\n\t\t\tpublic void onTextChanged(CharSequence s, int start, int before, int count) {\n\t\t\t\tu.setPassword(s.toString());\n\t\t\t\n\t\t\t}", "public char[] getPassword() {\r\n return senha;\r\n }", "String getUserPassword();", "String getPassword();", "String ge...
[ "0.6815945", "0.673235", "0.6562615", "0.6556795", "0.65436935", "0.65436935", "0.65436935", "0.65436935", "0.65436935", "0.65436935", "0.65436935", "0.65436935", "0.65436935", "0.6504651", "0.6488158", "0.64771456", "0.64441794", "0.64441794", "0.64441794", "0.64441794", "0....
0.0
-1
Instantiates a new booking quota exceeded excpetion.
public BookingQuotaExceededExcpetion(Quota quota, double limit, String userid) { this.quota = quota; this.quotaLimit = limit; this.userId = userid; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public BookingQuotaExceededExcpetion(String message, Quota quota, double limit, String userid) {\n\t\tsuper(message);\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "public BookingQuotaExceededExcpetion(Throwable cause, Quota quota, double limit, String userid) {\n\t\tsu...
[ "0.64679694", "0.6338044", "0.62430686", "0.6066136", "0.59528124", "0.5880841", "0.5830902", "0.57992095", "0.57834023", "0.5645203", "0.5579128", "0.5569882", "0.5505068", "0.54121745", "0.5407174", "0.53861135", "0.53693056", "0.53499424", "0.53433067", "0.5323099", "0.532...
0.6543666
0
Instantiates a new booking quota exceeded excpetion.
public BookingQuotaExceededExcpetion(String message, Quota quota, double limit, String userid) { super(message); this.quota = quota; this.quotaLimit = limit; this.userId = userid; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public BookingQuotaExceededExcpetion(Quota quota, double limit, String userid) {\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "public BookingQuotaExceededExcpetion(Throwable cause, Quota quota, double limit, String userid) {\n\t\tsuper(cause);\n\t\tthis.quota = quota;\...
[ "0.6543666", "0.6338044", "0.62430686", "0.6066136", "0.59528124", "0.5880841", "0.5830902", "0.57992095", "0.57834023", "0.5645203", "0.5579128", "0.5569882", "0.5505068", "0.54121745", "0.5407174", "0.53861135", "0.53693056", "0.53499424", "0.53433067", "0.5323099", "0.5320...
0.64679694
1
Instantiates a new booking quota exceeded excpetion.
public BookingQuotaExceededExcpetion(Throwable cause, Quota quota, double limit, String userid) { super(cause); this.quota = quota; this.quotaLimit = limit; this.userId = userid; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public BookingQuotaExceededExcpetion(Quota quota, double limit, String userid) {\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "public BookingQuotaExceededExcpetion(String message, Quota quota, double limit, String userid) {\n\t\tsuper(message);\n\t\tthis.quota = quota;...
[ "0.6543666", "0.64679694", "0.62430686", "0.6066136", "0.59528124", "0.5880841", "0.5830902", "0.57992095", "0.57834023", "0.5645203", "0.5579128", "0.5569882", "0.5505068", "0.54121745", "0.5407174", "0.53861135", "0.53693056", "0.53499424", "0.53433067", "0.5323099", "0.532...
0.6338044
2
Instantiates a new booking quota exceeded excpetion.
public BookingQuotaExceededExcpetion(String message, Throwable cause, Quota quota, double limit, String userid) { super(message, cause); this.quota = quota; this.quotaLimit = limit; this.userId = userid; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public BookingQuotaExceededExcpetion(Quota quota, double limit, String userid) {\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "public BookingQuotaExceededExcpetion(String message, Quota quota, double limit, String userid) {\n\t\tsuper(message);\n\t\tthis.quota = quota;...
[ "0.6543666", "0.64679694", "0.6338044", "0.6066136", "0.59528124", "0.5880841", "0.5830902", "0.57992095", "0.57834023", "0.5645203", "0.5579128", "0.5569882", "0.5505068", "0.54121745", "0.5407174", "0.53861135", "0.53693056", "0.53499424", "0.53433067", "0.5323099", "0.5320...
0.62430686
3
Gets the quota which caused the exception.
public Quota getQuota() { return this.quota; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public double getQuotaLimit() {\n\t\treturn this.quotaLimit;\n\t}", "public Integer getMaxQuota() {\n return (Integer) getAttributeInternal(MAXQUOTA);\n }", "public BookingQuotaExceededExcpetion(Throwable cause, Quota quota, double limit, String userid) {\n\t\tsuper(cause);\n\t\tthis.quota = quota;\n...
[ "0.71137136", "0.6559031", "0.65450436", "0.63590276", "0.6333624", "0.63271666", "0.6276849", "0.6263417", "0.6250788", "0.6228926", "0.6213612", "0.60375255", "0.5945749", "0.5926313", "0.5914749", "0.5893393", "0.58165014", "0.5760774", "0.5754853", "0.57297915", "0.571593...
0.68137497
1
Gets the quota limit which caused the exception.
public double getQuotaLimit() { return this.quotaLimit; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Integer getMaxQuota() {\n return (Integer) getAttributeInternal(MAXQUOTA);\n }", "public Integer getLimit() {\n return limit;\n }", "public int getLimit() {\n return limit;\n }", "public int getLimit() {\r\n return limit;\r\n }", "public int getLimit() {\n ...
[ "0.7208618", "0.6961902", "0.69052416", "0.6872428", "0.6860288", "0.6860288", "0.6860288", "0.68407315", "0.67767215", "0.67767215", "0.67575186", "0.674802", "0.67212355", "0.6719115", "0.6689294", "0.66802216", "0.6680191", "0.66715896", "0.6666145", "0.66656196", "0.66656...
0.7673859
0
Gets the user id affected by the quota.
public String getUserId() { return userId; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Integer getUserId();", "public int getUserId() {\n return instance.getUserId();\n }", "long getUserId();", "long getUserId();", "public long getUserId();", "public long getUserId();", "public long getUserId();", "public long getUserId();", "@Override\n\tpublic long getUserId() {\n\t\treturn...
[ "0.724852", "0.72258556", "0.7203544", "0.7203544", "0.7191068", "0.7191068", "0.7191068", "0.7191068", "0.7168225", "0.71221715", "0.7122104", "0.70847696", "0.7064446", "0.705766", "0.70506406", "0.7042", "0.7042", "0.7006341", "0.7000642", "0.7000642", "0.7000642", "0.69...
0.0
-1
/ Implement in java. Read this below two array. Find the lowest difference between the two array cell.
public static void main(String[] args) { int [] array1 = {30,12,5,9,2,20,33,1}; int [] array2 = {18,25,41,47,17,36,14,19}; int a=array1.length; int b=array2.length; System.out.println("The lowest differenc between two array is :"+findLowestDiff(array1,array2,a,b)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int smallestDifference(int[] A, int[] B) {\n\t\tint[] longArray = A.length > B.length ? A : B;\n\t\tint[] shortArray = A.length > B.length ? B : A;\n\t\tArrays.sort(longArray);\n\t\tint min = Integer.MAX_VALUE;\n\t\tfor (int i = 0; i < shortArray.length; i++) {\n\t\t\tint a = min(longArray, shortArray[i]);\...
[ "0.72184116", "0.6863406", "0.6818696", "0.68087506", "0.6760237", "0.6636966", "0.65739524", "0.64859587", "0.6470515", "0.6467224", "0.6467047", "0.6441139", "0.6439312", "0.6420027", "0.6419708", "0.64089847", "0.64071757", "0.63635814", "0.63020265", "0.63001835", "0.6282...
0.7821728
0
User can write a message on a text input User can send the message he or she has written to the server by pressing submit User can send the message he or she has written to the server by pressing enter
@Test public void UserCanWriteAndSendAMessage() { proLogin(proWait); handler.getDriver("user").navigate().refresh(); // User to queue waitAndFillInformation(userWait); // User from queue waitAndPickFromQueue(proWait); // User can write message waitChatWindowsAppear(userWait).sendKeys("yy kaa koo"); // Can send it By Pressing Submit waitElementPresent(userWait, By.name("send")).submit(); assertEquals("", waitChatWindowsAppear(userWait).getText()); assertTrue(waitForTextToAppear(userWait, "yy kaa koo")); // Can send it By Pressing Enter waitChatWindowsAppear(userWait).sendKeys("kaa koo yy"); waitChatWindowsAppear(userWait).sendKeys(Keys.ENTER); assertEquals("", waitChatWindowsAppear(userWait).getText()); assertTrue(waitForTextToAppear(userWait, "kaa koo yy")); endConversationPro(proWait); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void actionPerformed(ActionEvent e) {\n\n if (inputField.getText().trim().length() == 0) {\n return;\n }\n try {\n\n String input = inputField.getText();\n \n inputField.setText(\"\");\n clientMessage = new Message(getName(), Messag...
[ "0.72368264", "0.72356224", "0.6910392", "0.6848576", "0.68008393", "0.68000764", "0.677979", "0.67144024", "0.66980124", "0.6672051", "0.6589405", "0.65543705", "0.6511921", "0.650395", "0.6478154", "0.6477585", "0.6468366", "0.64593846", "0.6455347", "0.6446797", "0.6429522...
0.60721445
48
Keep token secured, use System.getenv("$TOKEN_VARIABLE")
public DiscordBot() throws LoginException { // 1. Setup a EnumSet of GatewayIntent and load all permissions to list EnumSet<GatewayIntent> gatewayIntents = initializeGateways(); // 2. Build JDA Api configuration with api token and permission list API = JDABuilder.create(TOKEN, gatewayIntents).build(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void GuardarToken(String token){\n SharedPreferences.Editor edits = prefs.edit();\n edits.putString(MYConstantsPreferences.MAQUIPURAY_TOKEN, token);\n edits.apply();\n }", "private void enviarTokenRegistro(String token){\n Log.d(TAG, token);\n }", "public void storeToke...
[ "0.67838365", "0.6414537", "0.6407305", "0.63325936", "0.62021", "0.61989695", "0.61762446", "0.61762446", "0.61762446", "0.61762446", "0.61762446", "0.61762446", "0.61629534", "0.61446965", "0.61392593", "0.6053133", "0.6053133", "0.6053133", "0.6053133", "0.6053133", "0.605...
0.0
-1
1. Create method with return type of EnumSet with no params
private EnumSet<GatewayIntent> initializeGateways() { return EnumSet.allOf(GatewayIntent.class); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@SafeVarargs\r\n\tpublic static <A extends Enum<A>> Set<A> hardenumset(A... elems)\r\n\t{\n\t\tif(elems.length == 0)\r\n\t\t{\r\n\t\t\treturn Collections.emptySet();\t\r\n\t\t}\r\n\t\t\r\n\t\tEnumSet<A> eset = EnumSet.of(elems[0]);\r\n\t\t\r\n\t\tfor(int i = 1; i < elems.length; i++)\r\n\t\t\t{ eset.add(elems[i]);...
[ "0.6251736", "0.594286", "0.58312863", "0.58175373", "0.5759125", "0.5731814", "0.5662234", "0.5619976", "0.55426985", "0.5470262", "0.54600704", "0.54210275", "0.541784", "0.53766096", "0.53594995", "0.53581333", "0.53317374", "0.52939284", "0.52821", "0.5276603", "0.5253282...
0.0
-1