method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
dc56c15c-f379-46d3-9408-38170f5229bb
4
@Test(groups = { "Character-Sorting", "Primitive Sort" }) public void testInsertionSortChar() { Reporter.log("[ ** Insertion Sort ** ]\n"); try { testSortCharacters = new InsertionSort<>( primitiveShuffledArrayChar.clone()); Reporter.log("1. Unsorted Random Array\n"); timeKeeper = System.currentTi...
9a70374c-2374-4935-b396-94b156fd8093
2
private static void test_strxtoi(TestCase t) { // Print the name of the function to the log pw.printf("\nTesting %s:\n", t.name); // Run each test for this test case int score = 0; for (int i = 0; i < t.tests.length; i += 2) { int exp = (Integer) t.tests[i]; String arg1 = (String) t.tests[i + 1]; i...
9e8bf058-f075-4b31-a6a0-08e95fdff030
7
protected synchronized boolean insert(CollisionObject collisionObject){ if(collisionObject == null) return false; if(!contains(collisionObject)){ if(getParentNode() != null) return getParentNode().insert(collisionObject); System.err.println("QuadTreeNode.root : CollisionObject "+collisionObject....
96a388fa-9439-45c5-a671-eba703a58583
3
public static void encodeToFile(byte[] dataToEncode, String filename) throws java.io.IOException { if (dataToEncode == null) { throw new NullPointerException("Data to encode was null."); } // end iff Base64.OutputStream bos = null; try { bos = new Base64.OutputStream( new java.io.FileOutputStrea...
a3a3a398-8573-4f92-9b03-e48c0d6f35c7
3
private void totalNQueens2Rec(int level, List<Integer> perm){ if (level == perm.size() && isValid(perm)) ++res; for (int i = level; i < perm.size(); ++i){ Collections.swap(perm, i, level); totalNQueens2Rec(level + 1, perm); Collections.swap(perm, i, level); } ...
41e8e638-7f03-4309-9fbe-f68f3db4310c
2
public static ArrayList<String> findAllInFile(String fileName, Pattern pattern) throws FileNotFoundException { ArrayList<String> ret = new ArrayList<String>(); Scanner sFile = new Scanner(new File(fileName)); while (sFile.hasNextLine()) { String line = sFile.nextLine(); Scanner sLine = new Scanner(line);...
268bedc2-32ab-46d0-84bd-41c767a48516
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 RoleSchool)) { return false; } RoleSchool other = (RoleSchool) object; if ((this.id == null && other.id != null...
abe7d5e0-fac3-414b-9dbb-da174c77fcb3
6
@EventHandler public void MagmaCubeHeal(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...
d7739a84-d0a7-4c8b-8645-342a93ea4b3b
1
@Override public void run() { System.out.println("run Start !"); while(ctl) { System.out.println("Control Test :" ); } }
ab30031f-6207-4e96-89d2-2b3466d907b3
8
public static String diceText(int id) { switch (id) { case 15086: return "a six-sided"; case 15088: return "two six-sided"; case 15090: return "an eight-sided"; case 15092: return "a ten-sided"; case 15094: return "a twelve-sided"; case 15096: return "a a twenty-sided"; case 15098: ...
734d4ab2-adf0-47f5-b05a-4af911e5b3a4
2
@Override public String execute() { try { if (databaseContext.table != null) { return new Integer(databaseContext.table.commit()).toString(); } else { return "No table selected."; } } catch (IOException e) { return e.get...
3addf582-ae16-4b67-9a8b-21d3156e96d4
1
public void openAudioInputStream(final File file) { Thread thread = new Thread(new Runnable(){ public void run(){ try { openAudioClip(file); listener.decodingDone(); } catch (Exception e) { listener.decodingError(e.getMessage()); } } }); thread.start(); }
6d8255c7-ee16-4dd9-b388-fb4b05adb9c3
7
public static IHandler createHandler(Socket socket,IMessage msg) { IHandler handler = null; switch (msg.getType()) { case IMessage.MSG_LOGIN: handler = new LoginHandler(socket,msg);break; case IMessage.MSG_REGISTER: handler = new RegisterHandler(socket,msg);break; case IMessage.MSG_PULL: handler ...
544075fe-e9fd-4d4b-8e29-1633600a5386
7
public List<Dependency> selectDependencies( Class<?> clazz ) { List<Dependency> list = Collections.emptyList(); Method[] methods = clazz.getDeclaredMethods(); for ( Method method: methods ) { if ( isMethodEligible( method ) ) { if ( list.isEmpty() ) list = new ArrayList<...
fde61a0b-f9f8-41e4-9a6b-48cfd1ec9f95
6
public static synchronized boolean createGrammarWithOutProbability(String text){ // If the text is null then return if(text == null){ System.out.println("Text to create grammar is null!"); return false; } // Only leave text and numbers text = FileUtils.get...
9540fcce-99bd-4590-b8b8-e68660cb7c98
4
public void chooseIcon(boolean isOpening){// should be called on click (or pressed) if (markIndex == 0 && isOpening) imgIndex = getValue();// for now else if (markIndex == 0){ imgIndex = 0; }else{ imgIndex = 9 + markIndex; } if (imgIndex == 9) bombsBeingRevealed = true; //this.setPressedIcon(min...
6957bc69-1748-4e16-b062-b1bddc991b0d
5
private void startLabeling(ArrayList<Integer> startCell, int clusterId, HashMap<ArrayList<Integer>, Integer> gridSign){ // if the startCell has not included in the cluster, add it if ( !gridLabel.containsKey(startCell) ) { gridLabel.put(startCell, clusterId); } // create a queue for other to-be-examine...
bc7effbd-190a-4883-b3de-363b838a5ca9
7
public Object[] next() { Object[] tr = output.toArray(); Object to; while (true) { if (itering.size() == 0) { output = null; return tr; ...
3043ec19-0931-455d-9c0f-b22338b688e4
1
public float getFloat( String name ) { Float result = floatHashMap.get( name.toLowerCase() ); if ( result != null ) return result; return 0; }
e8a34f8b-fae1-4d12-97c4-a493d1b63c9e
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 Entities)) { return false; } Entities other = (Entities) object; if ((this.addedId == null && other.addedId != ...
c2c8706b-5024-45d5-aafa-a0bcda6931e6
9
public TableSearchQuery(@Context UriInfo ui) { if (ui == null) { return; } MultivaluedMap<String, String> queryParameters = ui.getQueryParameters(); EntityFilterType[] filterTypes = EntityFilterType.values(); for (Map.Entry<String, List<String>> param : queryParameters.entrySet()) { for (EntityFilter...
95e0c70f-e61f-480a-97ac-8f5b7aaa0722
1
private void printSTNode(STNode<Key, Value> x) { for (int i = 0; i <= x.h; i++) System.out.print("\t"); System.out.println(x.key + ":" + x.h); }
5011d2f9-f3f5-4239-9a90-08c69400f059
7
public static final boolean fullDharokEquipped(Player player) { int helmId = player.getEquipment().getHatId(); int chestId = player.getEquipment().getChestId(); int legsId = player.getEquipment().getLegsId(); int weaponId = player.getEquipment().getWeaponId(); if (helmId == -1 || chestId == -1 || legsId == -1...
9fb4fb68-547a-49b1-b713-a7a44e9fd28b
5
private static void createVMF() throws IOException { boolean savingFlag = true; int iterations = 1; //this loop creates a file with an indexed value on the end //instead of failing to save or overwriting while (savingFlag) { File f = new File(generatedFilename + ".vmf...
eaff9c6d-863f-4c54-9dae-c4c74b9d29f3
6
protected static double grad(int hash, double x, double y, double z) { hash &= 15; double u = hash < 8 ? x : y; double v = hash < 4 ? y : hash == 12 || hash == 14 ? x : z; return ((hash & 1) == 0 ? u : -u) + ((hash & 2) == 0 ? v : -v); }
b9dfb16b-e0cd-42c3-9adb-6415774af69e
2
public int getDimensions() { if (!isArray()) return 0; String name = clazz.getName(); int pos = name.length() - 2; int count = 0; while (name.charAt(pos) == '[' ) { pos -= 2; count++; } return count; }
8a93bb36-4f49-4d93-b131-1315252202ed
3
public ArrayList<String> getUrlList() { ArrayList<String> retVal = new ArrayList<String>(); try { Random randomGenerator = new Random(); StringBuilder sb = new StringBuilder(); int randomInt; randomInt = randomGenerator.nextInt(1000); if (randomInt < 25) { /* * Ponowna indeksacja */...
f764b04d-22fd-4ba0-b7bb-1cd891b6bc95
3
static Coordinates nextForwardPosition(Coordinates position, Direction direction) { if (direction == NORTH) return new Coordinates(position.getX(), position.getY() + 1); if (direction == SOUTH) return new Coordinates(position.getX(), position.getY() - 1); if (direction ==...
f554fd23-3973-472a-a74f-25cf0ed1cb36
2
public int getBookableByPID(Statement statement,String PID)//根据PID获取可预订车位数 { int result = -1; sql = "select bookable from Park where PID = '" + PID +"'"; try { ResultSet rs = statement.executeQuery(sql); while (rs.next()) { result = rs.getInt("bookable"); } } catch (SQLException e) { S...
85f22a06-ff76-407f-89de-7be0621cca6d
2
public void setup() { String os = System.getProperty("os.name"); if (os.startsWith("Windows")) { System.out.println("Matching .exe on " + os); extension = ".exe"; root = new File("C:\\Program Files"); } else if (os.startsWith("Mac")) { System.out.println("Matching .app on " + os); File[] ro...
add1b6c0-d57a-4b85-b69d-3d5cb08d7df0
6
public void mouseClicked(MouseEvent e) { Point clickPoint = e.getPoint(); if(barrierFlag) { if(getBarrierState(clickPoint.x,clickPoint.y)){ GridBoard.this.setBarrierPosition(clickPoint.x,clickPoint.y,false); } else { GridBoard.this.setBarrierPosition(clickPoint.x,clickPoint.y,true); } } else ...
34755225-36fd-45e9-939b-f2b5aff35fca
7
private void tallyTree(Tree<String> tree, Counter<String> symbolCounter, Counter<UnaryRule> unaryRuleCounter, Counter<BinaryRule> binaryRuleCounter) { if (tree.isLeaf()) return; if (tree.isPreTerminal()) return; if (tree.getChildren().size() == 1) { UnaryRule unaryRule = makeUnaryRule(tree); ...
f5631451-1b83-492b-94aa-cf509550e466
2
private boolean isCutOffBy(City city, Owner owner){ VertexSet neighbours = getVertexSetNeighbourhood(getConnectedComponents(city)); for(City c : neighbours){ if(c.getOwner() == ReturnOtherPlayer(owner)) return false; } return true; }
c29c0664-d274-4e24-a5fd-9e33357fdcd4
7
@Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){ if(sender.hasPermission("manager.commands")){ if(cmd.getName().compareToIgnoreCase("spelllevel") == 0){ if(args.length == 2){ try{ plugin.getLev...
1712bb4f-c6da-49ad-ae58-f2d08495403f
8
public synchronized void collectFailingParts(WorkSheet sheet) { sheet.status = WorkSheet.Status.STARTED_TO_REPAIR; Mobile mobile = sheet.mobile; if (mobile.display.failing) { addPartToReplace(sheet, mobile.display); } if (mobile.keyboard != null && mobile.keyboard.failing) { addPartToReplace(sheet, m...
725d90fa-05ae-483b-9e86-5bc20ae80c75
1
@Override public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { API api = Plugin.getAPI(); if(!(sender instanceof Player)){ sender.sendMessage("You can't use this command!"); return true; } Player player = (Player) sender; player.sendMessage("[RP] Wallet: " ...
1c78044d-fe82-48a4-9357-a53f1c386dc3
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { Physical target=mob; if((auto)&&(givenTarget!=null)) target=givenTarget; if(target.fetchEffect(this.ID())!=null) { mob.tell(mob,target,null,L("<T-NAME> <T-IS-ARE> already affected by @x1.",...
0913a56b-3d94-4763-87fc-39c899417d2d
9
public void GoDown(WumpusPolje[][] wumpusWorld) { WumpusPolje oce = tmpPolje; tmpPolje = wumpusWorld[tmpPolje.m_x + 1][tmpPolje.m_y]; obiskanaPolja.add(tmpPolje); tmpPolje.m_oce = oce; this.m_points += WumpusRating.action; WumpusHelper.Print(WumpusSteps.PremikNaPolje(tmpPolje.m_x, tmpPolje.m_y)); //...
26bc4617-9ae2-482c-b32a-afd12b6fb932
2
@Override public void execute() { GroundItem nest = GroundItems.getNearest(FIND_NEST); if (nest.isOnScreen()) { if (nest.interact("Take")) { Ivy.nest = false; sleep(750,1250); } } else { Walking.walk(nest.getLocation()); ...
959a15c6-4411-4256-ab21-f96ba697a66c
7
private final void nullifyAudioFileTempData() { synchronized (this.audioFileTempLock) { if (this.audioFileTempGenerator != null) { this.audioFileTempGenerator.cancel(); this.audioFileTempIsGenerating = false; } if (this.audioFileTemp != null) { this.audioFileTemp.delete(); this.audioFileTemp ...
c4675487-a824-4001-8208-1dba6dee072f
8
@Override protected InputStream getBody() throws Exception { // create a cloned array of all the form parameters. This is necessary // because this method may return before the data for all the form // params are computed, and we don't want a race condition where // the params are modifi...
582f6bbe-ef97-4c08-9899-ebf635ff4ab0
8
public void send_packet(RdpPacket_Localised data) throws RdesktopException, IOException, CryptoException { if(getSecureLayer() == null) return; int length = data.size(); int data_offset = 0; int packets_sent = 0; int num_packets = (length/VChannels.CHANNEL_CHUNK_LENGTH); num_packets += length - (VChanne...
e5b195f0-9b29-497a-814e-b8bdd9097c13
8
public Prescription(Patient p) { super("Prescription"); layout = new GridBagLayout(); constraints = new GridBagConstraints(); //---------------------- patient = p; // setLayout(layout); setLayout(new GridLayout(4, 1, 2, 2)); topPanel = new JP...
b899a184-aafd-46f6-a0b7-21a7c14b3060
3
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof FactionMember)) return false; FactionMember that = (FactionMember) o; return factionName.equals(that.factionName) && memberName.equals(that.memberName); }
dad899cc-a2ac-4970-96bf-1b20eecd826f
2
public static void main(String[] args) { String sourceFilename = args[0]; Scanner s = null; try { s = new Scanner(new FileReader(sourceFilename)); } catch (IOException e) { e.printStackTrace(); System.err.println("Error accessing the sourc...
2528073a-b131-4ac4-a334-c75d87437b8f
3
public synchronized void setAudioVolume(int percentage) { if(allPlayers.lastElement() != null && percentage >= 0 && percentage <= 100) { allPlayers.lastElement().setAudioVolum(percentage); SRSOutput.getInstance().logD("Lautstärke ist nun: "+percentage); } }
6e80bd7b-17e8-4f26-b8a8-701d41405794
2
public void testGetValue() { YearMonthDay test = new YearMonthDay(); assertEquals(1970, test.getValue(0)); assertEquals(6, test.getValue(1)); assertEquals(9, test.getValue(2)); try { test.getValue(-1); } catch (IndexOutOfBoundsException ex) {} try { ...
93493c69-e928-47bd-aa4c-a75ef10b1c85
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 TaxonObservationDownloadPurpose)) { return false; } TaxonObservationDownloadPurpose other = (TaxonObservationDownloadPu...
63dc04fd-58de-4cbc-a174-1828e9ee2837
7
private static int gather(LinkedList<Fragment> dest, LinkedList<Fragment> src, int cut, int poffset) { /* * move hunks in source that are less than cut to dest, but compensate * for changes in offset. The last hunk may be split if necessary * (oberlaps cut). */ int o...
a3e6ff1e-4f9a-4376-90db-9743dcbfe4c7
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...
978b330c-87de-4880-a378-dd2260cfb915
4
public static void main(String[] args){ try { _port = initParser(args); Thread list = new Thread(new ListServer()); Thread upload = new Thread(new UploadServer()); list.start(); upload.start(); list.join(); upload.join(); } catch (NumberFormatException e) { System.err.println(Errors.INVALID_...
d1ad2b0c-95f5-4f54-85c4-56175382c478
7
public static Vector<String> parseCommas(String s, boolean ignoreNulls) { final Vector<String> V = new Vector<String>(); if ((s == null) || (s.length() == 0)) return V; int x = s.indexOf(','); while (x >= 0) { final String s2 = s.substring(0, x).trim(); s = s.substring(x + 1).trim(); if ((!ignore...
a41f2a5d-ecf2-4769-aae3-292db81e94b2
7
private final int doNext() throws IOException { if (m_tagType==END_DOCUMENT) { return END_DOCUMENT; } m_tagType=(ReadUtil.readInt(m_stream) & 0xFF);/*other 3 bytes?*/ /*some source length*/ReadUtil.readInt(m_stream); m_tagSourceLine=ReadUtil.readInt(m_stream); /*0xFFFFFFFF*/ReadUtil.readInt(m_stream);...
f9fb874d-8f82-49f8-96d4-7e33b9811f5e
1
public void unloadChunks(int x,int z){ Chunk current = chunks[x][z]; current.removeFromParent(); chunks[x][z] = null; if(isEmpty())dim.unloadRegion(this); System.gc(); }
05c32ce6-7feb-4aa4-80e4-e6a412294720
0
@Id @GenericGenerator(name = "generator", strategy = "increment") @GeneratedValue(generator = "generator") @Column(name = "CSA_ID") public int getIdPosControlSaldos() { return idPosControlSaldos; }
da330c85-d8e8-4483-9c8c-6e47dccb64ed
0
private static byte[] MD5(byte[] sourecebuf) throws NoSuchAlgorithmException { MessageDigest md5 = MessageDigest.getInstance("MD5"); md5.reset(); md5.update(sourecebuf); return md5.digest(); }
d0cbafa1-d8cf-4ddc-b794-ce15557fa10d
1
@Override public void addToStart(String value) throws AlreadyExist { if (!exists(value)) { super.addToStart(value); } else { throw new AlreadyExist("Alredy exist in List"); } }
fd3ce5fe-49e7-4e50-90bd-322ea5681a39
7
public static void main(String[] args) throws Exception { String props="udp.xml"; String name=null; for(int i=0; i < args.length; i++) { if(args[i].equals("-props")) { props=args[++i]; continue; } if(args[i].equals("-name")) { ...
41e84a45-823c-49a6-b0e9-703eef7160e6
5
public void handle(String path, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setStatus(HttpServletResponse.SC_OK); final int length = path.l...
63618175-fa73-4e05-a1a7-eddfe51b6846
0
public void AddPerson(Person tmp) { //set new priority IncrementPriority(); //set the person priority at the stop tmp.SetPriority(priority); //put a person on the stop busStop.add(tmp); //set minimum passangers this.SetMinimumPassenger(busStop...
58b9b9be-112d-4985-9d1d-75cef252c361
5
private void rateRecommendation(int rating){ //Save last recommendation ID with current context and rating to case base in MongoDB GUI.disableButtons(); if(!recommendationsToShow.isEmpty() && !contextInformation.isEmpty()&&useMongoDBConnection){ HashMap<String, String> data = contextInformation; data.put("R...
be2fc811-338f-42d1-a02c-c1c381048997
0
public static void main(String[] args) { // TODO code application logic here //JAPEREN IS ZO FIJN!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! }
0a64d48f-8025-4aca-90b5-fb76515746bf
5
private PairNode<T> combineSiblings( PairNode<T> firstSibling ) { if( firstSibling.nextSibling == null ) return firstSibling; // Store the subtrees in an array int numSiblings = 0; for( ; firstSibling != null; numSiblings++ ) { treeArray = doubleIfFull( treeArray, numSib...
0567d2e5-3584-45e3-a458-5b043000b3d6
4
public void setImage(String image) { int width = (300+this._partie.getParametre().getNbCaseX()+1)/this._partie.getParametre().getNbCaseX(); int height = (300+this._partie.getParametre().getNbCaseY()+1)/this._partie.getParametre().getNbCaseY(); this._image = image; String path = ...
1d515d3b-9302-4ea4-bc1f-61779d788aac
0
public void SetStream(OutputStream stream) throws IOException { ReleaseStream(); _stream = stream; }
d4e397fc-3aba-4c62-a24b-b5cbe0273386
0
public void setCp(String cp) { this.cp = cp; }
216e3f97-5a3b-4ed5-939b-52ff17ce77e6
7
@Test public void testValue() { System.out.println("value"); for (int i = 0; i < this._values.length; i++) { _equals.testValue(_instance, null, _values[i], false); _equals.testValue(_instance, _values[0], _values[i], false); _equals.testValue(_instance, _v...
719a337a-b058-4620-9eb8-743f1c668dc9
9
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) { if (!(table.getParent() instanceof JViewport)) { return; } JViewport viewport = (JViewport) table.getParent(); Rectangle rect = table.getCellRect(rowIndex, vColIndex, true); Rectangle viewRect =...
f455cfbc-e12d-4f38-b852-edf9c56263a8
7
private String[] getStringArray(JComponent comp) { if (comp instanceof JComboBox) { JComboBox comboBox = (JComboBox)comp; List<String> list = new ArrayList<String>(); if (comboBox.getItemCount() > 0) { for (int i = 0; i < comboBox.getItemCount(); i++) { if (!isEmpty(comboBox.get...
1c319651-4f75-48e5-afeb-aaa62c28b960
7
void poly_mul2(double u1[][], double u2[][], int p1[], int p2[], double u3[][], int p3[]) { int i1, j1, i2, j2, i3, j3, p11, p12, p21, p22; int i, j; double u1ij; for(i=0;i<2;i++) p3[i] = p1[i] + p2[i]; for(i=0;i<5;i++) for(j=0;j<5;j++) u3[i][j] = 0; p11 = p1[0]; p12 = p1[1]; p21 = p2[...
38dbc9e2-9aad-45b2-8ca3-8b95e5026fe3
0
public Tile[][] getGrid() { return grid; }
d00dbf1d-ff09-45ca-a468-5a70e3b4cacc
2
public static String bcd2Str(byte[] bytes) { StringBuffer temp = new StringBuffer(bytes.length * 2); for (int i = 0; i < bytes.length; i++) { temp.append((byte) ((bytes[i] & 0xf0) >>> 4)); temp.append((byte) (bytes[i] & 0x0f)); } return temp.toString()...
54a21615-2961-4e16-a575-7b8338a60e4d
2
private List loadAList(String[] someStrs) { List newList = new ArrayList(); try { for (int i = 0; i < someStrs.length; ++i) { newList.add(new DateTime(someStrs[i], DateTimeZone.UTC)); } // end of the for } catch (IllegalArgumentException pe) { ...
4b939021-b67b-4c0f-8abb-5c1b97974bf0
4
@Override public void put(Key key, Value val) { if (val == null) delete(key); if (N >= M / 2) resize(2 * M); int i; for (i = hash(key); keys[i] != null; i = (i + 1) % M) if (key.equals(keys[i])) { vals[i] = val; return; } keys[i] = key; vals[i] = val; N++; }
d9439a69-5331-4a79-a3e1-58c4f5956309
9
public MigratableProcessWrapper acceptProcess(String command, String[] args) { Class<?> processClass = null; Constructor<?> processCtr = null; MigratableProcessWrapper mpw = null; //Determine if there is a class for the command try { processClass = Class.forName(command); } catch (ClassNotFoundExcepti...
443be8e9-8ebe-4dfa-b098-f06f72f57f2a
3
public List<String> getListForQuery(String query) { List<String> resultList = new ArrayList<String>(); // try the following try { // open the connection to the database Connection connection = DriverManager.getConnection(this.urlStr); // create a statement ...
0587dabf-7263-4696-b6e4-18be19deb3fc
2
public static void main(String[] args) throws IOException { Twitter ex3 = new Twitter(); String s; // BufferedReader buff = new BufferedReader(new InputStreamReader(System.in)); // while (true) { // s = buff.readLine(); // if (s.contains("EXIT")) { // ...
bd7ba592-caac-4b23-8557-a8e79a81f713
7
@Override public Rideable findALadder(MOB mob, Room room) { if(room==null) return null; if(mob.riding()!=null) return null; for(int i=0;i<room.numItems();i++) { final Item I=room.getItem(i); if((I!=null) &&(I instanceof Rideable) &&(CMLib.flags().canBeSeenBy(I,mob)) &&(((Rideab...
c8632025-f02d-4a56-98f5-86473645acc8
4
private void checkAttribution() throws Exception { if(iterator < tokenList.size() && tokenList.get(iterator++).getType() != TokenType.ATTR) { // missing attribution symbol throw new Exception("Syntax Error at line " + tokenList.get(iterator-1).getLine() + ": Expected = and got \"" + tokenList.get(iterator...
0fc1c39e-04e9-45ad-bc17-21818853fd49
5
public void actionPerformed(ActionEvent e) { if (e.getSource() == openFile) { int returnVal = openWekaFile.showOpenDialog(UserInterface.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = openWekaFile.getSelectedFile(); logData.setText(logData.getText() + "Opening: " + file.getName() + "...
75dc7627-ccc9-4b5f-9cb4-9c67cbeca233
5
public void renameFolder(FolderDTO folderDTO, String folderNewName) throws DataProcessingException { if (folderDTO.getFolderName().equals("Inbox") || folderDTO.getFolderName().equals("Outbox") || folderDTO.getFolderName().equals("Draft")) { throw new DataProcessingException(ExceptionType.systemFolderRenami...
1d58c484-a6af-44e2-82d4-fa75cb65ec8a
3
@Override public ExecutionContext run(ExecutionContext context) throws InterpretationException { Value val1 = ((AbsValueNode) getChildAt(0)).evaluate(context); if (getChildAt(0) instanceof ThingVNode && val1.getType() == VariableType.ARRAYLIST) { if (((ArrayList<Value>) val1.getValue()...
7ffe38f4-7918-408a-8861-0359e7de33b2
2
public static List<Laureate> filterByName(List<Laureate> inputList, List<String> ListOfTerms) { List<Laureate> outputList = new ArrayList<>(); // parse input, keep what matchs the terms. for (Laureate Awinner : inputList) { if (ListOfTerms.contains(Awinner.getName())) { ...
6a3bb8bc-5149-4982-b927-2c98b58b23cc
2
public void Search(String indexLoc){ IndexReader ir; try { //Opens the files already indexed as CEDD ir = DirectoryReader.open(FSDirectory.open(new File(indexLoc))); ImageSearcher searcher = ImageSearcherFactory.createCEDDImageSearcher(10); ImageSearchHits hits = searcher.search(compImg, ir); ...
ef0c41ad-d7a4-4b72-93ad-08f17595e8a4
4
@Override public boolean equals(Object other) { if (other == null) return false; if (other == this) return true; if (this.room == null) return false; Row otherRow = (Row) other; return this.number == otherRow.getNumber() && this.room.equals(otherRow.getRoom()); }
3eef4ed4-da19-47e9-884f-4cf1c90dd831
3
public List<String> sortedKeys() { //Returns a List of type String, sorted based on their corresponding values. Uses insertion sort. List<String> keysList = getKeys(); int index; int v; String s; for(int i = 0; i < keysList.size(); i++) { index = i; s = keysList.remove(i); v = getInt(s); for(int j...
3bef0dd6-a78b-44fb-9549-064e1dbe86be
9
private void doOutputCommand(Command command) throws ControllerException, VariableException { if (output == null) throw new ControllerException("No output file specified"); StringBuffer line = new StringBuffer("|"); for (int i = 0; i < varList.length; i++) { // find val...
4476b0e5-6b9f-4e1e-b696-0e84de511ab8
9
private boolean r_verb_suffix() { int among_var; int v_1; int v_2; int v_3; // setlimit, line 174 v_1 = limit - cursor; // tomark, line 174 if (cursor < I_pV) { ...
f13cbdd1-0c15-4ddd-a35c-db2a07d4c9c1
4
public Varargs invoke(Varargs args) { switch (args.narg()) { case 0: return call(); case 1: return call(args.arg1()); case 2: return call(args.arg1(), args.arg(2)); case 3: return call(args.arg1(), args.arg(2), args.arg(3)); default: return call(args.arg1(), args.arg(2), args.arg(3), args.arg...
22b53e7e-a2fb-471d-8c38-21e0906ac2bc
2
public boolean isUnknown(int x, int y) { if (!isValidPosition(x,y)) return false; if (w[x][y].contains(UNKNOWN)) return true; else return false; }
4b669eb4-1d66-4a66-a1e5-5d0bb73033ea
4
public Boolean connect() { try { Class.forName("com.mysql.jdbc.Driver").newInstance(); this.dbConnect=DriverManager.getConnection("jdbc:mysql:"+this.dbURL,this.user,this.password); this.dbStatement = this.dbConnect.createStatement(); return true; } c...
27a6036a-8217-40fb-abfc-5dcdedd45d3d
1
public void lueLaskutoimitus() throws IllegalStateException { if (!paikkaOsaTunnusta()) { throw new IllegalStateException(); } Laskutoimitus lisattava = kirjasto.haeLaskutoimitus( syote.substring(paikka, paikka + 1)); lauseke.lisa...
27602841-4a22-4a83-9478-c8f98e30fb61
4
public void act() { setImage(flashScreen); if (style) { if (transparency > 0) { getImage().setTransparency(transparency--); } else { getWorld().removeObject(this); } } els...
6116602c-67df-4466-a892-0d397c805361
8
private int countNeighbours(int col,int row){ int total = 0; total = getCell(col-1, row-1) ? total + 1 : total; total = getCell( col , row-1) ? total + 1 : total; total = getCell(col+1, row-1) ? total + 1 : total; total = getCell(col-1, row ) ? total + 1 : total; total = getCell(col+1, row ) ? total + 1 :...
6010af39-2a77-41c4-91d6-9a497f326db7
4
public void checkFilterWeightControlParameterForBreadMaker() { // get bread makers by filter String searchParameter = "Регулировка веса"; getDriver().findElement( By.xpath(FiltersBlock.getFunction(searchParameter))).click(); List<Item> filteredBreadMakersList = new ArrayList<Item>(); while (true) { fil...
0fb2b6c8-a9f1-4aef-93fe-19a6c4289531
8
public void fazJogada() { int posP = 159; int num = 0; Peca peca = null; if (turno == 0) { for (int i = 0; i < 6; i++) { if (pecas[i].getDir() == pecas[i].getEsq()) { if (num < pecas[i].getDir()) { num = pecas[i].get...
362bbfdc-9827-4d63-bbee-d56d1d312163
7
public List<RawMaterial> getAvailableLine(MOB mob) { Item I=null; final List<RawMaterial> available=new Vector<RawMaterial>(); for(int i=0;i<mob.numItems();i++) { I=mob.getItem(i); if((I instanceof RawMaterial) &&((I.material()&RawMaterial.MATERIAL_MASK)==RawMaterial.MATERIAL_CLOTH) &&(!CMLib.flags...
0cd151f0-a0b7-493a-b961-b2eca77d5fa5
6
public synchronized void printInvisibleFields() { for (int k = 0; k < SIZE; k++) { for (int l = 0; l < SIZE; l++) { if (fField[k][l] == VALUE_SHIP) { System.out.print("S "); } if (fField[k][l]...
f96f7448-869d-48a6-98fd-358e42c91e61
8
public void loadConfig() { boolean bSaveFile = false; if (m_Plugin.getDataFolder().exists() == false) { m_Plugin.getDataFolder().mkdir(); } File configFile = new File(m_Plugin.getDataFolder(), m_ConfigFile); if (configFile.exists() == true) { try { ...
5ae3edad-1959-4832-869e-8accd7ec9960
9
public boolean VeranderOnderdeel(IOnderdeel onderdeel) { if (onderdeel.getCode() > 0 && onderdeel.getOmschrijving() != null && !onderdeel.getOmschrijving().equals("") && onderdeel.getAantal() > 0 && onderdeel.getPrijs() > 0) { try { ArrayList<IOnderdeel> onderdelen = db.GetOnderdelen...