method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
ba8155d4-1f6f-40cb-9a0b-d008e9c5990f
1
public void render(Graphics g) { if(this.colorFilter != null) this.animation.get(this.currentAnimation).draw(position.getX(), position.getY(), this.colorFilter); else { this.animation.get(this.currentAnimation).draw(position.getX(), position.getY()); } }
285f309f-6de8-4710-9583-4364eb4aba90
9
static File createRandomBTX(Random r, File output, int objSize, int attrLen) throws IOException { if (output == null) { output = File.createTempFile("random-btx-file", ".carrots"); } DummyInputStream dum = new DummyInputStream(); ArrayList<state> stack = new ArrayList<>(); state cur = state.DO_CHILDREN; ...
daf550d9-81b8-4090-897d-3de5ce5d5f7f
0
public String getUserid() { return userid; }
3ea1413c-4b54-40ef-a69c-2a2404028484
1
public double[] nextDoubles(int n) throws IOException { double[] res = new double[n]; for (int i = 0; i < n; ++i) { res[i] = nextDouble(); } return res; }
a2161411-31b0-45ae-a254-71e32a6441ae
8
public synchronized CMVFSDir fetchSubDir(final String path, final boolean create) { final String[] ppath=path.split("/"); CMVFSDir currDir=this; for(final String p : ppath) { if(p.length()>0) { synchronized(currDir) { final CMVFSDir key = new CMVFSDir(currDir,currDir.getPath()+p+"/...
7f6d0633-d4c9-42e3-92ca-74f201eab282
8
public void partition(FieldInfo fieldInfo, int partitions) { if (fieldInfo.getType().equals("DOUBLE")) { partitionDouble(fieldInfo, partitions); return; } FieldIterator iter = getFieldIterator(fieldInfo); ArrayList<Integer> values = new ArrayList<Integer>(); ArrayList<Integer> boundaries = new ...
c611ba99-2746-421f-abd8-e3cccdd809bb
5
public boolean getSalida(List<Salida> Listaentradas,int numSalida){ int x=0; while(x<LargoLista){ boolean esta=false; for(int y=0;y<entradas.getLength();y++){ if((Boolean)Listaentradas.get(y).getValue()==entradas.get(y).get(x)){ if(y==entradas....
fbd85594-4d14-4843-9141-60b4b69fc1aa
1
private void setShortValue(final Cursor cursor, final int index, final Field field, final Object object) { final Short value = (!cursor.isNull(index) ? cursor.getShort(index) : null); Reflection.setFieldValue(field.getName(), object, value); }
256fcb00-d377-4d14-8f20-472fb857c01e
2
public boolean deletePatient(Patient patient){ if (this.nextPatient == null){ return false; } else if (this.nextPatient.name.equals(patient.name)){ this.nextPatient = nextPatient.nextPatient; return true; } else { return this.nextPatient.deletePatient(patient); } }
d3b58a72-0588-489d-87e5-ed6cacd206cb
8
private void quickSort(E[] array, int low, int high) { if (high - low < 1) return; int i = low; int j = high; E temp = array[low]; while (i != j) { // 找到右边数第一个小于枢纽元素的元素 while (i < j && array[j].compareTo(temp) > 0) j--; if (i < j) { array...
4fa17fe8-5edb-49df-955c-25685978fe2f
7
public static void main(String[] args) { DataGIS gis = null; TopRegionalRC rc = null; DataGridUser user = null; // FIRST STEP--------------------------------------------- // Initialize the GridSim package int num_user = 1; // number of grid users Calendar calend...
5ef1e3e4-c10e-40a3-9576-ae2aaec718e9
5
public Object nextEntity(char ampersand) throws JSONException { StringBuffer sb = new StringBuffer(); for (;;) { char c = next(); if (Character.isLetterOrDigit(c) || c == '#') { sb.append(Character.toLowerCase(c)); } else if (c == ';') { ...
47e04d13-5daf-49ec-924b-a0e35b74fa36
1
@SuppressWarnings("static-access") public static void spawnLich (Location loc, int amount) { int i = 0; while (i < amount) { LeatherArmorMeta helmMeta; ItemStack lichHelm = new ItemStack(Material.LEATHER_HELMET, 1); helmMeta = (LeatherArmorMeta) lichHelm.getItemMe...
18eb3016-5793-4e31-b986-8b90942cee5b
9
private boolean r_mark_suffix_with_optional_U_vowel() { int v_1; int v_2; int v_3; int v_4; int v_5; int v_6; int v_7; // (, line 159 // or, line 161 lab0: do { ...
8b65f4dc-1588-4460-897d-01b80b4df13d
6
public static void setEnabled(Container c, HashMap<Component, Boolean> wasEnabled, Component[] notEdit) { List<Component> notEditList = null; if (notEdit != null && notEdit.length > 0) { notEditList = Arrays.<Component> asList(notEdit); } else { notEditList = new ArrayList<Component>(); } Component[...
e7e259a9-7605-46c9-a856-187ed82703fb
8
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String callback = request.getParameter("callback"); List<String> entityIDs = new ArrayList<String>(); for (int i = 0; i < 10; i++) { String val ...
5a091fe0-b12a-4734-9db1-fbba8362d99b
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Produto other = (Produto) obj; if (codProduto != other.codProduto) return false; if (nome == null) { if (other.nome != null) return f...
a335264b-d0bc-42be-a088-d264b4a3fa53
1
public static void main(String[] args) throws Exception { StaticDynamicUncertaintyWithADIULHSolver solver = new StaticDynamicUncertaintyWithADIULHSolver(); PrintStream filePrintStream = new PrintStream(new File("results/ADI-Cost-Experiment1a.csv")); PrintStream[] printStreams = new PrintStream[2]; printStrea...
3cf881cc-a281-489f-86af-b8e88122d36a
7
private static void test10() throws FileNotFoundException { //Test winning the game twice in a row String input = "new\n" + "pick up key\n" + "wait\n" + "unlock door with key\n" + "go through cell door\n" + "new\n" + "pick up key\n" + "wait\n" + "unlock door with key\n" + "go through cell door\n" + "quit\n"...
fe9bbb75-597d-434b-ac64-1a9d6f964c65
5
private boolean parse(String command) { StringTokenizer tokens = new StringTokenizer(command, Utils.SEPARATOR); if (tokens.countTokens() != 2) return false; String process = tokens.nextToken(); if (! r.contains(process)) return false; String action = tokens.nextToken(); if (! (action.equals("ON") || a...
51e7eedb-54aa-4ffc-b8d1-d642e2636069
0
public ArrayList<String> getWorks() { return works; }
2daa5e13-da9d-4b78-b3df-a074f01eda5a
1
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Role r = new Role(); r.setName(request.getParameter("role")); response.setContentType("text/html;charset=UTF-8"); try (PrintWriter ...
6f5331b5-bcbd-404c-8501-c4efa6f1053a
6
public static void main(String[] args) { Random rand = new Random(); List<String> ls = new ArrayList<String>(); System.out.println("0: " + ls); Collections.addAll(ls, "oh", "what", "a", "beautiful", "Manila", "Monday", "morning"); System.out.println("1: " + ls); String h ...
38e5b4f0-6d17-4f20-8a2f-5a9b1a371a50
8
public static ArrayList<MstxInfo> getFavourite(String uid) { ArrayList<MstxInfo> result = new ArrayList<MstxInfo>(); String sql = "select info_title,info_dis,info_lon,info_lat,info_time,a.uid,a.mid " + "from mstx_info as a,mstx_col as b where a.mid=b.mid and b.uid = " + uid + ";"; Connection con = DBUtil.getC...
f6489296-d7cd-4595-9357-e33f37bdb88f
1
public void setNextFigure(FiguresChain nextChain) { if (Objects.isNull(nextChain)) { throw new IllegalStateException("next part of the chain is null, please provide non-null chain"); } this.chain = nextChain; }
c43724f2-2da9-4ff6-bd95-9df9a2564da5
1
private final int copy(InputStream paramInputStream, OutputStream paramOutputStream) throws IOException { byte[] arrayOfByte = new byte[4096]; int i = 0; int j = 0; while (-1 != (j = paramInputStream.read(arrayOfByte))) { paramOutputStream.write(arrayOfByte, 0, j); i += j; } return i; }
a899e1d9-7b2a-41ea-9ee4-267cca5f116f
6
public boolean hasFinishedProduction() { //holy shit this is disgusting code if(production == GameConstants.ARCHER && productionAmount >= 10) { return true; } else if(production == GameConstants.LEGION && productionAmount >= 15){ return true; } else if(production == GameConstants.SETTLER && pr...
73a4a67e-3130-431e-8d53-d48ce57f2607
5
public static void cp(final String source, final String target) { FileChannel inChannel = null; FileChannel outChannel = null; try { inChannel = new FileInputStream(new File(source)).getChannel(); outChannel = new FileOutputStream(new File(target)).getChannel(); // JavaVM does its best to do this as nati...
2d07c725-8fd7-4f31-9f62-f89a1c04d8a0
0
public DefaultTempFileManager() { tmpdir = System.getProperty("java.io.tmpdir"); tempFiles = new ArrayList<TempFile>(); }
75cd6bf1-cfe5-41e1-9923-0b69fa3f0496
2
@Override public void valueChanged(ListSelectionEvent e) { if (e.getSource() == stockList) { // check if order list is empty if (stockList.getSelectedIndex() > -1) { // separate the text in the selected list item String[] values = stockList.getSelectedValue().split("\\t"); driver.getGui().getTabbed...
eb7b7590-b8c2-42e2-b5cc-995a5d2dde95
0
public LayoutParser(String layoutFile, SootClass theClass) { this.layoutFile = layoutFile; this.theClass = theClass; }
bc1491c6-75c9-4cde-91aa-0afb18787feb
8
private int getOption(String[] args, String textToFileter) { if (args.length > 1) { if (args[1].length() < 3) return 0; String option = args[1].substring(2); try { boolean startsWithTextToFilter = args[1].toLowerCase().startsWith(textToFileter); ...
655713d0-523e-420d-b923-ec7c8f34e21e
0
public void setCollectComments(boolean newValue) { collectComments = newValue; }
b8f659ce-9643-4bcd-9ce2-e76f1c95efe2
4
@Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if(commandLabel.equalsIgnoreCase("qop")){ Player target = (Bukkit.getServer().getPlayer(args[0])); if (target == null) { sender.sendMessage(args...
38b90684-14e2-4a03-90e3-6f55707f17ec
0
public void setCity(String city) { this.city = city; }
9048e970-0629-46a3-bd65-5f342055e89a
5
public static String encode(byte[] in) { int iLen = in.length; int oDataLen = (iLen * 4 + 2) / 3; // output length without padding int oLen = (iLen + 2) / 3 * 4; // output length including padding char[] out = new char[oLen]; int ip = 0; int op = 0; while (ip < iLen) { int i0 = in[ip++] & 0xff; ...
a15a204f-778c-4b52-a684-2e684b68c156
0
CompoundExecutorDemo(Executor executor) { this.executor = executor; }
114d1e78-df5a-4101-acb2-f7311dae17bd
4
private int autoCorrelation(int index, int windowWidth) { double max = -1; int indexAtMaximum = -1; if(index + windowWidth > modifiedSamples.length){ return -1; } windowWidth = windowWidth/2; //the window is assigned as between i and i + windowWidth int end = index + windowWidth; for(int...
ec298a9c-c46c-4973-a284-7c9c4a6c9c36
7
public void close(Object stream) { if (stream == null) return; try { if (stream instanceof Reader) { ((Reader) stream).close(); } else if (stream instanceof Writer) { ((Writer) stream).close(); } else if (stream instanceof InputStream)...
b389f4ca-44be-437d-bcfb-9cc1f45d7a6d
6
@Override public void addVisitor(MapleCharacter visitor) { int i = getFreeSlot(); if (i > -1) { broadcastToVisitors(PlayerShopPacket.shopVisitorAdd(visitor, i)); switch (i) { case 1: chr1 = new WeakReference(visitor); break; case 2: chr2 = new WeakReference(visitor); break; ...
41c2fd16-4027-4770-9256-7b0d96294e10
9
public void removeDuplicates(Node<AnyType> headNode, int method) { if(method==1) { ArrayList<AnyType> list = new ArrayList<AnyType>(); Node<AnyType> prev = null; while(headNode!=null) { if(list.contains(headNode.data)) { prev.Next = headNode.Next; } else { prev = headN...
ea6f56b8-d428-4d0f-9a13-dd4732468c04
5
private int[] payloadStringToArray(String payload) { int[] deltaValues = new int[sizeOfNetwork]; int soNcounter = 0; int i = 0; while (i < payload.length()) { if (payload.charAt(i) == '_' || payload.charAt(i) == ',' || payload.charAt(i) == ' ') { i++; continue; } else if (payload.charAt(i) == ...
68486162-3e3d-40a0-9b22-774979433f80
0
public Float getGainAlbum_dB() { return gainAlbum_dB; }
b5ded7d6-7c99-40f1-8ae4-532c67c3316a
2
public static void main(String[] args) { dbc = DBController.get(); dbc.initDBConnection(); try { DbWriter.createTableFiles(); DbWriter.createTableCustomer(); } catch (SQLException e1) { e1.printStackTrace(); } // dbc.handleDB(); try { CloudButler systemTrayExample = new CloudButler(); syst...
d837d02d-bf30-4e82-86e2-406eb820f631
5
private void recieveFrame() { byte newestByte = this.buffer.get(); if (newestByte == START_OF_FRAME) { // Beginning of Frame this.currentFrame = null; } else if (newestByte == END_OF_FRAME) { // End of Frame String textFrame = null; // currentFrame will be null if END_OF_FRAME was send directly after ...
d9976eeb-6dc3-4d74-9b4c-7fce87662eda
6
public void launch(String launchPath, String[] args) { if (launchPath == null) { try { launchPath = getRunningPath(); } catch (UnsupportedEncodingException ex) { return; } } ProcessBuilder processBuilder = new ProcessBuilder();...
e864660f-107d-4f36-b25f-45e74624147c
7
public void move(int delta) { if (moving) { if (currentX == destX && currentY == destY) moving = false; else { if (currentX > destX) currentX -= 1 * delta; else if (currentX < destX) currentX += 1 * delta; if (currentY > destY) currentY -= 1 * delta; else if (currentY < destY)...
14f12d55-a89d-4c77-aa7b-2068afd1d6a0
2
public static Account getAccountDetails(int accountNumber){ Account accountObject = null; for(int i = 0 ; i < 10; i++) { if(accList[i].getAccountNumber() == accountNumber) { accountObject = accList[i]; break; } else { continue; } } return accountObject; }
f5198059-14c8-4c6b-a7d1-3071768755be
9
public static int findOption(String... options) { if (options == null) return -1; if (options.length == 0) return isOpen() ? 0 : -1; for (int i = 0; i < options.length; i++) { options[i] = options[i].toLowerCase(); } for (int opt = 0; opt < 5; opt++) { String s = getOption(opt).toLowerCase(); i...
fb770765-0f3c-449f-a753-a538487fe82e
0
private void addMenu() { menu.add(importDataMenuItem); menu.add(new JSeparator()); menu.add(exportDataMenuItem); menuBar.add(menu); frame.setJMenuBar(menuBar); }
fb766f1f-6214-4f5b-b234-daa5b423044b
6
@Override public void keyPressed(KeyEvent event) { KeyStroke ks = KeyStroke.getKeyStrokeForEvent(event); int code = ks.getKeyCode(); if (code != VK_SHIFT && code != VK_CONTROL && code != VK_META && code != VK_ALT && code != VK_CAPS_LOCK && code != VK_ESCAPE) { mKeyStroke = ks; setText(getKeyStrokeDisplay(m...
d317ac8d-eb2c-4b51-b03c-52d3ff25c59d
6
@Override public void run() { StringBuilder sb = new StringBuilder(); try { ArrayList<String> c = api.getCoupons(); if (c.isEmpty() || c.size() <= 0 || c == null) { sender.sendMessage(ChatColor.RED+"No coupons found."); return; } else { sb.append(ChatColor.DARK_PURPLE+"Coupon list: "+ChatColor...
2dcc32af-976f-4205-be85-93172ac446d4
6
@Override public void batchInsertArtificialData(String tableName, List<String> columnNames, List<List<String>> datas, String DB_NUM) throws CustomerizedException{ String sqlInsert = ""; String columnNamesStr = ""; String values = ""; //build insert SQL int count = 0; for(String columnName:columnNames){ ...
bf9cc168-fa34-42dc-bee5-2d1a5557af9b
5
private static void evaluateAddress() { boolean notNull = (remoteAddress != null); if (notNull) { boolean nonEmpty = !(remoteAddress.equals("")); boolean containsOnlyLetters = true; for (int i = 0; i < remoteAddress.length() && containsOnlyLetters; i++) { ...
f336fc47-af6d-4c30-8740-c1f3ca59bdf9
5
public void Animate() { if (hit > 0) { hit--; } if (hit >= 2) { target.room = level.rooms.elementAt(58); target.charge = 0; if (target.InternalRoom != null) { Room room = target.InternalRoom; if (room.wires.size() > ...
a7e27592-f29b-460d-b574-de0a3953ceb5
0
private void retrieveAllOrders() { this.allOrders = this.adminFacade.getAllOrders(); this.size = this.allOrders.size(); }
71dc2af9-dfb0-4b5c-a8fb-3b3c88b935fa
4
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { List<String> fouten = new ArrayList<>(); BigDecimal percentage = null; try { percentage = new BigDecimal(request.getParameter("percentage")); if (percentage.compareTo(BigDecimal.ZERO) <...
a9ed35e3-7368-461a-a83a-dd8b83fdb6a0
2
public String getGeneName() { // Try 'gene'... String geneName = get("gene"); if (geneName != null) return geneName; // Try 'gene'... geneName = get("gene_synonym"); if (geneName != null) return geneName; return getGeneId(); }
35e00553-a957-4256-acbd-834df81c6ea0
6
public static String escape(String string) { char c; String s = string.trim(); int length = s.length(); StringBuilder sb = new StringBuilder(length); for (int i = 0; i < length; i += 1) { c = s.charAt(i); if (c < ' ' || c ...
530afb4b-d352-4275-9f8d-e65bcc5ffe9b
8
public boolean search(int[][] matrix, int rowStart, int rowEnd, int colStart, int colEnd, int target) { if (rowStart > rowEnd || colStart > colEnd) { return false; } int m = (rowStart+rowEnd)/2; int n = (colStart+colEnd)/2; if (matrix[m][n]==target) { return true; }else if (matrix[m][n]>target) { ...
204bda0c-8011-41f5-bcca-c8c3d500f283
1
public void displayInfo(Message msg){ if(!msg.getSource().equalsIgnoreCase(localhost)){ System.out.println(msg.getContent()); } }
70e0d1c7-deb5-4a5f-8fba-eae4ac48be3b
6
public void serialEvent(SerialPortEvent e) { // Create a StringBuffer and int to receive input data. StringBuffer inputBuffer = new StringBuffer(); int newData = 0; // Determine type of event. switch (e.getEventType()) { // Read data until -1 is returned. If \r is received substitute // \n for ...
77ba2c74-2d74-4f66-b3f6-269263fe9feb
1
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed isAlt = !isAlt; if( isAlt==true ){ pressSystemKey(KeyEvent.VK_ALT); jButton7.setBackground(Color.black); jButton7.setForeground(Color.white); } else{ releaseSys...
7f0ebb03-9ae9-4947-ad0c-cb63e1b85310
8
public static boolean modifyRow (Object bean, String field) { PreparedStatement stmt = null; try{ if(bean instanceof Patient){ return modifyPatient((Patient)bean, stmt, field); } if(bean instanceof Employee){ return modifyEmployee((Employee)bean, stmt, field); } if(bean instanceof Drug)...
b7db24f6-cc0e-48b8-ab31-ed67b16740a7
9
public void process() { if( status == ANIM_PLAY ) // selection cursor animation, loopeable if( System.currentTimeMillis() - timer > delay ) { if( loop ) { if( play_backwards ) frame--; else frame++; ...
9e13eed2-0e89-4edc-b0e1-f58173715288
5
private int readNumberToken(char current, int offset, String formula, List<Token> parts) { int end = offset + 1; boolean pointSeen = current == '.'; while (end < formula.length()) { char next = formula.charAt(end); if (Character.isDigit(next)) { end++; ...
1c54ef92-17b2-4052-b068-8c76e3b25c87
8
public static void main(String[] args) { File[] files = null; if (args.length > 0) { files = new File[args.length]; for (int i = 0; i < args.length; i++) files[i] = new File(args[i]); } else { JFileChooser chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(true); File cwd = new F...
13fe22b4-9f2b-4f47-bcce-0095c12d93bd
0
public JFrame getFrame() { return frame; }
e432dcc4-50d4-40e3-a418-c9704529fece
6
public static void find (File dir) { File[] list = dir.listFiles(); Arrays.sort(list); for (File f : list) { if (f.isDirectory()) { if (f.getName().equals(".hg")) { final MercurialRepository rep = new MercurialRepository(f); SwingUtilities.invokeLater(new Runnable() { @Override pub...
bdb21756-c74a-4312-b104-7f02d4890287
5
@SuppressWarnings( "unchecked" ) public DefaultUmlDiagram toDiagram( UmlDiagramData data, DefaultUmlDiagramRepository repository ) { Graph graph = new Graph(); DefaultUmlDiagram diagram = new DefaultUmlDiagram( graph, repository ); diagram.setCurrentUniqueId( data.getNextUnqiueId() ); for( Data<?> itemData : ...
4c05ce27-b848-47ea-811e-0a08a425ca30
8
private void onMessage(String msg) { // TODO call the callback obj in case of callback. If not send call the // method! JSONObject json = JSONObject.fromObject(msg); if (!json.has("callback")) { System.err.println("No callback: " + msg); return; } ...
5dd1d60d-cb64-448a-ab41-76f22cf6909e
8
public void drawGenbankAnnotations( Graphics g) { this.colorIndex = 0; int yOffset = 3; g.setFont(new Font("SansSerif", Font.BOLD, 12)); if( genbankAnnotationList == null || ! showGeneAnnotations) return; int leftBorder = selectedYAxis.isDisplayed() ? selectedYAxis.getNumPixelsReserved() :0; in...
188e35e6-57b0-4889-83e4-43e9ef4bc413
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 PlanoTrabalho)) { return false; } PlanoTrabalho other = (PlanoTrabalho) object; if ((this.id == null && other.i...
0a5d541b-2ebe-483e-84bd-6edf5098665c
7
@Override public Object getWatcher() { Class<?> watcher_class = Util.getCraftClass("DataWatcher"); Object watcher = null; try { watcher = watcher_class.newInstance(); Method a = Util.getMethod(watcher_class, "a", new Class<?>[] { int.class, Object.class }); a.setAccessible(true); a.invoke(watcher, ...
96782f4e-6abf-48de-adea-74f6ee35a98c
6
private ArrayList<Class<?>> getClasses(String jarFile) throws IOException { jar = new JarFile(jarFile); Enumeration<JarEntry> entries = jar.entries(); URL[] urls = { new URL("file:" + in) }; classLoader = new URLClassLoader(urls); ArrayList<Class<?>> classes = new ArrayList<...
58080d13-96b5-48d6-9f5f-f016fb7b0bcf
5
private String createXMLString(ArrayList<String[]> data) { Date today = new Date(); SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); String updated = fmt.format(today); String xml = "<?xml version='1.0' encoding='UTF-8'?>\n" + "<registry xmlns='www.iana.org/assignments/port-numbers' id='ports'>\n...
45a3cdd6-770d-4979-a9f8-9b330d179d92
8
public void action() { //try to follow near the wall PilotProps pp = new PilotProps(); try { pp.loadPersistentValues(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } float wheelDiameter = Float.parseFloat(pp.getProperty(PilotProps.KEY_WHEELDIAMETER,...
cdc5faa8-e1c0-47d9-b379-3ff9e4025d33
0
@Override public void init(List<String> argumentList) { numberOfArguments = Integer.parseInt(argumentList.get(0)); }
e8df70d9-5889-474d-94ca-cc28981fb03b
5
public static void main(String args[]){ int op; do{ System.out.println("1- Agregar Plan"); System.out.println("2- Cobrar Plan"); System.out.println("3- Imprimir Detalle"); System.out.println("4- Cliente Viejo"); System.out.println("5- ...
2cf0a6fd-a565-4dd7-b1c7-4c084903e3ad
8
public static int[] [] nextState(int [] [] currentCells){ int [][] nextState = new int[n][n]; for(int i = 0; i<n; i++){ for(int j = 0; j<n; j++){ int neighbourcells = 0; neighbourcells = currentCells[i+1][j] + currentCells[i+1][j+1]+ currentCells[i+1][j-1]+ currentCells[i][j-1]+ currentCells[i-1][j-1]+ ...
9f53e644-4ddd-47e0-991c-524520874134
6
public static Stella_Object accessBooleanVectorIndexNodeSlotValue(BooleanVectorIndexNode self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Logic.SYM_LOGIC_TRUE_LINK) { if (setvalueP) { self.trueLink = ((BooleanVectorIndexNode)(value)); } else { value ...
f7704836-954a-4a96-8011-679ccd97cd36
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...
1470e322-8d41-4f5d-8c1c-f620a5b77928
3
private void exploreJar(File jar) throws IOException { HashMap<String, ClassInfo> db = new HashMap<String, ClassInfo>(); ZipFile zip = new ZipFile(jar, ZipFile.OPEN_READ); Enumeration<? extends ZipEntry> en = zip.entries(); while(en.hasMoreElements()) { ZipEntry e = en.nextElement(); if(e.getName().endsWi...
1857b38c-ad29-408d-9897-9860db207c31
7
public void adjCharStats(Object[] changes, CharStats charStats) { if(changes==null) return; for(int i=0;i<changes.length;i+=2) { if(changes[i] instanceof Integer) charStats.setStat(((Integer)changes[i]).intValue(),charStats.getStat(((Integer)changes[i]).intValue())+((Integer)changes[i+1]).intValue()); ...
cb7b4113-3b61-4a03-ac8c-8b37df036d11
7
@Override public IoSession newSession(SocketAddress remoteAddress, SocketAddress localAddress) { if (remoteAddress == null) { throw new NullPointerException("remoteAddress"); } if (localAddress == null) { throw new NullPointerException("localAddress"); ...
82c563d0-af64-4808-b0a1-68134c1b2ce5
9
public String strStr(String haystack, String needle) { if (needle.length() == 0 || needle.equals(haystack)) return haystack; if (needle.length() > haystack.length()) return null; int hLen = haystack.length(); int nLen = needle.length(); ...
eb1b2cb2-65d4-4e79-8112-a225d089f071
1
public void visit_jsr(final Instruction inst) { if (longBranch) { addOpcode(Opcode.opc_jsr_w); addLongBranch((Label) inst.operand()); } else { addOpcode(Opcode.opc_jsr); addBranch((Label) inst.operand()); } stackHeight++; }
a383dd56-9d36-497a-95e5-4bfdcce8faa6
3
static void preprocess(char[] p) { int i = 0, j = -1, m = p.length; b[0] = -1; while (i < m) { while (j >= 0 && p[i] != p[j]) j = b[j]; b[++i] = ++j; } }
6b35b664-b253-4d90-909e-fd52f173520d
5
private void lireFichierTexte(String nom) { try { BufferedReader aLire=new BufferedReader(new FileReader(nom)); String infos=aLire.readLine(); int i=0;; String t=""; int j=0; Interface.CODES[] val= Interface.CODES.values(); boolean trouve=false; while(infos.charAt(i)!=' ') { t+=infos.charA...
22500059-d718-470d-975d-fea8821efaca
9
private boolean evaluateDelayClause(String str) throws InterruptedException { if (str.matches(REGEX_NONNEGATIVE_DECIMAL)) { float sec = Float.valueOf(str).floatValue(); int millis = (int) (sec * 1000); while (!stop && millis > 0) { try { Thread.sleep(millis > DELAY_FRACTION ? DELAY_FRACTION : millis...
40499aff-43ea-4ce3-b607-affddea53c41
2
public TesteFisica() { setDoubleBuffered(true); vertices.add(new Point(pos.x - 30, pos.y - 100)); vertices.add(new Point(pos.x - 120, pos.y + 100)); vertices.add(new Point(pos.x + 75, pos.y + 300)); vertices.add(new Point(pos.x + 150, pos.y + 100)); vertices.add(new Point...
fa1eb36e-1fe2-4f77-a82d-686999612e2d
4
private int[] getVal(String value) { int[] myVal = new int[2]; // count for {my symbol, enemy symbol} String[] path; for (int counter = 0; counter < 2; counter++) { if (counter == 0) path = value.split(String.valueOf(enSymbol)); // count the possibility for my symbols else path = valu...
81a7acc1-cb43-4a40-a28c-27cbeadfaa91
0
public double getG() { return G; }
20376543-5f74-47d4-ae34-512f632fc73d
2
public static void main(String args[]) { int total = 338614; int limit = 22574; long begin = System.currentTimeMillis(); ExecutorService executorService = Executors.newFixedThreadPool(total / limit); for (int i = 0; i <= total / limit; i++) { SetAuthoRelation_Out test = new SetAuthoRelation_Out(i * lim...
b53aee4e-5023-40ab-ae28-281f6e2b61ba
3
public void preguntarNumeroDeCiclos(Main framePrincipal) { boolean isRespuestaValida; do { String respuesta = JOptionPane.showInputDialog(framePrincipal, "Ingrese el número de ciclos máximos con el\n" + "que desea limitar el algoritmo", "15"); try { ...
e64f1ede-6de0-41c9-bf15-427938330d27
3
@Override public String execute() throws Exception { try { Map session = ActionContext.getContext().getSession(); setUser((User) session.get("User")); email = getUser().getEmailId(); UserDetails used = new UserDetails(email, getUser(), fname); ...
e7c23a57-a6ba-44ee-bda2-60964871c69a
4
public String getAsHexString(){ int r, g, b, a; if(this.r == -1 || this.g == -1 || this.b == -1 || this.a == -1){ r = this.getRed(); g = this.getBlue(); b = this.getGreen(); a = this.getAlpha(); }else{ r = (int) (this.r * 255); g = (int) (this.g * 255); b = (int) (this.b * 255); a = (in...
c8bd1236-39ed-4813-9b41-d1b3d81b944a
9
public static void main(String[] args) { Store store = new Store(); int opcao; String confirm, login, password; Scanner in = new Scanner(System.in); String nomeProduto; System.out.println("Bem vindo a Virtual Store.\n\n"); System.out.println("Login:"); login = in.next(); System.out.println("Senh...
c1c75d19-e43f-4a7b-9634-e330471c0724
4
public void partitionHelper(int end) { if (currentCut > minCut) return; if (end == 0) { minCut = currentCut; return; } for (int i = 0; i < end; i++) { if (isPal[i][end - 1]) { currentCut++; partitionHelper(...
2e439393-dd6d-43f9-aec9-38c17b1dde5a
4
private List<?> createArrayContainer(ContainerFactory containerFactory){ if(containerFactory == null) return new JSONArray(); List<?> l = containerFactory.creatArrayContainer(); if(l == null) return new JSONArray(); return l; }