method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
ee9eb0d1-0c46-4723-95f7-3bce8c7fa7ae
5
public void waitUntilTextIsPresent(String text, Long time) throws InterruptedException{ Long startTime = System.currentTimeMillis(); boolean verify = true; while (verify) { try{ if (driver.findElement(By.tagName("body")).getText().contains(text) || driver.findElement(By.tagName("iframe")).getText(...
09c7dc5f-98f6-4839-a02d-739156ffa906
9
public void update() { Piece p = viewingCanvas.getNextPiece(); if(p instanceof Corner) { nextPiece.setIcon(new ImageIcon("images/Corner.png")); } else if(p instanceof Hook_L) { nextPiece.setIcon(new ImageIcon("images/Hook_L.png")); } else if(p instanceof Hook_R) { nextPiece.setIcon(new ImageIcon("image...
8902e6c9-7ee3-46b5-b2f6-2e2b18e5882c
5
public boolean amatch(String ln, Int i) { if (!negate) { if (i.get()<ln.length() && locate(ln.charAt(i.get()))) { i.incr(); return true; } } else { if (i.get()<ln.length() && !locate(ln.charAt(i.get()))) { i.incr(); return true; } } return false; }
5886f385-cb59-47c3-8985-5f9f020798e0
1
@Override public boolean batchInsert(String collectionName, String shell, List<Object[]> argsList) { final List<DBObject> dbObjects = new ArrayList<DBObject>(argsList.size()); for (Object[] args : argsList) { dbObjects.add(QueryBuilder.toDBObject(shell, args)); } return execute(collectionName, new Collecti...
70670ee4-9155-4c63-b56c-c4a782dfaf0e
6
@Override public List<Tour> searchTours(Criteria criteria) throws DaoException { if (criteria.getParam(DAO_DIRECTION_STATUS) == null) { criteria.addParam(DAO_DIRECTION_STATUS, ACTIVE); } if (criteria.getParam(DAO_TOUR_STATUS) == null) { criteria.addParam(DAO_TOUR_STAT...
589f8707-7543-4d1f-92e6-9c029993fbd5
3
public ContentField(String initialValue, Color bg, String fieldTitle) { if (bg == null) { setBackground(Color.WHITE); } if (fieldTitle == null) { fieldTitle = ""; } if (initialValue == null) { initialValue = ""; } create(init...
ae865a26-6924-4fe4-9851-09a8c8f29876
8
@Override public void calcularSolucion(int idElemInicial) { int times = 0; boolean primera = true; while(times < 4) { Camino caminoActual = new Camino(SolucionInicial.generarSolucion(cjtElementos)); CjtCaminos soluciones = new CjtCaminos(nSolutionsToKeep); ...
132a1526-2c9a-4c7b-9060-b464d3ccc758
5
private ManifestParser parseManifestOverride(File pOverrideFile) throws ExManifestBuilder { Logger.logDebug("Located manifest override file " + pOverrideFile.getName()); //Parse the manifest override file ManifestParser lParser = new ManifestParser(pOverrideFile); try { lParser.parse(...
f1dc026a-d69c-4565-a123-546488f6b9fb
3
private int method182(int arg0, int arg1, int arg2) { if ((aByteArrayArrayArray149[arg1][arg2][arg0] & 8) != 0) { return 0; } if (arg1 > 0 && (aByteArrayArrayArray149[1][arg2][arg0] & 2) != 0) { return arg1 - 1; } else { return arg1; } }
93693cc9-193d-4682-b215-3e71fbe993ea
1
public static void switchLevel() { levels[currentLevel].endMusic(); currentLevel++; if(currentLevel > 9) { endGame = true; System.out.println("Going to endGame"); } else { System.out.println("Switching to: " + levels[currentLevel].getName()); resetXY(); levelSwitch.play(); switchin = true; ...
91e54478-8045-479d-a500-52472a753963
1
public double pow(double x, int n) { if(n < 0) return 1/ pow2(x,-n); else return pow2(x,n); }
475cbea6-69c6-4ced-80f3-8385ca3c3928
4
@Override public int[] getBiomeData(int px, int pz, int sx, int sz) { int[] da = a.getBiomeData(px, pz, sx, sz); int[] db = b.getBiomeData(px, pz, sx, sz); for(int i = 0; i < sx*sz; i++) { if(sa.contains(da[i]) && sb.contains(db[i])) { ...
01a26ae1-5247-46d3-b30b-7cb60d7e8e71
7
@Override public void run(int interfaceId, int componentId) { if (stage == -1) { sendEntityDialogue(SEND_1_TEXT_CHAT, new String[] { NPCDefinitions.getNPCDefinitions(npcId).name, "The trip will cost you 30 coins." }, IS_NPC, npcId, 9827); stage = 0; } else if (stage == 0) { sendOptionsDialogue(...
8e7e9180-16ed-4a5c-9ba0-b3494a5dfb74
6
protected boolean find_recovery_config(boolean debug) { Symbol error_token; int act; if (debug) debug_message("# Finding recovery state on stack"); /* Remember the right-position of the top symbol on the stack */ Symbol right = stack.peek();// TUM 20060327 removed .right Symbo...
e6312840-0405-4a55-bae4-db445fe95edf
0
public void synchronizeDefault() { String protocolName = Preferences.getPreferenceString(Preferences.FILE_PROTOCOL).cur; FileProtocol protocol = getProtocol(protocolName); setDefault(protocol); }
a3666b2a-5db4-4bf0-a7ff-0090bb5a2561
1
public SAXClassAdapter(final ContentHandler h, boolean singleDocument) { super(h); this.singleDocument = singleDocument; if (!singleDocument) { addDocumentStart(); } }
e7576df4-998f-4e98-9386-81172e420649
5
private void updateActiveQuest(CivilianCharacter civilian, PlayerCharacter player){ // If the character does not have an active quest with this Civilian get one, else, add it to the panel if(civilian.getActiveQuest() == null){ // Get next quest if there is one Quest quest = civilian.getNextQuest(); i...
4cefbe1c-f8db-4eb6-be14-3e6237ba2317
4
private void sendBlockMangerData() { try { EIError.debugMsg("Setting Block Manager..."); //short[][] blockChunk = unzipBlockData(blockChunkByteArray); if (blockChunk.length >= collumnChunkSize) { registry.getBlockManager().setBlockCollumns(blockChunk, currentS...
350582a0-2233-4e6a-aeee-b469df7c1e31
3
@Override void merge(Publisher oldEntity, Publisher newEntity) { if(!oldEntity.getName().equals(newEntity.getName())) oldEntity.setName(newEntity.getName()); if(!oldEntity.getCountryCode().equals(newEntity.getCountryCode())) oldEntity.setCountryCode(newEntity.getCountryCode()); if(!oldEntity...
412afe17-32e1-4df8-9e5b-fa93073f93de
9
private static int destroy(List<Integer> c, int x, int i) { int sum = 0; int j = i; while (!c.isEmpty()) { x = c.get(j); for (; j >= 0 && c.get(j) == x; j--); int j1 = ++j; for (; j1 < c.size() && c.get(j1) == ...
975c5569-a23c-4ec4-bb2f-9cf6f72bef08
2
@Override public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException { if(!endGame) { levels[currentLevel].render(Math.round(x), Math.round(y), 0, 0, g); if(!levels[currentLevel].preMode) { player.render(); g.drawString("ScrewDrivers: " + player.getScore() + " / 3",300 ,...
b090dbf8-f2c3-4be6-8a21-6759954f6dc2
5
private boolean checkJikesSuper(Expression expr) { if (expr instanceof LocalStoreOperator || expr instanceof IIncOperator) return false; if (expr instanceof Operator) { Expression subExpr[] = ((Operator) expr).getSubExpressions(); for (int i = 0; i < subExpr.length; i++) { if (!checkJikesSuper(subExpr[...
ddba0921-39ba-4f28-b6c8-06a622cdc23e
6
@Override double matchAt(int i) { double bestResult = Double.POSITIVE_INFINITY; Regex.GroupMap tempGroups = null; Regex.GroupMap oldGroups = new Regex.GroupMap(owner.groups); int bestNum = -1; matchStart = i; matchLen = 0; for (int j = 0; j <...
92c25ea1-f35f-49ba-81eb-cf768ac82224
9
public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) return; int x = board.getSelectedColumn(); int y = board.getSelectedRow(); if (x == -1 || y == -1 || !boardModel.isEmpty(x, y)) return; try { if(player == rint.getTurn() && rint.Havewinner() == false && r...
46120e47-7e28-4e9c-b840-4cfdc5069063
2
public Boolean canUse(Player player, Type type) { String name = type.getName(); if(isAdmin(player) || player.hasPermission(use +"."+ name)) { return true; } return false; }
cba05aa5-1390-46dc-bcf0-4e2a3151f7db
8
private int lastIndexOf(Object element) { if (size == 0) { return -1; } int n = last; int index = size; if (element == null) { // Find first NULL do { if (n > 0) { n--; } else { n = queueData.length - 1; } index--; if (queueData[n] == null) { return index; } ...
a72589f9-729b-4264-9ab4-d4b3b20b31c5
4
public void updateQuote(){ Date date = new Date(); long maxTimeNoUpdate = Long.parseLong(config.getQOTD_expiration_time()); long timeNow = date.getTime()/1000L; long timeLastQuote = 0; try { crs = qb.selectFrom("qotd").all().executeQuery(); if(crs.next()){ timeLastQuote = crs.getDate("date").getTi...
b5458b10-5543-4576-bd0d-6932d6dfb401
9
public static JobQueueMatch getMatch(Collection<JobQueueMatch> matches, String submissionLocation) { if (matches == null) { return null; } for (JobQueueMatch m : matches) { if (m.getQueue().toString().equals(submissionLocation)) ...
1fda2bb9-ddb6-442a-a766-4b941719417b
1
public void undo() { for (int i = 0; i < commands.length; i++) { commands[i].undo(); } }
d59ee94a-8d9c-418b-8271-ec3a6431efe8
2
private boolean hasTag(String version) { for (final String string : updater.NO_UPDATE_TAG) { if (version.contains(string)) { return true; } } return false; }
97215500-087e-4e14-907a-e99d8dd6fb24
5
@Override public boolean shouldKeepAlive(int i, int j) { return (getCell(i, j).isAlive()) && (numberOfNeighborhoodAliveCells(i, j) == 3 || numberOfNeighborhoodAliveCells(i, j) == 4 || numberOfNeighborhoodAliveCells(i, j) == 6 || numberOfNeighborhoodAliveCells(i, j) == 7 || numberOfNe...
6e6ed0d3-ca9d-40f8-beaa-3d3e0cbb4ad6
6
public void testRemoveAllTCollection() { int element_count = 20; TIntList other = new TIntArrayList(); for ( int i = 0; i < element_count; i++ ) { other.add( i ); } TIntList list = new TIntArrayList( 20 ); for ( int i = 0; i < element_count; i++ ) { ...
8e2dfb92-ac47-4c1c-bc74-629a31aae5f4
4
public static void run(String[] args, int unused) { reader = new XMLMapTransformer(); PrintWriter summary = null; try { File temp = new File("summary.txt"); temp.createNewFile(); summary = new PrintWriter(temp); } catch (Exception e) { Sy...
95a358c8-2049-4147-9bcc-625e37c13a2d
7
public Item equip(Item equipping, AbilitySet abilities) { Item replace = null; try { for (Field f : EquipmentSet.class.getFields()) { if (f.getClass().equals(equipping.getClass())) { replace = (Item) f.get(this); f.set(this, equipping); } } } catch (IllegalArgumentException e) { System....
afc0b4ed-11b5-485c-a6e1-a9b6cd9d2739
8
public int move(int row, int col, int player) { int value = player == 1 ? 1 : -1; rows[row] += value; cols[col] += value; if (row == col) diagonal += value; if (col == (n - row - 1)) antiDiagonal += value; if (Math.abs(rows[row]) == n || ...
a4c4f3b9-8393-481f-9a79-680ec4bab6df
8
private void checkIfDeclaration() throws Exception { if(iterator < tokenList.size() && tokenList.get(iterator++).getType() != TokenType.L_PAR) { // missing opening parenthesis throw new Exception("Syntax Error at line " + tokenList.get(iterator-1).getLine() + ": Expected ( and got \"" + tokenList.get(iter...
b306d823-6146-49e9-b16a-b71d606e48b8
0
public DocumentInfo getDocumentInfo () { return docInfo; }
d51ee354-159d-4274-a42f-452ca3625d4d
0
public Player(String name) { _name = name; _wins = 0; _drawOutput = null; }
77986b20-047f-4fb7-ba14-7f761c92f675
2
public void testPropertyCompareToWeekOfWeekyear() { DateTime test1 = new DateTime(TEST_TIME1); DateTime test2 = new DateTime(TEST_TIME2); assertEquals(true, test1.weekOfWeekyear().compareTo(test2) < 0); assertEquals(true, test2.weekOfWeekyear().compareTo(test1) > 0); assertEquals...
bbcfed46-e063-49ca-9665-0e52e60c17a2
3
public void createWindow() { Frame window = new Frame(this.title); final Game game = this; window.addWindowListener(new WindowListener() { @Override public void windowClosing(WindowEvent e) { game.stop(); System.exit(0); ...
3514fc6e-a007-4719-afaf-26cf086e804a
5
@Override public void update(long ms) { if ( deltaLevel != 0 ) { active = true; level += deltaLevel; } if ( deltaLevel > 0 && level > 100 ) { level = 100; active = false; deltaLevel = 0; } if ( deltaLevel < 0 && level < 100 ) { level = 0; active = false; deltaLevel = 0; } ...
bf637b29-b343-4eb2-957d-77ca107588cb
6
public static String computeName(String firstName, String middleName, String lastName) { String name=""; String separator = ""; if (firstName!=null&&!firstName.isEmpty()) { name+=firstName; separator=" "; } if (middleName!=null&&!middleName.isEmpty()) { name+=separator+middleName; ...
9f73a4c6-432b-427c-8db4-e63e454f5774
4
@Override public void paintComponent(Graphics g) { super.paintComponent(g); // Draw the soft connections (first, so they're under the nodes). ViralSpread.ShowConnections connectionType = ViralSpread.getConnectionType(); if (connectionType == ViralSpread.ShowConnections.SOFT || connectionType == ViralSpread...
cac42639-5cc2-4c16-80d4-3f891f787fe7
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; HeteroAtomSmilesAndLambda other = (HeteroAtomSmilesAndLambda) obj; if (lambdaConvention == null) { if (other.lambdaConvention != nul...
046ccdd8-4ae8-4988-89ad-04906bdf6883
6
@Override public void mousePressed(MouseEvent event) { if (event.getModifiers() == InputEvent.BUTTON1_MASK || event.isControlDown() || event.isShiftDown()) { if (event.getClickCount() == 2 || event.isShiftDown()) { if (!controller.isVertex(event.getPoint())) { controller.addVertex(event.getPoint()); ...
a6862c95-ade0-4848-af62-89179bb69d4e
4
private void setUI() { try { UIManager .setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (Unsupport...
17f72ffb-1c3e-4afe-aa1d-f2b64eed3fd3
1
public void testNegated() { Seconds test = Seconds.seconds(12); assertEquals(-12, test.negated().getSeconds()); assertEquals(12, test.getSeconds()); try { Seconds.MIN_VALUE.negated(); fail(); } catch (ArithmeticException ex) { // expec...
975b3f20-523a-44e7-86c0-5b7f455bba13
1
@AfterTest public void tearDown() throws Exception { driver.quit(); String verificationErrorString = verificationErrors.toString(); if (!"".equals(verificationErrorString)) { fail(verificationErrorString); } }
1360f482-9769-4888-80cc-3c524b4c65e7
6
public Element askDumping(Element request) throws IOException { if (dump) { String x = getName() + "-request"; try { System.err.println("<" + x + ">" + DOMMessage.elementToString(request) + "</" + x + ">\n"); } catch (Ex...
9c2fa979-fa36-45b4-8035-d3384633c7d8
6
public boolean makeMove(BoardViewer board) { move = new Move(); move.setPlayer(personalSymbol); //If winning move available, make it String index; index = rowWithWinningMove(board, personalSymbol); if (!index.equals("")) { move.setPosition(getRowEmptySpace(board, index)); ...
82d08e55-7f21-4f6c-8565-bbef33e2b085
0
public HoistStackItem(Node hoistedNode) { this.hoistedNode = hoistedNode; this.hoistedNodeParent = hoistedNode.getParent(); this.hoistedNodeIndex = hoistedNodeParent.getChildIndex(hoistedNode); this.hoistedNodeDepth = hoistedNode.getDepth(); this.oldNodeSet = hoistedNode.getTree().getRootNode(); this.lin...
0e15e5db-213f-465c-b3b2-f20e0cd9f4c2
6
private void notifyListeners(KeyEvent e){ switch (e.getID()){ case KeyEvent.KEY_PRESSED: for(KeyListener listener : keyListeners){ listener.keyPressed(e); } break; case KeyEvent.KEY_RELEASED: for(KeyListener listener : keyListeners){ listener.keyReleased(e); } break; case...
769d827c-cecb-4564-a6c1-aaa3d5fddc56
5
public void startApp() throws MIDletStateChangeException { try { rs = RecordStore.openRecordStore("tknumber", true); if (rs.getNumRecords() > 0) { System.out.println(rs.getRecord(1).toString()); InputStream is = new ByteArrayInputStream(rs.getRecord(1)); ...
e7d1c356-9b2f-4720-b1fd-7ce3dc7095ea
8
public Boolean deterministic(float dt, rrandom rng) { double saturation; saturation = (double) 1.; for (int i = 0; i < input_species.size(); i++) { double cons; cons = input_species.get(i).getNumber(); // cons = input_species.get(i).getMy_concentration(); saturation = saturation * cons; } double ...
f0491dbd-135e-4406-a106-850b99d039c5
2
public static void main(String[] args) { String dir = "."; if (args.length == 1) { System.out.print("Usage: " + args[0] + " [inputDir] outputDir"); return; } String output = "../output/";//args[1]; if (args.length > 2) { dir = args[1]; output = args[2]; } DirManager manager = new DirManager(d...
862ac624-3869-4322-a6f8-f1a1f4f60ded
8
public void consume() { ConnectionFactory connectionFactory; Connection connection = null; Session session = null; Destination destination; MessageConsumer consumer = null; try { connectionFactory = new ActiveMQConnectionFactory(DEFAULT_BROKER_URL); connection = connectionFactory.createConnection(); ...
1a3f8808-a9b6-437f-b8ae-bd03cbf0b74f
1
public static Method[] getAllDeclaredMethods(Class<?> leafClass) throws IllegalArgumentException { final List<Method> methods = new ArrayList<Method>(32); doWithMethods(leafClass, new MethodCallback() { public void doWith(Method method) { methods.add(method); } }); return methods.toArray(new Method...
6f272591-fa06-43d7-8bf3-45dc58d73866
5
@Override public void incCount(E data) { //First check to see if data is already present in the HashTable //Get hashcode int hashCode = hasherH.hash(data) % table.length; //If data is already present, find it in the table and increment its count //It may not be in the first place we look - if so, use the se...
e3450f69-5be7-4da5-b6b0-0209252227f2
1
@SuppressWarnings("unchecked") public void addQustionToDB() { String questionStr = getConcatedString((ArrayList<String>) question); String answerStr = getConcatedString((ArrayList<String>) answer); // add to database try { String statement = new String("INSERT INTO " + DBTable + " (quizid, position, q...
4c02fe25-eeb6-46f4-800c-82edac98f9b0
4
public void recibirConnectionPhase2(String updateId, int precio, String type) { if (!updateIdsList.find(updateId)) { updateIdsList.append(updateId); if (id == this.id) for (int i = 0; i < connections.getLength(); i++) { Connection connection = connecti...
bda2530b-dc66-4e61-a651-e1d21a22897e
7
@Override public void run() { /*if there is a message store and check it*/ if (bot.hasMessage()) { message = bot.getMessage(); channel = bot.getChannel(); } if (message.startsWith("~zodiac")) { tokenize(true, 7, message); month = (Stri...
7526ac8b-7e74-435e-bd1a-1dc8a4cba6f5
0
public String getSkillName() { return skillName; }
2187f036-b342-4a43-b733-8fcd27fdecd8
6
private static void writeNodeContent( Node node, FileOutputStream fos, String encoding, boolean pretty, int level ) throws IOException { boolean containedOnlyElements = true; NodeList children = node.getChildNodes(); for ( int i=0;i<children.getLength();i++ ) { Node child = children.item( i ); switch ...
6e038b5e-1b6a-469b-b62c-333b8eeded08
1
public void setStartingAmmo() { weaponsDataDirty = true; for (WeaponInfo weaponInfo : weaponsData) { weaponInfo.setDefaults(); } getWeaponDataModifyable(Weapon.BERETTA_93R).setCartregesReamaining(5); }
159c1a8f-ea08-4f46-8c9a-096b0a138281
9
public void putFile(String name, InputStream rawBytes) throws IOException { if (name.endsWith(SLASH_EMPTY_DIRECTORY_SENTINEL)) { File dir = new File(mRootDirectory, name).getParentFile(); if (dir == null) { throw new IOException("Empty root directory???"); } ...
06121031-24cb-4420-a75a-f8cf3a68dc17
6
private void register( Class<?> clazz ) throws IllegalStateException { if ( cachedDependencies.containsKey( clazz ) ) return; Set<Class<?>> inProgress = cycleDetect.get(); if ( inProgress == null ) { inProgress = new HashSet<Class<?>>(); cycleDetect.set( inProgress ); } if ( in...
16fdfc89-c134-4db0-b49a-1cc8625cdb85
6
private static ListItem sequentialSearch(ListMan lm, String target) { ListItem retVal = null; System.out.println("Searching for " + target + "."); int counter = 0; ListItem currentItem = new ListItem(); currentItem = lm.getHead(); ...
fba36f2a-b8bf-423d-a38d-fd81be68099d
6
@Override public void componentActivated(AbstractComponent source) { for (int i = 0; i < buttons.size(); i++) { if (buttons.get(i).hasMouseOverArea((MouseOverArea) source) && buttons.get(i).isActive) { for (ButtonRowListener listener : listeners) { listener.buttonWasPressed(this, buttons.get(i), i); ...
854f5e66-55c2-4123-88d8-2f1ba7e8a42b
9
public void mouseReleased(MouseEvent e){ if ( seleccionando ){ double x,y,x1,y1; x = posIniSelect.getX(); y = posIniSelect.getY(); x1 = e.getPoint().getX(); y1 = e.getPoint().getY(); if (x<x1){ if (y<y1){ ...
18bbd301-1690-43df-be4b-d1071d8fafd6
1
private Node setNode(Edge edge, MouseEvent e) { Node node; double mouseMapX = drawMapComponent.convertMouseXToMap(e.getX()); double mouseMapY = drawMapComponent.convertMouseYToMap(e.getY()); double fromDistance = Point2D.distance(edge.getFromNode().getxCoord(), edge.getFromNode().getyCoo...
0b1b410c-bed2-4354-af43-208939be6cc2
0
public CaptureRequestHandler(Vector<File> imageQueue) { this.imageQueue = imageQueue; }
ab4d52b8-2934-420f-a09a-56780dd2c24e
4
@Override public void run(){ this.task.setState(TaskState.RUNNING); ReduceTask reduceTask = (ReduceTask)task; String jar = reduceTask.getParentJob().getJar(); String reduceClassName = reduceTask.getParentJob().getReduceClass(); Class<?> reduceClazz; try { ...
16d25a7d-c93b-4151-afa3-ecdc150829e9
2
public String getDisplayingName() { if ( tempname != null ) { return tempname; } else if ( nickname != null ) { return nickname; } else { return playername; } }
8ff31fad-ab92-485e-b755-ec834f45fd39
2
public void run() { ArrayList<Integer> fib = new ArrayList<Integer>(); int n = 0; fib.add(1); fib.add(2); //fib 1, 2, 3, 5, 8 ... for (int i = 2; n < 4000000; i++) { int twoPrevious = fib.get(i-2); int previous = fib.get(i-1); n = twoPrevious + previous; fib.add(n); if (n%2 == 0) { sum +=...
d0eb7760-59a8-4c5c-9352-ff2d7bbe1139
2
public void updateModRank(String userid, Rank rank) { if (modList.containsKey(userid)) { if (modList.get(userid).equals(rank)) { System.out.println("[Room] This User is already this rank.."); return; } modList.put(userid, rank); } }
f622827f-8386-4699-b3b3-15b21a53b089
1
public FieldInfo[] getFields() { if ((status & FIELDS) == 0) loadInfo(FIELDS); return fields; }
97d19a05-270d-423a-919a-5ad4142e6557
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...
066af13e-e262-4236-812f-0fd27469e07a
0
public double evaluate(double x) { return 1.0/(1.0+Math.exp(-x)); }
78761544-ab18-463f-b107-74b575a415ab
2
public boolean peutRepondre(Utilisateur utilisateur) { return (utilisateur != null && utilisateur.getRole().getValeur() >= getReponseRoleMinimum().getValeur()) || getReponseRoleMinimum() == Role.Utilisateur; }
1fcf8599-2846-4811-909a-0328259a16dc
1
@Override protected Marshaller create() { try { Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); return marshaller; } catch (JAXBException e) { throw new XmlTransformationException("Failed to create jaxb marshaller", e); } }
777798e9-1fc3-4c31-8adc-4db95828bf89
9
public String convert(String s, int nRows) { List<List<Character>> charList = new ArrayList<>(); for (int i = 0; i < nRows; i++) charList.add(new ArrayList<Character>()); String res = ""; if(s.trim().isEmpty() || nRows <= 1) return s; char[] chars = s.toCharArray();...
6c2e0592-1e65-4497-af03-47ebc4a34e90
2
public void updateType() { Type newType; if (!opAssign) { /* An opassign (+=, -=, etc.) doesn't merge rvalue type. */ Type lvalueType = subExpressions[0].getType(); Type rvalueType = subExpressions[1].getType(); subExpressions[0].setType(Type.tSuperType(rvalueType)); subExpressions[1].setType(Type....
952e43f0-d7fc-436d-82f7-c5c3b05ceb27
7
final char[] optimizedCurrentTokenSource2() { //try to return the same char[] build only once char[] src = this.source; int start = this.startPosition; char c0 , c1; int hash = (((c0=src[start]) << 6) + (c1=src[start+1])) % TableSize; char[][] table = this.charArray_length[0][hash]; int i = newEntry2; while (+...
b8033bdf-b756-48c0-9715-5205b69a5ad1
9
private static String testOnePattern(BufferedReader in) throws IOException { String pattern = ""; String errors = ""; Regex r; for (int n = Integer.parseInt(in.readLine().replaceAll("\\s.*", "")); n > 0; n--) { pattern += in.readLine() + "\r"; } // for r = n...
1a10d7b2-ce80-4207-8c11-0d58f2e618e8
2
public static void main(String args[]){ System.out.println("Hello World!"); try{ loadFromFile(); }catch(Exception e){ System.out.println("Error occured!"); } roveChange(); roveImgPrint(); try{ saveToFile(); }catch(Exception e){ e.printStackTrace(); } }
6067489a-d2a3-4530-8402-465ce686d516
0
@Override public int compare(Student o1, Student o2) { return o1.getBestScore().compareTo(o2.getBestScore()); }
1c7e4e47-9620-4b44-afcb-e6ed2552fb8b
9
public void draw(Graphics g) { int segments = 16; int i; int ox = 0; int hs = sim.euroResistor() ? 6 : 8; double v1 = volts[0]; double v2 = volts[1]; double v3 = volts[2]; setBbox(point1, point2, hs); draw2Leads(g); setPowerColor(g, true); ...
e4bf66ae-6507-4eb0-9f73-b8c687b743ca
9
protected static User createUserFromDBObject(DBObject obj) { User u = new User(); u.setIdUser((String)obj.get("idUser")); u.setId((ObjectId) obj.get("_id")); u.setUsername((String) obj.get("username")); u.setDisplayName((String)obj.get("displayName")); u.setFirstName(...
6343cf2e-d4f9-48cf-bd62-f34a51fa526b
8
protected boolean checkClass(Class<?> javaClass) { if (!classes.contains(javaClass.getName())) { Class<?> parent = javaClass.getSuperclass(); if (parent == null) return false; if (checkClass(parent)) return true; for (Class<?> in : javaClass.getInterfaces()) if (checkClass(in)) return ...
47707e81-e8ee-4bae-aaa6-f80b93cd6666
6
private void nombremedicamentosFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_nombremedicamentosFieldKeyTyped // TODO add your handling code here: if (!Character.isLetterOrDigit(evt.getKeyChar()) && !Character.isISOControl(evt.getKeyChar()) && evt.getKeyChar() !='-' && evt.getKeyChar() !=...
532cbd04-0462-4c8a-bcdd-5aab44cabb65
6
@Override public void replace(FilterBypass fb, int offset, int length, String text, AttributeSet attrs) throws BadLocationException { int inputOffset = io.getInputOffset(); if(io.doWrite()){ if(offset>=inputOffset){ return; } if(offset+length>inputOffset){ length = inputOffset-offset; } io.n...
f50367ff-4c9b-4998-b78d-687c0afa67fe
5
public void setType(String s) { if (s.equals("IN") || s.equals("OCO") || s.equals("OUT") || s.equals("IO") || s.equals("CLO")) { this.type = s; } else { this.type = "NC"; } }
9a1d54ce-7e3a-44b2-86c3-5ac1224f2528
6
public double mageAtkTest() { double attackBonus = c.playerBonus[3] == 0 ? 1 : c.playerBonus[3]; if(attackBonus < 1) attackBonus = 1; double attackCalc = attackBonus * c.playerLevel[6]; // +1 as its exclusive if (c.fullVoidMage()) attackCalc += 1.10; if (c.prayerActive[4]) atta...
a7872b3a-6e13-4ba4-b2bf-09eca6a60bba
3
public int indexOf(int gridletId, int userId) { Gridlet gl = null; int i = 0; Iterator<Gridlet> iter = super.iterator(); while (iter.hasNext()){ gl = iter.next(); if (gl.getGridletID()==gridletId && gl.getUserID()==userId) { return i; } ...
cb65a2c0-3510-421e-8f9b-b30339a3ebf5
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Orderdetail)) { return false; } Orderdetail other = (Orderdetail) object; if ((this.orderdetailid == null && ot...
ded4f4e0-a554-4adc-ad60-aa2eae39ee16
2
public String toString(){ String resultado = "{ "; if(getInicio() == null){ return "Lista numeros vacia"; }else{ NodoNumeros q = this.inicio; while(q != null){ resultado += q.getInfo().toString() + ", "; q = q.getLiga(); } } return resultado.substring(0, resultado.length() -1) + " ...
5654a5d9-3f76-4359-96a5-0ddb2bb735e3
5
public PascalTriangleComponent(int rows){ totalRows = rows; numbersInPascalTriangle = new int[rows*(rows+1)/2]; numbersInPascalTriangle[0]=1; //if there's only one row, we're done if (rows==1) return; numbersInPascalTriangle[1]=1; numbersInPascalTriangle[2]=1; int currentR...
581e4a9e-15ac-4b14-837d-95c37c21dbe1
6
public Game parseGame(String gamedesc_file) { String[] desc_lines = new IO().readFile(gamedesc_file); if(desc_lines != null) { Node rootNode = indentTreeParser(desc_lines); //Parse here game and arguments of the first line game = VGDLFactory.GetInstance()...
b0289a03-d530-4216-9c89-25c4f5738a2b
9
private Global() { try { icon = ImageIO.read(getClass().getClassLoader() .getResourceAsStream("icon.png")); if (System.getProperty("os.name").toLowerCase().contains("win")) configFile = new File(System.getenv("APPDATA") + File.separator + "JNapi" + File.separator + "config.dat"); else co...
89c0f99f-5266-488e-8ec0-857677bc4707
8
public void actionPerformed(ActionEvent arg0) { //Conditionals to Validate Which button was pressed if(arg0.getActionCommand().equals("Begin Pit Upload")) { //Validate at least one COnnected Client if(numConnected >= 1) { //Send Match Data to Clients if(MainThread.uploadQueues[0] != null) {...