method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
1986d3b5-f294-4412-bdba-dedebbf00a8a
5
public void doGet(HttpServletRequest request, HttpServletResponse response) { try { PrintStream out = new PrintStream(response.getOutputStream()); out.println("<capabilities>"); out.println("<peers path=\"community/\"/>"); // always give publish -- if clients don't have perms, they will see an error ...
39f16230-e3ac-42fa-b21d-6c3712b58f0d
4
@SuppressWarnings("unchecked") @Override public <Native, Hosted extends JOSObject<Native, Hosted>> JOSObject<Native, Hosted> _get(String name, Class<Native> NativeType, Class<Hosted> ReturnType) { JOSObject<? , ?> raw = this.get(name, JOSObject.class); if(raw == null) return null; try{ return (JOSObject<Nati...
efb073f1-fa8e-4da3-b7e0-34763d984817
7
public LinkedHashMap<String, Object> getData() { LinkedHashMap<String, Object> data = Maps.newLinkedHashMap(); if (type == Type.BOOLEAN) { enumeration.clear(); enumeration.add("true"); enumeration.add("false"); enumDescriptions.clear(); enumDescriptions.add("True"); enumDescriptions.add("False");...
4f67c361-674d-4de5-883f-2664fc2d94b7
9
private Boolean uploadFileIntern(File file, String graphURI){ if(!file.exists()){ try{ throw new FileNotFoundException(); } catch(FileNotFoundException e){ LogHandler.writeStackTrace(log, e, Level.SEVERE); return false; } } String absFile = file.getAbsolutePath(); String contentType = RD...
a8db832a-4e48-4fe4-a2da-ce55df1244c4
3
@Override public void deleteIllness(IllnessDTO illness) throws SQLException { Session session = null; try { session = HibernateUtil.getSessionFactory().openSession(); session.beginTransaction(); session.delete(illness); session.getTransaction().commit(...
c1b111c0-5b98-4868-a279-ee11de0789fc
7
public boolean interact(Widget w, Coord c) { for (Widget wdg = w.lchild; wdg != null; wdg = wdg.prev) { if (wdg == this) continue; Coord cc = w.xlate(wdg.c, true); if (c.isect(cc, (wdg.hsz == null) ? wdg.sz : wdg.hsz)) { if (interact(wdg, c.add(cc.inv()))) return (true); } } if (w instanc...
ca316c81-0b94-468a-ab07-416aa68a3ee6
9
public void run() { // XXX: Is this not the same as screen? while (true) { try { while (! request_queue.isEmpty()) { // XXX: request_queue is a queue of HTTPMessages, not // HttpRequests. HttpRequest next = (HttpRequ...
4a65f785-1c1d-4c8a-91b5-b0174971b17c
3
private boolean readTrue( StringBuffer b ) throws IOException, JSONSyntaxException { if( !readExpected('r',b) || !readExpected('u',b) || !readExpected('e',b) ) throwJSONException( "Unexpected token: " + this.describeCurrentToken() + "; expected true." ); this.fireTrueRead( b.toString() ); return tr...
9d7644fd-05ef-456b-993f-42bd9adfe0d6
3
private void clean_pipes() { if (pipe != null) { // Get rid of half-processed messages in the out pipe. Flush any // unflushed messages upstream. pipe.rollback (); pipe.flush (); // Remove any half-read message from the in pipe. w...
08a7214f-3799-47d8-a335-17eafd680051
4
private void createPageRangeFields(PrintRequestAttributeSet set) { PrintService service = getService(); if (service.isAttributeCategorySupported(PageRanges.class)) { ButtonGroup group = new ButtonGroup(); int start = 1; int end = 9999; PageRanges pageRanges = (PageRanges) set.get(PageRanges.class); i...
a25abf1f-c274-49a4-a06b-9405c22674b9
3
private ResGridlet cancel(int gridletId, int userId) { ResGridlet rgl = null; // Check whether the Gridlet is in execution list or not int found = gridletInExecList_.indexOf(gridletId, userId); // if a Gridlet is in execution list if (found >= 0) { // up...
dcb5414a-3b72-4187-bfff-f257db6ace92
7
public double classify(svm_problem _prob){ int[] countClass = new int[_prob.l]; double[] result = null; for (SVMHelper aSVM : ensembler){ result = aSVM.predict(_prob); for (int i = 0; i < result.length; i++){ if (result[i] == 1){ co...
c20b2ca5-12d4-453b-b069-02f373171ed3
2
public void end() { if(z==null) return; if(compress){ z.deflateEnd(); } else{ z.inflateEnd(); } z.free(); z=null; }
7d934204-9b2b-487d-932f-bd73c2d2d7a3
9
public void tick() { if (this.getWorldInfo().isHardcoreModeEnabled() && this.difficultySetting < 3) { this.difficultySetting = 3; } this.worldProvider.worldChunkMgr.cleanupCache(); this.updateWeather(); long var2; if (this.isAllPlayersFullyAsleep...
132839e7-4d22-464e-a020-cdd92681de57
4
public static boolean forwardToPrevious(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { final String referrer = request.getHeader(REFERRER); if (null == referrer) { return false; } final String contextPath = request.getContextPath(); if (re...
4044aee1-b0db-44ee-b00f-cf6990520a28
5
public static void main(String[] args) { ApplicationContext applicationContext = new FileSystemXmlApplicationContext("classpath:client.xml"); WebCrafterService service = (WebCrafterService) applicationContext.getBean("rmiProxy"); try { ItemTemplate wood = service.getItemTemplate("Wo...
349d1a51-dbf1-4ea2-bf02-b7984eb6a64b
3
void search() { Logger.getLogger(Search.class.getName()).entering(Search.class.getName(), "search"); String text = searchField.getText(); tableRowSorter.setRowFilter(RowFilter.regexFilter("(?i)" + text)); Pattern pattern = Pattern.compile("(?i)" + text); ...
0526d85d-9c9d-4d62-8162-83d789ffaf61
7
public static void initializeStreets(Gameboard board) { try { for (final StreetColor color : StreetColor.values()) { final List<PlaceProperty> places = new ArrayList<PlaceProperty>(); for (final Place place : board.places) { if (place instanceof PlaceProperty && ((PlaceProperty) place).getC...
49a64c73-3c4f-4478-a955-3587b0b33ea2
2
private static boolean isServerChannel( Channel c ) { if ( c.isDefault() && BungeeSuite.proxy.getServers().containsKey( c.getName() ) ) { return true; } return false; }
ef816059-6512-4a23-b680-0eb06dd1f680
6
protected boolean extractNatives() { setStatus("Extracting natives..."); File nativesJar = new File(binDir, getFilename(jarURLs[jarURLs.length - 1])); File nativesDir = new File(binDir, "natives"); if(!nativesDir.isDirectory()) { nativesDir.mkdirs(); } FileInputStream input = null; ZipInputStream zipIn...
4a107d31-d93c-4691-85f0-d762101d9533
6
public static Double nernst(Double freeEnergy, Double moles, Double cellPotential) { //G = -nFE boolean[] nulls = new boolean[4]; nulls[0] = (freeEnergy == null); nulls[1] = (moles == null); nulls[2] = (cellPotential == null); int nullCount = 0; for(int k = 0; k < nulls.length; k++) { if(nulls...
9727f47b-ab0b-49cf-b121-0027db839897
5
@Override public ParserResult specialCheckAndGetParserResult(ParserResult result, SyntaxAnalyser analyser) throws GrammarCheckException { boolean theOtherInfoIsEmpty = result.getAggregateFunctionName() == null && result.getConditions().size() == 0 && result.getDimensionLevelInfo().size() == 0 && resul...
afa697f6-a779-4e21-b9e3-777abe9a103e
6
private static int rankHands(Cards[] hands, Cards board, int numhands, int[] wins, int[] ties, int total) { List<HandRank> ranks = new ArrayList<HandRank>(numhands); HandRank highest = null; for (Cards hand : hands) { HandRank rank = holdem(hand, board); if (highest == nu...
7ba0174a-9bb0-4993-9551-93a73a21b3cf
1
public void skipCurrentTurn() { remainingActions = (remainingActions > 0) ? 0 : remainingActions; }
e6428999-8647-4505-a090-1ee46a4f55a5
4
public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case ID: return isSetId(); case NAME: return isSetName(); case PRICE: return isSetPrice(); } throw new IllegalStateException(); }
539c6138-5954-4e16-983c-b48576006d41
0
public TwitterModel getTwitterModel() { return twitterModel; }
3f27bb0e-39f0-4c3f-b65b-15930b5210e1
8
public void buttonClick(ActionEvent e) { String bv = e.getActionCommand().toString(); switch (bv) { case "New": NewMapDialog mapDialog = new NewMapDialog(); int mapDialogResult = JOptionPane.showConfirmDialog(null, mapDialog, "Select", JOptionPane.OK_CANCEL_OPTION); if (mapDialogResult == JOpti...
cba4238d-4a65-4f81-b73a-a1b396205762
5
public static void main(String[] _args) { Random rand = new Random(0); final int HOLDERSIZE = 1000; TestObj[] holder = new TestObj[HOLDERSIZE]; TestObj testobj = new TestObj(0x12345678); if (!OkraUtil.okraLibExists()) { System.out.println("...unable to create context, using fake references"); for (...
2577e07f-e57e-4c03-9e36-1598ac7fc7bb
4
public void keyReleased(KeyEvent e) { int key = e.getKeyCode(); switch(key) { case KeyEvent.VK_W: p.setMoveUp(false); break; case KeyEvent.VK_S: p.setMoveDown(false); break; case KeyEvent.VK_A: p.setMoveLeft(false); break; case KeyEvent.VK_D: p.setMoveRight(false);...
93ba664a-f5ab-4e2b-96e1-147206bd3432
0
@Override public boolean isDefault() { return defaultGroup; }
0825782a-011a-477b-9fe3-1753a3b95b94
5
@Override public void onDisable() { FileOutputStream fos = null; ObjectOutputStream oos = null; try { File data = new File(this.getDataFolder(), "arenadata.bin"); data.mkdirs(); data.createNewFile(); fos = new FileOutputStream(data); ...
8ea5af3e-96ca-4517-8930-dbe5971c5c9d
2
public Fornecedor getFornecedor(String razao) throws ExceptionGerentePessoa{ for (Fornecedor f : fornecedores) { if (f.getNome().equalsIgnoreCase(razao)) { return f; } } throw new ExceptionGerentePessoa ("Fornecedor n��o cadastrado"); }
58058cbf-499f-472c-a655-3447d9b17a90
3
@Override public void drawUp(Point p, Node node) { this.node = node; // Adjust color when we are selected updateColors(); // Update the button updateButton(); // Update font updateFont(); // Draw the TextArea setText(node.getValue()); int indent = node.getDepth() * pIndent; int wid...
485bd074-fac5-4419-b4ee-21393e9cea37
4
public ListNode deleteDuplicates(ListNode head) { ArrayList<Integer> visited = new ArrayList<Integer>(); if(head == null) return null; ListNode p = head; visited.add(new Integer(head.val)); while(p != null && p.next != null) { if(visited.con...
00910232-257e-4eb3-9f2a-abcf864fe2bd
7
public void addNewPastMeeting(Set<Contact> contacts, Calendar date, String text) { try { if(contacts.equals(null) || date.equals(null) || text.equals(null)) { throw new NullPointerException(); } if(contacts.isEmpty() || !contactList.containsAll(contacts)) { throw new IllegalArgumentExceptio...
04e7e5ca-f497-422a-8f69-759212d1bac4
9
public static void main(String[] args) { t = new TreeMap<Integer, Integer>(); int n = 201; sol = new ArrayList[n]; for (int i = 0; i < n; i++) { t.put( (i*i*i) , i ); } for (int i = 2; i < n; i++) { for (int j = i+1; j < n; j++) { for (int k = j+1; k < n; k++) { int m = i*i*i + j...
9d247d6f-ff55-4275-a64d-1a4d8920bf3a
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof Swear)) return false; Swear other = (Swear) obj; if (swearword == null) { if (other.swearword != null) return false; } else if (!swearword.equals(other.swearword))...
5f2ccf6e-aaed-4c90-8b49-c5751f913de2
0
@Transient public String getFunUnidad() { return funUnidad; }
dadfa0b5-7af0-46ef-a7ff-dd4fb2374258
6
@Override public void showGiveOptions(ResourceType[] enabledResources) { giveAvailables = enabledResources; givereload.setVisible(false); giveAmount.setVisible(false); //Show them all givewood.setVisible(true); givebrick.setVisible(true); givesheep.setVisible(true); givewheat.setVisible(true); giv...
470d3db3-92db-43b5-b567-b5dafe7be8d1
6
public static void generateDataSet(String path, Connection connection) { try { IDatabaseConnection dbUnitConnection = new DatabaseConnection(connection); IDataSet dataSet = dbUnitConnection.createDataSet(); File file = new File(path); if (!file.getParentFile().exists()) { file.getParentFile().mkdirs()...
6ddfc602-16f5-4cd2-91b2-9cb41b8ecc45
9
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; PersonInfo other = (PersonInfo) obj; if (firstName == null) { if (other.firstName != null) return false; } else if (!firstName.equals(other.firstNa...
59dfa576-e8c3-4c64-8afa-55393999daa0
8
private CommandExecutionResult executeInternal(Map<String, RegexPartialMatch> line0, AbstractEntityDiagram system, Url url, List<? extends CharSequence> s) { final String pos = line0.get("POSITION").get(0); final String code = line0.get("ENTITY").get(0); final IEntity cl1; if (code == null) { cl1 = syst...
1c0f2421-e776-4e6e-9f06-d8636e5b98b6
0
public MandelbrotPanelDouble() { setLayout(new BorderLayout()); setUpFractalPanel(); setUpInfoPanel(); }
528e6f3f-c753-4732-90cb-300dccfe58ac
2
public String loadExame() { Map parametros = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); String idExa = parametros.get("idExame").toString(); Integer id = Integer.parseInt(idExa); int i; for (i = 0; i < examesBean.size(); i++) { i...
efdaa28a-19de-49bd-9550-4758c163f5a3
1
private void endArguments() { if (argumentStack % 2 != 0) { buf.append('>'); } argumentStack /= 2; }
439b13ab-f717-46c1-91a9-1f38340add78
1
@Override public void drawImage(Function f, MyPanel image, double x, double y) { Graphics g = image.getGraphics(); Graphics2D g2 = (Graphics2D) g; g2.translate(150, 150); g2.scale(x, y); Complex tmp1 = f.evaluate(this.c1); int p = 10; for (int t = 0;...
e98552ac-73e0-40d6-a3ec-f06b6bed57a8
0
private Set<Card> twoKingsTwoQueensTwoJacksSix() { return convertToCardSet("KS,6S,KD,JS,QD,QC,JH"); }
0b89ac2f-e936-4b21-a671-19dc4338e0fb
4
@Override public Icon getIcon() { Icon retVal = null; if (fRating == null || fRating == Rating.NO_RATING) { retVal = null; } else if (fPosition < fRating.ordinal()) { retVal = getStarIcon(); } else if (fSelected) { ...
703fd522-4e15-4906-995b-9fb140bc3317
0
public Person5(String pname) { name = pname; }
9340fe9a-2e5e-47e7-9006-4199b6dae580
5
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if(args.length != 3) { printArgsError(args); printHelp(sender, label); return true; } String target = findTarget(args[1]); int chargeId = -1; try { chargeId = Integer.valueOf(args[2]); } catc...
4db7fc20-97c1-4eee-a260-d817e1a808f4
6
private static void DoMerge(Object[] numbers, int left, int mid, int right, int sortColumn) { int i, left_end, num_elements, tmp_pos; left_end = (mid - 1); tmp_pos = left; num_elements = (right - left + 1); Object[] temp = new Object[numbers.length]; while ((left <= left_end) && (mid <= right)) { if...
d510e656-8931-4854-bd1d-ab229be99302
5
private File downloadBackupToFile(String backupName, String outputDirectory, long totalFileBytes) { final PipedInputStream ftpDataInStream = new PipedInputStream(); File outFile = null; try { PipedOutputStream ftpDataOutStream = new PipedOutputStream(ftpDataInStream); ou...
46966352-0091-469f-bee1-a466732fcd2d
7
final int[] method1046(int i, int i_8_) { anInt1719++; if (i < 0 || (i ^ 0xffffffff) <= (anIntArrayArray1724.length ^ 0xffffffff)) { if (anInt1715 == -1) return new int[0]; return new int[] { anInt1715 }; } if (!aBooleanArray1725[i] || (anIntArrayArray1724[i].length ^ 0xffffffff) >= -2) r...
26014b28-a0d3-4d82-9d58-3415b8e69761
2
public void countFiftyMoveRule(Move lastMove) { if (lastMove instanceof CaptureMove || lastMove.piece instanceof Pawn) { this.fiftyMoveRuleCount = 0; } else { this.fiftyMoveRuleCount++; } }
bc402f1d-4b5a-40c4-b3af-d0a3d646c74d
8
private int getIndex(char letter) { switch (letter) { case 'I': return 0; case 'V': return 1; case 'X': return 2; case 'L': return 3; case 'C': return 4; case '...
50c89f38-35d2-497c-a2c7-34deb3cb1f29
0
@Override public void mouseExited(MouseEvent e) {}
8c76e123-436b-4d38-9eda-d99f79e6c5f8
7
Class348_Sub33(int i, byte[] is) { ((Class348_Sub33) this).anInt6958 = i; ByteBuffer class348_sub49 = new ByteBuffer(is); ((Class348_Sub33) this).anInt6965 = class348_sub49.getUByte(); ((Class348_Sub33) this).anIntArrayArray6959 = new int[((Class348_Sub33) this).anInt6965][]; ((Class348_Sub33) this).anIntArra...
5e7eb844-2cfb-4c35-a38b-3ea47d4b2d82
1
public final void relocate(String target, String... patterns) { for (String path : patterns) { pages.relocate(target, path); } }
a1f60fef-5ff5-47f7-90af-b8e2fc851656
8
public void setEditValue(int n, EditInfo ei) { if (ei.value > 0 && n == 0) { onresistance = ei.value; } if (ei.value > 0 && n == 1) { offresistance = ei.value; } if (ei.value > 0 && n == 2) { breakdown = ei.value; } if (ei.value...
37d3acc1-c979-4121-9595-27da88588120
6
public static Rectangle position(Rectangle outer, Rectangle inner, Alignment horizontalAlignment, Alignment verticalAlignment) { switch (horizontalAlignment) { case LEFT_TOP: default: inner.x = outer.x; break; case CENTER: inner.x = outer.x + (outer.width - inner.width) / 2; break; case RI...
397d573d-79fc-4e35-a34b-2522e4bcf599
2
private void dump (Document doc) throws IOException, FileNotFoundException, XPathExpressionException, ProtocolException, TransformerException { long startMillis = System.currentTimeMillis(); String strFileName = null; NodeList nl = (NodeList) xp.evaluate("//process...
27172b27-2f3b-4901-b94e-3e15863dd682
8
public void mouseClicked(int par1, int par2, int par3) { boolean flag = par1 >= xPos && par1 < xPos + width && par2 >= yPos && par2 < yPos + height; if (canLoseFocus) { setFocused(isEnabled && flag); } if (isFocused && par3 == 0) { int i = pa...
889bb39b-8b44-4b0f-9e0b-3e90b9b45615
9
public double powHelper(double x, int n, Hashtable<Integer, Double> ht) { if(x==0) if(n<0) return Double.MAX_VALUE; else if(n==0) return 1.0; else return 0.0; if(n==0) return 1.0; if(n==1) return x; if(n==-1) return 1.0/x; if(ht.containsKey(n))...
d23b919f-33f6-4c2b-b4be-391a79d25b3c
9
public void switchUser(String pUsername) throws SQLException { pUsername = pUsername.toUpperCase(); //Validate not attempting to CONNECT as the main user if(mPromoteUserName.equals(pUsername)){ throw new ExFatalError("Illegal attempt to CONNECT as promotion control user " + pUsername + ";...
1aa8492a-abe3-477f-a7d0-3af5f0596c7a
6
/* */ public void keyReleased(KeyEvent e) /* */ { /* 323 */ if (activeClass != null) /* 324 */ switch (e.getKeyCode()) { /* */ case 87: /* 326 */ activeClass.setGoingUp(false); /* 327 */ activeClass.stop(); /* 328 */ break; /* */ case 83: /* 330 */ ...
989dbac3-4f3f-49c5-bc2b-4030137e0fb7
7
public static boolean isStandardDeviationParam(String accession) { return INTENSITY_STD_SUBSAMPLE1.getAccession().equals(accession) || INTENSITY_STD_SUBSAMPLE2.getAccession().equals(accession) || INTENSITY_STD_SUBSAMPLE3.getAccession().equals(accession) || INTENS...
792f95c0-db43-44df-b746-a78a58d6fd87
2
public static void setLowInventoryWarning(DrugInventoryPage drugInv){ clearLowInventoryTable(Gui.getDrugPage()); String drugName=""; String drugCount=""; ArrayList<String> drug= null; drug=DatabaseProcess.getDrugCount(); int i=0; int j=0; while(i<drug.size()){ drugName=drug.get(i); drugCount=drug...
1589f508-de65-4332-878e-df1afd8be07a
5
private Initializable replaceSceneContent(String fxml) throws Exception { FXMLLoader loader = new FXMLLoader(); InputStream in = getClass().getResourceAsStream(fxml); loader.setBuilderFactory(new JavaFXBuilderFactory()); loader.setLocation(getClass().getResource(fxml)); AnchorPan...
eee14306-1866-4216-82e8-17eecccc1d6a
4
public static char determineGrade(double s) // s is for score, I reused my way to find the grade from the earlier assignment TestScore { if(s < 60) return 'F'; else if(s < 70) return 'D'; else if(s < 80) return 'C'; else if(s < 90) return 'B'; else return 'A'; }
6aeef04b-c38d-4722-9fec-a9795a5f1262
5
public List<Movie> getMoviesByCineplex(Cineplex cineplex) { moviesByCineplex = new ArrayList<Movie>(); for(Cinema c : cineplex.getCinemas()) { for(ShowTime st : c.getShowTimes()) { int month; calendar.setTime(st.getTime()); month = calendar.get(Calendar.MONTH); if(st.getMovieTickets().size() > 0...
0cee7eef-8ec7-4c6d-9559-12ec8e91c81b
6
public ArrayList<Noeud> includedInto(int deb_x, int deb_y, int fin_x, int fin_y) { if (plan == null) return null; List<Noeud> noeuds = plan.getNoeuds(); ArrayList<Noeud> selection = new ArrayList<Noeud>(); // Pour tous les noeuds for (Noeud n : noeuds) { int x = screenX(n.getX()); int y = screenY(...
566ba4e1-e42a-4d04-9372-f90ae82e6ad2
4
private Clip initClip(String strIn, String strDefault) { Clip clipOut = null; try { clipOut = AudioSystem.getClip(); try { clipOut.open ( AudioSystem.getAudioInputStream ( new java.io.File(strIn) ) ); } catch(Exception e) { if (null != strIn && 0 < strIn.l...
0b138ba8-3a43-4da8-aa3d-64d7e4f7b88d
1
public String getValue() { if (isSortable()) { WebElement el = element.findElement(By.tagName("div")); return el.getText(); } return element.getText(); }
b4e7e609-1309-4a22-b362-3efa750370ff
5
public void setWapSignal(int i) { switch (i) { case WAP_SIGNAL_NONE: case WAP_SIGNAL_LOW: case WAP_SIGNAL_MEDIUM: case WAP_SIGNAL_HIGH: case WAP_SIGNAL_DELETE: wapSignal = i; break; default: throw new RuntimeException("Invalid wap signal value: " + i); } }
5d6f3420-9d96-43cb-909d-34ce8fcbd227
3
private void calcFEP() { Map<String, Float> fep; String name = name(); if ((name != null) && (fep = Config.FEPMap.get(name().toLowerCase())) != null) { FEP = "\n"; for (String key : fep.keySet()) { FEP += String.format("%s:%.1f ", key, (float) fep.get(key) * qmult); } } }
59b2c0eb-dd5b-4a9b-a6a4-c902c84374b7
3
final public void Unary_logical_operator() throws ParseException { /*@bgen(jjtree) Unary_logical_operator */ SimpleNode jjtn000 = new SimpleNode(JJTUNARY_LOGICAL_OPERATOR); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); jjtn000.jjtSetFirstToken(getToken(1)); try { ...
9a71ab52-ffb5-40a6-b3c8-ecf7d8ee7970
3
public ArrayList<DBSong> getSongsById(ArrayList<Integer> ids){ StringBuilder sb = new StringBuilder(); for(Integer id : ids){ sb.append(id).append(','); } sb.deleteCharAt(sb.lastIndexOf(",")); HashMap<String, String> params = new HashMap<String, String>(); ...
c783c0d7-2427-47e2-bd31-f50d2c03ed16
1
public static void outTrace(String data){ if (trace != null) trace.println(data); }
f02e0ca6-e6db-4dd8-affd-fc6f46c9a9d7
4
public boolean ReceivedGiftToday(BirthdayRecord birthday) { // Is there a birthday record for this player? if (birthday != null) { if (birthday.lastGiftDate == null) { // Player has never received birthday gifts Debug("Never received a gift"); return false; } // Get current date without time (...
b4ff99c7-3c4a-4c2e-83bd-39a980a5e8db
6
public static int findNumCommentsMentionedCodeReviews(String content) { if (content != null && !content.equals("")) if (content.contains("Code Review") || content.contains("code review") || content.contains("review") || content.contains("reviewed")) return 1; return 0; }
7f3af4bd-e2e6-47b1-b92b-f9b116f93639
9
public void filterDocument(Dictionary dictionary, int docId, Map<Integer, String> docTable){ String line = ""; String []splitString; String totalString = ""; StringBuilder sb = new StringBuilder(); while( true){ line = fileProcessor.readLineFromFile(); if( line =...
ab5d718f-340f-44a4-aa96-b3d942647cae
1
public void deleteGroup( int id ) { try { PreparedStatement ps = con.prepareStatement( "DELETE FROM groups WHERE id=?" ); ps.setInt( 1, id ); ps.executeUpdate(); ps.close(); } catch( SQLException e ) { e.printStackTrace(); } }
3303464d-b6e6-4d2a-91a2-682ca8548fc8
6
public void init() { boolean debug = CommandLine.booleanVariable("debug"); if (debug) { // Enable debug logging Logger logger = Logger.getLogger("com.reuters.rfa"); logger.setLevel(Level.FINE); Handler[] handlers = logger.getHandlers(); ...
025610d2-673d-42a2-950c-2f5dfa627ef6
7
@Override public String toString() { // Prometheus (2012), USA, 124 min, csfd: 70%, imdb: 7.5, http://csfd.cz/film/290958 String result = title + " "; if (year != null) result += "(" + year + ")"; result += ", "; if (country != null) ...
33308040-176c-49b7-9d15-2f119475cb37
3
public void run() { try { this.MReading.acquire(); if(this.counter == 0) this.MWriting.acquire(); this.counter++; this.MReading.release(); System.out.println("Lecture"); Thread.sleep(1000); this.MReading.acquire(); this.counter--; if(this.counter == 0) this.MWriting.re...
ebad640c-9306-44ba-b844-7fa142796f1a
1
public static Class[] getParams(String desc) { if (desc.charAt(0) != '(') throw new RuntimeException("$sig: internal error"); return getType(desc, desc.length(), 1, 0); }
2749e618-fa51-44af-9632-7f376a2ef0eb
0
private String extractAnnotationNameFromMethod(Annotation antFromMethod) { int endOfAnnotationName = antFromMethod.toString().indexOf("("); String upToAnnotationName = antFromMethod.toString().substring(0,endOfAnnotationName); return upToAnnotationName.substring(upToAnnotationName.lastIndexOf(".") + 1); }
d413b029-1ae5-41f0-bbd4-6776db964c2b
5
private void computeError() { for(int i = 0; i < targetMacroBlocks.size();i++) { RGB[][] t = targetMacroBlocks.get(i); RGB[][] r = bestBlocks.get(i); RGB[][] e = new RGB[16][16]; for(int j = 0; j < 16; j++) for(int k = 0; k < 16; k++) e[k][j] = new RGB(0,0,0); for(int y = 0; y < 16; y+...
1ad14d35-e36e-4ea5-960c-f3b8e128bed5
2
public void heal(int heal) { if (hurtTime > 0) return; //level.add(new TextParticle("" + heal, x, y, Color.get(-1, 50, 50, 50))); health += heal; if (health > maxHealth) health = maxHealth; }
8be5639f-c134-4933-945f-97304d584a94
1
public void addPlayer(Player player) { if (playersNo < maxPlayers) { players[playersNo] = player; player.prepareToMission(); ++playersNo; wmap.removeShadow(player); } }
d3217ba4-c1c1-4d1d-b24f-0f2ef8c838e0
7
public static boolean func_46154_a(ItemStack par0ItemStack, ItemStack par1ItemStack) { return par0ItemStack == null && par1ItemStack == null ? true : (par0ItemStack != null && par1ItemStack != null ? (par0ItemStack.stackTagCompound == null && par1ItemStack.stackTagCompound != null ? false : par0ItemStack.st...
acde150b-1116-477c-b0f6-3174115d962a
4
public Set<Tile> getTileArray() { if (tiles != null) { return tiles; } final Polygon polygon = getPolygon(); final Rectangle bounds = polygon.getBounds(); final Set<Tile> set = new HashSet<Tile>(); int x = 0; while (x < bounds.width) { int y = 0; while (y < bounds.height) { final int tempX ...
3eff476b-e7e5-4235-9253-71a13ad04a04
5
public void draw(Graphics2D g) { final int s = 30; // size of a cell g.setColor(BACKGROUND); g.fillRect(x * s, y * s, s, s); g.setFont(FONT); if (state == State.OPEN) { g.setColor(OPENED); g.fillRect(x * s, y * s, s, s); if (type == Type.MINE)...
f2da41e3-4927-4fe8-b967-3ef05421734b
4
public static void main(String[] args){ Conn con = PoolManager.getInstance().getConnection(); Connection conn = con.getConn(); Statement stmt = null; ResultSet rs = null; try { stmt = conn.createStatement(); rs = stmt.executeQuery("select * from article "); int c = rs.getMetaData().getColumnCount(...
0aa38044-fb54-4378-9023-668501b604cf
2
private void addVideo(Video video){ VideoPlayer videoPlayer; if(scalingFactorX!= 1 || scalingFactorY != 1){ videoPlayer = new VideoPlayer(video,videoListener); videoPlayer.resizeVideo(scalingFactorX, scalingFactorY); } else{ videoPlayer = new VideoPlayer(video,videoListener); } layeredPane.add(vide...
c9ccd411-320e-4f70-8895-392f978e8600
3
final synchronized public String getString() throws Exception { if (type != Type.STRUCT) throw new Exception("Type " + type + " does not contain string"); final short code = data.getShort(0); final Type el_type = Type.forCode(code); if (el_type != Type.STRUCT_STRING) ...
eec33036-e97c-450c-99b7-637a5f4f3aac
8
public void saveToFile(String fileName) throws IOException { /* * This method writes the XML document in the following format: * * <?xml version="1.0" encoding="UTF-8" ?> * <macro> * <macroName>test</macroName> * <action id="default-typed">abcdefg</action> * [<action id=...>...</action>...
ff0640b6-6097-41cb-af2f-50829666a07d
6
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; BookstoreArtistEntity that = (BookstoreArtistEntity) o; if (artistid != that.artistid) return false; if (name != null ? !name.equals(that.name)...
fe7a36d3-3180-442a-83a3-f4b6a9402a59
2
private void startField(){ if (field == null || !running) { field = new Thread(this); field.start(); running = true; } }
8b449db1-12bd-4329-afb0-7bd0b1f1c92d
2
public static boolean isParameter(String line){ if(line.contains("=") == false){ return false; } String[] split = line.split("="); if(split.length == 2){ return true; } return false; }