method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
fb2fbdbd-dfb7-4f88-8c27-0ae2c63802c1
6
public Component getComponentForDataSection(TaskObserver taskObserver, String dataSectionName) throws InterruptedException { if (dataSectionName == DATA_SECTION_UNKNOWN0) { return getGeneralPanel(taskObserver); } else if (dataSectionName == DATA_SECTION_VISIBLE_MAP) { return getVisibleMapPanel(taskO...
58216063-c5d6-4bf9-ac72-cab373dcb977
7
public void play() { try { Synthesizer synth = MidiSystem.getSynthesizer(); synth.open(); final MidiChannel[] mc = synth.getChannels(); Instrument[] instr = synth.getDefaultSoundbank().getInstruments(); synth.loadInstrument(instr[80]); long initial = System.currentTimeMillis(); float tempoFactor ...
5616169d-6276-458b-96d8-469465342e6f
4
public String toString() { String board = ""; for (int i = 1; i <= this.ty; i++) { board = board + "|"; for (int j = 1; j <= this.tx; j++) { board = board + this.counterToString(getPosition((j), (i))); } board = board + "|" + "\n"; } board = board + "+"; for (int h = 1; h <= this.tx; h++){ ...
dd53fead-32d4-40e3-a5a2-e1ebfd06bbbc
1
public ICommand getCommand() { String commandName = UrlUtil.getCommandName(commandParameter); ICommand command = commandMap.get(commandName); if (command != null) { return command; } return new UnknownCommand(commandParameter); }
6b47674a-6c7f-400b-96f4-0dee49ad70a3
8
public synchronized void addCompiledQueryMix(CompiledQueryMix cqMix) { int[] cRunsPerQuery = cqMix.getRunsPerQuery(); double[] cAqet = cqMix.getAqet(); double[] cAvgResults = cqMix.getAvgResults(); double[] cAqetg = cqMix.getAqetg(); double[] cQmin = cqMix.getQmin(); double[] cQmax = cqMix.getQmax(); int[...
6daf1f72-dc36-407a-b7f2-c2219e254e3c
2
@Override public void run() { byte[] buffer = new byte[1024]; int read; try { while((read=inputStream.read(buffer)) != EOF) { outputStream.write(buffer, 0, read); } } catch (IOException e) { e.printStackTrace(); } ...
1b3f3ea4-b74c-4c9a-8553-ad1b98a500e3
5
public boolean setWarp(CommandSender cs, Command label, String string, String[] args) { Player player = (Player) cs; if (player.hasPermission("warpsandports.warp.add") || player.isOp()) { if (args.length == 0) { player.sendMessage(ChatColor.RED + "Correct use is " + ChatColor.AQUA + "/wnp warp add <...
eb0ffd22-08a7-4b17-b514-1bb26828b16b
1
public void create(Activity activity) throws DuplicateInstanceException { if (!activities.contains(activity)) { activities.add(activity); Persistence.getInstance().save(); } else { throw new DuplicateInstanceException(activity, "Activity"); } }
610c3633-b16d-472f-86b4-ee5e24acfdad
4
public static void connect(TreeLinkNode root) { if (null == root) return; TreeLinkNode parent = root; TreeLinkNode node = null; while (null != parent.left) { node = parent; while (null != node) { node.left.next = node.right; if (null != node.next) no...
a8cf7f85-49e5-46bf-bdec-9ca2547ec3a2
0
public void setCipherReference(CipherReferenceType value) { this.cipherReference = value; }
31fffcf3-599c-4fe5-973e-72be299cd37e
1
public ArrayInit getInitializer() { ASTree t = getRight().getRight(); if (t == null) return null; else return (ArrayInit)t.getLeft(); }
8b358021-b734-4d5f-9715-1ab0c7b023b1
8
public void expandNode(int count) { for(int a = 0; a < (caseSize - 1); a ++) { cost = 15000; if(a == 0) { tour.add(vertices.get(vertexCount)); v1 = tour.get(0); } specifiedEdges = graph.getEdges(v1); Iterator<Edge> myIter = specifiedEdges.iterator(); while(myIter.hasNext()) { ...
9e216b81-eb18-4601-b7cd-9edb9ba84897
6
public static String numberToString(Number number) throws JSONException { if (number == null) { throw new JSONException("Null pointer"); } testValidity(number); // Shave off trailing zeros and decimal point, if possible. String string = number.toString(); ...
2b054fbe-2126-449d-a710-889fe637439d
0
public List<String> findWords(String wordnum) { /*for(Map.Entry e : dictionary.entrySet()) { System.out.println(e.getKey() + " -> " + e.getValue()); }*/ return dictionary.get(wordnum); }
3458e5e1-d0fc-4f53-ab82-e50c9c8845fc
1
public void restore() { if (mMaximizedContainer != null) { mMaximizedContainer.getHeader().adjustToRestoredState(); mMaximizedContainer = null; getLayout().forEachDockContainer((dc) -> dc.setVisible(true)); revalidate(); repaint(); } }
49ab9dfc-567e-41fb-ae2f-356e0b45f72a
2
public static int remainingPokemon(Pokemon[] p, int numOfPokemon) { int temp=0; for(int i=0; i<numOfPokemon; i++) { if(isAlive(p[i].health)) { temp++; } } return temp; }
2101b2b1-3f10-4ea7-9d60-7ba0cadec320
3
private void updatePrimeSugar(String name, String unit) { if (dontUpdate == false) { PrimeSugar newF = new PrimeSugar(); List<PrimeSugar> ar = Database.getInstance().primeSugarDB; for (int i = 0; i < ar.size(); i++) { if (name.equals(ar.get(i).getName())) { newF = (PrimeSugar)ar.get(i); } } ...
fd6902e1-13f6-41c2-8622-51ce179c7823
3
public static float fixAoLight(float light, float defLight) { if (Config.lightLevels == null) { return light; } else { float level_0 = Config.lightLevels[0]; float level_1 = Config.lightLevels[1]; if (light > level_0) { return light; ...
65a82eb2-17b9-4f23-be6b-bd519ebb5152
7
private String readElement(List<String> operators, List<String> operands, String s, int i) { String s2 = s.substring(i).trim(), ret = ""; for (String tmp: operands) { if (s2.startsWith(tmp) && tmp.length() > ret.length()) { ret = tmp; } } if (ret.equals("")) { for (String tm...
bba3ec6d-12ec-4a27-acc0-e439079d1129
8
protected void showMainScreen (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // set the encoding, otherwise database is encoded wrongly request.setCharacterEncoding("UTF-8"); HttpSession session = request.getSession(); AdminUnitVM formData = (AdminU...
e372a825-1ca9-400e-a592-75dc6914ffb7
4
@SuppressWarnings("unused") private boolean canReachBackwards( Node from, Node to, int version ) { while ( from != null && from != to ) { Arc a = from.pickIncomingArc( version ); if ( a.versions.cardinality() != 1 ) return false; if ( from != null ) from = a.from; } return from == to; }
bd315436-9326-49c7-b0f6-ad138af8c7a6
0
public Component getLastComponent(Container container) { return m_Components[m_Components.length - 1]; }
7e9a97a4-cf86-46e3-bf1d-db6c55a3e592
3
public void closeBrace() { if ((Options.outputStyle & Options.BRACE_AT_EOL) != 0) println("}"); else { println("}"); if ((Options.outputStyle & Options.BRACE_FLUSH_LEFT) == 0 && currentIndent > 0) untab(); } }
9c640282-d55e-4779-bfe3-80ccf73227ef
8
public void paintComponent(Graphics g) { if (m_fainted) { g.drawImage(m_image, 0, 0, null); return; } updateIcon(); Graphics2D g2 = (Graphics2D)g.create(); if (m_pokemon.getState() == State.FAINTED) { BufferedIma...
a0f3e490-d6c2-4661-9c41-36daf6148f44
4
public Tile getTile(int x, int y){ if (x >= 0 && x < map[0].length){ if (y >= 0 && y < map.length){ return map [y][x]; } } return null; }
8f662763-adf6-4d53-9ae0-f6966a9dd7c3
9
private void callSetter(Object target, SimpleProperty property, Object value) throws SQLException { Class<?>[] params = property.getWriteParameterTypes(); try { // convert types for some popular ones if (value != null) { if (value instanceof jav...
ea9d6d28-f51b-4345-93e2-5cd252422389
9
public boolean excludeClass(Class<?> clazz, boolean serialize) { if (version != Excluder.IGNORE_VERSIONS && !isValidVersion(clazz.getAnnotation(Since.class), clazz.getAnnotation(Until.class))) { return true; } if (!serializeInnerClasses && isInnerClass(clazz)) { return true; } ...
58956332-6549-4574-b44a-0b8bda4eec70
6
public static void main(String[] args) { readData(); calculateAverageRatings(); // Calculate mahalanobis distance for each user try { b = new BufferedReader(new FileReader(fileDirectory + dataFile)); File base = new File(outputDirectory + fileName); if (!base.exists()) base.createNewFile(); F...
7a112dbb-a4f4-4b31-a558-a75ca18320c6
2
public Game readGameInfo() { String fileName = "saveFile.txt"; // Without a directory, it will look // to the project's directory. File currentSaveFile = new File(fileName); /* * Major Scanner Methods: .next() returns next string separated around * white space. .nextLine() returns the next line...
21d4dd84-947b-4b8c-bc78-afeb4d9ab044
6
public List<Street> createStreets(Map<String, OSMNode> nodes, List<OSMWay> osmWays, boolean isDirected) { List<Street> streets = new ArrayList<Street>(); int count = 0; // generate the streets for (int i = 0; i < osmWays.size(); i++) { OSMWay thisStreet = osmWays.get(i); List<String> refs = this...
027f68b7-faf9-41df-a41f-cb14f67e573e
1
public boolean isNewerThan(PluginVersion installedPlugin) { if (major == installedPlugin.major) { return minor > installedPlugin.minor; } return major > installedPlugin.major; }
d5dc8c17-2cf0-4826-8497-b08bc8737816
5
private int Loop254(int valu, int index){ String ip; if(!catalogue.getmanualServer()) { ip = Server.getServer((String)serverlist.get(valu)).getPort() + Server.getServer((String) serverlist.get (valu)).getIp().toString(); } else{ ip = "111.111.1...
fcb42cd0-4400-4930-9b4f-5910e7e5d211
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...
fd063002-1b97-44ea-8d71-3a3390a5308e
0
public String getEmail() { return email; }
fb64960c-cd12-4b7f-b47d-c3d8b385c45c
3
@Override public GameState[] allActions(GameState state, Card card, int time) { GameState[] states = new GameState[1]; states[0] = state; if(time == Time.DAY) { states[0] = VoodooDay(new GameState(state), card, false); } else if(time == Time.DUSK) { PickTreasure temp = new PickTreasure(); sta...
de5e9ee6-2443-41b1-ac17-bbc854d09565
2
public void add(final String path, final Object rule) { String pattern = path; if (path.startsWith("*/")) { pattern = path.substring(1); lpatterns.add(pattern); } else if (path.endsWith("/*")) { pattern = path.substring(0, path.length() - 1); rpatterns.add(pattern); } rules.put(pattern, r...
29b4829f-d689-4618-afa8-3a80fb646d5e
8
public Ground(Stage game, int x, int y, int width, int height, GroundType groundType, Theme theme) { super(game, x, y, width, height, "/images/groundObjects.png"); switch (theme) { case NORMAL: yAs = 0; break; case SNOW: yAs...
4d05d9a3-d1ef-47da-aaa6-ac21a5da7b13
8
@Override public String toString() { String typ = "Illegal"; switch (type) { case TYPE_COMPLETE: typ = "Complete"; break; case TYPE_ERROR_RECIEVE: typ = "ErrorRec"; break; case TYPE_ERROR_SEND: typ = "ErrorSend"; break; case TYPE_NEW: typ = "New"; break; case TYPE_PENDING: typ...
b99a5666-1abd-4d7e-9b43-87a5d658adb3
7
@Override public boolean canSetTrapOn(MOB mob, Physical P) { if(!super.canSetTrapOn(mob,P)) return false; if(mob!=null) { final Item I=findMostOfMaterial(mob.location(),RawMaterial.MATERIAL_ROCK); if((I==null) ||(super.findNumberOfResource(mob.location(),I.material())<100)) { mob.tell(L("You'...
7eea800b-101c-4e0f-98f1-c6331c089bc0
7
public ListNode insertionSortList(ListNode head) { if(head==null||head.next==null){ return head; } ListNode newHead = null; ListNode curOld = head; ListNode curNew = null; boolean first = true; while(curOld!=null) { ListNode cur = curOld; ListNode pre = curOld; ListNode minCur = null; Lis...
a34c5890-d252-4cca-9b89-401cd1d2f929
6
@EventHandler public void ZombieWaterBreathing(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.getZombieConfig().getDouble("Zombie....
a8a320b2-2602-4be0-ab6f-e4a098b2c960
1
@Override public Iterator<?> getPrefixes(String namespaceURI) { return null; }
ed9bd9fc-740a-4405-89b6-6dbb4e8fd2cd
1
public static EntityLiving createEntityFromUIN(String s, TileMap tm, World world){ switch (s) { case PIG: return new EntityPig(tm, world, PIG); } return null; }
a8a224f6-728a-484b-b250-73c06e101aef
7
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; User user = (User) o; if (id != user.id) return false; if (!email.equals(user.email)) return false; if (!login.equals(user.login)) retu...
17acbbc8-75f9-4dc7-9e7d-ecb90cc54551
0
public void setPcaPrecioVenta(Integer pcaPrecioVenta) { this.pcaPrecioVenta = pcaPrecioVenta; }
7b4f0a97-77c0-4978-a8e1-7dfa8633a2cc
1
public void testEra() { assertEquals(1, IslamicChronology.AH); try { new DateTime(-1, 13, 5, 0, 0, 0, 0, ISLAMIC_UTC); fail(); } catch (IllegalArgumentException ex) {} }
41204826-dba0-4599-af9e-59b46d739f50
2
public static List<Service> selectService() throws SQLException { String query = null; List<Service> services = new ArrayList<Service>(); ResultSet resultat; try { query = "SELECT * from SERVICE "; PreparedStatement pStatement = (PreparedStatement) ConnectionBDD...
f58422de-b746-4d7f-bfc8-7f6cb91b2cf7
8
public static void main(String[] args) { InputStream in = StreamTokenizerMain.class.getResourceAsStream("content.txt"); BufferedReader br = new BufferedReader(new InputStreamReader(in)); StreamTokenizer token = new StreamTokenizer(br); token.ordinaryChar('\''); // 单引号 's token.ordinaryChar('\"'); // 双引号 "...
44075388-facd-47fc-b6d5-69f10c8ac293
0
public Date getDateFrom() { return dateFrom; }
9b648761-4a52-4d3f-9328-1c935196e26e
7
public boolean sendData(Object data) { if (output == null || !socket.isConnected()) { return false; } synchronized (this) { try { output.flush(); output.writeObject(data); output.flush(); output.reset(); ...
514ce9e4-a00c-4767-a28f-06fb6a88f3b6
9
public static Geodesic getDivideAndConquerGeodesicNoCommonEdges(PhyloTree t1, PhyloTree t2) { Bipartition minEl; PhyloTree newT1 = null; Geodesic geo = null; Geodesic potentialGeoToReturn = null; RatioSequence rsForPotentialGeoToReturn = null; Vector<Bipartition> m = t2....
d9d6f01b-63c4-480c-8ac6-ddf600d79dc5
6
@SuppressWarnings("unchecked") @Override public String displayQuestionWithAnswer(int position, Object userAnswer) { ArrayList<String> questionList = (ArrayList<String>) question; String questionStr = questionList.get(0); ArrayList<String> answerList = (ArrayList<String>) answer; ArrayList<String> userAnswerLi...
5b006f19-b951-467d-8cb5-cdfba04925be
9
private boolean isNotEmpty(){ if(fName.equals("")||lName.equals("")||phone.equals("")||email.equals("")||addr.equals("")||city.equals("")||state.equals("")||ZIP.equals("")||date.equals("")){ JOptionPane.showMessageDialog(null,"Please fill out all fields.","Error",JOptionPane.WARNING_MESSAGE); return false; }e...
f1a82db8-5dea-49b5-b8aa-4846de114ec0
8
public static <T extends BaseEntity> List<T> toJsonList(Object params, Class<T> clz, String key) { List<T> results = new ArrayList<T>(); if (params instanceof Map) { Map<String, Object> result = (Map<String, Object>) params; if (!ApiUtil.isEmpty(result.get(key))) { if (result.get(key) instanceof List) {...
e73dfb32-53e2-4d45-9cf6-e2411045d70f
6
public boolean declareVariable(String variableName, Object value){ if (value instanceof Boolean){ addFlag(variableName, (Boolean)value); return true; } for(String p : variableList.keySet()) if (p.equals(variableName)) return false; if (!(value instanceof String) && !(value instanceof Integer) &...
6f5d644f-61b5-4e7d-a746-e8c3736751ef
6
public void spawnEnemies(int n) { Patch spawnPoint; int m = (int) (n * .2); int failsafe = 42; while (n > 0 && failsafe > 0) { spawnPoint = enemySpawnPoints.get((int) (Math.random() * enemySpawnPoints.size())); if (spawnTurtle(spawnPoint.getX(), spawnPoint.getY(),...
ed0c1c1b-3f84-4591-a512-f8fcac2817d6
4
private int setTab(TimeFilter filter){ switch(filter){ case TODAY: return 1; case TOMORROW: return 2; case THIS_WEEK: return 3; case OLD: ...
49b74afa-5aab-461f-b07b-82e9b4a19b42
5
@Test public void testPersistencyHandler() { PersistencyHandler ph = PersistencyHandler.getInstance(); ph.loadDb(); try { ph.write(new PersistentMusic("/home/andreluiz/a.mp3")); ph.write(new PersistentMusic("/home/andreluiz/b.mp3")); ph.write(new PersistentUser("andrelgsl@gmail.com", "1234", 2...
1eaa656f-08c5-453a-a802-b08da0f927db
0
public int getStreamStartTime() { return liveTime; }
025eab1c-7b75-432c-b9a6-a5c08af8e288
3
public void doFilter(ServletRequest sRq, ServletResponse sRp, FilterChain chain) throws IOException, ServletException { try { sF.getCurrentSession().beginTransaction(); chain.doFilter(sRq, sRp); sF.getCurrentSession().getTransaction().commit(); sF.getCurrentSession().close(); } catch (Throwable e) {...
4bda6253-2ac2-4b15-bc39-37662d7c3970
4
@Override public Class<?> getColumnClass(int columnIndex) { Class retorno =null; switch(columnIndex){ case 0: retorno = Integer.class; break; case 1: retorno = String.class; break; case 2: retorno = String.class; break; } return retorno; }
2f779061-8725-4914-a5cf-6ca322424b50
9
protected ObjectInstantiator newInstantiator (final Class type) { if (!Util.isAndroid) { // ReflectASM. try { final ConstructorAccess access = ConstructorAccess.get(type); return new ObjectInstantiator() { public Object newInstance () { try { return access.newInstance(); } catch ...
e52611e1-8410-472f-87a8-7bf49125bad4
9
protected static String calculateMD5ForSong(final Song aSong, final FindDuplicateOption aOption, final HashCalculator aCalculator) throws Exception { aCalculator.resetInit(); if (aOption.isAlbum()) { aCalculator.updateHash(String.valueOf(aSong.getAlb...
7b95f580-c4be-4d44-af70-8ae9b717729d
5
public void controlarMenuInicial() { int opcao = 10; while(opcao >3 || opcao <1) { opcao = tela.menuInicial(); switch(opcao) { case 1: controlarNovoJogo(); break; case 2: controlarDadosPartidas(); break; case 3: tela.mostrarMenuSair(); break; default: tela.opca...
858f96cb-3e19-47a9-9c2c-9ed2fba49faa
6
public void run () { while (true) { Socket s = null; boolean connected = false; try { s = new Socket(Unity.ip, Integer.parseInt(Unity.port)); connected = true; } catch (Exception e) { } finally { if (s != null) { try { s.close(); } catch(IOException ...
751b6f2f-5412-490d-9069-a4605d9cf41b
1
public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); new AuthFrame(); } catch (...
78238805-08ac-410f-86ec-f8b9c636f124
7
public void drawValues(Graphics g, String s, double hs) { if (s == null) { return; } g.setFont(unitsFont); FontMetrics fm = g.getFontMetrics(); int w = fm.stringWidth(s); g.setColor(whiteColor); int ya = fm.getAscent() / 2; int xc, yc; ...
afd99b30-ce2c-4a0a-8fcf-9cae0cf8056f
4
private JMenuItem getWithName(JMenu menu, String name) { int numOfItems = menu.getItemCount(); JMenuItem menuItem = null; for(int i = 0; i < numOfItems; i++) { JMenuItem item = menu.getItem(i); if(item == null) { continue; } if(item...
db8c5fc0-c980-4bcd-a13d-a965d7f5d77c
3
@Override public C next() { while (toVisit.size()>0) { // Go thru the current nodes BinarySearchTree.Node<C> n = toVisit.pop(); // Add non-null children if (n.lesser!=null) toVisit.add(n.lesser); ...
1afa900f-6348-4aff-a6d1-9d789051792c
0
public Car(int serialNumber) { //super(serialNumber); System.out.println("Car constructor"); }
9c207208-9a17-4100-8748-915d7afd84fb
1
@Override public byte[] getHTTPMessageBody() { try { return Files.readAllBytes(Paths.get(serverViewsDirectory + "/404.html")); } catch (IOException e) { e.printStackTrace(); } return "File Could Not Be Read".getBytes(); }
0f37ddcd-c52a-4734-a30c-d81715f2306b
7
@Override public void configure(ResourceInfo resourceInfo, FeatureContext context) { Collection<String> requiredRoles = new ArrayList<>(); Class<?> resourceClass = resourceInfo.getResourceClass(); Method method = resourceInfo.getResourceMethod(); if(resourceClass.isAnnotationPresent(RequiresRoles.cla...
1a0d8574-4e35-4d0f-893b-6d313aa69332
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final TipoLogradouro other = (TipoLogradouro) obj; if (this.idTipoLogradouro != other.idTipoLogradouro && (this...
e7ecb8a6-a827-4a57-9233-78ed49253bae
5
public Double columnMin(int col) { if (!isContinuous(col)) { throw new MLException("Cannot calculate the min of a non-continuous column"); } boolean allUnknownValues = true; Double min = Double.MAX_VALUE; for (List<Double> row : data) { double val = row.ge...
4ddeae17-fcd2-409c-9d4f-c14c9a056e27
8
public List<Integer> getRow(int rowIndex) { rowIndex++; if (rowIndex == 0) { return Collections.emptyList(); } else if (rowIndex == 1) { List result = new ArrayList<>(); result.add(1); return result; } int[] r = new int[rowIndex]; ...
7597bc47-eebc-4305-90dd-f62306391d2b
0
public String getName() { return name; }
4f639d28-d5cc-447a-9f6c-eadbe13ea73c
4
static String[] split(String foo, String split){ if(foo==null) return null; byte[] buf=Util.str2byte(foo); java.util.Vector bar=new java.util.Vector(); int start=0; int index; while(true){ index=foo.indexOf(split, start); if(index>=0){ bar.addElement(Util.byte2str(buf, start, ...
6fa20d9b-16c6-45f0-8dfe-750878bb0e05
6
@Override @SuppressWarnings("rawtypes") public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } if (getClass() != obj.getClass()) { return false; } AbstractRectangularPuzzle other = (AbstractRectangularPuzzle) obj; if (height != other.he...
2990fd67-449c-4a23-bba9-4fb514c081b7
7
public List<String> getmenuItemsProduct() { List<String> menuItemsProduct = new ArrayList<String>() { private static final long serialVersionUID = 3109256773218160486L; { try { //Connect to database conn = DriverManager.getConnec...
24c3a083-5825-443d-85a2-a8e99a3939bd
4
public <T extends AstronomicalObject> String stringInnerObjects(Class<T> type) { String returnedString = ""; if (type.getName().contains("Satellite")) { List<Satellite> obj = satellites; for (Satellite t : obj) { returnedString += t.deepToString(); } ...
3f2c7db3-78d3-489b-ab06-c54ca3ebecb1
3
public int pop() { if (stacks.size() == 0) return Integer.MIN_VALUE; if (stacks.get(current).isEmpty()) { stacks.remove(current); current--; if (current < 0) { return Integer.MIN_VALUE; } } return stacks.get(current).pop(); }
d64bff66-7938-4699-a820-06ddacfd5edf
3
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Atribuicaoresponsavel other = (Atribuicaoresponsavel) obj; if (!Objects.equals(this.idAtribuicaoResponsav...
70df7998-72a3-4517-9f86-ebf8d5512da6
0
public String getNomeUser() { return nomeUser; }
7f77fd01-a30e-44f9-b7f4-5c569e263e66
5
public ArrayList<Meld> getRuns() throws Exception{ ArrayList<Hand> colouredSets; ArrayList<Meld> runs; ArrayList<Tile> possibleRun; runs = new ArrayList<Meld>(); colouredSets = separateByColour(); for(Hand hand : colouredSets){ hand.removeRedundancies(); hand.sortByNumber(); for(int j=0; ...
2ffc764a-188e-4ef4-abb8-cb48374c8cb7
9
public void setRule(String rulnam, boolean rulact, int rulval){ int rulnumb = getRuleNumber(rulnam); //if(rulnumb == -1){}else{rules[rulnumb] = rulact;} if(rulval == -1){}else{rulevalues[rulnumb] = rulval;} if(rulnumb == 0 && rulact){rules[1] = false;} if(rulnumb == 1 && rulact){rules[0] =...
a1b189e9-2cf1-4e23-ad36-25562a7205a9
1
public static void main(final String[] args) { Map settings = null; try { settings = readSettings(); final String filename = (String) settings.get("csvFile"); final String verbose = (String) settings.get("verbose"); call(filename, Boolean.valueOf(verbo...
5d2dbf25-f9e5-4504-8219-12a851b78891
8
public static ArrayList<Course> fetchCourses() { ArrayList<Course> courseList = new ArrayList<Course>(); Document doc; try { doc = Jsoup.connect(courseURL).get(); System.out.println("Connected to " + URL); } catch (IOException e) { System.out.println("Could not connect to " + URL); return courseLis...
34e1a2a4-f0a1-4fdb-8530-8181a21f86b0
8
@Override public Identity visitLcondition(LconditionContext ctx) { int opType = ctx.op.getType(); Identity left = visit(ctx.e(0)); Identity right = visit(ctx.e(1)); if (left.getIdentityType() != Identity.NUMBER || right.getIdentityType() != Identity.NUMBER) { errOut.println("Condition Error: test value...
fe0d01e3-7e55-41bc-88e2-f73328dd7747
9
private String restInStep1b(String word){ int lw = word.length(); char lastChar = word.charAt(lw-1); if(word.endsWith("at") || word.endsWith("bl") || word.endsWith("iz")){ word = word.concat("e"); }else if(isDoubleEnd(word) && !(lastChar == 'l' || lastChar == 's' || lastChar == 'z')){ word = w...
9070d5ed-eccf-44ed-b5b1-84842904024f
4
@Override public void deserialize(Buffer buf) { name = buf.readString(); breed = buf.readByte(); if (breed < PlayableBreedEnum.Feca.value() || breed > PlayableBreedEnum.Steamer.value()) throw new RuntimeException("Forbidden value on breed = " + breed + ", it doesn't respect the f...
be04e1b3-4689-4b7e-8f5b-dbc74e30453e
9
static int findNextStructureEndAvoidQuotes( final char[] text, final int offset, final int maxi, final int[] locator) { boolean inQuotes = false; boolean inApos = false; char c; int colIndex = offset; int i = offset; int n = (maxi - of...
c702bab1-f24d-4546-ab8b-dbff1a9d09e3
9
private static final void parseAggregateHeader(OMMData data, PrintStream ps, int tabLevel) { dumpIndent(ps, tabLevel); short dataType = data.getType(); ps.println(OMMTypes.toString(dataType)); switch (dataType) { case OMMTypes.FIELD_LIST: { ...
3eb5666d-3201-4a25-a12b-cd0fce6aed90
5
public static void main(final String[] args) { final Map<Long, Integer> map = new HashMap<Long, Integer>(); for (long i = 1; i < 1000000; i++) { int count = 0; long j = i; /* Stop when it gets to 1 and store it */ while (j != 1) { /* If it is even, divide by 2 */ if ((j % 2) == 0) { j /= 2...
00a6af33-7d1d-41c7-8f25-4a72a22a7514
1
public PreferenceBoolean getApplyFontStyleForComments() { if (useDocumentSettings()) { return this.applyFontStyleForComments; } else { return Preferences.getPreferenceBoolean(Preferences.APPLY_FONT_STYLE_FOR_COMMENTS); } }
9e052294-f731-46d0-88b7-3dd6dcb40368
5
public void runStatement(final String rawString) throws IOException, SQLException, SyntaxException { final String inString = rawString.trim(); if (verbosity != Verbosity.QUIET) { out.println("Executing : <<" + inString + ">>"); out.flush(); } currentDecorator.println( String.format("-- output from ...
dd02a448-ba97-4d87-8d68-fa2b10971384
8
public static String toJson(OdeAccess access) { StringBuffer sb = new StringBuffer(1024); sb.append("{ "); boolean first = true; sb.append("\"vertices\":[ "); for (Visode v : access.getVisodes()) { String type = ""; if (v.getType() == Visode.TYPE_LINK) { type = "link"; } else if (v.getType(...
9e35bfb1-f6fb-42e2-ac73-7faf8dcfe3b0
4
public static NodeList getNodeList(Node node, String xpath) { if (node == null) { throw new IllegalArgumentException( "null 'document' arg in method call."); } else if (xpath == null) { throw new IllegalArgumentException( "null 'xpath' arg ...
98ae242c-59cd-4ac9-859b-9e925a35d1bc
1
public boolean removeImportFormat(String formatName) { int index = indexOfName(formatName, importerNames); if (index >= 0) { importerNames.remove(index); importers.remove(index); // Also remove it from the list of formats stored in the preferences Preferences.FILE_FORMATS_IMPORT.remove(index); ...
d712b670-efad-4cee-a01b-66b35554539d
4
public double strategyDistance(double time){ double distance = 0.0; switch(carStatus){ case ACCELERATE: distance = 0.5*(acceleration)*(time*time) + tempSpeed*time; break; case DECELERATE: distance = 0.5*(-acceleration)*(time*time) + tempSpeed*time; break; case STOP: distance = 0.0; break; ...
6b5296fc-96fe-4c23-8214-36a69bc22d82
9
public void _testDumpPropertiesFile() { File file = new File(filename); AudioFileFormat baseFileFormat = null; AudioFormat baseFormat = null; try { baseFileFormat = AudioSystem.getAudioFileFormat(file); baseFormat = baseFileFormat.getFormat(); ...