method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
9d294487-818d-4d43-bb17-980e10c2807b
9
void generateRandomDistributions(int nNodes, int nValues) { // Reserve space for CPTs int nMaxParentCardinality = 1; for (int iAttribute = 0; iAttribute < nNodes; iAttribute++) { if (m_ParentSets[iAttribute].getCardinalityOfParents() > nMaxParentCardinality) { nMaxParentCardinal...
00b28307-4041-495e-921c-f19c9d680ebf
3
public boolean commitCustomers(Connection conn) throws SQLException { boolean status = true; try { // Start of system transaction conn.setAutoCommit(false); BookingMapper bm = new BookingMapper(); status = status && bm.addNewCustomer(newCustomers, conn); ...
9b5c147a-b69c-4088-a3e8-3cc756bc0fac
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; RubiksCube other = (RubiksCube) obj; if (config == null) { if (other.config != null) return false; } else if (!config.equals(other.confi...
2af52c54-19cc-4df2-942b-decbc558aaef
7
public ConfigurationSection save(ConfigurationSection c){ for(Field f:this.getClass().getFields()){ if(f.isAnnotationPresent(config.class)){ try{ if(f.get(this) instanceof Location){ c.set(f.getName() + ".world", ((Location)f.get(this)).getWorld().getName()); c.set(f.getName() + ".x", (...
19b887d2-49e0-4b78-99fe-7f013a9b0cf4
2
private void renderKingPile(Graphics2D g) { double x = X_BOARD_OFFSET + CARD_WIDTH + CARD_X_GAP; double y = Y_BOARD_OFFSET; g.setColor(Color.white); g.drawString("King Down", (int) x, (int) y - 1); for (List<Card> kingPile : game.getKingPiles()) { if (kingPile.size()...
a075ba95-d99b-4c05-a3c9-917e486b6a3f
9
private static void generate() { for (int i = 0; i < ROW; i++) Arrays.fill(C[i], -1); for (int i = 0; i < MAX; i++) BEST[i] = i; for (int i = 1; i < COLUMN; i++) C[0][i] = 1; for (int i = 1; i < ROW; i++) C[i][0] = 1; ...
4a49ec88-9ded-4eb9-9549-2d62d69f1da2
9
@Override public TextureRegion getFrame(float stateTime) { wait--; if (x > 800) x-=1; if (dying > 0) { dying--; if (dying == 0) { this.x = 1100; this.y = 240; } return treeDie.getKeyFrames()[dying / 24]; } if (firing > 0 && x<=800) { rooting = 0; firing--; if (firing ...
ce8a0331-7751-4bf3-b887-a63884075fb3
4
public static void makeTreeDirected(mxAnalysisGraph aGraph, Object startVertex) throws StructuralException { if (isTree(aGraph)) { mxGraphProperties.setDirected(aGraph.getProperties(), false); final ArrayList<Object> bFSList = new ArrayList<Object>(); mxGraph graph = aGraph.getGraph(); final mxIGraphMo...
0ced2eb1-dc0a-4a70-bc76-f925d7cdbd5a
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Coordinate other = (Coordinate) obj; if (coordX != other.coordX) return false; if (coordY != other.coordY) return false; return true; ...
1b7bcbb2-c0a8-425f-a49b-d8e47d4e14e9
0
public void start() { System.out.println("Timer is restarting ..."); startTime = System.currentTimeMillis(); }
222751d1-15f8-40fc-a0cd-a0759f292fd9
7
public int Run(RenderWindow App){ boolean Running = true; Text scenario = new Text(); Font Font = new Font(); try { Font.loadFromFile(Paths.get("rsc/font/mrsmonsterrotal.ttf")); } catch (IOException e) { e.printStackTrace(); return (-1); ...
1c64b395-0411-4475-800d-1a8ba331c415
0
public CommandCwformat(CreeperWarningMain plugin) { this.plugin = plugin; }
aeebd04a-f99e-4608-a9aa-2252ad205304
4
public static String GetLoLFolder() { File file = null; String path = null; try { JFileChooser chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); chooser.setDialogTitle("Please set your Location of \"lol.launcher.exe\""); cho...
7c205842-04e3-489e-a039-cb8da7a67242
6
private void copyRGBtoBGRA(ByteBuffer buffer, byte[] curLine) { if (transPixel != null) { byte tr = transPixel[1]; byte tg = transPixel[3]; byte tb = transPixel[5]; for (int i = 1, n = curLine.length; i < n; i += 3) { byte r = curLine[i]; ...
36a47348-0f12-48a4-8049-c34de9a25ac7
4
public void initMethod(State state) { try { Method[] mets = mod.getClass().getMethods(); for (Method met : mets) { if (met.isAnnotationPresent(Initialization.class) && met.getAnnotation(Initialization.class).value() == state) { met.invoke(mod); } } } catch (IllegalAccessException |...
0e3928e0-020c-4de4-b22d-b72ba5e93b5d
6
public Dictionary parseDictionaryFromFile(File file) throws FileNotFoundException, IOException { Dictionary lexicon = new Dictionary(); int linenum = 0; if (file.getName().endsWith("txt")) { String filename = file.getPath(); lexicon.setFile(file); Logger.get...
64360e85-2d28-4a02-9856-11f48ff5b84b
1
public void removeFromParent() { if (mParent != null) { mParent.removeChild(this); } }
4eecbed0-246b-4982-8a3a-581e103b367d
6
public void GiveExperience(int ammount, Room Room, RoomUser PetUser) { Experience += ammount; ServerMessage Message = new ServerMessage(); Room.Environment.InitPacket(609, Message); Room.Environment.Append(Id, Message); Room.Environment.Append(PetUser.VirtualId, Message); ...
e28d0b56-3163-4aa0-a3c7-e60a79119dcc
9
@CLNames(names = { "-abcstat", "-STAT" }) @CLDescription("Old way of adding stats. Deprecated") public void addStat(String[] statAndConfig) { String statName = statAndConfig[0]; // turn this into a class in 2 ways. if it contains no . try using this // package as a prefix Class type = null; try { String ...
dea0a1f0-3d2d-4c07-b19b-6f74ee20fa3f
4
private void initializeSlaveMapping() throws BookStoreException { Properties props = new Properties(); slaveServers = new HashSet<String>(); try { props.load(new FileInputStream(filePath)); } catch (IOException ex) { throw new BookStoreException(ex); } String slaveAddresses = props.getProperty(BookS...
493e674d-c833-4695-9abe-0fec6ed58f2e
2
public static TicketingFacilityEnumeration fromValue(String v) { for (TicketingFacilityEnumeration c: TicketingFacilityEnumeration.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); }
9ab5f399-023b-4a09-94f0-a3ad2bc0218e
0
public ContactIterable(Iterable<T> s1, Iterable<T> s2) { this._s1 = s1; this._s2 = s2; }
073c3249-6cab-472c-8c96-ba80a8bf2717
6
void headerOnPaint (Event event) { CTableColumn[] orderedColumns = getOrderedColumns (); int numColumns = orderedColumns.length; GC gc = event.gc; Rectangle clipping = gc.getClipping (); int startColumn = -1, endColumn = -1; if (numColumns > 0) { startColumn = computeColumnIntersect (clipping.x, 0); if (start...
b0184e10-b081-43b3-827e-c5e5b381f4e3
4
@Override public GameState choose(Player player, GameState[] states, Card card) { for(GameState s : states) { s = findSetToTrue(s,card); } //If there's only one choice, we have no choice but to do it if(states.length == 1) { return states[0]; } int alpha = Integer.MIN_VALUE; int beta =...
74fd6460-82b3-417a-affd-caed2e10f00f
3
public void insertNewFact(String name, String text) { PreparedStatement ps = null; try{ stat.setQueryTimeout(30); ResultSet rs = stat.executeQuery("Select * from Fact " + "where Name = '"+name+"' OR Text ='"+text+"'"); if(!rs.isBeforeFirst()) ...
e07d404b-22c2-4a19-8c94-5796019ce9e4
8
public static boolean validPalindrome(String s) { if(s == null) { return false; } int left = 0; int right = s.length()-1; while(left < right) { while(left < right && !Character.isLetterOrDigit(left)){ left ++; } w...
2d4c7985-9c21-435a-affb-4f444ba869fe
2
public long getLong(int index) throws JSONException { Object object = this.get(index); try { return object instanceof Number ? ((Number) object).longValue() : Long.parseLong((String) object); } catch (Exception e) { throw new JSONException("JSONArray["...
05909ec9-c7b2-468c-bb12-c54b30d937c9
6
public Component getTableCellRendererComponent (JTable table, Object value, boolean selected, boolean focused, int row, int column) { super.getTableCellRendererComponent(table, value, selected, focused, row, column); if (column == 0 || column == 6) { //Weekend rende...
0cb56106-045c-4b35-a73a-5eadd9fe50cf
0
public int getPacketTime() { return lastPacketTime; }
59afffc4-a9a3-409e-a139-45f99004b320
9
private void loop(Scanner sc, Server server, ServerNetworkListener listener) { String line = sc.nextLine(); if(line.startsWith("/")) { String command = line.substring(1); if(command.equals("stop")) { running = false; server....
5eec5e4d-064c-4c30-a2a0-89559e5d6e8b
4
public Element generateElement(Document document) { Element key = document.createElement(mxGraphMlConstants.KEY); if (!keyName.equals("")) { key.setAttribute(mxGraphMlConstants.KEY_NAME, keyName); } key.setAttribute(mxGraphMlConstants.ID, keyId); if (!keyName.equals("")) { key.setAttribute(mx...
ccc17ac5-0181-405b-a922-873fbab3c8c0
2
public void deposit(BigInteger amount) throws IllegalArgumentException { if ( (amount == null) || (amount.compareTo(BigInteger.ZERO) <= 0) ) throw new IllegalArgumentException(); setBalance(this.getBalance().add(amount)); }
62b641eb-6660-41e5-bde0-a6e6b1234eb7
2
private MouseListener mouseListener(){ return new MouseAdapter() { @Override public void mousePressed( MouseEvent e ) { closeMenu(); if( e.isPopupTrigger() ){ popup( e.getX(), e.getY(), e.getComponent() ); } } @Override public void mouseReleased( MouseEvent e ) { if( e.isPopupT...
03f0cea4-9da3-4d6b-99e0-eb906275d787
5
private void checkValuePlacement( String text ) throws RrdException { Matcher m = VALUE_PATTERN.matcher(text); if ( m.find() ) { normalScale = (text.indexOf(SCALE_MARKER) >= 0); uniformScale = (text.indexOf(UNIFORM_SCALE_MARKER) >= 0); if ( normalScale && uniformScale ) throw new RrdException( "C...
1e2a6831-951b-44b0-b528-76bc13bd1e79
5
public void paint(Graphics g) { if (handles != null && isHandlesVisible()) { for (int i = 0; i < handles.length; i++) { if (isHandleVisible(i) && g.hitClip(handles[i].x, handles[i].y, handles[i].width, handles[i].height)) { g.setColor(getHandleFillColor(i)); g.fillRect(handles...
eed1cb9f-c8f4-4c46-9b53-1a43565e96ef
0
@Override public String getName() { return NAME; }
9fa7cf66-3cc4-4725-b8c7-bce0fc25d01e
1
private boolean canShootMoreTargets() { if (attackData.getEnemiesTowerCanShootAtTheSameFrame() > attackData.getEnemiesTowerHasShoot()) { return true; } return false; }
b3876cbe-7ade-4ac4-80cf-a4e86506faaf
5
public void buttonPress(int function) { if(function == 1) { new EventGUI(myDay,combo.getSelectedIndex(),gui); gui.reformat(); this.hide(); } if(function == 2) { if(myDay.getEvents().size() != 0) myDay.getEvents().remove(0); gui.reformat(); this.hide(); } if(function == 3) { gui....
5e6fd39a-51eb-4203-ab51-d256d209dab0
1
@Override public ArrayList<String> getAllCategories() { ArrayList<String> categories = new ArrayList<String>(); TypedQuery<Category> categoryQuery = emgr.createNamedQuery("Category.findAll", Category.class); List<Category> categoriesList = (List<Category>) categoryQuery .getResultList(); for (int i = 0;...
8a6e2a92-b24d-4a43-803f-853b9aa76c4d
4
public void attachHost(GridSimCore entity, PacketScheduler sched) { String msg = super.get_name() + ".attachHost(): Error - "; if (entity == null) { System.out.println(msg + "the entity is null."); return; } if (sched == null) { Sy...
30bb4cbb-a378-41dc-a750-7a3ce2466ffa
3
public static Vector3 getVec3fromYamlObject(Object yamlObject) { if (!(yamlObject instanceof List)) throw new RuntimeException("yamlObject not a List"); List<?> yamlList = (List<?>)yamlObject; return new Vector3( Float.valueOf(yamlList.get(0).toString()), Float.valueOf(yamlList.get(1).toString()), ...
6ff80212-20e9-48ce-a989-dcc7481b4980
9
public void event (ZoneEvent event) { switch (event.getType()) { case MOTION: env.getNotifyService().sendMotion(name); action(event); possibleAlarm(event); break; case OPENED: env.getNotifyService().sendDoorOpen(name); action(event); ...
90c13a50-660c-4265-bd2a-89c2938a6264
3
public void setSelectionCrossoverOp(String selectedSelectionCrossoverOp) { try { Class crossoverClass = Class.forName(selectedSelectionCrossoverOp); selectionCrossoverOp = (Selection) crossoverClass.newInstance(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e...
7d69f825-8f94-4e3f-8465-6ccf33220dd4
5
public static byte[] toByteSequence(String data) throws Exception{ /* Counter for making sequence. */ int j=-1; /* Size of the byte array. */ int byteArrSize = data.length()/8; /* Checks if the byte array size is adequate. */ if (data.length()%8 != 0) byteArrSize++; ...
e38b10b4-44d0-4198-a956-f59ca5ad6140
2
public HaxagonUI() { Toolkit toolkit = Toolkit.getDefaultToolkit(); Point hotSpot = new Point(0,0); Image cus = toolkit.getImage(getClass().getResource("Pic/iconse.png")); //Image curs = toolkit.getImage(getClass().getResource("Pic/Wand.png")); //Cursor oriCursor = toolkit.createCustomCursor(curs, hotSpot, "...
20192002-fef5-4a5a-8bf6-edee5a3065fa
8
public static void playGame() { for (Player p : playerList) { int bet; System.out.printf("%s, you have $%.2f in your wallet.\n", p.getName(), p.getWallet()); System.out.print("How much do you want to bet? "); do { try { bet = scan.nextInt(); } catch(InputMismatchException e) { be...
4bfafe30-796c-46c0-9639-dc623db176f0
8
private static String escapeJSON(String text) { StringBuilder builder = new StringBuilder(); builder.append('"'); for (int index = 0; index < text.length(); index++) { char chr = text.charAt(index); switch (chr) { case '"': case '\\': ...
79813941-58d5-4bf5-b424-636b313cca29
0
public void select() { listButtons(true); }
972f0836-768c-4f80-81e4-e2ec8fcb4c31
0
private String getLabel(Instrument instrument, Calendar calendar) { String label = instrument.name(); label = label.substring(0, 3) + label.substring(3, 6); label = label + "_" + df.format(calendar.getTime()); return label; }
7264da80-546e-4f92-97cf-e98cc308c2d6
9
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Person person = (Person) o; if (favouriteNumber != null ? !favouriteNumber.equals(person.favouriteNumber) : person.favouriteNumber != null) ...
fa9bd6e2-1005-4515-b868-c4cd57301544
4
public Page getPage(TreePath path) { Object[] way = path.getPath(); PageInfo page = (PageInfo)way[0]; for (int i = 1; i < path.getPathCount(); i++) { boolean found = false; for (PageInfo p : page.getSubPages()) { if (way[i] == p) { page...
fb9abb3e-3f0f-46cc-9047-af2350d27117
5
private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException { boolean isValueNumeric = false; try { if (value.equals("0") || !value.endsWith("0")) { Double.parseDouble(value); isValueNumeric = true; ...
883032f9-599f-4815-b93e-bb144605104f
4
public void copyPicture(final SimplePicture sourcePicture) { Pixel sourcePixel = null; Pixel targetPixel = null; // loop through the columns for (int sourceX = 0, targetX = 0; (sourceX < sourcePicture.getWidth()) && (targetX < this.getWidth()); sourceX++, targetX++) { // loop through the rows for (in...
9edfcade-6a27-478f-b179-4a76ef36d196
8
public static void dijkstra(int start) { int[] distances=new int[p]; boolean[] visited=new boolean[p]; Comparator<vertexButter> vComp = new VertexButterComparator(); PriorityQueue<vertexButter> queue = new PriorityQueue<vertexButter>(p, vComp); for(int i=0; i<p; i++) { if(i!=startp[start]) { distances[...
04a0ea49-da1a-4733-9e7e-496a71cb022e
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Exit other = (Exit) obj; if (!Objects.equals(this.name, other.name)) { return false; ...
c03ab745-b528-449d-8944-b0b96ca9f755
6
public boolean equals(Object configuration) { if (configuration == this) return true; try { if (!super.equals(configuration)) return false; Tape[] tapes = ((TMConfiguration) configuration).myTapes; if (tapes.length != myTapes.length) return false; for (int i = 0; i < tapes.length; i++) if...
15a81147-cd87-45aa-b2e4-2c41d9609d90
2
public PreparedStatement build(Connection connection) throws SQLException { if (this.sqlCache == null) { this.sqlCache = builder.toString(); } PreparedStatement preparedStatement = connection.prepareStatement(sqlCache); for(int i = 0; i != parameters.size(); ++i) { preparedStatement.setObject(i + 1,...
b2c7fc32-282b-4903-a342-1a5ccccf5c3d
8
public Case(int a, int x, int y){ setSize("54px", "54px"); if (a == 1) { setStyleName("caseSol"); } else if (a == 2) { add(new SiegeButton("images/siege2.png",x,y,false)); } else if (a == 3) { add(new DecoButton("/images/table2.png")); } else if (a == 4) { add(new CafeButton()); } else if (a == 5...
520d561d-69d3-4cce-a810-82b746819b98
9
public String nextToken() throws JSONException { char c; char q; StringBuffer sb = new StringBuffer(); do { c = next(); } while (Character.isWhitespace(c)); if (c == '"' || c == '\'') { q = c; for (;;) { c = next(); ...
24ef4339-8545-4e9c-8e56-8904520d5252
2
public static byte[] executeFunction(byte[] block, byte[] subkey) throws IllegalArgumentException { if (block.length != 4) throw new IllegalArgumentException("Block should be 4 bytes long."); else if (subkey.length != 6) throw new IllegalArgumentException("Key should be 6 bytes l...
2f733bbd-0078-405f-966d-88e3ba251b48
3
public int lookup(PageId pageNo) { // Instantiate a new entry BufHTEntry entry; int index; // If the page does not exist return an INVALID_PAGE if (pageNo.pid == INVALID_PAGE) return INVALID_PAGE; // Determine which bucket in Page Table array that the pageNo would be in index = hash...
fc8c4f86-a3ba-4087-8ad5-7261cc86bb37
1
public boolean hasRoute(Node to) { if (dij != null) { return dij.hasPathTo(to); } return false; }
95ec16ef-cf18-4140-bf94-0f71607582be
7
private Content retrieveInheritedDocumentation(TagletWriter writer, ProgramElementDoc ped, Tag holderTag, boolean isFirstSentence) { Content replacement = writer.getOutputInstance(); Configuration configuration = writer.configuration(); Taglet inheritableTaglet = holderTag == null ?...
b2712493-2133-40c6-88ab-4c671f8af6e5
0
public Wall(int x,int y) { super(x,y); URL loc = this.getClass().getResource("/karel/themes/LTTPWall.png"); ImageIcon iia = new ImageIcon(loc); image = iia.getImage(); this.setImage(image); }
2fa8f008-b373-4f1d-8669-683ca0b87c94
1
@Override public void deleteAndCopyHistory(MediaUrlModel mediaUrlModel) { try { String query = "INSERT INTO " + TABLE_HISTORY_NAME; query += " (original_id, url,search_word,twitter_user_name, created_at,updated_at) VALUES (?,?,?,?,?,?) "; PreparedStatement stmt = con.prepareStatement(query); stmt.setI...
d5ecb353-b614-46ca-9e1c-265507241266
0
public PlatformCompatibility() {}
7328f6dc-8b19-4d22-aa8e-5fc971bd8a1c
4
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if(args.length == 0) { return noArgs(sender, command, label); } else { final String subcmd = args[0].toLowerCase(); // Check known handlers first and pass to them f...
5fdf7add-7a3e-47e4-9c2b-2579bb773ceb
5
public static void main(String [] args){ boolean found=false; int [] values={1,5,11,25,9,3}; Arrays.sort(values); int low=0; int high=values.length-1; int pos=0; int searchedNumber=11; while(low<=high&&!found){ pos=(low + high)/2; ...
f9b3c06e-0436-4700-bcbb-3fb234831abc
6
public void supprimer(int debut, int fin) { if (debut == fin && debut > 0) { contenu.deleteCharAt(debut - 1); position = debut - 1; } else if (debut == fin) { if (debut > 0) { contenu.deleteCharAt(debut); position = debut; }...
70772c59-bb57-4cad-b988-7b1ae3b47770
8
private void processMessage(String message) { if (message.equals(TOOLKIT_SETTINGS_REQUEST)) { sendToolkitSettings(); } else if (message.startsWith("<toolkit")) { processToolkitSettings(message); } else if (remoteToolkitSettings == null) { sendCommand(TOOLKIT_SETTINGS_REQUEST); } else if (m...
d0506ea9-9d1e-4ee4-9c60-e6a3fe8e07b2
1
@Test public void WhenStaticUnionCollections_ExpectResultUnion() throws UnknownHostException { ArrayList<Host> list0 = new ArrayList<Host>(1); Host host0 = new PGridHost("127.0.0.1", 3333); list0.add(host0); ArrayList<Host> list1 = new ArrayList<Host>(1); Host ho...
83605089-4483-43c6-87a4-54ea97ad80aa
0
@Override public void onDisable() { }
0ed600b1-9eba-4b10-b23c-779c9f3b6aa7
0
public int size() { return myCards.size(); }
a00e1f87-57c0-47f6-ab8b-227ee589c52e
9
public static boolean isObjectIdValid(String s) { if (s == null) return false; final int len = s.length(); if (len != 24) return false; for (int i = 0; i < len; i++) { char c = s.charAt(i); if (c >= '0' && c <= '9') continue; if (c >= 'a' && c <= 'f') continue; if (c >= 'A' && c <= '...
3d375dcc-72ac-4427-8add-34a5f623d4b6
9
public Map<String, String> downloadTaskContext(TaskAttribute attribute) throws TaskContextDownloadException { // filepath, submitter Map<String, String> taskContextMap = new HashMap<>(); // check if the directory to download all task contexts is existing File f = new File("MylynContexts"); if (!f.exists(...
3cc3eeba-31f4-4578-a463-dd0ed0f56f85
0
@AfterClass public static void tearDownClass() { }
e5d7ee87-db32-4c6a-a1d1-8fda03fc1606
8
private void setLeaf() throws Exception { //this will fill the ranges array with the number of times //each class type occurs for the instances. //System.out.println("ihere"); if (m_training != null ) { if (m_training.classAttribute().isNominal()) { FastVector tmp; //System.out.pri...
b6abf374-fc37-451b-a6bb-e241fee749de
2
public TD01Knapsack(int capacity, int w[], int v[]) { int n = w.length; // capacity ranges from 0 to 'capacity' vKnapsack = new int[capacity + 1]; contentsKnapsack = new String[capacity + 1]; for (int i = 0; i <= capacity; i++) { vKnapsack[i] = Integer.MIN_VALUE; contentsKnapsack[i] = ""; } vKna...
b44249c1-3ba3-4b9e-b5da-081d309099a1
4
void calculateShipPosition(){ this.shipCoordinates[0][0] = this.shipPosition_x; this.shipCoordinates[0][1] = this.shipPosition_y; /*For vertical ships*/ if(this.shipOrientation == 'v' || this.shipOrientation == 'V'){ for(byte x = 1; x < this.shipSize; x++){ this.shipCoordinates[x][0] = this.shipPosition...
7d69694e-59cf-44b0-a5a2-1d40b74e582b
8
private void interpolatePrecisely(int iLower, int iUpper) { int dx = (int) Math.floor(txRaster[iUpper]) - (int) Math.floor(txRaster[iLower]); if (dx < 0) dx = -dx; float dy = (int) Math.floor(tyRaster[iUpper]) - (int) Math.floor(tyRaster[iLower]); if (dy < 0) dy = -dy; if ((dx + dy) <= 1) return; f...
79ada500-403d-4e5a-a3f8-a732caf2f05e
0
private void jButtonDetailsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDetailsActionPerformed ctrlCR.DetailsPraticien(); }//GEN-LAST:event_jButtonDetailsActionPerformed
3df9b1bf-28dd-4474-976a-08df8e06279f
0
public JLabel getjLabelAdresse() { return jLabelAdresse; }
ff7dbfe8-6c65-4ce4-94c9-242c4f54debe
2
public int maxSubArray(int[] A) {// O(n) space if (A == null) return 0; int[] buffer = new int[A.length]; buffer[0] = A[0]; int max = buffer[0]; for (int i = 1; i < A.length; i++) { buffer[i] = Math.max(A[i], buffer[i - 1] + A[i]); max = Math.max(buffer[i], max); // keep track of the largest sum ...
44d101c1-f88d-414e-8bdf-b23c8b0db3ca
0
private void jLabel3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel3MouseClicked jTextPane1.insertIcon(new ImageIcon(getClass().getResource("/picture/2.jpg"))); pos.add(jTextPane1.getText().toString().length()-1); pic.add("}"); }//GEN-LAST:event_jLabel3MouseClick...
3ce82803-ff70-4031-860f-b9bb5a2cec9b
9
@Override public void process(SimEvent event) { NodeReachedEvent _event = (NodeReachedEvent) event; this.setPosition(_event.getPosition()); //Sets the actual position to the one provided by the event. System.out.println(getName() + "@" + getEngine().getCurrentTime() + ": reached node (" + getPosition().getX() + ...
c591f73b-b0e1-4586-8918-e70cdaa6c0b4
4
public boolean updatePosition(float pf_width, float pf_height, Player player, Vector<Brick> bricks, Vector<BrickConfiguration> brickConfigurations, BreakoutCanvas canvas) { /*Update the shot's position*/ x += xVel;//(speed * xDir); y += yVel;//(speed * yDir); int score_sum = 0; boolean bricksStillInPlay = ...
eee968af-db39-4a70-870e-fd1d5d5b44b8
3
public int maxProfit(int[] prices) { int[] A = prices; if (A.length < 2) return 0; int max = 0; for (int i = 1; i < A.length; i++) { int diff = A[i] - A[i - 1]; max = diff > 0 ? max + diff : max; } return max; }
a082af74-c8ac-4eac-b82b-56f03ac1c711
0
public List findByRecordCode(Object recordCode) { return findByProperty(RECORD_CODE, recordCode); }
4ff72e5e-97ca-473d-9676-94276698f748
0
public void increment() { System.out.println("Other increment operation"); }
3c07b548-8a2d-41fd-90a5-ed5a713cfb8d
6
public static String generateTripKML(LinkedList<Trip> trips) { String output; output = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<kml xmlns=\"http://www.opengis.net/kml/2.2\">\n" + " <Document>\n" + " <name>Paths</name>\n" + " <Style id=\"testStyle\">\n" + " <LineStyle>\n" + " ...
f76d0830-8d2d-4038-84ff-0d9dd344c031
0
public String getSource() { return this.source; }
e9c266e7-3fad-412c-8b06-15e4559411df
4
private void clearPosition() { StreamsterApiInterfaceProxy proxy = new StreamsterApiInterfaceProxy(); Position[] positions = new Position[0]; try { positions = proxy.getPositions(); } catch (RemoteException ex) { Logger.getLogger(JobTradeUpGBPJPY.class.getName())....
728e0a4b-e12e-4be3-ab52-6f5c01afb25e
0
public boolean getHasVisited() { return hasVisited; }
43659784-8291-4000-97f5-7e111ed994df
7
public void connect_event () { boolean err = false; SocketChannel fd = null; try { fd = connect (); } catch (ConnectException e) { err = true; } catch (SocketException e) { err = true; } catch (SocketTimeoutException e) { ...
d464f041-2bd5-4407-a039-0fd6dfee4384
0
public String getAlgorithm() { return algorithm; }
56321e37-9f25-4a15-a62d-9e59cdab9980
7
private String getLANIpAddress() { // returns IP address in wifi network try { boolean firstAddress = true; Enumeration<NetworkInterface> networkInterfaces = NetworkInterface .getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { NetworkInterface networkInterface = networkInterface...
72a8fb40-7dc1-4cce-8b20-1391aae7f643
9
@Override public Screen respondToUserInput(KeyEvent key) { int k = key.getKeyCode(); if (k == KeyEvent.VK_ESCAPE) return game; else if (k == KeyEvent.VK_DOWN || k == KeyEvent.VK_J || k == KeyEvent.VK_NUMPAD2) { if (pos<8) pos++; } else...
41cbbb33-26ef-4fcf-b4a5-df98aad8e0dd
3
public void insertStudent(String Name,String Address) throws SQLException { String insertTableSQL = "INSERT INTO school.student " + "(name, address) " + "VALUES" + "('"+Name+"','"+Address+"')"; try { MyConnection mc=new MyConnection(); dbConnection=mc.getConnection(); stateme...
b33092e5-2680-4f2a-9665-54bd6f5858c9
2
public Collection<V> values() { List<V> values = new ArrayList<>(); for(Set<V> valueSet : mValuesByKey.values()) { for(V value : valueSet) { values.add(value); } } return values; }
b2612c48-04a1-4b39-b899-7b947b3247ea
2
@Override public int compareTo(letterAndFrequency o) { // TODO Auto-generated method stub if(this.frequency < o.frequency){ return -1; } else if(this.frequency == o.frequency){ return 1; } return 0; }