method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
a7d8a1ff-b6b1-4e46-bbc7-a91f71a41ce9
3
public byte[] getTiledImageDataPart(int px, int py, int ptx, int pty) { byte[] palettedImage = new byte[ptx * pty]; int tileCount = ptx * pty / 64; int tileWidth = ptx / 8; for (int t = 0; t < tileCount; t++) for (int y = 0; y < 8; y++) for (int x = 0; x...
3c050965-1b75-46f9-bf4c-bf07da6b62f1
0
private int indexCycle(int index, int delta) { int size = m_Components.length; int next = (index + delta + size) % size; return next; }
454bd785-3321-48d3-938b-f25aee556597
1
static File downloadDir() throws MalformedURLException { String dir = System.getProperty("user.dir"); File f = new File(dir, "oms3"); // installation directory if (f.exists()) { return f; } throw new IllegalArgumentException("Not found for install: " + f.toStr...
3f9c1c1c-8776-45a3-a54c-c48951987ca9
4
@Override public void flush() throws IOException { try { // Calling flush but write has not been called. do nothing if (chunkIndex == 0 && position == 0) { return; } // Too many bytes written. Drop everything if (maxChunksReached) ...
890490b0-a47d-4a28-b752-a736477d35e3
0
public Modificar() { initComponents(); }
1805aee3-3315-410d-8137-521404068767
7
@Override public int castingQuality(MOB mob, Physical target) { if((mob!=null)&&(target!=null)) { if(mob.isInCombat()&&(mob.rangeToTarget()>0)) return Ability.QUALITY_INDIFFERENT; if(mob.charStats().getStat(CharStats.STAT_DEXTERITY)<CMProps.getIntVar(CMProps.Int.BASEMAXSTAT)) return Ability.QUALITY_...
d070d289-0ee3-41b5-ad59-a4c9f9b96b7a
8
Tile(TileColor _color, int _size, TileShape _shape, int _x, int _y, int _rotation){ color = _color; size = _size; shape = _shape; x = _x; y = _y; rotation = _rotation; neighbours = new Array<Tile>(); switch(shape){ case SQUARE: tileSprite = new Sprite(tilesRegions[0][7]); break; case LON...
7a57714a-3434-432b-bd76-5f2f14ef0a84
9
@Override public boolean processButtonClick(int interfaceId, int componentId, int slotId, int packetId) { switch (interfaceId) { case 271: if (player.getDuelConfigurations().getRule(5)) { player.getPackets().sendGameMessage( "You can't use prayers in this duel."); return false; } return t...
69a9dbe4-58a4-42c4-a7b6-6a9f430f56f4
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 Motivo)) { return false; } Motivo other = (Motivo) object; if ((this.idMotivo == null && other.idMotivo != null...
ed640654-e87d-4541-9b23-b60bafb86993
9
public boolean skipPast(String to) throws JSONException { boolean b; char c; int i; int j; int offset = 0; int length = to.length(); char[] circle = new char[length]; /* * First fill the circle buffer with as many characters as are in the * to str...
4c1d4020-0558-45dd-b90d-aaa30677148f
3
public static ColorModel coerceData(WritableRaster wr, ColorModel cm, boolean newAlphaPreMult) { // System.out.println("CoerceData: " + cm.isAlphaPremultiplied() + // " Out: " + newAlphaPreMult); if (!cm.hasAlpha()) // Nothing to do no alpha channel ...
047000c5-9900-4e2f-b58e-aca2f57099d4
4
private Boolean openFile(){ /* creates a data backup in case the file is corrupted */ m_dataSetBackup = m_dataSet; /* add .csv extension selection to File Chooser * m_firstTimeOpen flag ensures that it's added only once * */ if(m_firstTimeOpen) { m_firstTimeOpen = fal...
c47156be-7aff-4acf-a2a4-87d41ad79799
0
@Test public void testFindWords() { assertTrue(_dictionary.findWords("356937").size() > 0); }
22fdd3aa-bfc1-4d25-bc5e-d58a612fbca0
0
@Override public void keyReleased(KeyEvent arg0) { }
a70ff136-9067-427c-b5fb-164fa7ab98f6
7
public static void operate() { Pattern hashPattern = Pattern.compile("prev_commit_hash = \\w*"); String urlBase = "https://raw.github.com/dongli/CodeMate/"+ "master/products/installer/payload/"; String dirBase = System.getenv("HOME")+"/.codemate/"; // -----------------------------------------------------...
d274af0d-0960-4359-bd12-d39fb4a061f5
6
public static void main(String[] args) { // reading the configuration file. ConfigurationReader configuration = new ConfigurationReader(_propertiesFile); if (!configuration.readConfigurationFile()) { System.out.println("Failed in reading configuration file."); return; } // creating client RpcCl...
2fdff4e0-9512-4094-8662-eee27fe691d4
3
public void run() // Execution { // Listen to network to get the latest state of the // game from the server // Update model with this information, Redisplay model DEBUG.trace( "Player.run" ); try { NetObjectReader input = new NetObjectReader(s); // try make a rea...
54be2492-affe-4cdc-8b18-69367bec794e
9
@Override public void spring(MOB target) { if((target!=invoker())&&(target.location()!=null)) { if((doesSaveVsTraps(target)) ||(invoker().getGroupMembers(new HashSet<MOB>()).contains(target))) target.location().show(target,null,null,CMMsg.MASK_ALWAYS|CMMsg.MSG_NOISE,L("<S-NAME> avoid(s) setting off a no...
218c7e0d-5ffc-4d30-9d7d-49bf3f42aca6
8
@Override protected void updateWeights() { RBM rbm = getNeuralNetwork(); RBMLayerCalculator lc = getLayerCalculator(); int mbs = lc.getPositivePhaseVisible().getDimensions()[lc.getPositivePhaseVisible().getDimensions().length - 1]; if (weightUpdatesKernel == null || weightUpdatesKernel.getMiniBatchSize() != m...
1a1ab06e-274c-4447-bd0e-59502c1db440
1
private double pathCostEstimate(Location start, Location goal, Agent agent) { if (agent == null) { // default agent int dx = Math.abs(goal.x - start.x); int dy = Math.abs(goal.y - start.y); double diff = (double) Math.abs(dx - dy); return typicalCost * (dx + dy); } else { return 1; } }
5068b33a-9219-479f-8a5c-8d4cdb77f21c
4
public static void main(String[] args) { df = new DecimalFormat("#.00"); // Run a total of 4 timer accuracy tests (for different batch sizes) timerAccuracyTest(500); timerAccuracyTest(1000); timerAccuracyTest(1500); timerAccuracyTest(2000); // Run a number of di...
2ad58ca6-e14a-48f9-934c-d0ef6a39073f
6
public int method185(int i, int j) { if (i == -2) return 0xbc614e; if (i == -1) { if (j < 0) j = 0; else if (j > 127) j = 127; j = 127 - j; return j; } j = (j * (i & 0x7f)) / 128; if (j < 2) j = 2; else if (j > 126) j = 126; return (i & 0xff80) + j; }
c6aa7865-9748-49e4-85de-ed51fdcf2a6c
3
public void buttonClicked(int ID) { switch (ID) { case 0: game.changeMenu(new MenuCharCreation(game)); break; case 1: game.loadFile(); break; case 3: game.changeMenu(new MenuInfo(game)); break; } }
a6dca56d-c053-4ae4-ada5-db3379fe69c6
7
void calcMarginalProbabilities() { // calculate marginal probabilities int [] values = new int[m_nNodes.length]; int [] order = new int[m_bayesNet.getNrOfNodes()]; m_MarginalP = new double[m_nNodes.length][]; for (int iNode = 0; iNode < m_nNodes.length; iNode++) { order[m_nNodes[iNode]] = iNode; ...
2d8f4c07-57e3-49e9-813b-2a79e58a676a
2
public static void main(String[] agrs){ Scanner in = new Scanner(System.in); int n =in.nextInt(); int l=in.nextInt(); int curr=0; int result = 0; while(n-->0){ int s = in.nextInt(); curr+=s+10; result+=2; } curr-=10; result-=2; if(curr<=l){ result+=(l-curr)/5; System.out.println(re...
1cfe5499-2527-41a1-9eb1-a1b1a0bdc372
7
public PNGDecoder(InputStream input) throws IOException { this.input = input; this.crc = new CRC32(); this.buffer = new byte[4096]; readFully(buffer, 0, SIGNATURE.length); if(!checkSignature(buffer)) { throw new IOException("Not a valid PNG file"); } ...
e61dd770-eb06-4390-9383-7a576754fe5a
2
public String getState() { if(atBP()) return "Boiling Point"; if(isBoiling()) return "Boiling"; return "Not Boiling"; }
4dfc2694-46e4-4e89-827c-188024f5d932
4
@Override public void execute() { Task.sleep(50); switch (Settings.location.getFurnaceId()) { case 11666: Constants.FALADOR_WALK_FURNACE.traverse(); break; case 26814: Constants.EDGEVILLE_WALK_FURNACE.traverse(); break; case 76293: Constants.AL_KHARID_WALK_FURNACE.tr...
8c6564a2-162b-43ae-b716-92bea94fc7a6
2
public boolean hasLayer(String layer) { String[] lrs = gob().resnames(); for(int i = 0; i < lrs.length; i++) if(lrs[i].contains(layer)) return true; return false; }
1203d63d-b99d-479e-9f52-db2df46d6083
6
public static void pprintDefinition(Cons self, boolean hasvariablesP, org.powerloom.PrintableStringWriter stream) { if (((java.lang.reflect.Method)(OntosaurusUtil.$PPRINT_BEFORE_DEFINITION_FUNCTION$.get())) != null) { edu.isi.stella.javalib.Native.funcall(((java.lang.reflect.Method)(OntosaurusUtil.$PPRINT_BEF...
3161ffbc-afe7-49a6-aa38-743287057de2
3
public Clazz findClazz(String clazz) { Clazz ret = getClass(clazz); if (ret != null) return ret; for (DirManager dm : subDirs) { ret = dm.findClazz(clazz); if (ret != null) return ret; } return null; }
9420af24-25f3-4e72-bc21-04c748ecc14a
8
private boolean r_prelude() { int among_var; int v_1; // repeat, line 36 replab0: while(true) { v_1 = cursor; lab1: do { // (, line 36 ...
baeed4f0-d7bf-41e2-b261-1f4aa0f12185
8
@Override public Component getListCellRendererComponent(JList<? extends ArrayList<Configuration>> list, ArrayList<Configuration> value, int index, boolean isSelected, boolean cellHasFocus) { setOpaque(true); if (isSelected) { setBackground(list.getSelectionBackground()); ...
be2886b2-79ae-451a-bce0-c060e3a3666a
7
protected OgexMaterial toMaterial( DataStructure ds, Map<BaseStructure, Object> index ) { OgexMaterial result = (OgexMaterial)index.get(ds); if( result != null ) { return result; } result = new OgexMaterial(); index.put(ds, result); if( "true".equals(ds.getP...
39c470cd-46f3-442d-bd8f-767ff0911140
0
private void initLighter(WorkingMemoryEntryPoint startEntryPoint) { startEntryPoint.insert(new ReachedBottom()); lighter.init(startEntryPoint); }
775a04eb-4d3f-402a-a4ac-67e3f249c49b
9
private void initJNDI(Configuration configuration) throws TorqueException { log.debug("Starting initJNDI"); Configuration c = configuration.subset(JNDI_KEY); if (c == null || c.isEmpty()) { throw new TorqueException("JndiDataSourceFactory requires a jndi " + "path property to lookup the DataS...
03dad717-8d3a-4c11-994e-d313a86c863a
4
LeagueRunner(ServletContext context,int leagueNumber) { this.context=context; this.leagueNumber=leagueNumber; File path = new File("../Source"); list = path.list(new DirectoryFilter("java")); for(int currentFile=0;currentFile<list.length;currentFile++) { try { FileReader...
ff5887c0-6cd0-42f5-b669-81c9446acff2
4
@Override public boolean isMoveable(Location loc) { if (super.isValid(loc)) { if (!super.isMoveable(loc)) { return false; } if (!this.objectGrid.isMoveable(loc)) { return false; } if (!this.mapGrid.isMoveable(loc)) {...
3b19ca77-9790-4c67-8ce5-e5109035227c
6
private void drawGlyphAlpha(byte glyphPixels[], int x, int y, int width, int height, int colour, int alpha) { int outputPosition = x + y * DrawingArea.width; int outputWidth = DrawingArea.width - width; int inputWidth = 0; int inputPosition = 0; /* * Calculate the height of the glyph. */ if (y <...
44b1c56d-5511-48df-bf7a-4b05de298251
3
private List<Card> findPossibleCards(List<Card> cardList, int rowNumber) { List<Card> result = new ArrayList<>(); if ((rowNumber > 4)||(rowNumber < 1)) { throw new IllegalArgumentException(); } int rowIndex = rowNumber - 1; for (int columnIndex = 0; columnIndex < 4; c...
1b157954-d7e3-4c9b-b34c-075b9ca2ea6d
0
@Basic @Column(name = "CTR_CANTIDAD") public int getCtrCantidad() { return ctrCantidad; }
fd57445c-68d2-45c0-9949-a7d379ccf232
0
public ErmitForm (ArrayList<Excel> allEx) { allex = allEx; setColoredExes(); }
6098d253-cc4b-436f-9c12-fd7324f1af77
9
public void run() { final byte[] buf = PacketHelper.toPacket(new ConnectionstateRequest(channelId, new HPAI(HPAI.IPV4_UDP, useNat ? null : (InetSocketAddress) socket .getLocalSocketAddress()))); final DatagramPacket p = new DatagramPacket(buf, buf.length, ctrlEndpt.getAddress(), ctrlEndpt.getPo...
ea994e7b-f9ce-42c2-98d4-d27582d99e54
6
public static void main(String[] args) { Graphium g = GraphiumLoader.open(args[0]); Vertex nut = g.getVertexURI("http://www4.wiwiss.fu-berlin.de/drugbank/resource/drugcategory/micronutrient"); GraphIterator<Edge> it1, it2, it3; it1 = nut.getEdgesIn(); while (it1.hasNext()) { Vertex drug = it1.next().get...
4034b760-3719-45e1-b0fb-70dfbb41b1b9
0
public String getType() { return type; }
fec2fa11-59f1-4674-841c-693a31fec4f2
3
public static void decode(InputStream src, OutputStream dst) { byte[] bytesRead = new byte[8192]; byte[] bytesToWrite = new byte[8192]; byte[] alphabet = getBytesAlphabet(); int numberOfBytesRead; try { int i; while ((numberOfBytesRead = src.read(bytesRea...
849d86b0-38ca-4e00-b89e-44110f37af9f
3
public void actionPerformed (ActionEvent ae) { if (ae.getActionCommand().equals("Envoyer")) { // On envoi un message s'il n'est pas vide if (ucast_chat.getText().length() > 0) { String my_contact = Cast.getAddress() + ";" + program.getNickname(); String[] recipients = new String[contacts.size()]; ...
7c33aa1d-13d4-4996-b502-1301facbe9cf
4
public User authentifier(String id, String mdp) { String requete= "SELECT ID_user, Login, Pass, Age, Sexe, Email, Aime, AimePas, Activite, Droit, Avatar " + "FROM Utilisateur WHERE Login = '"+id+"' AND pass = '"+mdp+"'"; DateFormat format = new SimpleDateFormat("yyyy/MM/dd"); String date1 = format.format(new ...
aa9532f1-cc8f-490d-8372-f4166a7f32af
8
public String format(LogRecord par1LogRecord) { StringBuilder stringbuilder = new StringBuilder(); stringbuilder.append(field_74268_a.format(Long.valueOf(par1LogRecord.getMillis()))); Level level = par1LogRecord.getLevel(); if (level == Level.FINEST) { stringbuil...
bcdc842a-86cd-4951-a8ed-5c08b6fa2901
5
private void ConnectionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConnectionButtonActionPerformed try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con = DriverManager.getConnection("jdbc:odbc:VideoStore", "", ""); Statement stat = ...
acbe8043-370f-4134-87ae-8bab2a2c319f
4
public boolean matarFantasma(int n) { Query q2; switch(n){ case 0: q2 = new Query("matarBlinky"); return q2.hasSolution(); case 1: q2 = new Query("matarClyde"); return q2.hasSolution(); case ...
a22b4215-2fcf-4195-8c66-29d1584a567f
2
public void playM(String p) { try { if(!Mclip.isActive()) { MaudioInputStream = AudioSystem.getAudioInputStream(new File(Main.loc + p)); Maf = MaudioInputStream.getFormat(); Msize = (int) (Maf.getFrameSize() * MaudioInputStream.getFrameLength()); Maudio = new byte[Msize]; Minfo = new DataLine....
67b83358-c12c-496c-8f16-e3b2c76f8b48
5
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } Coordinate other = (Coordinate) obj; if (D...
76cb45b1-5130-46ad-a77d-caaad0a76ece
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...
58f53df0-0913-4a2b-8c0d-766bfa0f31d4
9
public static int[][] setZero (int[][] matrix) { HashSet<Integer> row = new HashSet<Integer>(); HashSet<Integer> col = new HashSet<Integer>(); for(int i=0;i<matrix.length;i++) for(int j=0;j<matrix[i].length;j++){ if(matrix[i][j]==0) { row.add(i); col.add(j); } } for(int i=0;i<matrix.l...
3e32ffb3-c9e4-4d18-bcab-975e1107df0e
0
@Basic @Column(name = "FUN_TERMINAL") public String getFunTerminal() { return funTerminal; }
bc8b425c-0326-442e-9e55-7f5c9113bbb4
8
private String compute(String tableName, List<TableField> fields, List<StepSetOperation> operations, Connection memConn) throws Exception { long startTime = 0; // 栏目设置整理 List<List<StepSetOperation>> lists = new ArrayList<List<StepSetOperation>>(); // 共多少行 int totalRowNum = 0; // 共多少页 int totalPage =...
f309e2d6-b3f4-4538-8deb-9ad23a3a0390
8
@Override public void setMethodInfo(wadl wadl, String wsdlPath) { try { FileInputStream fstream = new FileInputStream(wsdlPath); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); ...
6f9aaeb3-9ab6-4c74-a2ad-b9cd4f489658
8
private String elapsed() { final long days = elapsed / MILLISECONDS_PER_DAY; final long drest = elapsed % MILLISECONDS_PER_DAY; final long hours = drest / MILLISECONDS_PER_HOUR; final long hrest = drest % MILLISECONDS_PER_HOUR; final long minutes = hrest / MILLISECONDS_PER_MINUTE; final long mrest = hres...
36fac2c3-49f1-4a06-9b5e-f7c39e742e8b
7
public Map getVersions() throws TimeoutException { Map<InetSocketAddress, String> map = new HashMap<InetSocketAddress, String>(); PooledBlockingClient pbc[] = blockingClientPool.getOneBlockingClientForAllActiveHosts(); if (pbc == null) { throw new TimeoutException("we do not have any client array [pbc] to con...
54247cbf-469c-4a61-a86b-3623c4773102
5
public String buscarProspectoPorFecha(String fecha){ //##########################CARGA_BASE DE DATOS############# tablaDeProspectos(); //##########################INGRESO_VACIO################### if(fecha.equals("")){ fecha = "No busque nada"; return resu...
a2db2164-608f-4675-8a7a-5213eca08a53
5
public static void main(String[] args) { if (args.length == 1) { try { daytimeTCP(args[0]); } catch (IOException e) { e.printStackTrace(); System.exit(1); } } else...
3a780d47-b862-4b4e-8c15-40983477811a
2
public static String md5Encrypt(String string) { String encrypted = ""; try { MessageDigest digest = MessageDigest.getInstance("MD5"); byte[] stringBytes = string.getBytes(); digest.reset(); digest.update(stringBytes); byte[] message = digest....
1e567e7d-1dc5-4a92-bbdc-381648a6a301
9
public static List<TipoObra> listaDeObras() { ResultSet tr = null; String select = "SELECT * FROM tipo_obra"; ArrayList<TipoObra> listaTipoObra = new ArrayList<TipoObra>(); Statement statement = null; Connection conexion = null; try { conexion = DataSource...
5fb4381a-8cc2-4530-bc99-5561a5814684
9
public static void main(String[] args) throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder( ); int casos = 1; for (String line; (line = in.readLine())!=null; casos++) { if(line.equals(""))break; sumas = new long[line.length()]; ...
b3e89bf9-d51f-4e7b-909c-d8060b1d3060
2
public static ArrayList<NoteMessage> getMessagesByUserID(int userID) { ArrayList<NoteMessage> noteMessageQueue = new ArrayList<NoteMessage>(); try { String statement = new String("SELECT * FROM " + DBTable +" WHERE uid2 = ?"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); stmt.setI...
1093b26d-85fb-4852-a9e3-4078ce25ba54
4
public static int getClientId(String name) { if (name.equals("rpcclientfacade") || name.equals("RpcClientFacade")) { return RpcClientFacadeFactory.RPC_CLIENT_FACADE; } else if (name.equals("rpcclientfacadewrapper") || name.equals("RpcClientFacadeWrapper") ) { return RpcClientFacadeFactory.RPC_CLIENT_FA...
270c334c-9579-4637-a38a-eab7406c6605
5
public void dropPiece(final int X, final int Y, final Piece.ConnectFourPieceColour col) { m_dropping = true; if (col == Piece.ConnectFourPieceColour.YELLOW) { m_currentPieceColour = YELLOW_PIECE; } else if (col == Piece.ConnectFourPieceColour.RED) {...
74992181-f50f-408a-a29d-c06221d5d27c
9
@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...
4b5a2de9-3e44-4e4b-bdb7-12e8fe91de4e
3
public static byte[] handshake(byte[] peerId, byte[]info_hash){ //Create the handshake //Set the first bits equal to "BitTorrent protocol" as specified by BT protocol byte[] handshake = new byte[68]; handshake[0] = 19; handshake[1] = 'B'; handshake[2] = 'i'; handshake[3] = 't'; handshake[4] ...
4674951a-ee5d-43fa-82e4-251e44987035
2
public void push( StatMethod stat ) { trace[depth].pause(); if (++depth == trace.length) { int newLength = depth + (depth >> 1); trace = Arrays.copyOf( trace, newLength ); for (int i = depth; i < newLength; i++) { trace[i] = new Trace(); } } trace[depth].s...
91f24ccd-ee30-43fd-b26b-1cc484f612d0
8
public static double[][] benchmarkJLargeArraysDoubleSequentual(long[] sizes, int[] nthreads, int iters, String file) { double[][] results = new double[nthreads.length][sizes.length]; long k; System.out.println("Benchmarking JLargeArrays (doubles, sequentual)"); for (int th = 0; th < ...
06f76835-ec6d-416c-b79c-53e171d88db3
9
@Override public long doRead(Master master, ReadRequest readRequest) { incrementAccessAndMaybeRecalibrate(master); long fileId = readRequest.getFileId(); Location accessLoc = readRequest.getLocation(); MasterMeta fm = master.map.get(fileId); if (fm == null || fm.instances.size() == 0) { retu...
6b401d1a-e4e4-4762-b682-88aa933b22e7
0
public int indexOfOpenDocument(Document doc) { return openDocuments.indexOf(doc); }
72d83195-3579-4f65-9e86-6e9d86746902
9
int inflateInit(int w) { z.msg = null; blocks = null; // handle undocumented wrap option (no zlib header or check) wrap = 0; if (w < 0) { w = -w; } else if ((w & INFLATE_ANY) != 0) { wrap = 4; w &= ~INFLATE_ANY; if (w < 48) w &= 15; } else if ((w & ~31) != 0) { // for example, DEF_WBITS +...
56bf2131-9119-444d-86ee-5534027e6039
9
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) { if (!(table.getParent() instanceof JViewport)) { return; } JViewport viewport = (JViewport) table.getParent(); Rectangle rect = table.getCellRect(rowIndex, vColIndex, true); Rectangle viewRect =...
e109e4b0-9421-4585-be95-07e7c34a2140
3
public void setVisible(boolean visible) { if(frame == null) { frame = new JFrame("About YAMG"); mainPanel = new JPanel(new GridLayout(18, 2)); mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); addRow("Game Version", Yamg.VERSION); addRow("Lead Programmer", "Daniel Glus"); addRow("A...
82b12943-60f9-415c-84ca-52e28db05b00
2
@Override public void run() { //Loading Loading load = new Loading(this); display.setScreen(load); synchronized (load) { try {load.wait();} catch (InterruptedException e) {e.printStackTrace();} } //Startup db = assets.get("db/pokemon"); world = new World(this); player = new Player(this, new Spr...
0baa15f5-d36e-4105-95d9-36ea78856368
1
int putIndexed(int tag, Object obj1, int index1, int index2) { Key key = new Key(tag, obj1, index2); Integer indexObj = (Integer) entryToIndex.get(key); if (indexObj != null) { /* Maybe this was a reserved, but not filled entry */ int index = indexObj.intValue(); indices1[index] = index1; indices2[ind...
6601a450-69ea-46ea-a4ad-9631bbbff74c
9
public int[] findEdge(Cube cube, TileColor c1, TileColor c2) { for (int f = 0; f < 6; f++) { for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { if ((x == 1 || y == 1) && !(x == 1 && y == 1)) { if (cube.getColor(cube.createArray(f, x, y)).equals(c1) && cube.getColor(Cube.getOthers(cube.creat...
16c8a63a-a4a0-4aeb-90e7-d520b6b5895b
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Company other = (Company) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) re...
8f058262-f669-434c-9a6c-a76325c4f531
2
public static ArrayList<Subcategorias> sqlSelect(){ ArrayList<Subcategorias> subcat = new ArrayList(); if(!BD.getInstance().sqlSelect("SELECT sc.nombre, sc.idsubcategorias FROM subcategorias sc INNER JOIN cat_subcat_tit_attr_descr pr ON pr.subcategorias_id = sc.idsubcategorias GROUP BY sc.nombre;")){ ...
2611f289-5474-4e3c-a195-4fad528b81e6
3
public static String extractDigits(String s) { if (s == null) { return StringPool.BLANK; } StringBuilder sb = new StringBuilder(); char[] c = s.toCharArray(); for (int i = 0; i < c.length; i++) { if (Validator.isDigit(c[i])) { sb.append(c[i]); } } return sb.toString(); }
3769b676-6b9f-4589-93ac-f6f77942bf13
7
private String getSelectedOption() { String result=""; switch(Equation.getSelectedIndex()+1) { case 1: result="f(x)"; break; case 2: result="g(x)"; break; case 3: result="a(x)"...
e42477c0-0454-42a4-8f44-3e0ef03aec37
7
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Diff other = (Diff) obj; if (operation != other.operation) { return f...
c7012200-60c5-456f-a2e0-4cf1a926301d
3
public static void closeConnection(Connection con) { if (con != null) { try { con.close(); } catch (SQLException e) { throw new RuntimeException(e.getSQLState() + "\nCaused by\n" + e.getCause(), e); } finally { try { con.close(); } catch (SQLException e) { ...
3816dcdd-879c-4839-9f13-da1af6d3c349
2
@Override public long getEncodedLength () { long childLength = 0; for (final Value<?> val : value) { childLength += val.getEncodedLength(); } return childLength + 2; }
a4583127-04c5-4db3-9a1e-ebdda866704d
2
public void loadFromDB() { try { PreparedStatement ps = getSelectStmt(); ResultSet rs = ps.executeQuery(); if (rs.next()) fillMembers(rs); rs.close(); } catch (SQLException sqle) { } }
db709f90-c9a5-4ba5-a21b-33712c5ee8de
9
void render() { VdwForceLines lines = (VdwForceLines) shape; Pair[] pairs = lines.pairs; if (pairs == null) return; int n = pairs.length; if (n <= 0) return; Atom[] atoms = frame.atoms; Atom a1 = null; Atom a2 = null; short colix1, colix2; int x, y, z; int i1, i2; int atomCount = viewer.ge...
09f26998-da6c-43f9-8ba3-4455bd40a90e
5
public void respondToChangeGameSpeedRequest() { game.getAudio().play(pathXPropertyType.AUDIO_CUE_SELECT.toString(), false); // OPEN UP JOPTIONPANE TO OBTAIN USER INPUT String inputGameSpeed = JOptionPane.showInputDialog(null, "Enter a game speed between 0 and 3"); try ...
620f8cac-e097-4a1a-ba5d-fa04f5aa7e94
2
@Override public boolean onPointerMove(int mX, int mY, int mDX, int mDY) { Iterator<IScreenItem> it = screenItems.iterator(); while(it.hasNext()) { IScreenItem item = it.next(); if(item.onPointerMove(mX, mY, mDX, mDY)) { return true; } ...
6eeeea4d-398e-4a15-9035-499f5983dcce
9
public Node addWordToTree(String word, Node adjacent, int direction){ Node currentWord = isAChild(word,adjacent,direction); Node x = inDistNodeList(word,adjacent.getDistance()+1,direction); //Found in the Sentence Tree if(currentWord.getLabel().equals(word)){ //Alredy present, increment count } String ...
eb8f8ada-6597-481d-9528-869689cdd01b
2
private void clickedCheck() { if (btnCheck.getText().startsWith("N")) { nextPhrase(); } else { if (exPanel.verify()) { nextPhrase(); } else { btnCheck.setText("Next Phrase"); btnCheck.setMnemonic('n'); } } }
741932a6-96cd-4cfa-b57f-d4184155b299
3
public boolean equals(Vector4d v) { return x == v.x && y == v.y && z == v.z && w == v.w; }
7b877f72-e94e-4fa0-8212-e6144e76f5eb
7
public void setEncodings(int nEncodings, int[] encodings) { if (nEncodings > nEncodings_) { encodings_ = new int[nEncodings]; } nEncodings_ = nEncodings; useCopyRect = false; supportsLocalCursor = false; supportsDesktopResize = false; currentEncoding_ = Encodings.raw; for (int i...
0c200413-0393-4427-bf02-749151cfe0b6
9
public void rendermap(MapElement tocreate) { map.clearTiles(); UE = new ArrayList<UnitElement>(); UE = (ArrayList<UnitElement>) tocreate.getunitlist(); EE = new ArrayList<EnvironmentElement>(); EE = (ArrayList<EnvironmentElement>) tocreate.getEnviromentList(); pixelsX = tocreate.getpixelsX(); pixelsY = ...
86f2cf2c-f1a6-4ecd-8d76-3741a8f6f5ec
3
public PlayerEntity(TileLevel level, Tile startingTile) { super(level, startingTile); standAnim = null; moveAnim = null; bumpAnim = null; if(PlayerEntity.STAND_ANIMATIONS != null && PlayerEntity.MOVE_ANIMATIONS != null && PlayerEntity.BUMP_ANIMATIONS != null) copyAnimations(); }
0103cca9-100e-4a6f-8871-83a88fb9ef8d
5
public static void main(final String[] args) { if (args.length > 1) { FileInStream fis; FileOutStream fos; CodeFormatter codeFormatter = new CodeFormatter(); FormatOptions formatOptions = new FormatOptions(DEFAULT_FORMATTER_PROPERTIES); try { ...
037bf1d0-9558-4d1f-9861-b57be2931de1
8
public static StateActor convertToState(int action){ switch (action){ case 8 : return UP; case 2 : return DOWN; case 4 : return LEFT; case 6 : return RIGHT; case 88 : return ATTACKINGUP; case 22 : return ATTACKINGDOWN; case 44 : return ATTACKINGLEFT; case 66 : return ATTACKINGRIGHT; default : retu...
ab04384e-c0ce-4743-bf95-035c171ccaa6
4
public void setVolume(String sourcename, float value) { if (midiSourcename(sourcename)) { midiChannel.setVolume(value); } else { Source mySource = sourceMap.get(sourcename); if (mySource != null) { float newVolume = value; if (newVolume < 0.0f) newVolume = 0.0f; else if (newVolume > 1.0f) ...