method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
6f706167-5671-4f70-8112-d9f2ac43ce25
2
public ArrayList<Membre> rechercherMembresNom(String nom){ ArrayList<Membre> retour = new ArrayList<Membre>(); for(Membre m : listeMembres){ if(m.getNom().toLowerCase().indexOf(nom.toLowerCase().trim())!=-1) retour.add(m); } return retour; }
4789dbd8-403f-4b7c-954c-84c93ae79501
9
public static void main(String[] args) { Options options = new Options(); options.addOption(COMMUNITY_NAME_OPTION, true, "Name for the community"); options.addOption(USER_FILE_OPTION, true, "users file (StackExchange XML dump format)"); options.addOption(POST_FILE_OPTION, true, "posts file (StackExchan...
50a5f1d3-ff6c-4edc-8705-7914ad6c6cb7
0
public MusicTypes getMusicType() { return musicType; }
22af800d-9047-43fb-8bf1-037f16a602ae
9
public void actionPerformed(ActionEvent e) { Object o = e.getSource(); // if it is the Logout button if(o == logout) { client.sendMessage(new ChatMessage(ChatMessage.LOGOUT, "")); return; } // if it the who is in button if(o == whoIsIn) { client.sendMessage(new ChatMessage(ChatMessage.WHOISIN, ""))...
413f5228-4556-435d-ad07-c3cdebf14bb9
5
public static boolean LoadNatives() { String OS = System.getProperty("os.name").toLowerCase(); String os_res = ""; if (isWindows(OS)) { os_res = "windows"; } else if (isMac(OS)) { os_res = "macosx"; } else if (isUnix(OS)) { os_res = "linux"; } else if (isSolaris(OS)) { os_res = "solaris"; }...
4270a511-0b22-4ff4-b58d-e8db21b7f828
9
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed int row = -1; int opc = -1; if (row == -1) { row = jTable1.getSelectedRow(); opc = 1; } if (row == -1) { row = jTable18.getSelectedRow(); opc = 2; } if (row == -1) { row = jTable...
faec8eac-1619-4ad9-83a4-f59ce619c72a
8
private static Difference[] parseUnifiedDiff(Reader in) throws IOException { BufferedReader br = new BufferedReader(in); List<Difference> diffs = new ArrayList<Difference>(); String line = null; do { while (line == null || !(line.startsWith(UNIFIED_MARK) && ...
ce20d431-def7-40a5-a329-f9767cab294b
1
private void enlarge(final int size) { int length1 = 2 * data.length; int length2 = length + size; byte[] newData = new byte[length1 > length2 ? length1 : length2]; System.arraycopy(data, 0, newData, 0, length); data = newData; }
886658d0-e202-421d-be48-a07b7fd185ad
7
@Override public void keyPressed(KeyEvent e) { switch (e.getKeyCode()) { case KeyEvent.VK_UP: getAisha().moveUp(); getAisha().setMovingUp(true); break; case KeyEvent.VK_DOWN: getAisha().moveDown(); getAisha().setMovingDown(true); break; case KeyEvent.VK_LEFT: getAisha().moveLeft(); g...
6e2b1b5f-f998-4b26-8425-65eb34d827b8
5
public synchronized void transportConnected() { setState(STATE_READY); if (reconnectTask != null) { reconnectTask.cancel(); reconnectTask = null; } resetTimeout(); if (transport.canSendBulk()) { ConcurrentLinkedQueue<String> outputBuffer = this.outputBuffer; this.outputBuffer = new ConcurrentLinke...
6e9e8749-fa68-4020-8371-40fb868cf222
3
public void run() { String modulePath = Main.CLASS_PATH; ImportingModuleLoader loader = new ImportingModuleLoader(modulePath, ClassLoader.getSystemClassLoader()); try { // String moduleName = module.split(".class")[0]; String moduleName = alg...
cd404beb-d37c-420b-9dde-c37358f983ca
9
public static String inferOdmlType(Object value) { if (value instanceof Integer) { return "int"; } else if (value instanceof Boolean) { return "boolean"; } else if (value instanceof Date) { return "datetime"; } else if (value instanceof Float) { return "float"...
b23f82a6-4542-4421-a292-71d998a71044
6
public void setRadioButtonSelected(char situation){ switch(situation){ case 'A': buttonA.setSelected(true); break; case 'B': buttonB.setSelected(true); break; case 'C': buttonC.setSelected(true); break; case 'D': buttonD.setSelected(true); break; case 'E': buttonE.setSelected(true); break; ca...
c28f600e-03c4-4d0e-b207-18cfc1f80023
1
@RequestMapping(value = "/myTravels", method = RequestMethod.GET) public String displaySortedTravelTrips(Model model) { if(firstTime){ createDummyTravelTrips(); firstTime = false; } model.addAttribute("travelTripList", travelTripService.findAll()); return "ind...
163a0486-64e4-453d-8e81-ff605f4cb112
8
private static String writeNode(Properties objectProperties, int depth){ StringBuilder builder = new StringBuilder(); for(Map.Entry<Object, Object> entry : objectProperties.entrySet()){ Object key = entry.getKey(); Object value = entry.getValue(); if(value instanceof ...
76fa77cd-a35f-417e-b672-ae44ff23cadf
9
@Transactional public int insert(Object o) throws DataAccessException { StringBuilder qry = new StringBuilder(); StringBuilder strFieldColumn = new StringBuilder(); StringBuilder strValueColumn = new StringBuilder(); List<Object> val = new ArrayList<Object>(); qry.append("insert into "); Class<?> c = o.ge...
e6a891eb-9779-44df-b903-b8a6319ea04c
5
public void processProjectileUpdate(UpdateProjectile up) { if (up.action.equals("Create")) { Player p = registry.getPlayerManager().getPlayerById(up.playerId); Projectile projectile = new Projectile(up.id, this, registry, p, up.image, up.speed, up.start, up.end, up.friendly, up.placeable...
6f516527-bf30-4e79-b870-5f68b931cc20
3
public Line[] readFile(File file) { ArrayList<Line> lines = new ArrayList<Line>(); try { if(!file.exists()) file.createNewFile(); BufferedReader in = new BufferedReader(new FileReader(file)); String line; while ((line = in.readLine()) != null) { lines.add(new Line(line)); } } catch (Excepti...
e8926638-10ac-4a91-beaf-d1c14c860b68
9
@Override public void execute() { final int BANKER_ID = 2759; NPC banker = NPCs.getNearest(BANKER_ID); if (banker != null) { if (!banker.isOnScreen()) { Camera.turnTo(banker); } else { if (Bank.open()) { // Here we ...
bf1dfe16-82ad-4d88-b26f-b572278eca8e
0
@Override public void startSetup(Attributes atts) { super.startSetup(atts); TEXT = atts.getValue(A_TEXT); setEnabled(false); addActionListener(this); Outliner.documents.addUndoQueueListener(this); Outliner.documents.addDocumentRepositoryListener(this); }
2516ca53-4ed0-43fa-9888-38ec12cf05f0
9
public void update(int xPos, int yPos, int width, int height) { int xLeft = xPos / size; int yLeft = yPos / size; int xRight = (xPos + width) / size; int yRight = (yPos + height) / size; int x = (xPos + width / 2) / size; int y = (yPos + height / 2) / size; if (x < getMaxX() && y < getMaxY()) map[x][y]...
d96d4189-8af4-4905-9a05-41c4dcd49f2c
2
private void saveRule() { if (isAdding) { Rule r = new Rule(this.edName.getText(), this.edUrl.getText(), this.edRegExpr.getText(), true); RulesManager.getInstance().getRulesList().add(r); } else { // Edit an existing rule Rule r = RulesManager.getInstance...
6a11d6ec-75b1-49a5-beab-a40841fc1a16
2
public final INameable getNamedObject(String name) { int logicalChildrenCount = getAllLogicalChildren().size(); int namedChildrenCount = 0; for (ILogical logicalObject : getAllLogicalChildren()) { if (logicalObject instanceof INameable) { namedChildrenCount++; } } logger.info(logicalChildrenCount, "...
025f7464-b225-4b79-90e5-c7e3cda09e65
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Coordinates other = (Coordinates) obj; if (x != other.x) return false; if (y != other.y) return false; return true; }
c7916270-a6d7-4503-b14c-94a41f86104a
2
public static void main(String[] args) { print("How many points are in your plot?: "); int pointCount = scan.nextInt(); double[][] pointMatrix = new double[pointCount][2]; print("\nEnter your points. Separate x and y with a space, press the enter key after each point:\n"); input(pointMatrix); pr...
79072f99-16ec-4f47-8b87-c629854b793a
3
void dnaCoderCopyBases(int seqLenSrc, int seqLenDst, Random rand) { String srcStr = randSeq(seqLenSrc, rand); String dstStr = randSeq(seqLenDst, rand); // Create sequence DnaSequence src = new DnaSequence(srcStr); DnaSequence dst = null; dst = new DnaSequence(dstStr); long signature = src.getCodes()[0];...
fe2903eb-a429-491d-b4d1-65e96882aed0
3
public boolean containsValue (int value) { K[] keyTable = this.keyTable; int[] valueTable = this.valueTable; for (int i = capacity + stashSize; i-- > 0;) if (keyTable[i] != null && valueTable[i] == value) return true; return false; }
28534e99-84f8-47b6-8488-0fc345a4dfe9
8
public void mousePressed(MouseEvent e) { int mx = e.getX(); int my = e.getY(); p = new Point(mx, my); if(b.getGameStatus() == STATE.MENU){ //Play if (m.getPlayButton().contains(p) && b.getGameStatus() == STATE.MENU){ b.setState(STATE.GAME); b.restart(); } // Quit if (m.getQuitButton(...
92c0a367-a24a-4184-846e-752916cdc373
8
public void actionPerformed(ActionEvent e) { Object src = e.getSource(); Calendar c = new GregorianCalendar(); c.setTime(parent.getCalendar().getTime()); if (src instanceof JButton) { if (e.getSource() == premon) { c.add(Calendar.MONTH,...
6d7979a5-e89b-4e95-9abc-94f8287d236e
6
public void calculateFeromon(LinkedList<Ant> ant){ for(Ant a: ant){ for (int i = 0; i < 16; i++){ for(int j = 0; j < 30 ; j++){ if(a.getPermutation().checkPer(j, i)){ cPI_.getPointsInformation(i, j).setFeromon(cPI_.getPointsInformation(i, j).getFeromon() + (1.0/(double)matrix_.getValue(i, j))); ...
5418a8c4-5f79-41fc-ad58-8c106520f26c
6
@Override public void actionPerformed(ActionEvent e) { boolean selection = false; DocUtils.buttonDoClick(e); wordProcessor.area1.requestFocus(); String text = wordProcessor.area1.getSelectedText(); int start = 0, length = 0; if (text != null) { selection = true; start = wordProcessor.area1.get...
f57891da-2536-42aa-ba89-f15d57fc9e0b
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 fe...
df2a0f9f-159d-4bcc-b646-725f427ba699
4
public void animateToHeight(final int height){ final int startFrameHeight = frame.getHeight(); for( ActionListener aL : animationTimer.getActionListeners()){ animationTimer.removeActionListener(aL); } animationTimer.addActionListener(new ActionListener(){ public void actionPerformed(ActionE...
098eae4d-fe84-44b9-88cb-cee88898dfef
2
public long inserir(InstituicaoSubmissao instituicaosubmissao) throws Exception { String sql = "INSERT INTO instituicaosubmissao(nome) VALUES(?)"; long idGerado = 0; try { PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); stmt.setString(...
aee9a32e-735a-474e-8c18-a4f166321da2
7
public void detectPulse(Record record) { double value = record.getValue(); if (value > THRESHOLD) { if (this.isInPeak) { // set buffer values to 100 and clear for (Record bufferedRecord : this.buffer) { bufferedRecord.setValue(100); ...
c92f47d4-0a46-4aec-b28e-48fc65b030dc
5
public RaisedObject getObject(int x, int y) { if (x < 0 || y < 0 || x >= width || y >= height) { return RaisedObject.voidObject; } int spot = objects[x + y * width]; RaisedObject r = RaisedObject.getRaisedObjectFromNumber(spot); if (r != null) { return...
8febe649-665a-4f86-8d6d-938deea8576b
3
public static double[] analyzeGlobal(final String directory, final String prefix, final int numVertices) throws IOException { File dir = new File(directory); int[] counts = new int[numVertices]; /* Get files */ String[] files = dir.list(new FilenameFilter() { @Override ...
691a9a9a-6128-4ffc-96b8-d60cfe35807b
2
public void defocus() { Configuration[] configs = configurations.getConfigurations(); for (int i = 0; i < configs.length; i++) { if (configs[i].getFocused()) { configurations.defocus(configs[i]); } } drawer.setAutomaton(simulator.getAutomaton()); drawer.invalidate(); component.repaint(); }
d37b8a19-145a-43a9-aaa9-37ae2f822416
7
public void nextPermutation(int[] num) { int len = num.length; if (len <=1){ return; } int firstAscend = -1; for (int i = len-1;i>0;i--) { if (num[i-1]<num[i]){ firstAscend = i-1; break; } } int s...
1cd428da-44b6-4a3d-a8d2-a4a714478630
9
public Pokedex() { keepGoing = true; scanIn = new Scanner(System.in); dbc = new DatabaseController("veekun-pokedex.sqlite"); while(keepGoing) { userInput = scanIn.nextLine(); userInputArray = userInput.toLowerCase().split(" "); switch(userInputArray[0]) { case "pinfo": try{pokemonInfo(new Pok...
815a982f-ca29-400a-83cf-8bed1cd50470
9
static public void statistic2(){ Statement stmt = null; ResultSet rs = null; for(int hour = 0; hour < 24; hour ++) try { String time = "2011-10-07"; String hourTxt = hour + ""; if(hour < 10){ hourTxt = "0" + hour; } System.out.print(hour + "\t"); String sqlTxt = "select ...
9b41d8de-024b-451b-b8f0-f50cbb13a376
7
public void start(InputStream istream, OutputStream ostream) { BufferedReader reader = new BufferedReader(new InputStreamReader(istream)); PrintWriter writer = new PrintWriter(ostream); String line; System.out.println("Enter \\quit to finish."); try { while ((line = r...
850fa3c0-5e6f-4bd2-aa54-d73ae5fafc55
0
public InvalidFieldException(String message) { super(message); }
abecbf2b-5741-4feb-8d0e-67c2b4fc9d35
7
private void advance() { TKey innerKey, outerKey; int comp; try { while(true) { if (increment[0]) { outerRow = outerIterator.next(); } if (increment[1]) { inne...
a95b4b96-19d6-4c28-9b3a-8d7ccb9f420e
5
@Override public boolean equals(Object o) { if (o == null) { return false; } if (o.getClass() != this.getClass()) { return false; } WordTrie ob = (WordTrie) o; if (ob.getNodeCount() != this.nodeCount || ob.getWordCount() != this.getWordCount())...
31177138-9170-4ac4-81f1-775cabaa072e
7
public static void main(String[] args) { if (log.isDebugEnabled()) log.debug("Method call"); View view = null; try { view = (View) new ViewFactory().newInstance("console"); ServerModel server = new Server(); Controller controller = new Controller(s...
05d5f252-259d-46f0-95c5-f5b90390761e
8
@Override public void endElement(String uri, String localName, String qName) throws SAXException { String topElement = ""; if (elements.size() > 0) { topElement = elements.peek(); } if (localName.equals(topElement)) { elements.pop(); if (localName.equals("s")) { for(String[] secEd...
86ec73cf-e61f-4326-9ad9-bf4ebceb1850
6
public static String asString( final double[] A, int m, int n, int decimals ) { final StringBuilder out = new StringBuilder(); final int size = m * n; final String[] elements = new String[size]; // int max = 0; // for (...
23cd01d6-6a39-4e0a-8dcd-2a45d8860688
0
public Object getElementAt(int i) { return items[i]; }
1dff01d7-e498-41bf-a7eb-62da162c0b52
1
@Override public void free() { MappedByteBuffer mappedByteBuffer = (MappedByteBuffer) threadLocalByteBuffer.getByteBuffer(); mappedByteBuffer.clear(); try { fileChannel.truncate(0); } catch (IOException e) {/**/} }
5eecde70-20d6-4918-9d64-afcc0747a4cc
8
@SuppressWarnings("unchecked") private void loadFeatVecGenerator(File modelDirectory, String modelPrefix) throws JChunkerException { ObjectInputStream fvGeneratorInputStream = null; try { fvGeneratorInputStream = new ObjectInputStream(new FileInputStream(new File(modelDirectory,...
be58e232-2c60-44b4-8eef-c73df50ef663
9
public boolean isValidSudoku(char[][] board) { if (board.length != 9 || board[0].length != 9) return false; this.board = board; boolean tmp; for (int i = 0; i < 9; i ++) { tmp = checkRow(i); if (tmp == false) return fa...
0e419b1f-f3aa-4e03-8802-7a49f5aad1e1
3
@Override public void setFrame(double x, double y, double width, double height) { if (width < 0) { width = 0; } if (height < 0) { height = 0; } if (width != height) { mRadius = Math.min(width, height) / 2; mX = x + mRadius + (width / 2 - mRadius); mY = y + mRadius + (height / 2 - mRadius); }...
08cac511-1e7b-40c6-bde8-51f114204d29
8
public void actionPerformed(ActionEvent e){ if("exit".equals(e.getActionCommand())){ exitMenuItemActionPerformed(e); } if("min30".equals(e.getActionCommand())){ min30ActionPerformed(e); } if("min45".equals(e.getActionCommand())){ min45ActionPer...
fc71267b-93c8-4de6-9f7b-20465de5192a
3
public static boolean isPalindrome(long number) { long figureTarget = number; int figure = 0; while (figureTarget != 0) { figureTarget = figureTarget / 10; figure += 1; } for (int i = 0; i < figure / 2; i++) { if (getNumber(number, i) != getNu...
a48b7941-fd32-48e7-9c29-4715766454de
4
private long getCPtrAddRefTradeDataMarket(TradeDataMarket element) { // Whenever adding a reference to the list, I remove it first (if already there.) // That way we never store more than one reference per actual contained object. // for(int intIndex = 0; intIndex < elementList.size(); intIndex++) { Object theOb...
4241fb4b-45fb-465f-b6e2-45b51d1c2246
4
public void windowStateChanged(WindowEvent e) { if(e.getOldState()==JFrame.MAXIMIZED_BOTH && e.getNewState()==JFrame.NORMAL){ //restore preMaximised Size if(Debug.gui) System.out.println("wsc:PreMaxBounds:"+preMaximiseBounds); frame.setBounds(preMaximiseBounds); } if(Debug.gui) display...
974f4ea4-c008-4dbc-894a-e0968ad70f4d
9
@Override public boolean move(int dx, int dy) { if ((this.x == 0 && dx < 0) || (this.x == this.landlord.getGridPanel().getGrid().length - 1 && dx > 0)) { dx = 0; } if ((this.y == 0 && dy < 0) || (this.y == this.landlord.getGridPanel().getGrid()[0].length - 1 && dy > 0)) { dy = 0; } Cell destina...
05d26d85-412a-45c1-93f1-ae1acb0ae690
2
private void copieCarte(final int[][] carte) { this.carte = new int[carte.length][carte[0].length]; for (int i = 0; i < carte.length; i++) { for (int j = 0; j < carte[0].length; j++) { this.carte[i][j] = carte[i][j]; } } }
e4460710-7d5e-43d4-b9f5-872ff4ac375b
5
public static void main(String[] args) { final int SOMME1MIN = 0; final int SOMME1MAX = 20; final int SOMME2MIN = 21; final int SOMME2MAX = 50; final int SOMME3MIN = 51; final int SOMME3MAX = 100; int iSomme[] = new int[3]; int i; //sommation des entiers en [0, 20] for(i = SOMME1MIN, iSo...
14ab2f6d-354f-470b-b0df-17b62ef365f0
5
@Override public double calculateDistance(double[] target, double[] spiketrain) { double d; final double P = 2.0; List<Integer> targetSpikes = new ArrayList<Integer>(); List<Integer> spiketrainSpikes = new ArrayList<Integer>(); for (int i = 0; i < target.leng...
1b16b843-06cb-43ed-a9cc-901ec3b0df01
2
public boolean checkPassword(String username, byte[] passwordHash) { try { // hash + salt = password storage.selectDb("passwords"); Object obj = storage.readObject(username.toLowerCase()); Password password = (Password) obj; if (password == null) { // User doesn't exist return false; } by...
857d9e3b-af8d-4b77-879c-592c4c689da7
3
public boolean doesCollide(BasicBoundingSphere sphere) { int j = 0; for (int i = 0; i < planes.length; i++) { if (planes[i].doesCollide(sphere)) { _lastPlane = planes[i]; ++j; } } System.out.println(j); // if (j>1) { // System.out.println("Podwojna kolizja"); // } if (j>=1) { // Syste...
0c7325b9-fa73-4259-abfa-162937003656
1
public void storeClass(DataOutputStream out) throws IOException { if (GlobalOptions.verboseLevel > 0) GlobalOptions.err.println("Writing " + this); info.write(out); info = null; fieldIdents = methodIdents = null; }
08e6802e-6791-4b73-ad8e-1740fc610cd1
8
public String getHtml(String address) { Socket smtpSocket = null; OutputStream os = null; InputStream is = null; String host = address; try { // Create socket to host on port 80 smtpSocket = new Socket(host, 80); // Get the channels os = smtpSocket.getOu...
22254afa-c7fe-4c75-9862-c79e97ce33fa
4
public void printQLearning() { for(int i = 0; i < this.States.length; i++) { for(int j = 0; j < this.States[0].length; j++) { if(this.States[i][j].IsWall) { System.out.print("( WALL )"); }else if(this.States[i][j].IsTerminal) { System.out.print("( TERMI )") ; }else{ System....
1b2734b6-c51d-4f05-9e11-992c0237015a
7
public String[] mapTypes(String[] types) { String[] newTypes = null; boolean needMapping = false; for (int i = 0; i < types.length; i++) { String type = types[i]; String newType = map(type); if (newType != null && newTypes == null) { newTypes =...
4059c3c2-dd96-4f8b-9b36-bb4e71f66404
9
public void herbivoreAnimalFeeder() { int eatnum = gen.nextInt(100); herbanimeat++; // Increments the animal eat variable each time the method is called. for (HerbivoreAnimal ha : herbanimalArray) { // For each animal in the array ha.decHunger(); // call that animals decHunger method...
bd6d2d0b-136c-4573-851e-ca909e6855b4
6
public String ecrireMips() { String str = ""; TDS tds = TDS.getInstance(); for(Declaration d : declaration){ if(d instanceof D_Champ){ Symbole s = tds.identifier(new Entree(((D_Champ) d).idf, 0, "entier")); if(s.isGlobal()){ str+=d....
dbf3291c-eb07-469b-ae3d-1e31708ea7da
7
public ArrayList<Auction> searchKeywordByUser(String keyword, String username) { try { ArrayList<Auction> auctions = new ArrayList<Auction>(); String[] keywords = keyword.split(" "); String[] usernames = username.split(" "); String sql = "select * from (select * from " + tableName + " where "; ...
9c5d3527-50d0-47ad-ba5e-deeaf14d8d69
3
public int getNumberLocX(int number) { for (int[] element : map) { for (int x = 0; x < map[0].length; x++) { if (element[x] == number) return x; } } Logger.log("Can't find number " + number + " in map", Logger.ERROR); Game.exit(1); return -1; }
8c84e022-20ed-4a12-a5ef-19d50a56fb62
7
protected Cluster<?> expandCluster(Object r, Cluster<?> c) { LOG.trace("Expanding cluster"); Cluster<Object> newCluster = new Cluster<Object>(); newCluster.addRecord(r); for (Object o : c.getRecords()) { if (!c.isVisited(o)) { c.setVisited(o,true); Cluster<?> cluster = this.rangeQuery(o);...
62ddd801-ab26-4690-a52d-092b01a49c7a
2
public static TableIdentifier getIdentifierFromName(byte[] name) { for (TableIdentifier idd : TableIdentifier.values()) { if (("!" + idd.name()).equals(new String(name))) { return idd; } } return null; }
bb0202cb-a07e-479e-9168-ab090412d6f7
3
public static String stripFilenameExtension(String path) { if (path == null) { return null; } int extIndex = path.lastIndexOf(EXTENSION_SEPARATOR); if (extIndex == -1) { return path; } int folderIndex = path.lastIndexOf(FOLDER_SEPARATOR); if (folderIndex > ext...
25094014-b573-467a-9702-2a27c0ab6383
2
public void removeTailLightTrail(){ if (otherPositions.size() > 2) { Position newHeadPosition = otherPositions.remove(0); setPosition(newHeadPosition); } else if (otherPositions.size() == 0) { setPosition(null); } notifyObservers(); }
03009f16-f161-46a6-bd06-250b6050d87b
3
public void backUpTiles(){ System.out.println("backing up tiles: " + backUpNum); backUpGoDefault(); System.out.println("backing up tiles2: " + backUpNum); int[][][] temp = new int[tileID.length][tileID[0].length][tileID[0][0].length]; for(int k = 0; k < tileID.length; k++){ for(int i = 0; i < tileID[0].len...
b898e2b6-8a79-4a03-87bf-f67ec93c55be
3
public boolean search(T item){ LinkedListNode<T> current; boolean found; current = first; found = false; //search the list while (current != null && !found){ if (current.info.equals(item)) //item is found found = true; else ...
19560326-ac90-4d10-a8b1-7423decb2816
5
public void initializeForView(AutomatonPane view){ myView = view; setLocationManually(myAutoPoint); this.setDisabledTextColor(Color.BLACK); this.setBackground(new Color(255, 255, 150)); this.addMouseMotionListener(new MouseMotionListener(){ public void mouseDragged(MouseEvent e) { if (e.isPopupTr...
22cb4cb6-08ce-49d5-b676-1e8efe5cc3f0
9
private static ImageLayout layoutHelper(Vector sources, ImageLayout il) { ImageLayout layout = (il == null) ? new ImageLayout() : (ImageLayout)il.clone(); int numSources = sources.size(); // dest data type is the maximum of transfertype of source im...
bcc024d0-0016-40d3-a14e-de7559187971
2
private static int longestLength(List<String> lst) { int longest = 0; for (String s : lst) { if (s.length() > longest) { longest = s.length(); } } return longest; }
34f84938-40f3-4ecb-a185-bc735fa4d597
1
private boolean clickedOnDeck(MouseEvent e) { return (findCol(e.getX()) == 0 && e.getY() >= DECK_Y); }
24ea22dd-fb30-466b-b0e7-69ee9990579d
3
public void closeSocket() { try { if (this.ssck != null && ! this.ssck.isClosed()) this.ssck.close(); } catch(Exception exp) { EzimLogger.getInstance().severe(exp.getMessage(), exp); } }
7404177d-367e-469c-85a9-daab3034077a
1
private static boolean deletePatient(Patient bean, PreparedStatement stmt) throws SQLException{ stmt.setInt(1, bean.getPid()); int affected=stmt.executeUpdate(); if(affected==1){ System.out.println("Patient with ID "+bean.getPid()+" has been Removed from database."); } else { System.out.println("unab...
0327c7de-5229-490c-a40f-ff37ee78a2ba
9
public Vector<Object> DeserializeFile() throws FileNotFoundException { Vector<Object> objectsVector = new Vector<Object>(); Method dMet; Method fMet; Class cls; Object obj; String type; String dTypeName; String methodName; String value; String lineIn = " "; Class dT = dTypes.getClass(); //Kee...
0dbbd929-170e-4a18-a61d-1a1c93f79570
0
public void setOfflineDate(Date offlineDate) { this.offlineDate = offlineDate; }
ef0fd527-7848-4af6-9d99-6640433b2c70
6
public static void teacherMainMenu() throws IOException, Exception { InputStreamReader in = new InputStreamReader(System.in); BufferedReader keyboard = new BufferedReader(in); int choice = 0; while( choice!=6) { System.out.println("~~~~~Teacher Menu~~~~~"); System...
0b6d4a48-1af6-4ade-9236-66f1f7cc787d
6
void rtabled(node cnode, int i, int j) throws valid_not_checked { cnode.removeRtable(i, j); query q,lastq=null; node tn; int found1=0,a=i; while (found1==0) { for(int b=0;b<common.maxCol;b++) { tn=cnode.getRtable(a, b); if (tn==null) continue; if (tn.isValid()==0) { cnode.removeR...
beebd17e-c123-46e0-9c6a-d918d9be1f06
2
public boolean equals(ShareItem item){ boolean b = true; if (numberOfShares != item.getNumberOfShares()) b = false; if (purchasevalue != item.getPurchasValue()) b = false; return b; }
1bf27f1d-e728-4205-b426-9da5cd6ea327
1
public static void listNotManagedByHarper(EntityManager entityManager) { TypedQuery<Project> query = entityManager.createQuery( "select pr from Project pr where pr not in (select p from Project p left join p.employees e where e.firstName = 'Harper')", Project.class); List<Project> resultList = query.getResult...
56b82771-2913-4b73-b76b-3dcbd4702e0f
7
@Override public void unInvoke() { if(canBeUninvoked()) { if(affected instanceof MOB) { final MOB mob=(MOB)affected; if((buildingI!=null)&&(!aborted)) { if(messedUp) { if(activity == CraftingActivity.LEARNING) commonEmote(mob,L("<S-NAME> fail(s) to learn how to make @x1.",...
7d71656d-d2f5-46e7-834a-52cbe729ede7
6
@Override public void start(Stage stage) { stage.setTitle("Hello Drag And Drop"); Group root = new Group(); Scene scene = new Scene(root, 400, 200); scene.setFill(Color.LIGHTGREEN); final Text source = new Text(50, 100, "DRAG ME"); source.setScaleX(2.0); source....
f8e8480e-180d-4602-8986-652af15c8063
4
public static void main(String[] args) { //ConcurrentHashMap Map<String,String> myMap = new ConcurrentHashMap<String,String>(); myMap.put("1", "1"); myMap.put("2", "1"); myMap.put("3", "1"); myMap.put("4", "1"); myMap.put("5", "1"); myMap.put("6", "1"); ...
1ab8f155-abde-424e-af17-de2341be1b99
6
public boolean equals(Object other) { if(other == null) { return false; } if(other == this) { return true; } if(!(other instanceof Song)) { return false; } Song anotherSong = (Song)other; return (title.equals(anotherSong.getTitle()) && artist.equals(anotherSong.getArtistName()) && album.equals(...
61818c2f-3818-4343-8d50-756b3aff05a2
1
private void onExit() { // if the user wants to save the window size on exit, do it. if (settings.window_size_remember) { settings.window_size_last = html_panel.getSize(); settings.saveWindowSize(); } System.exit(1); }
c64ff68e-8eac-46e8-96ca-40f4b395fcc1
6
public ZhengTagTime(List<Bookmark> trainList) { userResourceTagMaping = new HashMap<Integer, Map<Integer,List<Integer>>>(); userResourceTimeMaping = new HashMap<Integer, Map<Integer, Long>>(); userMaxTimeMaping = new HashMap<Integer, Long>(); userMinTimeMaping = new HashMap<Integer, Long>(); for (Bookmark...
9abd0c44-bc9e-4191-9e46-415f5531cd85
5
@Override public User findUserByUserIdAndEventId(int userId, int eventId) { User user = null; Connection cn = null; PreparedStatement ps = null; ResultSet rs = null; try { cn = ConnectionHelper.getConnection(); ps = cn.prepareStatement(QTPL_SELECT_BY...
bd5a1a75-746d-47ae-8cde-8778f79069e7
4
private void setSubjectDepartment() { DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) subjectTree.getLastSelectedPathComponent(); if (selectedNode == null) { return; } int treeLevel = selectedNode.getLevel(); if (treeLevel != 2) { ...
41211558-2b5c-47f9-a054-99adf9d2ee73
3
public void defaultSurfEnc(int randy) { if(randy<=3) enemy[0]=new Pokemon(Pokemon.Species.MAGIKARP,10); else if(randy<=6) enemy[0]=new Pokemon(Pokemon.Species.TENTACOOL,5); else if(randy==7) enemy[0]=new Pokemon(Pokemon.Species.POLIWAG,10); else enemy[0]=new Pokemon(Pokemon.Species.SEEL,7); }
a632d9f3-c12e-4709-9fda-371f82c7a8a9
6
private boolean kaannosOnnistuu(KaantyvaPalikka palikka) { if (onkoPalikkaSeinanSisalla(palikka)) { palikka.liiku(1, 0); if (onkoPalikkaSeinanSisalla(palikka)) { palikka.liiku(-2, 0); if (onkoPalikkaSeinanSisalla(palikka)) { Tetromino t...
fcd60f4d-462b-4cec-9850-639c0cbfef67
1
@Test public void addIngredient_should_work(){ rep.addIngredient("olive oil"); Ingredient c = rep.getIngredient("olive oil"); if(c==null){ Assert.fail(); } }