method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
761eaa7e-b15e-46d7-bbe4-8bbd0555554b
6
public void testValueCollectionToArray() { int element_count = 20; int[] keys = new int[element_count]; String[] vals = new String[element_count]; TIntObjectMap<String> raw_map = new TIntObjectHashMap<String>(); for (int i = 0; i < element_count; i++) { keys[i] = i +...
db1db7d0-1a10-4c5d-8a3f-2d9ab93eb6ae
2
@EventHandler(priority = EventPriority.NORMAL) public void onBlockBurn(BlockBurnEvent event) { if (event.isCancelled()) return; // plugin.debug(event.getEventName()); Block block = event.getBlock(); if (plugin.isProtected(block)) { plugin.debug("Blocking block burn at " + block.getWorld().getName() + " "...
990799c9-9bc6-4a3e-b366-147c518c7f7d
2
private void populateEntity() { enemys = new ArrayList<Enemy>(); entities = new ArrayList<EntitySpecial>(); Slugger s; Crawler c; Point[] points = new Point[] {}; Point[] points2 = new Point[] {}; for (int i = 0; i < points.length; i++) { s = new Slugger(tileMap); s.setPosition(points[i].x, points[i...
143b712b-f246-4d69-93fc-38cd0a1711a3
9
public static LinkedList<Pair<Integer, Set<CharacterClass>>> getOverlaps(Set<CharacterClass> ccs) { LinkedList<Pair<Integer, Set<CharacterClass>>> overlaps = new LinkedList<Pair<Integer,Set<CharacterClass>>>(new Pair<Integer, Set<CharacterClass>>(0, new ShareableHashSet<CharacterClass>())); // insert all ranges ...
bbd78def-6c61-4c66-88ec-4fa4523ed3b1
8
protected Map<Integer, Sugar> getFreeSugar() { Map<Integer, Sugar> freeSugar = new HashMap<Integer, Sugar>(); for (Sugar sugar : getSugar().values()) { boolean free = true; for (Team team : world.getTeams().values()) { for (Ant ant : team.getAnts().values()) { if (!ant.isSweet()) continue; ...
6113ffc3-4ec7-4900-8646-671dc9d55889
5
public boolean isBST2(BTPosition<T> current, T min) { if (current == null) return true; Stack<BTPosition<T>> s = new Stack<>(); while (!s.isEmpty() || current != null) { if (current != null) { s.push(current); current = current.getLeft(); } else { current = s.pop(); if (comp.compare(min...
9c626436-9f78-4997-a74d-d87750b7115e
8
private TableColumn<Object, ?> getNextColumn(boolean forward) { List<TableColumn<Object, ?>> columns = new ArrayList<>(); for (TableColumn<Object, ?> column : getTableView().getColumns()) { columns.addAll(getLeaves(column)); } //There is no other column that supports editing....
f85050cf-279b-4fc6-b914-d167a5eba183
1
@Override public DBConfig get() { Properties props = new Properties(); try { FileReader reader = new FileReader("Database.properties"); props.load(reader); } catch(IOException io) { } log.info("------- URL--------- : " + System.getProperty("connection.url")); log.info("------- USER ------- :...
d963c71d-1729-47ca-b255-c14c2479cb4e
5
private void postPlugin(boolean isPing) throws IOException { // Server software specific section PluginDescriptionFile description = plugin.getDescription(); String pluginName = description.getName(); boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enab...
367f6cd4-e860-4eac-8a3c-aba48785144e
2
public Coordinate getEndPoint1() { Coordinate coord1 = new Coordinate(0,0); if ((rotation % 2) == 1 ) { coord1 = new Coordinate(x-100, y); } if ((rotation % 2) == 0 ) { coord1 = new Coordinate(x, y-100); } return coord1; }
e1ac09c2-4323-4288-8e9a-d5b750ddd927
1
public void flush() throws IOException { synchronized(forked) { for(OutputStream s : forked) s.flush(); } }
c2354a64-acb5-4b84-9178-75be46738d42
5
public static void addModsToInstallation() { TroveModLoader.getTroveModLoaderGUI().disableButtons(true); if (getTroveInstallLocation() != null && !getTroveInstallLocation().isEmpty()) { File installDirectory = new File(getTroveInstallLocation()); for (File mod : TroveMods.getMods...
8df548c6-a7fe-4555-b2e9-427a7bc6d6ef
5
public void setup(String prefixChat, String prefixPermissions, boolean createDirectory) { server = getServer(); this.prefixChat = (prefixChat + ChatColor.WHITE); this.permissionHandler = new PermissionHandler(prefixPermissions); this.permissionHandler.setupPermissions(); this.myLog = new MyLogger(this.getDesc...
7670019e-fe15-4473-998b-9b43b28e88c1
2
synchronized public void writeEnableContinuousUpdates(boolean enable, int x, int y, int w, int h) { if (!cp.supportsContinuousUpdates) throw new ErrorException("Server does not support continuous updates"); startMsg(MsgTypes.msgTypeEnableContinuousUpdates); ...
fcc1e263-7bbc-444c-9ad7-629350b281db
1
public void gameOverPopUp(){ manager.removeKeyEventDispatcher(controls); nomJoueur = JOptionPane.showInputDialog(null, "Fin de la partie \nNombre de rangée compléter : " + nbRangeeCompleted +"\nEntrez votre nom pour le classement."); temps = (int)((System.currentTimeMillis() - startTime)/1000) ;...
49ead75c-5cb9-46dc-861f-a143383957c6
0
public String getName() { return name; }
198109a1-55aa-4837-b5d5-534c379f5cd4
1
@Override public byte[] getHTTPMessageBody() { PartialContentParser partialContentParser = new PartialContentParser(byteRange); try { return partialContentParser.getPartialContent(Files.readAllBytes(Paths.get(directory + "/" + uri))); } catch (Exception e) { e.printStackTrace(); } ...
22d490d8-3277-4232-b43a-01e4644f6036
4
public void setSize(Dimension paramDimension) { MapCell[][] arrayOfMapCell = new MapCell[paramDimension.width][paramDimension.height]; for (int i = 0; i < paramDimension.width; i++) for (int j = 0; j < paramDimension.height; j++) if ((i >= this.mapsize.width) || (j >= this.mapsize.height)) ...
2ca1648b-25e6-4e35-8811-d3d1eeefee87
5
public void messageReceived(MessageEvent e) { if (!Widgets.get(335).getChild(9).isOnScreen() || !Widgets.get(334).getChild(8).isOnScreen()) { if (e.getMessage().toLowerCase().contains("ilovehf") || e.getMessage().toLowerCase().contains("i love rs")) { if (!getPlayerName(e.getSender())) { play = e...
542e7d0a-0cb5-4e8a-aefb-385986df8b7b
5
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed /* Muestra los datos de las ventas comprendidas entre los montos ingresados en los Spinner, * estos valores son validados de modo que el valor maximo sea mayor que el mínimo requerido. ...
5c18a310-849f-4657-ae50-8c0f9489f0bc
6
public static <T extends RestObject> T postRestObject(Class<T> restObject, String url) throws RestfulAPIException { InputStream stream = null; try { HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection(); conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Mac...
454fbbdf-1730-4946-a319-21433732529c
3
public static void printAll() { try { PreparedStatement stmt = Main.EMART_CONNECTION.prepareStatement("select * " + "from customer"); ResultSet rs = stmt.executeQuery(); System.out.println("Customers:"); while (rs.next()) { System.out.println(rs.getString("cid") + " | " + rs.getString("pass...
1b97c778-9416-4238-b6ce-d1d5dc0ed1d8
2
public void removePhiAtBlock(final Block block) { final PhiStmt phi = phis[cfg.preOrderIndex(block)]; if (phi != null) { if (SSA.DEBUG) { System.out.println(" removing " + phi + " at " + block); } phi.cleanup(); phis[cfg.preOrderIndex(block)] = null; } }
0301273f-950c-421c-aa83-f3d55f97fc3f
9
protected Collection<Object> getCellsForChange(mxUndoableChange change) { mxIGraphModel model = getGraph().getModel(); Set<Object> result = new HashSet<Object>(); if (change instanceof mxChildChange) { mxChildChange cc = (mxChildChange) change; Object parent = model.getParent(cc.getChild()); if (cc....
6938452b-6357-46dd-808e-43bfc0d0585f
1
public boolean delete(Prestamos p){ PreparedStatement ps; try { ps = mycon.prepareStatement("DELETE FROM Prestamos WHERE id=?"); ps.setInt(1, p.getId()); return (ps.executeUpdate()>0); } catch (SQLException ex) { Logger.getLogger(PrestamosCRUD.clas...
559a6253-4e3d-4c89-882a-1b8228afc72f
1
public Speaking(Gob gob, Coord off, String text) { super(gob); if(sb == null) sb = new IBox("gfx/hud/emote", "tl", "tr", "bl", "br", "el", "er", "et", "eb"); svans = Resource.loadtex("gfx/hud/emote/svans"); this.off = off; this.text = Text.render(text, Color.BLACK); }
41149dcc-c108-41cf-b397-df0673c079da
1
@Override public boolean equals(Object obj) { return obj instanceof SinglePlayerGame ? ((SinglePlayerGame) obj).name.equals(this.name) : false; }
44f50ae5-fa79-4b14-bed3-007694359397
8
protected void updateTargetRequest() { repairStartLocation(); ChangeBoundsRequest request = (ChangeBoundsRequest) getTargetRequest(); request.setEditParts(getOperationSet()); Dimension delta = getDragMoveDelta(); request.setConstrainedMove(getCurrentInput().isModKeyDown( MODIFIER_CONSTRAINED_MOVE)); re...
f298940e-3330-49b8-9410-0f9259efcd66
8
public static void printRes(int one, int two, int five, int ten, int twenty, int fifty, int hund, int twoHund) { for(int i = 0; i < one; i++) System.out.print("one, "); for(int i = 0; i < two; i++) System.out.print("two, "); for(int i = 0; i < five; i++) System.out.print("five, "); for(int i = 0; i < t...
7e4e4c8f-8585-4bc9-804c-217eff01db97
5
@Override public void setRandomSeed(long seed) { r = new Random(seed); for (int i = 0; i < size; i++) for (int j = 0; j < size; j++) for (int k = 0; k < zsize; k++) for (int d = 0; d < density; d++) for (int e = 0; e < dimen...
634fcb0b-0d7d-4bd2-a981-1392aea21f50
3
public void execute(CommandSender sender, String[] args) { if (!sender.hasPermission("bungeeannouncer.admin")) { sender.sendMessage(FontFormat.translateString("&4You do not have permission to use this command")); return; } if (args.length != 1) { sender.sendMessage(FontFormat.translateString("&7Usage: /a...
a10da770-931b-4669-bb4e-754ab88496ec
3
private void grow() { Bucket[] oldBuckets = buckets; int newCap = buckets.length * 2 + 1; threshold = (int) (loadFactor * newCap); buckets = new Bucket[newCap]; for (int i = 0; i < oldBuckets.length; i++) { Bucket nextBucket; for (Bucket b = oldBuckets[i]; b != null; b = nextBucket) { if (i != Math....
202c5ac3-e84b-46be-b339-f26ee7ed2d5b
5
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: if (time == null) { JOptionPane.showMessageDialog(null, "Por favor, selecione uma data para pesquisar"); return; } ...
c9d605c3-f1be-4898-9400-a5e60e24fba9
1
public String getEntityValue(String ename) { Object entity[] = (Object[]) entityInfo.get(ename); if (entity == null) { return null; } else { return (String) entity[3]; } }
e3c8bbce-4c7e-4f0e-9c56-b64c226f5612
2
private void processPacketQueue() { if (this.packetBuffer.size() > 0 && !this.encoding) { Packet pack = this.packetBuffer.remove(0); this.packet(pack); } }
f1ec3693-7d3f-4c10-8611-f951767421f1
1
public static void handleNick(String nick) { if ( nick.isEmpty() ) { appendError("Nebyla zadána nová přezdívka."); return; } getCurrentServerTab().getConnection().changeNick(nick); clearInput(); }
36e54c09-7488-4ceb-92aa-b4e0a41cfaa4
4
public void keyPressed(KeyEvent key){ if(key.getKeyCode() == KeyEvent.VK_ESCAPE){ if(!over){ paused = !paused; }else{ st.currentLevel = 0; } } if(key.getKeyCode() == KeyEvent.VK_ENTER){ if(over){ restart(); } } }
53b29f03-4056-4482-99e2-272236e2760d
5
public Stats getLastStats(int mode) { try { switch(mode) { case 0: return getStatsOsuStandard(new TreeSet<>(this.stats_normal.keySet()).last()); case 1: return getStatsTaiko(new TreeSet<>(this.stats_taiko.keySet()).last()); case 2: return getStatsCTB(new TreeSet<>(this.stats_ctb.ke...
2115f15e-b6eb-4e3f-b0e4-5dbb9b960b7b
8
@Override public void update() { super.update(); boolean finished = false; if(generationNum==numGenerations && !flag) { flag = true; OrganismRepository.getInstance().printResults(); System.out.println("=================================!"); System.out.println("FINISHED!"); System.out.println(...
91d5dd1b-f26b-483e-9ddd-1b61577dc7ff
7
protected boolean endsWithCVC (String str) { char c, v, c2 = ' '; if (str.length() >= 3) { c = str.charAt(str.length() - 1); v = str.charAt(str.length() - 2); c2 = str.charAt(str.length() - 3); } else { return false; } if ((c == 'w...
488c6ae1-1664-49fc-892d-9b11ff1b82b4
7
public void removeItem(int slot, int amount) { Item item = beastItems.get(slot); if (item == null) return; Item[] itemsBefore = beastItems.getItemsCopy(); int maxAmount = beastItems.getNumberOf(item); if (amount < maxAmount) item = new Item(item.getId(), amount); else item = new Item(item.getId(), ...
0d5ec53c-97d3-4bc7-b5af-6f820d1bd8ba
8
private void handleAction() { if(actionButton.getText().equals("Find IP")){ Integer ip = dnsDB.findIP(nameText.getText()); if(ip == null){ JOptionPane.showMessageDialog(GUI.this, "Could not find an IP address with host name: " + nameText.getText()); } else{ ipText.setText(DNSDB.IPToString(ip)); ...
4b9a49fc-a609-4bbb-a9cc-621ba6b92531
5
public void saveResult() { if (ea != null && ea.bestSolution != null) { fj.showSaveDialog(this); if (fj.getSelectedFile() != null) { try { PrintWriter out = new PrintWriter(fj.getSelectedFile()); for (int i = 0; i < ea.bestSolution....
8c37cba2-1fd8-4d04-aa77-9878719d4acf
2
private void affTraceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_affTraceActionPerformed if (trace == false){ trace = true; } else if (trace == true){ trace = false; } }//GEN-LAST:event_affTraceActionPerformed
bdb5a479-8d8d-46c8-aee2-61a286096a6c
9
public void printZigZag(BSTNode<T> root) { LinkedList<Pair> nextLevelStack = new LinkedList<>(); // this keeps odd level nodes LinkedList<Pair> currentLevelStack = new LinkedList<>(); // this keeps even level nodes //add the root to even level stack currentLevelStack.addFirst(new Pair(...
77e7b00f-84f9-4ac4-9b12-60dfcf23c1c8
4
public void run() { prevFps = 0; fps = 0; prevTime = System.nanoTime(); // grab current time in nano second this.preStart().start().postStart(); while (this.sceneOnPlay()) { currTime = System.nanoTime(); length = currTime - prevTime;...
13a23dff-63d5-479a-85f2-3fe5d59e1456
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 ListasItens)) { return false; } ListasItens other = (ListasItens) object; if ((this.iListaItens == null && othe...
bb85a992-3d46-46ce-8643-4c7522194756
6
@Override public Product getProduct(String id) { Product prod; Session session = null; Transaction trx = null; try { session = sessionFactory.openSession(); trx = session.beginTransaction(); Criteria cr = session.createCriteria(Product.class); cr.add(Restrictions.eq("asin", id)); List re...
d8935510-2d8b-4c90-94b4-68b75682024c
2
public boolean isExist(int number, int counter){ int x = 0; while(x < counter){ if(number == randlist[x]){ return false; } x++; } return true; }
567ca692-4c97-47de-bb0d-3a330b428dab
9
private Shape createShapeWithOneParameter(BufferedReader reader, String shape, ShapeColor color, Map<String, String[]> shapeMap) { // Ask for one parameter System.out.println(shapeMap.get(shape)[0] + ":"); double param = readParameter(reader); // Create class try { shape = "Shapes." + StringUtils.capi...
1bf12aa5-81a2-4982-9b72-7ee601a6fcdb
8
public CodeMap8 set(final int index, final int value) { final int i0 = index >>> 28; int[][][][][][][] map1 = map[i0]; if (map1 == null) map[i0] = map1 = new int[MAX_INDEX][][][][][][]; final int i1 = (index >>> 24) & 0xf; int[][][][][][] map2 = map1[i1]; if (map2 == null) map1[i1] = map2 = new int[M...
7263d7da-8f6b-4875-8280-4afceac2a52f
7
public void shortestPaths(int s, int t) { /* Initialize structures */ for (int i = 0; i < g.getNumVertices(); i++) { inTree[i] = Boolean.FALSE; distance[i] = Double.MAX_VALUE; parents[i] = -1; } distance[s] = 0; int x = s; while (!inTree[x]) { inTree[x] = Boolean.TRUE; /* ...
9cc56eff-4db9-4406-875f-030952ed81b0
8
public void actionPerformed(ActionEvent e) { for (int i = 0; i < enemyHeads.size(); i++) { EnemyHead a = (EnemyHead) enemyHeads.get(i); if (a.isVisible()) a.move(); else enemyHeads.remove(i); } try { heads.move(); ...
d32370f3-3356-4aa4-9af6-3e6d7a6da1f6
0
Rectangle(double x, double y, double width, double height) // constructor { this.X = x; this.Y = y; this.Width = width; this.Height = height; }
c4c0ace0-05be-484d-a4e5-8acd66f31d93
7
@Override protected int drawUnselectedText(Graphics graphics, int x, int y, int p0, int p1) { setRenderingHits((Graphics2D) graphics); Font saveFont = graphics.getFont(); Color saveColor = graphics.getColor(); SyntaxDocument doc = (SyntaxDocument) getDocument(); S...
fd55a4d5-aa2b-4246-b67d-db433e8e6210
9
@Override protected void updateBucketVersioningStatusImpl(String bucketName, boolean enabled, boolean multiFactorAuthDeleteEnabled, String multiFactorSerialNumber, String multiFactorAuthCode) throws S3ServiceException { if (log.isDebugEnabled()) { log.debug( (enabled ...
44d6930e-a505-404c-9ade-185cbfaf7088
1
public void addUser(User user) { try { beginTransaction(); session.save(user); session.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); } finally { closeSession(); } }
812d3f69-7374-47e7-bd43-d047d7bf55c3
7
protected static Date handleDateSpecification(String specification) throws NumberFormatException, ParseException { if (specification == null) return null; else if (specification.toLowerCase().startsWith("in ")) { specification = specification.substring(3).trim().replace(" +", "").toLowerCase(); long expiry...
67538ae6-3bb5-49ad-91ab-9e05394e39f0
0
public void setFile(File file) { File oldFile = this.file; this.file = file; distributeFileChangeEvent(new FileChangeEvent(this, oldFile)); }
56f98600-8c3a-4299-b6e6-884f2c6a3e79
4
public void testObtenirDocument() { // simulation de documents PreProcessingEngineFichier pPEFichier = new PreProcessingEngineFichier(); try { String racine = new String(); if (System.getProperty("os.name").equals("Windows 8.1")) { racine = "C:/Users/Jérémie/Documents/TU/CrawlerTest/"; } else { r...
cbbe36f5-9d60-46a3-9d1b-253d6020df12
7
private void processMouseDraggedEvent(MouseEvent e) { if (!isEnabled()) return; int x = e.getX(); int w2 = knob.width / 2; if (knobHeld) { if (x > w2 && x < fillLocator + w2) { knob.x = x - w2; } else if (x <= w2) { knob.x = 0; } else if (x >= fillLocator + w2) { knob.x = fillLocat...
ac039655-8ba8-4efe-93be-53f20be66d18
0
public static Filter isAbstract() { return new IsAbstract(); }
62e760a9-0d77-4399-8dff-8379642e5b16
5
public static boolean writeEvents(int numNodes, int idTraffic) { double percent = 0; int qntNodeEv = 0; double lambda = 0; Distribution distTraffic = null; System.out.println("------------------------------------------------------"); System.out.println("ConfigTest"); System.out.println("--------------...
c64ea6d8-0ec3-4e97-b67b-ea0d3695948f
4
protected void FillBuff() throws java.io.IOException { int i; if (maxNextCharInd == 4096) maxNextCharInd = nextCharInd = 0; try { if ((i = inputStream.read(nextCharBuf, maxNextCharInd, 4096 - maxNextCharInd)) == -1) { inputStream.close()...
800d274a-d1a9-4a31-802b-415bb24d2a39
3
@Override public boolean acceptsDraggableObject(DraggableObject object) { if(object instanceof DraggableObjectFile) { DraggableObjectFile fileobj = ((DraggableObjectFile)object); if(fileobj.file != null) { if(Animation.isValidFile(fileobj.file.getName())) return true; } } return false; }
f27f6158-b798-4a94-9630-201863ba27eb
4
public int upgradeLevel(Upgrade type) { if (upgrades == null) return 0 ; int num = 0 ; for (int i = 0 ; i < upgrades.length ; i++) { if (upgrades[i] == type && upgradeStates[i] == STATE_INTACT) num++ ; } return num ; }
1df034cc-77b9-4310-a548-4b92d9989223
5
public String[] getLine() throws IOException{ int lineNumber = -1; ArrayList<String> v = new ArrayList<String>(); if (tokenCache != null){ v.add(tokenCache); lineNumber = lineCache; } while ((tokenCache = lexer.getNextToken()) != null && (l...
bbaa6a52-5304-4dce-b1da-df063996b516
6
public static void main(String[] args) throws FileNotFoundException, IOException { BufferedReader br = new BufferedReader(new FileReader("jobs.txt")); int number = Integer.parseInt(br.readLine()); final Integer[][] schedule1 = new Integer[number][3]; final Double[][] schedule2 = new Double[number][3]; long s...
54723501-98e4-484c-be0d-70a2201c5fab
0
private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed //Se finaliza el programa System.exit(0); }//GEN-LAST:event_jMenuItem4ActionPerformed
7742b049-d1a7-4d61-a897-f19207393ede
1
public void setReload(final Expr expr, final boolean flag) { if (SSAPRE.DEBUG) { System.out.println(" setting reload for " + expr + " to " + flag); } reloads.put(expr, new Boolean(flag)); }
35f8a5b5-28e4-414e-8b15-882d5b5d7631
4
public Game() { // Set the instance variable instance = this; BoardSize = Options.getGameSize(); Player1 = Options.Player1; Player2 = Options.Player2; thisTurn = Player1; TimerRunning = false; ConsecutiveRun = 0; // Reset the scores and turns of each player Player1.newGame(); Player2.newGame...
c0ca1d11-d417-43fa-ab8e-e261f7beb17e
4
@Override public boolean equals(Object o) { if (o instanceof Peer) { Peer p = (Peer) o; if (p.peer_ip.equals(this.peer_ip) && p.port_number == this.port_number) { return true; } return false; } else if (o == this) { return true; } else { return false; } }
153cff93-66fd-4725-8fa6-17e85c6d105a
0
public void setPcaCantidad(Integer pcaCantidad) { this.pcaCantidad = pcaCantidad; }
7dc2937a-93e5-4065-acbb-a7a42066b2ba
5
public boolean getUse(String compType) { switch (compType) { case "Ext": return useExtension; case "Hash": return useHash; case "Name": return useName; case "Size": return useSize; case "Thorough": return useThorough; default: return false; } }
b65a223b-8369-4292-872b-3102e21ea361
7
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost,msg); if((affected!=null) &&(affected instanceof MOB) &&(msg.amISource((MOB)affected)||msg.amISource(((MOB)affected).amFollowing())||(msg.source()==invoker())) &&(msg.sourceMinor()==CMMsg.TYP_QUIT)) { ...
510d18b7-a329-4553-8a3b-2aa0a7c81f80
3
static ChannelError fromSigError(int flag, int ctype, ByteBuffer data) { String message = ""; message = "Bad signal"; if (ctype == ContentType.UTF8 && data != null) { Charset charset = Charset.forName("UTF-8"); CharsetDecoder decoder = charset.newDecoder(); ...
c6c8f50f-23c9-4f75-9e5b-3ee5cbcd9f9c
4
public static void catalog(String contentRoot, String catalogFile) { //TODO add support for refreshing or adding to catalog // Try to open the output file before spending all that time doing // processing, in case the file path was wrong. ObjectOutputStream oos = null; try { ...
e39d1c27-175a-4943-bc51-9edee245f51a
5
public double getDiffuseLayerPotential(){ if(!this.sternOption){ System.out.println("Class: GouyChapmanStern\nMethod: getDiffuseLayerPotential\nThe Stern modification was not included"); System.out.println("The value of the diffuse layer potential has been set equal to the surface potent...
4cab19f1-6707-442b-ab15-2df5bbe76022
7
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.setContentType("image/jpeg"); BufferedImage bi = new BufferedImage(300,203,BufferedImage.TYPE_INT_RGB); //int[] rgbarray={255,48,48}; //bi.setRGB...
c8730980-9a31-4cf5-b8b6-4e2e23fa2f11
3
public static String trimTrailingCharacter(String str, char trailingCharacter) { if (!hasLength(str)) { return str; } StringBuilder sb = new StringBuilder(str); while (sb.length() > 0 && sb.charAt(sb.length() - 1) == trailingCharacter) { sb.deleteCharAt(sb.length() - 1); } return sb.toString(); }
69b3dae7-ff70-4197-921b-f6c29de155b6
0
public void setDestTermid(String[] destTermid) { DestTermid = destTermid; }
f71e0c46-7e68-4ea0-8f1b-1d9e6b1ac498
3
public void computeCellsToSolve() { int cells = 0; for (int i = 0; i < 9; i++) { for (int j = 0; j < 0; j++) { if (board[i][j].getValue() == 0) { cells++; } } } cellsToSolve = cells; }
f5ecdcb1-fe28-4923-8b81-2a47af52660f
0
public void setGraphPanel(GraphPanel graphPanel) { this.graphPanel = graphPanel; }
7b5a359f-2443-4848-a0d5-daf3147caacf
9
@Test public void bothPlayersPlaceButterflyAndContinueSeed5() throws HantoException { HantoGameManager.clearInstance(); HantoPlayer bluePlayer = new HantoPlayer(); HantoPlayer redPlayer = new HantoPlayer(); bluePlayer.RANDOM_SEED = 5; bluePlayer.startGame(HantoGameID.EPSILON_HANTO, HantoPlayerColor.BLUE, t...
a055640b-a25c-4c7a-8d69-cf53769d1d7c
4
private static Set findFinal(Automaton a) { Set finalized = new HashSet(); finalized.addAll(Arrays.asList(a.getFinalStates())); boolean added = finalized.size() != 0; Transition[] t = a.getTransitions(); while (added) { added = false; for (int i = 0; i < t.length; i++) if (finalized.contains(t[i].ge...
fe4cfb57-a0c2-4065-ace1-d21ff9a7d137
6
@Override public void solve(BlockMatrix64F B, BlockMatrix64F X) { if( B.blockLength != blockLength ) throw new IllegalArgumentException("Unexpected blocklength in B."); D1Submatrix64F L = new D1Submatrix64F(chol.getT(null)); if( X != null ) { if( X.blockLength != bl...
127bb504-4504-40e7-b6c5-8f9ca51d3b72
5
private final void isaac() { int i, x, y; b += ++c; for (i = 0; i < SIZE; ++i) { x = mem[i]; switch (i & 3) { case 0: a ^= a << 13; break; case 1: a ^= a >>> 6; break; case 2: a ^= a << 2; break; case 3: a ^= a >>> 16; break; } a += mem[i + SIZE / 2 & SIZE ...
a83c0933-ce68-46ea-a923-54829495a815
7
private boolean generateSaveLocals(Node node) { int count = 0; for (int i = 0; i < firstFreeLocal; i++) { if (locals[i] != 0) count++; } if (count == 0) { ((FunctionNode)scriptOrFn).addLiveLocals(node, null); return false; ...
60de5672-1e46-42a8-9701-5663518638e4
5
@Override public int getCurrentFrame() { assert !isGameOver(); int currentFrame = 1; for (int i = 0; i < rollCount; i++) { int pinsKnockedDown = pinsKnockedDownArray[i]; if (currentFrame == 10) { return 10; } if (pinsKnockedDown == 10) { currentFrame++; } else if (pinsKnocke...
ddd22cd9-60a7-4cf5-913a-91b034494a07
2
@Override public void onAddParent( GameObject parent ) { super.onAddParent( parent ); if ( triangles != null ) { for ( Triangle triangle : triangles ) parent.addComponent( triangle ); } }
f64bc70e-a8a4-4f52-ba93-2db7a82022a0
7
public int ingresarPreguntaTema(Pregunta_Tema p) { try { if (con.isClosed()) { con = bd.conexion(); } String consulta; if (p.getRespuesta() != 0) { consulta = "INSERT INTO Pregunta_Tema VALUES('" + p.getTema().getCodigo() + "','" + ...
59066e46-17a5-4396-9564-6a198e8e2abe
8
static String nameHand(int rank) { String name; switch (rank) { case 9: name = "Strait Flush"; break; case 8: name = "Four of a Kind"; break; case 7: ...
f7fda357-bc90-49a7-9b5d-96661d9c73ff
7
public final static boolean finish() throws FatalError { try { // HTTP parameters stores header etc. HttpParams params = new BasicHttpParams(); params.setParameter("http.protocol.handle-redirects", false); HttpGet httpget = new HttpGet(Config.getHost() + "arbeitsamt/index"); httpget.setParams(params)...
60ee7f9a-e068-466f-8614-9808c9b661bd
7
public void run() { if(duration != -1) { Robot.getInstance().getMotion().getPilot().backward(); Delay.msDelay(duration); if(!getInterrupted()) { Robot.getInstance().getMotion().getPilot().stop(); Robot.getInstance().getMotion().setRunnableRobot(null); Robot.getInstance().warn(new Event(TypeEvent....
3c420a30-4c7d-4ae9-aad3-a71b80543221
8
public void compExecTime() { double newExeTime; double newCost; dEval = 0; dTime = 0; dCost = 0; for (int i = 0; i < iClass; i++) { newExeTime = 0; // System.out.print("Cost[" + i + "]"); for (int j = 0; j < iSite; j++) { if (dmAlloc[i][j] != -1) { if (dmAlloc[i][j] < 1) { newExeTime...
b5af019d-aa54-4cfe-90ef-152e04c9cf03
2
public MapObjectType getObjectType(int positionX, int positionY){ if(mapObjectGrid[positionX][positionY] != null) return MapObjectType.Object; if(characterGrid[positionX][positionY] != null) return MapObjectType.Character; return MapObjectType.Null; }
60aff345-a954-43e9-9ef9-465dd239007f
3
public static double averageAltitudes(int[] altiList) { int sum = 0; for (int i = 0; i < altiList.length; i++) { /*Check to see if all spots in array are full in order to average*/ if (altiList[i] == ' ') { System.out.println("Some spots in the array are blank\n...
4692f3ab-d369-41f2-98ae-c22f025458a4
4
@Override public boolean hasNext() { if (reader == null) return false; // No input stream? if (next == null) { next = readNext(); // Try reading next item. if ((next == null) && autoClose) close(); // End of file or any problem? => Close file } return (next != null); }
66435b8a-ef5f-4037-8b8c-c021474fec2b
8
static void draw_sprites(osd_bitmap bitmap, int priority) { int offs, sx, sy; for (offs = 4096 - 32; offs >= 0; offs -= 32) { int code; int attr = stfight_sprite_ram.read(offs + 1); int flipx = (((attr & 0x10) != 0 ? 1 : 0) ^ stfight_flipscreen); ...
5114c52d-315f-4c7c-a58a-f5634bee7412
0
private final void removeChannel(String channel) { channel = channel.toLowerCase(); synchronized (_channels) { _channels.remove(channel); } }