method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
b38fbff9-ef5c-4c80-b633-46382e8218d2
0
public Component getActive() { return tabbed.getSelectedComponent(); }
3542cdde-04f2-46c8-895c-a3d6b25ffd7a
3
public static void deserialize() { int x; try { FileInputStream fileIn = new FileInputStream("/Users/Ruben/Documents/fool.ser"); ObjectInputStream in = new ObjectInputStream(fileIn); Canvas.components = (ArrayList) in.readObject(); x = Canvas.comp...
76f0d383-f2d8-4fe8-b4f3-6f58ddd2509a
6
static Map<String, Integer> toIntegerMap(Object objMap) { Map<?, ?> map = (Map<?, ?>) objMap; Map<String, Integer> result = new HashMap<>(); for (Object key : map.keySet()) { Object value = map.get(key); result.put(key.toString(), value instanceof Integer ? (Integer) value : Integer.pa...
878797b9-1aa5-4810-a480-165b47e9c6a4
7
private int partition(int[] arrayIn, int lhs, int rhs, SorterParams.SortDirection sortDir) { int pivot = arrayIn[lhs + (rhs - lhs) / 2]; int i = lhs; int j = rhs; MemoryUsage.addMem(3); while(i <= j) { if(sortDir == SorterParams.SortDirection.ASC...
57a0edfc-1e95-4204-8be5-12ec179eca54
4
@Override public void run() { DatagramPacket paquete; byte recibidos[] = new byte[50000]; try { paquete = new DatagramPacket(recibidos, recibidos.length); socket.receive(paquete); ByteArrayInputStream bytesDelPaquete = new ByteArrayInputStream(paquete.ge...
8d573be4-0827-4098-8ebb-efbaac30043b
6
private void showMessage(){ try { String[] tokens = inputText.split("\002"); String newText; if(whisper){ String receiver = (String)sendToCombo.getSelectedItem(); newText = "\n" + "( TO "+ receiver + " )"+client.username + " :";// + inputText; ...
e9265231-c7c6-4416-8981-44580ba7b67a
3
public void deleteMark(Mark mark) { marks.remove(mark); for (final Connection connection : mark.getConnections()) { if (!connection.getA().equals(mark)) { connection.getA().deleteConnection(connection); } if (!connection.getB().equals(mark)) { connection.getB().deleteConnection(connection); } ...
2eae10d1-26c6-4ab7-bd95-3ba9b0a431a4
0
public void liikuVasemmalle() { this.xSuunta = -1; }
0ec7ff01-1b92-44fa-97f8-6f76c9e4e35d
3
@Override public synchronized Vector slice(int from, int to) { SparseVector res = new SparseVector(); for(int index : data.keys()) { if (index >= from && index < to) { res.set(index-from, data.get(index)); } } return res; }
87f3b755-53c4-45b9-8919-0d132d44dd2c
0
public static long getStartOfDay(long t) { Date d = new Date(t); Date dayD = new Date(d.getYear(), d.getMonth(), d.getDate()); return dayD.getTime(); }
3ee3408d-96a0-4d71-9ddb-a034d262c94e
7
@Override public void caseASysoutStmt(ASysoutStmt node) { for(int i=0;i<indent;i++) System.out.print(" "); indent++; System.out.println("(Print"); inASysoutStmt(node); if(node.getSysout() != null) { node.getSysout().apply(this); } if...
07750ecf-9680-4f10-b6d8-7d189d3c42b5
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 Usuario)) { return false; } Usuario other = (Usuario) object; if ((this.cpf == null && other.cpf != null) || (t...
022d93c0-040a-4ec8-8592-01f76eaf793d
4
public List<order> retrieveOrderData(String supName) throws SQLException{ try{ databaseConnector=myConnector.getConnection(); stmnt=(Statement) databaseConnector.createStatement(); SQLQuery="SELECT * FROM familydoctor.order WHERE supplierName="+"'"+supNa...
1e89d315-9333-4fdc-ba66-45358fff92c7
2
@Override public void error(String message, Throwable e) { if (errorMethod != null) { try { errorMethod.invoke(logger, message, e); } catch (Exception e2) { } } else { System.err.println("ERROR " + EasyFlow.class.getName() + " " + messa...
fbb5221b-b329-45d9-85f3-0595bd5df4c3
9
private void doAction(char choice) { switch (choice) { case 'G': this.gamePlayHelpView(); break; case 'Z': this.puzzleHelpView(); break; case 'T': this.TreasureHelpView(); break; ...
b350b6bc-342b-4ff3-ad2f-19e7d0617bdb
4
private void albumsTableKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_albumsTableKeyPressed Logger.getLogger(MainInterface.class.getName()).entering(MainInterface.class.getName(), "albumsTableKeyPressed"); if (evt.getKeyCode() == KeyEvent.VK_TAB) { evt.consume(); ser...
f693f0e0-8ad5-4874-b9fd-31cc44268c75
7
public int findElement(int[] arrA, int element) { int low = 0; int high = arrA.length - 1; while (low <= high) { int mid = (low + high) / 2; if (arrA[mid] == element) { return mid; } if (arrA[mid] >= arrA[low]) { if (arrA[mid] > element && arrA[low] <= element) { //means first half is in ...
71c5f8ee-afea-49a5-9ccc-58f62b98a9fd
6
protected boolean compressSchedule(double refTime, boolean execute) { if(jobOrder != null) { Collections.sort(waitingJobs, jobOrder); } Iterator<SSGridlet> iterQueue = waitingJobs.iterator(); while(iterQueue.hasNext()) { SSGridlet queuedSgl = iterQueue.next(); ...
ee913a7b-3893-4fc2-9c23-504a204a1d7e
5
void findContent() { if ( data == null ) { StringBuilder sb = new StringBuilder(); int iNode = startIndex; Pair p = mvd.pairs.get( iNode ); int i = startOffset; int totalLen = 0; while ( p.length()==0 || totalLen<this.length ) ...
bfd90a89-3fb1-456c-8d96-544039c2012d
4
public type_Type(JCas jcas, Type casType) { super(jcas, casType); casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator()); casFeat_GeneDoc = jcas.getRequiredFeatureDE(casType, "GeneDoc", "uima.cas.String", featOkTst); casFeatCode_GeneDoc = (null == casFeat_GeneDoc)...
2442d3f9-a14a-4466-a1c2-d5c80238b05d
8
private boolean parseLeave(String in, String[] split) { String names[] = in.toString().split("!"); String name = names[0].substring(1); String host = names[1].split(" ")[0]; String channel = split[2]; serv.getServerPanel().getChannelPane(channel).getUserlist().getList().remove...
0e9beceb-f25f-4d2f-8312-ec56556eccb9
1
private String formatOL(String content) { String buf = ""; int idx = 0; int aStart = 0; int aEnd = -5; while (content.indexOf("<ol>", idx) != -1) { aStart = content.indexOf("<ol>", idx); buf += content.substring(aEnd+5, aStart); aEnd = content.indexOf("</ol>", aStart); buf += "\n"+formatL...
dd6ce2bb-0532-4f41-b6d4-1e31bb0b3b50
5
public void UpdateYahooDB() { //TODO: loop through all stocks, Query from finviz database MongoDB findb = null; try { findb = new MongoDB(); } catch (UnknownHostException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Tem...
169b5f55-1aed-48cc-b144-6d9b3a1ccb5d
8
public void testReplace() throws TimeoutException, MemcachedException { String readObject = null; String key = null; String value = null; //1 value = "ABCD"; key = "testrep1"; c.set(key, 3600, "World"); boolean flag = c.replace(key, 3600, value); assertTrue(flag); readObject = (String) c....
fd791db1-6aee-4ed0-b6c9-ce2f26165568
8
public Matrix solve (Matrix B) { if (B.getRowDimension() != n) { throw new IllegalArgumentException("Matrix row dimensions must agree."); } if (!isspd) { throw new RuntimeException("Matrix is not symmetric positive definite."); } // Copy right hand side. double[][]...
7b296718-a60f-4b9c-a105-1557455b348e
9
@Cmd(permissions = "simpleslots.add", senderType = SenderType.PLAYER) public static void add(final CommandEvent e) { if(e.getNumberArgs() != 2) { e.getSender().sendMessage(ChatColor.RED + "Error: " + ChatColor.DARK_RED + "invalid arguments. Usage: ss add <name> <type>"); return; } final String na...
9acafa92-a284-4d50-b3ac-52e53fb797d4
8
private int evaluateShire(Shire s) { int result = 0; switch(skType) { case POPULOUSSHIRES: return s.getPopsize(); case WEALTHYSHIRES: return (int) Math.min(s.getNetAssetValue(explorer, false), Long.MAX_VALUE); case LEARNEDSHIRES: return s.getLibrary().getAmountOfKnowledge(); case FRIENDLYSHIRES: ...
fd2ba223-5c90-488e-a7b5-b9ec0c17368b
5
public static ArrayList<Commands> getCommandList(String filePath){ ArrayList<Commands> commands = new ArrayList<>(); String path; String command; BufferedReader b; try{ b = new BufferedReader(new java.io.FileReader(new File(filePath))); try { ...
0d9d2032-7344-4431-b4a4-8372a7f4939c
5
public void applyEffects(Player player, String scroll) throws PotionEffectInvalidException { // Player does not get potion effects if (player.hasPermission("scrollteleportation.potioneffectbypass")) return; List<String> effects = plugin.getMainConfig().getEffects(scroll); for (String effect: effects) {...
db18082a-a66c-4df1-8348-161d2ce658fe
8
public double computeEntropy(SampleSet set){ double entropy = 0.0; int pos=0,neg=0,total=0; boolean status = true; Iterator<Sample> it; Sample sample =null; //Sort by this attribute. java.util.Collections.sort(set.getSamples(),this); //count number of positive and negative examples for(Sample s : set.getSample...
e8188b8f-4997-44df-bcad-6c2dadded77b
6
@Override public void onMessage(MessageEvent e) { if (!RUtils.isFantasyCommand(e.getMessage())) return; final String command = RUtils.getFantasyCommand(e.getMessage()); if (!command.equalsIgnoreCase("players")) return; Player[] online = plugin.getServer().getOnlinePlayers(); ...
5d851176-b516-49f6-ba90-73f930b6a041
3
public static String format(byte[] data) { StringBuilder result = new StringBuilder(); int n = 0; for(byte b : data) { if(n % 16 == 0) result.append(String.format("%05X: ", n)); result.append(String.format("%02X ", b)); n++; if(n % 16 == 0) result.append("\n"); } resu...
67c9523f-6914-4a5f-9683-786f873936a6
5
public static SQLConnector getSQLConnector(String type) throws FileNotFoundException, IOException, ClassNotFoundException, SQLException { if(ags == null) { ags = AGSettings.getInstance(); } // Vergleichsnamen if(type.equals("name")) { if(nameConnector == null) { String adress = ags.getN...
90fb9660-678f-4d34-8873-eec35a0610a7
6
@EventHandler public void MagmaCubeResistance(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getMagmaCubeConfig().getDouble("Magma...
44efcefd-a4e9-4fb5-98c0-ca9607039928
3
@Override public void ParseIn(Connection Main, Server Environment) { Room Room = Environment.RoomManager.GetRoom(Main.Data.CurrentRoom); if (Room == null || !Room.CheckRights(Main.Data, true) || Room.MoodlightData == null) { return; } int Preset = Main.Deco...
5d278d12-a857-4068-b1b4-c0083c4096eb
7
public static void main(String[] args) throws Exception { Gson gson = new Gson(); FileReader reader = new FileReader("ufo_awesome.json"); Sightings list = gson.fromJson(reader, Sightings.class); Map<String, ArrayList<Sighting>> map = new HashMap<String, ArrayList<Sighting>>(); for (Sighting s : list) { ...
f8a009cb-0ec1-41a8-ae49-46ea44ceafe1
3
public void fillList() { BufferedReader reader; try { reader = new BufferedReader(new FileReader(System.getProperty("resources") + "/database/variables")); String line; while((line = reader.readLine()) != null) { listModel.addElement(line); } listModel.addElement(null); reader.close...
3f297e60-4dd9-4d7c-8870-51ac9d711d13
8
private void sendCommand(CommandInfo info) throws CommandException { CommandHandler ch = queue.getMethod().getAnnotation(CommandHandler.class); boolean playerOnly = ch.playerOnly(); if (info.getArgsLength() < info.getCommandHandler().min()) { info.getSender().sendMessage("Too ...
877156ba-a98f-40c5-a73d-cf69cc3b2fdb
8
private int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long active1) { if (((active0 &= old0) | (active1 &= old1)) == 0L) return jjStartNfa_0(4, old0, old1, 0L); try { curChar = input_stream.readChar(); } catch (IOException e) { jjStopStringLiteralDfa_0...
3793245b-8e6d-4464-88fa-bb1400f899d1
4
private boolean onBoard(int x, int y){ if((x<WIDTH&&y<HEIGHT)){ if(0<=x&&0<=y){ return true; } return false; }else{ return false; } }
6a54eeee-9240-4e6e-a8f3-edf0ce21ebd5
1
public String addStudentToClass() throws Exception { InputStreamReader in = new InputStreamReader(System.in); BufferedReader keyboard = new BufferedReader(in); DBConnector db = new DBConnector(); System.out.println("Adding a Student to a course."); System.out.print("Stude...
5b88e266-d9cf-4f05-b5bf-99f24200d291
4
public void test_01() { Random random = new Random(20120907); for (int len = 1; len < 1000; len++) { for (int i = 0; i < 10; i++) { String seq = GprSeq.randSequence(random, len); DnaSequenceByte dna = new DnaSequenceByte(seq); if (verbose) System.out.println("Len: " + len + "\t" + seq + "\t" + dna);...
97c1315b-34f4-4e97-abcf-dc7819b23cb9
9
public boolean updateFrequencies(int[] frequencies) throws BitStreamException { if ((frequencies == null) || (frequencies.length != 256)) return false; int count = 0; for (int i=0; i<256; i++) { this.sizes[i] = 0; this.codes[i] = 0; if (...
47a1450f-5f79-4e23-9071-4e694e9a1575
8
public static Object [] loadNagiosData(Gui gui, int windowWidth, Graphics g) throws Exception { String exception = null; JavNag javNag = new JavNag(); javNag.setUserAgent(version); javNag.setSocketTimeout(config.getSleepTime() * 1000); long startLoadTs = System.currentTimeMillis(); int prevNHosts = -1; ...
77b159b9-0cc6-4c1f-9258-614452ceb27c
6
public void displayTheStack() { for(int n = 0; n < 61; n++) System.out.print("-"); System.out.println(); for(int n = 0; n < stackSize; n++) { System.out.format("| %2s "+ " ", n); } System.out.println("|"); for(int n = 0; n < 61...
189586f2-2c83-462b-92d2-0b19442e3ed9
3
public PERangeList selectPEs(int reqPE){ if(getNumPE() < reqPE) { return null; } mergePERanges(); PERangeList selected = new PERangeList(); for(PERange range : ranges) { if(range.getNumPE() >= reqPE){ int begin = range.getBegin(); int end = begin + reqPE - ...
d0c50782-e080-4e3c-85cc-e25c4897ba10
0
@Override public void onMouseClick(int x, int y, int button) { System.out.println("mouse: " + button + " - " + x + ", " + y); }
8be69bdc-c0f1-47c7-a6a1-ad301bc5623f
4
public void moveTo(float worldX, float worldY) { if (worldX > maxOffsetX || worldX < minOffsetX || worldY > maxOffsetY || worldY < minOffsetY) { throw new IllegalArgumentException("Unable to move a viewport outside its allowable range"); } this.worldX = worldX; this.worldY = ...
77fd9ceb-6719-4f10-9d22-71725cef7182
3
public void removeChilds(final HTML...childsToRemove) { if ( childsToRemove == null ) return; for (final HTML child : childsToRemove) if ( this.hasChild(child) ) this.childs.remove(child); }
aa9a15ce-d76e-44fc-81c0-12ab4903fe19
8
@Override protected void parseInternal(Method method, Map<String, Integer> paramIndexes, Map<String, Integer> batchParamIndexes) throws DaoGenerateException { super.parseInternal(method, paramIndexes, batchParamIndexes); Annotation[][] annotations = method.getParameterAnnotations(); Class<?>[] paramTypes = m...
1bde60c3-679f-44c7-824c-04a6505df243
0
public Invoker(Command command) { this.command = command; }
86a93703-2de0-4dce-b907-48c23e390c41
9
public static boolean executeUpdate(String sql, CommandArgument[] args, CommandArgument[] selectArgs) { PreparedStatement stat = null; try { stat = connection.prepareStatement(sql); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { int i=0; for (; i < s...
5990de0b-fefc-4a3c-97c8-c206d279f7ea
6
private void test(String testPath){ Scanner scanner = null; try { scanner = new Scanner(new File(testPath)); } catch (FileNotFoundException e) { e.printStackTrace(); } while (scanner.hasNext()){ total += 1; String path = scanner.ne...
90e2e06c-7086-4e79-94db-472cbaeef2cc
5
public void grille(){ ImageIcon requin = new ImageIcon(Toolkit.getDefaultToolkit().getImage("img\\requin019.gif")); ImageIcon poisson = new ImageIcon(Toolkit.getDefaultToolkit().getImage("img\\poisson.jpg")); for(int y = 0; y<env.taille_envi;y++){ for(int x = 0; x<env.taille_envi;x++){ agent[x][y].setBa...
181b602f-9b08-4f80-abfb-2c30ed79d282
4
public int parseExpression() throws IOException { Element localRoot = IRT.createElement(String.valueOf(Tags.OPERATION)); curRootElement.appendChild(localRoot); curRootElement = localRoot; int result = parseTerm(); while (curToken.type == PLUS || curToken.type == ...
9f17b7cd-4a0b-4440-939a-b902123c37cf
3
public boolean equals(Object obj) { if (obj == null || getClass() != obj.getClass()) { return false; } if ((this.getISBN() == ((BookCopy) obj).getISBN())) { return true; } return false; }
b3887aab-7526-4de1-9f48-b7873114bc1e
7
public static OOXMLElement parseOOXML( XmlPullParser xpp, Stack<String> lastTag ) { HashMap<String, String> attrs = new HashMap<>(); String ns = null; try { int eventType = xpp.getEventType(); while( eventType != XmlPullParser.END_DOCUMENT ) { if( eventType == XmlPullParser.START_TAG ) { ...
2f4786d7-8c80-4d9f-a6a2-131b34fcc987
3
private void openLocalDbConnection() throws DataAccessException { try { // Each time you perform a new query you must re-open the connection db.openConnection(DRIVER, URL, ADMIN, PASSWORD); } catch (IllegalArgumentException ex) { throw new DataAccessException(ex.getMe...
e6b0d764-5741-4585-b2f1-1e041ffe1088
8
private static void setupAndDraw(DocumentInfo docInfo, OutlinerDocument doc, int openOrImportResult) { JoeTree tree = doc.tree; String filename = PropertyContainerUtil.getPropertyAsString(docInfo, DocumentInfo.KEY_PATH); tree.clearSelection(); tree.getVisibleNodes().clear(); // Insert nodes into the Vis...
7818897a-e2f2-4bc2-9852-c29342773a09
2
static double det(double[][] A){ double det = 0; if(A.length == 1){ det = A[0][0]; }else{ for(int i = 0; i < A.length; i++){ det += Math.pow(-1,i)*det(minor(A,i,0))*A[i][0]; } } return det; }
2d3bde7c-e044-4f98-91a2-923db6d19697
6
@Override public void serialEvent(SerialPortEvent events) { if(events.isRXCHAR()) { if(!portOpened) return; try { int len = events.getEventValue(); byte [] buffer = serialPort.readBytes(len); if( len>0 ) { String line2 = new String(buffer,0,len); Log(line2); ...
ade4ba7c-c08f-4175-b582-0a6dd0e170c5
2
private void setupNonePieces() { for (int i = 0; i < NUMBER_OF_COLS; i++) { for (int j = 0; j < NUMBER_OF_ROWS; j++) { pieces[i][j] = new NonePiece(); } } }
74fc8daa-49bb-4f75-8d18-2aaa1fe04d3f
6
public void addToTree(AdressBookEntry dataToAdd) { // newNode is used to create a node containing the relevant data newNode = new Node(dataToAdd); // This check checks that there exists a root node // If none exists, one is created. if(treeSize < 1) { rootNode = newNode; rootNode.setParent(null); ...
6ecf3d62-4321-4609-b2c3-bbd5f05502fc
9
public void setSelectionCells(Object[] cells) { if (cells != null) { if (selectionMode == GraphSelectionModel.SINGLE_GRAPH_SELECTION && cells.length > 0) cells = new Object[] { cells[cells.length - 1] }; cellStates.clear(); Vector change = new Vector(); Set newSelection = new LinkedHashSet(); ...
0e7cd53e-b1d8-41a4-b3e8-33cbf517337b
5
@Override public Set<Noppa> sopivatNopat(Set<Noppa> nopat) { Set<Noppa> kelpoisatnopat = new HashSet<Noppa>(poistaKelpaamattomatSetista(nopat)); Map<Noppa, Integer> nopatlistalla = super.laskeNopittain(kelpoisatnopat); //poistetaan paria varten pienempi silmaluku nopatlista...
da64425b-132c-4e4f-a1cc-7a8177645afd
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...
ea756bd1-5c94-4b1e-8ea8-d35bf19c1d03
6
public void showSmithInterface(int itemId) { if (itemId == 2349) makeBronzeInterface(c); else if (itemId == 2351) makeIronInterface(c); else if (itemId == 2353) makeSteelInterface(c); else if (itemId == 2359) makeMithInterface(c); else if (itemId == 2361) makeAddyInterface(c); else if (itemId...
81eb5dbd-6bf4-4ccd-95e4-c66fa9038b57
8
public GamePosition checkSeries(GameBoardMark playerMark, int depth) { int[] auxilliaryBoard = new int[GameBoard.TOTAL_SQUARES_PER_BOARD]; GamePosition winningPosition; if (depth == GameBoard.MAX_DEPTH_FOR_TEMP_BOARD) return GamePosition.nonePosition(); setc4c(playerMark); for ...
b31a1885-23df-4b82-ba11-0cb6092e19b1
8
public static ArrayList<String> readInListFromSeveralFiles(String directory, String splitter, int numberOfLines) { ArrayList<String> list = new ArrayList<String>(); int file_counter = 0; try { while(true){ String file = directory+"_"+file_counter; file_counter++; File f = new File(file); if(f....
a5c7f475-f6c1-4004-b336-7ac6be9709c3
4
private static int lca(int a, int b) { boolean[] used = new boolean[n]; for (;;) { a = base[a]; used[a] = true; if (mt[a] == -1) break; a = p[mt[a]]; } // from b node for (;;) { b = base[b]; if (used[b]) return b; b = p[mt[b]]; } }
8a99770c-5c47-4fdc-8e6c-a9327b100cfc
6
public void greet(String server) { if (heloResponse != null || ehloResponse != null) return; int code = ehlo(server).code; if (code >= 200 && code < 300) return; Response response = helo(server); if (response.code < 200 || response.code > 299) ...
9063c5d0-c9d4-49c5-b2dc-cf2f057f9398
8
public final void quant(final float[] lsp, final float[] qlsp, final int order, final Bits bits) { int i; float tmp1, tmp2; int id; float[] quant_weight = new float[MAX_LSP_SIZE]; for (i = 0; i < order; i++) qlsp[...
3d80c77c-8c02-42e2-bf3a-39727aade409
0
public void rotCW() { forme.rotCW(); }
ad1ac34c-b39e-469a-b1ff-a8a077662ffe
7
public static String helpCppChangeCase(GeneralizedSymbol symbol, Keyword caseconvention) { { Module module = ((Module)(symbol.homeContext)); String name = symbol.symbolName; boolean allUpperP = Stella.allUpperCaseStringP(name); Keyword capsBreakKeyword = (allUpperP ? Stella.KWD_CLEVER : Stella.KWD...
f77f2885-99c0-4ecc-94da-b279c58c07bc
6
public void newBlocks() { int x3; int x4; int y3; int y4; int z3; int z4; Vector vMax = Vector.getMaximum(v1, v2); Vector vMin = Vector.getMinimum(v1, v2); x3 = vMin.getBlockX(); x4 = vMax.getBlockX(); y3 = vMin.getBlockY(); y4 = vMax.getBlockY(); z3 = vMin.getBlockZ(); z4 = vMax...
bf274874-a7ba-4700-bb1e-3f1b1ee4fe71
7
@Override public List<Tour> findTours(Criteria criteria) throws DaoException { Short status = (Short) criteria.getParam(DAO_TOUR_STATUS); Boolean allStatus = (Boolean) criteria.getParam(DAO_TOUR_ALLSTATUS); if (allStatus != null && allStatus) { criteria.remuveParam(DAO_TOUR_STATU...
eb640b9e-0c12-4a54-b6a1-797e56206648
8
private static String escapeHtmlChars(String s) { for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); switch (ch) { // only start building a new string if we need to case '<': case '>': case '&': StringBuilder sb = new StringB...
936ad56c-26ef-461c-a5b1-ceb6ec7d7a05
3
private ASPlayer setLastOnline(ASPlayer data, TableType table, int value) { switch(table) { case DAY: data.lastDay.online = value; break; case WEEK: data.lastWeek.online = value; break; case MONTH: data.lastMonth.online = value; break; default: plugin.severe("Invalid Type in setLastOnline"); } re...
ef69f48c-8247-4e13-b6a4-0de895798ccc
2
public double getMahdSuojakilvenHalkaisija(){ double maxPituus = Double.NEGATIVE_INFINITY; for (Raaja raaja : raajat){ if (raaja.getPituus() > maxPituus){ maxPituus = raaja.getPituus(); } } return maxPituus*2; }
ab4b8603-6217-4101-b013-48d4fc75157e
8
@Override public void init( Graphics2D g ) throws MojoExecutionException { switch ( alignment ) { case HORIZONTAL: { for ( Drawable d : getDraw() ) { d.setDrawingContext( dwContext ); Graphic...
0f6edcc4-6bbd-4db0-afac-dae348507e2e
9
private boolean isGoodTitle(String title) { if(title.length() > 0 && title.charAt(0) >= 'a' && title.charAt(0) <= 'z') { return false; } String tmp = title.toLowerCase(); if(titleFilter.contains(tmp) || endFilter.contains(tmp)) { return false; } for(String filter : titleFilter) { if(tmp.startsWith(...
b1b78f75-477a-46c5-8177-05a6f5b62b3a
2
public static void main(String []args){ Comparable []c={4,9,23,1,45,27,5,2}; System.out.println("待排序数组"); for(int i=0;i<c.length;i++) System.out.print(c[i]+" "); insertionSort(c); System.out.println("\n排序结果"); for(int i=0;i<c.length;i++) ...
aeee9df5-cc7c-49ad-b83c-bb4590b1cc72
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final Cheesery other = (Cheesery) obj; if (cheese == null) { if (other.cheese != null) return false; } else if (!cheese.equals(ot...
772b3faf-60f3-400c-83a5-24c420d4f90e
9
private String constructQualificationQuery(String table, String regExp, String[][] tags, String[][] attributes, String[] columns, String[][] values, String[] doubleColumns, Double[][] doubleValues, double[][] range) throws MobbedException { String qry = ""; String closer = ""; String[] keys = keyMap.get(...
13e78031-7f17-40f0-baf3-853b5a4a1ab9
8
final private void jj_rescan_token() { jj_rescan = true; for (int i = 0; i < 4; i++) { try { JJCalls p = jj_2_rtns[i]; do { if (p.gen > jj_gen) { jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; switch (i) { case 0: jj_3_1(); break; case 1: jj...
e005d4ba-fd2b-4026-9a32-fc8945bd50f7
9
public String convert(String s, int nRows) { if(null == s || s.length() == 0 || nRows <=0) return ""; if(nRows == 1) return s; int length = s.length(); StringBuilder builder = new StringBuilder(); int size = 2 * nRows - 2; for(int i=0; i<nRows; ...
49f8253f-6bc6-4bd6-ae0e-fcb2435241a7
9
public static void daxpy_j (int n, double da, double dx[], int incx, double dy[], int incy) { int i,ix,iy,m; if (n <= 0) return; if (da == 0.0) return; if ((incx == 1) && (incy == 1)) { // both increments equal to 1 m = n%4; for (i = 0; i < m; i++)...
4cd4b05a-16fe-4644-bc4e-5fe62a97d68d
4
private int pickFree(byte[] schedule) { int[] freeSlots = new int[numSlots]; int numFrees = 0; for(int i = 0; i < numSlots; i++) { if(extractSlot(schedule, i) == 0 && !desiredSlots[i]) { freeSlots[numFrees] = i; numFrees++; } } if(numFrees == 0) { return -1; } else { int i = random.nextI...
ebb478e5-30b6-47dd-b0cf-cebd475877a1
1
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; String URI = req.getRequestURI(); chain.doFilter(request, response); //Cookie cookie = new Cookies(req.getCookies()).getUs...
a51f863f-cda3-416f-8863-7a44f831828b
9
public void mouseClicked(MouseEvent e) { switch(steps){ case 1: nextPosition = tface.getPosition(5,5); tRover.moveToPosition(nextPosition); steps++; break; case 2: nextPosition = tface.getPosition(5,4); tRover.moveToPosition(nextPosition); steps++; break; case 3: nextPosition = tfac...
b54acde9-4c19-4ce8-8f9d-0d3e65678ec1
9
@Override public String toString() { StringBuilder buf = new StringBuilder(); buf.append("%%MatrixMarket matrix "); if (isSparse()) buf.append("coordinate "); else buf.append("array "); if (isReal()) buf.append("real "); else if ...
727a3871-cf05-4cc7-a66a-8a150bcb1fda
1
private static boolean intersect (Circle c1, Circle c2){ double x=Math.pow((c1.center_x - c2.center_x),2); double y=Math.pow((c1.center_y - c2.center_y),2); double res=Math.sqrt(x+y); return (res<(c1.radius+c2.radius) || res<Math.abs(c1.radius-c2.radius)); }
8eafad5a-e786-4ddb-8a14-e2035ed32826
7
void sort(Tria[] tr, int[] colorCode, float[] zTr, int l, int r) { int i = l, j = r, wInt; float x = zTr[(i + j)/2], w; Tria wTria; do { while (zTr[i] < x) i++; while (zTr[j] > x) j--; if (i < j) { w = zTr[i]; zTr[i] = zTr[j]; zTr[j] = w; wTria = tr[i]; tr[i] = tr[j]; tr[j] = ...
6bef2426-fea0-43bb-a40e-b289257df5c4
0
public Object[] getArguments() { return arguments.toArray(); }
2349aa13-8726-4192-b34a-f7330ffc2e16
0
private int mapValue(float input, float inMin, float inMax, float outMin, float outMax) { return (int)((input - inMin) * (outMax - outMin) / (inMax - inMin) + outMin); }
854f48f4-fc74-4f62-9fdc-2c1a0bdfb84e
3
@Override public Account createNewChild(TreeMap<String, String> properties) { String name = properties.get(NAME); Account account = new Account(name); String typeName = properties.get(Account.TYPE); if(typeName!=null){ account.setType(accountTypes.getBusinessObject(typeNa...
2364741e-1dd7-4dfc-890a-447aa74870d2
0
public void testCsvTools2() { String filePath = "C:\\Users\\tdhuang\\Desktop\\功夫baby数据表格1(未加数值)\\战斗关卡地图\\rich_map.csv"; CsvFile csvFile = new CsvFile(filePath, 0, 4, 1); List<CsvDataLine> data = CsvTools.parse(csvFile); System.out.println(data); assertNotNull(data); }
c282c12c-931b-41fb-a500-0efc2ad2520a
6
public void playAnimalSound(Entity e, Player p){ String type = e.getType().toString(); Location loc = p.getLocation(); if(type.equalsIgnoreCase("Cow")){ Bukkit.getWorld("world").playSound(loc, Sound.COW_IDLE, 1, 1); Bukkit.getWorld("world").playEffect(e.getLocation(), Effect.MOBSPAWNER_FLAMES, 5, 5); }els...
49a0e329-ccd0-48fb-aa5e-4794793ae583
1
public VersionInfo() { JdomParser parser = new JdomParser(); InputStream installProfile; installProfile = getClass().getResourceAsStream("/install_profile.json"); try { versionData = parser.parse(new InputStreamReader(installProfile, Charsets.UTF_8)); } catch (Excepti...
84d9e290-64d4-4ee9-8208-0ed624d33b58
1
public double bonusDefense(Territoire t, Peuple attaquant) { if( t.has(MachineACafe.class) ) return 2.0; return 0.0; }