method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
606f34cf-7adb-488e-99a2-f29ce016692b
8
@SuppressWarnings("unchecked") void readVibFreqs() throws Exception { readLine(); String label = ""; int frequencyCount = parseInt(line); Vector vibrations = new Vector(); Vector freqs = new Vector(); logger.log("reading VIBFREQ vibration records: frequencyCount = " + frequencyCount); ...
d389ffeb-f03f-49b3-8044-57983cc2f3d4
6
@EventHandler public void MagmaCubeHarm(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getMagmaCubeConfig().getDouble("MagmaCube.H...
977af0eb-e553-4280-938d-ff93a3c0e3ef
2
private void addListenerForTabbedPane() { tabbedPane.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { if (tabbedPane.getSelectedIndex() == 1) { leftSidePanel.removeAll(); createLeftSidePanelForUserSettings(); repaint(); } else if (tabbedPane.ge...
b06432bb-30c8-417a-b24c-167a115da2ed
9
@SuppressWarnings("unchecked") public ServiceMethod(Node node) throws Exception { String className = Utilities.selectSingleText(node, "./@c:class", XMLLabels.STANDARD_NAMESPACES); logger.debug("Method class: " + className); this.append = Utilities.selectSingleText(node, "./@c:appendToUrl", XMLLabels.STANDA...
566c6826-96d0-4b97-a7bb-138e55b6a839
3
private void signalEditorSelectionChanged() { if(se_signal.getSelectionIndex() == -1) return; Contact contact = new Contact(se_signal.getText()); Signal signal = signals.getSignals().get(contact); if(signal != null) { StringBuilder sb_time = new StringBuilder(); S...
53d2bfa0-3569-4282-98af-ce4841595dc7
2
public User getUser() { if (user == null) { try { user = restClientBean.getUserResourceService().createUser(); } catch (Exception e) { e.printStackTrace(); } } return user; }
94265f3c-186a-4ef2-8732-2e08887763a0
2
private boolean useStrings() { return useStrings || ignoreCase || ignoreWhite; }
04b60137-32d0-4432-9ffe-7af194846105
1
public OperatingSystem getGroup() { if (this.parent != null) { return parent.getGroup(); } return this; }
a89f511f-bac0-43b8-89c3-8e4baffdb6a9
8
public static Boolean getConfirmation() { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); Boolean bConfirmation = false; Boolean bValidAnswer = false; String strInput; try { System.out.println(""); System....
d43166bc-e06b-486b-a319-5fb518a46d32
1
public static Integer[] getRandomArray(int size) { Random r = new Random(); Integer a[] = new Integer[size]; for(int i = 0; i < size; i++) a[i] = Math.abs(r.nextInt()); return a; }
e095ff43-2023-457a-a58b-6ea0c51d5294
9
private void moreSubject(){ boolean quit; String callNumber, subject; LibrarianModel libModel = new LibrarianModel(); Class c = libModel.getClass(); quit = false; try { while(!quit) { System.out.println("Enter CallNumber: \n"); callNumber = in.readLine(); if(callNumber....
e8c23242-e029-47ec-bf32-f890611c67a5
5
public static <T> EntityBuilder<T> similarTo(T entity, Property<?>... differences) { Class<T> entityType = (Class<T>) entity.getClass(); Collection<Property<?>> differentProperties = new TreeSet<>(asList(differences)); try { for (Field field : entityType.getDeclaredFields()) { ...
e79686ed-d62d-4b06-97ed-883381ba2068
0
public void setBooking(Collection<BookingEntity> booking) { this.booking = booking; }
2a52289f-65fd-4067-97ed-7dac7cf048e2
8
@EventHandler public void onBlockPlace(BlockPlaceEvent event) { Block block = event.getBlock(); Location location = block.getLocation(); Pad cpad = plugin.getPadAt(location); UnnamedPad upad = plugin.getUnnamedPadAt(location); if (cpad != null || upad != null) { ...
fc5b9071-7470-4746-b2c8-17c5426212a4
4
public int numDistinct(String S, String T) { int m = S.length(); int n = T.length(); int[][] array = new int[m+1][n+1]; //T 为空时 s 删掉全部就能成为T for(int i=0 ; i< m+1;i++) array[i][0] = 1; for(int i=1; i< m+1;i++) for(int j = 1; j < n+1;j++){ /*如果T....
96cab444-5f87-4ea8-bb59-a09e1dc0410f
3
public void scrollVertically(ScrollBar scrollBar) { if (image == null) return; if (imageHeight > visibleHeight) { final int oldOffset = displayFDC.yOffset; final int newOffset = Math.min(scrollBar.getSelection(), imageHeight - visibleHeight); if (oldOffset != newOffset) { paintCanvas.update(); disp...
9d908651-b881-4c0f-9ab8-9fb2758030a1
6
public static void main(String[] args) { ////////////////////////////////////////////////////////////////////////////////////////////////// // Reasonable defaults // List of pvalues to be precalculated (One can rely on this default value) double[] pvalues = PrecalculateThresholdList.PVALUE_LIST; ...
c7704dea-f981-49f2-b50b-15b30dc16595
0
@Override public void endSetup(Attributes atts) { super.endSetup(atts); }
75f9c159-e5df-42ff-a101-912dad4a727b
3
public static void main(String[] args){ Class<FancyToy> ftClass = FancyToy.class; try { FancyToy fancyToy = ftClass.newInstance(); Class<? super FancyToy> up = ftClass.getSuperclass(); Object obj = up.newInstance(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAcce...
5a570886-d71c-4179-bb73-bad5a6fdecdf
7
public ArrayList<MArchive> search() throws SDKException, APIException, SignInException{ ArrayList<MArchive> archiveList = new ArrayList<>(); if (query != null && !query.isEmpty()) { data.put("q", query); } if (!data.containsKey("location")) { data.rem...
456832d1-4143-47cc-bd95-2a95ba43ca82
5
public void runWorker() throws InterruptedException { while( true ) { debug("Looking for a task (any task) to work on..."); RenderTask task = getSomeTask(); debug("Got task. Starting work."); LocalRenderWorker rri = lrs.start(task); RenderResult res; for( int r=0; r<taskRepititions && (res = rr...
a114e6a1-2323-463c-9b2e-68f0ae614987
4
private JsonObject readObject() throws IOException { read(); JsonObject object = new JsonObject(); skipWhiteSpace(); if (readChar('}')) { return object; } do { skipWhiteSpace(); String name = readName(); skipWhiteSpace(); if (!readChar(':')) { throw expected("':'"); } skipWhiteSpace...
030f7eaa-1dee-48f0-98f1-7b85a8f65916
8
public static double svm_predict_probability(svm_model model, svm_node[] x, double[] prob_estimates) { if ((model.param.svm_type == svm_parameter.C_SVC || model.param.svm_type == svm_parameter.NU_SVC) && model.probA!=null && model.probB!=null) { int i; int nr_class = model.nr_class; double[] dec_val...
123032e8-061a-40dd-bcea-94c0056bbdd7
8
final public Program PsyScript() throws ParseException { Procedure proc; Table table; label_1: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PROCEDURE: proc = Procedure(); p.add(proc); break; case TABLE: table = Tab...
beda8f84-8117-4fd4-bfcb-1962c77162eb
7
public void compFinalResult() { do { iStage++; compAllocation(); if (compDistribution()) { /* deadline can not be satisfied */ if (!bDeadline) { System.out.println("THE DEADLINE CAN NOT BE SATISFIED!"); return; } else { System.out.println("\nNEW ROUND WITHOUT CHECKING:"); dEv...
699ae206-02c1-4bd6-8338-1b85c272e78c
1
public void markStateDependent(String name, Class[] params) throws CompilationException { Object m=getMember(null,name,params); Object removed=stateless.remove(m); if (Debug.enabled) Debug.check(removed!=null,"State dependent methos \""+m+ "\"is made state dependend again."); };
7c7d22c2-cf63-497b-a44d-a94a398b7bff
2
public boolean isRegisteredHunter(AID hunterAID) { Hunter hunter; for (int i=0; i<hunters.size();i++){ hunter = hunters.get(i); if (hunter.getHunterAID().equals(hunterAID)) return true; } return false; }
77d00ce7-b289-4637-ac5f-f1b4b57f3be8
1
public byte[] findAttribute(String name) { if (unknownAttributes != null) return (byte[]) unknownAttributes.get(name); return null; }
f40791f2-d6b1-4ec1-b22f-2a90145a4aa9
7
public static boolean isValid(File f) { if (f.isDirectory()) { return false; } String extension = FileTools.getExtensionPoint(f); if (extension != null) { if (extension.equals(".zip") || extension.equals(".tar") || extension.equals...
61467350-38ca-43ba-9b4b-c942be10f101
4
private void handleJump(Rectangle rectangle) { if (player.currentDirection == Direction.RIGHT) { Tween.to(player, SpriteTween.POS_XY, .15f) .target(player.getX() + (rectangle.getWidth() + 25), player.getY()).start(manager); } else if (player.currentDirection == Direction.LEFT) { Tween.to(pl...
4d4a6ffa-3aca-463f-8993-b8bd63975d55
0
public static String getPrivateKey(Map<String, Object> keyMap) throws Exception { Key key = (Key) keyMap.get(PRIVATE_KEY); return SecurityCoder.base64Encoder(key.getEncoded()); }
081e7b6b-9bb1-4248-b42c-23cbc0a7cecd
1
public void agregarEntidades(final Object[][] entidades) { for (final Object[] entidad : entidades) { agregarEntidad((Long) entidad[0], (String) entidad[1], (Double) entidad[2]); // Para cada entidad llama a agregarEntidad } }
4f370370-bd12-4d20-9db0-c0e7cd854876
1
private void testAgents(String[] agentStrings, Browser expectedBrowser) { for (String agentString : agentStrings) { assertEquals(expectedBrowser, Browser.parseUserAgentString(agentString)); } }
ebcc0a6b-5a7f-4bfd-80b4-df772ec614e5
3
public JSONWriter object() throws JSONException { if (this.mode == 'i') { this.mode = 'o'; } if (this.mode == 'o' || this.mode == 'a') { this.append("{"); this.push(new JSONObject()); this.comma = false; return this; } t...
22af822b-8738-43d6-95c6-e30a5c970285
9
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); try{ Connection adaugareNewsConn = null; ResultSet adaugareNewsResult = null; Statement adaugareNewsStatement = null; PreparedStateme...
2f088cae-09dc-48f0-863d-71d73b137cc5
2
public void run(){ isRunning = true; try { //connect clients... clientSocket1 = serverSocket.accept(); System.out.println("New audio connection from "+clientSocket1.getInetAddress().toString()); clientSocket2 = serverSocket.accept(); System.out...
793c71d1-266a-43b1-8b3c-120e73eda72c
2
public void open() { try { // Only try if we do not already have a sequencer if ( sequencer == null ) { sequencer = MidiSystem.getSequencer(); } sequencer.open(); } catch( MidiUnavailableException e) { System.err.println("Th...
032c8f2a-2807-4505-b9b0-ea117473a645
2
public static void main(String[] args) { symbolTable = new SymbolTable(); symbolTable.setFunction("add", new AddFunction()); symbolTable.setFunction("square", new SquareFunction()); Scanner scanner = new Scanner(System.in); String in = ""; Parser p = new...
f90f67a7-2187-482a-b82b-f4d961918aca
9
private void firstInsertion(int ndj,VertexPulse v){ int key = keyCalculator(ndj); if(baseAproxBucket!=null){ int pos = posCalculator(key, baseAproxBucket.getKey()); if(highLevelBuckets[pos] != null){ highLevelBuckets[pos].insertVertexDist(v); } else{ AproxBucket theNewBucket = new AproxBucket(v,...
12f1af38-86a0-43ea-9b9e-06f1236907e3
1
public String moveCardOntoCardFromTopRow(int boardIndexFrom, int boardIndexTo) { List<Card> from = topRow.get(boardIndexFrom); String result = moveCardOntoCard(from, boardIndexTo, from.size() - 1); if (result.isEmpty()) { from.remove(from.size() - 1); } return result;...
98edc311-7218-43e2-ba97-9bdb246f6ccf
2
private static JPanel createStatText() { JPanel panel = new JPanel(); StringBuilder sb = new StringBuilder(); sb.append("Wins:" + StorageManager.getWins() + " "); sb.append("Losses: " + StorageManager.getLosses() + " "); double ratio = StorageManager.getRatio() * 100; sb....
3c208369-b92a-43e2-a395-b3e419d8341f
5
@Override public void update(GameState newState) { for (Player player : newState.getTables().keySet()) { System.out.print(player.getName()); System.out.print("\t"); } System.out.println(); for (int i = 0; i < newState.getTableLines(); ++i) { for (T...
9aba5282-f33e-4b6c-bc42-efb950f5862a
1
public static int nextMonth (int month) { if (month==12) return 1; else return month+1; }
f260aa00-df6b-4292-bd92-2599c1991062
7
private String uploadPeppyResultsIntelligently(String fileLocation){ String header = ""; String entireHeader = ""; try { Scanner s = new Scanner(new File(fileLocation)); String token; for(int i = 0; i < 4; i++){ token = s.nextLine(); if(token.toLowerCase().trim().startsWith("format")){ e...
50ae4601-8c61-48ad-a866-9eef1ff0eb6f
8
private Point3f[] getLimits() { // Find the limits of the model Point3f[] limit = new Point3f[2]; limit[0] = new Point3f(Float.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE); limit[1] = new Point3f(Float.MIN_VALUE, Float.MIN_VALUE, Float.MIN_VALUE); for (int i = 0 ; i < coordList.size() ; i++) { Point3f cur_vtx = ...
e1f88f9e-4374-4c8d-9aa2-61efc624d0a2
8
public void createGrid() { this.area = new Dimension(0, 0); this.showCenter = true; boolean changed = false; int dist; if (TILE_COUNT_WIDTH >= TILE_COUNT_HEIGHT) { dist = TILE_COUNT_WIDTH; } else { dist = TILE_COUNT_HEIGHT; } for (int x = 0; x < TILE_COUNT_WIDTH; x++) { for (int y = 0...
32547c0e-0232-46da-99eb-82d250730511
2
@Override public boolean loadInstrument(Instrument instrument) { boolean isLoadedCorrectly = true;; for (Synthesizer s : theSynths) if (!s.loadInstrument(instrument)) isLoadedCorrectly = false;; return isLoadedCorrectly; }
7f67b2fd-14a5-4c16-b17e-2a9b44729ce3
0
@Override public void refresh(Camera camera) { calcPrimitives(camera); }
ab235af1-eca9-4722-ab5a-37e8a8f4535c
8
public void actionPerformed( ActionEvent e ) { Object sender = e.getSource() ; if ( sender == langButton ) { showLanguageDialog() ; } else if ( sender == closeButton ) { makeResult() ; this.setModalResult( TInternalDialog.MR_OKAY ) ; } else if ( sender == cancelButton...
767fda5b-0f2b-4bb6-a9d5-ad5cc9dc9213
3
private void loadImage(String mapImagePath) { try { this.mapImage = new Image(mapImagePath); this.mapImageHeight = this.mapImage.getHeight(); this.mapImageWidth = this.mapImage.getWidth(); this.pixelsOnMapImage = new int[this.mapImageHeight * this.mapImageWidth]; } catch (SlickException e) { e.printS...
acac4632-a175-48b1-b3ac-c6f28b794369
1
public String toString() { String res = "{\n"; for (Iterator<ZElement> e = enumElements(); e.hasNext();) { res += e.next() + "\n"; } return "}" + res; }
daccc743-753d-469b-a9d8-146f669b802f
0
public KeyStroke getKey() { return KeyStroke.getKeyStroke('s'); }
6234eef2-ea40-4aea-9ce9-e49f26f03c7b
8
private boolean r_shortv() { int v_1; // (, line 49 // or, line 51 lab0: do { v_1 = limit - cursor; lab1: do { // (, line 50 if (!(out_grouping_...
d2d8441f-a6ec-4309-8d04-825c7976235c
6
private static ArrayList<String> parseFileForTickers(File htmlFile) { ArrayList<String> tickers = new ArrayList<String>(); if (htmlFile == null) return tickers; String[] getTickersFrom = { " " }; try { String fromFile = FileUtils.readFileToString(htmlFile); getTickersFrom = fromFile.replaceAll("\\s+...
5d6c3d24-c21f-4f7b-9258-e48b088127c3
4
private void processGet(int userLevel, String[] keywords) { logMessage(LOGLEVEL_TRIVIAL, "Displaying processGet()."); if (isAccountTypeOf(userLevel, ADMIN, MODERATOR, REGISTERED)) { if (keywords.length != 3) { sendMessage(cfg_data.irc_channel, "Proper syntax: .get <port> <property>"); return; } if ...
891fe95e-462b-452f-85f8-c4a36849b130
0
public Integer getCantidad() { return cantidad; }
88868b38-1546-42f7-85e1-38979a9def21
6
public int longestConsecutive(int[] num) { Set<Integer> set = new HashSet<Integer>(); for (int i = 0 ;i<num.length;i++) { set.add(num[i]); } int min = 0; for( int i = 0; i < num.length;i++) if (set.contains(num[i])) { set.remove(new Integer(num[i])); int k ...
73a28d53-4633-4077-9ee4-7f4edb0978f0
3
public static String getAppDataDir() { Logger.getLogger(OSBasics.class.getName()).entering(OSBasics.class.getName(), "getAppDataDir"); File appDataDir; if (isMac()) { appDataDir = new File(System.getProperty("user.home"), "Library" + File.separatorChar + "Application Support"+ File.s...
82319db8-6d6f-4c63-8ec3-0de8bb0cb558
9
public void writeInfo(String clientName) { User user = users.get(clientName); for(ServerGame game : games.values()) { user.getClient().notifyOfGameChange(game); } for(User other : users.values()) { if(other.getClient() != null && other.getClient().getClientName(...
c6ded59f-fda1-4525-8de0-aabb2a27c934
6
public void actionPerformed(ActionEvent ae) { if (ae.getActionCommand().equals("apply")) { if (door != null) { door.type = typeNames[typeBox.getSelectedIndex()]; door.climbDir = dirClimbBox.getSelectedIndex(); door.destDir = dirBox.getSelectedIndex(); door.destX = Integer.parseInt(destX.getText());...
100ce0a7-554a-4439-9f21-63180d2bd9ed
3
public short acceptNode (Node node) throws DOMException { String name = node.getLocalName(); if (null == name) { throw new DOMException(DOMException.NOT_FOUND_ERR, "DOM Node doesn't have a local name!"); } if (this.tagname.equals(name)) { return this.FILTER_ACCE...
b2c006e5-8a00-4bea-8a8d-0edd7b0174f1
4
@Override public void execute() { for (int i=0;i<num;i++) { seq(Segment.repress(Move.A)); seq(Segment.repress(Move.A)); // use rare candy if (monscroll == 0) seq(Segment.repress(Move.A)); // mon else { if (monscroll == 1 || monscroll == -1) seq(Segment.skip(1)); seq(Segment.scrollAF(mons...
ab372c94-2048-4e90-91db-30b7b32ab337
1
public static double[][] scaling3DAnyAxis(double[] axis, double k) { double[][] res = new double[3][3]; if (axis.length == 3) { double nx = axis[0]; double ny = axis[1]; double nz = axis[2]; res[0][0] = 1 + (k - 1)*nx*nx; res[1][0] = (k - 1)*nx*ny; res[2][0] = (k - 1)*nx*nz; res[0][1] = (k...
559c4f3f-e6a4-4c5f-8e7a-2f2774453f8f
4
String getData() throws Exception { if ((url == null) || url.isEmpty()) return ""; StringBuffer text = new StringBuffer(); URL page = new URL(url); HttpURLConnection conn = (HttpURLConnection) page.openConnection(); conn.connect(); InputStreamReader in = new InputStreamReader((InputStream) conn.getContent(...
84cf8838-8bcc-45d8-83db-ed2e054ffb60
8
private boolean Targeted(Info info){ double Distance = 5000; int closest_target = -1; boolean targeted = false; int i = -1; Iterator grenades; grenades = info.getGrenades().iterator(); if(info.getGrenades().size() != 0){ while(grenades.hasNext()) { grenades.next(); i++; InfoDetai...
3190c2c7-6796-4864-92f0-0559baa098d6
5
public boolean BulletCollision(List<Bullet> bullets, Entity enemies[]) { boolean collision = false; // NOTE; if intersected push that shit outa the way for (int b = 0; b < bullets.size(); b++) { if (bullets.get(b).exists) { for (int i = 0; i < enemies.length; i++) { if(bullets.get(b).rec.intersects(e...
7240058e-95ac-4c4e-8c09-eacbba3485e6
2
public <T extends Component> boolean hasComponent(UUID entity, Class<T> componentType) { synchronized (componentStores) { HashMap<UUID, ? extends Component> store = componentStores .get(componentType); if (store == null) { return false; ...
9c57bc8f-6031-4564-848a-e0a3c40d143d
9
public static void textPack(byte packedData[], java.lang.String text) { if(text.length() > 80) text = text.substring(0, 80); text = text.toLowerCase(); int carryOverNibble = -1; int ofs = 0; for(int idx = 0; idx < text.length(); idx++) { char c = text.charAt(idx); int tableIdx = 0; for(int i = 0; i...
b7c50d20-aa9a-47e2-8d1c-a9feb1d17a44
6
public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case FIRST_NAME: return isSetFirstName(); case LAST_NAME: return isSetLastName(); case STATUS: return isSetStatus(); case ID: return isSetId(); ...
fcecb9d8-aa85-4f32-bf7a-6fb3980c89a6
8
public void run() { String fromClient = ""; //TODO get client's IP and put it inside IP String IP = "127.0.0.1"; String userID = ""; String fileName = ""; String filePath = ""; String report = ""; System.out.println("client handling befor while"); outStream.println(" you are connected "); while(f...
f2058cc9-7856-454a-b797-16de001026b2
2
public void setTip(String tip) { if (tip == null) { putValue(SHORT_DESCRIPTION, tip); return; } if (tip.equals(getValue(SHORT_DESCRIPTION))) return; putValue(SHORT_DESCRIPTION, tip); }
5222fe6e-960e-4608-baa8-b57532788616
6
public TableModel obtenerAsistenciasDiaDB(java.util.Date date) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Connection conn = null; Statement stmt = null; String query = "SELECT TC.IDCLIENTE, NOMBRE, HORA FROM " + "GYMDB.CLIENTES TC JOIN GYMDB.ASISTENCIAS...
e84aadeb-6193-4a41-a9db-0aebea6e0678
9
public boolean met(int chunkX, int chunkZ, int y, int time, int lightLevel, Biome biome, Material materialBelow, Environment environment) { if (minLight > lightLevel || maxLight < lightLevel) return false; if (!meetsHeightRequirements(y) || !meetsTimeRequirements(time)) return false; if (requireOpaq...
50e00483-5951-479b-b59c-a963347f9e6c
0
public void construct() { builder.buildPartA(); builder.buildPartB(); builder.buildPartC(); }
a276283f-8b8f-4f1f-a5cc-d08244d21909
3
public static boolean isNegativeSign(int dividend, int divisor) { return ((dividend < 0 && divisor > 0) || (dividend > 0 && divisor < 0)); }
1ad5f379-64ff-4762-8876-371b09a459f5
1
public void actionPerformed(ActionEvent event) { for (int i = 0; i < pokemons.length; i++) { pokemons[i].constantAcc = playSpeed; pokemons[i].move(); } repaint(); }
be8aaddf-7836-4214-9511-c7a8afe2f987
9
@Override public void draw(Graphics g) { int width = getWidth(); int height = getHeight(); if (width == -1 || height == -1) return; g.setClip(getRealX(), getRealY(), width, height); if (this.hasBackground()) g.setColor(getBackground()); else g.setColor(Color.darkGray); g.fillRect(...
203218c9-74d1-4bc4-90fd-2da7bc129692
4
public static int getFilesCount(File file) { int count = 0; if (! file.getName().equals(SystemProperties.getInstance().getDatabaseName())) { File[] files = file.listFiles(); for (File f : files) { if (! f.isHidden()) { if (f.isDirectory()) { count += getFilesCount(f); } else { count+...
fa755584-738e-470e-8617-9de7788210b5
7
private static Moves performMoveTowardsOpponent(BotState state, Moves movesSoFar) { Moves out = new Moves(); List<Region> knownOpponentSpots = HeuristicMapModel.getGuessedOpponentRegions(); if (knownOpponentSpots.size() == 0) { System.err.println("knownOpponentSpots.size() == 0"); return out; } int curr...
ea412e8c-136d-4b82-9601-77f117bc1fea
8
public Node merge(Node left, Node right) { Node merged = null; Node node = null; if(left == null) { merged = right; return merged; } else if (right == null) { merged = left; return merged; } if(left.data < right.data) { merged = left; node = left; left = left.next; } else ...
c1e17e30-e941-4f39-8c6f-85633e61713e
6
public void manageRequest(String aName, String aNumber){ String resourceName = aName + " " + aNumber; for(Resource r : resources){ if(r.toString().equals(resourceName)){ gui.popError("Risorsa già in possesso!"); return; } } LinkedList<ClientInterface> clientsWithResource = null; try{ download...
6bf71870-144f-475e-9a78-26b50fb2a977
6
public WorldTrimTask(Server theServer, Player player, String worldName, int trimDistance, int chunksPerRun) { this.server = theServer; this.notifyPlayer = player; this.chunksPerRun = chunksPerRun; this.world = server.getWorld(worldName); if (this.world == null) { if (worldName.isEmpty()) sendMessag...
d090c175-430e-4b83-8b24-e12851c7a2cd
7
@SuppressWarnings("unchecked") public static <T> Grammar<T> get(Class<T> class1) { if(grammarMap.containsKey(class1)) { return (Grammar<T>) grammarMap.get(class1); } try { Subclasses annotation_subclass = class1.getAnnotation(Subclasses.class); if(null != annotation_subclass) ...
0d504fb2-aacd-4e30-9343-048047932b2e
6
public static void main(String[] args) { List<String> stringCollection = new ArrayList<>(); stringCollection.add("ddd2"); stringCollection.add("aaa2"); stringCollection.add("bbb1"); stringCollection.add("aaa1"); stringCollection.add("bbb3"); stringCollection.add("ccc"); stringCollection.add("bbb2"); s...
e5a259fe-7798-410e-acaf-ad0cb0a588f0
9
public Brain.Move bestMove(Board board, Piece piece, int limitHeight, Brain.Move move) { // Allocate a move object if necessary if (move==null) move = new Brain.Move(); double bestScore = 1e20; int bestX = 0; int bestY = 0; Piece bestPiece = null; Piece c...
5a30157e-bb01-4391-b23e-59149920bdb1
3
public void makeDir(String dirname) { File dir = new File(dirname); try { if(!dir.isDirectory()) { if(dir.exists()) { dir.delete(); } dir.mkdir(); } } catch (Exception e) { ExceptionLog.printl...
0bf9c315-c6bb-4f3d-87e4-0cfbe15f1fa8
7
private void handleScores(){ checkHSExists(); String scores = "High Scores:\n\n"; boolean done = false; LinkedList<HighScore> hsArr = new LinkedList<HighScore>(); for(int i = 0; i < NUM_SCORES; i++){ HighScore hs = HighScore.read(i, HIGHSCORES_PATH); if(score > hs.getScore() && !done){ HighScore...
849aac29-986c-4a49-9550-c14e00daeb92
6
public static void main(String args[]) throws IOException{ // TODO Auto-generated method stub String afile1=args[0];//"/home/dharmesh/aditya/mallet-2.0.7/enfullagelibsvmtested.txt"; String afile2=args[1];//"/home/dharmesh/aditya/mallet-2.0.7/enfullgenderlibsvmtested.txt"; String afile3=args[2];//"/home/dharmesh...
d1e15a60-cdd0-43eb-b3ee-7cbb8838a78d
3
void a2(int rating, boolean wealthy) { boolean secondDate = false; if (rating >= 8 || (rating == 7 && wealthy)) { secondDate = true; } }
be5645f1-9c1f-4e64-84a9-1c437c31177a
4
@SuppressWarnings("unchecked") public static void printList(AbstractList list, int depth) { final Iterator i = list.iterator(); Object o = null; for (int k = 0; k < depth; k++) System.out.print(" "); System.out.println("List: "); while (i.hasNext() && (o = i.nex...
97975aa7-1ee0-4759-a1b2-d47d9db80db9
0
@Override public ProductB factoryB() { return new ProductB1(); }
0fc164a2-f1a8-4aea-83f9-c387b717f042
1
public static void main(String[] argsv) { // Setting op a bank. Bank christmasBank = new Bank(); christmasBank.addAccount(new BankAccount(BigInteger.valueOf(100))); christmasBank.addAccount(new BankAccount(BigInteger.valueOf(50), BigInteger.valueOf(-1000))); // Print the balanc...
90de2aff-d401-4454-88b0-c7dd70c86ad7
8
public void recallCurveStates(DataSet ds) { int i, j; if (ds.getLineStroke() != null) { i = (int) ds.getLineStroke().getLineWidth(); comboBox[0].setSelectedIndex(i); for (j = 0; j < LineStyle.STROKES.length; j++) { if (Arrays.equals(ds.getLineStroke().getDashArray(), LineStyle.STROKES[j].getDashArr...
39b45769-f9a0-4619-90bf-3c387c1423c3
8
@Override public boolean narrow(Variable<IntegerDomain> variable) { // Narrow the domain of the argument variable to include (at most) the intervals satisfying: // [when variable == a]: ci - bj for each interval ci in c and bj in b, // [when variable == b]: ci - aj for each interval ci in c and aj in a, //...
48094e5e-7091-435f-ab46-3f6a89da61d9
1
public boolean containsPacket(Class<? extends APacket> p) { return PList.contains(p); }
53690a3c-beb5-40d6-8fa2-80a3bde2a3d8
9
protected boolean isIdentifierChar(char c) { //TODO need improve from http://www.cs.indiana.edu/scheme-repository/R4RS/r4rs_9.html#SEC67 return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || (c == '_') || (c == '-') || (c == '?') || (c == '!'); }
e600bb3e-bf21-4323-bf50-9543165acb9f
7
public String getToolTipText( MouseEvent e ) { String tip = null ; java.awt.Point p = e.getPoint() ; int rowIndex = rowAtPoint( p ) ; int colIndex = columnAtPoint( p ) ; int realColumnIndex = convertColumnIndexToModel( colIndex ) ; if ( realColumnIndex == 0 ) // comments { TMultiLan...
56ffa8ee-a3d4-4827-9cff-848af4b879c6
5
public void writeKnownAttributes(GrowableConstantPool gcp, DataOutputStream output) throws IOException { if (constant != null) { output.writeShort(gcp.putUTF8("ConstantValue")); output.writeInt(2); int index; if (typeSig.charAt(0) == 'J' || typeSig.charAt(0) == 'D') index = gcp.putLongConstant(cons...
14899704-88ac-40b5-b288-b2579670404e
6
protected static void search(ProcessSearchHotels processSearchHotels) { StringBuffer stringBuffer = new StringBuffer(TravelSDK.INSTANCE.getSettingsResult().getWsUrl()); stringBuffer.append("?prgm=hotel.search"); TravelSDK.appendStandartServiceParameters(stringBuffer); stringBuffer.append("&offset=0&limit=").app...
4ca56333-63ce-45c1-84bd-e72474fbea7c
7
public static AdjListNode[] genRandomDirectedWeightedGraph(int vertexCount) { if(vertexCount <= 0) { return null; } AdjListNode[] graphList = new AdjListNode[vertexCount]; Random random = new Random(); for(int i=0;i<vertexCount;i++) { if(graphList[i] == null) { graphList[i] = new AdjListNode(Stri...