method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b2b14e97-83ee-409f-8f07-8f4539b34e49
1
private synchronized Container getWindow() { if (window == null) { window = createWindow(); } return window; }
9cede300-c541-4e34-9c6a-efe7908e7392
8
public synchronized Object toJavaObject( int idx ) throws LuaException { Object obj = null; if (isBoolean(idx)) { obj = new Boolean(toBoolean(idx)); } else if (type(idx) == LuaState.LUA_TSTRING.intValue()) { obj = toString(idx); } else if (isFunction(idx)) { obj = getLuaObject(idx); } e...
b7c096c1-329e-4808-8b4f-eb3deb038911
8
private int readFrameType(final Object[] frame, final int index, int v, final char[] buf, final Label[] labels) { int type = b[v++] & 0xFF; switch (type) { case 0: frame[index] = Opcodes.TOP; break; case 1: frame[index] = Opcodes.INTEGER; ...
7bd5762b-fe13-4ea8-b104-bd099d2c2a0c
5
public void addListener() { itemtf[4].addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent arg0) { if (!itemtf[4].getText().equals("")) { String name = logic.showTeacherName(itemtf[4].getText()); itemtf[5].setText(name); } } @Override public void focusGai...
eeff2101-eaa7-4e9b-8567-71fbb29464e6
2
@Test @SuppressWarnings("unused") public void testSynchronize() { final int ITERATIONS = 1000000; watch.start("Without synchronized... "); int j = 0; for (int i = 0; i < ITERATIONS; i++) { j += (i + 23) * 25; j >>= 1; j |= (i << 3); j &= 0xFFFFFFF; } watch.stop("%.6f seconds.\n"); long ...
9c3035dc-4a48-422f-b5ca-e7027184c344
4
public static String buildDelimString(final String[] elements, final char delimiter, final char qualifier) { final StringBuilder sb = new StringBuilder(); for (int i = 0; i < elements.length; i++) { if (i > 0) { sb.append(delimiter); } if (qualifier !=...
6fc18a1a-68ff-4739-b7d6-976e2da1cd6e
9
private boolean getKeywordsInSentence(String sen, Integer index) { boolean found = false; boolean found_temp = false; if(this.keyphases == null) { return found; } Iterator<String> it = this.keyphases.iterator(); while (it.hasNext()) { String s = it.next(); if(s.indexOf("/") != -1) { String[] ke...
5c04dd0a-7c03-4dda-abca-d6c01975d439
9
private static int parseGroupId(char[] data, int i, int end, Term term, Hashtable gmap) throws PatternSyntaxException{ int id; int nstart=i; if(Character.isDigit(data[i])){ while(Character.isDigit(data[i])){ i++; if(i==end) throw new PatternSyntaxException("group_id ex...
8de2f4e1-df7c-461a-b48e-7a8135477622
2
public static int search_function_by_name(Function_table function_table, String name) { int num = function_table.function_name.size(); for (int i = 0; i < num; i++) { if (function_table.function_name.get(i).toString().equals(name)) { return i; } } ...
8fb51753-c743-4a08-bd32-27056cd749f2
6
@Override public UsuarioInt obtenerUsuarioL(int cedula){ @SuppressWarnings("Convert2Diamond") UsuarioInt result = new UsuarioImp(); FileReader archivo = null; String linea; StringTokenizer st; try { archivo = new FileReader("Us...
b1923266-8070-4e20-b7c8-0d0617367785
1
public void calculateTotalsEP() { for (double ep : consumptionEnergyPoints) systemConsumptionEP += ep; }
ae58a574-dd42-4a57-8a69-d908918551f3
6
@Override public void collides(Entity... en) { for (BulletBounce e : b) { e.collides(en); } if (dead) { return; } for (Entity e : en) { if (e == this || e.cull()) { continue; } Polygon p = e.getBounds(); if (shape.intersects(e.getBounds())) { takeDamage(e.doDamage()); e.takeDama...
d6742073-99bf-425a-84ff-57db76afc28b
8
@Override protected void process() { super.process(); Actor actor = ai.getActor(); int actorX = actor.getMapX(); int playerX = registry.getClosestPlayerX(actor.getCenterPoint(), registry.getScreenWidth()); int distance = Math.abs(playerX - actorX); ...
2c712507-b8bb-47ee-959a-1d80e742b167
9
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=getTarget(mob,commands,givenTarget); if(target==null) return false; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=proficiency...
837aa94c-6848-48d5-9acb-8df741ce3b18
4
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Vertex other = (Vertex) obj; if (id != other.id) { return false; } return true; }
a4885dfe-b429-4074-b904-ad06fe2c6b8e
5
private static void merge(Comparable[] a, Comparable[] aux, int lo, int mid, int hi) { for (int k = lo; k <= hi; k++) { aux[k] = a[k]; } int i = lo, j = mid+1; for (int k = lo; k <= hi; k++) { if (i > mid) { a[k] = aux[j++]; ...
fe733676-6be3-45fd-9c7a-cd27861fe86c
1
private static TreeMap<Long, User> loadtestDataInMemory() throws IOException { System.out.println("Start Loading Test Data"); TreeMap<Long, User> userMap = new TreeMap<Long, User>(); BufferedReader fileReader = new BufferedReader(new FileReader(testDataDirectory)); while (fileReader.ready()) { String line ...
1eb39d6f-ab9f-4931-b0b2-91b03dff7c83
5
public boolean create(String name) { Connection conn = null; PreparedStatement ps = null; try { conn = iConomy.getiCoDatabase().getConnection(); ps = conn.prepareStatement("INSERT INTO " + Constants.SQLTable + "(username, balance, hidden) VALUES (?, ?, 0)"); ps.setString(1, name); ...
72d264dd-22fe-48e2-ac49-a32a1156c448
4
public void initialisation() { this.getContentPane().setBackground(Color.WHITE); this.popupParties.getContentPane().setBackground(Color.WHITE); this.popupNouveauProfil.getContentPane().setBackground(Color.WHITE); this.popupParametres.getContentPane().setBackground(Color.WHITE); ...
c3dadb51-4668-468c-974f-55e069a5d1f8
3
public Vector3 abs() { if(x < 0) x = -x; if(y < 0) y = -y; if(z < 0) z = -z; return this; }
0e2c9e92-d6d7-4ea7-b8c6-478782f24466
3
*/ public Long getAssertionDate(CycAssertion cycAssertion) throws UnknownHostException, IOException, CycApiException { String command = makeSubLStmt("asserted-when", cycAssertion); Object date = converseObject(command); if (date instanceof Integer) { return ((Integer) date).longValue(); ...
054fbac5-501b-414f-b6ca-90b709e590e0
5
@Override public boolean equals(final Object obj) { // Auto-generated using Eclipse if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } GenericTeln...
a2f53c1b-bfae-427c-a38e-977cc5413ff5
1
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); response.setCharacterEncoding("UTF-8"); request.setCharacterEncoding("UTF-8"); String msj_exito =...
4574ba77-8ec9-44a7-bc7f-2602dcd367ea
0
public static boolean isValidXMLElementName(String text) { return isValidXMLAttributeName(text); }
2c74bf93-bd96-4317-9e11-3fa1167de60b
5
public static int numOfParameters(String desc) { int n = 0; int i = 1; for (;;) { char c = desc.charAt(i); if (c == ')') break; while (c == '[') c = desc.charAt(++i); if (c == 'L') { i = desc.indexO...
39ec2bd7-7f7e-485d-9320-2ce32bae40f7
9
public void loadBoard() { ArrayList<Piece> p1Pieces = new ArrayList<Piece>(); ArrayList<Piece> p2Pieces = new ArrayList<Piece>(); try { for(int i = 0; i < 8; i ++) { p1Pieces.add(new Pawn(Loyalty.RED)); } p1Pieces.add(new Rook(Loyalty.RED)); p1Pieces.add(new Knight(Loyalty.RED)); p1Pie...
f0aaf120-d808-4862-afc0-6d44d76bddfe
9
public void run() { int seconds = 0; while(connected) { if(pausing) { seconds = 0; acceptServerInput(); synchronized(this) { notifyAll(); } } try { Thread.sleep(1000); } catch(InterruptedException e) { // nah } seconds = (seconds + 1) % idleTimeout; if(second...
3cee2e07-c0ce-49d9-bb43-4762988cfbae
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof PlayerMessage)) return false; PlayerMessage other = (PlayerMessage) obj; if (message == null) { if (other.message != null) return false; } else if (!message.equals...
a6eb0c98-3e27-4d4d-8803-62b067b3e05e
2
public BillItem findBillItem(int billId, int medicineId) { String query = "SELECT `billItem`.`billId`, " + " `billItem`.`medicineId`, " + " `billItem`.`quantity` " + " FROM `billItem` " + " WHERE `billItem`.`billId` = '%d'" ...
2ef4fadf-e439-4992-a8b3-32bb12d74d5e
4
public String handle(String cmd) { if (cmd.equals("clear")) { cp.clear(); return ""; } else if (cmd.startsWith("new")) { return handleCreate(cmd); } else if (cmd.startsWith("del")) { return handleDelete(cmd); } else if (cmd.startsWith("con"...
dcad7b79-fa49-4b73-85c2-037921a6e68e
1
public boolean setStandardButtonMinWidth(int width) { boolean ret = true; if (width <= 0) { this.buttonStd_Width = UISizeInits.STD_BTN.getWidth(); ret = false; } else { this.buttonStd_Width = width; } somethingChanged(); return ret; ...
6ecba28b-4662-4929-93ef-6b926fff6f16
2
@Test public void test_intersection() throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(baos); HLLCounter hll0 = new HLLCounter(true); for (int i=0; i<1000000; i++) { hll0.put(Hashing.md5().hashString(Integer.toString(i)...
8935e4a3-fa66-434b-b93c-603da83687ed
8
@Test public void testUnblockNotRunning() { LOGGER.log(Level.INFO, "----- STARTING TEST testCloseBeforeUnblock -----"); try { server1.startThread(); } catch (IOException | ServerSocketCloseException | FeatureNotUsedException e) { exception = true; } wa...
45f2882c-62c3-4b28-8791-5fe98ba7a603
2
public ToggleOutlineItem(final BasicGraphEditor editor, String name) { super(name); setSelected(true); addActionListener(new ActionListener() { /** * */ public void actionPerformed(ActionEvent e) { final mxGraphOutline outline = editor.getGraphOutline(); outline.setVisibl...
d80450f2-218e-4ab6-9781-4a5a0fb396e8
4
private char[][] remplirTabChar(String k) { char[][] c= new char[5][5]; String key=this.adapterCle(k).toString(); ArrayList<Character> a=new ArrayList<Character>(); int r=0; a.add(CHAR_INEXISTANT); a.add(' '); for(int i=0;i<key.length()-1;i++) { if(!a.contains(key.charAt(i))) { a.add(key.charAt(i))...
79ec6aa1-eb19-465d-b49c-b3498c43aef5
0
protected void execute() { Robot.tilter.move(Robot.oi.getTilterAxis()*Tilter.SPEED_DEFAULT); }
c5ec81eb-2a9c-4611-bf23-95859f02fe1b
1
@Override public void finalize() throws Throwable { if(isAlive()) stop(); super.finalize(); }
d75a02fb-253c-4f91-90f2-95c84447381d
7
protected void movesToward(VGDLSprite target) { double distance = this.physics.distance(rect, target.rect); if(maxDistance != -1 && distance > maxDistance) { //We have a maximum distance set up, and the target is further than that. // -> We don't react to this target...
a5f1bbeb-b7d7-4642-b213-dc79e46cd2e4
0
private void drawStateOutput(Graphics g, State state, Point point, Color color) { String output = ((MooreMachine) state.getAutomaton()).getStateDescription(state); int ascent = g.getFontMetrics().getAscent(); int heights = 0; int textWidth = 0; Rectangle2D ...
36e5ff26-a4e1-410d-800a-c59e4ff9827a
8
@Override public int compareTo(Country country) { if (this.gold > country.gold) { return -1; } else if (this.gold == country.gold) { if (this.silver > country.silver) { return -1; } else if (this.silver == country.silver) { if (this.bronze > country.bronze) { return -1; } else i...
a3e7f91a-10a1-4539-a2b6-2008c236ec95
4
public List<Actor> getObjects(Class<? extends Actor> actorClass) { if(actorClass == Actor.class) return actorList; ArrayList<Actor> objectsAtPosition = new ArrayList<>(); for (Actor actor : actorList) { if(actorClass.isAssignableFrom(actor.getClass())) ...
e01c536f-19dc-468f-8347-2d9db55a48c2
2
public void disable() throws IOException { // This has to be synchronized or it can collide with the check in the task. synchronized (optOutLock) { // Check if the server owner has already set opt-out, if not, set it. if (!isOptOut()) { configuration.set("opt-out"...
414d094f-c134-42f7-97ee-376c5bb5f9b2
8
@Override public String executer(HttpServletRequest req) throws CommandeException { String idProduit = req.getParameter("idProd"); String action = req.getParameter("action"+idProduit); ProduitBean pb; Integer quantite = 0; ArrayList<ElementPanier> li...
aae8bf1c-4663-4b53-b5fb-cce659b4b880
6
public Justification copy() { { Justification self = this; { Justification copy = null; Cons antecedents = Stella.NIL; if (Surrogate.subtypeOfP(Stella_Object.safePrimaryType(self), Logic.SGT_LOGIC_PRIMITIVE_STRATEGY)) { { PrimitiveStrategy self000 = ((PrimitiveStrategy)(self)); ...
c44923ae-df51-48ca-b6c7-41ba971a346f
5
public boolean fillBuffer(int min) { if (closed) return false; assert buffer.length >= min; int read = 0; try { while (read != -1 && bufferLimit < min) { read = connection.getInputStream().read(buffer, bufferLimit, buffer.length - bufferLimit); bufferLimit += read; } } catch (IOException e) {...
3a81b9a1-1550-445c-9c4b-81f6e8f8f294
9
@Override public void setValueAt(Object o, int row, int col) { Order or = info.get(row); switch (col) { case 0 : or.getOrderName(); break; case 1 : or.getDueDate(); break; case 2 : or.getSleeve().getMaterial().getName(); break; case 3 : or.getS...
c969265d-e154-484b-8d6a-768554bbb8da
8
public void damageItem(int par1, EntityLiving par2EntityLiving) { if (this.isItemStackDamageable()) { if (par1 > 0 && par2EntityLiving instanceof EntityPlayer) { int var3 = EnchantmentHelper.getUnbreakingModifier(((EntityPlayer)par2EntityLiving).inventory); ...
14d6e104-f352-4259-b7f6-32d1ef27c580
8
@Override public DenseMatrix64F getQ( DenseMatrix64F Q , boolean compact ) { if( compact ) { if( Q == null ) { Q = CommonOps.identity(numRows,minLength); } else { if( Q.numRows != numRows || Q.numCols != minLength ) { throw new Ille...
9d7df1a6-4a4c-4749-93d3-c8cb683e1742
4
public static List<TestSetInfo> getTestSets(HierarchicalConfiguration testsetsData) { List<TestSetInfo> testsetInfos = new ArrayList<TestSetInfo>(); if (testsetsData != null) { List<HierarchicalConfiguration> testsets = testsetsData.configurationsAt(TESTSET_TAG); if (testsets != null &&...
9aeb8e81-8280-4383-8e0f-6a2844c52093
9
public final void run() { anInt1963++; for (;;) { int i; synchronized (this) { for (;;) { if (anIOException1968 != null) { return; } if ((anInt1956 ^ 0xffffffff) == -1) { i = -1 + (anInt1957 - anInt1960); } else if ((anInt1960 ^ 0xffffffff) <= (anInt1956 ^ 0xffffffff)) { ...
c35fb341-2d3d-43bf-96a2-b077cb7a13a5
3
public static int getLargestConnectedComponent() { int max = 0; for (LinkedList<Person> component : components) if (component.size() > max) max = component.size(); if (max > maxMaxComponentSize) maxMaxComponentSize = max; maxComponentSizes.put(stopWatch.getElapsedTime(), max / (double) numPeople); r...
0968691e-c969-4ac9-8d31-95aad1161ee3
2
public CreatePark() { //setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE); setTitle("停车场管理"); setBounds(100, 100, 450, 367); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblNewLabel = new J...
bb5120eb-b6f6-43f7-a2e2-aa25332dc2ab
1
public int tLineCount(){ int count= 1; if(identifiers != null) count += identifiers.tLineCount(); return count; }
b3fa1c9e-fe48-4030-8c0b-ffeb47c268a1
6
@EventHandler(priority=EventPriority.LOW) public void sheepShear(PlayerShearEntityEvent event) { if(event.isCancelled()) return; Player play = event.getPlayer(); EntityType mob = event.getEntity().getType(); if((MCListeners.isMultiWorld()) && (!play.hasPermission("...
714c138c-ccac-487b-92cc-ac9e25537954
3
@Test public void testIllegalConstruction() { Edge edge; try { edge = new Edge(null, testTile1, true); fail("IllegalArgumentException was expected"); } catch (IllegalArgumentException e){ //expected exception } try { edge = new Edge(null, null, false); fail("IllegalArgumentException was expe...
23505b33-3083-4739-887e-000ce79892e3
6
public static void main(String[] args) throws IOException, TemplateException { Options options = configureOptions(); CommandLine line = null; try { CommandLineParser parser = new PosixParser(); line = parser.parse(options, args); if (line.hasOption(HELP) || !line.hasOption(ROM)) { ...
11eea130-e99d-4910-8bd4-26195355992e
7
public static void main(String[] args) { System.out.println("Veuillez saisir l'erreur globale"); BufferedReader keyboard=new BufferedReader(new InputStreamReader(System.in)); String line=""; //init System.out.println("Texte::"); try{ line=keyboard.readLine();//Recup du texte }catch(IOException e){ Sy...
20f9c7a0-0b54-428a-8ce9-703bfacc08eb
0
@Override public String toString() { Property p=this.getProperty(); return "Query ("+this.totalNodes+" elements) "+p.toString(); }
10d68915-4e9f-403b-acea-aafa0732077f
9
public static void pprintArguments(Vector arguments, boolean separatelinesP, boolean omitlastargumentP, org.powerloom.PrintableStringWriter stream) { if (arguments == null) { return; } { Iterator argumentsiterator = (omitlastargumentP ? arguments.butLast() : ((Iterator)(arguments.allocateIterator())))...
22e6cde0-5886-4879-812a-ec334c18848c
4
public void start(String[] args) { Config.parseCommandLineArguments(args); try { Display.setTitle(windowTitle); Display.setFullscreen(fullscreen); Display.setVSyncEnabled(vsync); if (!fullscreen) { Display.setDisplayMode(new DisplayMode(wid...
ad0f0c5c-d8ef-4bf9-94a2-c10504d4ad4d
5
private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException { boolean isValueNumeric = false; try { if (value.equals("0") || !value.endsWith("0")) { Double.parseDouble(value); isValueNumeric = true; ...
5fd492b9-f130-4591-85b7-b70c6aa619fc
6
private String compare(String leftHandSide, String rightHandSide) { if (leftHandSide.equals(INTEGER)) { if (rightHandSide.equals(INTEGER)) { return INTEGER; } else if (rightHandSide.equals(REAL)){ return REAL; } else { SemanticW...
94e8ce4f-9e73-472a-8bf8-46fd6453df85
2
@Override public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception { Contexto oContexto = (Contexto) request.getAttribute("contexto"); oContexto.setVista("jsp/mensaje.jsp"); AlumnoBean oAlumnoBean = new AlumnoBean(); AlumnoDao oAlumnoDao = new ...
a35ac02a-abed-4ae6-94d0-681941dade11
4
@Override public synchronized boolean loginClient(ClientInterface client, String name) throws RemoteException { boolean result; //Der Host connected sich zuerst if(_connectedClients.isEmpty()) { _hostName = name; } if(_connectedClients.containsKey(name) || _connectedClients.containsValue(clien...
027ddb29-8b75-4c0f-a3af-dd24006adf4d
8
public void up(int x, int y){ int tempIndex; for (int i=0; i < options.size(); i++){ options.get(i).up(x, y); tempIndex = options.get(i).getCurrentIndex()-1; if(!text.isEmpty()){ switch (tempIndex){ case (0): text.get(i).setString("...
17c3baa1-acc6-4c18-b99b-b2b931c4f5cb
3
public static int getLargestPhysicalDistance() { double maxDist = 0.0; for (Person[] connection : hardConnections) { double dist = Math.sqrt( (connection[0].getX()-connection[1].getX())*(connection[0].getX()-connection[1].getX()) + (connection[0].getY()-connection[1].getY())*(connection[0].getY()-conne...
5cf9a03d-eed1-4add-a793-b5295b3358f2
3
public synchronized long update(HTSMsg msg) { HTSMsg chann = events.get(((Number)msg.get(EVENTID)).longValue()); for (String name : msg.keySet()){ if (Arrays.asList(HTSMsgFields).contains(name)){ chann.put(name, msg.get(name)); } else if (name.equals("method")){ //This is normal, do nothing.....
86e11650-b5e9-4948-aaa8-cedb0cfefad8
3
public static void Cliente_Lista(String nome, InterfaceControlador ic_cliente){ /** This array will receive a copy of the list of objects from the Controller */ ArrayList<String> ALS = null; try { ALS = ic_cliente.lista(); } catch (RemoteException e1) { ...
dc381125-ca46-4798-a27c-28f57462a58d
7
public Node run(ArrayList<Node> parameters) { Node bindNodes = parameters.get(0).getCar().clone(); Node executionNode = parameters.get(0).getCdr().clone(); do { Node temp = bindNodes.getCar().clone(); String variableId = temp.getToken().getText(); SymTabEntry...
1649558c-0808-4d5d-a254-155176c0052b
0
public String getId() { return id; }
e9a8390a-502b-4d41-bd99-55240e0226f0
3
private void spawnRandom() { Random random = new Random(); boolean notValid = true; while(notValid){ int location = random.nextInt(ROWS*COLS); int row = location / ROWS; int col = location%COLS; Tile current = board[row][col]; if(current == null){ int value = random.nextInt(10)<9?2:4; Ti...
523cd5b2-d369-462c-8770-37f86a129b56
0
protected Quantity(double value, Unit unit) { this.value = value; this.unit = unit; }
bf1886e7-8095-4708-9302-96eab3fb460e
0
@Test public void runTestLoop1() throws IOException { InfoflowResults res = analyzeAPKFile("GeneralJava_Loop1.apk"); Assert.assertEquals(1, res.size()); }
ed0e0240-6d23-47a5-8698-c1758ff4dac2
4
public boolean peutCreerSujet(Utilisateur utilisateur) { return ( utilisateur != null && ( utilisateur.getRole().getValeur() >= getSujetRoleMinimum().getValeur() || (getJeuAssocie() != null && ( getJeuAssocie().g...
85ed3c66-e053-4ffd-8ab8-3c7e18f94407
2
public void fillSuccessors() { if (jump != null) flowBlock.addSuccessor(jump); StructuredBlock[] subs = getSubBlocks(); for (int i = 0; i < subs.length; i++) { subs[i].fillSuccessors(); } }
1f17e6e7-297a-4650-b327-985698677915
1
private void deallocate_page (PageId pageno) throws BufMgrException { try { SystemDefs.JavabaseDB.deallocate_page(pageno); } catch (Exception e) { throw new BufMgrException(e, "BUFMGR: deallocate_page() failed"); } // end try } // end deallocate_page()
76671f6c-657d-4c68-8a5f-a33d188b3bd9
3
public String getMonarch(String playerName) { String monarchName = playerName; String tMonarch = null; HashMap<String, Boolean> vassal = new HashMap<String, Boolean>(); vassal.put(playerName, true); while (true) { tMonarch = plugin.getPatron(monarchName); if (tMonarch != null) { if (vassal.conta...
f6e2c14f-5ca8-400e-acef-755b09c9710e
8
public List<Entry> getSortedChildren() { List<Entry> children = new ArrayList<Entry>(); log.debug("children: " + children.size()); HttpClient client = new HttpClient(); GetMethod get = null; try { log.debug("getting url " + url); get = new GetMethod(url); int rc = client.executeMethod(get); ...
a1d65b25-06d7-46b4-885d-b1beeb7c2ec7
1
void addPredecessor(Instruction pred) { if (preds == null) { preds = new Instruction[] { pred }; return; } int predsLength = preds.length; Instruction[] newPreds = new Instruction[predsLength + 1]; System.arraycopy(preds, 0, newPreds, 0, predsLength); newPreds[predsLength] = pred; preds = newPreds; ...
2b9bd9d5-5c10-40ea-96ad-279398715b39
2
@Override public List<Source> getSources() throws BadResponseException { List<Source> sources = new ArrayList<Source>(); JsonRepresentation representation = null; // R�cup�ration de la liste des messages Representation repr = serv.getResource("intervention/" + interId + "/source", null); try { repr...
7e28f9c8-4b0b-4617-9a63-9c33ef647949
9
public Labyrinth(String filename){ try{ BufferedReader init = new BufferedReader(new FileReader(filename)); String current_line; int current_char; int y = 0; while ((current_line = init.readLine()) != null){ if (this.size == 0){ this.size = current_line.length(); this.labyrinth = new bool...
82f326ab-5034-4576-9b52-039554d7c368
3
public static void updateVelo(Velo velo) { PreparedStatement stat; try { stat = ConnexionDB.getConnection().prepareStatement("select * from velo where id_velo=?",ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE); stat.setInt(1, velo.getId_velo()); ResultS...
78910d5c-df19-4268-87c2-0e16d58d9b78
6
public void enableMainPanelControls(boolean isEnabled) { testIdComboBox.setEnabled(userKeyTextField.getText().equals(Constants.ENTER_YOUR_USER_KEY) ? false : isEnabled); reloadButton.setEnabled(userKeyTextField.getText().equals(Constants.ENTER_YOUR_USER_KEY) ? false : isEnabled); userKeyTextFie...
d88dcd34-3f90-4f3c-893f-cd21e545f2a2
9
public Object getNiceValueFor(Class<?> c) { if (c.isArray()) { return Array.newInstance(c, 0); } else if (c.equals(String.class)) { return ""; } else if (Number.class.isAssignableFrom(c) || // TODO: Test this c.equals(int.class) || ...
b72500e8-b22d-41c6-b931-373762a3779f
6
/* */ private JPanel buildLoginPanel() { /* 208 */ TransparentPanel localTransparentPanel1 = new TransparentPanel(); /* 209 */ localTransparentPanel1.setInsets(4, 0, 4, 0); /* */ /* 211 */ BorderLayout localBorderLayout = new BorderLayout(); /* 212 */ localBorderLayout.setHgap(0); /* 213 */ ...
67bfc13b-7748-4097-aae1-c9361db530db
2
@Override public int hashCode() { return ((domain == null) ? 0 : domain.hashCode()) + ((name == null) ? 0 : name.hashCode()); }
866d8cba-70e6-4b9b-a2c2-83a8a2935cd5
2
public List<Message> DisplayAllMessagesRecieved (String R){ List<Message> listemsg = new ArrayList<>(); String requete = "select * from message where Reciever ='"+R+"'"; try { Statement statement = MyConnection.getInstance() .createStatement(); ...
2a746b41-4637-464f-b3e1-7661bdd9c609
2
public void setDAO(String daoLine) { if (daoLine.equals("Mock")) { dao = new MockDAO(); } else if (daoLine.equals("MySQL")) { dao = new MySQLDAO(); } }
05c12f98-1c7f-4593-b489-54c0b87e8680
6
public String getResults(int a, int d) { attackers = a; defenders = d; outcome = new double[attackers + 1][defenders + 1]; for (int i = 0; i < attackers + 1; i++) for (int j = 0; j < defenders + 1; j++) outcome[i][j] = -1.0; outcome[attackers][defenders] = 1.0; double winOdds = 0.0; String likel...
4c94345d-285d-4eea-ab72-b0e21bbc0fb5
2
private void addNodeListener(){ algoTreeView.addMouseListener( new MouseAdapter() { public void mousePressed(MouseEvent e) { int selRow = algoTreeView.getRowForLocation(e.getX(), e.getY()); TreePath selPath = algoTreeView.getPathForLocation(e.getX(), e.getY()); ...
854776bc-dc1f-4872-be08-b28a876ee1d8
9
public void updateLocalityFromVisibility() throws TGException { //for (int i = 0 ; i < completeEltSet.nodeCount(); i++) { // Node n = nodeAt(i); TGForEachNode fen = new TGForEachNode() { public void forEachNode( Node node ) { try { if (node.isV...
a3b924be-9edf-4e14-9a09-60b5dcc12eb0
4
public long getMinimumDifference_as_long(){ long diff = 0L; if(this.type==4 || this.type==5){ ArrayMaths am = this.sort(); long[] sorted = am.getArray_as_long(); diff = sorted[1] - sorted[0]; long minDiff = diff; for(int i=1; i<this.length-1; i...
0529e2a9-1e32-4f1b-98a8-efca18ff9f68
6
public Coupon getBasicCoupon(String coupon) throws SQLException { ResultSet rs = sql.query("SELECT * FROM couponcodes WHERE name='"+coupon+"'"); if (rs == null) return null; if (sql.getDatabaseOptions() instanceof MySQLOptions) rs.first(); int usetimes = rs.getInt("usetimes"); int time = rs.getInt("timeuse");...
93c5a2ca-3bd4-4e41-afba-25774105a953
6
public Double[] minimizeMod(Double[] min, int[] numberOfValues, NodeVariable x, int xIndex, FunctionEvaluator fe, HashMap<NodeVariable, MessageQ> modifierTable){ if(debug>=3){ System.out.print("Oplus_MinSum.minimizeMod: modifier table size="+modifierTable.size()); if (modifierTable.size...
5c3202cf-484f-4407-9f5c-0bd861907494
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Customer other = (Customer) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) retur...
b5ebda78-4f5d-433b-9422-14d1a8210139
6
private static Spieler[] spielVorbereiten() { int spielerAnzahl = 0; int menschlicheSpielerAnzahl; do { System.out .println("Mit wie vielen Spielern möchten Sie spielen (2 oder 4)?"); spielerAnzahl = scan.nextInt(); } while (spielerAnzahl != 2 && spielerAnzahl != 4); do { System.out.print("Anz...
8fe1aeba-ae92-471c-967e-d0d43f2f6b3c
2
@Override public void mouseClicked(MouseEvent e) { Position pos = this.e.getPos(); if(this.e.getSoldat()!= null && this.e.getSoldat() instanceof Heros) panelPere.select(this); else panelPere.select(this); panelPere.repaint(); // ArrayList<Element> AE = ...
8e3fc85c-558f-4031-87e2-cc4b8ef9be16
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
8fee1728-f8ba-4a6a-a609-5d05f9a1b144
0
private static int getIntLittleEndian(byte[] a, int offs) { return (a[offs + 3] & 0xff) << 24 | (a[offs + 2] & 0xff) << 16 | (a[offs + 1] & 0xff) << 8 | a[offs] & 0xff; }
131a6049-6a99-40c6-97ab-71ddbaef7a2c
5
public void setCustomColor(Color color, byte part) { switch (part) { case BORDER: custBord = color; break; case BOX: custBox = color; break; case BACK: custBack = color; break; case TEXT: custText = color; break; cas...