method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
2c0dc932-13ee-42ad-873c-57ee9d84bc5f
8
public Set<Map.Entry<Float,Character>> entrySet() { return new AbstractSet<Map.Entry<Float,Character>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TFloatCharMapDecorator.this.isEmpty(); } ...
f24767db-b670-4fa4-9262-f4378aaecdf9
1
public JSONArray getJSONArray(String key) throws JSONException { Object object = this.get(key); if (object instanceof JSONArray) { return (JSONArray) object; } throw new JSONException("JSONObject[" + quote(key) + "] is not a JSONArray."); }
cdaf82f6-3d9c-4cda-a5f6-a2c99443ed06
0
public void setName(String name) { this.name = name; setDirty(); }
74ecfc91-ab8a-4851-9359-49668263049e
3
public void secureDatabase() { logger.debug("<<<< DatabasePasswordSecurerBean is running!!! >>>>>"); getJdbcTemplate().query("select username, password, password_encrypted from r_user", new RowCallbackHandler() { @Override public void processRow(ResultSet rs) throws SQLExceptio...
227b0958-c74e-4aaf-9a49-2f9d3925c24c
8
public int compare(String o1, String o2) { String s1 = (String)o1; String s2 = (String)o2; int thisMarker = 0; int thatMarker = 0; int s1Length = s1.length(); int s2Length = s2.length(); while (thisMarker < s1Length && thatMarker < s2Length) { ...
9afb91ab-0efd-4a57-aea5-c6de5f5f3971
2
public String echoIP(ClientInterface client) { this.client = client; //System.out.println(client.name); try { System.out.println("The score on the client is " + client.findScore()); } catch (RemoteException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } String remoteClient = null;...
dd7376db-123c-4d31-ab1e-e828d45df29c
3
public Collection<Category> getCategories() { if (categories == null) try { execute(); } catch (SQLException e) { e.printStackTrace(); } TreeSet<Category> ret = new TreeSet<Category>(); if (categories != null) ret.addAll(categories.values()); return ret; }
7d2af794-dd93-441a-9a27-5ba8668407e3
4
public boolean hasCycle(ListNode head) { if (head == null) { return false; } ListNode fast = head, slow = head; do { if (fast.next == null || fast.next.next == null) { return false; } fast = fast.next.next; slow...
7d5b4f61-aead-4c30-8b02-7ffb226f8d6a
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 Teacher)) { return false; } Teacher other = (Teacher) object; if ((this.id == null && other.id != null) || (thi...
6fa67798-c445-4910-bdae-750f5004ad6b
3
private boolean handleMaintenance() { if (plugin.maintenanceEnabled != true) { plugin.maintenanceEnabled = true; plugin.config.set("maintenancemode", true); for (ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) { if (!player.hasPermission("bungee...
5d2ab6d3-5f8a-4a38-a8f9-0ed85162d5d6
9
private static List<String> compactLines(List<String> srcLines, int requiredLineNumber) { if (srcLines.size() < 2 || srcLines.size() <= requiredLineNumber) { return srcLines; } List<String> res = new LinkedList<>(srcLines); // first join lines with a single { or } for (int i = res.size()-1; i ...
8c42bd85-8214-4ba4-8860-7ee7590f7099
4
private boolean hasEveryLightGrenadePositionOnlyOneLightGrenade(Grid grid) { List<LightGrenade> lightGrenades = getLightGrenadesOfGrid(grid); for (LightGrenade lg : lightGrenades) { final Position lgPos = grid.getElementPosition(lg); for (Element e : grid.getElementsOnPosition(lgPos)) if (e instanc...
d48a1d9e-cc9a-468e-8fa6-5c0d3eea4b28
1
public static void readFileTest(){ List<String> list = new LinkedList<String>(); while(true){ list.add(java.util.UUID.randomUUID().toString()); } }
141794a6-e725-48bb-96e8-3f9a8cec3afa
6
private void run(){ int frames = 0; double frameCounter = 0; double lastTime = Time.getTime(); double unprocessedTime = 0; while (running){ boolean render = false; double startTime = Time.getTime(); double passedTime = startTime - lastTime...
5603dd80-6494-4316-a12b-f10a9de3d56d
8
public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); ArrayList<Integer> numList = new ArrayList<Integer>(); do { numList.add(input.nextInt()); } while (numList.get(numList.size()-1) != 0); numList.remove(numList.size()-1); for (int i = 0...
ab434e04-b31e-4d8f-a29c-23382ee61344
7
@Override public void doChangeContrast(int contrastAmountNum) { if (imageManager.getBufferedImage() == null) return; double c = contrastAmountNum; double q = (c + 100) / 100; WritableRaster raster = imageManager.getBufferedImage().getRaster(); double[][] newPixels = new double[raster.getWidth()][raster.ge...
7029ede4-dc68-41a3-8413-cc369a65cee2
2
public ResultSet ExecuteQuery(String query) { Statement st; if (!IsConnected) { return null; } try { st = Conn.createStatement(); plugin.Debug("SQL Query: " + query); return st.executeQuery(query); } catch (SQLException e) { plugin.Warn("Query execution failed!"); plugin.Log("SQL: " + query...
f63e557e-1b2e-483c-b083-fc851f4f71e8
3
private static void readMagicItemsFromFileToArray(String fileName, Items[] items) { File myFile = new File(fileName); try { int itemCount = 0; Scanner input = new Scanner(myFile); while (input.hasNext() && itemCou...
b4f2cf40-cab4-4f79-aa40-7d218a158bf3
9
@SuppressWarnings("unchecked") @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Pair other = (Pair) obj; if (first == null) { if (other.first != null) return false; } else if (!firs...
321fd3e8-c782-40ad-b803-22ddd3c37559
4
public List<String> databaseMedicineInfo(String columnName) throws SQLException{ List<String> medicineName=new ArrayList(); List<Float> medicinePrice=new ArrayList(); try{ databaseConnector=myConnector.getConnection(); stmnt=(Statement) databaseConnector.createSt...
015b06c0-956d-4841-9d88-365077550cce
6
public int minDistance(String word1, String word2) { // Start typing your Java solution below // DO NOT write main() function int m = word1.length(); int n = word2.length(); int[][] res = new int[m + 1][]; int i = 0, j = 0; for (i = 0; i < m + 1; i++) res[i] = new int[n + 1]; for (i = 0; i < m + 1; i...
eaaa45c1-8ac0-4144-8d80-b81c1a8bd74b
0
public static SoundManager getInstance() { return ourInstance; }
2522bd9c-e265-43d3-9810-20a88501936c
7
protected void prepare_sample_reading(Header header, int allocation, //float[][] groupingtable, int channel, float[] factor, int[] codelength, float[] c, float[] d) { int channel_bitrate = header.bitra...
420df518-c5d9-46f6-98d2-5d8fa8997b0a
9
private boolean convertYUV422toRGB(int[] y, int[] u, int[] v, int[] rgb) { if (this.upSampler != null) { // Requires u & v of same size as y this.upSampler.superSampleHorizontal(u, u); this.upSampler.superSampleHorizontal(v, v); return this.convertYUV444to...
920652f0-f6f7-4c99-aebf-594defb977d0
9
public static void initCommandLineParameters(String[] args, LinkedList<Option> specified_options, String[] manditory_args) { Options options = new Options(); if (specified_options != null) for (Option option : specified_options) options.addOption(option); Option option = null; OptionBuilder.with...
127d4e18-4458-4594-8690-63c49ccccab5
4
public String toLongString() { if (flagsMap.isEmpty()) return Language.NO_PERMISSIONS_SET.getString(); String sFlags = ""; for (Map.Entry<PermissionFlag, Boolean> flag : flagsMap.entrySet()) { if (!sFlags.isEmpty()) sFlags += " | "; sFlags += flag.getKey().getName() + ": ...
84aea0e6-508f-4309-b4a4-b055ca0cdc7f
3
public static int[] getLineLabels(double latitude, double longitude, int date, int dstFlag) { int[] lineLabels = new int[13]; for(int i = 0; i <= 12; i++) { lineLabels[i] = i + 6; //go from 6 am to 6 pm if(isDayLightSavings(latitude, longitude, date, dstFlag)) lineLabels[i]++; //just increase labels b...
f16f46f1-6c82-492f-81c8-3e8db2a03601
3
@Override public List<String> getPermissions(String world) { List<String> perms = super.getPermissions(world); TotalPermissions plugin = (TotalPermissions) Bukkit.getPluginManager().getPlugin("TotalPermissions"); for (String group : inheritence) { try { Permissio...
a7ecea09-1107-4126-b78c-9d55828df0db
3
public void actionPerformed(ActionEvent e) { //String cmd = e.getActionCommand(); for(ConvertOption o : this.gui.options){ if(e.equals("option_" + o.toString().toLowerCase().replace(" ", "_"))){ if(this.gui.activeOptions.contains(o)) this.gui.activeOptions.remove(o); else this.gui.active...
9ad4db06-31b0-4e1f-ae11-ef006225e79b
9
public ArrayList<Librarian> searchLibrarian(String columnName, String cond) { Connection conn = null; Statement st=null; ResultSet rs=null; ArrayList<Librarian> Librarians = null; try { conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/librarysystem?user=admin&password=123456"); String qu...
2ec53345-6b14-4e88-890e-04d3f5ad65fe
6
protected void move( GameObject obj, Location l1 ) { Location l0 = obj.getLocation(); boolean movedBetweenContainers = l0.container != l1.container; if( movedBetweenContainers ) { // Disconnect anything attached to the exterior! for( GameObject o : obj.getExterior().getContents() ) { if( o instanc...
253280d5-4a61-4615-9645-04d6ce9c18c5
6
public void keyPressed(KeyEvent e) { setTitle(""+ KeyEvent.getKeyText(e.getKeyCode())); System.out.println("hit + "+ KeyEvent.getKeyText(e.getKeyCode())); switch(e.getKeyCode()) { case KeyEvent.VK_DOWN :player.setVelocityY( player.getSpeed()); player.setVelocityX(0); ...
f9493ada-d168-4d32-a765-591be878f4d5
5
@Override public User build() { try { User record = new User(); record.names = fieldSetFlags()[0] ? this.names : (java.util.Map<java.lang.CharSequence,java.lang.CharSequence>) defaultValue(fields()[0]); record.name = fieldSetFlags()[1] ? this.name : (java.lang.CharSequence) defaultValu...
0f4d2eef-3368-497e-884e-96a31659bed6
1
@SuppressWarnings("unchecked") private IElement decorateElement(final ClassLoader loader, final Field field) { final WebElement wrappedElement = proxyForLocator(loader, createLocator(field)); return elementFactory.create( (Class<? extends IElement>) field.getType(), wrappedElement); }
8ceffa2a-aea2-422b-8247-64b360b6557a
6
private static int[] addBinary(int[] aa, int[] bb){ int n = aa.length; int m = bb.length; int lenMax = n; int lenMin = m; if(m>n){ lenMax = m; lenMin = n; } int[] addition = new int[lenMax]; int carry = 0; int sum = 0; ...
37adb839-da84-44c9-92aa-902664410d44
5
private static List<Region> calculateBestRegionsToTransferTo(BotState state, Region transferRegion) { List<Region> closestNeighborsToBorder = DistanceToBorderCalculator.getClosestOwnedNeighborsToBorder(state, transferRegion); Region closestNeighborToOpponent = transferRegion.getClosestOwnedNeighborToOpponentBor...
cb86f40e-3951-47a7-a1b4-789aae6fd482
4
@Override public void update(long deltaMs) { super.update(deltaMs); // cool! if we have bought an update, we first flag that as done and at the next update, when the research event has been triggered, we update the tree! if(updateResearch) { itemSlots.clear(); ...
7fee4e23-0d79-4d1a-8841-bad9e5fc63ab
8
@Override public synchronized boolean equals(Object obj) { if (obj == null) return false; if (this == obj) return true; if (getClass() != obj.getClass()) return false; WayOsm other = (WayOsm) obj; if (nodos == null) { if (other.nodos != null) return false; } else if (this.sortNodes().size...
48fc8e12-ac50-4496-a814-4f02d284e586
8
public SQLResult process() throws Exception { Matcher createTable = Pattern.compile("[cC][rR][eE][aA][tT][eE][\\s\\t]+[tT][aA][bB][lL][eE][\\s\\t]+(\\w+)[\\s\\t]+\\([\\s\\t]*(.*)[\\s\\t]*;").matcher(command); if (createTable.find()) { // TABLENAME String tableName = createTable.group(1); Tabl...
e5ba59ac-fed0-4834-acb8-754e47f6753e
1
public int compare(Person p1,Person p2) { int result = p1.getName().compareTo(p2.getName()); if( 0 == result) { return p1.getId() - p2.getId(); //若姓名相同则按id排序 } return result; }
6eb9c8a5-711b-4e40-a1f2-55ee3ac7dd1a
3
private static boolean formQueryCity(Criteria crit, List params, StringBuilder sb, StringBuilder sbw, Boolean f23) { List list = new ArrayList<>(); StringBuilder str = new StringBuilder(" ( "); String qu = new QueryMapper() { @Override public String mapQuery() { ...
d46f6f26-5ae7-47e5-83fb-0d95fe6a04fd
3
public boolean isMetal() { int row = getRow(), col = getCol(); if(getOrbitalLetter() == 'p' && col <= 6 && row >= col-11) return true; return false; }
6d87006f-6dbb-4f90-b39b-332bce427ef0
2
public void shakeComponent(final JComponent component) { if(t == null || !t.isAlive()) { t = new Thread(this); t.start(); } }
13c0eda9-9f78-40f5-b360-119b585f0a86
6
public static void handleButtons(Player player, int buttonId, int packetId, InputStream stream) { String username = player.getDisplayName(); String clanName = "Feather"; if (buttonId == 85 && packetId == 61) { player.getPackets().sendJoinClanChat(username, clanName); } if (buttonId == 80 && packetId =...
4348e84f-30a2-4328-ba85-a7000e0ecb4b
0
private void decremDealCounter(){ dealCounter--; }
6db1e4a4-53b3-4ec3-ad4a-c49c45a03b97
8
private void processLabors(int year, List<Man> mankind, List<Woman> womankind) { List<Man> fathers = calculateFathers(mankind); List<Human> children = new ArrayList<Human>(); for (Iterator<Woman> it = womankind.iterator(); it.hasNext(); ) { Woman woman = it.next(); if (wo...
984839f8-c7a4-4319-9967-7e566477d7f4
8
@Override public void run() { //TODO collect statistics on users for fun: //1. # of standups attended/missed //2. speed of response after called on //3. avg length of standup response? //4. # of out of turn comments //2 ways in: //1. is a poll check and the user spoke //2. is not a poll, timer expi...
54d02213-1bab-4868-a157-fff4de74adb9
7
static boolean check_lon_overlap( Double arg_min_lon, Double arg_max_lon, Double min_lon, Double max_lon ) { boolean return_value = false; if ( arg_min_lon < min_lon ) { if ( arg_max_lon > min_lon ) { if ( arg_debug >= Log_Informational_2 ) { System.out.prin...
44634ab9-12be-4a64-9fa2-3e67c5987002
6
private int compareSync (String comp) { // Inverse sync 0x82ED4F19 final String INVSYNC="10000010111011010100111100011001"; // Sync 0x7D12B0E6 final String SYNC="01111101000100101011000011100110"; // If the input String isn't the same length as the SYNC String then we have a serious problem ! if (comp.lengt...
057534b1-2e22-45f2-8d24-9f49da99b9fa
6
public void testSafeAddInt() { assertEquals(0, FieldUtils.safeAdd(0, 0)); assertEquals(5, FieldUtils.safeAdd(2, 3)); assertEquals(-1, FieldUtils.safeAdd(2, -3)); assertEquals(1, FieldUtils.safeAdd(-2, 3)); assertEquals(-5, FieldUtils.safeAdd(-2, -3)); assertEquals(Integ...
c9a7bf5c-0152-485b-8c52-6d288cb30fae
3
public LifeFrame nextFrame() { LifeFrame next = new LifeFrame(new String[frame.height()][frame.width()]); for (int i = 0; i < frame.height(); i++) { for (int j = 0; j < frame.width(); j++) { LifePosition lifePosition = new LifePosition(i, j); if (shouldALive(l...
8745086d-ee9f-4405-a5b6-58b610890c47
1
private void writeAssociativeArray(List<Byte> ret, Map<String, Object> val) throws EncodingException, NotImplementedException { ret.add((byte)0x01); for (String key : val.keySet()) { writeString(ret, key); encode(ret, val.get(key)); } ret.add((byte)0x01); }
b9a7685f-5dd0-44be-a6ea-0594a99092cc
8
public double calculateSalary() { double salary = 0; if (paymentType == "Base") { if (paymentCurrency == "Dollar") { salary = baseRate * dollarRate; } if (paymentCurrency == "British Pound") { salary = baseRate * gbpRate; }...
0c5489c0-4895-4f07-9f07-6febee9d0f8a
0
@RequestMapping("/{id}") public String view(@PathVariable String id, Model model) { model.addAttribute("model", userRepository.findOne(id)); return "users/form"; }
1d89ccee-9060-48b7-8c76-6ee777d0a774
0
public SchlangenKopf(Rectangle masse, IntHolder unit, Color color) { super(masse, unit, color); direction = DIRECTION_START; }
a5e4656d-f810-4abd-93c9-93c43fa194b2
0
public void dash() { }
d5f65c57-0c68-46ac-87c1-bd57558d1e3d
5
public void bannir(String _loginBan, boolean banni, String _login) throws UserAlreadyBannedException, IncompatibleUserLevelException, RemoteException { if(!_login.equals(this.getAuteur()) || !GestionnaireUtilisateurs.getUtilisateur(_login).isAdmin()) throw new IncompatibleUserLevelException(); ...
73e8cb29-158c-44dc-95a1-bdc9ee6067a8
4
private int ways(int currentVal, int add, int goal) { if(currentVal == goal) { return 1; } else if(currentVal > goal) { return 0; } else { int sum = 0; for(Integer m : money) { if(m >= add) sum += ways(currentVal + m, m, goal); } return sum; } }
53534ec0-ee57-4822-b270-ec475bf9574b
8
public static int pushAdjacent(Queue<Pair<Integer, Integer>> myQueue, int[][] canTravel, Pair<Integer, Integer> curr, Map<String, String> myMap){ int currX = curr.getFirst(); int currY = curr.getSecond(); if(currX+1<canTravel.length && canTravel[currX+1][currY]==0){ Pair<Integer, Integer> rightChil...
976eb608-1810-4f1b-8efe-73a8ffbb2a03
2
@Test public void testDeregisterWorkers() throws LuaScriptException { String jid = addJob(); popJob(); List<Map<String, Object>> workers = _client.Workers().counts(); for (Map<String, Object> worker : workers) { if (worker.get("name").equals(TEST_WORKER)) { assertEquals("1", worker.get("jobs").toStri...
ba8fd8e7-934e-47ff-96b4-654a87057ae4
8
private HashSet<String> getMatchesOutputSet(Vector<String> tagSet, String baseURL) { HashSet<String> retSet=new HashSet<String>(); Iterator<String> vIter=tagSet.iterator(); while (vIter.hasNext()) { String thisCheckPiece=vIter.next(); Iterator<Pattern> pIter=patternSet.iterator(); boo...
ec4c3c5e-8932-4a4e-b879-01398775e43d
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; Employee other = (Employee) obj; if (divisionName == null) { if (o...
632b0bc5-eaf3-461a-a99f-12eb35495d72
8
public boolean subsumes(Object general, Object specific) { HGRelType grel = (HGRelType)general; HGRelType srel = (HGRelType)specific; if (general == null || specific == null) return general == specific; if (!grel.getName().equals(srel.getName()) || grel.getArity() != srel.getArity()) return false; for ...
4a0f464c-c2e9-457a-aabf-1ccaab1feefc
3
private static String loadShader( String fileName ) { StringBuilder shaderSource = new StringBuilder(); BufferedReader shaderReader = null; final String INCLUDE_DIRECTIVE = "#include"; try { shaderReader = new BufferedReader( new FileReader( "./res/shaders/" + fileName ) ); String line; while ( ( ...
60326daa-3bce-41a4-a66e-9e6f55b2dd5c
8
private void buildStatsPerDay(HashMap<Component, DayStats> to, HashMap<Component, List<Interval> > from){ Iterator componentsIterator = from.entrySet().iterator(); while (componentsIterator.hasNext()) { Map.Entry pairs = (Map.Entry)componentsIterator.next(); Component node = (Component)pa...
191dab19-2add-4749-9bd7-37e8c22d292a
3
@Override public EntidadBancaria read(Integer idEntidadBancaria) { try { EntidadBancaria entidadBancaria; Connection conexion = connectionFactory.getConnection(); String selectSQL = "SELECT * FROM entidadbancaria WHERE idEntidadBancaria = ?"; PreparedStatemen...
a1acdef3-cdcc-40a1-af4a-a911a3cab85f
4
public void gameUpdated(GameUpdateType type) { switch (type) { case GAMEOVER: finalTime = engine.getCurrentRound(); finalN = engine.getBoard().mosquitosCaught; break; case MOVEPROCESSED: break; case STARTING: break; case MOUSEMOVED: default: // nothing. } }
626b6ffb-91dc-47e9-8cc2-5cdb28889b61
6
public static boolean shouldBuild() { int starports = UnitCounter.getNumberOfUnits(buildingType); if (TerranFactory.getNumberOfUnitsCompleted() >= 3 && starports == 0 && TerranSiegeTank.getNumberOfUnits() >= 5 && !TechnologyManager.isSiegeModeResearchPossible()) { return ShouldBuildCache.cacheShouldBuil...
084f4740-7393-4eae-a887-1544d0e46020
4
public void tire(int x, int y) { for (int i = 0; i < flotte.size(); i++) { vaisseau tmp = flotte.get(i); if (tmp.isSelected && tmp.isAlive()) { tmp.nbTir++; if (tmp.nbTir < 10) { tir.add(new laser((int) tmp.posx + tmp.milieuX, (int) tmp...
cb39fb40-6cd5-46ab-b1a9-907a47e192af
5
@Override public boolean valid() { if (ctx.players.local().animation() == -1 && (!ctx.players.local().inMotion() || ctx.movement.distance(ctx.players.local(), ctx.movement.destination()) < 4)) { if (npc().valid()) { return true; } final GameObject rock = rock(TIN_FILTER); if (rock.valid()) { Log...
de702bf7-b9fa-4e7d-8803-96479d357951
1
@Override public void update(GameContainer gc, StateBasedGame sbg, int Delta) throws SlickException { if(handle.Up() == true) { System.out.println("test"); gc.exit(); System.exit(0); } }
d9ec5f03-576d-4ba7-9e63-3d6bd0522c33
5
private void runServer() throws IOException { // pre startup message ServerSocket serverSocket = new ServerSocket(PORTNUM); serverSocket.setSoTimeout(TIMEOUT); serverDirectoryCheck(); System.out.println("Server: Server has started broadcast on port " + PORTNUM + " and is waiting for connections..."); Sys...
82cc135d-8e51-4fad-a1dc-60ef4d69e5dd
4
public boolean authenticate(String username, String password) throws LoginException { if (debug) { LOG.debug("Trying to authenticate user: " + username); } boolean authenticated = false; UserData result = authenticationDao.loadUserData(username); if (res...
6a9d973a-b9e2-4aec-9764-d08efa135669
5
public static ArrayList<int[]> getGoalLocations(State state) { ArrayList<int[]> goalList = new ArrayList<int[]>(); int[] goalPosition = {0, 0}; ArrayList<ArrayList<String>> temp; temp = copy(state.getData()); for (int k = 0; k < temp.size(); k++) { for(int m = 0; m < temp.get(k).size(); m++) { if (temp...
4884cff9-13f4-4b39-b9b3-cfa768ac45c7
2
@Override public void getOptions() { for (Component p : getParent().getComponents()) { if (p instanceof OptionsPanel) { fixedSpeed = ((OptionsPanel) p).isFixedSpeed(); player1.setLives(((OptionsPanel) p).getLives()); player2.setLives(((OptionsPanel...
e2d4dd5f-647a-4a0e-8abc-5b40d72de6d8
2
private void trierDocuments(ArrayList<Document> documents, ArrayList<Critere> criteres, ArrayList<MotClef> motClefs, FileListModel flm) { for (Document d : documents) { if (d.matches(criteres, motClefs)) { flm.add(d); } } }
f6ec7c51-62b1-4d16-b0d9-3b5611ca5d26
2
public Attribute getAttribute(String name) { for( int n = 0; n< attributes.size(); n++ ) { Attribute item = attributes.get(n); if( item.getName().equals(name) ) { return item; } } Attribute attribute = new Attribute(); attribute.setName(name); attributes.add(attribute); return attribute; ...
7d355300-aa90-4ff4-ab7f-9284b9cbff04
7
public boolean containsAtLeast(Inventory inventory, int minimumAmount) { int foundItems = 0; if (inventory instanceof PlayerInventory) { PlayerInventory playerInventory = (PlayerInventory) inventory; if (equals(playerInventory.getBoots()) || equals(playerInventory.getLeggings()...
2f8f1a01-2b3c-4104-bc4b-585cc0f2a846
2
@Override public void run() { while (serverIsRaning) { try { clientSocket = socket.accept(); ClientList.add(new Client(clientSocket)); Frame.println("Client connected."); } catch (Exception e) { serverIsRaning = false; e.printStackTrace(); } } }
75babb97-9700-4266-afe7-9adb6ec6e1da
5
public void updateStats(){ int totalArmor = 0; int minDmg = 0; int maxDmg = 0; int totalHealth = 0; ArrayList<InventoryBox> equipped = inv.getEquipment(); InventoryBox weapon = equipped.get(0); //weapon InventoryBox ring = equipped.get(1); //ring InventoryBox neck = equipped.get(2); //necklace if (w...
f96de20d-1fe6-44ed-aa2e-195e3c4db294
9
void processChemCompLoopBlock() throws Exception { parseLoopParameters(chemCompFields); while (tokenizer.getData()) { String groupName = null; String hetName = null; for (int i = 0; i < fieldCount; ++i) { String field = loopData[i]; if (field.length() == 0) continue; ...
5f0a3b0b-d5f9-41f8-a130-b782278f14da
7
public void tick() { peersManager.tick(); choker.tick(); Long waitTime = activeTracker.getInterval(); if (incomingPeerListener.getReceivedConnection() == 0 || peersManager.getActivePeersNumber() < 4) { waitTime = activeTracker.getMinInterval() != null ? activeTracker.getMi...
a8449cde-fb75-4e91-ad1c-0144d6046014
1
public String toString() { Object obj; String result = "[ "; SListNode cur = getHead(); while (cur != null) { obj = cur.red; result += "{"; result = result + obj.toString() + ","; obj = cur.green; result = result + obj.toString() + ","; obj = cur.blue; result = result + obj.toString() + ","...
548adca0-23d9-4af2-a77e-87b089d69304
8
public void writeTermList(Expression list) { boolean first = true; for (Term t : list.list) { if (first) { writer.print((t.constant == 1f ? "" : (t.constant == -1f ? "-" : t.constant == Math.ceil(t.constant) ? Integer .toString((int) t.constant) : t.constant)) + " " + t.variable + " "); ...
4a350a00-c045-4584-ab41-d650a582c1e3
1
public static UserSettingsClient getInstance(){ if(instance == null){ instance = new UserSettingsClient(); } return instance; }
870a8cc1-e37d-4e4d-83df-9d1ba602cbcb
5
public static boolean cambioUnaLetra(char[] pActual, char[] pNueva) throws Exception { boolean [] comprobar = new boolean[pActual.length]; int contador = 0; for (int i = 0; i < pActual.length; i++) { if (pActual[i] == pNueva[i]) { comprobar[i] = true; } ...
cf33d9a1-eb31-4ba3-b26a-806e06ab09f9
5
private Point getRowColOfSelectedCard(Point pressPt) { Point p; for(int i =0; i < A1Constants.NUMBER_OF_ROWS; i++){ for(int j = 0; j < A1Constants.NUMBER_OF_COLS; j++){ if(cards[i][j] != null){ if(cards[i][j].getCardArea().contains(pressPt) && cards[i...
c1d543a6-247b-4454-a7f0-ebd16a999f4c
6
@SuppressWarnings("unchecked") public List<OfficeSpace> seachOfficeSpace(HashMap<String, Object> criteria){ Criteria c = new Criteria(); List<OfficeSpace> finalList = new ArrayList<OfficeSpace>(); // Create instance of Criteria object. try { if(criteria.containsKey("searchCriteria")){ c.poppulateCriter...
b6bdb95f-3c3d-449a-947a-8516b104389c
3
@Override public void logout(String username, int sentBy) { _userStore.remove(username); notifyUserListChanged(); if((sentBy == ServerInterface.CLIENT) && (backupServer != null)) { try { backupServer.ping(); backupServer.logout(username, ServerInterface.SERVER); } catch(Exception ex) { S...
5043f5f4-74f0-46a5-81a0-8dc0befdc901
2
private Type createArray(Type rootComponent, int dims) { if (rootComponent instanceof MultiType) return new MultiArrayType((MultiType) rootComponent, dims); String name = arrayName(rootComponent.clazz.getName(), dims); Type type; try { type = Type.get(getClassPo...
25db0e6d-8b08-488a-8986-977538f45aa5
3
public char nextClean() throws JSONException { for (;;) { char c = next(); if (c == 0 || c > ' ') { return c; } } }
666f0787-e2ed-4aa2-866a-c6fd2d5ca80a
4
private static boolean modifyDrug(Drug bean, PreparedStatement stmt, String field) throws SQLException{ String sql = "UPDATE drugs SET "+field+"= ? WHERE drugname = ?"; stmt = conn.prepareStatement(sql); if(field.toLowerCase().equals("description")) stmt.setString(1, bean.getDescription()); if(field.toLo...
c6b6a79e-c868-43f3-aaa9-01aaa6c72f83
3
*/ private int[] getWhatNeedsDone() { ArrayList list = new ArrayList(); for (int i = 0; i < editingGrammarModel.getRowCount() - 1; i++) if (!converter.isChomsky(editingGrammarModel.getProduction(i))) list.add(new Integer(i)); int[] ret = new int[list.size()]; for (int i = 0; i < ret.length; i++) ret[...
05e67140-a2cc-4c17-943b-ecbf4ef1a3fd
9
public void transmitTextFile(final File file, final LoggedDataOutputStream dos) throws IOException { if ((file == null) || !file.exists()) { throw new IllegalArgumentException("File is either null or " + "does not exist. Cannot transmit."); } File fileToSend = file; final T...
45dac0a5-7d03-4bdb-92fb-9724e6238251
6
public boolean objectEqualP(Stella_Object y) { { Set x = this; if (Surrogate.subtypeOfP(Stella_Object.safePrimaryType(y), Stella.SGT_STELLA_SET)) { { Set y000 = ((Set)(y)); { boolean testValue000 = false; testValue000 = x.length() == y000.length(); if (testValue000...
a6fc2da2-812c-4742-8e42-d0667199d9be
7
public static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double)o).isInfinite() || ((Double)o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); ...
0509ec8a-b457-43cd-b525-1e5371968143
8
public static int countNeighbours(boolean[][] world, int col, int row) { int c = 0; if (getCell(world, col - 1, row - 1) == true) { c += 1; } if (getCell(world, col, row - 1) == true) { c += 1; } if (getCell(world, col + 1, row - 1) == true) { c += 1; } if (getCell(world, col - 1, row) == tr...
eaf63857-4cd1-4182-af4d-374ab927a5ff
1
public boolean fichierRename(File ancien_nom, File nouveau_nom) { if (ancien_nom.renameTo(nouveau_nom)) return true; else return false; }
a77f725a-116d-4286-bd36-7705c7314ff1
6
public void setHasBackground(boolean hasBackground) { if(hasBackground && !this.hasBackground) this.setColor(this.backgroundColor); else if(!hasBackground && this.hasBackground) this.setColor(Colors.TRANSPARENT.getGlColor()); this.hasBackground = hasBackground; if(!this.hasBackground && !this.hasBor...
958a010d-053d-4319-b83e-e311631b5565
7
public double augmentFrontEndCharges(double capacity, int reactor_type, int year_count, PrintWriter output_writer) { // front end cost calculation int i; double charge=0; double pvf; if (year_count > FRONTENDREFYEAR[0] - START_YEAR) { // if past the reference date, total NU use must be calculat...