id
stringlengths
36
36
text
stringlengths
1
1.25M
8f0c4340-d6f4-47c6-ac9f-eccc6fa2d2ba
public TreasureChest( String name){ contents = new ArrayList<String>(); this.name = name; }
7631dab0-8498-4937-ba06-edc875798f91
public int getId() { return id; }
d0897980-6f9f-4e5b-b0b7-f647107874dd
public void setId(int id) { this.id = id; }
9bd6eb30-45ef-47f4-8184-c30a0559486e
public String getName() { return name; }
96b1b090-a718-4c3d-810b-9bd994ee8dab
public void setName(String name) { this.name = name; }
5fa8d734-6a22-4d73-a3b0-9e5a01c39cd3
public List<String> getContents() { return contents; }
8daeae94-344b-48b8-8244-f18855791c6d
public void setContents(List<String> contents) { this.contents = contents; }
0ae89c82-3485-45f7-8cd4-6535b2ecd839
public void addToTreasureMap(String content){ if(contents!=null&&content!=null){ contents.add(content); } }
8f07a809-a668-40c9-84ce-9fc605363631
public void removeContent(String content){ if(contents!=null){ boolean contentPresent =contents.contains(content); if(contentPresent){ contents.remove(content); } } }
1042e7d0-9860-4044-b863-16f07c1f8fb6
public int hascode(){ final int HASH =7; int result = (HASH*31)+id ; return result ; }
714ab946-8b0e-4d1b-8d7e-5616a5181a3b
public boolean equals(Object obj){ boolean equal = false ; if(this==obj){ return true ; } if(obj==null){ return false; } if(getClass()!=obj.getClass()){ return false ; } TreasureChest chest = (TreasureChest)obj ; if(chest.getId()==getId()&&chest.getName().equalsIgnoreCase(getName())){ equa...
038e6a6a-d8c6-4844-9abf-df4adc5c3d0d
@Test public void testTreasureChestNearby(){ Grid g = new Grid(4, 5); g.addTreasureChest(new TreasureChest("1"), 0, 0); g.addTreasureChest(new TreasureChest("2"), 1, 2); TreasureChestManager v = new TreasureChestManager(); v.displayTreasureChestNearby(g); //TODO need to put in array to check the recor...
4e622c5b-7cc4-4a1c-b1c7-b3090f97c2a7
public void paint(Graphics g) { //g.drawImage(img, 0, 0, null); }
c40babae-fbb3-44d1-aa79-22905a7e72f2
public AuroraData LoadAndConvert() { /* * // Get a pixel int rgb = bufferedImage.getRGB(x, y); // Get all the pixels int w = bufferedImage.getWidth(null); int h = bufferedImage.getHeight(null); int[] rgbs = new int[w*h]; bufferedImage.getRGB(0, 0, w, h, rgbs, 0, w); // Set a pixe...
64594a8f-3f04-4fc0-9e9c-69bd2fefbe23
private double[][] manRGBArray(BufferedImage image, Hemisphere hemi){ double[][] rgbArray = new double[200][200]; int rgb = 3096;//Don't ask why int x=0; int y = 0; for (x = 0; x < 200; x++) { // loop x axis of the image for (y = 0; y < 200; y++) {// loop y axis // remove arrow or text if (hemi ...
83fade93-57c8-4809-82c4-7b834fd05b3a
public double getIntensity(int alpha, int red, int green, int blue) { if (alpha == 0) { return 0; } // bottom of scale is 0.0 and top of scale is 10.0. float[] hsbvals = new float[3]; hsbvals = Color.RGBtoHSB(red, green, blue, hsbvals); double intensity = 0; if (h...
093d2618-dc68-4584-982d-21095c0c12c5
public static void main(String args[]) { Converter c = new Converter(); c.LoadAndConvert(); }
e0f5a6fd-ad4a-4092-a981-b25c15bc8a6b
public double[][] getS() { return s; }
c422ddb6-ca13-4893-8d2f-14793c6e60c4
public void setS(double[][] s) { this.s = s; }
db71540d-41fd-4bcf-b25e-800744def4de
public double[][] getN() { return n; }
f820383c-6dd3-400a-8a5b-4c00433b63a7
public void setN(double[][] n) { this.n = n; }
7adf2b6e-9629-42bf-9f07-73edea18baba
public AuroraData() { }
4607da59-8efe-480b-9931-0473963db771
public AuroraController() { }
441bb23b-6d81-4a2e-ae37-c816819c90bc
@RequestMapping(value = "/now") public @ResponseBody AuroraData now(HttpServletResponse response) throws IOException { return converter.LoadAndConvert(); }
a5384900-02d7-4368-a8e3-d15b3442d6c6
@RequestMapping(value="/weather") public void weather(HttpServletResponse response) throws IOException { String url = "http://www.spaceweather.gc.ca/apps/conditions/php/ajax/get_current_conditions.php"; HttpMethod method = new GetMethod(url); HttpClient client = new HttpClient(); client.executeMethod(method)...
01c9e1a7-0452-4f90-b12a-736e04d154e2
@RequestMapping("") public String index() { return "index"; }
3edae49a-0a40-4ca0-8bdd-df2232faf970
@Override public void serialize(double[][] value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { jgen.writeStartArray(); for (int i = 0; i < value.length; i++) { jgen.writeStartArray(); for (int j = 0; j < value[i].length; j++) { if (value[i][j] == (i...
543f2b15-1f36-42b0-bd93-11df5f57301d
@Override public RecordReader getRecordReader(InputSplit split, JobConf job, Reporter reporter) throws IOException { // Set the input schema right before the retrieving the record reader Schema schema = ReflectData.get().getSchema(WikiCategoryLink.class); AvroJob.setInputSchema(job, schema);...
d8836493-2bc8-464f-9f38-b7ed9524cad0
public AvroOutputUnion getOutputUnion() { AvroOutputUnion aou = new AvroOutputUnion(); aou.wcl = this; return aou; }
b5acedfb-36be-4596-a84d-738c34f04aad
@Override public RecordReader getRecordReader(InputSplit split, JobConf job, Reporter reporter) throws IOException { // Set the input schema right before the retrieving the record reader Schema schema = ReflectData.get().getSchema(WikiPage.class); AvroJob.setInputSchema(job, schema); ...
8837cade-de2e-4c0f-a14e-92202ff9a0ef
public AvroOutputUnion getOutputUnion() { AvroOutputUnion aou = new AvroOutputUnion(); aou.wp = this; return aou; }
118b6499-3466-498c-83d7-7ae16629a3d3
public AvroOutputUnion getOutputUnion();
7c2612fd-068b-4fd0-a073-b5a4e8cabc1e
public static void main(String [] args) throws Exception { ToolRunner.run(new WPJoin(), args); }
2e147b0e-7dc7-4d56-a23e-87fdc1850ef8
public int run(String[] args) throws IOException { JobConf jc = new JobConf(getConf(), getClass()); AvroJob.setReflect(jc); MultipleInputs.addInputPath(jc, new Path(args[0]), AvroMIFWikiPage.class, WPPageJoinMapper.class); MultipleInputs.addInputPath(jc, new Path(args[1]), AvroM...
83a45fa0-04dd-4dc4-ac57-824e0f63bed2
public WikiTitleCategoryLink() {}
f8cf4fd4-f06e-40fe-8a40-769f2ad1b344
public WikiTitleCategoryLink(WikiCategoryLink wcl, String title) { set(wcl, title); }
bac0731e-4910-43a5-9512-7e095d840929
public void set(WikiCategoryLink wcl, String title) { this.id = wcl.id; this.to = wcl.to; this.sortkey = wcl.sortkey; this.timestamp = wcl.timestamp; this.sortkey_prefix = wcl.sortkey_prefix; this.collation = wcl.collation; this.type = ...
6eadc22f-53f7-44c5-b7ac-c3282ce10d50
public int getPartition(AvroKey<JoinKey> k2, AvroValue v2, int i) { return k2.datum().key.hashCode() % i; }
02c899d2-5f1a-4ac2-b73b-6292b1d84a49
public void configure(JobConf jc) { }
72f65b9b-b999-47ad-b3ce-697d058ae89e
@Override public int compare(AvroWrapper<JoinKey> x, AvroWrapper<JoinKey> y) { JoinKey xk, yk; xk = x.datum(); yk = y.datum(); return xk.key.compareTo(yk.key); }
dc8b2268-5d47-495c-a220-6cbb2a7482e3
public void map(AvroWrapper k1, NullWritable v1, OutputCollector<AvroKey<JoinKey>, AvroValue<AvroOutputUnion>> oc, Reporter rprtr) throws IOException { try { JoinKey jk = new JoinKey(); AvroUnionConstructorVisitor obj = (AvroUnionConstructorVisitor)k1.datum()...
df7e1c25-b8b9-41fc-8c94-0c65f4619fab
public WPPageJoinMapper() { cls = WikiPage.class; position = 0; joinfield = "id"; }
4f222e78-5b81-48c4-8546-985401c456ac
public WPCategoryLinkJoinMapper() { cls = WikiCategoryLink.class; position = 1; joinfield = "id"; }
218c4341-33bc-488a-a11e-53434ff3fc88
@Override public void reduce(JoinKey key, Iterable<AvroOutputUnion> values, AvroCollector<WikiTitleCategoryLink> collector, Reporter reporter) throws IOException { WikiPage wp = null; WikiTitleCategoryLink wtcl = new WikiTitleCategoryLink(); for(AvroOutputUnion a...
1024efaf-3aa4-4474-811d-32fe3807bdd4
@Override public String getCore() { return "collection1"; }
06e090df-aaf3-4bd4-a23f-ffbd70733028
@Test public void testQueryVideo() { SolrQuery query = new SolrQuery(); query.set("q", "video"); query.addFacetField("cat"); query.setFacetLimit(10); query.setFacetMinCount(1); try { QueryResponse response = server.query(query); SolrDocumentList docs = response.getResults(); for (SolrDocument doc...
97ad6772-b171-42b6-aae1-8643f1784492
@Test public void testSearchByCursor() { SolrQuery query = new SolrQuery(); int pageSize = 3; query.set("q", "video"); query.setRows(pageSize); query.setSort("id", ORDER.asc); /** * There also is another way to check does this loop should be stopped * via checking the currentMark, If currentMark is i...
5e633e1b-80ef-4a44-a98b-0e93b744a65b
@Test public void testIndexDoc() { }
070c2e34-07f3-4fd6-a0a6-ee0ac874984f
@Test public void testDeleteById() { try { server.deleteById("ABC DEF"); server.commit(); } catch (SolrServerException e) { logger.error(e.getMessage(), e); } catch (IOException e) { logger.error(e.getMessage(), e); } }
93acca40-39d1-49f2-9410-14e9c98e1ad9
public String getCore(){ return "collection4"; }
bf2203db-972f-4f42-bb69-ccc99bf798dd
@Override public String getServerURL() { return "http://localhost:8080/solr"; }
e51d5212-ef2a-493b-bb44-2af708ad50ef
@Test(enabled=true) public void eraseIndexRepository() { try { SolrQuery params = new SolrQuery(); params.set("q", "*:*"); params.setRows(100); QueryResponse response=server.query(params); for(SolrDocument doc:response.getResults()){ System.out.println(doc.getFieldValue("id")); } server.setS...
0525229a-da0e-4017-a4e0-aa7d53cabbb2
public String getCore(){ return ""; }
cbefb208-c3fa-409f-84a4-d47fd3d82e4c
public String getServerURL(){ return serverURL; }
6ead71e5-1d3b-4597-a1c9-a3268616e7d7
@BeforeClass public void init() { server = new HttpSolrServer(getServerURL()+"/"+getCore()); server.setMaxRetries(1); // defaults to 0. > 1 not recommended. server.setConnectionTimeout(5000); // 5 seconds to establish TCP // Setting the XML response parser is only required for cross // version compatibility ...
e4a0f3c2-60fc-4c00-98be-2dda3a9ea0d2
@AfterClass public void shutdown() { server.shutdown(); logger.info("Shutdown server...."); }
966f131e-8ba8-4c8c-bd94-0f6bcb68b35f
public String getCore(){ return "collection1"; }
fd62abfe-b705-4ffd-892f-1546e38e24c9
@DataProvider(name = "simpleDocDatas") public Item[][] getData() { // These docs will be distributed to different shard(s) according to you // algorithm Item[][] result = new Item[4][1]; Item item = new Item(); item.setCategories(new String[] { "feed" }); item.setId("我们都"); result[0][0] = item; item =...
53cf9fbc-62da-42d6-9dc0-95ae93b66e01
@Test(dataProvider = "simpleDocDatas") public void testIndexSimpleBean(Item item) { try { server.addBean(item); } catch (SolrServerException e) { logger.error(e.getLocalizedMessage(), e); } catch (IOException e) { logger.error(e.getLocalizedMessage(), e); } }
07123de2-6e31-48e5-b815-b5b42da77810
@AfterClass(alwaysRun = true) public void doCommit() { logger.info("Start to commit all request...."); UpdateResponse response; try { response = server.commit(); Assert.assertEquals(response.getStatus(), 0, "Fail to update/add Index"); } catch (SolrServerException e) { logger.error(e.getMessage()...
776ef799-844d-4a48-8c30-9c605b43a35b
@Test public void testIndexSimple1() { // http://localhost:8080/solr/select/?q=id:ABC SolrInputDocument doc = new SolrInputDocument(); doc.addField("id", "ABC"); doc.addField("name", "Lewisl Test1-V2"); doc.addField("category", "human being"); try { server.add(doc); UpdateResponse response = server.c...
a2ef8650-2993-46b1-8a1d-05165192752c
@Test public void testIndexSimpleBean() { // http://localhost:8080/solr/select/?q=cat:Tools Item item = new Item(); item.setCategories(new String[] { "Tools", "Softwear" }); item.setId("ABC DEF"); try { server.addBean(item); UpdateResponse response = server.commit(); Assert.assertEquals(response.ge...
d5c45859-039d-4289-af90-9b69c76a6636
public String getId() { return id; }
f74431c5-1a5c-4da1-97bf-3b0cd5f6ed74
public void setId(String id) { this.id = id; }
29400040-2d93-413f-ae26-61cce862df32
public String[] getCategories() { return categories; }
9d4256c5-0d6f-4a54-bc0d-6a7cdb3291cc
public void setCategories(String[] categories) { this.categories = categories; }
7e278bcb-7aee-412c-b71a-3e97cfa9fc43
public List<String> getFeatures() { return features; }
160262d0-49b3-4912-9d01-fb554a72501f
public void setFeatures(List<String> features) { this.features = features; }
c565785d-b9d3-41a9-adcd-74311d48b2fb
public String getRouterRef() { return routerRef; }
fe0cf603-bf18-41d9-aea1-03a488f636c8
public void setRouterRef(String routerRef) { this.routerRef = routerRef; }
4ead876b-a6cb-42dc-bbde-3a1a2a27cd42
@Before public void setup() { driver = new FirefoxDriver(); }
8bf140b2-cf79-4d7f-a6f4-bf43feb2307c
@After public void tearDown() { driver.close(); }
2702100a-1f60-4645-b385-a82c61823369
@Test public void testWithdrawal$100() { visitCashman(); withdraw(100); assertEquals(100, totalDispensed()); }
de655986-b73b-4a9f-ae89-31866669467f
private void visitCashman() { driver.get("http://tomcat.corsamore.com/cashman"); }
2367f356-69f8-4934-ba6f-8c055d299155
private void withdraw(int amount) { driver.findElement(By.id("cashmachine_withdrawalAmount")).sendKeys(String.valueOf(amount)); driver.findElement(By.id("cashmachine_Withdraw")).click(); }
a7dff6ad-3dc9-4920-8174-fda8c3c551ae
private int totalDispensed() { int total = 0; List<WebElement> elements = driver.findElement(By.id("cashmachine_Withdrawal")).findElements(By.tagName("tr")); for(WebElement element : elements) { List<WebElement> dispensedNote = element.findElements(By.tagName("td")); if(d...
e11e1320-6d26-45b3-a6ed-f65defb5ab94
@Before public void beforeScenario() { if(driver==null) { driver = new FirefoxDriver(); } if(baseUrl==null) { baseUrl = "http://tomcat.corsamore.com"; } }
84b0527c-0bfe-4fcf-9033-1d33dcd003a6
@After public void afterScenario() { driver.close(); }
464f1279-fab4-4d60-93b3-b877afe16a61
public CashMachinePage CashMachine() { return new CashMachinePage(); }
2d5d230a-d349-4a1e-be0a-fad33cc5c607
@Given("^I go to the cash machine$") public void I_go_to_the_cash_machine() { CashMachine().visit(); }
77e0294d-602c-4d14-8cf1-362af16d115f
@When("^I select to withdraw \\$(\\d+)$") public void I_select_to_withdraw_$(int amount) { CashMachine().withdraw(amount); }
1fcf5866-47cc-4128-a5ef-8f207a2baeb7
@Then("^I should receive (\\d+) note of (.*)$") public void I_should_receive_$(int numNote, String noteType) { assertEquals(numNote, CashMachine().numDispencedNotes(noteType)); }
47b3ebb9-5818-401f-98b1-f6245fe53368
public void visit(String pageUrl) { driver.get(baseUrl + "/" + pageUrl); }
57daf401-b521-4ab4-a458-4b370f742f6b
public void visit() { super.visit(PAGE_URL); }
dcc788a8-e708-45a0-a036-7311c385952e
public void withdraw(int amount) { driver.findElement(withdrawalAmount).sendKeys(String.valueOf(amount)); driver.findElement(withdrawalConfirm).click(); }
22a6488b-11f0-40d0-acb6-b142e22f3413
public int numDispencedNotes(String note) { List<WebElement> elements = driver.findElement(withdrawalNotes).findElements(By.tagName("tr")); for(WebElement element : elements) { List<WebElement> dispensedNote = element.findElements(By.tagName("td")); if(dispensedNote.size()<=1) co...
5b379991-899e-4443-96c9-45ca222dbad6
public LoginBean() { // TODO Auto-generated constructor stub }
af7bbb09-e555-44f1-b687-94a190dc82f4
public void validar(ActionEvent event) { if (event.getComponent().getId().equals("validarId")) { try { FacesContext context = FacesContext.getCurrentInstance(); HttpServletResponse response = (HttpServletResponse) context .getExternalContext().getResponse(); Usuario us = new Usuario(); Usuari...
df9b1713-0f24-4f4f-b947-c2ef0f57d80b
public void refresh() { FacesContext context = FacesContext.getCurrentInstance(); Application application = context.getApplication(); ViewHandler viewHandler = application.getViewHandler(); UIViewRoot viewRoot = viewHandler.createView(context, context .getViewRoot().getViewId()); context....
ff21462c-0993-4112-863b-d5bfad0ad7fd
public String getName() { return name; }
24c0c9a8-d7f6-4b8a-92f2-a2fc6f77bb73
public void setName(String name) { this.name = name; }
976548f8-28a2-456d-aad8-dc18d7c2bf8e
public String getPassword() { return password; }
1de5be80-ee63-4e50-9d75-6f68623cdd96
public void setPassword(String password) { this.password = password; }
67668d93-bb67-443b-9862-feff07c2ea4c
public String getUser() { return user; }
ad9f43a2-11eb-49d1-a768-6883011b468b
public void setUser(String user) { this.user = user; }
16b10f13-dea9-4596-8b3d-82176f6f6ade
public int getId() { return id; }
89dc5c88-6091-4bca-9d89-072fcb43184f
public void setId(int id) { this.id = id; }
289b5e24-6015-472b-82f7-ba2974eb47d3
public String getMensaje() { return mensaje; }
cfd3877a-1c9f-48a7-8425-12f52c7c0075
public void setMensaje(String mensaje) { this.mensaje = mensaje; }
a62b96bc-f0f7-47df-be03-11dc58372a0c
public boolean isRender() { return render; }