method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
c997df05-804d-4cb9-a026-b9f1c32b4885
1
public int getUpperLeftX(){ if (x1 > x2) { return x1; } else { return x2; } }
daeb2573-5dad-4323-8a6d-93ba01378d8f
1
private void startCollectionTab() { ImageButton collectionButton = new ImageButton(parent, "New Collection", (int) (posX + 60), 140, 200, 25, 1) { @Override public void onMousePress(int x, int y) { // CREATES CREATION COLLECTION MENU if (!creatingCollection) { newCollection = new Collection<...
14b78f41-4978-4713-963d-643a653b09d8
6
public byte[] processBlock(byte[] in, int inOff, int len) throws InvalidCipherTextException { if (param instanceof SHEBV11bPublicKeyParameters) { // Enc SHEBV11bPublicKeyParameters pk = ((SHEBV11bPublicKeyParameters) param); SHEBV11bParameters parameters = pk.getParameters()...
9e246702-044f-41af-9294-d32da483cc68
1
private void atividadesAtrasadas() { if (usuarioLogado.getTipo().equals("Gerente")) { AtividadesAtrazadasForm atividadesAtrazadasForm = null; atividadesAtrazadasForm = new AtividadesAtrazadasForm(usuarioLogado); atividadesAtrazadasForm.setVisible(true); centrali...
621184ce-3c6d-4d4f-9bfd-cccee78da6aa
4
private void oilPasteBuffer(CPRect srcRect, CPRect dstRect, int[] buffer, byte[] brush, int w, int alpha) { int[] opacityData = opacityBuffer.data; int by = srcRect.top; for (int j = dstRect.top; j < dstRect.bottom; j++, by++) { int srcOffset = srcRect.left + by * w; int dstOffset = dstRect.left + j *...
a2d5560b-ef14-4321-8e18-b4e38922034a
4
public static void act(KeyEvent e) { for(Player p: players) { if (!p.isBot()) { if (e.getKeyChar() == ' ') p.setAction(8); else if (!e.isActionKey()) p.setAction(e.getKeyChar()); else p.setAct...
ea442b63-4462-4a9c-9985-8afe0b981ee7
6
void sendShips(Set<Planet> fromList, Planet to) { double interval = 12; double radiusDelta = 30; Set<Ship> ships = new HashSet<Ship>(); for (Planet from : fromList) { double radius = from.radius + 10; int sendCount = from.shipsCount.get() / 2; from.s...
98b93782-45dc-4900-831a-66f737aa82c7
9
@Override public void keyPressed( KeyEvent e ){ int key = e.getKeyCode(); if ( key == KeyEvent.VK_UP ){ if (!DOWN){ resetMoves(); UP = true; } } else if ( key == KeyEvent.VK_DOWN ){ if (!UP){ resetMoves(); DOWN = true; } } else if ( key == KeyEvent.VK_LEFT ){ if (...
788a1ae8-4de0-42f2-a5ac-d3d239d53370
5
protected String buildFormatMultipleCommand(List<? extends Object> objList) { String command = null; if (shouldDisambiguate) { command = SubLAPIHelper.makeSubLStmt(GENERATE_DISAMBIGUATION_PHRASES, new CycList(objList), DEFAULT, DEFAULT, getFormatLanguageMt(), getDomainMt(), getCycSymbol(getM...
e33685db-1334-4615-afdc-9123ab99c2a6
4
@Override public void handle(HttpExchange exchange) throws IOException { System.out.println("In build road handler"); String responseMessage = ""; if(exchange.getRequestMethod().toLowerCase().equals("post")) { try { //TODO verify cookie method String unvalidatedCookie = exchange.getRequestHeade...
812b1763-1fd3-4a33-a65f-8f4b75131966
5
public void mousemove(Coord c) { if (locked) return; if ((!locked) && (dragging == null) && (pressed != null)) { dragging = pressed; int slot = index(c); if (slot >= 0) { clearslot(slot); } pressed = null; } ...
3a891f93-b8cb-499e-985d-d6390ccec888
3
@Override public void run() { while(true) { try { Thread.sleep((random.nextInt(agent.getNumAgentsConnected()) + 1) * 250); if (!Agent.getConflictExists()) { Agent.Leader(agentId, agentType); Thread.sleep((random.nextInt(agent.getNumAgentsConnected()) + 1) * 400); Agent...
40418b63-c840-4160-9242-3e48611680bd
1
public void reset() { for (int i=0; i<BANDS; i++) { settings[i] = 0.0f; } }
ee476602-b860-402f-b5d7-d19f512a2206
3
void createExampleWidgets () { /* Compute the widget style */ int style = getDefaultStyle(); if (horizontalButton.getSelection ()) style |= SWT.HORIZONTAL; if (verticalButton.getSelection ()) style |= SWT.VERTICAL; if (borderButton.getSelection ()) style |= SWT.BORDER; /* Create the example widgets */ ...
2b56a29f-bca1-43d3-ad3d-27b10a12d73a
3
public static RoutingTable deserializeRoutingTable(CorbaRoutingTable corbaRoutingTable) { if (corbaRoutingTable == null) { throw new NullPointerException("Cannot transform a null value to a Host object"); } RoutingTable routingTable = new RoutingTable(); Host localhost = des...
57d9adc6-6388-471b-8f94-283d99340a3a
6
public void convertOldCircuitsYml(){ File oldYmlFile = new File(plugin.getDataFolder(),"circuits.yml"); if(oldYmlFile.exists()){ plugin.log(plugin.getMessage("found_old_file").replace("%file%",oldYmlFile.getName())); FileConfiguration oldYml = YamlConfiguration.loadConfiguration...
db6e2ae2-759e-43ae-bf21-17472441967c
8
@EventHandler public void onUrlCheckEvent(final SendDataEvent event) { event.getURL().getPage(new URLResponseHandler() { public void validResponse(BufferedReader br) throws IOException { final String line; try { line = br.readLine(); } catch (Exception e) { e.printStackTrace(); return; ...
ffcf2cd3-a420-471f-839d-4e00d555eac2
2
public static void handleGetEventMethod(HTSMsg msg, HTSPServerConnection conn, HTSPMonitor monitor) throws IOException { Collection<String> requiredFields = Arrays.asList(new String[]{"eventId"}); if (msg.keySet().containsAll(requiredFields)){ //TODO handle several clients!! HTSMsg reply = monitor.getEvent((L...
21b6902d-facb-4c80-983a-d30b1d94eea6
9
private void tabClientesKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tabClientesKeyReleased performNavigateAction(evt); if (evt.getKeyCode() == KeyEvent.VK_DOWN) { if (booAlteracao) { btnCancelar.doClick(); booAlteracao = false; } el...
c2131127-35b2-4f65-af10-0c45c36ec16c
2
public void tallennaPalaute(Palaute p) throws DAOPoikkeus { Connection yhteys = avaaYhteys(); try { String sql = "insert into Palaute(tilausID, nimi, kategoria, vastataanko, pvm, tiedot, sahkoposti) values (?, ?, ?, ?, ?, ?, ?)"; PreparedStatement ps = yhteys.prepareStatement(sql); // La...
e70ebc14-549a-46ca-8c25-689d2b55dc6f
0
public void invalidate() { valid = false; }
8152d199-a490-4047-ae9e-ed169ffac1e6
2
int getMin(Vector<Sample> Q) { double min = Double.MAX_VALUE; int index = 0; for (int i = 0; i < Q.size(); i++) { if (Q.get(i).fx < min) { min = Q.get(i).fx; index = i; } } return index; }
5e66f5d8-75de-4561-879d-9d83563029f8
3
private void botonCargarComprasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botonCargarComprasActionPerformed //limpio el modelo DefaultTableModel modeloCompras = ((DefaultTableModel) jTableCompras.getModel()); modeloCompras.setRowCount(0); //saco el id de la person...
c9b7e708-5fbd-43af-9781-793f5c46cea1
9
public void tick() { if (input.up.clicked) selected--; if (input.down.clicked) selected++; int len = options.length; if (selected < 0) selected += len; if (selected >= len) selected -= len; if (input.attack.clicked || input.menu.clicked) { if (selected == 0) { Sound.test.play(); game.resetGame(...
3f305e5b-4c04-492e-8ca2-47efc5c87ee9
7
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try{ response.setContentType("text/html"); PrintWriter out = response.getWriter(); String userid=request.getParameter("sjsuid"); String password=request.getParameter("passwor...
d9b950db-13c5-4eb9-b988-a4fabec6ef40
7
public Tile[][] generateRandomBlock() { Tile[][] piece = new Tile[0][0]; Random generator = new Random(); int randomIndex = generator.nextInt(7); switch(randomIndex) { case 0: piece = generat...
8feab463-08d1-444c-98cf-ec62156b7551
7
private String DDCRET_String(int retcode) { switch ( retcode ) { case DDC_SUCCESS: return "DDC_SUCCESS"; case DDC_FAILURE: return "DDC_FAILURE"; case DDC_OUT_OF_MEMORY: return "DDC_OUT_OF_MEMORY"; case DDC_FILE_ERROR: return "DDC_FILE_ERROR"; case DDC_INVALID_CALL:...
2e1e875a-3509-4807-bf9a-adc3376a42af
2
@Override public TLValue evaluate() { TLValue a = lhs.evaluate(); TLValue b = rhs.evaluate(); // number + number if(a.isNumber() && b.isNumber()) { return new TLValue(a.asDouble() % b.asDouble()); } throw new RuntimeException("illegal expression: " + this); }
63079996-5d23-45e9-b2e7-215ec8d0583b
1
private void jjCheckNAdd(int state) { if (jjrounds[state] != jjround) { jjstateSet[jjnewStateCnt++] = state; jjrounds[state] = jjround; } }
27a9e8ab-30b0-4819-8be7-77d1564d9d72
8
public void upd() { bestNbrIndices.clear(); for (int i = 0; i < topk.size(); i++) { bestNbrIndices.add(i); } boolean run = true; while(run) { run = false; // add neighbor //print(baseUserID + " begining: " + upd); for (int i = 0; i < topk.size() + topr.size(); i++)...
91c86b58-a23a-433b-bc78-14649f58f274
7
public void renderTile(int xp, int yp, Tile tile) { xp -= xOffset; yp -= yOffset; for(int y = 0; y < tile.sprite.SIZE; y++) { int ya = y + yp; for(int x = 0; x < tile.sprite.SIZE; x++) { int xa = x + xp; if(xa < -tile.sprite.SIZE || xa >= w...
8490212a-9c50-4d9f-8660-c3e71b264759
8
@Override public void affectPhyStats(Physical affected, PhyStats affectableStats) { if((whom!=null)&&(song!=null)) { final Hashtable<Integer,Integer> H=getSongBenefits(song); for(final Enumeration<Integer> e=H.keys();e.hasMoreElements();) { final Integer I=e.nextElement(); final String[] chk=stuf...
1403c249-9376-4d54-9f20-45e7864dc009
2
public static boolean inventoryContains(int itemId) { for(int i=0; i<Inventory.length; i++) { if(Inventory[i] == itemId) { return true; } } return false; }
a34234c4-f23d-4095-a1ea-8c264784c41e
2
public static Game createGame(Game myGame, Move m) { // TODO Auto-generated method stub Board testBoard = new Board(false); Piece thePieceMoving = myGame.getPiece(m.getPreviousLocation()); Point whereToMove=m.getCurrentLocation(); boolean theTurn = myGame.isWhitesTurn();//check if the new board set up puts th...
e69393c8-612f-40e5-b341-846e454a8382
2
public void addHandler(String handlername, Object handler) { logger.info("Registered " + handlername + " for " + handler.getClass()); if (handler instanceof XmlRpcHandler) { handlers.put(handlername, handler); } else if (handler != null) { ...
fc4b55ef-dfc8-46aa-aabc-4cb62ce9efb2
7
**/ public void print(int depth) { int i; // Print the indentation and the data from the current node: for (i = 1; i <= depth; i++) System.out.print(" "); System.out.println(data); // Print the left subtree (or a dash if there is a right child and no left child) ...
01f81dda-bc74-4020-a03a-8e66cb55db76
6
public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); InfoPaciente infoPaciente; try { infoPaciente = em.getReference...
5911d81b-4fd8-4534-8ef3-6084eec482c5
5
public static void main(String[] args) { Map map = new Map(new int[]{16, 16}, new int[]{0, 0}, new int[]{15, 15}); Scout scout = new Scout(map.mapArray, map.startCoord, map.endCoord); for(int i = 0; i < 25; i++){ scout.moveDirection(); } Rectangle rectangle = new Rectangle(0, 0, 10, 10); rectangle.add...
546562fd-a35c-44fc-8790-ac6184efa25d
8
@Override public void beforeSample() { try { // input BufferedReader ir = getInputReader(); String line = ir.readLine(); if (line == null) { inputReader.close(); inputReader = null; ir = getInputReader(); line = ir.readLine(); } String[] split = line.split(","); if (next...
d2e5b05d-bdbb-4c70-8086-dc50e6be2f30
2
public boolean isExistForumUser(Connection con, String user) { /* Compose query. */ String SQL_QUERY = "SELECT COUNT(username) entries " + "FROM xf_user " + "WHERE username=?;"; /* Execute query. */ try { PreparedStatement stmt = con.prepareStatement(SQL_QUERY); stmt.setString(1, user); ResultS...
ef1a2a3a-89b2-419a-b993-0b36c5cd7c48
7
private void initGUI() { try { this.setLayout(new BoxLayout(this, javax.swing.BoxLayout.X_AXIS)); // this.setPreferredSize(new Dimension(400, 300)); { this.add(tablePanel); tablePanel.setLayout(new BoxLayout(tablePanel, javax.swing.BoxLayout.Y_AXIS)); tablePanel.setPreferredSize(new java.awt.Dime...
5737e319-5076-4c11-b4d7-ce016a96d4e1
5
private void animate() { getDisplay().timerExec(msDelay, new Runnable() { @Override public void run() { if( !label.isDisposed() ) { if( isVisible() && frames.size() > 0 ) { curFrame++; if( curFrame > frames.size()-1 ) { curFrame=0; } label.setI...
949c1d9c-a838-4a93-9025-7fb70a334b4b
9
private String getTypeStr(PointCloud2 cloud) { String typeStr = new String("TYPE"); for(PointField field: cloud.fields){ switch(field.datatype){ case(1): case(3): case(5): typeStr = typeStr + " I"; break; case(2): case(4): case(6): typeStr = typeStr + " U"; break; case(7): ...
23cefd1c-4822-4421-a623-c0eb26cf80e1
9
private boolean buildFriendsListMenu(RSInterface rsInterface) { int type = rsInterface.contentType; if (type >= 1 && type <= 200 || type >= 701 && type <= 900) { if (type >= 801) type -= 701; else if (type >= 701) type -= 601; else if (type >= 101) type -= 101; else type--; menuAction...
3ade1ed3-0765-4b7d-9894-c6a999a1c9c3
6
private void auraAttack(){ Point startPoint = new Point(Game.PLAYER.getX(), Game.PLAYER.getY()); Point endPoint = new Point(Mouse.getX() + Game.PLAYER.getCameraX(), Mouse.getY() + Game.PLAYER.getCameraY()); double m = (endPoint.getY() - startPoint.getY())/(endPoint.getX() - startPoint.getX()); double startAngle...
af0be8a4-7fe1-42f8-9434-2be8cd4bfae1
8
private void calculateSelectedRect() { double startX = start.getX(); double startY = start.getY(); double endX = end.getX(); double endY = end.getY(); double swidth = endX - startX; double sheight = endY - startY; if (swidth > 0 && sheight > 0) { rect...
08948ed0-92cc-49ef-af67-edf57c8ba8b5
4
public static void moveLeftText(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) { Node currentNode = textArea.node; if (textArea.getCaretPosition() == 0) { // Get Prev Node Node prevNode = tree.getPrevNode(currentNode); if (prevNode == null) { tree.setCursorPosition(tre...
d2a2365f-9463-43a2-a733-05e83d6c81ad
4
public void simulate(long simulationTime) { state = true; while (state) { SimEvent event = eventQueue.poll(); if (event == null) break; if (simulationTime > 0 && event.getOccurringTime() >= simulationTime) break; currentTime = event.getOccurringTime(); event.getOwner().process(event); } }
92b2e220-f7bf-4eb3-9d70-134029d811da
6
@SuppressWarnings("unchecked") private Set<WFF> makeCorrectDepthResults(WFF source) { HashSet<WFF> results = new HashSet<WFF>(); try { Logic logic = new ClassicalLogicS(); if (source.getFormula().length() < 1) { return results; }; formula = (Formula) logic.createExpression(source.getFormula()); ...
db516eba-9765-4fcf-bb81-79e4f17c40e3
3
@Override public void exportWrite(String path) { try { PrintStream ps = new PrintStream(path); ps.println("Number of nodes: " + Tools.getNodeList().size()); Configuration.printConfiguration(ps); ps.println(separator); Iterator<Node> it = Tools.getNodeList().iterator(); Iterator<Edge> eIt; ...
167bf117-21d9-4c7f-a506-e830b747a5e4
3
public GetDocumentsListResult genLoad() { HashoutListToDocument hashoutListToDocument = new HashoutListToDocument(); Id listId = parentId; if (listId == null) { listId = HashoutList.ALL_DOCUMENTS.getId(); } List<EntityDocument> documents = hashoutListToDocument.loadEntities(listId.getKey()); ...
c1fa9ee8-3d3c-4844-b874-03e5fba03ef7
8
private void initializePerson(){ //Roles and Job mRoles = new HashMap<Role, Boolean>(); //role to active mAtJob = false; //Lists mFriends = new ArrayList<Person>(); mEvents = Collections.synchronizedList(new ArrayList<Event>()); mItemInventory = Collections.synchronizedMap(new HashMap<EnumItemType, Int...
37c1aae4-18fc-48b6-a541-a4a49c359ecf
1
public final void pauseLayer(GameLayer layer) { if (!gameLayers.containsValue(layer)) { logger.error(new NullPointerException(), "Tried to pause a game layer that isn't registered to the GameScreen :: ", this); } else { layer.pause(); } }
f2c79471-5167-4175-bc93-d7bcb48f8026
6
public static void WritePaymentLog(String log, String id_payment){ StringBuilder sb = new StringBuilder(); try{ String path_log = "/home/terminal/Log/LogPayment/Payment_"+id_payment+".txt"; File Log_path = new File(path_log); if (!Log_path.exists()){ t...
98e87190-40e3-43b6-a424-05185a2bfcc4
9
private static boolean isCPFPadrao(String cpf) { if (cpf.equals("11111111111") || cpf.equals("22222222222") || cpf.equals("33333333333") || cpf.equals("44444444444") || cpf.equals("55555555555") || cpf.equals("66666666666") ...
88a91960-f9f6-4b20-a42d-0a167f547215
4
public int get(final int index) { final int i0 = index >>> 26; int[][] map1; if (i0 != 0) { if (map == null) return NOT_FOUND; map1 = map[i0]; if (map1 == null) return NOT_FOUND; } else map1 = map10; int[] map2 = map1[(index >>> 13) & 0x1fff]; if (map2 == null) return NOT_FOUND; ...
e69d6b3e-fc3d-4918-949c-1d4095a24b82
7
void removeDev (DeviceImpl dev) { synchronized (devices) { DeviceImpl d = (DeviceImpl)getDevice (dev.getAddress ()); int i; //if (MacOSX.trace) // System.err.println ("notify removeDev " + dev.getPath()); if (d == null || d != dev) ...
9debb6a6-5ea8-48d5-8ed9-843db53cac67
9
private double calculateScore(ArrayList<seed> seedlist) { double total = 0.0; for (int i = 0; i < seedlist.size(); i++) { double score = 0.0; double chance = 0.0; double totaldis = 0.0; double difdis = 0.0; for (int j = 0; j < seedlist.size(); j++) { if (j != i) { totaldis = totaldis + Math....
e24777aa-6b97-4bb0-9463-f7e766c67c75
7
private void drawMap() { int c; for(int i = 0; i < width; i++) { for(int j = 0; j < height; j++) { c = gameMap[i][j]; if(c == 0) mapView[i][j].setIcon(new ImageIcon(getClass().getResou...
d694cea7-0cfa-4eaa-8c41-b6ba4f292b1d
8
@Override public void onClick(MouseEvent e, int x, int y) { if(boardTool == BoardTool.MAKE_MOVE) { if(currentPlayerTurn == player) { int stat = board.makeMove(player, x, y); if(stat >= 0) { SoundManager.playStoneSound(); ...
8373139a-1bb6-4ccb-9073-b6d495a69691
7
public static List<CongressionalDistrict> createDistricts(List<CensusTract> tracts, int numDistricts, MapCoordinate seedCoordinate) { List<CongressionalDistrict> districts = new ArrayList<CongressionalDistrict>(); Quicksort sorter = new Quicksort(tracts, seedCoordinate); tracts = sorter.getS...
e8572d4d-6530-47dd-b2f3-877e2aca83a6
5
public static void main(String[] args) throws Exception { game = new XPilotGame(); view = new View(game); SoundManager.load(); JEasyFrameFull win = new JEasyFrameFull(view); win.addKeyListener((Keys)game.getCtrl()); // run the game while (true) { game....
9441410e-9231-4b91-875c-56b351909f87
4
@Override public <T> T select( String msg, Collection<T> candidates) { ImmutableList<T> copyList = ImmutableList.copyOf( candidates); this.writeln( msg); this.write( Message.CANDIDATE_BOX, this.formatCandidates( 0, copyList)); try { BufferedReader reader = new BufferedR...
f627cd48-27f9-4b11-b931-0455a3451fc8
0
@XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "OriginatorKeyInfo", scope = AgreementMethodType.class) public JAXBElement<KeyInfoType> createAgreementMethodTypeOriginatorKeyInfo(KeyInfoType value) { return new JAXBElement<KeyInfoType>(_AgreementMethodTypeOriginatorKeyInfo_QNAME, Key...
fd5a0156-e300-428e-aab8-749f559a244b
0
public void setStrategy(Strategy strategy) { this.strategy = strategy; }
2e6f16e8-b2bc-44ed-881c-dec7447cb5ae
2
private void closeWindow(final JWindow window) { fWindowClosed = true; if(fFadeOut && sWindowApi.isTranslucencySupported(Translucency.TRANSLUCENT, sMainScreen)) { final AnimationTimer animationTimer = new AnimationTimer(FrameRate.FPS_25); animationTimer.setDuration(ANIMATION_FADE_OUT_DURATION); animationTi...
a9032bf0-ab3c-4251-9a79-df5e256314e5
8
public static AsmProgram loadProgram(String fileName) throws AssemblerException { File file = new File(fileName); AsmProgram prog = new AsmProgram(Definitions.getInstance().getAddressesTable()); if (!file.exists()) throw new AssemblerException(fileName + " doesn't exist"); if (fileName.endsWith(".hack")) ...
c1ed791b-39f8-4f03-8ce1-6d41d24f466b
4
public static void main(String[] args) { System.out.println("Question 8: Duped"); Scanner keyboard = new Scanner(System.in); boolean invalid = true; String inputStr; do { System.out.print("Enter integers separated by commas: "); inputStr = keyboard.nextLine(); String[] strArray = inputStr.split(",")...
afc6dcb1-e6b9-45e0-8413-ae73581f4651
0
@Override public void onLoad() { LogOre.NAME = this.getDescription().getFullName(); this.getLogger().log(Level.INFO, "Loading configuration..."); this.cloader = new ConfigurationLoader(this); }
c0c851e5-2e1d-4ace-9070-7a1227a466b9
2
int getMaxCond(String name) { // returns the maximum condition, default is 0 File conditions = new File(subjects.getAbsolutePath() + "\\" + name + "\\conditions"); try { BufferedReader cFile = new BufferedReader(new FileReader(conditions)); Scanner scanner = new Scanner(cFile); int n; if (scanner.hasN...
2cc7fe9e-cc08-4a26-af63-a03744ef0c86
4
public void setChild(Position pos, QuadTreeNode newNode){ switch (pos){ case northWest: this.nw = newNode; break; case northEast: this.ne = newNode; break; case southWest: this.sw = newNode; break; case southEast: this.se = newNode; break; } }
2941ac6e-e394-4e52-984d-ef74da4023f2
5
@Override public void run() { try ( OutputStream outputStream = socket.getOutputStream(); Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(outputStream, true) ) { boolean done = false; while (!done && in.hasNextLine()...
962d998c-8ab6-4205-8449-9d72abfb60a3
1
public void SetMinimumPassenger(int minimumPassenger) { if(minimumPassenger < this.minimumPassenger) this.minimumPassenger = minimumPassenger; }
63c41658-1774-4bf1-a238-0d482866a2f2
6
@Override public void update(GameContainer gc, StateBasedGame s, int delta) throws SlickException { Thread timing = new Thread(new Runnable() { @Override public void run() { if(rectOn) { try { Thread.sleep(200); ...
c9bc0fdd-1294-4503-9ccf-4903819bbe3d
5
public void playSpells(){ String manaPool = ""; Collections.sort(p1.getHand()); for(Land l : this.p1.getLands()) if(!l.isTapped()) manaPool += l.getManaTypes(); for(int i = 0; i < this.p1.getHand().size(); i++){ Card c = this.p1.getHand().get(i); if(!c.getType().equals("land")) if(c.ca...
93f2246f-c6b7-47dc-9661-69804a45ed28
4
@SuppressWarnings("rawtypes") public static Boolean isNullOrEmpty(Object object) { if (object == null) { return Boolean.TRUE; } if (object instanceof String) { return ((String) object).trim().length() == 0; } if (object instanceof Map) { return ((Map) object).isEmpty(); } if (object instanceof C...
b594a824-f601-446c-a278-509c88ff18be
5
@Override public void applyReservePolicy(LibraryModel model, List<LibraryView> views, List<Item> toReserve, String borrowerID) { List<Item> availableItems = new LinkedList<Item>(); List<Item> toRemove = new LinkedList<Item>(); for (Item item : toReserve) { List<Reservation> reservations = getReservationsOf...
ffe5676f-9c69-49cd-a382-04bd78d19b78
5
public void move(int key) { Position p = new Position(position.x, position.y); switch (key) { case KeyEvent.VK_UP: currentOrientation = PLAYER_ORIENTATION.UP; p.y -= speed; break; case KeyEvent.VK_RIGHT: currentOrie...
dfa3beee-09d2-4556-ba4f-d4110d1b492c
0
public String goToUserProductsList() { this.retrieveAllProducts(); return "userProductsList"; }
f00255d5-c3f8-4244-a12b-c24d2f56b7b3
8
private void getResourcesFromXML(Document doc, PetriNet pn) { NodeList resourcesList = doc.getElementsByTagName("resource"); for (int i = 0; i < resourcesList.getLength(); i++) { Node nNode = resourcesList.item(i); if (nNode.getNodeType() == Node.ELEMENT_NODE) { ...
d811ff9e-a64d-4634-bc99-714179fb949d
5
public Descriptor findMessageTypeByName(String name) { // Don't allow looking up nested types. This will make optimization // easier later. if (name.indexOf('.') != -1) { return null; } if (getPackage().length() > 0) { name = getPackage() + '.' + name; } final ...
31380386-a668-4ad3-9aac-a0ab06cfacbc
3
public static ArrayList<String> load(String packageName) { URL root = Thread.currentThread().getContextClassLoader().getResource(packageName.replace(".", "/")); File[] files = new File(root.getFile()).listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { ...
bf268cae-ea3c-4319-a5b6-d64614b71436
1
private void itmMnuDepartamentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itmMnuDepartamentoActionPerformed // Menu - Cadastro > ItemMenu - Departamento //Instancia uma tela de cadastro de Departamento se o usuario que esta logado for Um diretor; //caso não seja um dire...
164572d0-1f2b-4af2-9eac-29aa78620f6d
4
@SuppressWarnings("unchecked") private Object checkTypeAndReturnObject(Column column, Class clazz) { if (clazz.isAssignableFrom(column.getType()) || clazz == Long.class && java.util.Date.class.isAssignableFrom(column.getType())) { if (columns.containsKey(column)) { return columns.get(column)...
d678306e-3f94-41d9-8f3c-032934a6fca7
9
private void updateGate(String CLK, String CLR, String J, String K, String Q, String NQ) throws InvalidPinException { if (this.isLow(CLR)) { this.setPin(Q, Pin.PinState.LOW); this.setPin(NQ, Pin.PinState.HIGH); } else if (this.isRisingEdge(CLK)) { if (this.isLow(J) && this.isHigh(K)) { this.setPin(Q, P...
04e6472c-7db1-4d70-b634-55ac7251dc29
6
private static eCoreInventory loadInventory(OfflinePlayer player, YamlConfiguration yamlConfig, boolean eventInv){ String configPath = eventInv?"eCoreInv.":"normalInv.", tempPath; eCoreInventory inv; int amount; List<ItemStack> tempItems = new ArrayList<ItemStack>(); Map<String, ItemStack[]> serialized = new Hash...
307c9430-ebb0-4c13-b65a-b6ecd099e8d5
2
public static void addTile(String tileName, Point2D pos) { if(tiles.get(tileName) == null) { tiles.put(tileName, new Model2D(new String[]{tileName})); } if(tilePos.get(tileName) != null) { tilePos.get(tileName).add(pos); } else { tilePos.put(tileName, new ArrayList<Point2D>(Arrays.asList(pos))); }...
8c4cea20-c52e-4b3b-9284-2a6b39751d5b
0
public Dirt() { super(new Color(95, 75, 9), true); }
ec675d24-eb3b-4438-ae2c-3aa9011b4dc3
6
public static void render(World world){ GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor3f(0.2f, 0.2f, 0.2f); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(0 + Game.PLAYER.getCameraX(), 0 + Game.PLAYER.getCameraY()); GL11.glVertex2f(Game.SCREEN_WIDTH + Game.PLAYER.getCameraX(), 0 + Game.PLAYER.getCameraY...
3a7227c9-317a-4d25-afbd-46d4d239c5a8
3
public void makeMenus() { JMenuItem mi; // used in various spots JMenuBar mb = new JMenuBar(); parentFrame.setJMenuBar(mb); ResourceBundle b = ResourceBundle.getBundle("Menu"); JMenu fm = mkMenu(b, "file"); fm.add(mi = mkMenuItem(b, "file", "open")); mi.addActionListener(new ActionListener() { pub...
9d3f53c6-4a14-41fd-922f-4648c9a5e696
0
public Diamant(Rectangle masse, IntHolder unit, int points) { super(masse, unit); this.points = points; }
35122a4b-74e7-49c1-a08f-808ab056d515
3
private String getSlotContents(int par, int chi) { String scLine = ""; int[] contents = c.widgets.get(par, chi).getSlotContents(); if (contents != null) { for (int i = 0; i < contents.length; i++) { scLine = scLine + contents[i]; if (i < contents.lengt...
f22d39af-247c-481e-879b-2e23255545e6
0
@Override public String getMessageText() { String msg = oldName + " " + settings.getLanguage().getLabel("text_rename") + " " + newName; return msg; }
60ccd239-b450-4600-b736-377574bc5b92
5
public boolean delete_text(int beginIndex, int endIndex) { if(beginIndex < 0 || beginIndex > endIndex || endIndex > maxChars) {return false;} int deletionLength = endIndex - beginIndex; length -= deletionLength; for(int currentIndex = beginIndex; curre...
b35e4b94-10f1-4146-8013-0cb5a67013a0
1
public boolean EliminarTrabajo(Trabajo p){ if (p!=null) { cx.Eliminar(p); return true; }else { return false; } }
a91711c5-6bdf-49c2-a52a-01e648c85b63
0
public void setId(Long id) { this.id = id; }
8527f060-174b-4e92-a837-e0debd0d199c
3
public Tree relationalExpressionPro(){ Tree firstConditionalExpression = null, secondConditionalExpression = null; Symbol operator = null; if((firstConditionalExpression = additiveExpressionPro()) != null){ if((operator = accept(Symbol.Id.PUNCTUATORS,"(>=?|<=?)")) != null){ if((secondConditionalExpression...
144de9ff-e99d-4484-a9fb-12e39da4f36d
8
@Override public SemiLease write(final ISemiSpaceTuple entry, final long leaseTimeMs) { if (entry == null) { return null; } // log.logDebug( "WRITE: "+entry.getJSON()); //System.out.println("SemiSpace.write-1 "+entry); WrappedInternalWriter write = new WrappedInternalWriter(...
74bcd3c4-9d68-42bf-8349-65a454d7afc2
4
public boolean equals(Object o) { GUID g = (GUID)o; return d1 == g.d1 && d2 == g.d2 && d3 == g.d3 && d4 == g.d4 && d5 == g.d5; }
7cea1b26-1934-400a-a194-ef05dc73c877
8
public static void main(String[] args) { int run = 13; boolean roll = true; long rollingProduct = 0; long largestProduct = 0; int largestProductIndex = 0; String numbers = "731671765313306249192251196744265747423553491949349698352031277450632623957831801698480186947885184385861560789112949495459501737958331...