method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
18a815c6-50c0-4fce-913a-a378229adc54
3
@Override public void setMortgages(Mortgages mortgages) { listModel.clear(); if (mortgages != null) { for (Mortgage mortgage : mortgages.getBusinessObjects()) { if (!listModel.contains(mortgage)) { listModel.addElement(mortgage); } } } list.revalidate(); }
e415c3ff-266a-41c9-b028-b5145f8e32ec
0
public void setLang(String langCode) { putMergeVar("mc_language", langCode); }
890f2c3d-36e2-4cce-9278-ef32ce7f083f
2
@Override public Source postSource(Source s) throws JSONException, BadResponseException { Representation r = new JsonRepresentation(s.toJSON()); r = serv.postResource("intervention/" + interId + "/source", s.getUniqueID(), r); Source source = null; try { source = new Source(new JsonRepresentation(r).getJso...
a6de7cce-d941-4ec8-a79c-a9fb9b165a67
2
public void back() throws JSONException { if (usePrevious || index <= 0) { throw new JSONException("Stepping back two steps is not supported"); } this.index -= 1; this.character -= 1; this.usePrevious = true; this.eof = false; }
9ef6d514-d5a9-4ef6-9c8c-e3260d35ef9e
1
public void robotInit() { driveTrain = new DriveTrain(); shooter = new Shooter(); tilter = new Tilter(); tomahawk = new Tomahawk(); ledStrip = new LEDStrip(); vision = new Vision(); // Initialize OI last so it doesn't try to access null subsystems ...
6eac9576-5fa7-47ea-a825-90ff03f9e10e
0
public void setStepInPending(boolean b) { stepInPending = b; }
019d34f9-b782-442d-bf12-3b116076a7a0
3
public void deleteMatchRecord() { if (id != null) { PreparedStatement st = null; try { conn = dbconn.getConnection(); String q = "DELETE FROM match_record_2013 WHERE id = ?"; st = conn.prepareStatement(q); st.setInt(1, this....
21479e4b-4218-4255-ab6b-8917ffccdbdf
1
@Override public int hashCode() { return id != null ? id.hashCode() : 0; }
0cfd507e-d595-4423-97d3-52c2dcfbfc36
7
private void initialize(){ for(int i = 0; i <= this.size[0]; i++){ for(int x = 0; x < this.size[0]; x++) { for(int y = 0; y < this.size[1]; y++) { mapArray[x][y] = 0; mapArray[x][y] = x == startCoord[0] && y == startCoord[1] ? 1 : mapArray[x][y]; mapArray[x][y] = x == endCoord[0] && y == endCoor...
ed4b7e57-6e00-4cc3-81e9-4825a9350a7d
4
public static void main(String[] args) { for (int i = 0; i < 100; i++) { // the randomizer generates a random number in the range 0 to 10. int number = (int) (Math.random() * 10); if (number == 5) { new Ball(); } } System.out.println(Ball.getCount()); // calling subclass of Ball, RedBall for...
707516b4-9a3a-4969-978e-6726ff867664
9
void download() { if (des == null) { EventQueue.invokeLater(new Runnable() { public void run() { String s1 = Modeler.getInternationalText("NoDestinationSelected"); String s2 = Modeler.getInternationalText("DownloadError"); JOptionPane.showMessageDialog(JOptionPane.getFrameForComponent(page), s1 ...
e8f9f867-f400-4e2a-8016-9d297cbc566a
0
@Override public String toString() { return "LINE " + lineNumber; }
829cd37b-2078-4aaa-bb8a-f8b8aba32d41
7
void render() { if (shape == null) return; frontOnly = viewer.getTestFlag2(); Mps mcps = (Mps) shape; for (int m = mcps.getMpsmodelCount(); --m >= 0;) { Mps.Mpsmodel mcpsmodel = mcps.getMpsmodel(m); if (mcpsmodel == null) continue; if ((mcpsmodel.modelVisibilityFlags & myVisibilityFlag) == 0) ...
9cc8a04a-b08e-40b3-8296-a916a54335db
5
public void doGet(HttpServletRequest request, HttpServletResponse response) { response.setContentType("text/html"); PrintWriter webPageOutput=null; try { webPageOutput=response.getWriter(); } catch(IOException error) { Routines.w...
64f3b125-a62d-486f-ab6e-ac6726dbae3b
7
public static void main(String[] args) { // Working with the Switch Statement int day = 11; switch (day) { case 1: System.out.println("It's MONDAY!"); break; case 2: System.out.println("It's TUESDAY!"); break; case 3: System.out.println("It's WEDNESDAY!"); break; case 4: System.out....
307e62a9-f2aa-4adb-9b7e-ee7536d8e985
9
public int run() { String indexValue = "0"; // Gets the index value. if (register.equalsIgnoreCase("1")) indexValue = ASCView.getIndex1(); else if (register.equalsIgnoreCase("2")) indexValue = ASCView.getIndex2(); else if (register.equalsIgnor...
025ab740-d774-409a-8d6a-80a2e955a12f
8
private void readValues(Stream stream) { do { int i = stream.readUnsignedByte(); boolean dummy; if(i == 0) return; else if(i == 1) { anInt390 = stream.read3Bytes(); method262(anInt390); } else if(i == 2) anInt391 = stream.readUnsignedByte(); else if(i == 3) dummy =...
e47d1cfa-2718-4353-9dac-e5315cb59e75
6
public void addPurchase(Purchase purchase){ if(purchase != null){ if(purchase.id != null){ addTank(purchase.id, purchase.id_tank, purchase.id_armor, purchase.id_engine, purchase.id_first_weapon, purchase.id_second_weapon); addArmor(purchase.id_armor); ...
6a41affa-c387-4b43-b4a3-16292fdc9459
8
public boolean verifyInputInit(){ if(name.length() <= 0){ return false; } if(dateOfEvent.toString().length() <= 0){ return false; } if(client_id < 0){ return false; } if(location.length() <= 0){ return false; } if(numGuests < 0 || totalLengthOfEvent < 0){ return false; } if(!sta...
2a55bdab-6632-418f-9825-f518e0444418
6
public void compute(long iID, long jID, PostingUser[] usersForMoviei, PostingUser[] usersForMoviej, Boolean own){ int indexForI = 0; int indexForJ = 0; float [] calculationResult = new float[3]; while((indexForI<usersForMoviei.length)&&(indexForJ<usersForMoviej.length)){ if(usersForMoviei[indexForI].userID<u...
2ae738b6-c6f1-4a02-96d1-0ebc908cbcf9
8
@Override public void affectPhyStats(Physical affectedMOB, PhyStats affectableStats) { super.affectPhyStats(affectedMOB,affectableStats); if(alladj[2]!=1.0) affectableStats.setArmor(100-(int)Math.round(CMath.mul(100-affectableStats.armor(),alladj[2]))); else if(allset[2]>=0) affectableStats.setArmor(all...
1d432f08-3fb4-4855-ba54-29eedf6e8a2d
1
private void rescaleAllDataPointGraphics() { for (DataPointGraphic gr : charts) { gr.rescale(); } }
e0cd03d1-af51-4e1c-a4da-5ba484fddc12
0
public void invalidateBounds() { validBounds = false; }
36d1fcb1-3acd-4c30-b415-2e209f636307
7
private void field_tasa_ivaFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_field_tasa_ivaFocusLost boolean es_componente=false; //voy a preguntar si la componente que me saco el foco es algun campo del panel de datos de asientos int i=0; Component[] components = panel...
3ab45ff0-779f-4cad-ba2e-5eccf3e3afbd
4
public boolean syncPlayerGroups(Map<String, String> data) { /* Perform game group to forum group mapping. */ /* Remove if not a valid group. */ for(Entry<String, String> s : data.entrySet()) { if(mGroupMap.containsKey(s.getValue())) { String g = mGroupMap.get(s.getValue()); if(g != null) s.setValu...
8c1f68f5-d664-4e1e-99f2-1ef1c657d5e3
0
public Trie() { this.root = new Node('*'); //dummy root }
2445f120-c3c1-4753-b1ef-b692b123a68c
8
public void playermove(){ if (upPressed) { if(!player.offscreentop) { player.setY(player.getY() - playerSpeed); } } if (downPressed) { if(!player...
9c2c7f00-45ec-4312-a5fe-a479e92a78f7
7
public static String getCacheStorageLocation () { if (CommandLineSettings.getSettings().getCacheDir() != null && !CommandLineSettings.getSettings().getCacheDir().isEmpty()) { return CommandLineSettings.getSettings().getCacheDir(); } switch (getCurrentOS()) { case WINDOWS: ...
78a70d60-75b5-4e09-8ff2-59d6f80764aa
4
private void sendProcessingError(Throwable t, ServletResponse response) { String stackTrace = getStackTrace(t); if (stackTrace != null && !stackTrace.equals("")) { try { response.setContentType("text/html"); PrintStream ps = new PrintStream(re...
df192219-c391-4134-9717-ac7c18474179
6
public void pruneWorld() { for(HexImage c : hexList.values()) { if(c.cX + RADIUS > right + RADIUS * 2 || c.cX - RADIUS < left - RADIUS * 2|| c.cY - RADIUS < top - RADIUS * 2|| c.cY + RADIUS > bottom + RADIUS * 2){ big.getChildren().remove(c.hex); } else { if (!big.getChildren().contains(...
2dfe48fa-4fcc-4adb-942f-1a33a1845227
6
public static void main(String[] args) { try { File file = new File("debug.txt"); writer = new BufferedWriter(new FileWriter(file)); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedEncodingException e) { // TODO Auto-gene...
daeb5131-14f1-4ad5-a0f5-61364696d2a9
7
static final void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double)o).isInfinite() || ((Double)o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); ...
61b62d66-6c2c-494b-bf0c-d881e6d6948c
8
private static void segmentRecursion(PackedImage img, int r, int c, int index) { img.set(r, c, COLORS[index]); if (r-1 >= 0 && img.at(r-1, c) == 0xffffff) { // If the pixel above the current is white and not outside the image's dimensions segmentRecursion(img, r-1, c, index); } if (r+1 < img.rows() && img.at...
a1643798-2c3c-4f1d-8e08-825b6bce1783
9
private void postPlugin(final boolean isPing) throws IOException { // The plugin's description file containg all of the plugin data such as name, version, author, etc final PluginDescriptionFile description = plugin.getDescription(); // Construct the post data final StringBuilder data =...
094a20d3-e5ec-44c2-9a2b-886bf154bcb1
2
@Override public boolean onMouseDown(int mX, int mY, int button) { Iterator<IScreenItem> it = screenItems.iterator(); while(it.hasNext()) { IScreenItem item = it.next(); if(item.onMouseDown(mX, mY, button)) { return true; } } ...
a2363924-1e41-4898-a145-3065b669d9c4
8
public static void main(String[] args) { Connection conn = null; Statement stmt = null; ResultSet rs = null; try { new com.mysql.jdbc.Driver(); Class.forName("com.mysql.jdbc.Driver").newInstance(); conn = DriverManager.getConnection("jdbc:mysql://sqlserver.mhscs.org:3306/MHS_Android_News?user=java_cl...
71fcd39c-c727-497c-a151-dcbc5a850fed
9
public static WritableRaster CIEXYZToRGB(Raster src, int[] srcComponentSize, WritableRaster dest, int[] destComponentSize) { // Validate the parameters checkParameters(src, sr...
7df37d1f-45ee-48b0-a39d-88e87a215511
7
public int longestConsecutive_2(int[] num) { // Note: The Solution object is instantiated only once and is reused by // each test case. if(num == null || num.length == 0){ return 0; } HashSet<Integer> set = new HashSet<Integer>(); int maxLen = 1; for(i...
bc4a9c4a-4621-4555-bea4-0fb49b88132d
4
public static void main (String [] args){ int x = 3; while (x > 0){ if (x > 2){ System.out.print("a"); } if (x == 2){ System.out.print("b c"); } if (x == 1){ System.out.println("d"); } x = x - 1; System.out.print("-"); } }
a0bb4ddf-8d0a-46fa-bd39-934d88fba4bf
0
@FXML private void handleBtnPrevAction(ActionEvent event) { move(-1); }
cf29cb55-1f49-4f16-bc14-b041c95eded0
2
public String getCape(String player, String type) { File saveFile = new File(getDataFolder(), "saved.yml"); if (!saveFile.exists()) { try { saveFile.createNewFile(); } catch (IOException ex) { Logger.getLogger(PlayerPlus.class.getName()).log(Level.SEVERE, null, ex); } } YamlConfiguration yFile ...
a6726f51-f65b-458d-bbf3-8ded1e2f97ca
3
public boolean checkIfPlayerLost(HantoPlayerColor color) { HantoPiece tempPiece; Iterator<Entry<PieceCoordinate, HantoPiece>> pieces = board.entrySet().iterator(); PieceCoordinate coordinate = null; while(pieces.hasNext()) { Entry<PieceCoordinate, HantoPiece> entry = pieces.next(); coordinate = entry.getK...
8deb5e47-4417-4881-ab51-7dc3e5cbf0d2
4
@Override public boolean equals(Object obj) { if (obj == null) return false; if (obj.getClass() != this.getClass()) return false; Vec2i other = (Vec2i) obj; if (this.x == other.x && this.y == other.y) return true; return false; }
d0e4ea90-af1e-432f-8b57-b9b13a24f169
5
private void actualizarTotal(){ if(!reciboExiste){ BigDecimal subtotal=new BigDecimal(0); for(int i=0;i<jTable1.getModel().getRowCount();i++){ if(!esExento(modelo.getValueAt(i,0).toString())) subtotal=this.sumarBigDecimal(subtotal+"", modelo.ge...
7a4991b5-80bf-4160-bf65-f29a823dd57e
5
public static void command(String command) { boolean err = false; try { Process process = new ProcessBuilder(command.split(" ")).start(); BufferedReader results = new BufferedReader( new InputStreamReader(process.getInputStream())); String s; while((s = results.readLine()...
9d721541-7d48-4f61-8d54-c462a7c7be1b
8
private int getShape(STNode<Key, Value> x) { /* * Balance factor of a node is the difference between the height of its * left subtree and right subtree in that order. */ switch (height(x.left) - height(x.right)) { case 2: switch (height(x.left.left) - height(x.left.right)) { case 0: // can re...
237b87ca-cf8e-46c2-92fe-85851f7e898f
9
public static void main(String[] args) { Scanner in = new Scanner(System.in); String input; Maze maze = new Maze(); while (maze.winner() == 1) { maze.show(); System.out.print("Direccao a jogar (c(ima)|b(aixo)|d(ireita)|e(squerda): "); ...
8a0f7ca2-2af2-43eb-9b60-e45bf7bbdafa
8
VMap( short v, Vector<Pair> pairs ) { HashMap<Pair,Pair> vMap = new HashMap<Pair,Pair>(); if ( pairs.size() > 1 ) { Pair last = null; for ( int i=0;i<pairs.size();i++ ) { // examine all the v-pairs Pair p = pairs.get( i ); if ( p.contains(v) ) { if ( last == null ) continue; ...
4b7a465e-7b41-4665-ad4d-4a8bbb48fc79
5
public void load() { // logger.info("load()..."); try { if (!this.todoDatabaseFile.exists()) { logger.warn("the file " + this.todoDatabaseFile + " does not exist yet. Will not try to read anything, but create a default todo list"); // Todo todo = new Todo(-1,"t1","do something"); // this.creat...
e7a0e4bd-e991-4dad-950e-13c90579ddc4
1
@Override public final Short getMax() { Short max = 0; for (final Short i : filter) { max = (short)Math.max(i, max); } return max; }
c7455509-c575-4365-bfac-8b4b0e6e953b
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Postosaude other = (Postosaude) obj; if (!Objects.equals(this.idPosto, other.idPosto)) { retu...
4c30cafc-1cb9-4cd6-a581-7aa20653c649
3
protected void decodeChildren(mxCodec dec, Node node, Object obj) { Node child = node.getFirstChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE && !processInclude(dec, child, obj)) { decodeChild(dec, child, obj); } child = child.getNextSibling(); } }
8fc6526b-82f0-4e11-9d9d-54ec7a6e358c
6
private void groupStatistics(){ if(!this.dataEntered)throw new IllegalArgumentException("no data has been entered"); this.groupMeansBD = new BigDecimal[this.nGroups]; // group means as BigDecimal this.groupMeans = new double[this.nGroups]; // group mean...
d8bb758d-ff4e-4011-81db-04bc4d6b9dd1
1
protected Class delegateToParent(String classname) throws ClassNotFoundException { ClassLoader cl = getParent(); if (cl != null) return cl.loadClass(classname); else return findSystemClass(classname); }
731f2368-5cff-4719-95b6-80fd1c614a01
9
public void connectVLine(String fieldType, CABot3Net retNet, CABot3Net linesNet) { int netSize =retNet.getInputSize(); int retinaOffset = getRetOffset(fieldType)*netSize; // let's move this to the off centre receptors as they work better retinaOffset++; int lineOffset = getLineOffset(fieldType, "Vli...
33858996-26fb-45a5-b2bd-0b7903963b84
6
public void signUp(SignUpRequest signUpRequest) throws AccountServiceException { try { if (!signUpRequest.getPassword().equals(signUpRequest.getConfirmPassword())) { throw new AccountServiceException("2 passwords do not match."); } if (!accountCaptchaService.validateCaptcha(signUpRequest.getCaptchaKey()...
882b1681-0a6f-4b90-9186-b7f23316ce56
2
private void mainAreaMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mainAreaMouseMoved if (isJoined == 1) { MoveTo cmd = new MoveTo(); cmd.areaId = 1; cmd.objectId = 3; cmd.maxAcceleration = 0; cmd.maxSpeed = 200; cmd.targetP...
594c666a-7c8b-47a2-b43b-5a931f1bed13
0
public void setFunction(Function function) { this._function = function; }
b707e671-a28d-41d3-8fc7-1310a0df09ef
0
@Override public void connectionClosed() { messageToSend.setEditable(false); okButton.setEnabled(false); messagelog.append("Connection Closed\n"); }
72f32762-5165-4464-95d9-95fd7a2105d6
8
public static void main(String[] args) { CommandLineParser parser = new BasicParser(); putOptions(); if (args.length < 2) { usage(options); return; } getFuncyWithIt(); try { CommandLine line = parser.parse(options, args); ...
fa6c28b0-b145-4bd9-9bed-f337bcdcd8e8
0
public static boolean isGreaterThan3(int i){ return i > 3; }
74c04f67-d50b-42ae-8d3c-ddc9508d43f9
0
public String toString(String input) { return name + calc(input); }
d8b3d830-d15b-41a3-96ba-8af04dd7fead
5
public static void loadMaps() { File mapsDir = Main.getMapsDirectory(); for(File map : mapsDir.listFiles()){ if(map.isDirectory()){ if(new File(map, "level.dat").exists() && new File(map, "region").exists() && new File(map, "map.yml").exists()){ YamlConfiguration mapYml = YamlConfiguration.loadConfigura...
a1d8678a-8590-4662-a8ab-c1b37d9a54f2
8
public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox) { if (averageGroundLevel < 0) { averageGroundLevel = getAverageGroundLevel(par1World, par3StructureBoundingBox); if (averageGroundLevel < 0) { ...
896129db-c51e-468f-a7ae-35cd40fec142
8
GridData getData(IFigure[][] grid, int row, int column, int rowCount, int columnCount, boolean first) { IFigure figure = grid[row][column]; if (figure != null) { GridData data = (GridData) getConstraint(figure); int hSpan = Math.max(1, Math.min(data.horizontalSpan, columnCount)); int vSpan = Math.max(1,...
675e7f9d-533a-4b94-8a59-80630fb846fc
6
public String toJSON() { Map<String,String> parameters = new LinkedHashMap<String,String>(); if (GoCoin.hasValue(getId())) { parameters.put("id",getId()); } if (GoCoin.hasValue(getFirstName())) { parameters.put("first_name",getFirstName()); } if (GoCoin.hasValue(getLastName...
3c76af9b-545d-434a-bc9d-0a2ef0dd5d29
0
public void setType(int type) { this.type = type; }
e0d264f8-ce93-43e9-b530-47df89b5cdc0
2
public void load(int chunkX, int chunkY) throws IOException{ String path = Standards.WORLD_SAVE_LOCATION + "/" + chunkX + "x" + chunkY + ".cnk"; FileInputStream in = new FileInputStream(path); for (int x = 0; x < Standards.CHUNK_SIZE; x++){ for (int y = 0; y < Standards.CHUNK_SIZE; y++){ //contents[x][y]...
5dcdc98a-c44f-479b-b1d4-4203ab68b070
7
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 fe...
e140c8a1-ed49-41b4-b26f-a0319f0d69ec
1
private void stopMatrix() { if (timer1.isRunning()) { timer1.stop(); timer2.stop(); } }
948a127a-d622-4d4b-9214-5efc0b1fa9cb
4
public ListNode deleteDuplicates(ListNode head) { if(head == null || head.next == null){ return head; } ListNode current = head.next; ListNode pre = head; while(current != null){ if(pre.val == current.val){ pre.next = current.next; current = current.next; }else{ pre = current; current...
0ab4616a-23b2-451f-b54b-5bc9c6169359
5
@SuppressWarnings("unchecked") public static void printMap(Map map, int depth) { final Iterator i = map.keySet().iterator(); Object key = null; for (int k = 0; k < depth; k++) System.out.print(" "); System.out.println("Dictionary:"); while (i.hasNext() && (key =...
9e2e7814-746d-4f8d-9a98-1157fe004f56
8
private static Scriptable js_sort(Context cx, Scriptable scope, Scriptable thisObj, Object[] args) { long length = getLengthProperty(cx, thisObj); if (length <= 1) { return thisObj; } Object compare; Object[] cmpBuf; if (args.length > ...
603b1626-9576-4242-b609-f2e47b1eaeca
6
protected SecuredPriorityBean getPriority(SecuredMessageTriggerBean messageTriggerBean) throws GranException { String impactUDFName = KernelManager.getFind().findUdf(INCIDENT_IMPACT_UDFID).getCaption(); String urgencyUDFName = KernelManager.getFind().findUdf(INCIDENT_URGENCY_UDFID).getCaption(); ...
1ce7f118-243d-45af-9371-b40e28e14312
4
private static Expression getLess(Expression left, Expression right) { if (left instanceof Less || left instanceof LessOrEqual) { return left; } if (right instanceof Less || right instanceof LessOrEqual) { return right; } return null; }
8c510bc5-f887-405c-a939-10f4986f3680
7
public int simMutate(File aFile, mutList aMutList, hap aHap) throws IOException{ int i,summut = 0; double mutrate, probSum = 0; double loc; int numRegions,reg,numMuts = 0; double randMark,begin; double[] reglen,probRegion,treeTime; int[] nMutByRegion = null; numRegions = dem.getNumRegs(); reg...
443ca5c9-92bd-47e2-92e7-49c87eb9c243
5
@Override public void visitInsn(ClassNode c, MethodNode m, Instruction monitor) { if(monitor.opcodeClass() == opc_monitorenter) { MethodEditor e = m.editor(); Instruction astore = prev(m, monitor); if(astore == null) return; Instruction dup = prev(m, astore); if(dup == null) return; ...
a7c13084-b9cb-4100-ba9f-34161a235b25
2
public ResultSet sqlQuery(String sql) { Statement stat = null; try { stat = (Statement) conn.createStatement(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } ResultSet rs = null; try { rs = stat.executeQuery(sql); } catch (SQLException e) { // TODO Au...
73ce8d24-3c82-41de-a6bb-7023d024655e
4
private float[] ciexyzToSRGB(float[] xyz) { float[] rgb = matrixMult(xyz, xyzToSRGB, 3); for (int i = 0; i < rgb.length; i++) { if (rgb[i] < 0.0) { rgb[i] = 0f; } else if (rgb[i] > 1.0) { rgb[i] = 1f; } ...
a41e8111-a147-465d-8a92-77e9e4b68662
8
private int huffman_coder_count1( int tableindex ) { int huffbits; int signv, signw, signx, signy, p = 0; int len; int totalBits = 0; signv = (v > 0)? 0: 1; signw = (w > 0)? 0: 1; signx = (x > 0)? 0: 1; signy = (y > 0)? 0: 1; // if(v < 0) v = -v; // if(w < 0) w = -w; // if(x ...
e0da0712-7f37-43f0-9a58-2ea7e7a19818
3
public void put(Key key, Value val) { if (val == null) { delete(key); return; } // double table size if average length of list >= 10 if (N >= 10 * M) { resize(2 * M); } int i = hash((String)key); if (!st[i].con...
87309e31-18d9-4688-9616-f87a9283a35c
8
public List<User> listViewUser(int uprofile, int userId) { List<User> list = null; String queryLISTMSISDN = ""; if (uprofile == 3) { queryLISTMSISDN = "select userid,fname,lname,baddress,haddress,utype,umobile,uemail,active from user "; } else { queryLISTMSISDN...
3e5ad62c-7ee5-4f63-969d-019ceb11f7be
4
private void gameRender() { if (dbImage == null){ dbImage = createImage(PWIDTH, PHEIGHT); if (dbImage == null) { System.out.println("dbImage is null"); return; } else dbg = dbImage.getGraphics(); } // a light blue background dbg.setColor(lig...
e0377dd7-6426-4c9b-b160-35f37b3d0428
9
public void sendOverAck(int numberRandom){ DatagramPacket packetOverAck=null,packetOver=null; byte sendBuffer[]=new byte[StopAckTip[0]]; byte receiveBuffer[]=new byte[StopTip[0]]; //���ý��ճ�ʱ1000ms try { socket.setSoTimeout(1000); /*������ȷ�ϰ�*/ ...
c464630b-5139-4eb8-865d-784c1ec9824a
6
public static TokenType getNegRelation(TokenType relation) { switch (relation) { case EQL: return TokenType.NEQ; case LSS: return TokenType.GEQ; case LEQ: return TokenType.GRE; case NEQ: return TokenType.EQL; case GEQ: return TokenType.LSS; case GRE: return TokenType.LEQ; default: t...
3c942229-ba5b-407c-8c33-4687ed74a86c
6
private static void execute() { for ( Properties conf : connections ) { FTPConnection conn = null; try { conn = FTPConnectionFactory.getInstance(conf); }catch(ConfigurationException ce) { log.error("could not get an instance of FTPConnection!", ce); } try { conn.connect(); ...
9f475bd3-5d79-4cbc-9c8d-e56701c0eb22
3
public void loadPlattformar() { PanelHelper.cleanPanel(plattformHolder); ArrayList<String> al = null; try { al = DB.fetchColumn("select pid from plattform"); } catch (InfException e) { e.getMessage(); } for (String st : al) { if (Valid...
1903dbdd-e6ee-4878-bd51-8b1dd1b815dc
1
public boolean matches( Class<?> clazz ) { return clazz.isAnnotation(); }
165f932b-2196-4aa3-a49c-20625ccf40d4
9
private QuadTreeNode insert(QuadTreeNode h, Point p) { if(h== null) return new QuadTreeNode(p); else if ( lessX(p,h) && lessY(p,h)) h.SW = insert(h.SW, p); else if ( lessX(p,h) && !lessY(p,h)) h.NW = insert(h.NW, p); else if (!lessX(p,h) && lessY(p,h)) h.SE = insert(h.SE, p); e...
7d42040f-fe4b-41a6-a763-ff918c3e6bb9
8
public Set<Map.Entry<Character,Long>> entrySet() { return new AbstractSet<Map.Entry<Character,Long>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TCharLongMapDecorator.this.isEmpty(); } ...
339ea863-e09c-4bcc-b9f9-c0dbe8016a11
1
public ClickedTrainListFrame(Title myTitle, TrainSchedule TS, String selectedTrain) throws IOException { setBackground(new Color(173, 216, 230)); setLayout(null); //This takes the output of the select method. JTable label = TS.select(selectedTrain); JScrollPane scrollPane = new JScrollPane(label); add(s...
390c628b-f81a-449f-8919-501e4f8326e3
0
public String toString() { return getName(); }
29effc4a-c312-4b08-87b5-3b47a60cb9ef
8
public static void main(String args[]) { Scanner sc = new Scanner(System.in); String s ; int t=0; while(sc.hasNextLine()) { s = sc.nextLine(); if(s.equals("#")) break; t++; System.out.print("Case "+t+": "); ...
3942ea59-e01c-470e-8327-92ca1f74c9bc
4
public synchronized Script popScript() { synchronized (scriptStack) { if (!scriptStack.isEmpty() && scriptStack.peek() != null) { Script script = scriptStack.pop(); log(Bot.class, Level.FINE, "Stopping script " + script.getManifest().name() + "..."); try { script.close()...
2e0d3a2f-f6f4-41b8-a029-1009ee6aaa6e
1
private int jjStartNfaWithStates_0(int pos, int kind, int state) { jjmatchedKind = kind; jjmatchedPos = pos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return pos + 1; } return jjMoveNfa_0(state, pos + 1); }
deae5715-482e-4016-9cb0-d247feb616db
1
public TwitterCrawler() { String appendix = getFilenameApd(); fileName = "./"+fileFolder+"/"+appendix; Settings.tableName = appendix+"COR"; checkFolder(); Settings.queryKeywords = Settings.baseKeywords; writeKeywordFile(Settings.baseKeywords,false); writeKeywordFile(Settings.blackList,true); //black...
dcf016b6-f884-4637-9229-fbb5cb4a5c59
8
public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Prestamo other = (Prestamo) obj; if (this.libro != other.libro && (this.libro == null || !this.libro.equals(other.libro...
a68fb6ce-b6a9-4216-bbd4-e7f5bbfc0cc1
2
T remove(int index) { T value = array[index]; ArrayList<T> tmp = new ArrayList<>(); for (int i = 0; i < array.length; i++) { if (i != index) { tmp.add(array[i]); } } array = (T[]) tmp.toArray(); return value; }
98d7160e-198e-4614-8060-bfc96d8ff234
9
private Object getObject(String[] strFields, Object o) throws IllegalAccessException { Field[] f = o.getClass().getDeclaredFields(); for (int i = 0; i < f.length; i++) { f[i].setAccessible(true); if (f[i].getType().equals(String.class)) { f[i].set(o, strFields[i]); ...
dad6905c-19a9-4970-b8f4-ad6c8f4ffd35
4
@Override public boolean equals(Object obj) { if (!(obj instanceof Rectangle)) { return false; } Rectangle b = (Rectangle)obj; return b.x1 == x1 && b.y1 == y1 && b.x2 == x2 && b.y2 == y2; }