blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 7
332
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
50
| license_type
stringclasses 2
values | repo_name
stringlengths 7
115
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 557
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
684M
⌀ | star_events_count
int64 0
77.7k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 17
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 82
values | src_encoding
stringclasses 28
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 7
5.41M
| extension
stringclasses 11
values | content
stringlengths 7
5.41M
| authors
listlengths 1
1
| author
stringlengths 0
161
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
29b6bbb5c2075edaddc9f8a8a497d54773b141da
|
a0d6c4bcfcb3edd8e47ee7b95963b252795d2fec
|
/src/bog1/Main.java
|
cf3266e906d0985e5c30778c1efda4f5433434e1
|
[] |
no_license
|
Mathias2860DK/EksamensOpgaver
|
836abcddf6601bf3069e146276d8809ff36e9f83
|
b9cfbc89a94c024b7ad08e1521b810e545c4520b
|
refs/heads/master
| 2023-02-09T01:02:27.851535 | 2021-01-04T12:33:35 | 2021-01-04T12:33:35 | 311,970,611 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 549 |
java
|
package bog1;
public class Main {
public static void main(String[] args) {
Library library = new Library();
Bog bog = new Bog(12345,"Java Programming",2010);
Bog bog2 = new Bog(1234,"Python Programming",2018);
Bog bogTest = new Bog (123222,"nejtak",2020);
library.addBog(bog);
library.addBog(bog2);
System.out.println("denne bog er ikke bibloteket :" + library.isBookInLibrary(bogTest));
System.out.println("denne bog er i bibloteket :" + library.isBookInLibrary(bog2));
}
}
|
[
"[email protected]"
] | |
e2c8ad6e8156cb6172ce7627429d2aea5a371235
|
fa4383b3673bdb946c68a27ee67a5c81237de731
|
/src/main/java/com/pavan/utill/WebPage.java
|
f52be689f4740b472b55fb64a74b2f81839fdb02
|
[] |
no_license
|
pavanhitesh/project_cucumber
|
377270ff5d0428dbc36256210cc4ee9ad06d5269
|
6395974950e5b7a6701db77aaf0cd4bd99524e59
|
refs/heads/master
| 2022-06-16T07:41:37.253540 | 2022-06-01T15:11:09 | 2022-06-01T15:11:09 | 63,466,426 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 23,239 |
java
|
package com.pavan.utill;
import java.io.File;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.safari.SafariDriver;
import org.openqa.selenium.safari.SafariOptions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;
import com.pavan.cvsreader.CallerContext;
import com.pavan.cvsreader.GuiObjectsMap;
public class WebPage
{
private static WebDriver d = null;
private static WebDriverWait wait;
private static final Logger logger = LogManager.getLogger(WebPage.class);
private CallerContext context = new CallerContext();
public WebPage(WebDriver d) {
this.d = d;
wait = new WebDriverWait(this.d, 40);
}
/**
* To get the webDriver Instance
* Where ever needed in the other class
*
* */
public WebDriver getWD() {
return d;
}
/**
* To create the required browser instance.
*
* @param Browser
* @return the instance of created web-driver
* @throws MalformedURLException
*/
public WebDriver createWebDriverInstance(String Browser) throws MalformedURLException
{
if(d==null && Browser.equals("Firefox"))
{
d = new FirefoxDriver();
logger.info("--FireFox Browser has opened ");
}
else if(d==null && Browser.equals("Chrome"))
{
String path ="binary/chromedriver.exe";
System.setProperty("webdriver.chrome.driver", path);
ChromeOptions options = new ChromeOptions();
DesiredCapabilities caps = DesiredCapabilities.chrome();
d = new ChromeDriver(caps);
logger.info("--Chrome Browser has opened ");
}
else if (d==null && Browser.equals("IE"))
{
String path ="binary/IEDriverServer.exe";
System.setProperty("webdriver.ie.driver", path);
logger.info("--IEDriver has setup");
DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
caps.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);
caps.setCapability("requireWindowFocus", true);
caps.setCapability("enablePersistentHover", true);
caps.setCapability("native events", true);
d = new InternetExplorerDriver(caps);
logger.info("--IE Browser has opened ");
}
else if (d==null && Browser.equals("Safari"))
{
File safariExt = new File("binary/SafariDriver2.32.0.safariextz");
SafariOptions opt = new SafariOptions();
//opt.addExtensions(safariExt);
DesiredCapabilities capabilities = DesiredCapabilities.safari();
capabilities.setCapability(SafariOptions.CAPABILITY, opt);
capabilities.setCapability("requireWindowFocus", true);
capabilities.setCapability("enablePersistentHover", true);
capabilities.setCapability("native events", true);
d = new SafariDriver(capabilities);
logger.info("--Safari Browser has opened ");
}
else if (d==null && Browser.equals("IE32bit"))
{
String path ="binary/IEDriverServer_32bit.exe";
System.setProperty("webdriver.ie.driver", path);
logger.info("--IEDriver has setup");
DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
caps.setCapability(
InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
true);
caps.setCapability("requireWindowFocus", true);
caps.setCapability("enablePersistentHover", false);
caps.setCapability("native events", true);
d = new InternetExplorerDriver(caps);
logger.info("--IE Browser has opened ");
}
return d;
}
/**
* Fetch the locator from the gui map .If the key is not found ,pass the
* locator as the literal and try to perform the action.
*
* @param locator
* @return
* @throws Exception
*/
public String getUiObjectLocator(String locator) throws Exception {
String callingClass = context.getClassExecutionStack()[3].getCanonicalName();
System.out.println("Thecalling Class is "+context.getClassExecutionStack()[0].getCanonicalName());
System.out.println("Thecalling Class is "+context.getClassExecutionStack()[1].getCanonicalName());
System.out.println("Thecalling Class is "+context.getClassExecutionStack()[2].getCanonicalName());
System.out.println("Thecalling Class is "+context.getClassExecutionStack()[3].getCanonicalName());
System.out.println("Thecalling Class is "+context.getClassExecutionStack()[4].getCanonicalName());
String c1 = GuiObjectsMap.getGuiMap().get(callingClass + "." + locator);
if (c1 == null) {
callingClass = context.getClassExecutionStack()[4].getCanonicalName();
c1 = GuiObjectsMap.getGuiMap().get(callingClass + "." + locator);
if (c1 == null) {
/*
* AppLogger.getLogger().info( "could not find key for " +
* locator + ", using literal text instead");
*/
return locator;
}
return c1;
}
else
return c1;
}
/**
* Fetch the locator from the gui map .If the key is not found ,pass the
* locator as the literal and try to perform the action.
*
* @param locator
* @return
* @throws Exception
*/
public String getUiDataMap(String label) throws Exception {
String callingClass = context.getClassExecutionStack()[2].getCanonicalName();
System.out.println("Thecalling Class is "+context.getClassExecutionStack()[0].getCanonicalName());
System.out.println("Thecalling Class is "+context.getClassExecutionStack()[1].getCanonicalName());
System.out.println("Thecalling Class is "+context.getClassExecutionStack()[2].getCanonicalName());
System.out.println("Thecalling Class is "+context.getClassExecutionStack()[3].getCanonicalName());
System.out.println("Thecalling Class is "+context.getClassExecutionStack()[4].getCanonicalName());
String c1 = GuiObjectsMap.getDataMap().get(callingClass + "." + label);
if (c1 == null) {
callingClass = context.getClassExecutionStack()[4].getCanonicalName();
c1 = GuiObjectsMap.getDataMap().get(callingClass + "." + label);
if (c1 == null) {
/*
* AppLogger.getLogger().info( "could not find key for " +
* locator + ", using literal text instead");
*/
return label;
}
return c1;
}
else
return c1;
}
/**
* To open the defined URL.
* @param URL
* @return and return the given URL if needed
* @throws Exception
*/
public String openURL(String URL) throws Exception {
getWD().get(URL);
getWD().manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
return URL;
}
/**
* To Wait for required amount of time for each action performed in the called method
* @param Seconds
*/
public void wait(int Seconds) {
getWD().manage().timeouts().implicitlyWait(Seconds, TimeUnit.SECONDS);
}
/**
* To Wait the Execution for required amount of seconds
* @param Seconds
* @throws InterruptedException
*/
public void delay(int Seconds) throws InterruptedException {
Thread.sleep(Seconds * 1000);
}
/**
* Waits for page to load
* @throws Exception
*/
public void waitForPageToLoad() throws Exception {
WebDriverWait wait = new WebDriverWait(getWD(),40);
wait.until(ExpectedConditions.visibilityOfElementLocated(By
.xpath("//*[not (.='')]")));
}
/**
* To Get WebElement Based on the locator type
* @param elementlocator
* @return
*/
public WebElement getId(String elementlocator) {
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id(elementlocator)));
return getWD().findElement(By.id(elementlocator));
}
public WebElement getName(String elementlocator) {
wait.until(ExpectedConditions.visibilityOfElementLocated(By.name(elementlocator)));
return getWD().findElement(By.name(elementlocator));
}
public WebElement getXpath(String elementlocator) {
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(elementlocator)));
return getWD().findElement(By.xpath(elementlocator));
}
public WebElement getCSS(String elementlocator) {
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(elementlocator)));
return getWD().findElement(By.cssSelector(elementlocator));
}
public WebElement getClassName(String elementlocator) {
wait.until(ExpectedConditions.visibilityOfElementLocated(By.className(elementlocator)));
return getWD().findElement(By.className(elementlocator));
}
public WebElement getLinkText(String elementlocator) {
wait.until(ExpectedConditions.visibilityOfElementLocated(By.linkText(elementlocator)));
return getWD().findElement(By.linkText(elementlocator));
}
/**
* Does not wait for the page to load .Just clicks and proceeds for the next
* statement.
*
* @param elementlocator
* @param idtype
* @throws Exception
*/
public void click(String elementlocator,String locatortype) throws Exception {
if (locatortype.equalsIgnoreCase("id")) {
getId(elementlocator).click();
} else if (locatortype.equalsIgnoreCase("name")) {
getName(locatortype).click();
} else if (locatortype.equalsIgnoreCase("xpath")) {
getXpath(elementlocator).click();
} else if (locatortype.equalsIgnoreCase("css")) {
getCSS(elementlocator).click();
} else if (locatortype.equalsIgnoreCase("class")) {
getClassName(elementlocator).click();
} else if (locatortype.equalsIgnoreCase("link")) {
getLinkText(elementlocator).click();
}
}
/**
* Click on the required element and waits page to load
*
*
* @param elementlocator
* @param locatortype
* @throws Exception
*/
public void clickAndWait(String elementlocator , String locatortype) throws Exception {
click(elementlocator, locatortype);
waitForPageToLoad();
}
/**
* To Find the WebElement in the web page.
* @param element
* @param idtype
* @return
*/
public WebElement getWebElement(String elementlocator, String locatortype)
{
WebElement element=null;
if (locatortype.equalsIgnoreCase("id")) {
element = getId(elementlocator);
} else if (locatortype.equalsIgnoreCase("name")) {
element = getName(locatortype);
} else if (locatortype.equalsIgnoreCase("xpath")) {
element = getXpath(elementlocator);
} else if (locatortype.equalsIgnoreCase("css")) {
element = getCSS(elementlocator);
} else if (locatortype.equalsIgnoreCase("class")) {
element = getClassName(elementlocator);
} else if (locatortype.equalsIgnoreCase("link")) {
element = getLinkText(elementlocator);
}
return element;
}
/**
* To Maximize the window.
*/
public void maximize()
{
getWD().manage().window().maximize();
}
/**
* To Close the Instance of the Created WebDriver and assign the NULL.
*/
public void close()
{
getWD().close();
getWD().quit();
d = null;
}
/**
* Returns the visible text of the element.
*
* @param elementlocator
* @param locatortype
* @return
* @throws Exception
*/
public String getText(String elementlocator , String locatortype) throws Exception {
String Text =null;
Text = getWebElement(elementlocator, locatortype).getText();
return Text;
}
/**
* Returns the visible text of the element.
*
* @param elementlocator
* @param locatortype
* @return
* @throws Exception
*/
public String getValue(String elementlocator , String locatortype) throws Exception {
String Text =null;
Text = getWebElement(elementlocator, locatortype).getAttribute("value");
return Text;
}
/**
* Check a toggle-button (checkbox/radio)
*
* @param elementlocator
* @param locatortype
*/
public void check(String elementlocator , String locatortype) {
WebElement element = getWebElement(elementlocator, locatortype);
if (!element.isSelected()) {
element.click();
}
}
/**
* Uncheck a toggle-button (checkbox/radio)
* if element is selected
*
*
* @param elementlocator
* @param locatortype
* @throws Exception
*/
public void uncheck(String elementlocator , String locatortype) throws Exception {
WebElement element = getWebElement(elementlocator, locatortype);
if (element.isSelected()) {
element.click();
}
}
/**
* To Select the visible text option from the Dropdown
* present in the webpage.
*
*
* @param selectlocator
* @param locatortype
* @param optionText
* @throws Exception
*/
public void selectByVisibleText(String selectlocator , String locatortype , String optionText) throws Exception {
WebElement element= getWebElement(selectlocator, locatortype);
new Select(element).selectByVisibleText(optionText);
}
/**
* to get the selected value from the drop down list.
*
* @param selectlocator
* @param locatortype
* @return
*/
public String selectedValue(String selectlocator , String locatortype) {
WebElement element=getWebElement(selectlocator, locatortype);
return new Select(element).getFirstSelectedOption().getText();
}
/**
* Simulates a user hovering a mouse over the specified element.
*
*
* @param elementlocator
* @param locatortype
*/
public void mouseOver(String elementlocator,String locatortype) {
WebElement element = getWebElement(elementlocator, locatortype);
Actions builder = new Actions(getWD());
builder.moveToElement(element).build().perform();
}
/**
* Simulates a user hovering a mouse over the specified element.
* and click on the particular element.
*
* @param elementlocator
* @param locatortype
*/
public void mouseOverClick(String elementlocator,String locatortype) {
WebElement element = getWebElement(elementlocator, locatortype);
Actions builder = new Actions(getWD());
builder.moveToElement(element).click().build().perform();
}
/**
* Gets whether a toggle-button (checkbox/radio) is checked.
*
*
* @param elementlocator
* @param locatortype
* @return true if the checkbox is checked, otherwise false
* @throws Exception
*/
public boolean isChecked(String elementlocator , String locatortype) throws Exception {
WebElement element = getWebElement(elementlocator, locatortype);
return element.isSelected();
}
/**
* Gets whether a webelement is displayed or not.
*
*
* @param elementlocator
* @param locatortype
* @return true if the specified element is visible,otherwise false
* @throws Exception
*/
public boolean isVisible(String elementlocator , String locatortype) throws Exception {
try {
WebElement element=getWebElement(elementlocator, locatortype);
return element.isDisplayed();
} catch(Exception e) {
return false;
}
}
/**
* to get non display fields in the webpage
* given input as map;
* @param Map1
* @return
* @throws Exception
*/
public ArrayList<String> isElementVisible(Map<String,Pojo> Map1) throws Exception {
ArrayList<String> nondisplay = new ArrayList<String>();
for (Map.Entry<String, Pojo> entry : Map1.entrySet()) {
Pojo obj = Map1.get(entry.getKey());
if(isVisible(obj.getProperty(),obj.getPropertyType())) {
System.out.println(entry.getKey()+" is available in the screen");
} else {
logger.info(entry.getKey()+" is not available in the screen");
System.out.println(entry.getKey()+" is not available in the screen");
nondisplay.add(entry.getKey());
}
}
logger.info("The Undisplayed Fields are " +nondisplay);
return nondisplay;
}
/**
* to get the uncleared text boxes
* @param Map1
* @return
* @throws Exception
*/
public ArrayList<String> isAlltxtFieldsCleared(Map<String,Pojo> Map1) throws Exception {
ArrayList<String> nondisplay = new ArrayList<String>();
for (Map.Entry<String, Pojo> entry : Map1.entrySet()) {
Pojo obj = Map1.get(entry.getKey());
if(getValue(obj.getProperty(), obj.getPropertyType()).contentEquals("")) {
logger.info(entry.getKey()+"is Cleared");
} else {
logger.info(entry.getKey()+"is not Cleared");
nondisplay.add(entry.getKey());
}
}
logger.info("The Uncleared Fields are " +nondisplay);
return nondisplay;
}
/**
* To sendkeys in to any text box present on webelement
*
*
* @param elementlocator
* @param locatortype
* @param valuetotype
*/
public void sendKeys(String elementlocator , String locatortype , String valuetotype) {
getWebElement(elementlocator, locatortype).sendKeys(valuetotype);
}
/**
* Returns the title of the current active window
*
* @return title of the open web page
* @throws Exception
*/
public String getTitle() throws Exception
{
return getWD().getTitle();
}
/**
* To Get the List of WebElement
*
*
* @param elementlocator
* @param locatortype
* @return
*/
public List<WebElement> getWebElementList(String elementlocator , String locatortype) {
List<WebElement> elementlist=null;
if(locatortype.equalsIgnoreCase("id")) {
elementlist =getWD().findElements(By.id(elementlocator));
} else if(locatortype.equalsIgnoreCase("xpath")) {
elementlist =getWD().findElements(By.xpath(elementlocator));
} else if(locatortype.equalsIgnoreCase("css")) {
elementlist =getWD().findElements(By.cssSelector(elementlocator));
} else if (locatortype.equalsIgnoreCase("class")) {
elementlist =getWD().findElements(By.className(elementlocator));
} else if(locatortype.equalsIgnoreCase("link")) {
elementlist =getWD().findElements(By.linkText(elementlocator));
} else if(locatortype.equalsIgnoreCase("name")) {
elementlist =getWD().findElements(By.name(elementlocator));
}
return elementlist;
}
/**
* To get the Xpath count of
* any element present in the web page
*
* @param elementlocator
* @return
* @throws Exception
*/
public int getXPathCount(String elementlocator) throws Exception {
return getWD().findElements(By.xpath(elementlocator)).size();
}
/**
* To switch the cursor the defined iframe located in the web page
*
* @param framelocator
* @param locatortype
*/
public void switchFrame(String framelocator , String locatortype) {
WebElement element;
element = getWebElement(framelocator, locatortype);
getWD().switchTo().frame(element);
}
/**
* To switch the cursor the default web page.
*/
public void switchToDefaultConatiner() {
getWD().switchTo().defaultContent();
}
/**
* To verify the alert present in the web page
*
*
* @return true if alert present , other wise false.
* @throws Exception
*/
public boolean isAlertPresent() throws Exception {
try {
WebDriverWait wait = new WebDriverWait(getWD(), 20);
wait.until(ExpectedConditions.alertIsPresent());
return true;
}
catch(Exception e) {
return false;
}
}
/**
* to get the values in the drop down
* @param Property
* @param PropertyType
* @return
*/
public ArrayList<String> getDropDownValue(String Property , String PropertyType) {
ArrayList<String> ddlvalues = new ArrayList<String>();
WebElement SelectDDL = getWebElement(Property, PropertyType);
Select select = new Select(SelectDDL);
List<WebElement> values = select.getOptions();
for(WebElement value :values) {
ddlvalues.add(value.getText());
}
return ddlvalues;
}
/**
* To get the text present on the Alert
* or confirmation box.
*
* @return
* @throws Exception
*/
public String getAlertText() throws Exception {
String alerttext = null;
alerttext =getWD().switchTo().alert().getText();
return alerttext;
}
/**
* To click OK on the Confirmation box
* or accept the alert
*
* @throws Exception
*/
public void chooseOkOnNextConfirmation() throws Exception {
getWD().switchTo().alert().accept();
}
/**
* To Click No on the confirmation box.
* or to dismiss alert
*
* @throws Exception
*/
public void chooseNoOnNextConfirmation() throws Exception {
getWD().switchTo().alert().dismiss();
}
/**
* to handle windows
* @return
*/
/**
* To read the Text on the confirmation box.
* or to dismiss alert
*
* @throws Exception
*/
public String windowHandle() {
String parentWindow = getWD().getWindowHandle();
for(String childWindow: getWD().getWindowHandles()) {
getWD().switchTo().window(childWindow);
}
return parentWindow;
}
/**
* to Switch between windows
* @param Window
*/
public void switchWindow(String Window) {
getWD().switchTo().window(Window);
}
/**
* to execute java scripts
* @param Code
*/
public void javaScrpitExcecutor(String Code) {
JavascriptExecutor javascript = (JavascriptExecutor)getWD();
javascript.executeScript(""+Code+"");
}
/**
* to generate Alert with
* user defined message
* @param Message
* @param secondstoAccept
* @throws Exception
*/
public void generateAlertandAccept(String Message, int secondstoAccept) throws Exception {
javaScrpitExcecutor("alert('"+Message+"');");
delay(secondstoAccept);
chooseOkOnNextConfirmation();
}
public void waitforPageLoadJS() {
JavascriptExecutor javascript = (JavascriptExecutor)getWD();
javascript.executeScript("return document.readyState").equals("complete");
}
public void mouseclick(WebElement a,WebElement b) {
try {
String mouseOverScript = "if(document.createEvent){var evObj = document.createEvent('MouseEvents');evObj.initEvent('mouseover',true, false); arguments[0].dispatchEvent(evObj);} else if(document.createEventObject) { arguments[0].fireEvent('onmouseover');}";
((JavascriptExecutor) getWD()).executeScript(mouseOverScript,a);
Thread.sleep(1000);
((JavascriptExecutor) getWD()).executeScript(mouseOverScript,b);
Thread.sleep(1000);
((JavascriptExecutor) getWD()).executeScript("arguments[0].click();",b);
} catch (Exception e) {
}
}
/**
* To clear the Data
* @param elementlocator
* @param locatortype
* @throws Exception
*/
public void Clear(String elementlocator,String locatortype) throws Exception {
getWebElement(elementlocator, locatortype).clear();
}
}
|
[
"[email protected]"
] | |
95235ad4ad080128069da6c993d5d45983cbb99b
|
7875cb66e28481c5f04720d216d9c641ad24cfdf
|
/app/src/main/java/com/zsp/storeapp/glide/GlideLoadUtils.java
|
021dcd9d2fe04bf8a0606d9782d31fb03bc8d053
|
[] |
no_license
|
zsp19931222/StoreAPP
|
9337b32b77c1ec80e8702a8f46f0b77f536fa12e
|
40897b60ad98ed8ee312f3e3c7f42f9060960a94
|
refs/heads/master
| 2023-02-25T18:32:00.124161 | 2021-02-02T06:15:52 | 2021-02-02T06:15:52 | 322,530,758 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,497 |
java
|
package com.zsp.storeapp.glide;
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;
import androidx.annotation.DrawableRes;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestBuilder;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.zsp.storeapp.R;
import me.andy.mvvmhabit.util.ZLog;
/**
* description:Glide 加载 简单判空封装 防止异步加载数据时调用Glide 抛出异常
* author:created by Andy on 2019/6/20 0020 15:33
* email:[email protected]
*/
public class GlideLoadUtils implements GlideLoadInterface {
public static final int BORDER_RADIUS = 45;
public static final int NORMAL = 0;
/**
* 借助内部类 实现线程安全的单例模式
* 属于懒汉式单例,因为Java机制规定,内部类SingletonHolder只有在getInstance()
* 方法第一次调用的时候才会被加载(实现了lazy),而且其加载过程是线程安全的。
* 内部类加载的时候实例化一次instance。
*/
//判断Activity是否Destroy
public static boolean isDestroy(Activity activity) {
return activity == null || activity.isFinishing() || activity.isDestroyed();
}
private static class GlideLoadUtilsHolder {
private final static GlideLoadUtils INSTANCE = new GlideLoadUtils();
}
public static GlideLoadUtils getInstance() {
return GlideLoadUtilsHolder.INSTANCE;
}
public GlideLoadUtils() {
}
/**
* @param context
* @param url 加载图片的url地址 String
* @param imageView 加载图片的ImageView 控件
* @param default_image 图片展示错误的本地图片 id
* @param radius 圆角(0-无圆角,45-圆图片,其他值-相对应的圆角图片)
* @description:Glide 加载 简单判空封装 防止异步加载数据时调用Glide 抛出异常
* @author:Andy
* @date:2019/6/20 0020 15:41
*/
@Override
public void glideLoad(Context context, Object url, ImageView imageView, int default_image, int radius) {
try {
if (context != null) {
if (!isDestroy((Activity) context)) {
Glide.with(imageView.getContext()).load(url)
.apply(new RequestOptions()
// .fitCenter()
// .centerCrop()
.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
.placeholder(default_image)
.error(default_image).centerCrop()
.transform(new GlideRoundTransform(imageView.getContext(), radius)))
.thumbnail(loadTransform(imageView.getContext(), default_image, radius))
.into(imageView);
}
} else {
ZLog.i("Picture loading failed,context is null");
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* description: 使用RadiusImageView在布局里面设置圆角
* author: Andy
* date: 2019/8/1 0001 10:47
*/
public void glideLoad(Context context, Object url, ImageView imageView, int default_image) {
try {
if (context != null) {
if (!isDestroy((Activity) context)) {
Glide.with(imageView.getContext()).load(url)
.apply(new RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)
.placeholder(R.mipmap.default_icon_image)
.error(R.mipmap.default_icon_image).centerCrop()
)
.into(imageView);
}
} else {
ZLog.i("Picture loading failed,context is null");
}
} catch (Exception e) {
}
}
private static RequestBuilder<Drawable> loadTransform(Context context, @DrawableRes int placeholderId, float radius) {
return Glide.with(context)
.load(placeholderId)
.apply(new RequestOptions().centerCrop()
.transform(new GlideRoundTransform(context, radius)));
}
}
|
[
"[email protected]"
] | |
753e15d0bb662b9f26f8be907c28345fece340bb
|
84d3d42fdbbf9d946a1b314580f13242edc54a22
|
/imagezxlingDemo/app/src/main/java/com/qin/imagezxlingdemo/Questionmake.java
|
9269c07b359979cb1b8286d6ff2fe60018e7e98c
|
[] |
no_license
|
Ysilence/survey
|
10244ee509a20cb0bd75ec1700569f356ced9413
|
f033b57fb85575333ebfab4f1f291fa79489e8df
|
refs/heads/master
| 2021-01-27T21:42:27.598092 | 2020-04-03T05:17:58 | 2020-04-03T05:17:58 | 243,487,804 | 0 | 0 | null | 2020-02-27T10:04:21 | 2020-02-27T10:04:21 | null |
UTF-8
|
Java
| false | false | 2,545 |
java
|
package com.qin.imagezxlingdemo;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.RadioButton;
public class Questionmake extends AppCompatActivity {
public static String answer="NONE";
public String Json="NONE";
public EditText option1;
public EditText option2;
public EditText option3;
public EditText option4;
public EditText question;
public RadioButton single;
public RadioButton mul;
public String ques;
public String an1;
public String an2;
public String an3;
public String an4;
public String type;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_questionmake);
single=(RadioButton)findViewById(R.id.rbsingle);
mul=(RadioButton)findViewById(R.id.rbmul);
question = (EditText) findViewById(R.id.et_question);
option1 = (EditText) findViewById(R.id.et_option1);
option2 = (EditText) findViewById(R.id.et_option2);
option3 = (EditText) findViewById(R.id.et_option3);
option4 = (EditText) findViewById(R.id.et_option4);
}
public void next(View view)
{
ques=question.getText().toString();
if(single.isChecked())
{
type="single";
}
if(mul.isChecked())
{
type="multiple";
}
an1=option1.getText().toString();
an2=option2.getText().toString();
an3=option3.getText().toString();
an4=option4.getText().toString();
if (an3==null) {
Json = "{\"survey\":{\"id\":\"1\",\"len\":\"1\",\"questions\":[{\"type\":\""+type+"\",\"question\":\""+ques+"\",\"options\":[{\"1\":\""+an1+"\"},{\"2\":\""+an2+"\"}]}]}}\n";
}
else if(an4==null)
{
Json = "{\"survey\":{\"id\":\"1\",\"len\":\"1\",\"questions\":[{\"type\":\""+type+"\",\"question\":\""+ques+"\",\"options\":[{\"1\":\""+an1+"\"},{\"2\":\""+an2+"\"},{\"3\":\""+an3+"\"}]}]}}\n";
}
else
{
Json = "{\"survey\":{\"id\":\"1\",\"len\":\"1\",\"questions\":[{\"type\":\""+type+"\",\"question\":\""+ques+"\",\"options\":[{\"1\":\""+an1+"\"},{\"2\":\""+an2+"\"},{\"3\":\""+an3+"\"},{\"4\":\""+an4+"\"}]}]}}\n";
}
answer=Json;
Intent intent = new Intent(this, Qrcode.class);
startActivity(intent);
}
}
|
[
"[email protected]"
] | |
809e7b1c5dcded53a1a54bb2733c7e37102ff871
|
f508b10791522ae022b3aec15322519e4bf9b101
|
/JDBDriver.java
|
7237e94975b9249bb1fbdde7c7aa4322c943cac7
|
[] |
no_license
|
agil98/CPSC-304-Project
|
aae80b0bfeac017b2c8f6f4efa83c79e361bf94c
|
22005c126ddee1366899131bf2c4c32791901138
|
refs/heads/master
| 2020-04-20T17:22:24.623285 | 2020-02-03T23:52:23 | 2020-02-03T23:52:23 | 168,986,779 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 43,391 |
java
|
JDBCConnection.java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class JDBCConnection {
private BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
public static Connection getConnection1() {
Connection con = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe", "victoria", "Kodak123");
} catch (Exception e) {
System.out.println("Error in connection" + e);
}
return con;
}
private void showMenu() {
int userType;
int choice;
boolean quit;
quit = false;
Connection con = getConnection1();
try {
// disable auto commit mode
con.setAutoCommit(false);
System.out.print("Welcome to our Arena!\n");
System.out.print("\n\nWhat kind of user are you? \n");
System.out.print("1. Attendee\n");
System.out.print("2. Attraction\n");
System.out.print("3. Sponsor\n");
System.out.print("4. Employee\n");
System.out.print("5. For demo only: all queries in deliverable order\n>>");
userType = Integer.parseInt(in.readLine());
while (!quit) {
// also we need TYPE CHECKING when we are getting user input!!!!!
// we can group these in ways that make more sense later.
// need error handling for duplicate key
// Deliverables from Formal Project Specification
if (userType == 1) {
// event attendees
// deliverable 2
System.out.print("1. Create (insert) a new event attendee\n");
// deliverable 4
System.out.print("2. Update credit card information\n");
System.out.print("3. Purchase a ticket\n");
// deliverable 10, select attractions by their genres/sport
System.out.print("4. View (select) all available attractions of a given genre\n");
// deliverable 11, create view
System.out.print("5. View concerts occuring within the next month (view)\n");
// deliverable 6, 2 table join
System.out.print("6. View eventID based off genre (join)\n");
System.out.print("7. Quit\n>> ");
choice = Integer.parseInt(in.readLine());
System.out.println(" ");
switch (choice) {
case 1:
CustomerQueries.insertNewAttendee();
break;
case 2:
CustomerQueries.updateAttendee();
break;
case 3:
CustomerQueries.purchaseTicket();
break;
case 4:
CustomerQueries.viewAvailableAttractions();
break;
case 5:
CustomerQueries.createNextMonthView();
CustomerQueries.viewNextMonthEvents();
break;
case 6:
EmployeeQueries.getEventsFromGenre();
break;
case 7:
quit = true;
}
}
if (userType == 2) {
// attractions
// deliverable 3
System.out.print("1. Create (insert) an event booking\n");
System.out.print("2. Cancel (delete) an EVENT BOOKING by ID\n");
// deliverable 7, group by gender and age
System.out.print("3. View demographic (AVG age and gender) statistics of attendees\n");
System.out.print("4. Quit\n>> ");
choice = Integer.parseInt(in.readLine());
System.out.println(" ");
switch (choice) {
case 1:
CustomerQueries.createEventBooking();
break;
case 2:
CustomerQueries.cancelEventBooking();
break;
case 3:
CustomerQueries.viewDemographicStatistics();
break;
case 4:
quit = true;
}
}
if (userType == 3) {
// sponsors
System.out.print("1. Sponsor a sporting event\n");
System.out.print("2. Sponsor a concert event\n");
// deliverable 7, group by gender and age
System.out.print("3. View demographic (AVG age and gender) statistics of attendees\n");
// deliverable 10, group attractions by their genres/sport
System.out.print("4. View (select) all available attractions of a given genre/sport\n");
System.out.print("5. Quit\n>> ");
choice = Integer.parseInt(in.readLine());
System.out.println(" ");
switch (choice) {
case 1:
SponsorQueries.insertSportingEventSponsor();
break;
case 2:
SponsorQueries.insertConcertEventSponsor();
break;
case 3:
CustomerQueries.viewDemographicStatistics();
break;
case 4:
CustomerQueries.viewAvailableAttractions();
break;
case 5:
quit = true;
}
}
if (userType == 4) {
// employees
// deliverable 2
System.out.print("1. Create (insert) a new sporting EVENT\n");
System.out.print("2. Create (insert) a new concert EVENT\n");
// deliverable 3
System.out.print("3. Cancel (delete) a sporting event by ID\n");
System.out.print("4. Cancel (delete) a concert event by ID\n");
// deliverable 6, 2 table join
System.out.print("5. View eventID based off genre (join)\n");
// deliverable 7, group by gender and age
System.out.print("6. View demographic (AVG age and gender) statistics of attendees\n");
// deliverable 8, update the date of a concert
System.out.print("7. Update the date of a concert\n");
System.out.print("8. Update the date of a sporting event\n");
// deliverable 9, additional query, view events scheduled to work for
System.out.print("9. View (select) events you are scheduled to work for\n");
// deliverable 5, 3 table join
System.out.print("10. View Employee names working at a specific event (join)\n");
System.out.print("11. Quit\n>> ");
choice = Integer.parseInt(in.readLine());
System.out.println(" ");
switch (choice) {
case 1:
EmployeeQueries.insertNewSportingEvent();
break;
case 2:
EmployeeQueries.insertNewConcertEvent();
break;
case 3:
EmployeeQueries.deleteSportingEvent();
break;
case 4:
EmployeeQueries.deleteConcertEvent();
break;
case 5:
EmployeeQueries.getEventsFromGenre();
break;
case 6:
CustomerQueries.viewDemographicStatistics();
break;
case 7:
EmployeeQueries.updateConcertEvent();
break;
case 8:
EmployeeQueries.updateSportingEvent();
break;
case 9:
EmployeeQueries.viewSchedule();
break;
case 10:
EmployeeQueries.seeEmployeesWorkingAtEvent();
break;
case 11:
quit = true;
}
}
if (userType == 5) {
System.out.print("**Note that these are not all are queries\n");
//System.out.print("Deliverable 1:\n");
System.out.print("Deliverable 2: Create (insert) a new event attendee\n");
System.out.print("Deliverable 3: Cancel (delete) a sporting event by ID\n");
System.out.print("Deliverable 4: Update credit card information\n");
System.out.print("Deliverable 5: View Employee names working at a specific event (join)\n");
System.out.print("Deliverable 6: View eventID based off genre (join)\n");
System.out.print("Deliverable 7: View demographic (AVG age and gender) statistics of attendees\n");
System.out.print("Deliverable 8: Update the date of a concert\n");
System.out.print("Deliverable 9: View (select) events you are scheduled to work for\n");
System.out.print("Deliverable 10: View (select) all available attractions grouped by a given genre\n");
System.out.print("Deliverable 11: View concerts occuring within the next month (view)\n");
System.out.print("Quit\n>> ");
choice = Integer.parseInt(in.readLine());
System.out.println(" ");
switch (choice) {
case 1:
CustomerQueries.insertNewAttendee();
break;
case 2:
CustomerQueries.insertNewAttendee();
break;
case 3:
EmployeeQueries.deleteSportingEvent();
break;
case 4:
CustomerQueries.updateAttendee();
break;
case 5:
EmployeeQueries.seeEmployeesWorkingAtEvent();
break;
case 6:
EmployeeQueries.getEventsFromGenre();
break;
case 7:
CustomerQueries.viewDemographicStatistics();
break;
case 8:
EmployeeQueries.updateConcertEvent();
break;
case 9:
EmployeeQueries.viewSchedule();
break;
case 10:
CustomerQueries.viewAvailableAttractions();
break;
case 11:
CustomerQueries.createNextMonthView();
CustomerQueries.viewNextMonthEvents();
break;
case 12:
quit = true;
}
}
}
con.close();
in.close();
System.out.println("\nThanks for stopping by the Arena!\n\n");
System.exit(0);
} catch (IOException e) {
System.out.println("IOException!");
try {
con.close();
System.exit(-1);
} catch (SQLException ex) {
System.out.println("Message: " + ex.getMessage());
}
} catch (SQLException ex) {
System.out.println("Message: " + ex.getMessage());
}
}
public static void main(String[] args) {
new JDBCConnection().showMenu();
}
}
CustomerQueries.java
import java.sql.Statement;
import java.util.Calendar;
import java.util.concurrent.ThreadLocalRandom;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
public class CustomerQueries {
private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
public static void insertNewAttendee() throws SQLException {
int creditCardNum;
int age;
String gender;
String name;
String email;
PreparedStatement ps;
Connection con = JDBCConnection.getConnection1();
con.setAutoCommit(false);
try {
ps = con.prepareStatement("INSERT INTO attendee VALUES (?,?,?,?,?,?,?)");
// for insertion, need to make sure that this primary key isnt taken -> how to
// do
// also how to handle char vs string? do we need to make char array?
// also need to implement type checking for insertion and update
System.out.print("\nName: ");
name = in.readLine();
ps.setString(1, name);
System.out.print("\nEmail: ");
email = in.readLine();
ps.setString(2, email);
// total points gets default to 0
ps.setInt(3, 0);
System.out.print("\nCredit card #: ");
creditCardNum = Integer.parseInt(in.readLine());
ps.setInt(4, creditCardNum);
// ticket amount default to zero
ps.setInt(5, 0);
System.out.print("\nAge: ");
age = Integer.parseInt(in.readLine());
ps.setInt(6, age);
System.out.print("\nGender: "); //
gender = in.readLine();
ps.setString(7, gender);
// String phoneTemp = in.readLine();
// if (phoneTemp.length() == 0) {
// ps.setNull(5, java.sql.Types.INTEGER);
// } else {
// bphone = Integer.parseInt(phoneTemp);
// ps.setInt(5, bphone);
// }
ps.executeUpdate();
System.out.println("New user inserted.");
System.out.println();
// commit work
con.commit();
ps.close();
} catch (IOException e) {
System.out.println("IOException!");
} catch (SQLException ex) {
System.out.println("Message: " + ex.getMessage());
try {
// undo the insert
con.rollback();
} catch (SQLException ex2) {
System.out.println("Message: " + ex2.getMessage());
System.exit(-1);
}
}
catch (Exception e) {
System.out.println("Please make sure input values are correct!" + e);
}
}
// adds a record to the table willAttend (relationship btwn ticket, attendee,
// and event) and then calls buyTicket which inserts to the ticket table
public static void purchaseTicket() throws SQLException {
int eventID;
int seatNum;
int sectionNum;
String name;
String email;
PreparedStatement ps;
Connection con = JDBCConnection.getConnection1();
con.setAutoCommit(false);
try {
ps = con.prepareStatement("INSERT INTO willAttend VALUES (?,?,?,?,?)");
// for insertion, need to make sure that this primary key isnt taken -> how to
// do
// also how to handle char vs string? do we need to make char array?
// also need to implement type checking for insertion and update
System.out.print("\nName: ");
name = in.readLine();
ps.setString(1, name);
System.out.print("\nEmail: ");
email = in.readLine();
ps.setString(2, email);
System.out.print("\nSection number #: ");
sectionNum = Integer.parseInt(in.readLine());
ps.setInt(3, sectionNum);
System.out.print("\nSeat number #: ");
seatNum = Integer.parseInt(in.readLine());
ps.setInt(4, seatNum);
// TODO need a way to check event ID is valid
System.out.print("\nEvent ID: ");
eventID = Integer.parseInt(in.readLine());
Statement st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet res = st
.executeQuery("select attractionid from eventattractions" + " where eventid = " + eventID);
res.next();
int attractionID = res.getInt(1);
buyTicket(sectionNum, seatNum, name, email, eventID, attractionID);
ps.setInt(5, eventID);
ps.executeUpdate();
con.commit();
ps.close();
System.out.println("Ticket purchased");
} catch (IOException e) {
System.out.println("IOException!");
} catch (SQLException ex) {
System.out.println("User or event does not exist: " + ex.getMessage());
try {
// undo the insert
con.rollback();
} catch (SQLException ex2) {
System.out.println("User or event does not exist: " + ex2.getMessage());
System.exit(-1);
}
} catch (Exception e) {
System.out.println("Please make sure input values are correct!");
}
}
// adds purchase to the ticket table
public static void buyTicket(int secNum, int seatNum, String name, String email, int eventID, int attractionID)
throws SQLException {
PreparedStatement ps;
Connection con = JDBCConnection.getConnection1();
Date today = new Date(Calendar.getInstance().getTime().getTime());
con.setAutoCommit(false);
try {
ps = con.prepareStatement("INSERT INTO verifiedTicket VALUES (?,?,?,?,?,?,?,?,?)");
// for insertion, need to make sure that this primary key isnt taken -> how to
// do
ps.setInt(1, secNum);
ps.setInt(2, seatNum);
// set default price as $100
ps.setInt(3, 100);
// set todays date
ps.setDate(4, today);
// not verified yet
ps.setBoolean(5, false);
// default to 100 points
ps.setInt(6, 100);
ps.setString(7, email);
ps.setString(8, name);
ps.setInt(9, attractionID);
ps.executeUpdate();
// commit work
con.commit();
ps.close();
} catch (SQLException ex) {
System.out.println("Message: " + ex.getMessage());
try {
// undo the insert
con.rollback();
} catch (SQLException ex2) {
System.out.println("Message: " + ex2.getMessage());
System.exit(-1);
}
}
catch (Exception e) {
System.out.println("Please make sure input values are correct!" + e);
}
}
// can update credit card
public static void updateAttendee() throws SQLException {
int cardnum;
String name;
String email;
PreparedStatement ps;
Connection con = JDBCConnection.getConnection1();
con.setAutoCommit(false);
try {
System.out.print("\nName: ");
name = in.readLine();
System.out.print("\nEmail: ");
email = in.readLine();
System.out.print("\nNew card number: ");
cardnum = Integer.parseInt(in.readLine());
ps = con.prepareStatement("UPDATE attendee SET creditcard# = " + cardnum + " WHERE name = '" + name
+ "' and email = '" + email + "'");
int rowCount = ps.executeUpdate();
if (rowCount == 0) {
System.out.println("\nUser does not exist!");
} else
System.out.println("\nCredit card info upated.");
con.commit();
System.out.println("");
ps.close();
} catch (IOException e) {
System.out.println("IOException!");
} catch (SQLException ex) {
System.out.println("Message: " + ex.getMessage());
try {
con.rollback();
} catch (SQLException ex2) {
System.out.println("Message: " + ex2.getMessage());
System.exit(-1);
}
}
catch (Exception e) {
System.out.println("Please make sure input values are correct!" + e);
}
}
public static void viewAvailableAttractions() {
String genre;
try {
Connection con = JDBCConnection.getConnection1();
PreparedStatement ps;
ps = con.prepareStatement("select groupName from attraction4 where genre = ?");
System.out.print("\nGenre (Pop, Retro, Indie, Rap): ");
genre = in.readLine();
Statement st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet res = st.executeQuery("select attractionName from attraction where genre = '" + genre + "'");
// TODO error checking here if result set is empty
while (res.next()) {
// this number needs to be switched to whatever the name column is
System.out.println(res.getString(1) + " ");
}
res.close();
con.close();
} catch (Exception e) {
System.out.println("Please make sure input values are correct!" + e);
}
}
public static void createNextMonthView() throws SQLException {
Calendar oneMonth = Calendar.getInstance();
oneMonth.add(Calendar.MONTH, 1);
Date today = new Date(Calendar.getInstance().getTime().getTime());
Date nextMonth = new Date(oneMonth.getTime().getTime());
PreparedStatement ps;
PreparedStatement drop;
Connection con = JDBCConnection.getConnection1();
con.setAutoCommit(false);
try {
try {
drop = con.prepareStatement("drop view nextMonthEvent");
drop.executeQuery();
con.commit();
drop.close();
} catch (Exception e) {
// if we can't drop it thats fine
}
// need to drop next month event and commit that
ps = con.prepareStatement(
"create view nextMonthEvent as " + "select eventName, eventID from concert where performancedate>'"
+ today + "'and performancedate<'" + nextMonth + "'");
ps.executeUpdate();
// commit work
con.commit();
ps.close();
} catch (SQLException ex) {
System.out.println("Message: " + ex.getMessage());
try {
// undo the insert
con.rollback();
} catch (SQLException ex2) {
System.out.println("Message: " + ex2.getMessage());
System.exit(-1);
}
}
catch (Exception e) {
System.out.println("Please make sure input values are correct!" + e);
}
}
public static void viewNextMonthEvents() {
try {
Connection con = JDBCConnection.getConnection1();
Statement st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet res = st.executeQuery("select * from nextMonthEvent");
System.out.println("Events happening next month:");
while (res.next()) {
System.out.println(res.getString(1));
}
res.close();
con.close();
System.out.println("");
} catch (Exception e) {
System.out.println("Error in fetching data" + e);
}
}
public static void createEventBooking() throws SQLException {
int attractionID;
int eventID;
int price;
PreparedStatement ps;
Connection con = JDBCConnection.getConnection1();
con.setAutoCommit(false);
try {
ps = con.prepareStatement("INSERT INTO books VALUES (?,?,?)");
// are we supposed to generate our own event id here or what
System.out.print("\nAttraction ID: ");
attractionID = Integer.parseInt(in.readLine());
ps.setInt(1, attractionID);
System.out.print("\nEvent ID: ");
eventID = Integer.parseInt(in.readLine());
ps.setInt(2, eventID);
// for price, for now we'll simulate a scheme by
// using a random number generator that goes between $1000-$5000 dollars
price = ThreadLocalRandom.current().nextInt(1000, 5001);
ps.setInt(3, price);
ps.executeUpdate();
// commit work
con.commit();
System.out.println("Booking created.");
ps.close();
} catch (IOException e) {
System.out.println("IOException!");
} catch (SQLException ex) {
System.out.println("Message: " + ex.getMessage());
try {
// undo the insert
con.rollback();
} catch (SQLException ex2) {
System.out.println("Message: " + ex2.getMessage());
System.exit(-1);
}
}
catch (Exception e) {
System.out.println("Please make sure input values are correct!" + e);
}
}
public static void cancelEventBooking() throws SQLException {
int eventID;
PreparedStatement ps;
Connection con = JDBCConnection.getConnection1();
con.setAutoCommit(false);
try {
ps = con.prepareStatement("DELETE FROM books where eventID = ?");
System.out.print("\nEvent ID: ");
eventID = Integer.parseInt(in.readLine());
ps.setInt(1, eventID);
int rowCount = ps.executeUpdate();
if (rowCount == 0) {
System.out.println("\nBooking does not exist!");
} else
System.out.println("\nBooking cancelled.");
// commit work
con.commit();
ps.close();
} catch (IOException e) {
System.out.println("IOException!");
} catch (SQLException ex) {
System.out.println("Message: " + ex.getMessage());
try {
// undo the insert
con.rollback();
} catch (SQLException ex2) {
System.out.println("Message: " + ex2.getMessage());
System.exit(-1);
}
}
catch (Exception e) {
System.out.println("Please make sure input values are correct!" + e);
}
}
// group by gender and age from attendee
// added those to table to do this
public static void viewDemographicStatistics() {
try {
Connection con = JDBCConnection.getConnection1();
Statement st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet res = st.executeQuery("select gender, avg(age) from attendee group by gender");
ResultSetMetaData rsmd = res.getMetaData();
// get number of columns
int numCols = rsmd.getColumnCount();
System.out.println(" ");
// display column names;
for (int i = 0; i < numCols; i++) {
// get column name and print it
System.out.printf("%-15s", rsmd.getColumnName(i + 1));
}
System.out.println(" ");
while (res.next()) {
System.out.print(res.getString(1));
System.out.println(res.getInt(2));
}
res.close();
con.close();
} catch (Exception e) {
System.out.println("Error in fetching data" + e);
}
}
}
EmployeeQueries.java
import java.sql.Statement;
import java.util.Calendar;
import java.util.concurrent.ThreadLocalRandom;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
public class EmployeeQueries {
private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
// deliverable 2
// TODO: add to JDBCConnection.java
// SportingEvent(eventID: INTEGER, capacity: INTEGER, ticketsSold: INTEGER,
// date: DATE,
// sponsorPrice: INTEGER, sponsorID: INTEGER, homeTeamID: INTEGER, awayTeamID:
// INTEGER, employeeID: INTEGER)
public static void insertNewSportingEvent() throws SQLException {
int eventID;
int homeTeamID;
int awayTeamID;
String date;
String eventName;
PreparedStatement ps;
Connection con = JDBCConnection.getConnection1();
con.setAutoCommit(false);
try {
ps = con.prepareStatement("INSERT INTO sport VALUES (?,?,?,?,?)");
System.out.println("Event ID: ");
eventID = Integer.parseInt(in.readLine());
ps.setInt(1, eventID);
System.out.println("Event name: ");
eventName = in.readLine();
ps.setString(2, eventName);
System.out.println("Home Team ID: ");
homeTeamID = Integer.parseInt(in.readLine());
ps.setInt(3, homeTeamID);
System.out.println("Away Team ID: ");
awayTeamID = Integer.parseInt(in.readLine());
ps.setInt(4, awayTeamID);
System.out.println("Date: YY-MM-DD: ");
date = in.readLine();
ps.setString(5, date);
/*
* System.out.print("\nEvent Capacity: "); capacity =
* Integer.parseInt(in.readLine()); ps.setInt(5, capacity);
*/
// default value of tickets sold so far is set to 0
// ps.setInt(6, ticketsSold);
// ps = con.prepareStatement("INSERT INTO sport VALUES " + eventID + homeTeamID
// + awayTeamID + date + capacity);
ps.executeUpdate();
// commit work
con.commit();
System.out.println("Event inserted.");
ps.close();
} catch (IOException e) {
System.out.println("IOException!");
} catch (SQLException ex) {
System.out.println("Message: " + ex.getMessage());
try {
// undo the insert
con.rollback();
} catch (SQLException ex2) {
System.out.println("Message: " + ex2.getMessage());
System.exit(-1);
}
}
catch (Exception e) {
System.out.println("Please make sure input values are correct!" + e);
}
}
// deliverable 2
// TODO: add additional query case to JDBCConnection.java to handle different
// event types
public static void insertNewConcertEvent() throws SQLException {
int eventID;
String date;
String eventName;
PreparedStatement ps;
Connection con = JDBCConnection.getConnection1();
con.setAutoCommit(false);
try {
ps = con.prepareStatement("INSERT INTO concert VALUES (?,?,?)");
System.out.print("\nEvent ID: ");
eventID = Integer.parseInt(in.readLine());
ps.setInt(1, eventID);
System.out.println("Event name: ");
eventName = in.readLine();
ps.setString(2, eventName);
System.out.println("Date: YY-MM-DD: ");
date = in.readLine();
ps.setString(3, date);
/*
* System.out.print("\nEvent Capacity: "); capacity =
* Integer.parseInt(in.readLine());
*/
// ps.setInt(3, sectionNum);
// default value of tickets sold so far is set to 0
// ps.setInt(4, ticketsSold);
// ps = con.prepareStatement("INSERT INTO concert VALUES " + eventID + date +
// capacity);
ps.executeUpdate();
// commit work
con.commit();
System.out.println("Event inserted.");
ps.close();
} catch (IOException e) {
System.out.println("IOException!");
} catch (SQLException ex) {
System.out.println("Message: " + ex.getMessage());
try {
// undo the insert
con.rollback();
} catch (SQLException ex2) {
System.out.println("Message: " + ex2.getMessage());
System.exit(-1);
}
}
catch (Exception e) {
System.out.println("Please make sure input values are correct!" + e);
}
}
// TODO: add additional query case in JDBCConnection.java to handle the two
// event types
public static void deleteSportingEvent() throws SQLException {
int eventID;
PreparedStatement ps;
Connection con = JDBCConnection.getConnection1();
con.setAutoCommit(false);
try {
System.out.print("\nSporting Event ID: ");
eventID = Integer.parseInt(in.readLine());
// ps.setInt(1, eventID);
ps = con.prepareStatement("DELETE FROM sport where eventID = " + eventID);
int rowCount = ps.executeUpdate();
if (rowCount == 0) {
System.out.println("\nEvent does not exist!");
} else
System.out.println("Event deleted!");
con.commit();
// commit work
con.commit();
ps.close();
} catch (IOException e) {
System.out.println("IOException!");
} catch (SQLException ex) {
System.out.println("Message: " + ex.getMessage());
try {
// undo the insert
con.rollback();
} catch (SQLException ex2) {
System.out.println("Message: " + ex2.getMessage());
System.exit(-1);
}
}
catch (Exception e) {
System.out.println("Please make sure input values are correct!" + e);
}
}
public static void deleteConcertEvent() throws SQLException {
int eventID;
PreparedStatement ps;
Connection con = JDBCConnection.getConnection1();
con.setAutoCommit(false);
try {
System.out.print("\nConcert Event ID: ");
eventID = Integer.parseInt(in.readLine());
// ps.setInt(1, eventID);
ps = con.prepareStatement("DELETE FROM concert where eventID = " + eventID);
int rowCount = ps.executeUpdate();
if (rowCount == 0) {
System.out.println("\nEvent does not exist!");
} else
System.out.println("Event deleted!");
// commit work
con.commit();
ps.close();
} catch (IOException e) {
System.out.println("IOException!");
} catch (SQLException ex) {
System.out.println("Message: " + ex.getMessage());
try {
// undo the insert
con.rollback();
} catch (SQLException ex2) {
System.out.println("Message: " + ex2.getMessage());
System.exit(-1);
}
}
catch (Exception e) {
System.out.println("Please make sure input values are correct!" + e);
}
}
// deliverable 6, two-table join between attraction and concert
// get the eventID of events based off their genre
public static void getEventsFromGenre() throws SQLException {
String genre;
Connection con = JDBCConnection.getConnection1();
con.setAutoCommit(false);
try {
// can also just figure out this statment just by testing w db
System.out.print("\nPick a genre (Pop, Retro, Indie, Rap): ");
genre = in.readLine();
Statement st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
/*
* ResultSet res = st.executeQuery("SELECT Count(*) FROM attendee a" +
* "INNER JOIN employee e on e.email = a.email" + "WHERE e.employeeID = " +
* employeeID);
*/
ResultSet res = st.executeQuery("SELECT eventID FROM concert c "
+ "INNER JOIN attraction a on a.attractionName = c.eventName " + "WHERE a.genre = '" + genre + "'");
System.out.println(" ");
// need to adjust number of stuff printed out here
while (res.next()) {
System.out.println(res.getString(1));
}
System.out.println(" ");
res.close();
con.close();
} catch (SQLException ex) {
System.out.println("Message: " + ex.getMessage());
try {
con.rollback();
} catch (SQLException ex2) {
System.out.println("Message: " + ex2.getMessage());
System.exit(-1);
}
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (Exception e) {
System.out.println("Please make sure input values are correct!" + e);
}
}
// deliverable 8, update the date of an event
public static void updateConcertEvent() throws SQLException {
int eventID;
String date;
PreparedStatement ps;
Connection con = JDBCConnection.getConnection1();
con.setAutoCommit(false);
try {
System.out.print("\nEvent ID: ");
eventID = Integer.parseInt(in.readLine());
// ps.setString(3, eventID);
System.out.println("New Date: YY-MM-DD: ");
date = in.readLine();
// ps.setString(5, date);
ps = con.prepareStatement("UPDATE concert SET performancedate = '" + date + "' WHERE eventID = " + eventID);
int rowCount = ps.executeUpdate();
if (rowCount == 0) {
System.out.println("\nEvent does not exist!");
} else
System.out.println("Date changed!");
con.commit();
ps.close();
} catch (IOException e) {
System.out.println("IOException!");
} catch (SQLException ex) {
System.out.println("Message: " + ex.getMessage());
try {
con.rollback();
} catch (SQLException ex2) {
System.out.println("Message: " + ex2.getMessage());
System.exit(-1);
}
}
catch (Exception e) {
System.out.println("Please make sure input values are correct!" + e);
}
}
public static void updateSportingEvent() throws SQLException {
int eventID;
String date;
PreparedStatement ps;
Connection con = JDBCConnection.getConnection1();
con.setAutoCommit(false);
try {
System.out.print("\nEvent ID: ");
eventID = Integer.parseInt(in.readLine());
// ps.setString(3, eventID);
System.out.println("New Date: YY-MM-DD: ");
date = in.readLine();
// ps.setString(5, date);
ps = con.prepareStatement("UPDATE sport SET matchdate = '" + date + "' WHERE eventID = " + eventID);
int rowCount = ps.executeUpdate();
if (rowCount == 0) {
System.out.println("\nEvent does not exist!");
} else
System.out.println("Date changed!");
con.commit();
ps.close();
} catch (IOException e) {
System.out.println("IOException!");
} catch (SQLException ex) {
System.out.println("Message: " + ex.getMessage());
try {
con.rollback();
} catch (SQLException ex2) {
System.out.println("Message: " + ex2.getMessage());
System.exit(-1);
}
}
catch (Exception e) {
System.out.println("Please make sure input values are correct!" + e);
}
}
/*
* // GROUP BY statement on Facilitates table to group all the employees by
* their specific roles such as security and sales public static void
* viewEmployees() { try { Connection con = JDBCConnection.getConnection1();
* Statement st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
* ResultSet.CONCUR_READ_ONLY); ResultSet res =
* st.executeQuery("SELECT employeeID, eventID FROM facilitates GROUP BY role");
* ResultSetMetaData rsmd = res.getMetaData();
*
* // get number of columns int numCols = rsmd.getColumnCount();
*
* System.out.println(" ");
*
* // display column names; for (int i = 0; i < numCols; i++) { // get column
* name and print it
*
* System.out.printf("%-15s", rsmd.getColumnName(i + 1)); }
*
* System.out.println(" ");
*
* while (res.next()) { System.out.print(res.getString(1) + " ");
* System.out.print(res.getString(2) + " "); System.out.print(res.getString(3)
* + " "); System.out.print(res.getString(5) + " ");
* System.out.print(res.getString(6) + " ");
* System.out.println(res.getString(7) + " "); } res.close(); con.close(); }
* catch (Exception e) { System.out.println("Error in fetching data" + e); } }
*/
// view events you are scheduled to work for
public static void viewSchedule() throws SQLException {
int employeeID;
Connection con = JDBCConnection.getConnection1();
con.setAutoCommit(false);
try {
System.out.print("\nEmployee ID: ");
employeeID = Integer.parseInt(in.readLine());
// ps.setString(1, employeeID);
Statement st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet res = st.executeQuery("SELECT eventID FROM facilitates WHERE employeeID = " + employeeID);
if (!res.isBeforeFirst() ) {
System.out.println("Not a valid employeeID");
}
while (res.next()) {
System.out.println(res.getString(1));
}
System.out.println();
res.close();
con.close();
} catch (Exception e) {
System.out.println("Please make sure you have entered a valid ID" + e);
}
}
// joins employee with facilitates with concert
public static void seeEmployeesWorkingAtEvent() throws SQLException, NumberFormatException, IOException {
Connection con = JDBCConnection.getConnection1();
con.setAutoCommit(false);
int eventID;
try {
// can also just figure out this statement just by testing w db
// join employee w facilitates with concert
Statement st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
/*
* ResultSet res = st.
* executeQuery("SELECT attractionName, Count(*) FROM attraction a, verifiedTicket t "
* + "INNER JOIN attraction a on t.attractionID = a.attractionID " +
* "INNER JOIN attendee b on t.purchaserEmail = b.email " + "WHERE a.genre = '"
* + genre + "'");); ResultSetMetaData rsmd = res.getMetaData();
*/
System.out.print("\nConcert Event ID: ");
eventID = Integer.parseInt(in.readLine());
ResultSet res = st.executeQuery(
"SELECT name FROM employee e " + "INNER JOIN facilitates f on e.employeeID = f.employeeID "
+ "INNER JOIN concert c on f.eventID = c.eventID " + "WHERE c.eventID = '" + eventID + "'");
ResultSetMetaData rsmd = res.getMetaData();
if (!res.isBeforeFirst() ) {
System.out.println("Not a valid EventID");
return;
}
// get number of columns
int numCols = rsmd.getColumnCount();
System.out.println(" ");
// display column names;
for (int i = 0; i < numCols; i++) {
// get column name and print it
System.out.printf("%-15s", rsmd.getColumnName(i + 1));
}
System.out.println(" ");
// need to adjust number of stuff printed out here
while (res.next()) {
System.out.println(res.getString(1));
}
System.out.println(" ");
res.close();
con.close();
} catch (SQLException ex) {
System.out.println("Message: " + ex.getMessage());
try {
con.rollback();
} catch (SQLException ex2) {
System.out.println("Message: " + ex2.getMessage());
System.exit(-1);
}
}
catch (Exception e) {
System.out.println("Please make sure input values are correct!" + e);
}
}
}
SponsorQueries.java
import java.sql.Statement;
import java.util.Calendar;
import java.util.concurrent.ThreadLocalRandom;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
public class SponsorQueries {
private static BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//inserts new Sponsor for sporting event
public static void insertSportingEventSponsor() throws SQLException {
int sid;
int eventID;
PreparedStatement ps;
Connection con = JDBCConnection.getConnection1();
con.setAutoCommit(false);
try {
ps = con.prepareStatement("INSERT INTO sponsorssportingevent VALUES (?, ?)");
// for insertion, need to make sure that this primary key isnt taken -> how to
// do
// also how to handle char vs string? do we need to make char array?
// also need to implement type checking for insertion and update
System.out.print("\nSponsor ID: ");
sid = Integer.parseInt(in.readLine());
ps.setInt(1, sid);
System.out.print("\nEvent ID for the event you would like to sponsor: ");
eventID = Integer.parseInt(in.readLine());
ps.setInt(2, eventID);
ps.executeUpdate();
// commit work
con.commit();
ps.close();
System.out.println("\nSponsorship created.");
} catch (IOException e) {
System.out.println("IOException!");
} catch (SQLException ex) {
System.out.println("EventID does not exist: " + ex.getMessage());
try {
// undo the insert
con.rollback();
} catch (SQLException ex2) {
System.out.println("EventID does not exist: " + ex2.getMessage());
System.exit(-1);
}
}
catch (Exception e) {
System.out.println("Please make sure input values are correct!" + e);
}
}
//inserts new Sponsor for concert event
public static void insertConcertEventSponsor() throws SQLException {
int sid;
int eventID;
PreparedStatement ps;
Connection con = JDBCConnection.getConnection1();
con.setAutoCommit(false);
try {
ps = con.prepareStatement("INSERT INTO sponsorsconcertevent VALUES (?, ?)");
// for insertion, need to make sure that this primary key isnt taken -> how to
// do
// also how to handle char vs string? do we need to make char array?
// also need to implement type checking for insertion and update
System.out.print("\nSponsor ID: ");
sid = Integer.parseInt(in.readLine());
ps.setInt(1, sid);
System.out.print("\nEvent ID for the event you would like to sponsor: ");
eventID = Integer.parseInt(in.readLine());
ps.setInt(2, eventID);
ps.executeUpdate();
// commit work
con.commit();
ps.close();
System.out.println("\nSponsorship created.");
// should we add sponsorPrice to concert and sport tables?
} catch (IOException e) {
System.out.println("IOException!");
} catch (SQLException ex) {
System.out.println("EventID does not exist: " + ex.getMessage());
try {
// undo the insert
con.rollback();
} catch (SQLException ex2) {
System.out.println("EventID does not exist: " + ex2.getMessage());
System.exit(-1);
}
}
catch (Exception e) {
System.out.println("Please make sure input values are correct!" + e);
}
}
public static void viewAvailableAttractions() {
String genre;
try {
Connection con = JDBCConnection.getConnection1();
PreparedStatement ps;
ps = con.prepareStatement("select groupName from attraction4 where genre = ?");
System.out.print("\nGenre/sport: ");
genre = in.readLine();
Statement st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet res = st.executeQuery("select genre from attraction4 where genre = " + genre);
ResultSetMetaData rsmd = res.getMetaData();
// TODO error checking here if result set is empty
// get number of columns
int numCols = rsmd.getColumnCount();
System.out.println(" ");
// display column names;
for (int i = 0; i < numCols; i++) {
// get column name and print it
System.out.printf("%-15s", rsmd.getColumnName(i + 1));
}
System.out.println(" ");
while (res.next()) {
// this number needs to be switched to whatever the name column is
System.out.print(res.getString(1) + " ");
}
res.close();
con.close();
} catch (Exception e) {
System.out.println("Error in fetching data" + e);
}
}
}
|
[
"[email protected]"
] | |
5b2fb7f89f276fbac75ba184c352ebae54381a19
|
8de6016ff70e3e3a442c355827967ba7fddc4573
|
/lab7-skel/task5/MyTask.java
|
5ce20bcbe50fa3fd70b5dad627aa15720f76a018
|
[] |
no_license
|
SergiuBabin/Laboratoare-APD
|
31a96e257da55bbbf65537ec4683b641a3d0d574
|
b8734501788b8a00dae7c8648dca303583206c43
|
refs/heads/main
| 2023-03-25T04:59:04.847233 | 2021-03-22T09:18:17 | 2021-03-22T09:18:17 | 306,116,155 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 891 |
java
|
package task5;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.RecursiveTask;
public class MyTask extends RecursiveTask<Void> {
int[] colors;
int step;
public MyTask(int[] colors, int step) {
this.colors = colors;
this.step = step;
}
@Override
protected Void compute() {
if (step == Main.N) {
Main.printColors(colors);
} else {
List<MyTask> tasks = new ArrayList<>();
// for the node at position step try all possible colors
for (int i = 0; i < Main.COLORS; i++) {
int[] newColors = colors.clone();
newColors[step] = i;
if (Main.verifyColors(newColors, step)) {
//colorGraph(newColors, step + 1);
MyTask t = new MyTask(newColors, step + 1);
tasks.add(t);
t.fork();
}
}
for (MyTask task : tasks) {
task.join();
}
}
return null;
}
}
|
[
"[email protected]"
] | |
05cfbb61d213ffb23167974a5107200d0a23f4e3
|
6ebbde2ddaaaf3d3041f9882a3863ee325924d6a
|
/WS/default/AdvancedJavaProject/src/examples/review/threads/WeatherTest.java
|
8fe9ba856651f8d6573922e7c453c16352ee5af9
|
[] |
no_license
|
srook12/BootcampHardDrive
|
e55e63fa661c93c300503276ebe8def0ce03e412
|
eb4f8bb47f7dff220afcca8cc1839ac32a3334de
|
refs/heads/master
| 2020-06-27T10:49:35.749613 | 2016-11-23T02:24:24 | 2016-11-23T02:24:24 | 74,525,820 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 446 |
java
|
package examples.review.threads;
public class WeatherTest {
public static void main(String notused[]) {
WeatherBroadcast ws = new WeatherBroadcast();
ws.setDaemon(true);
ws.addListener(new SampleListener1());
ws.addListener(new SampleListener2());
ws.start();
try {
Thread.sleep(30000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
|
[
"[email protected]"
] | |
75232241b06b77c0a9f54ae498c8c854bf0a925d
|
060b354bf9192c75f6219459076a6c5a71a692f1
|
/src/test/java/il/ac/bgu/cs/bp/bpjs/examples/GetTimeTest.java
|
d89995f0e200aca3b3e6f203769d2093f32100af
|
[
"MIT"
] |
permissive
|
kevinmel2000/BPjs
|
6d8ca7542b63d1e03740268db33736514a398a3a
|
27cad3552fb96c1649711f9b0f01025cf709ba3b
|
refs/heads/master
| 2020-07-02T17:38:10.468974 | 2019-03-30T22:58:12 | 2019-03-30T22:58:12 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,861 |
java
|
/*
* The MIT License
*
* Copyright 2017 michael.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package il.ac.bgu.cs.bp.bpjs.examples;
import il.ac.bgu.cs.bp.bpjs.model.BProgram;
import il.ac.bgu.cs.bp.bpjs.execution.BProgramRunner;
import il.ac.bgu.cs.bp.bpjs.model.ResourceBProgram;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
*
* @author michael
*/
public class GetTimeTest {
@Test
public void test() throws InterruptedException {
BProgram sut = new ResourceBProgram("getTimeTest.js");
long timePre = System.currentTimeMillis();
new BProgramRunner(sut).run();
long timePost = System.currentTimeMillis();
Long actual = sut.getFromGlobalScope("theTime", Long.class).get();
assertTrue( (actual>=timePre) && (actual<=timePost) );
}
}
|
[
"[email protected]"
] | |
f17d58ce08f2d2d7a50d3075467334e386af13fb
|
b01ae19d6bce9229b83d0165601719ae53ae2ed0
|
/android/versioned-abis/expoview-abi46_0_0/src/main/java/abi46_0_0/expo/modules/notifications/badge/ExpoBadgeManager.java
|
ddc62744034acc0279b4867170d8b57dcae53601
|
[
"MIT",
"BSD-3-Clause",
"Apache-2.0"
] |
permissive
|
Abhishek12345679/expo
|
1655f4f71afbee0e8ef4680e43586168f75e1914
|
8257de135f6d333860a73676509332c9cde04ba5
|
refs/heads/main
| 2023-02-20T19:46:17.694860 | 2022-11-21T15:48:20 | 2022-11-21T15:48:20 | 568,898,209 | 1 | 0 |
MIT
| 2022-11-21T16:39:42 | 2022-11-21T16:39:41 | null |
UTF-8
|
Java
| false | false | 1,144 |
java
|
package abi46_0_0.expo.modules.notifications.badge;
import android.content.Context;
import android.util.Log;
import expo.modules.core.interfaces.SingletonModule;
import expo.modules.notifications.badge.interfaces.BadgeManager;
import me.leolin.shortcutbadger.ShortcutBadgeException;
import me.leolin.shortcutbadger.ShortcutBadger;
public class ExpoBadgeManager implements SingletonModule, BadgeManager {
private static final String SINGLETON_NAME = "BadgeManager";
private int mBadgeCount = 0;
private Context mContext;
public ExpoBadgeManager(Context context) {
mContext = context;
}
@Override
public String getName() {
return SINGLETON_NAME;
}
@Override
public int getBadgeCount() {
return mBadgeCount;
}
@Override
public boolean setBadgeCount(int badgeCount) {
try {
ShortcutBadger.applyCountOrThrow(mContext.getApplicationContext(), badgeCount);
mBadgeCount = badgeCount;
return true;
} catch (ShortcutBadgeException e) {
Log.d("expo-notifications", "Could not have set badge count: " + e.getMessage());
e.printStackTrace();
}
return false;
}
}
|
[
"[email protected]"
] | |
c8fdd247c729cfda133a2f02a9c0f0fb716b145b
|
62a673ad3ce04b4a6337106345d2ef7ed6cd8b06
|
/app/src/main/java/com/xudre/dogosfromouterspace/Button.java
|
35f91171a27e395c4435d9e4788532b6ebef1e52
|
[
"MIT"
] |
permissive
|
xudre/android-dogos
|
e41b938f2a34a6e85b181f21510bf10c2032f105
|
7b255e54d249b4c501e77eeeedba5fa6a0a12d17
|
refs/heads/master
| 2020-03-21T19:22:06.594527 | 2018-09-18T17:02:51 | 2018-09-18T17:02:51 | 138,945,392 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,044 |
java
|
package com.xudre.dogosfromouterspace;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.view.MotionEvent;
public class Button extends Sprite {
public boolean pressing;
public Button(Bitmap bitmap) {
super(bitmap);
}
public void ProcessEvents(MotionEvent event) {
float x = event.getX();
float y = event.getY();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
pressing = Hit(x, y);
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_OUTSIDE:
case MotionEvent.ACTION_CANCEL:
pressing = false;
break;
case MotionEvent.ACTION_MOVE:
pressing = Hit(x, y);
break;
}
}
@Override
public void Draw(Canvas canvas) {
if (pressing) {
Paint.setAlpha(0x99);
} else {
Paint.setAlpha(0xFF);
}
super.Draw(canvas);
}
}
|
[
"[email protected]"
] | |
761744978bf5641d7fe60bf9c34fd5d323b4dc82
|
629fc58f9792872184c6c5aba0240a6708fda701
|
/topCMS/src/main/java/com/infotop/core/tpl/FileTplManagerImpl.java
|
f901825ef68dca95d6cbe0fb5b487826e362db8b
|
[] |
no_license
|
unreal-work/topCMS
|
4b356c82769e651fd0483da954c470cd55f5d342
|
aa9eb019ee3c798a7e5a674e98cf2d882bb7ed07
|
refs/heads/master
| 2021-05-28T12:02:29.925736 | 2015-04-09T01:08:12 | 2015-04-09T01:08:12 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,240 |
java
|
package com.infotop.core.tpl;
import static com.infotop.common.web.Constants.UTF8;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.multipart.MultipartFile;
import com.infotop.common.web.springmvc.RealPathResolver;
public class FileTplManagerImpl implements TplManager {
private static Logger log = LoggerFactory
.getLogger(FileTplManagerImpl.class);
public int delete(String[] names) {
File f;
int count = 0;
for (String name : names) {
f = new File(realPathResolver.get(name));
if (f.isDirectory()) {
if (FileUtils.deleteQuietly(f)) {
count++;
}
} else {
if (f.delete()) {
count++;
}
}
}
return count;
}
public Tpl get(String name) {
File f = new File(realPathResolver.get(name));
if (f.exists()) {
return new FileTpl(f, root);
} else {
return null;
}
}
public List<Tpl> getListByPrefix(String prefix) {
File f = new File(realPathResolver.get(prefix));
String name = prefix.substring(prefix.lastIndexOf("/") + 1);
File parent;
if (prefix.endsWith("/")) {
name = "";
parent = f;
} else {
parent = f.getParentFile();
}
if (parent.exists()) {
File[] files = parent.listFiles(new PrefixFilter(name));
if (files != null) {
List<Tpl> list = new ArrayList<Tpl>();
for (File file : files) {
list.add(new FileTpl(file, root));
}
return list;
} else {
return new ArrayList<Tpl>(0);
}
} else {
return new ArrayList<Tpl>(0);
}
}
public List<String> getNameListByPrefix(String prefix) {
List<Tpl> list = getListByPrefix(prefix);
List<String> result = new ArrayList<String>(list.size());
for (Tpl tpl : list) {
result.add(tpl.getName());
}
return result;
}
public List<Tpl> getChild(String path) {
File file = new File(realPathResolver.get(path));
File[] child = file.listFiles();
if (child != null) {
List<Tpl> list = new ArrayList<Tpl>(child.length);
for (File f : child) {
list.add(new FileTpl(f, root));
}
return list;
} else {
return new ArrayList<Tpl>(0);
}
}
public void rename(String orig, String dist) {
String os = realPathResolver.get(orig);
File of = new File(os);
String ds = realPathResolver.get(dist);
File df = new File(ds);
try {
if (of.isDirectory()) {
FileUtils.moveDirectory(of, df);
} else {
FileUtils.moveFile(of, df);
}
} catch (IOException e) {
log.error("Move template error: " + orig + " to " + dist, e);
}
}
public void save(String name, String source, boolean isDirectory) {
String real = realPathResolver.get(name);
File f = new File(real);
if (isDirectory) {
f.mkdirs();
} else {
try {
FileUtils.writeStringToFile(f, source, UTF8);
} catch (IOException e) {
log.error("Save template error: " + name, e);
throw new RuntimeException(e);
}
}
}
public void save(String path, MultipartFile file) {
File f = new File(realPathResolver.get(path), file
.getOriginalFilename());
try {
file.transferTo(f);
} catch (IllegalStateException e) {
log.error("upload template error!", e);
} catch (IOException e) {
log.error("upload template error!", e);
}
}
public void update(String name, String source) {
String real = realPathResolver.get(name);
File f = new File(real);
try {
FileUtils.writeStringToFile(f, source, UTF8);
} catch (IOException e) {
log.error("Save template error: " + name, e);
throw new RuntimeException(e);
}
}
private String root;
private RealPathResolver realPathResolver;
@Autowired
public void setRealPathResolver(RealPathResolver realPathResolver) {
this.realPathResolver = realPathResolver;
root = realPathResolver.get("");
}
private static class PrefixFilter implements FileFilter {
private String prefix;
public PrefixFilter(String prefix) {
this.prefix = prefix;
}
public boolean accept(File file) {
String name = file.getName();
return file.isFile() && name.startsWith(prefix);
}
}
}
|
[
"Rajesh@Rajesh-PC"
] |
Rajesh@Rajesh-PC
|
56177f093a9c600cc105abff3c823b7d6f095fc4
|
dbd2cdb791b2fa04a132348849a066ddd8de3998
|
/src/main/java/com/arun/database/springjdbctojpa/jdbcBean/Person.java
|
913c9ae2de0410f4f5d51fd61b7b6bf88ba44b98
|
[] |
no_license
|
arun786/SpringJdbcTemplateJPA
|
7441e5ecf6ec72ad7cb78d5e48062b69de2fd331
|
0d8f31074ea0cd3b1ce85ccf1911d56a926687e8
|
refs/heads/master
| 2021-05-03T13:54:05.273147 | 2018-02-06T20:36:13 | 2018-02-06T20:36:13 | 120,513,265 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 917 |
java
|
package com.arun.database.springjdbctojpa.jdbcBean;
import java.util.Date;
public class Person {
private int id;
private String name;
private String location;
private Date birthDate;
public Person() {
super();
}
public void setId(int id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setLocation(String location) {
this.location = location;
}
public void setBirthDate(Date birthDate) {
this.birthDate = birthDate;
}
public Person(int id, String name, String location, Date birthDate) {
super();
this.id = id;
this.name = name;
this.location = location;
this.birthDate = birthDate;
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public String getLocation() {
return location;
}
public Date getBirthDate() {
return birthDate;
}
}
|
[
"[email protected]"
] | |
3ca17f02cbd22da1ca2eda26de8203cfde0f3729
|
35563cbf1d5c737300b107a3c649e9fc8c1ce1a1
|
/src/java/org/cspk4j/filter/TickFilter.java
|
ee9224da6fd885b947d81c82e74c92a5098a9f40
|
[
"LicenseRef-scancode-warranty-disclaimer"
] |
no_license
|
mkleine/cspk4j
|
032ff35747ebf25d10423a8e6e8e4f6b88cec75b
|
a7533d9b11c6f4086509ce6f64f69ae19f9b12d8
|
refs/heads/master
| 2020-12-25T18:23:03.869970 | 2010-09-22T09:50:31 | 2010-09-22T09:50:31 | 889,272 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,153 |
java
|
/**
* This file is part of CSPk4J the CSP concurrency library for Java.
*
* CSPk4J is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CSPk4J is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with CSPk4J. If not, see <http://www.gnu.org/licenses/>.
*
**/
package org.cspk4j.filter;
import java.util.ArrayList;
import java.util.Collection;
import org.cspk4j.CspEvent;
import org.cspk4j.Filter;
public class TickFilter implements Filter {
public Collection<CspEvent> filter(Collection<CspEvent> events) {
ArrayList<CspEvent> result = new ArrayList<CspEvent>();
for(CspEvent event:events){
if(event.isTick()){
result.add(event);
}
}
return result;
}
}
|
[
"[email protected]"
] | |
5826738420808952b229a3781e280b94060de3b9
|
82de1e98e30a0836b892f00e07bfcc0954dbc517
|
/hotcomm-api/hotcomm-operator/hotcomm-prevention/src/main/java/com/hotcomm/prevention/bean/mysql/manage/devicemanager/vaule/DevListVaule.java
|
40dde8f471b761f526d997904d8747cdaea22bc7
|
[] |
no_license
|
jiajiales/hangkang-qingdao
|
ab319048b61f6463f8cf1ac86ac5c74bd3df35d7
|
60a0a4b1d1fb9814d8aa21188aebbf72a1d6b25d
|
refs/heads/master
| 2020-04-22T17:07:34.569613 | 2019-02-13T15:14:07 | 2019-02-13T15:14:07 | 170,530,164 | 2 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 532 |
java
|
package com.hotcomm.prevention.bean.mysql.manage.devicemanager.vaule;
import com.hotcomm.prevention.bean.mysql.manage.PageParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
public class DevListVaule extends PageParam {
private String starttime;
private String endtime;
private String context;
private Integer batterytype;
private Integer moduleid;
private Integer userid;
private Integer groupid;
}
|
[
"[email protected]"
] | |
a8cb533567723f6684e47de1eb650322acd449c5
|
7c7bd05b654f076b84862ac2091d2c024c21d438
|
/src/com/example/livelock/Tester.java
|
42972332d0b07ef1a059dcfe2e95e280e6dc32fb
|
[] |
no_license
|
oleg-sandro/concurrency-cases-project
|
cee96089fdc1ceecb3200bfaae663dc57ff77698
|
9e20dcba662afc51398bada76b093116c0e2a0c5
|
refs/heads/master
| 2022-01-09T23:35:44.057346 | 2019-06-25T05:00:29 | 2019-06-25T05:00:29 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 868 |
java
|
package com.example.livelock;
public class Tester {
public static void main(String[] args) throws InterruptedException {
String name = Thread. currentThread().getName();
System.out.println(name + " начал работу");
BankAccount account1 = new BankAccount(1, 100);
BankAccount account2 = new BankAccount(2, 100);
Transaction th1 = new Transaction("thread-1", account1, account2, 10);
Transaction th2 = new Transaction("thread-2", account2, account1, 10);
th1.start();
th2.start();
for(int i=0; i<6; i++)
if(th1.isAlive() || th2.isAlive())
Thread.sleep(5_000);
if(th1.isAlive())
th1.interrupt();
if(th2.isAlive())
th2.interrupt();
System.out.println(name + " завершил работу");
}
}
|
[
"[email protected]"
] | |
2a946f82d5c01e86317849147b1a0210d498327f
|
2899d76907f793211f0ab4dc914bde67804e8003
|
/app/build/generated/source/r/debug/android/support/mediacompat/R.java
|
59f5b476444d28b188ce328ec4b3346e095fe59a
|
[] |
no_license
|
bhumil-1998/daiict_timetable
|
b9478c1909e8757cb3faf8d9ab7e7a8f02f00ab8
|
fecea57695a9cd4100dd6166e01f81658a14ab5d
|
refs/heads/master
| 2020-03-26T01:57:25.800927 | 2018-08-24T17:40:48 | 2018-08-24T17:40:48 | 144,390,155 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 10,018 |
java
|
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.mediacompat;
public final class R {
public static final class attr {
public static final int font = 0x7f0400f4;
public static final int fontProviderAuthority = 0x7f0400f6;
public static final int fontProviderCerts = 0x7f0400f7;
public static final int fontProviderFetchStrategy = 0x7f0400f8;
public static final int fontProviderFetchTimeout = 0x7f0400f9;
public static final int fontProviderPackage = 0x7f0400fa;
public static final int fontProviderQuery = 0x7f0400fb;
public static final int fontStyle = 0x7f0400fc;
public static final int fontWeight = 0x7f0400fe;
}
public static final class bool {
public static final int abc_action_bar_embed_tabs = 0x7f050000;
}
public static final class color {
public static final int notification_action_color_filter = 0x7f060076;
public static final int notification_icon_bg_color = 0x7f060077;
public static final int notification_material_background_media_default_color = 0x7f060078;
public static final int primary_text_default_material_dark = 0x7f06007d;
public static final int ripple_material_light = 0x7f060082;
public static final int secondary_text_default_material_dark = 0x7f060083;
public static final int secondary_text_default_material_light = 0x7f060084;
}
public static final class dimen {
public static final int compat_button_inset_horizontal_material = 0x7f070051;
public static final int compat_button_inset_vertical_material = 0x7f070052;
public static final int compat_button_padding_horizontal_material = 0x7f070053;
public static final int compat_button_padding_vertical_material = 0x7f070054;
public static final int compat_control_corner_material = 0x7f070055;
public static final int notification_action_icon_size = 0x7f0700ca;
public static final int notification_action_text_size = 0x7f0700cb;
public static final int notification_big_circle_margin = 0x7f0700cc;
public static final int notification_content_margin_start = 0x7f0700cd;
public static final int notification_large_icon_height = 0x7f0700ce;
public static final int notification_large_icon_width = 0x7f0700cf;
public static final int notification_main_column_padding_top = 0x7f0700d0;
public static final int notification_media_narrow_margin = 0x7f0700d1;
public static final int notification_right_icon_size = 0x7f0700d2;
public static final int notification_right_side_padding_top = 0x7f0700d3;
public static final int notification_small_icon_background_padding = 0x7f0700d4;
public static final int notification_small_icon_size_as_large = 0x7f0700d5;
public static final int notification_subtext_size = 0x7f0700d6;
public static final int notification_top_pad = 0x7f0700d7;
public static final int notification_top_pad_large_text = 0x7f0700d8;
}
public static final class drawable {
public static final int notification_action_background = 0x7f080081;
public static final int notification_bg = 0x7f080082;
public static final int notification_bg_low = 0x7f080083;
public static final int notification_bg_low_normal = 0x7f080084;
public static final int notification_bg_low_pressed = 0x7f080085;
public static final int notification_bg_normal = 0x7f080086;
public static final int notification_bg_normal_pressed = 0x7f080087;
public static final int notification_icon_background = 0x7f080088;
public static final int notification_template_icon_bg = 0x7f080089;
public static final int notification_template_icon_low_bg = 0x7f08008a;
public static final int notification_tile_bg = 0x7f08008b;
public static final int notify_panel_notification_icon_bg = 0x7f08008c;
}
public static final class id {
public static final int action0 = 0x7f090006;
public static final int action_container = 0x7f09000e;
public static final int action_divider = 0x7f090010;
public static final int action_image = 0x7f090011;
public static final int action_text = 0x7f090017;
public static final int actions = 0x7f090018;
public static final int async = 0x7f090020;
public static final int blocking = 0x7f090024;
public static final int cancel_action = 0x7f090027;
public static final int chronometer = 0x7f09002e;
public static final int end_padder = 0x7f090049;
public static final int forever = 0x7f090055;
public static final int icon = 0x7f09005c;
public static final int icon_group = 0x7f09005d;
public static final int info = 0x7f090061;
public static final int italic = 0x7f090063;
public static final int line1 = 0x7f090069;
public static final int line3 = 0x7f09006a;
public static final int media_actions = 0x7f090074;
public static final int normal = 0x7f09007f;
public static final int notification_background = 0x7f090080;
public static final int notification_main_column = 0x7f090081;
public static final int notification_main_column_container = 0x7f090082;
public static final int right_icon = 0x7f090098;
public static final int right_side = 0x7f090099;
public static final int status_bar_latest_event_content = 0x7f0900c1;
public static final int text = 0x7f0900cd;
public static final int text2 = 0x7f0900ce;
public static final int time = 0x7f0900d6;
public static final int title = 0x7f0900dd;
}
public static final class integer {
public static final int cancel_button_image_alpha = 0x7f0a0004;
public static final int status_bar_notification_info_maxnum = 0x7f0a000d;
}
public static final class layout {
public static final int notification_action = 0x7f0c0032;
public static final int notification_action_tombstone = 0x7f0c0033;
public static final int notification_media_action = 0x7f0c0034;
public static final int notification_media_cancel_action = 0x7f0c0035;
public static final int notification_template_big_media = 0x7f0c0036;
public static final int notification_template_big_media_custom = 0x7f0c0037;
public static final int notification_template_big_media_narrow = 0x7f0c0038;
public static final int notification_template_big_media_narrow_custom = 0x7f0c0039;
public static final int notification_template_custom_big = 0x7f0c003a;
public static final int notification_template_icon_group = 0x7f0c003b;
public static final int notification_template_lines_media = 0x7f0c003c;
public static final int notification_template_media = 0x7f0c003d;
public static final int notification_template_media_custom = 0x7f0c003e;
public static final int notification_template_part_chronometer = 0x7f0c003f;
public static final int notification_template_part_time = 0x7f0c0040;
}
public static final class string {
public static final int status_bar_notification_info_overflow = 0x7f0e004f;
}
public static final class style {
public static final int TextAppearance_Compat_Notification = 0x7f0f010b;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0f010c;
public static final int TextAppearance_Compat_Notification_Info_Media = 0x7f0f010d;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0f010e;
public static final int TextAppearance_Compat_Notification_Line2_Media = 0x7f0f010f;
public static final int TextAppearance_Compat_Notification_Media = 0x7f0f0110;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0f0111;
public static final int TextAppearance_Compat_Notification_Time_Media = 0x7f0f0112;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0f0113;
public static final int TextAppearance_Compat_Notification_Title_Media = 0x7f0f0114;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0f01b7;
public static final int Widget_Compat_NotificationActionText = 0x7f0f01b8;
}
public static final class styleable {
public static final int[] FontFamily = { 0x7f0400f6, 0x7f0400f7, 0x7f0400f8, 0x7f0400f9, 0x7f0400fa, 0x7f0400fb };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x01010532, 0x01010533, 0x0101053f, 0x0101056f, 0x01010570, 0x7f0400f4, 0x7f0400fc, 0x7f0400fd, 0x7f0400fe, 0x7f040225 };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
}
}
|
[
"[email protected]"
] | |
334132f68ec7c9710b423cc824fd08130ad1e2fd
|
94dc216a2a071131ffabd0bfb76ef7e51fa04645
|
/src/administration/editSJ.java
|
c2238572b922d93375fe62cf7b9b0cbc71f975f8
|
[] |
no_license
|
itsannazzle/TNJ-Desk
|
9d539482bed95936d17bad0853abc183638bc841
|
b5b0912cbae2bb23b87c2c64443d0a778bcd8669
|
refs/heads/master
| 2023-06-02T22:40:56.032426 | 2021-06-19T13:32:38 | 2021-06-19T13:32:38 | 359,501,811 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 24,996 |
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package administration;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import javax.swing.JOptionPane;
/**
*
* @author Anna Karenina
*/
public class editSJ extends javax.swing.JFrame {
/**
* Creates new form editSJ
*/
SimpleDateFormat date = new SimpleDateFormat("dd-MMM-yyyy hh:mm:ss a");
Connection c = getConnection();
public editSJ() {
initComponents();
setLocationRelativeTo(null);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel21 = new javax.swing.JLabel();
jTextField14 = new javax.swing.JTextField();
jPanel1 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jDateChooser1 = new com.toedter.calendar.JDateChooser();
jLabel5 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
jTextField4 = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
jTextField5 = new javax.swing.JTextField();
jLabel9 = new javax.swing.JLabel();
jTextField6 = new javax.swing.JTextField();
jLabel10 = new javax.swing.JLabel();
jTextField7 = new javax.swing.JTextField();
jLabel11 = new javax.swing.JLabel();
jTextField8 = new javax.swing.JTextField();
jLabel13 = new javax.swing.JLabel();
jTextField9 = new javax.swing.JTextField();
jLabel17 = new javax.swing.JLabel();
jLabel14 = new javax.swing.JLabel();
jTextField10 = new javax.swing.JTextField();
jLabel12 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
jTextField11 = new javax.swing.JTextField();
jLabel19 = new javax.swing.JLabel();
jTextField12 = new javax.swing.JTextField();
jLabel16 = new javax.swing.JLabel();
jTextField13 = new javax.swing.JTextField();
jLabel20 = new javax.swing.JLabel();
jLabel22 = new javax.swing.JLabel();
jTextField15 = new javax.swing.JTextField();
jLabel21.setFont(new java.awt.Font("Bahnschrift", 0, 12)); // NOI18N
jLabel21.setText("Harga :");
jTextField14.setText("0");
jTextField14.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField14ActionPerformed(evt);
}
});
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setUndecorated(true);
jPanel1.setBackground(new java.awt.Color(255, 255, 255));
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel3.setIcon(new javax.swing.ImageIcon("E:\\Selena Gomes\\A\\TNJ\\Company App\\Bahan\\minim.png")); // NOI18N
jLabel3.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel3MouseClicked(evt);
}
});
jPanel1.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(460, 10, 10, -1));
jLabel2.setIcon(new javax.swing.ImageIcon("E:\\Selena Gomes\\A\\TNJ\\Company App\\Bahan\\close.png")); // NOI18N
jLabel2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel2MouseClicked(evt);
}
});
jPanel1.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 10, 10, -1));
jLabel15.setIcon(new javax.swing.ImageIcon("E:\\Selena Gomes\\A\\TNJ\\Company App\\Bahan\\edit surat jalan.png")); // NOI18N
jPanel1.add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
jLabel4.setFont(new java.awt.Font("Bahnschrift", 0, 12)); // NOI18N
jLabel4.setText("Tanggal :");
jPanel1.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 80, -1, -1));
jDateChooser1.setDateFormatString("dd-MMM-yyyy hh:mm:ss a");
jPanel1.add(jDateChooser1, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 70, 200, 30));
jLabel5.setFont(new java.awt.Font("Bahnschrift", 0, 12)); // NOI18N
jLabel5.setText("Nomor surat :");
jPanel1.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 180, -1, -1));
jTextField2.setEditable(false);
jTextField2.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTextField2KeyReleased(evt);
}
public void keyTyped(java.awt.event.KeyEvent evt) {
jTextField2KeyTyped(evt);
}
});
jPanel1.add(jTextField2, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 170, 200, 30));
jLabel6.setFont(new java.awt.Font("Bahnschrift", 0, 12)); // NOI18N
jLabel6.setText("NIP :");
jPanel1.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 230, -1, -1));
jPanel1.add(jTextField3, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 220, 200, 30));
jLabel7.setFont(new java.awt.Font("Bahnschrift", 0, 12)); // NOI18N
jLabel7.setText("Nama pengemudi :");
jPanel1.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 280, -1, -1));
jTextField4.setEditable(false);
jPanel1.add(jTextField4, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 270, 200, 30));
jLabel8.setFont(new java.awt.Font("Bahnschrift", 0, 12)); // NOI18N
jLabel8.setText("Nomor kendaraan :");
jPanel1.add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 330, -1, -1));
jTextField5.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTextField5KeyReleased(evt);
}
public void keyTyped(java.awt.event.KeyEvent evt) {
jTextField5KeyTyped(evt);
}
});
jPanel1.add(jTextField5, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 320, 200, 30));
jLabel9.setFont(new java.awt.Font("Bahnschrift", 0, 12)); // NOI18N
jLabel9.setText("Nomor polisi :");
jPanel1.add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 380, -1, -1));
jTextField6.setEditable(false);
jTextField6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField6ActionPerformed(evt);
}
});
jPanel1.add(jTextField6, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 370, 200, 30));
jLabel10.setFont(new java.awt.Font("Bahnschrift", 0, 12)); // NOI18N
jLabel10.setText("Pickup point :");
jPanel1.add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 430, -1, -1));
jTextField7.setEditable(false);
jTextField7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField7ActionPerformed(evt);
}
});
jPanel1.add(jTextField7, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 420, 200, 30));
jLabel11.setFont(new java.awt.Font("Bahnschrift", 0, 12)); // NOI18N
jLabel11.setText("Material :");
jPanel1.add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 560, -1, 30));
jTextField8.setText("-");
jTextField8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField8ActionPerformed(evt);
}
});
jTextField8.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTextField8KeyReleased(evt);
}
});
jPanel1.add(jTextField8, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 560, 110, 30));
jLabel13.setFont(new java.awt.Font("Bahnschrift", 0, 12)); // NOI18N
jLabel13.setText("Jarak tempuh :");
jPanel1.add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 530, -1, -1));
jTextField9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField9ActionPerformed(evt);
}
});
jTextField9.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTextField9KeyReleased(evt);
}
});
jPanel1.add(jTextField9, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 520, 80, 30));
jLabel17.setText("/ Ton");
jPanel1.add(jLabel17, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 560, -1, 30));
jLabel14.setFont(new java.awt.Font("Bahnschrift", 0, 12)); // NOI18N
jLabel14.setText("Uang jalan :");
jPanel1.add(jLabel14, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 520, -1, 30));
jTextField10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField10ActionPerformed(evt);
}
});
jPanel1.add(jTextField10, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 520, 110, 30));
jLabel12.setIcon(new javax.swing.ImageIcon("E:\\Selena Gomes\\A\\TNJ\\Company App\\Bahan\\simpan.png")); // NOI18N
jLabel12.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel12MouseClicked(evt);
}
});
jPanel1.add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 660, -1, -1));
jLabel18.setFont(new java.awt.Font("Bahnschrift", 0, 12)); // NOI18N
jLabel18.setText("Kode proyek :");
jPanel1.add(jLabel18, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 130, -1, -1));
jTextField11.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
jTextField11KeyTyped(evt);
}
});
jPanel1.add(jTextField11, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 120, 200, 30));
jLabel19.setFont(new java.awt.Font("Bahnschrift", 0, 12)); // NOI18N
jLabel19.setText("Drop point :");
jPanel1.add(jLabel19, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 480, -1, -1));
jTextField12.setEditable(false);
jTextField12.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField12ActionPerformed(evt);
}
});
jPanel1.add(jTextField12, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 470, 200, 30));
jLabel16.setFont(new java.awt.Font("Bahnschrift", 0, 12)); // NOI18N
jLabel16.setText("Berat :");
jPanel1.add(jLabel16, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 570, -1, -1));
jTextField13.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField13ActionPerformed(evt);
}
});
jPanel1.add(jTextField13, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 560, 80, 30));
jLabel20.setText("/ Km");
jPanel1.add(jLabel20, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 520, -1, 30));
jLabel22.setFont(new java.awt.Font("Bahnschrift", 0, 12)); // NOI18N
jLabel22.setText("Harga :");
jPanel1.add(jLabel22, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 610, -1, -1));
jTextField15.setText("0");
jTextField15.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField15ActionPerformed(evt);
}
});
jPanel1.add(jTextField15, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 600, 100, 30));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 713, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
public Connection getConnection(){
Connection con;
try {
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/tnj", "root", "");
return con;
} catch (SQLException ex) {
ex.printStackTrace();
}
return null;
}
private void jLabel3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel3MouseClicked
setExtendedState(ICONIFIED);
}//GEN-LAST:event_jLabel3MouseClicked
private void jLabel2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel2MouseClicked
this.dispose();
}//GEN-LAST:event_jLabel2MouseClicked
private void jTextField2KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField2KeyReleased
// TODO add your handling code here:
}//GEN-LAST:event_jTextField2KeyReleased
private void jTextField2KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField2KeyTyped
if(Character.isLowerCase(evt.getKeyChar())){
evt.setKeyChar(Character.toUpperCase(evt.getKeyChar()));
}
}//GEN-LAST:event_jTextField2KeyTyped
private void jTextField5KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField5KeyReleased
// try{
// PreparedStatement ps = c.prepareStatement("select * from kendaraan where no_ken='"+jTextField5.getText()+"'");
// ResultSet rs = ps.executeQuery();
// while(rs.next()){
//
// jTextField6.setText(rs.getString("no_pol"));
// }
//
// } catch(Exception e){
// System.out.println(e);
// }
}//GEN-LAST:event_jTextField5KeyReleased
private void jTextField5KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField5KeyTyped
}//GEN-LAST:event_jTextField5KeyTyped
private void jTextField6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField6ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField6ActionPerformed
private void jTextField7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField7ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField7ActionPerformed
private void jTextField8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField8ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField8ActionPerformed
private void jTextField9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField9ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField9ActionPerformed
private void jTextField9KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField9KeyReleased
int jartem = Integer.parseInt(jTextField9.getText());
int a = 50000;
int uangjalan = jartem*a;
jTextField10.setText(String.valueOf(uangjalan));
}//GEN-LAST:event_jTextField9KeyReleased
private void jTextField10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField10ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField10ActionPerformed
private void jLabel12MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel12MouseClicked
try{
PreparedStatement ps = c.prepareStatement("update surat_jalan set tanggal=?, id=?, nip=?, no_ken=?, material=?, jartem=?,uang_jalan=?,berat=?,harga=? where no_surat=?");
ps.setString(1, date.format(jDateChooser1.getDate()));
ps.setString(2, jTextField11.getText());
ps.setString(10, jTextField2.getText());
ps.setString(3, jTextField3.getText());
ps.setString(4, jTextField5.getText());
ps.setString(5, jTextField8.getText());
ps.setString(6, jTextField9.getText());
ps.setString(7, jTextField10.getText());
ps.setString(8, jTextField13.getText());
ps.setString(9, jTextField15.getText());
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "Perubahan data berhasil");
this.dispose();
} catch(Exception e){
System.out.println("Gagal mengubah data");
JOptionPane.showMessageDialog(null, e);
}
}//GEN-LAST:event_jLabel12MouseClicked
private void jTextField11KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField11KeyTyped
try{
PreparedStatement ps = c.prepareStatement("select * from data_proyek where id='"+jTextField11.getText()+"'");
ResultSet rs = ps.executeQuery();
while(rs.next()){
jTextField7.setText(rs.getString("pickup"));
jTextField12.setText(rs.getString("dropp"));
}
} catch(Exception e){
System.out.println(e);
}
}//GEN-LAST:event_jTextField11KeyTyped
private void jTextField12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField12ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField12ActionPerformed
private void jTextField13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField13ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField13ActionPerformed
private void jTextField14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField14ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField14ActionPerformed
private void jTextField15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField15ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField15ActionPerformed
private void jTextField8KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField8KeyReleased
if (null==jTextField8.getText()){
jTextField15.setText("?");
} else switch (jTextField8.getText()) {
case "PASIR":
{
String uangjalan = jTextField10.getText();
String MAT = "500000";
String berat = jTextField13.getText();
int harga = Integer.parseInt(MAT)*Integer.parseInt(berat)+Integer.parseInt(uangjalan);
jTextField15.setText(String.valueOf(harga));
break;
}
case "TANAH":
{
String uangjalan = jTextField10.getText();
String MAT = "700000";
String berat = jTextField13.getText();
int harga = Integer.parseInt(MAT)*Integer.parseInt(berat)+Integer.parseInt(uangjalan);
jTextField15.setText(String.valueOf(harga));
break;
}
case "SPLIT":
{
String uangjalan = jTextField10.getText();
String MAT = "900000";
String berat = jTextField13.getText();
int harga = Integer.parseInt(MAT)*Integer.parseInt(berat)+Integer.parseInt(uangjalan);
jTextField15.setText(String.valueOf(harga));
break;
}
default:
break;
}
}//GEN-LAST:event_jTextField8KeyReleased
/**
* @param args the command line arguments
*/
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://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(editSJ.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(editSJ.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(editSJ.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(editSJ.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new editSJ().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
public com.toedter.calendar.JDateChooser jDateChooser1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel13;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16;
private javax.swing.JLabel jLabel17;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel19;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel20;
private javax.swing.JLabel jLabel21;
private javax.swing.JLabel jLabel22;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
public javax.swing.JTextField jTextField10;
public javax.swing.JTextField jTextField11;
public javax.swing.JTextField jTextField12;
public javax.swing.JTextField jTextField13;
private javax.swing.JTextField jTextField14;
public javax.swing.JTextField jTextField15;
public javax.swing.JTextField jTextField2;
public javax.swing.JTextField jTextField3;
public javax.swing.JTextField jTextField4;
public javax.swing.JTextField jTextField5;
public javax.swing.JTextField jTextField6;
public javax.swing.JTextField jTextField7;
public javax.swing.JTextField jTextField8;
public javax.swing.JTextField jTextField9;
// End of variables declaration//GEN-END:variables
}
|
[
"[email protected]"
] | |
c164f5a4df3f61233f84169323582f2bccfe7eb3
|
e3293fbf9fde594c8aa9b046d20e0e06fc423c65
|
/impc_prod_tracker/core/src/main/java/org/gentar/statemachine/ProcessData.java
|
4bb8e96cb7a3daae35e55ac3adbf8d35566ee7fa
|
[
"Apache-2.0"
] |
permissive
|
albags/impc-production-tracker
|
43efe1fc083f0e1478b43178cd3d3c674a5edaed
|
221274e2b11efc6cec06a5662115ade1d171c62f
|
refs/heads/master
| 2021-11-22T23:06:16.670167 | 2021-10-27T13:52:29 | 2021-10-27T13:52:29 | 177,979,683 | 0 | 0 |
Apache-2.0
| 2019-03-27T11:25:48 | 2019-03-27T11:25:48 | null |
UTF-8
|
Java
| false | false | 334 |
java
|
package org.gentar.statemachine;
import org.gentar.biology.status.Status;
/**
* Interface to be implemented by the entity to be processed in the state machine.
*/
public interface ProcessData
{
ProcessEvent getEvent();
void setEvent(ProcessEvent processEvent);
Status getStatus();
void setStatus(Status status);
}
|
[
"[email protected]"
] | |
87b9eec1e626a0341e5ee144662184a254a1018e
|
828b5327357d0fb4cb8f3b4472f392f3b8b10328
|
/flink-runtime/src/test/java/org/apache/flink/runtime/taskexecutor/partition/PartitionTableTest.java
|
a6865113862ad586618ecefbf2ff24f4a5d5a1db
|
[
"CC-BY-3.0",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense",
"ISC",
"MIT-0",
"GPL-2.0-only",
"BSD-2-Clause-Views",
"OFL-1.1",
"Apache-2.0",
"LicenseRef-scancode-jdom",
"GCC-exception-3.1",
"MPL-2.0",
"CC-PDDC",
"AGPL-3.0-only",
"MPL-2.0-no-copyleft-exception",
"LicenseRef-scancode-public-domain",
"LGPL-2.1-only",
"BSD-2-Clause",
"CDDL-1.1",
"CDDL-1.0",
"LicenseRef-scancode-other-permissive",
"LicenseRef-scancode-proprietary-license",
"BSD-3-Clause",
"MIT",
"EPL-1.0",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-free-unknown",
"CC0-1.0",
"Classpath-exception-2.0",
"CC-BY-2.5"
] |
permissive
|
Romance-Zhang/flink_tpc_ds_game
|
7e82d801ebd268d2c41c8e207a994700ed7d28c7
|
8202f33bed962b35c81c641a05de548cfef6025f
|
refs/heads/master
| 2022-11-06T13:24:44.451821 | 2019-09-27T09:22:29 | 2019-09-27T09:22:29 | 211,280,838 | 0 | 1 |
Apache-2.0
| 2022-10-06T07:11:45 | 2019-09-27T09:11:11 |
Java
|
UTF-8
|
Java
| false | false | 3,730 |
java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.flink.runtime.taskexecutor.partition;
import org.apache.flink.api.common.JobID;
import org.apache.flink.runtime.io.network.partition.ResultPartitionID;
import org.apache.flink.util.TestLogger;
import org.junit.Test;
import java.util.Collection;
import java.util.Collections;
import static junit.framework.TestCase.assertNotNull;
import static junit.framework.TestCase.assertTrue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.empty;
import static org.junit.Assert.assertFalse;
/**
* Tests for the {@link PartitionTable}.
*/
public class PartitionTableTest extends TestLogger {
private static final JobID JOB_ID = new JobID();
private static final ResultPartitionID PARTITION_ID = new ResultPartitionID();
@Test
public void testEmptyTable() {
final PartitionTable<JobID> table = new PartitionTable<>();
// an empty table should always return an empty collection
Collection<ResultPartitionID> partitionsForNonExistingJob = table.stopTrackingPartitions(JOB_ID);
assertNotNull(partitionsForNonExistingJob);
assertThat(partitionsForNonExistingJob, empty());
assertFalse(table.hasTrackedPartitions(JOB_ID));
}
@Test
public void testStartTrackingPartition() {
final PartitionTable<JobID> table = new PartitionTable<>();
table.startTrackingPartitions(JOB_ID, Collections.singletonList(PARTITION_ID));
assertTrue(table.hasTrackedPartitions(JOB_ID));
}
@Test
public void testStartTrackingZeroPartitionDoesNotMutateState() {
final PartitionTable<JobID> table = new PartitionTable<>();
table.startTrackingPartitions(JOB_ID, Collections.emptyList());
assertFalse(table.hasTrackedPartitions(JOB_ID));
}
@Test
public void testStopTrackingAllPartitions() {
final PartitionTable<JobID> table = new PartitionTable<>();
table.startTrackingPartitions(JOB_ID, Collections.singletonList(PARTITION_ID));
Collection<ResultPartitionID> storedPartitions = table.stopTrackingPartitions(JOB_ID);
assertThat(storedPartitions, contains(PARTITION_ID));
assertFalse(table.hasTrackedPartitions(JOB_ID));
}
@Test
public void testStopTrackingPartitions() {
final ResultPartitionID partitionId2 = new ResultPartitionID();
final PartitionTable<JobID> table = new PartitionTable<>();
table.startTrackingPartitions(JOB_ID, Collections.singletonList(PARTITION_ID));
table.startTrackingPartitions(JOB_ID, Collections.singletonList(partitionId2));
table.stopTrackingPartitions(JOB_ID, Collections.singletonList(partitionId2));
assertTrue(table.hasTrackedPartitions(JOB_ID));
Collection<ResultPartitionID> storedPartitions = table.stopTrackingPartitions(JOB_ID);
assertThat(storedPartitions, contains(PARTITION_ID));
assertFalse(table.hasTrackedPartitions(JOB_ID));
}
}
|
[
"[email protected]"
] | |
6433fd36e78d110c4cdf7d11d63a53586d1b559e
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/35/35_8c1f3cacdb3b256cbdcda7c72a824d23bb9b46e8/BusinessDTO/35_8c1f3cacdb3b256cbdcda7c72a824d23bb9b46e8_BusinessDTO_s.java
|
82df94de31613670a6440c4ac4056b71ccd70ffe
|
[] |
no_license
|
zhongxingyu/Seer
|
48e7e5197624d7afa94d23f849f8ea2075bcaec0
|
c11a3109fdfca9be337e509ecb2c085b60076213
|
refs/heads/master
| 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null |
UTF-8
|
Java
| false | false | 820 |
java
|
package com.okaru.dtomapper.dto;
import java.util.Date;
import com.okaru.dtomapper.annotation.MappedField;
public class BusinessDTO {
@MappedField(mappedObjectKey="business")
private String name;
@MappedField(mappedObjectKey="business", field="founded")
private Date dateFounded;
@MappedField(mappedObjectKey="business", field="industry")
private String industryName;
public String getIndustryName() {
return industryName;
}
public void setIndustryName(String industryName) {
this.industryName = industryName;
}
public Date getDateFounded() {
return dateFounded;
}
public void setDateFounded(Date dateFounded) {
this.dateFounded = dateFounded;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
|
[
"[email protected]"
] | |
071355be8d1f0b7f2544d5822e6e4823342f50c4
|
7b0b0a44264cf8f38be65ca4b7df52456a7382bc
|
/app/src/main/java/com/swerr/bleterm/MainActivity.java
|
75ce184c78cab41ba29f848959df0c69da97bcc1
|
[] |
no_license
|
fox4u/bleTerm
|
b91dfa2dd2a4a52f78ca73ff3de05b96f79961af
|
6ed8b0613b4144ed096672edbfba97865a890a28
|
refs/heads/master
| 2021-01-11T17:37:32.195410 | 2017-04-19T06:24:04 | 2017-04-19T06:24:04 | 79,806,319 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 9,337 |
java
|
package com.swerr.bleterm;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.ParcelUuid;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.SimpleAdapter;
import android.widget.Toast;
@SuppressLint("NewApi")
public class MainActivity extends Activity {
private static String LOG_TAG = "MainActivity";
private static final String uuid_template = "0000%04x-0000-1000-8000-00805f9b34fb";
private static final String addr_uuid_tempplate = "%s -- %04x";
private BluetoothAdapter mBluetoothAdapter;
private boolean mScanning;
private Handler mHandler;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mHandler = new Handler();
if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
Toast.makeText(this,"没有蓝牙", Toast.LENGTH_SHORT).show();
finish();
}
// 初始化一个蓝牙适配器。对API 18级以上,可以参考 bluetoothmanager。
final BluetoothManager bluetoothManager =
(BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
mBluetoothAdapter = bluetoothManager.getAdapter();
// 检查是否支持蓝牙的设备。
if (mBluetoothAdapter == null) {
Toast.makeText(this,"设备不支持", Toast.LENGTH_SHORT).show();
finish();
return;
}
Button btstart=(Button) findViewById(R.id.btstart);
Button btstop=(Button) findViewById(R.id.btstop);
bar = (ProgressBar) findViewById(R.id.bar);
bar.setVisibility(View.GONE);
btlist = (ListView) findViewById(R.id.list);
listItem = new ArrayList<HashMap<String, Object>>();
adapter = new SimpleAdapter(this,listItem,android.R.layout.simple_expandable_list_item_2,
new String[]{"name","addr_uuid"},new int[]{android.R.id.text1,android.R.id.text2});
btlist.setAdapter(adapter);
btlist.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
String address = (String) listItem.get(arg2).get("address");
String name = (String) listItem.get(arg2).get("name");
int uuid = (Integer) listItem.get(arg2).get("uuid");
Intent intent=new Intent(getApplicationContext(), BlueCont.class);
intent.putExtra("address",address);
intent.putExtra("name",name);
if (uuid != -1)
{
String serv_uuid = String.format(Locale.US, uuid_template, uuid);
String char_uuid = String.format(Locale.US, uuid_template, uuid + 1);
intent.putExtra("serv_uuid",serv_uuid);
intent.putExtra("char_uuid",char_uuid);
Log.w(LOG_TAG, "uuid:" + uuid + ", char:" + char_uuid);
}
if (mScanning)
{
mBluetoothAdapter.stopLeScan(mLeScanCallback);
mScanning = false;
}
startActivity(intent);
}
});
btstart.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
scanLeDevice(true);
Log.e(LOG_TAG, "开始搜寻");
}
});
btstop.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
scanLeDevice(false);
Log.e(LOG_TAG, "停止");
}
});
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
//确保蓝牙是在设备上启用。如果当前没有启用蓝牙,
//火意图显示一个对话框询问用户授予权限以使它。
if (!mBluetoothAdapter.isEnabled()) {
if (!mBluetoothAdapter.isEnabled()) {
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(enableBtIntent, 1);
}
}
// scanLeDevice(true);
}
private void scanLeDevice(final boolean enable) {
if (enable) {
//停止后一个预定义的扫描周期扫描。
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
mScanning = false;
bar.setVisibility(View.GONE);
mBluetoothAdapter.stopLeScan(mLeScanCallback);
invalidateOptionsMenu();
}
}, 5000);
bar.setVisibility(View.VISIBLE);
mScanning = true;
mBluetoothAdapter.startLeScan(mLeScanCallback);
listItem.clear();
} else {
bar.setVisibility(View.GONE);
mScanning = false;
mBluetoothAdapter.stopLeScan(mLeScanCallback);
}
invalidateOptionsMenu();
}
// 扫描装置的回调。
private BluetoothAdapter.LeScanCallback mLeScanCallback =
new BluetoothAdapter.LeScanCallback() {
@Override
public void onLeScan(final BluetoothDevice device, final int rssi, final byte[] scanRecord) {
runOnUiThread(new Runnable() {
@Override
public void run() {
checkDevice(device, rssi, scanRecord);
}
});
}
};
private ListView btlist;
private ArrayList<HashMap<String, Object>> listItem;
private SimpleAdapter adapter;
private ProgressBar bar;
private static String ByteArrayToString(byte[] ba)
{
StringBuilder hex = new StringBuilder(ba.length * 2);
for (byte b : ba)
hex.append(b + " ");
return hex.toString();
}
public static class AdRecord {
private int iLength;
private int iType;
private byte[] rawData;
public AdRecord(int length, int type, byte[] data) {
iLength = length;
iType = type;
rawData = data;
Log.i(LOG_TAG, "Length: " + length + " Type : " + type + " Data : " + ByteArrayToString(data));
}
// ...
public static List<AdRecord> parseScanRecord(byte[] scanRecord) {
List<AdRecord> records = new ArrayList<AdRecord>();
int index = 0;
while (index < scanRecord.length) {
int length = scanRecord[index++];
//Done once we run out of records
if (length == 0) break;
int type = scanRecord[index];
//Done if our record isn't a valid type
if (type == 0) break;
byte[] data = Arrays.copyOfRange(scanRecord, index+1, index+length);
records.add(new AdRecord(length, type, data));
//Advance
index += length;
}
return records;
}
public int getUUID()
{
int ret = -1;
if(iType == 2)
{
ret = ((rawData[0] & 0xFF) | (rawData[1] & 0xFF) << 8) & 0xFFFF;
}
return ret;
}
}
private void checkDevice(final BluetoothDevice device, final int rssi, byte[] scanRecord)
{
Log.w(LOG_TAG, "check device:" + device.getName() + ", " + rssi);
List<AdRecord> records = AdRecord.parseScanRecord(scanRecord);
int uuid = -1;
for(AdRecord rec:records)
{
uuid = rec.getUUID();
if(uuid != -1)
{
break;
}
}
String addr = device.getAddress();
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("name", device.getName());
map.put("address",addr);
map.put("uuid", uuid);
if(uuid != -1)
{
String addr_uuid = String.format(Locale.US, addr_uuid_tempplate, addr, uuid);
map.put("addr_uuid", addr_uuid);
}
else
{
map.put("addr_uuid", addr);
}
listItem.add(map);
adapter.notifyDataSetChanged();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// 将菜单;这将项目添加到动作条如果真的存在。
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
|
[
"[email protected]"
] | |
97fe06f9d2c65816c1896e4f7159f3960bbc1a10
|
3ba8b0521886240bb27d61f7b1ce30d9da9f0142
|
/src/main/java/com/users/management/model/User.java
|
ac3666c52d28771f687feb87e7b0de75f22abf79
|
[] |
no_license
|
DannyMatev/userManagement
|
a8be4312f8718c125152c1e09a8dcda1d1605eaa
|
a8c0796b96f11b5a4420014db8373d6b7c548546
|
refs/heads/master
| 2020-05-22T13:34:07.540784 | 2019-05-17T11:08:47 | 2019-05-17T11:08:47 | 186,362,814 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,237 |
java
|
package com.users.management.model;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import java.time.LocalDate;
import java.util.Objects;
@Document
public class User {
@Id
private String id;
private String firstName;
private String lastName;
@Indexed(unique=true)
private String emailAddress;
private LocalDate dateOfBirth;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmailAddress() {
return emailAddress;
}
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
public LocalDate getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(LocalDate dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
User user = (User) o;
return Objects.equals(id, user.id) &&
Objects.equals(firstName, user.firstName) &&
Objects.equals(lastName, user.lastName) &&
Objects.equals(emailAddress, user.emailAddress) &&
Objects.equals(dateOfBirth, user.dateOfBirth);
}
@Override
public int hashCode() {
return Objects.hash(id, firstName, lastName, emailAddress, dateOfBirth);
}
@Override
public String toString() {
return "User{" +
"id='" + id + '\'' +
", firstName='" + firstName + '\'' +
", lastName='" + lastName + '\'' +
", emailAddress='" + emailAddress + '\'' +
", dateOfBirth=" + dateOfBirth +
'}';
}
}
|
[
"[email protected]"
] | |
c82fe84a34d393df4562039f87e419289ac5715e
|
428823dab4d8bc3ac94f39b0da286848b5be9d94
|
/src/main/java/com/rfid/netty/utils/ParamsMap.java
|
b28b505ea4cf925846767312a8f6b80475e07172
|
[] |
no_license
|
odora/RfidNetty
|
ba68e4c6f3f80b711721eced155d994e96c0a2b1
|
cf6ecc0a85557abcd41c31c08c6ea0de9b18aa81
|
refs/heads/master
| 2021-12-15T03:40:13.184525 | 2017-07-22T17:20:17 | 2017-07-22T17:20:17 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,013 |
java
|
package com.rfid.netty.utils;
import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
public class ParamsMap {
private final static ObjectMapper om = new JsonObjectMapper();
public static Map<String, String> getParamsMap(String body) throws JsonProcessingException, IOException{
Map<String, String> map = new HashMap<String, String>();
JsonNode root = om.readTree(body);
Iterator<String> nodeNames = root.fieldNames();
while(nodeNames.hasNext()){
String nodeName = nodeNames.next();
JsonNode node = root.get(nodeName);
map.put(nodeName, node.asText());
}
return map;
}
public static String getJsonString(Object obj) throws JsonProcessingException{
return om.writeValueAsString(obj);
}
}
|
[
"[email protected]"
] | |
3116bdf9c7caf641d80542df3eed43c7509981ad
|
06361e7873638602bd1446da9fea171aaf8414c8
|
/src/main/java/DongYu/WebBase/System/Service/RoleService.java
|
b15326ee09a174818ad253259d041f462c6c5854
|
[] |
no_license
|
Peter9063/BillManage
|
9e3b625d53d009cc8924726899f34b10a1adc655
|
cc46fb7a1e213e208cceb09c4a1b9205b8b2fb56
|
refs/heads/main
| 2023-03-18T02:56:09.338924 | 2022-07-09T09:01:04 | 2022-07-09T09:01:04 | 230,550,179 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 694 |
java
|
package DongYu.WebBase.System.Service;
import DongYu.WebBase.System.Entity.Role;
import DongYu.WebBase.System.Entity.SysBase.Sorte;
import DongYu.WebBase.System.Entity.SysBase.WebMessage;
import java.util.List;
public interface RoleService {
public WebMessage<Role> save(Role[] records, String userName);
public WebMessage<Role> delete(Role[] records);
public WebMessage<Role> update(Role[] records, String userName);
public List<Role> select(Role records, Integer start, Integer limit, Sorte[] sortes);
public Long getCount(Role record);
public WebMessage findPage(Role record, Integer start, Integer limit, String sort);
public List<Role> findPage();
}
|
[
"[email protected]"
] | |
f67816900fc63967ef71ca8e4726601a8224ecd0
|
0ebb418da77a5e7bd5f2a649a662813030d01a44
|
/src/babel/content/eqclasses/properties/type/Type.java
|
1f975cbd10251143a30c0aae0bb2edc2ccf684eb
|
[] |
no_license
|
aklement/babel
|
82fa2495036f7ebd5acf182e5e789c3d085f32d7
|
43858abdf8a9df52e5c8c25804521241eb9bb3cf
|
refs/heads/master
| 2016-09-05T15:02:11.364542 | 2013-05-10T14:36:15 | 2013-05-10T14:36:15 | 458,432 | 3 | 3 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,231 |
java
|
package babel.content.eqclasses.properties.type;
import babel.content.eqclasses.EquivalenceClass;
import babel.content.eqclasses.properties.Property;
public class Type extends Property
{
protected static final String NONE = "none";
protected static final String SRC = "src";
protected static final String TRG = "trg";
public Type()
{ m_type = EqType.NONE;
}
public Type(EqType type)
{ setType(type);
}
public void setType(EqType type)
{ m_type = (type == null) ? EqType.NONE : type;
}
public EqType getType()
{ return m_type;
}
public String toString()
{ return persistToString();
}
public String persistToString()
{ return EqType.NONE.equals(m_type) ? NONE : (EqType.SOURCE.equals(m_type) ? SRC : TRG);
}
public void unpersistFromString(EquivalenceClass eq, String str) throws Exception
{
if (SRC.equalsIgnoreCase(str))
{ m_type = EqType.SOURCE;
}
else if (TRG.equalsIgnoreCase(str))
{ m_type = EqType.TARGET;
}
else if (NONE.equalsIgnoreCase(str))
{ m_type = EqType.NONE;
}
else
{ throw new IllegalArgumentException();
}
}
protected EqType m_type;
public static enum EqType {SOURCE, TARGET, NONE}
}
|
[
"[email protected]"
] | |
5ec65ac3ef9a2eb900c5f61b74c4fa6eb6706330
|
6a854e2f5d861bd4d67a49a3a3c40ec3f46df8a7
|
/Handler/src/handler/Handler.java
|
63bf3eeb8d865d74aec4adbc6296ceaabb19c55d
|
[] |
no_license
|
Kevizy/Java-Projects
|
f587d5674b9aa27f3e1d85dcbd58959d7eabe35c
|
52eabe6587546103f51e787806791389d59f939f
|
refs/heads/master
| 2021-07-08T00:35:56.902908 | 2021-03-15T03:56:09 | 2021-03-15T03:56:09 | 229,690,659 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 332 |
java
|
package handler;
import javax.swing.JFrame;
public class Handler {
public static void main(String[] args) {
HandlerInfo msg = new HandlerInfo();
msg.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
msg.setSize(350, 100);
msg.setVisible(true);
}
}
|
[
"[email protected]"
] | |
3bc63c0e81cdf5174c85cbe3b9d250ab989b1cd8
|
d531fbed852183415ab84955a55462ac14d6eab8
|
/src/main/java/patrimoine/controllers/rest/ZoologieInvertebresAutresRestController.java
|
cbd36eddca2e53ffd753a9e76a54cbf48eff204f
|
[] |
no_license
|
Droopy06/patrimoine-flst-JEE
|
6ff00d81be40887080295d26449e765eae632220
|
9d50a51ac830074e7f865496fe386205ac7fd8a2
|
refs/heads/master
| 2021-01-10T17:06:47.620640 | 2017-05-01T16:35:01 | 2017-05-01T16:35:01 | 46,551,001 | 0 | 0 | null | 2016-02-04T09:46:28 | 2015-11-20T09:01:50 |
Java
|
UTF-8
|
Java
| false | false | 1,456 |
java
|
package patrimoine.controllers.rest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import patrimoine.models.ZoologieInvertebresAutres;
import patrimoine.services.daoServices.ZoologieInvertebresAutresService;
import java.util.List;
/**
* Created by LAMOOT Alexandre on 04/11/2016.
*/
@RestController
@RequestMapping("/rest/patrimoine")
public class ZoologieInvertebresAutresRestController {
private ZoologieInvertebresAutresService zoologieInvertebresAutresService;
@Autowired
public ZoologieInvertebresAutresRestController(ZoologieInvertebresAutresService zoologieInvertebresAutresService) {
this.zoologieInvertebresAutresService = zoologieInvertebresAutresService;
}
@RequestMapping(value = "/zoologieinvertebresautres",method = RequestMethod.GET)
public List<ZoologieInvertebresAutres> getAllZoologieInvertebresAutres(){
return zoologieInvertebresAutresService.findAll();
}
@RequestMapping(value = "/zoologieinvertebresautres/{id}",method = RequestMethod.GET)
public ZoologieInvertebresAutres getZoologieInvertebresAutresById(@PathVariable("id") String id){
return zoologieInvertebresAutresService.findOne(id);
}
}
|
[
"[email protected]"
] | |
67f0b3325f94e043ce434e42ff05f8a1b6000712
|
b0ebab9ed0ff40f436a723f2a8a78d0f3f9917b0
|
/src/main/java/com/sv27/learn/config/JacksonConfiguration.java
|
688c6f24a3e5fd7744bdf29e208ae6ca8be55621
|
[
"MIT"
] |
permissive
|
iamsivav/Jenkins_Pipeline
|
a89886021db0d3c43d2bd47b8e176345be12b0d5
|
c52060814354872be0b47191fe825d52b499ee1f
|
refs/heads/main
| 2022-12-28T17:14:16.995928 | 2020-10-17T04:32:23 | 2020-10-17T04:32:23 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,407 |
java
|
package com.sv27.learn.config;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.module.afterburner.AfterburnerModule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.zalando.problem.ProblemModule;
import org.zalando.problem.violations.ConstraintViolationProblemModule;
@Configuration
public class JacksonConfiguration {
/**
* Support for Java date and time API.
* @return the corresponding Jackson module.
*/
@Bean
public JavaTimeModule javaTimeModule() {
return new JavaTimeModule();
}
@Bean
public Jdk8Module jdk8TimeModule() {
return new Jdk8Module();
}
/*
* Jackson Afterburner module to speed up serialization/deserialization.
*/
@Bean
public AfterburnerModule afterburnerModule() {
return new AfterburnerModule();
}
/*
* Module for serialization/deserialization of RFC7807 Problem.
*/
@Bean
ProblemModule problemModule() {
return new ProblemModule();
}
/*
* Module for serialization/deserialization of ConstraintViolationProblem.
*/
@Bean
ConstraintViolationProblemModule constraintViolationProblemModule() {
return new ConstraintViolationProblemModule();
}
}
|
[
""
] | |
cd0dce1e7876f50df389b72a60be4adaabbfac25
|
355036ec921198d7af4441f73a0315373836c64f
|
/src/br/com/suelengc/devfest/main/AdapterItemExample.java
|
bc307519050a6e3bdc54ff73cfd0ab7c60b83f52
|
[] |
no_license
|
SuelenGC/DevFest2012-Fragments
|
c3ddf77256d135759e089a81b281f47efb245d0b
|
57eb3e1a83de5fd44ffcd8a66ad69cec40b75ff9
|
refs/heads/master
| 2020-06-05T18:13:25.117097 | 2012-11-30T17:33:23 | 2012-11-30T17:33:23 | null | 0 | 0 | null | null | null | null |
ISO-8859-1
|
Java
| false | false | 1,902 |
java
|
package br.com.suelengc.devfest.main;
import java.util.List;
import br.com.suelengc.devfest.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
public class AdapterItemExample extends BaseAdapter {
private LayoutInflater mInflater;
private List<ItemExample> itens;
public AdapterItemExample(Context context, List<ItemExample> listExamples) {
//Itens que preencheram o listview
this.itens = listExamples;
//responsavel por pegar o Layout do item.
mInflater = LayoutInflater.from(context);
}
/**
* Retorna a quantidade de itens
*
* @return
*/
public int getCount() {
return itens.size();
}
/**
* Retorna o item de acordo com a posicao dele na tela.
*
* @param position
* @return
*/
public ItemExample getItem(int position) {
return itens.get(position);
}
/**
* Sem implementação
*
* @param position
* @return
*/
public long getItemId(int position) {
return position;
}
public View getView(int position, View view, ViewGroup parent) {
//Pega o item de acordo com a posção.
ItemExample item = itens.get(position);
//infla o layout para podermos preencher os dados
view = mInflater.inflate(R.layout.item_example, null);
//atravez do layout pego pelo LayoutInflater, pegamos cada id relacionado
//ao item e definimos as informações.
((TextView) view.findViewById(R.id_item_example.name)).setText(item.getName());
((TextView) view.findViewById(R.id_item_example.description)).setText(item.getDescription());
return view;
}
}
|
[
"[email protected]"
] | |
633fbd85a736a37349051946153f4f2d00f2e234
|
9e38c682aa1225c5fdec383346b26b1957ef1743
|
/Strings_Datas/src/pacote/Aplicacao.java
|
848aca9d06fb531ebb285d80bd6abd9bc49930e4
|
[] |
no_license
|
PatrickGuedesOliveira/StringsDatas
|
54037be026037ca7c658ae4b99aae9a70fcacb32
|
eea103be973718ec1f737e02a99fcbd8a90c5786
|
refs/heads/master
| 2021-01-22T15:11:57.265320 | 2016-09-19T12:42:16 | 2016-09-19T12:42:16 | 68,604,887 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 896 |
java
|
package pacote;
import java.text.NumberFormat;
import java.util.Currency;
import java.util.Locale;
public class Aplicacao {
public static void main(String[] args){
// System.out.printf("%f", 1225401.7);
Locale l = new Locale("pt", "BR");
System.out.println(l.getDisplayName());
Currency moeda = Currency.getInstance(l);
System.out.println(moeda.getSymbol());
System.out.println(moeda.getDisplayName());
NumberFormat nf = NumberFormat.getInstance();
String s = nf.format(1000.5);
System.out.println(s);
NumberFormat nf1 = NumberFormat.getCurrencyInstance();
String s1 = nf1.format(1000.5);
System.out.println(s1);
NumberFormat nf2 = NumberFormat.getPercentInstance();
String s2 = nf2.format(1000.5);
System.out.println(s2);
System.out.println(String.format("%.2f", Float.parseFloat("123.4")));
}
}
|
[
"[email protected]"
] | |
74ef2deb864207d9fb54da9f2ad8eb2fb136fe97
|
53af22376bd0db992db1559e7031b9c87a962462
|
/app/src/main/java/com/yuri/dreamlinkcost/model/OnLoginListener.java
|
1c5ba7cd191873361acbc42105bf5882d983bfcb
|
[] |
no_license
|
xiayouli0122/DreamLinkCost
|
e2f8bc1d7a23bdbe544d14f912511e3043d71b11
|
1874691bf6f3da307324867540a1bf511e32f2db
|
refs/heads/master
| 2021-01-17T13:54:30.187718 | 2019-06-06T03:58:14 | 2019-06-06T03:58:14 | 39,063,056 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 169 |
java
|
package com.yuri.dreamlinkcost.model;
/**
* Created by Yuri on 2016/1/15.
*/
public interface OnLoginListener {
void onLoginSuccess();
void onLoginFail();
}
|
[
"[email protected]"
] | |
dbe3767eac5ece546fbdaa74ba5eab81e67d8460
|
b489055a0d77fbe6e5e3260210c7235c59836ffe
|
/it-order-claims/src/main/java/org/prof_itgroup/it_order/ItMessageListener.java
|
ea1ae333c7d40e9bc3c2a837faeab2309dbb1063
|
[] |
no_license
|
Hibernate2009/it-parent
|
35ab6fb1c817d6fd3c9a6635017affda0a130191
|
f3e5fe45b6b201b0a4724a729f4a0c3985622be6
|
refs/heads/master
| 2021-08-31T12:37:37.760213 | 2017-12-21T09:31:20 | 2017-12-21T09:31:20 | 114,987,221 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,731 |
java
|
package org.prof_itgroup.it_order;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
import org.apache.log4j.Logger;
import org.it.utils.exception.ExceptionUtil;
import org.it.utils.jms.JmsSender;
import org.prof_itgroup.json.order.Order;
import org.prof_itgroup.json.result.ServiceResult;
import org.springframework.jdbc.core.JdbcTemplate;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
public class ItMessageListener implements MessageListener {
private static Logger log = Logger.getLogger(ItMessageListener.class.getName());
private JmsSender jmsSender;
private JdbcTemplate jdbcTemplate;
public ItMessageListener(JdbcTemplate jdbcTemplate, JmsSender jmsSender) {
this.jdbcTemplate = jdbcTemplate;
this.jmsSender = jmsSender;
}
public void onMessage(Message message) {
ObjectMapper mapper = new ObjectMapper();
ServiceResult serviceResult = new ServiceResult();
try {
TextMessage tm = (TextMessage) message;
String payload = tm.getText();
Order order = mapper.readValue(payload, Order.class);
log.info("Модуль it-order-claims принял JSON объект Order id:"+order.getDoc().getId());
try{
Date orderDate = null;
if (order.getDoc().getOrderDate()!=null && !"".equals(order.getDoc().getOrderDate())){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
orderDate = format.parse(order.getDoc().getOrderDate());
}
Date orderPlanDateFrom = null;
if(order.getDoc().getOrderPlanDateFrom()!=null && !"".equals(order.getDoc().getOrderPlanDateFrom())){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
orderPlanDateFrom=format.parse(order.getDoc().getOrderPlanDateFrom());
}
Date orderPlanDateTo = null;
if (order.getDoc().getOrderPlanDateTo()!=null && !"".equals(order.getDoc().getOrderPlanDateTo())){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
orderPlanDateTo = format.parse(order.getDoc().getOrderPlanDateTo());
}
Date dtLoss = null;
if (order.getDoc().getDtLoss()!=null && !"".equals(order.getDoc().getDtLoss())){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
dtLoss = format.parse(order.getDoc().getDtLoss());
}
Object[] param = new Object[]{
order.getDoc().getCargoInvoice(),
order.getDoc().getClient(),
order.getDoc().getClientNameEn(),
order.getDoc().getClientNameRu(),
order.getDoc().getConsignee(),
order.getDoc().getConsigneeNameEn(),
order.getDoc().getConsigneeNameRu(),
order.getDoc().getEmploye(),
order.getDoc().getEmployeName(),
order.getDoc().getFlowtype(),
order.getDoc().getFlowtypeName(),
order.getDoc().getId(),
order.getDoc().getImport(),
order.getDoc().getModel(),
order.getDoc().getModelNameEn(),
order.getDoc().getModelNameRu(),
orderDate,
order.getDoc().getOrderDescription(),
order.getDoc().getOrderDescription1(),
order.getDoc().getOrderDescription2(),
order.getDoc().getOrderLdm(),
order.getDoc().getOrderNo(),
order.getDoc().getOrderNumber(),
order.getDoc().getOrderParcels(),
orderPlanDateFrom,
orderPlanDateTo,
order.getDoc().getOrderPrice(),
order.getDoc().getOrderPriority(),
order.getDoc().getOrderSono(),
order.getDoc().getOrderType(),
order.getDoc().getOrderVolume(),
order.getDoc().getOrderWeight(),
order.getDoc().getSender(),
order.getDoc().getSenderNameEn(),
order.getDoc().getSenderNameRu(),
order.getDoc().getSupplier(),
order.getDoc().getSupplierNameEn(),
order.getDoc().getSupplierNameRu(),
order.getDoc().getTruck(),
order.getDoc().getTruckName(),
dtLoss,
order.getDoc().getCompensatedByInsurance(),
order.getDoc().getNotes(),
order.getDoc().getTypeId(),
order.getDoc().getCLMstatus()
};
jdbcTemplate.update("insert into CustomerOrder ("
+ "cargoinvoice,"
+ "client,"
+ "clientNameEn,"
+ "clientNameRu,"
+ "consignee,"
+ "consigneeNameEn,"
+ "consigneeNameRu,"
+ "employe,"
+ "employeName,"
+ "flowtype,"
+ "flowtypeName,"
+ "id,"
+ "import,"
+ "model,"
+ "modelNameEn,"
+ "modelNameRu,"
+ "orderDate,"
+ "orderDescription,"
+ "orderDescription1,"
+ "orderDescription2,"
+ "orderLdm,"
+ "orderNo,"
+ "orderNumber,"
+ "orderParcels,"
+ "orderPlanDateFrom,"
+ "orderPlanDateTo,"
+ "orderPrice,"
+ "orderPriority,"
+ "orderSono,"
+ "orderType,"
+ "orderVolume,"
+ "orderWeight,"
+ "sender,"
+ "senderNameEn,"
+ "senderNameRu,"
+ "supplier,"
+ "supplierNameEn,"
+ "supplierNameRu,"
+ "truck,"
+ "truckName,"
+ "dtLoss,"
+ "compensatedByInsurance,"
+ "notes,"
+ "typeId,"
+ "CLMstatus"
+ ") values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", param);
serviceResult.setError(true);
serviceResult.setId(order.getDoc().getId());
try {
String serviceResultAsString = mapper.writeValueAsString(serviceResult);
jmsSender.send("it-order-ticket-queue", serviceResultAsString);
} catch (JsonProcessingException e1) {
log.info("ItMessageListener error:" + ExceptionUtil.getPrintStackTraceAsString(e1));
}
}catch(Exception e){
log.info("ItMessageListener error:" + ExceptionUtil.getPrintStackTraceAsString(e));
serviceResult.setError(false);
serviceResult.setId(order.getDoc().getId());
try {
String serviceResultAsString = mapper.writeValueAsString(serviceResult);
jmsSender.send("it-order-ticket-queue", serviceResultAsString);
} catch (JsonProcessingException e1) {
log.info("ItMessageListener error:" + ExceptionUtil.getPrintStackTraceAsString(e1));
}
}
}catch(Exception e){
log.info("ItMessageListener error:" + ExceptionUtil.getPrintStackTraceAsString(e));
serviceResult.setError(false);
try {
String serviceResultAsString = mapper.writeValueAsString(serviceResult);
jmsSender.send("it-order-ticket-queue", serviceResultAsString);
} catch (JsonProcessingException e1) {
log.info("ItMessageListener error:" + ExceptionUtil.getPrintStackTraceAsString(e1));
}
}
}
}
|
[
"[email protected]"
] | |
9666b1b4cbda20b8a3b837ecef40cb5824931890
|
f6b90fae50ea0cd37c457994efadbd5560a5d663
|
/android/nut-dex2jar.src/com/nut/blehunter/a/e.java
|
ec57ffe4f1875dd6b1b0024c9ce47d17b087baed
|
[] |
no_license
|
dykdykdyk/decompileTools
|
5925ae91f588fefa7c703925e4629c782174cd68
|
4de5c1a23f931008fa82b85046f733c1439f06cf
|
refs/heads/master
| 2020-01-27T09:56:48.099821 | 2016-09-14T02:47:11 | 2016-09-14T02:47:11 | 66,894,502 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,657 |
java
|
package com.nut.blehunter.a;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import b.a.a;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.json.JSONException;
import org.json.JSONObject;
public final class e
{
long a = System.currentTimeMillis();
String b;
String c;
public Map<String, String> d = new HashMap();
public e(c paramc, String paramString1, String paramString2)
{
this.b = paramString1;
this.c = paramString2;
}
public final void a()
{
JSONObject localJSONObject = new JSONObject();
Object localObject1 = new JSONObject();
Object localObject2;
Object localObject3;
while (true)
{
try
{
((JSONObject)localObject1).put("DATE", this.a);
((JSONObject)localObject1).put("EVENT", this.b);
if (!TextUtils.isEmpty(this.c))
{
((JSONObject)localObject1).put("SUB_EVENT", this.c);
if (this.d.isEmpty())
break label278;
localObject2 = new JSONObject();
localObject3 = this.d.keySet().iterator();
if (!((Iterator)localObject3).hasNext())
break;
String str1 = (String)((Iterator)localObject3).next();
String str2 = (String)this.d.get(str1);
if (TextUtils.isEmpty(str2))
continue;
((JSONObject)localObject2).put(str1, str2);
continue;
}
}
catch (JSONException localJSONException)
{
a.b(localJSONException, "record exception", new Object[0]);
return;
}
((JSONObject)localObject1).put("SUB_EVENT", JSONObject.NULL);
}
((JSONObject)localObject1).put("DATA", localObject2);
while (true)
{
localJSONException.put("NUT_LOG", localObject1);
localObject2 = this.e;
localObject1 = localJSONException.toString();
if (((c)localObject2).a != null)
{
localObject2 = ((c)localObject2).a.obtainMessage();
((Message)localObject2).what = 1;
localObject3 = new Bundle();
((Bundle)localObject3).putString("data", (String)localObject1);
((Message)localObject2).setData((Bundle)localObject3);
((Message)localObject2).sendToTarget();
}
a.a("recode=" + localJSONException.toString(), new Object[0]);
return;
label278: ((JSONObject)localObject1).put("DATA", JSONObject.NULL);
}
}
}
/* Location: C:\crazyd\work\ustone\odm2016031702\baidu\android\nut-dex2jar.jar
* Qualified Name: com.nut.blehunter.a.e
* JD-Core Version: 0.6.2
*/
|
[
"[email protected]"
] | |
3f608c2457bc8cbf483942cdc867696e9c12640b
|
d7930c2b8a1ff5906453398407aae3f62c19b62b
|
/app/src/main/java/wolfgang/bergbauer/de/kletterguide/ShareHelper.java
|
21b0559988d7af3a109ed5a3d82cef623fd32a6e
|
[] |
no_license
|
SonicBoom89/KletterGuide
|
144e78a92671a7d838aa9cad65c413756457cc65
|
293bfd67971d9ed110f707a96fca0e11470446bb
|
refs/heads/master
| 2021-01-17T11:00:08.291628 | 2017-05-18T10:47:00 | 2017-05-18T10:47:00 | 40,146,976 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 350 |
java
|
package wolfgang.bergbauer.de.kletterguide;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.ShareActionProvider;
import android.view.MenuItem;
import wolfgang.bergbauer.de.kletterguide.model.ClimbingArea;
/**
* Created by Wolfgang on 08.08.2015.
*/
public class ShareHelper {
}
|
[
"[email protected]"
] | |
fa906106674db52235a8d27fe8bfc7157eef7957
|
c2721046f768feb5b062c8be00a8f3ffc5a2aa25
|
/today/SoundCloud/src/POJO/AudioFile.java
|
93492ff46b18a7a4386e8980f66b210fb06d3822
|
[] |
no_license
|
SiaSimeonova/SoundCloud-FinalProject
|
4daf28e3eada5e93865bc7b531d6f4a1b013d65f
|
6d2f26453e2b48a492395a6ed796f27552f0a43a
|
refs/heads/master
| 2016-08-12T12:44:52.353309 | 2016-04-14T02:20:34 | 2016-04-14T02:20:34 | 54,495,208 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,953 |
java
|
package POJO;
public class AudioFile {
private static int audioCounter = 0;
private int id;
private String URL;
private String category;
private String name;
private String autor;
private String description;
private String picture;
private boolean isPrivate;
private int likes;
private int reposts;
private int shares;
private int downloads;
private int timesPlayed;
private String ownersName;
public AudioFile(String uRL, String category, String name, String autor, String description, String picture,
boolean isPrivate, int likes, int reposts, int shares, int downloads, int timesPlayed, String ownersName) {
this(uRL, name, ownersName);
this.category = category;
this.autor = autor;
this.description = description;
this.picture = picture;
this.isPrivate = isPrivate;
this.likes = likes;
this.reposts = reposts;
this.shares = shares;
this.downloads = downloads;
this.timesPlayed = timesPlayed;
}
public AudioFile(String uRL, String name, String ownersName) {
URL = uRL;
this.name = name;
this.autor = "empty";
this.description = "empty";
this.picture = "empty";
this.isPrivate = false;
this.likes = 0;
this.reposts = 0;
this.shares = 0;
this.downloads = 0;
this.timesPlayed = 0;
this.ownersName = ownersName;
this.id = ++audioCounter;
}
public String getURL() {
return URL;
}
public int getId() {
return id;
}
public void setURL(String uRL) {
URL = uRL;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAutor() {
return autor;
}
public void setAutor(String autor) {
this.autor = autor;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getPicture() {
return picture;
}
public void setPicture(String picture) {
this.picture = picture;
}
public boolean isPrivate() {
return isPrivate;
}
public void setPrivate(boolean isPrivate) {
this.isPrivate = isPrivate;
}
public int getLikes() {
return likes;
}
public void setLikes(int likes) {
this.likes = likes;
}
public int getReposts() {
return reposts;
}
public void setReposts(int reposts) {
this.reposts = reposts;
}
public int getShares() {
return shares;
}
public void setShares(int shares) {
this.shares = shares;
}
public int getDownloads() {
return downloads;
}
public void setDownloads(int downloads) {
this.downloads = downloads;
}
public int getTimesPlayed() {
return timesPlayed;
}
public void setTimesPlayed(int timesPlayed) {
this.timesPlayed = timesPlayed;
}
public String getOwnersName() {
return ownersName;
}
public void setOwnersName(String ownersName) {
this.ownersName = ownersName;
}
}
|
[
"[email protected]"
] | |
19a80eb9059c61bb8820a32039e18325907b63dd
|
20c79c03bdbcbb72b3d2b223dd64cfecde17bfe3
|
/UniversalCalculator/test/universalcalculator/Converter/ArabicConverterTest.java
|
74e128921fe036eabd1d583b59c9bdfc18cb7dca
|
[] |
no_license
|
licar/UniversalCalculator
|
bdbecbac2e33e6ce5d5599530d40645763090df9
|
d919d8c89cc2ac8d489b688306e26f5309907cd6
|
refs/heads/master
| 2021-01-19T05:27:02.473523 | 2016-06-14T09:27:56 | 2016-06-14T09:27:56 | 61,077,293 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,815 |
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package universalcalculator.Converter;
import org.junit.Test;
import static org.junit.Assert.*;
import universalcalculator.Formula;
/**
*
* @author user
*/
public class ArabicConverterTest {
@Test
public void testConvert() throws Exception {
System.out.println("testConvert");
ArabicConverter arabicConverter = new ArabicConverter();
assertEquals(1000f, arabicConverter.convert("1000"), 0.0001);
assertEquals(999f, arabicConverter.convert("999"), 0.0001);
assertEquals(12.4f, arabicConverter.convert("12.4"), 0.0001);
// TODO review the generated test code and remove the default call to fail.
}
@Test(expected=Exception.class)
public void testDot() throws Exception {
System.out.println("testDot");
ArabicConverter arabicConverter = new ArabicConverter();
arabicConverter.convert(".");
// TODO review the generated test code and remove the default call to fail.
}
@Test(expected=Exception.class)
public void testTwoDots() throws Exception {
System.out.println("TwoDots");
ArabicConverter arabicConverter = new ArabicConverter();
arabicConverter.convert("..");
// TODO review the generated test code and remove the default call to fail.
}
@Test(expected=Exception.class)
public void testDotPlusNumber() throws Exception {
System.out.println("DotPlusNumber");
ArabicConverter arabicConverter = new ArabicConverter();
arabicConverter.convert(".1234");
// TODO review the generated test code and remove the default call to fail.
}
@Test
public void testNegativeNumber() throws Exception {
System.out.println("NegativeNumber");
ArabicConverter arabicConverter = new ArabicConverter();
assertEquals(-1234f, arabicConverter.convert("-1234"), 0.001);
// TODO review the generated test code and remove the default call to fail.
}
@Test
public void testOneDigit() throws Exception {
System.out.println("OneDigit");
ArabicConverter arabicConverter = new ArabicConverter();
assertEquals(1f, arabicConverter.convert("1"), 0.001);
// TODO review the generated test code and remove the default call to fail.
}
@Test
public void testNegativeFloatNumber() throws Exception {
System.out.println("NegativeFloatumber");
ArabicConverter arabicConverter = new ArabicConverter();
assertEquals(-1234.1f, arabicConverter.convert("-1234.1"), 0.001);
// TODO review the generated test code and remove the default call to fail.
}
@Test(expected=Exception.class)
public void testTwoDotsAfterDigit() throws Exception {
System.out.println("TwoDotsAfterDigit");
ArabicConverter arabicConverter = new ArabicConverter();
arabicConverter.convert("1234.0.0");
// TODO review the generated test code and remove the default call to fail.
}
@Test(expected=Exception.class)
public void testDotInEnd() throws Exception {
System.out.println("DotInEnd");
ArabicConverter arabicConverter = new ArabicConverter();
arabicConverter.convert("1234.");
// TODO review the generated test code and remove the default call to fail.
}
@Test(expected=Exception.class)
public void testTwoMinuses() throws Exception {
System.out.println("TwoMinuses");
ArabicConverter arabicConverter = new ArabicConverter();
arabicConverter.convert("--1234");
// TODO review the generated test code and remove the default call to fail.
}
@Test(expected=Exception.class)
public void testTwoMinusesAfterDigit() throws Exception {
System.out.println("TwoMinuses");
ArabicConverter arabicConverter = new ArabicConverter();
arabicConverter.convert("-1-234");
// TODO review the generated test code and remove the default call to fail.
}
@Test
public void testRequareThisConverter() {
System.out.println("testRequareThisConverter");
ArabicConverter arabicConverter = new ArabicConverter();
assertTrue(arabicConverter.isAppropriateConverter("123"));
assertTrue(arabicConverter.isAppropriateConverter("123.1"));
assertTrue(arabicConverter.isAppropriateConverter("123."));
assertTrue(!arabicConverter.isAppropriateConverter("123+"));
assertTrue(!arabicConverter.isAppropriateConverter("123a"));
assertTrue(arabicConverter.isAppropriateConverter("-123"));
}
}
|
[
"[email protected]"
] | |
a561e666c417a34c0ca81c06fdfe6fa8a62235ab
|
f23d73fed49b8eb26a4b3aad22ac6e564848d557
|
/PlayerInterface.java
|
f3c253206f411b41ff5856c78a1e3bcca94e885a
|
[] |
no_license
|
Sohaila-Mohsen/GOFO
|
6f55285d94e38816b388d818a4e1eac1b3aa4d1f
|
7a54ad04a25d7e20e6306db739c1ab58ee477e55
|
refs/heads/main
| 2023-05-02T16:52:40.192395 | 2021-06-12T20:26:32 | 2021-06-12T20:26:32 | 376,372,408 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,679 |
java
|
package gofo;
import java.util.Scanner;
public class PlayerInterface extends DB{
static Scanner input;
static {
input = new Scanner(System.in);
}
public void PlayerMainMenue(Player p)
{
System.out.println("1- My Books \n2- My Requests\n3- Join Team \n4- Book Playground \n5- Sign Out");
int choice = input.nextInt();
switch (choice) {
case 1:
p.displayBooking();
PlayerMainMenue(p);
break;
case 2:
p.displayrequests();
PlayerMainMenue(p);
break;
case 3:
System.out.println("Not Included in implementation part");
PlayerMainMenue(p);
break;
case 4:
if(!playgrounds.isEmpty())
{
displayavailable();
System.out.print("choose one ");
int choic = input.nextInt();
choic=choic-1;
p.sendRequest(playgrounds.get(choic));
}
else
System.out.println("No PlayGrounds in the System yet");
PlayerMainMenue( p);
break;
case 5:
break;
default:
System.out.println("Invalied Choice");
PlayerMainMenue(p);
break;
}
}
public void SignMenue() {
System.out.println("1- sign up\n2- sign in\n3- Back");
int choice = input.nextInt();
if (choice == 1) {
Player p = new Player();
ClickSignUp(p);
}
else if (choice == 2){
System.out.print("Email : ");
String email = input.next();
System.out.print("Password : ");
String pass = input.next();
Player p = clicksignin(email,pass);
if (p!=null)
PlayerMainMenue(p);
else
{
System.out.println("user not found");
SignMenue();
}
}else if (choice == 3){
}
else{
System.out.println("Invalied Choice");
SignMenue();
}
}
public Player clicksignin(String email, String pass){
for (int i = 0; i < players.size(); i++) {
if(players.get(i).getEmail().replaceAll("\\s+","").equalsIgnoreCase( email.replaceAll("\\s+","") )&& players.get(i).getPassword().replaceAll("\\s+","").equalsIgnoreCase( pass.replaceAll("\\s+","") )){
return players.get(i);}
}
return null;
}
public void ClickSignUp(Player p) {
System.out.print("Name : ");
String name = input.next();
System.out.print("National ID : ");
String National_ID = input.next();
System.out.print("Phone : ");
String Phone =input.next();
System.out.print("Location : ");
String Location = input.next();
System.out.print("Email : ");
String Email = input.next();
System.out.print("Password : ");
String Password = input.next() ;
System.out.print("Balance you would like to add to Your E_Wallet : ");
float balance = input.nextFloat();
if(! p.regester(name,National_ID,Phone,Location,Email,Password,balance))
{
System.out.println("User Already Exists");
SignMenue();
}
PlayerMainMenue(p);
}
}
|
[
"[email protected]"
] | |
54a10aa575cfa665b568c93cb9d2bd3258da39e1
|
a9c598eba8c94f2493132cd043a7165d71375768
|
/StaticBlockTest/src/StaticBlockTest.java
|
dbccb832c540693088cda23a0ed6ffd91cd20e76
|
[] |
no_license
|
gaeunPark/Java_fundamental
|
01473268baba1012dbefa3947185f0ba2e5e8b8b
|
f65d133ac41392803fa12573374af7d6f399d839
|
refs/heads/master
| 2020-03-07T08:43:11.129270 | 2018-03-30T06:02:40 | 2018-03-30T06:02:40 | 127,386,567 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 275 |
java
|
public class StaticBlockTest {
static int[] arr = new int[10];
static {
for(int i=0; i<arr.length; i++) {
arr[i]=(int)(Math.random()*10)+1;
}
}
public static void main(String[] args) {
for(int i : arr) {
System.out.println(i);
}
}
}
|
[
"[email protected]"
] | |
c3e650ee364a3fa569a63f627bdd565da9319cfa
|
48304c1ae3f5fa2c235a851979be6e6a77b7e7b8
|
/day14/src/cn/com/mryhl/demo10_hemowork/demo02_stream/Demo01OutputStreamWriter.java
|
dbfea9577387381367a8a1a35f3cf2162af5e143
|
[] |
no_license
|
mr-yhl/javajybc
|
e5647e093765a4d0893f1f34059baa38b8b8bbaa
|
bc22c226b901817d6a535328d8a598871bddf5c0
|
refs/heads/master
| 2023-01-03T18:21:53.509449 | 2020-10-24T03:28:07 | 2020-10-24T03:28:07 | 284,627,147 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 456 |
java
|
package cn.com.mryhl.demo10_hemowork.demo02_stream;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
public class Demo01OutputStreamWriter {
public static void main(String[] args) throws Exception {
OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream("test4_1.txt"), "gbk");
writer.write("我要学好Java,我要月薪过万!!");
writer.flush();
writer.close();
}
}
|
[
"[email protected]"
] | |
1d547531431d7343383a139d49917ce4b8ff12e9
|
fd8d9bb507de41e9ba5a513f11e0f51c789079b9
|
/Code1/problem_sets/ps7/question1/ArrayMethods.java
|
0fce0cc10dccb6ea0c08af796a17b63c6c4b5fac
|
[] |
no_license
|
SiddheshKhedekar/Java-101
|
8f003e6c630ea680b09ba35ee42e093ed8e92725
|
81ad971350181519c50624847ae60034d9b12720
|
refs/heads/master
| 2021-06-16T11:46:20.308036 | 2017-05-30T05:34:28 | 2017-05-30T05:34:28 | 92,801,037 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,408 |
java
|
package ps7.question1;
import java.util.Arrays;
//
// Complete the methods below. These methods manipulate Arrays of Strings
//
// Need help starting this question? In the lesson titled
// "Starting points: Problem Set Questions", go to the
// problem titled "Problem Set 7 - Question 1" for some tips on
// how to begin.
//
public class ArrayMethods
{
String[] list; //instance variable
/**
* Constructor for objects of class ArrayMethods
*/
public ArrayMethods(String[] list)
{
// initialise instance variables
this.list = list;
}
/**
* Determines if the array is sorted (do not sort)
* When Strings are sorted, they are in alphabetical order
* Use the compareTo method to determine which string comes first
* You can look at the String compareTo method in the Java API
* @return true if the array is sorted else false.
*/
public boolean isSorted()
{
boolean sorted = true;
// TODO: Write the code to loop through the array and determine that each
// successive element is larger than the one before it
int i = 1;
while (sorted && i < list.length)
{
if (list[i].compareTo(list[i - 1]) < 0)
{
sorted = false;
}
i ++;
}
return sorted;
}
/**
* Replaces all but the first and last with the larger of its to neighbors
* You can use the compareTo to determine which string is larger (later in alphabetical
* order).
*/
public void replaceWithLargerNeighbor()
{
for (int i = 1; i < list.length - 1; i ++)
{
if (list[i - 1].compareTo(list[i + 1]) > 0)
{
list[i] = list[i - 1];
}
else
{
list[i] = list[i + 1];
}
}
}
/**
* Gets the number of duplicates in the array.
* (Be careful to only count each duplicate once. Start at index 0. Does it match any of the other element?
* Get the next word. It is at index i. Does it match any of the words with index > i?)
* @return the number of duplicate words in the array.
*/
public int countDuplicates()
{
int duplicates = 0;
for (int i = 0; i < list.length - 1; i ++)
{
for (int j = i + 1; j < list.length; j ++)
{
if (list[j].compareTo(list[i]) == 0)
{
duplicates ++;
}
}
}
return duplicates;
}
/**
* Moves any word that starts with x, y, or z to the front of the array, but
* otherwise preserves the order
*/
public void xyzToFront()
{
int insertAt = 0;
for (int i = 0; i < list.length; i ++)
{
if (list[i].startsWith("x") || list[i].startsWith("y") || list[i].startsWith("z"))
{
String cache = list[i];
for (int j = i; j > insertAt; j --)
{
list[j] = list[j - 1];
}
list[insertAt] = cache;
insertAt ++;
}
}
}
/**
* gets the string representation of this array
* @returns the string representation of this array in
* standard collection format
* @return a string representation of the array. (do this with Arrays.toString(list))
*/
public String toString()
{
return Arrays.toString(list);
}
}
|
[
"[email protected]"
] | |
e201f4a8eea8613d895b89fe3812c2f42ab10ca1
|
a5f1da80efdc5ae8dfda2e18af2a1042e2ff9234
|
/src/com/cyb/jndi/Persons.java
|
f510ad5e802904f394370dbddd69ac51073672a0
|
[] |
no_license
|
iechenyb/sina1.0
|
fb2b7b9247c7f6504e10d8301ee581a3b960bac2
|
aac363143e920a418f0cc3a8e3cadcb91cdb3acf
|
refs/heads/master
| 2021-05-23T04:47:39.852726 | 2020-05-15T00:32:27 | 2020-05-15T00:32:27 | 81,402,063 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 623 |
java
|
package com.cyb.jndi;
import java.io.Serializable;
public class Persons implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
String Name = "";
String Age ="" ;
public Persons () {
}
//构造函数,用于给变量赋值
public Persons (String namePara,String age) {
Name = namePara;
Age = age;
}
//用于返回变量Name的值
public String getName() {
return Name;
}
//用于返回变量Age的值
public String getAge () {
return Age;
}
}
|
[
"[email protected]"
] | |
5457fdc7fcf1eb054994c17207dfa0d3231fad19
|
2aee26166e4c4d3182a5948d95ca6046e3e84138
|
/src/main/java/otts/test/work/WebConfiguration.java
|
ebc29368867bf46e4f4784e088742bf612d34cee
|
[] |
no_license
|
eld0727/messages
|
366c0332ecfd34be7ad5615114069615084cd902
|
e287b8944a0ad3e123ede98f55bedb064f07faab
|
refs/heads/master
| 2021-01-13T02:07:16.640138 | 2015-09-08T02:34:39 | 2015-09-08T02:34:39 | 41,954,062 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,114 |
java
|
package otts.test.work;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
/**
* Created by alex on 07.09.2015.<br/>
* Web configuration
*/
@Configuration
public class WebConfiguration extends WebMvcConfigurerAdapter {
@Bean
public ViewResolver viewResolver() {
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
viewResolver.setPrefix("/WEB-INF/view/");
viewResolver.setSuffix(".jsp");
return viewResolver;
}
@Override
public void addResourceHandlers(final ResourceHandlerRegistry registry) {
registry.addResourceHandler("/assets/**")
.addResourceLocations("/WEB-INF/javascript/")
.addResourceLocations("/WEB-INF/styles/");
}
}
|
[
"[email protected]"
] | |
d3fa6a9987d9fbce27fc8250d727543a45071c29
|
183c7622e9aa4b5eb88d802106d3a87de15aae00
|
/Plot Route/app/src/main/java/bit/mike/googlemaps/WeatherRequest.java
|
a0f24473d4c27d599f8f35441755f0749756c395
|
[] |
no_license
|
ml-barnes/weather-tracker
|
52581bc6d869dcaabaa9fb24671093bacf0ba764
|
fd8ca0d67ca570121f6aebc41e6332c015823979
|
refs/heads/master
| 2020-03-29T01:16:23.071627 | 2018-09-19T03:04:32 | 2018-09-19T03:04:32 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,083 |
java
|
package bit.mike.googlemaps;
import android.content.res.Resources;
import android.os.AsyncTask;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.concurrent.TimeUnit;
/**
* Created by Mike on 21/05/2018.
*/
// Inner class that extends async so we can tdo http requests in background
public class WeatherRequest extends AsyncTask<String, Void, String>
{
/**
* Any class creating an instance of this class must implement AsyncResponse
*/
public interface AsyncResponse {
void processFinish(ArrayList<Forecast> forecasts, String error);
}
private static final int MAX_NUMBER_OF_DAYS = 8;
private static final int LAT_INDEX = 0;
private static final int LONG_INDEX = 1;
private static final int OFFSET = 2;
private static final int HOUR_COUNT = 5;
private AsyncResponse delegate;
private Calendar arrivalDate;
private DateFormat dateFormatter;
private Resources resources;
public WeatherRequest(AsyncResponse delegate, Date arrivalDate, DateFormat dateFormatter, Resources resources){
this.delegate = delegate;
this.arrivalDate = Calendar.getInstance();
this.arrivalDate.setTime(arrivalDate);
this.dateFormatter = dateFormatter;
this.resources = resources;
}
//Needs to implement do in background, returns a string
@Override
protected String doInBackground(String... locationInfo)
{
String JSONString;
String lat = locationInfo[LAT_INDEX];
String lng = locationInfo[LONG_INDEX];
String url = resources.getString(R.string.url, lat, lng);
JSONString = HTTPRequest.getJSONString(url, resources);
return JSONString;
}
/**
* When async call is complete
* Use json data to create forecasts based on arrival time
* @param s
*/
@Override
protected void onPostExecute(String s)
{
int arrivalDaysFromNow = getArrivalDaysFromNow();
ArrayList<Forecast> forecasts = null;
String error = null;
if (arrivalDaysFromNow < MAX_NUMBER_OF_DAYS)
{
try
{
JSONArray ja = new JSONObject(s).
getJSONObject(resources.getString(R.string.data)).
getJSONArray(resources.getString(R.string.weather)).
getJSONObject(arrivalDaysFromNow).
getJSONArray(resources.getString(R.string.hourly));
Calendar[] calendars = changeCalendarHours();
JSONObject[] weatherArray = {
ja.getJSONObject(calendars[0].get(Calendar.HOUR_OF_DAY)),
ja.getJSONObject(calendars[1].get(Calendar.HOUR_OF_DAY)),
ja.getJSONObject(calendars[2].get(Calendar.HOUR_OF_DAY)),
ja.getJSONObject(calendars[3].get(Calendar.HOUR_OF_DAY)),
ja.getJSONObject(calendars[4].get(Calendar.HOUR_OF_DAY)),
};
forecasts = new ArrayList<>();
for (int i = 0; i < weatherArray.length; i++)
{
forecasts.add(new Forecast(weatherArray[i], dateFormatter.format(calendars[i].getTime()), resources));
}
}
catch (JSONException e)
{
Log.d(resources.getString(R.string.log_error), e.getMessage());
error = resources.getString(R.string.weather_error);
}
catch (NullPointerException e)
{
Log.d(resources.getString(R.string.log_error), e.getMessage());
error = resources.getString(R.string.network_error);
}
}
else
{
error = resources.getString(R.string.trip_error);
}
delegate.processFinish(forecasts, error);
}
// Creates a calendar array holding different hours to get weather data
private Calendar[] changeCalendarHours()
{
Calendar[] calendars = new Calendar[HOUR_COUNT];
// Creates calendars from 2 before arrival time to 2 after
for (int i = 0; i < calendars.length; i++)
{
calendars[i] = Calendar.getInstance();
calendars[i].setTime(arrivalDate.getTime());
calendars[i].set(Calendar.HOUR_OF_DAY, arrivalDate.get(Calendar.HOUR_OF_DAY)+(i-OFFSET));
}
return calendars;
}
private int getArrivalDaysFromNow()
{
// Create calendar for today
Calendar currentDate = Calendar.getInstance();
currentDate.get(Calendar.DAY_OF_MONTH);
//Convert to millis
long end = currentDate.getTimeInMillis();
long start = arrivalDate.getTimeInMillis();
// Get days between both calendars
return (int) TimeUnit.MILLISECONDS.toDays(Math.abs(end - start));
}
}
|
[
"[email protected]"
] | |
67d6a8349a7b69960868ffdc9b10e8163da71c6b
|
a2440dbe95b034784aa940ddc0ee0faae7869e76
|
/modules/lwjgl/vulkan/src/generated/java/org/lwjgl/vulkan/VkDeviceGroupDeviceCreateInfoKHR.java
|
1c632818e91a71e21216e6a9d32f84ba0d13c6f8
|
[
"LicenseRef-scancode-khronos",
"LGPL-2.0-or-later",
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
LWJGL/lwjgl3
|
8972338303520c5880d4a705ddeef60472a3d8e5
|
67b64ad33bdeece7c09b0f533effffb278c3ecf7
|
refs/heads/master
| 2023-08-26T16:21:38.090410 | 2023-08-26T16:05:52 | 2023-08-26T16:05:52 | 7,296,244 | 4,835 | 1,004 |
BSD-3-Clause
| 2023-09-10T12:03:24 | 2012-12-23T15:40:04 |
Java
|
UTF-8
|
Java
| false | false | 13,017 |
java
|
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.vulkan;
import javax.annotation.*;
import java.nio.*;
import org.lwjgl.*;
import org.lwjgl.system.*;
import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.MemoryUtil.*;
import static org.lwjgl.system.MemoryStack.*;
/**
* See {@link VkDeviceGroupDeviceCreateInfo}.
*
* <h3>Layout</h3>
*
* <pre><code>
* struct VkDeviceGroupDeviceCreateInfoKHR {
* VkStructureType sType;
* void const * pNext;
* uint32_t physicalDeviceCount;
* VkPhysicalDevice const * pPhysicalDevices;
* }</code></pre>
*/
public class VkDeviceGroupDeviceCreateInfoKHR extends VkDeviceGroupDeviceCreateInfo {
protected VkDeviceGroupDeviceCreateInfoKHR(long address, @Nullable ByteBuffer container) {
super(address, container);
}
@Override
protected VkDeviceGroupDeviceCreateInfoKHR create(long address, @Nullable ByteBuffer container) {
return new VkDeviceGroupDeviceCreateInfoKHR(address, container);
}
/**
* Creates a {@code VkDeviceGroupDeviceCreateInfoKHR} instance at the current position of the specified {@link ByteBuffer} container. Changes to the buffer's content will be
* visible to the struct instance and vice versa.
*
* <p>The created instance holds a strong reference to the container object.</p>
*/
public VkDeviceGroupDeviceCreateInfoKHR(ByteBuffer container) {
super(container);
}
/** Sets the specified value to the {@code sType} field. */
@Override
public VkDeviceGroupDeviceCreateInfoKHR sType(@NativeType("VkStructureType") int value) { nsType(address(), value); return this; }
/** Sets the {@link VK11#VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO} value to the {@code sType} field. */
@Override
public VkDeviceGroupDeviceCreateInfoKHR sType$Default() { return sType(VK11.VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO); }
/** Sets the specified value to the {@code pNext} field. */
@Override
public VkDeviceGroupDeviceCreateInfoKHR pNext(@NativeType("void const *") long value) { npNext(address(), value); return this; }
/** Sets the address of the specified {@link PointerBuffer} to the {@code pPhysicalDevices} field. */
@Override
public VkDeviceGroupDeviceCreateInfoKHR pPhysicalDevices(@Nullable @NativeType("VkPhysicalDevice const *") PointerBuffer value) { npPhysicalDevices(address(), value); return this; }
/** Initializes this struct with the specified values. */
@Override
public VkDeviceGroupDeviceCreateInfoKHR set(
int sType,
long pNext,
@Nullable PointerBuffer pPhysicalDevices
) {
sType(sType);
pNext(pNext);
pPhysicalDevices(pPhysicalDevices);
return this;
}
/**
* Copies the specified struct data to this struct.
*
* @param src the source struct
*
* @return this struct
*/
public VkDeviceGroupDeviceCreateInfoKHR set(VkDeviceGroupDeviceCreateInfoKHR src) {
memCopy(src.address(), address(), SIZEOF);
return this;
}
// -----------------------------------
/** Returns a new {@code VkDeviceGroupDeviceCreateInfoKHR} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed. */
public static VkDeviceGroupDeviceCreateInfoKHR malloc() {
return new VkDeviceGroupDeviceCreateInfoKHR(nmemAllocChecked(SIZEOF), null);
}
/** Returns a new {@code VkDeviceGroupDeviceCreateInfoKHR} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed. */
public static VkDeviceGroupDeviceCreateInfoKHR calloc() {
return new VkDeviceGroupDeviceCreateInfoKHR(nmemCallocChecked(1, SIZEOF), null);
}
/** Returns a new {@code VkDeviceGroupDeviceCreateInfoKHR} instance allocated with {@link BufferUtils}. */
public static VkDeviceGroupDeviceCreateInfoKHR create() {
ByteBuffer container = BufferUtils.createByteBuffer(SIZEOF);
return new VkDeviceGroupDeviceCreateInfoKHR(memAddress(container), container);
}
/** Returns a new {@code VkDeviceGroupDeviceCreateInfoKHR} instance for the specified memory address. */
public static VkDeviceGroupDeviceCreateInfoKHR create(long address) {
return new VkDeviceGroupDeviceCreateInfoKHR(address, null);
}
/** Like {@link #create(long) create}, but returns {@code null} if {@code address} is {@code NULL}. */
@Nullable
public static VkDeviceGroupDeviceCreateInfoKHR createSafe(long address) {
return address == NULL ? null : new VkDeviceGroupDeviceCreateInfoKHR(address, null);
}
/**
* Returns a new {@link VkDeviceGroupDeviceCreateInfoKHR.Buffer} instance allocated with {@link MemoryUtil#memAlloc memAlloc}. The instance must be explicitly freed.
*
* @param capacity the buffer capacity
*/
public static VkDeviceGroupDeviceCreateInfoKHR.Buffer malloc(int capacity) {
return new Buffer(nmemAllocChecked(__checkMalloc(capacity, SIZEOF)), capacity);
}
/**
* Returns a new {@link VkDeviceGroupDeviceCreateInfoKHR.Buffer} instance allocated with {@link MemoryUtil#memCalloc memCalloc}. The instance must be explicitly freed.
*
* @param capacity the buffer capacity
*/
public static VkDeviceGroupDeviceCreateInfoKHR.Buffer calloc(int capacity) {
return new Buffer(nmemCallocChecked(capacity, SIZEOF), capacity);
}
/**
* Returns a new {@link VkDeviceGroupDeviceCreateInfoKHR.Buffer} instance allocated with {@link BufferUtils}.
*
* @param capacity the buffer capacity
*/
public static VkDeviceGroupDeviceCreateInfoKHR.Buffer create(int capacity) {
ByteBuffer container = __create(capacity, SIZEOF);
return new Buffer(memAddress(container), container, -1, 0, capacity, capacity);
}
/**
* Create a {@link VkDeviceGroupDeviceCreateInfoKHR.Buffer} instance at the specified memory.
*
* @param address the memory address
* @param capacity the buffer capacity
*/
public static VkDeviceGroupDeviceCreateInfoKHR.Buffer create(long address, int capacity) {
return new Buffer(address, capacity);
}
/** Like {@link #create(long, int) create}, but returns {@code null} if {@code address} is {@code NULL}. */
@Nullable
public static VkDeviceGroupDeviceCreateInfoKHR.Buffer createSafe(long address, int capacity) {
return address == NULL ? null : new Buffer(address, capacity);
}
// -----------------------------------
/** Deprecated for removal in 3.4.0. Use {@link #malloc(MemoryStack)} instead. */
@Deprecated public static VkDeviceGroupDeviceCreateInfoKHR mallocStack() { return malloc(stackGet()); }
/** Deprecated for removal in 3.4.0. Use {@link #calloc(MemoryStack)} instead. */
@Deprecated public static VkDeviceGroupDeviceCreateInfoKHR callocStack() { return calloc(stackGet()); }
/** Deprecated for removal in 3.4.0. Use {@link #malloc(MemoryStack)} instead. */
@Deprecated public static VkDeviceGroupDeviceCreateInfoKHR mallocStack(MemoryStack stack) { return malloc(stack); }
/** Deprecated for removal in 3.4.0. Use {@link #calloc(MemoryStack)} instead. */
@Deprecated public static VkDeviceGroupDeviceCreateInfoKHR callocStack(MemoryStack stack) { return calloc(stack); }
/** Deprecated for removal in 3.4.0. Use {@link #malloc(int, MemoryStack)} instead. */
@Deprecated public static VkDeviceGroupDeviceCreateInfoKHR.Buffer mallocStack(int capacity) { return malloc(capacity, stackGet()); }
/** Deprecated for removal in 3.4.0. Use {@link #calloc(int, MemoryStack)} instead. */
@Deprecated public static VkDeviceGroupDeviceCreateInfoKHR.Buffer callocStack(int capacity) { return calloc(capacity, stackGet()); }
/** Deprecated for removal in 3.4.0. Use {@link #malloc(int, MemoryStack)} instead. */
@Deprecated public static VkDeviceGroupDeviceCreateInfoKHR.Buffer mallocStack(int capacity, MemoryStack stack) { return malloc(capacity, stack); }
/** Deprecated for removal in 3.4.0. Use {@link #calloc(int, MemoryStack)} instead. */
@Deprecated public static VkDeviceGroupDeviceCreateInfoKHR.Buffer callocStack(int capacity, MemoryStack stack) { return calloc(capacity, stack); }
/**
* Returns a new {@code VkDeviceGroupDeviceCreateInfoKHR} instance allocated on the specified {@link MemoryStack}.
*
* @param stack the stack from which to allocate
*/
public static VkDeviceGroupDeviceCreateInfoKHR malloc(MemoryStack stack) {
return new VkDeviceGroupDeviceCreateInfoKHR(stack.nmalloc(ALIGNOF, SIZEOF), null);
}
/**
* Returns a new {@code VkDeviceGroupDeviceCreateInfoKHR} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
*
* @param stack the stack from which to allocate
*/
public static VkDeviceGroupDeviceCreateInfoKHR calloc(MemoryStack stack) {
return new VkDeviceGroupDeviceCreateInfoKHR(stack.ncalloc(ALIGNOF, 1, SIZEOF), null);
}
/**
* Returns a new {@link VkDeviceGroupDeviceCreateInfoKHR.Buffer} instance allocated on the specified {@link MemoryStack}.
*
* @param stack the stack from which to allocate
* @param capacity the buffer capacity
*/
public static VkDeviceGroupDeviceCreateInfoKHR.Buffer malloc(int capacity, MemoryStack stack) {
return new Buffer(stack.nmalloc(ALIGNOF, capacity * SIZEOF), capacity);
}
/**
* Returns a new {@link VkDeviceGroupDeviceCreateInfoKHR.Buffer} instance allocated on the specified {@link MemoryStack} and initializes all its bits to zero.
*
* @param stack the stack from which to allocate
* @param capacity the buffer capacity
*/
public static VkDeviceGroupDeviceCreateInfoKHR.Buffer calloc(int capacity, MemoryStack stack) {
return new Buffer(stack.ncalloc(ALIGNOF, capacity, SIZEOF), capacity);
}
// -----------------------------------
/** An array of {@link VkDeviceGroupDeviceCreateInfoKHR} structs. */
public static class Buffer extends VkDeviceGroupDeviceCreateInfo.Buffer {
private static final VkDeviceGroupDeviceCreateInfoKHR ELEMENT_FACTORY = VkDeviceGroupDeviceCreateInfoKHR.create(-1L);
/**
* Creates a new {@code VkDeviceGroupDeviceCreateInfoKHR.Buffer} instance backed by the specified container.
*
* <p>Changes to the container's content will be visible to the struct buffer instance and vice versa. The two buffers' position, limit, and mark values
* will be independent. The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided
* by {@link VkDeviceGroupDeviceCreateInfoKHR#SIZEOF}, and its mark will be undefined.</p>
*
* <p>The created buffer instance holds a strong reference to the container object.</p>
*/
public Buffer(ByteBuffer container) {
super(container);
}
public Buffer(long address, int cap) {
super(address, null, -1, 0, cap, cap);
}
Buffer(long address, @Nullable ByteBuffer container, int mark, int pos, int lim, int cap) {
super(address, container, mark, pos, lim, cap);
}
@Override
protected Buffer self() {
return this;
}
@Override
protected VkDeviceGroupDeviceCreateInfoKHR getElementFactory() {
return ELEMENT_FACTORY;
}
/** Sets the specified value to the {@code sType} field. */
@Override
public VkDeviceGroupDeviceCreateInfoKHR.Buffer sType(@NativeType("VkStructureType") int value) { VkDeviceGroupDeviceCreateInfoKHR.nsType(address(), value); return this; }
/** Sets the {@link VK11#VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO} value to the {@code sType} field. */
@Override
public VkDeviceGroupDeviceCreateInfoKHR.Buffer sType$Default() { return sType(VK11.VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO); }
/** Sets the specified value to the {@code pNext} field. */
@Override
public VkDeviceGroupDeviceCreateInfoKHR.Buffer pNext(@NativeType("void const *") long value) { VkDeviceGroupDeviceCreateInfoKHR.npNext(address(), value); return this; }
/** Sets the address of the specified {@link PointerBuffer} to the {@code pPhysicalDevices} field. */
@Override
public VkDeviceGroupDeviceCreateInfoKHR.Buffer pPhysicalDevices(@Nullable @NativeType("VkPhysicalDevice const *") PointerBuffer value) { VkDeviceGroupDeviceCreateInfoKHR.npPhysicalDevices(address(), value); return this; }
}
}
|
[
"[email protected]"
] | |
2067ac6f9123dab56d9e77a3b1b624a3fb402341
|
fe625f48aea5074e4cbc2b1f14d783c44a710417
|
/src/aula7/Prime.java
|
73df032ea1488e9449b94262411cf787336f0546
|
[] |
no_license
|
galemos/CursoJavaUnifesp
|
77041bac0223fff89733ef40e28fc2e90b5ba6d8
|
208ff6810e86777d872d4e39a4d1c16f722f5a12
|
refs/heads/master
| 2020-03-30T14:30:35.224862 | 2018-10-09T21:43:02 | 2018-10-09T21:43:02 | 151,321,128 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 301 |
java
|
package aula7;
public class Prime {
private boolean isPrime(long value) {
for(int i = 2; i<(value/2); i++) {
if(value%i == 0) {
return false;
}
}
return true;
}
public String msgPrime(long value) {
if(isPrime(value)) {
return "eh primo";
}
return "nao eh primo";
}
}
|
[
"[email protected]"
] | |
f371339b22d4fc399630844966ae89556fe322d2
|
f485ba5d778dddc8fd4578ffa9a5dfc83eeb164f
|
/app/src/main/java/com/aaron/runtracker/activities/SingleFragmentActivity.java
|
9f3acdf37c0b059d4d49af5f725819d768be47fe
|
[
"Apache-2.0"
] |
permissive
|
AaronChanSunny/RunTracker
|
043f41c9ff49f8c364c9de5e5851b85339a37b18
|
03c7382069457033fa009187e18f5cdba5f9e471
|
refs/heads/master
| 2021-01-19T11:15:44.967443 | 2015-07-08T09:39:04 | 2015-07-08T09:39:04 | 38,726,689 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 875 |
java
|
package com.aaron.runtracker.activities;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v7.app.AppCompatActivity;
import com.aaron.runtracker.R;
/**
* Created by Aaron on 15/7/3.
*/
public abstract class SingleFragmentActivity extends AppCompatActivity {
protected abstract Fragment createFragment();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_single_fragment);
FragmentManager fm = getSupportFragmentManager();
Fragment fragment = fm.findFragmentById(R.id.container);
if (fragment == null) {
fm.beginTransaction()
.add(R.id.container, createFragment())
.commit();
}
}
}
|
[
"[email protected]"
] | |
531a64e8986067b87030231aef9c3e4f921aaa8c
|
285127619284cf04c6e8cbd6484dbbb87d699823
|
/plugin/src/main/java/git4idea/changes/GitCommittedChangeList.java
|
2ccb1b3db0fc5fbd379ef4f980f91f11240ab8f7
|
[
"Apache-2.0"
] |
permissive
|
consulo/consulo-git
|
c1bc36d8ef053aaed34d991b73e23eafe864bba5
|
39835384bc64a00baadd8a301aa18abd1e051e21
|
refs/heads/master
| 2023-08-18T23:20:48.918195 | 2023-06-14T06:59:28 | 2023-06-14T06:59:28 | 13,809,557 | 0 | 0 | null | 2015-02-20T22:22:44 | 2013-10-23T17:25:01 |
Java
|
UTF-8
|
Java
| false | false | 2,342 |
java
|
/*
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package git4idea.changes;
import consulo.versionControlSystem.AbstractVcs;
import consulo.versionControlSystem.change.Change;
import consulo.versionControlSystem.versionBrowser.CommittedChangeListForRevision;
import git4idea.GitRevisionNumber;
import git4idea.GitVcs;
import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.Date;
public class GitCommittedChangeList extends CommittedChangeListForRevision
{
private final boolean myModifiable;
private final AbstractVcs myVcs;
@SuppressWarnings("unused") // used externally
@Deprecated
public GitCommittedChangeList(@Nonnull String name,
@Nonnull String comment,
@Nonnull String committerName,
@Nonnull GitRevisionNumber revisionNumber,
@Nonnull Date commitDate,
@Nonnull Collection<Change> changes,
boolean isModifiable)
{
super(name, comment, committerName, commitDate, changes, revisionNumber);
myVcs = null;
myModifiable = isModifiable;
}
public GitCommittedChangeList(@Nonnull String name,
@Nonnull String comment,
@Nonnull String committerName,
@Nonnull GitRevisionNumber revisionNumber,
@Nonnull Date commitDate,
@Nonnull Collection<Change> changes,
@Nonnull GitVcs vcs,
boolean isModifiable)
{
super(name, comment, committerName, commitDate, changes, revisionNumber);
myVcs = vcs;
myModifiable = isModifiable;
}
@Override
public boolean isModifiable()
{
return myModifiable;
}
@Override
public long getNumber()
{
return GitChangeUtils.longForSHAHash(getRevisionNumber().asString());
}
@Override
@Nonnull
public GitRevisionNumber getRevisionNumber()
{
return (GitRevisionNumber) super.getRevisionNumber();
}
@Override
public AbstractVcs getVcs()
{
return myVcs;
}
}
|
[
"[email protected]"
] | |
e6bd77212fb0bae04b90ce58962afae4a3adec74
|
e03f037606c3d4b335d902c45b0c9cdf9848c509
|
/RestExamples/AirtelServiceProvider/src/com/toml/airtel/service/MobileNameProvider.java
|
e6f1f39fd469a43e9906bc437f76ede397facc7f
|
[] |
no_license
|
ghoshkumararun/Rest_Examples
|
bc10957d0ce5c37962286de985576af6b3042889
|
927fe83c93ae49f10f483dcefa00fa1e29922d55
|
refs/heads/master
| 2021-07-01T08:12:24.113901 | 2017-09-21T04:04:17 | 2017-09-21T04:04:17 | 104,299,904 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 184 |
java
|
package com.toml.airtel.service;
import javax.ws.rs.core.Response;
public interface MobileNameProvider {
public Response getCustomerName(String operatorname,String mobileNumber);
}
|
[
"[email protected]"
] | |
b1ae2f4bf4df540f2e0bdc2a83bb0f1861e57137
|
d8c7c1f5a2b905b965ba7320be9b3ad3474c51f7
|
/kademlia-adapter/src/test/java/KademliaAdapterTest.java
|
e97147567b579b4391a9ee571a68fd081132dfae
|
[] |
no_license
|
henribouvet/Hermes
|
4696a5132a08cbe54bc16749106bc74df959283c
|
6a4eaf03bc0fb4bce5412f25d3af40526cba742c
|
refs/heads/master
| 2022-05-26T19:07:58.524392 | 2019-05-27T13:49:03 | 2019-05-27T13:49:03 | 167,522,256 | 1 | 2 | null | 2020-10-13T13:08:13 | 2019-01-25T09:34:12 |
Java
|
UTF-8
|
Java
| false | false | 1,726 |
java
|
import fr.univnantes.hermes.api.DHT;
import fr.univnantes.hermes.api.DHTService;
import fr.univnantes.hermes.api.api.Key20;
import fr.univnantes.hermes.kademlia.KademliaService;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.function.Executable;
import java.io.IOException;
import java.io.Serializable;
class KademliaAdapterTest {
private DHT<Serializable, Serializable> dht;
private DHTService service;
private Key20 k1, k2;
@BeforeEach
void setup() throws IOException {
service = new KademliaService();
dht = service.createDHT();
k1 = new Key20();
k2 = new Key20();
}
@AfterEach
void shutdown(){
service.shutDownServer();
}
// Just to test if the Key20 is accepted as a key in Kademlia
@Test
void TestKey20() throws IOException {
Key20 key = new Key20();
dht.store(key.getString(),"Hey");
}
@Test
void TestStoreRetrieve() throws IOException, NoSuchFieldException {
dht.store(k1.getString(),"Hey");
assertEquals("Hey", dht.retrieve(k1.getString()));
dht.store(k2.getString(),"Brother");
assertEquals("Hey", dht.retrieve(k1.getString()));
assertEquals("Brother", dht.retrieve(k2.getString()));
}
@Test
void TestRemove() throws IOException, NoSuchFieldException {
dht.store(k1.getString(),"Hey");
assertEquals("Hey", dht.retrieve(k1.getString()));
dht.remove(k1.getString());
assertThrows(NoSuchFieldException.class, () -> dht.retrieve(k1.getString()));
}
}
|
[
"[email protected]"
] | |
35dfe502b1781c470c28729e11041585f3ca5d63
|
07638f6016561f0df170457f7401acd3387b3494
|
/src/main/java/frc/robot/subsystems/DriveTrainSystem.java
|
e850110d764e4de67b2b326b6497130456308449
|
[] |
no_license
|
prhiggins/FRC_2020_Command
|
9ac923acf1ce4b83a4839aee9bfcc8a15974ae05
|
7e2107c4e1490b8bb8dd729ae06d74a7daadf111
|
refs/heads/main
| 2023-03-29T23:03:38.314015 | 2021-03-30T20:37:43 | 2021-03-30T20:37:43 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 14,205 |
java
|
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package frc.robot.subsystems;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Map;
import java.util.Random;
import com.revrobotics.CANSparkMax;
import com.revrobotics.CANSparkMax.IdleMode;
import com.revrobotics.CANSparkMaxLowLevel.MotorType;
import edu.wpi.first.wpilibj.Encoder;
import edu.wpi.first.wpilibj.SlewRateLimiter;
import edu.wpi.first.wpilibj.SpeedControllerGroup;
import edu.wpi.first.wpilibj.drive.DifferentialDrive;
import edu.wpi.first.wpilibj.geometry.Pose2d;
import edu.wpi.first.wpilibj.geometry.Rotation2d;
import edu.wpi.first.wpilibj.geometry.Translation2d;
import edu.wpi.first.wpilibj.kinematics.DifferentialDriveOdometry;
import edu.wpi.first.wpilibj.kinematics.DifferentialDriveWheelSpeeds;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.Constants;
import frc.robot.RobotMap;
import frc.robot.hardware.sensors.NavX;
import frc.robot.shuffleboard.WaypointData;
public class DriveTrainSystem extends SubsystemBase {
// Drive train speed controller variables
private SpeedControllerGroup leftSide;
private SpeedControllerGroup rightSide;
private boolean recordMotorInputs = false;
// Local instance of the Differential Drive class
private DifferentialDrive diffDrive;
private final NavX navX = NavX.get();
private final DifferentialDriveOdometry m_odometry;
// Create variables for the through bore encoders on either side of the drive
// train
private Encoder leftSideEncoder;
private Encoder rightSideEncoder;
// Individual Left Side Motors
private CANSparkMax LeftFrontMotor;
private CANSparkMax LeftMiddleMotor;
private CANSparkMax LeftBackMotor;
private CANSparkMax[] leftMotorsArray;
// Individual Right Side Motors
private CANSparkMax RightFrontMotor;
private CANSparkMax RightMiddleMotor;
private CANSparkMax RightBackMotor;
private CANSparkMax[] rightMotorsArray;
private FileWriter driveTrainWriter;
// Allows the driver to ramp the drivetrain up to 1.2 duty cycle in one second
SlewRateLimiter driveRamp = new SlewRateLimiter(1.2);
/** Creates a new DriveTrainSystem. */
public DriveTrainSystem() {
// Constructs the motors and adds them to speed controller groups
createMotors();
// Constructs the encoders and then resets them
createEncoders();
m_odometry = new DifferentialDriveOdometry(getHeading());
resetOdometry(new Pose2d(new Translation2d(), Rotation2d.fromDegrees(0)));
setBrakeMode(IdleMode.kBrake);
// Create a file to write the current motor powers to
try {
// Delete the file and create a new one
new File("/home/lvuser/DriveTrainOut.csv").delete();
driveTrainWriter = new FileWriter("/home/lvuser/DriveTrainOut.csv");
driveTrainWriter.write("Left Power,Right Power");
} catch (IOException e) {
System.out.println("Failed to write to Motor output");
e.printStackTrace();
}
}
@Override
public void periodic() {
// Update the odometry information each loop
m_odometry.update(getHeading(), getLeftEncoderDistance(), getRightEncoderDistance());
// Update the information displayed on the user dashboard
updateDashboard();
// If We are trying to record the current powers write them to the file
try {
if (recordMotorInputs) {
driveTrainWriter.write(getLeftSidePower() + ",");
driveTrainWriter.write(getRightSidePower() + "\n");
}
} catch (IOException exception) {
exception.printStackTrace();
}
}
private void updateDashboard() {
// AdriveTrainWriterdd both encoders to the dashboard to keep track of speed and
// position
SmartDashboard.putData("Left-Side-Encoder", getLeftEncoder());
SmartDashboard.putData("Right-Side-Encoder", getRightEncoder());
// Gyro information
SmartDashboard.putData("Gyro", navX.getAhrs());
// Average drive train motor temperatures
SmartDashboard.putNumber("Left-Side-Temperature", getAverageLeftSideTemperature());
SmartDashboard.putNumber("Right-Side-Temperature", getAverageRightSideTemperature());
// Average drive train current draw
SmartDashboard.putNumber("Right-Side-Current-Draw", getAverageRightSideCurrents());
SmartDashboard.putNumber("Left-Side-Current-Draw", getAverageLeftSideCurrents());
SmartDashboard.putNumber("Odometry-X", getPose().getX());
SmartDashboard.putNumber("Odometry-Y", getPose().getY());
// Add the continuous navX heading as well as the shaved down heading that is
// supplied to the RAMSETE Controller to the dashboard
SmartDashboard.putNumber("NavX-Continuous", navX.getAngle());
SmartDashboard.putNumber("NavX-RAMSETE", getHeading().getDegrees());
}
/**
* Get the robots current field pose
*
* @return pose information about the robot
*/
public Pose2d getPose() {
return m_odometry.getPoseMeters();
}
/**
* Get the wheel speeds of the differential drive train
*
* @return wheel speeds in m/s
*/
public DifferentialDriveWheelSpeeds getWheelSpeeds() {
return new DifferentialDriveWheelSpeeds(getLeftRate(), getRightRate());
}
/**
* Command the robots drive train using voltage as opposed to duty cycle
*
* @param leftVolts voltage to supply to the left side of the drive train
* @param rightVolts voltage to supply to the right side of the drive train
*/
public void tankDriveVolts(double leftVolts, double rightVolts) {
leftSide.setVoltage(leftVolts);
rightSide.setVoltage(-rightVolts);
diffDrive.feed();
}
/**
* Get the average distance of the two encoders
*
* @return the average of the two encoder readings
*/
public double getAverageEncoderDistance() {
return (getLeftEncoderDistance() + getRightEncoderDistance()) / 2.0;
}
/**
* Resets the odometry to the specified pose.
*
* @param pose The pose to which to set the odometry.
*/
public void resetOdometry(Pose2d pose) {
resetEncoders();
m_odometry.resetPosition(pose, getHeading());
}
/**
* Set the brake mode of all the motors on the bot
*/
public void setBrakeMode(IdleMode mode) {
for (int i = 0; i < leftMotorsArray.length; i++) {
leftMotorsArray[i].setIdleMode(mode);
rightMotorsArray[i].setIdleMode(mode);
}
}
/**
* Intermediate used to construct the motors
*/
private void createMotors() {
// Create the individual motors for the left side to add to the
// SpeedControllerGroup
LeftFrontMotor = new CANSparkMax(RobotMap.LeftFrontMotor, MotorType.kBrushless);
LeftMiddleMotor = new CANSparkMax(RobotMap.LeftMiddleMotor, MotorType.kBrushless);
LeftBackMotor = new CANSparkMax(RobotMap.LeftBackMotor, MotorType.kBrushless);
// Create and add motors to the Left side motor container
leftMotorsArray = new CANSparkMax[3];
leftMotorsArray[0] = LeftFrontMotor;
leftMotorsArray[1] = LeftMiddleMotor;
leftMotorsArray[2] = LeftBackMotor;
// Create the individual motors for the right side to add to the
// SpeedControllerGroup
RightFrontMotor = new CANSparkMax(RobotMap.RightFrontMotor, MotorType.kBrushless);
RightMiddleMotor = new CANSparkMax(RobotMap.RightMiddleMotor, MotorType.kBrushless);
RightBackMotor = new CANSparkMax(RobotMap.RightBackMotor, MotorType.kBrushless);
// Create an array to hold the right side motors
rightMotorsArray = new CANSparkMax[3];
rightMotorsArray[0] = RightFrontMotor;
rightMotorsArray[1] = RightMiddleMotor;
rightMotorsArray[2] = RightBackMotor;
// SpeedControllerGroups that hold all meaningful
leftSide = new SpeedControllerGroup(LeftFrontMotor, LeftMiddleMotor, LeftBackMotor);
rightSide = new SpeedControllerGroup(RightFrontMotor, RightMiddleMotor, RightBackMotor);
// Diff drive
diffDrive = new DifferentialDrive(leftSide, rightSide);
diffDrive.setSafetyEnabled(false);
setBrakeMode(IdleMode.kBrake);
}
/**
* Constructs the required drive train encoders
*/
private void createEncoders() {
// Create the encoders
leftSideEncoder = new Encoder(RobotMap.LeftSideEncoderA, RobotMap.LeftSideEncoderB);
rightSideEncoder = new Encoder(RobotMap.RightSideEncoderA, RobotMap.RightSideEncoderB);
// Flip Encoder values
leftSideEncoder.setReverseDirection(true);
// Convert the pulses into usable distances
leftSideEncoder.setDistancePerPulse(Constants.kEncoderDistancePerPulse);
rightSideEncoder.setDistancePerPulse(Constants.kEncoderDistancePerPulse);
resetEncoders();
}
public void resetNavX() {
navX.reset();
navX.resetYaw();
}
/**
* Wrapper for the differential drive arcade drive
*
* @param drivePower power to supply to the drive train to move
* forward/backwards
* @param turnPower power to supply to the drive train to rotate the
* robot
* @param enableRateLimiters enables the rate limiter on the drive for smoother
* acceleration and less jerk
*/
public void arcadeDrive(double drivePower, double turnPower, boolean enableRateLimiters) {
if (enableRateLimiters)
diffDrive.arcadeDrive(driveRamp.calculate(drivePower), turnPower);
else
diffDrive.arcadeDrive(drivePower, turnPower);
}
/**
* Get the encoder values of the left side converted to meters
*
* @return distance driven
*/
public double getLeftEncoderDistance() {
return leftSideEncoder.getDistance();
}
/**
* Get the encoder values of the right side converted to meters
*
* @return distance driven
*/
public double getRightEncoderDistance() {
return rightSideEncoder.getDistance();
}
/**
* Get the rate of the left side encoders
*
* @return rate in m/s
*/
public double getLeftRate() {
return leftSideEncoder.getRate();
}
/**
* Get the rate of the right side encoders
*
* @return rate in m/s
*/
public double getRightRate() {
return rightSideEncoder.getRate();
}
/**
* Wrapper for the tank drive method in the diff drive class
*/
public void tankDrive(double leftPower, double rightPower) {
diffDrive.tankDrive(leftPower, rightPower);
}
/**
* Get the left-side's speed controller group
*
* @return leftSide
*/
public SpeedControllerGroup getLeftSide() {
return leftSide;
}
/**
* Get the right-side's speed controller group
*
* @return rightSide
*/
public SpeedControllerGroup getRightSide() {
return rightSide;
}
/**
* Reset both sides encoders
*/
public void resetEncoders() {
rightSideEncoder.reset();
leftSideEncoder.reset();
}
/**
* Get a reference to the left encoder object
*
* @return the left encoder object
*/
public Encoder getLeftEncoder() {
return leftSideEncoder;
}
/**
* Get a reference to the right encoder object
*
* @return the right encoder object
*/
public Encoder getRightEncoder() {
return rightSideEncoder;
}
/**
* Sets the max output of the drive. Useful for scaling the drive to drive more
* slowly.
*
* @param maxOutput the maximum output to which the drive will be constrained
*/
public void setMaxOutput(double maxOutput) {
diffDrive.setMaxOutput(maxOutput);
}
/**
* Zeroes the heading of the robot.
*/
public void zeroHeading() {
navX.reset();
}
/**
* Returns the heading of the robot.
*
* @return the robot's heading in degrees, from -180 to 180
*/
public Rotation2d getHeading() {
return Rotation2d.fromDegrees(Math.IEEEremainder(navX.getAngle(), 360) * (Constants.kGyroReversed ? -1.0 : 1.0));
}
/**
* Returns the turn rate of the robot.
*
* @return The turn rate of the robot, in degrees per second
*/
public double getTurnRate() {
return -navX.getRate();
}
/**
* Retrieve the average temperature of the left side of the drive train
*
* @return current motor temp. average
*/
public double getAverageLeftSideTemperature() {
double sum = 0;
for (CANSparkMax motor : leftMotorsArray) {
sum += motor.getMotorTemperature();
}
return (sum / leftMotorsArray.length);
}
/**
* Retrieve the average temperature of the right side of the drive train
*
* @return current motor temp. average
*/
public double getAverageRightSideTemperature() {
double sum = 0;
for (CANSparkMax motor : rightMotorsArray) {
sum += motor.getMotorTemperature();
}
return (sum / rightMotorsArray.length);
}
/**
* Retrieve the average amperage of the left side of the drive train
*
* @return current motor amp draw
*/
public double getAverageLeftSideCurrents() {
double sum = 0;
for (CANSparkMax motor : leftMotorsArray) {
sum += motor.getOutputCurrent();
}
return (sum / leftMotorsArray.length);
}
/**
* Retrieve the average amperage of the right side of the drive train
*
* @return current motor amp draw average
*/
public double getAverageRightSideCurrents() {
double sum = 0;
for (CANSparkMax motor : rightMotorsArray) {
sum += motor.getOutputCurrent();
}
return (sum / rightMotorsArray.length);
}
/**
* Toggle wether or not we should be recording motor inputs
*/
public void toggleRecording() {
recordMotorInputs = !recordMotorInputs;
}
/**
* The current duty cycle supplied to the left side of the drive train
*
* @return current power
*/
public double getLeftSidePower() {
return getLeftSide().get();
}
/**
* The current duty cycle supplied to the right side of the drive train
*
* @return current power
*/
public double getRightSidePower() {
return getRightSide().get();
}
}
|
[
"[email protected]"
] | |
30d0739890d914449f3370626a5b7621e65d925c
|
0bdc8dad646bd874e285be4b5ee29609abf1fce5
|
/clustream-common/src/main/java/net/melissam/powerlog/clustering/FeatureVector.java
|
ae088bbcbc06f1e43d73e44a788c00b0890b4016
|
[] |
no_license
|
MelissaMifsud/powerlog
|
4256245500cfbf7f830702e539f3325f0cffce38
|
e89354541a7e3e41ebaca531caec8af4a9dd2ad1
|
refs/heads/master
| 2020-05-31T12:32:55.707436 | 2015-05-31T15:01:03 | 2015-05-31T15:01:03 | 24,804,077 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,345 |
java
|
package net.melissam.powerlog.clustering;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.math3.ml.clustering.Clusterable;
/**
* Represents a feature vector of arbitrary type.
*
* @author melissam
*/
public class FeatureVector implements Clusterable{
private int id; // line number from dataset
private long timestamp;
private int initialCluster;
private String groundTruthLabel;
private List<Double> point;
public FeatureVector(){
super();
this.id = -1;
this.timestamp = -1;
this.initialCluster = -1;
this.point = new ArrayList<Double>();
}
public FeatureVector(int id){
super();
this.id = id;
this.timestamp = -1;
this.initialCluster = -1;
this.point = new ArrayList<Double>();
}
public FeatureVector(int id, long timestamp){
super();
this.id = id;
this.timestamp = timestamp;
this.initialCluster = -1;
this.point = new ArrayList<Double>();
}
public int getId(){
return this.id;
}
public void setId(int id){
this.id = id;
}
public long getTimestamp(){
return this.timestamp;
}
public void setTimestamp(long timestamp){
this.timestamp = timestamp;
}
public int getInitialCluster(){
return initialCluster;
}
public void setInitialCluster(int cluster){
this.initialCluster = cluster;
}
public String getGroundTruthLable(){
return this.groundTruthLabel;
}
public void setGroundTruthLabel(String label){
this.groundTruthLabel = label;
}
public void add(double d){
point.add(d);
}
public void addAll(double[] features){
for (double feature : features){
point.add(feature);
}
}
public double[] getPoint(){
double[] values = new double[point.size()];
int i = 0;
for (Double d : point){
values[i++] = d.doubleValue();
}
return values;
}
public int getDimension(){
return this.point.size();
}
public double get(int index){
return this.point.get(index);
}
public void set(int index, double value){
this.point.set(index, value);
}
public boolean equals(Object o){
boolean equals = false;
if (o != null && o instanceof FeatureVector){
FeatureVector other = (FeatureVector)o;
equals = this.id == other.getId();
}
return equals;
}
public int hashCode(){
return new Integer(id).hashCode();
}
}
|
[
"[email protected]"
] | |
35d37862561817b5bc72565d79d3abf10ccb430d
|
09d0ddd512472a10bab82c912b66cbb13113fcbf
|
/TestApplications/TF-BETA-THERMATK-v5.7.1/DecompiledCode/Fernflower/src/main/java/org/telegram/messenger/time/FastDatePrinter.java
|
5ae427b54f05c97c801fce2a3fa252d208fafe18
|
[] |
no_license
|
sgros/activity_flow_plugin
|
bde2de3745d95e8097c053795c9e990c829a88f4
|
9e59f8b3adacf078946990db9c58f4965a5ccb48
|
refs/heads/master
| 2020-06-19T02:39:13.865609 | 2019-07-08T20:17:28 | 2019-07-08T20:17:28 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 24,585 |
java
|
package org.telegram.messenger.time;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.text.DateFormatSymbols;
import java.text.FieldPosition;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public class FastDatePrinter implements DatePrinter, Serializable {
public static final int FULL = 0;
public static final int LONG = 1;
public static final int MEDIUM = 2;
public static final int SHORT = 3;
private static final ConcurrentMap cTimeZoneDisplayCache = new ConcurrentHashMap(7);
private static final long serialVersionUID = 1L;
private final Locale mLocale;
private transient int mMaxLengthEstimate;
private final String mPattern;
private transient FastDatePrinter.Rule[] mRules;
private final TimeZone mTimeZone;
protected FastDatePrinter(String var1, TimeZone var2, Locale var3) {
this.mPattern = var1;
this.mTimeZone = var2;
this.mLocale = var3;
this.init();
}
private String applyRulesToString(Calendar var1) {
return this.applyRules(var1, new StringBuffer(this.mMaxLengthEstimate)).toString();
}
static String getTimeZoneDisplay(TimeZone var0, boolean var1, int var2, Locale var3) {
FastDatePrinter.TimeZoneDisplayKey var4 = new FastDatePrinter.TimeZoneDisplayKey(var0, var1, var2, var3);
String var5 = (String)cTimeZoneDisplayCache.get(var4);
String var6 = var5;
if (var5 == null) {
var6 = var0.getDisplayName(var1, var2, var3);
String var7 = (String)cTimeZoneDisplayCache.putIfAbsent(var4, var6);
if (var7 != null) {
var6 = var7;
}
}
return var6;
}
private void init() {
List var1 = this.parsePattern();
this.mRules = (FastDatePrinter.Rule[])var1.toArray(new FastDatePrinter.Rule[var1.size()]);
int var2 = this.mRules.length;
int var3 = 0;
while(true) {
--var2;
if (var2 < 0) {
this.mMaxLengthEstimate = var3;
return;
}
var3 += this.mRules[var2].estimateLength();
}
}
private GregorianCalendar newCalendar() {
return new GregorianCalendar(this.mTimeZone, this.mLocale);
}
private void readObject(ObjectInputStream var1) throws IOException, ClassNotFoundException {
var1.defaultReadObject();
this.init();
}
protected StringBuffer applyRules(Calendar var1, StringBuffer var2) {
FastDatePrinter.Rule[] var3 = this.mRules;
int var4 = var3.length;
for(int var5 = 0; var5 < var4; ++var5) {
var3[var5].appendTo(var2, var1);
}
return var2;
}
public boolean equals(Object var1) {
boolean var2 = var1 instanceof FastDatePrinter;
boolean var3 = false;
if (!var2) {
return false;
} else {
FastDatePrinter var4 = (FastDatePrinter)var1;
var2 = var3;
if (this.mPattern.equals(var4.mPattern)) {
var2 = var3;
if (this.mTimeZone.equals(var4.mTimeZone)) {
var2 = var3;
if (this.mLocale.equals(var4.mLocale)) {
var2 = true;
}
}
}
return var2;
}
}
public String format(long var1) {
GregorianCalendar var3 = this.newCalendar();
var3.setTimeInMillis(var1);
return this.applyRulesToString(var3);
}
public String format(Calendar var1) {
return this.format(var1, new StringBuffer(this.mMaxLengthEstimate)).toString();
}
public String format(Date var1) {
GregorianCalendar var2 = this.newCalendar();
var2.setTime(var1);
return this.applyRulesToString(var2);
}
public StringBuffer format(long var1, StringBuffer var3) {
return this.format(new Date(var1), var3);
}
public StringBuffer format(Object var1, StringBuffer var2, FieldPosition var3) {
if (var1 instanceof Date) {
return this.format((Date)var1, var2);
} else if (var1 instanceof Calendar) {
return this.format((Calendar)var1, var2);
} else if (var1 instanceof Long) {
return this.format((Long)var1, var2);
} else {
StringBuilder var5 = new StringBuilder();
var5.append("Unknown class: ");
String var4;
if (var1 == null) {
var4 = "<null>";
} else {
var4 = var1.getClass().getName();
}
var5.append(var4);
throw new IllegalArgumentException(var5.toString());
}
}
public StringBuffer format(Calendar var1, StringBuffer var2) {
return this.applyRules(var1, var2);
}
public StringBuffer format(Date var1, StringBuffer var2) {
GregorianCalendar var3 = this.newCalendar();
var3.setTime(var1);
return this.applyRules(var3, var2);
}
public Locale getLocale() {
return this.mLocale;
}
public int getMaxLengthEstimate() {
return this.mMaxLengthEstimate;
}
public String getPattern() {
return this.mPattern;
}
public TimeZone getTimeZone() {
return this.mTimeZone;
}
public int hashCode() {
return this.mPattern.hashCode() + (this.mTimeZone.hashCode() + this.mLocale.hashCode() * 13) * 13;
}
protected List parsePattern() {
DateFormatSymbols var1 = new DateFormatSymbols(this.mLocale);
ArrayList var2 = new ArrayList();
String[] var3 = var1.getEras();
String[] var4 = var1.getMonths();
String[] var5 = var1.getShortMonths();
String[] var6 = var1.getWeekdays();
String[] var7 = var1.getShortWeekdays();
String[] var8 = var1.getAmPmStrings();
int var9 = this.mPattern.length();
int[] var10 = new int[1];
int var12;
for(int var11 = 0; var11 < var9; var11 = var12 + 1) {
var10[0] = var11;
String var15 = this.parseToken(this.mPattern, var10);
var12 = var10[0];
var11 = var15.length();
if (var11 == 0) {
break;
}
char var13 = var15.charAt(0);
byte var14 = 4;
Object var16;
if (var13 != 'y') {
if (var13 != 'z') {
switch(var13) {
case '\'':
var15 = var15.substring(1);
if (var15.length() == 1) {
var16 = new FastDatePrinter.CharacterLiteral(var15.charAt(0));
} else {
var16 = new FastDatePrinter.StringLiteral(var15);
}
break;
case 'S':
var16 = this.selectNumberRule(14, var11);
break;
case 'W':
var16 = this.selectNumberRule(4, var11);
break;
case 'Z':
if (var11 == 1) {
var16 = FastDatePrinter.TimeZoneNumberRule.INSTANCE_NO_COLON;
} else {
var16 = FastDatePrinter.TimeZoneNumberRule.INSTANCE_COLON;
}
break;
case 'a':
var16 = new FastDatePrinter.TextField(9, var8);
break;
case 'd':
var16 = this.selectNumberRule(5, var11);
break;
case 'h':
var16 = new FastDatePrinter.TwelveHourField(this.selectNumberRule(10, var11));
break;
case 'k':
var16 = new FastDatePrinter.TwentyFourHourField(this.selectNumberRule(11, var11));
break;
case 'm':
var16 = this.selectNumberRule(12, var11);
break;
case 's':
var16 = this.selectNumberRule(13, var11);
break;
case 'w':
var16 = this.selectNumberRule(3, var11);
break;
default:
switch(var13) {
case 'D':
var16 = this.selectNumberRule(6, var11);
break;
case 'E':
String[] var18;
if (var11 < 4) {
var18 = var7;
} else {
var18 = var6;
}
var16 = new FastDatePrinter.TextField(7, var18);
break;
case 'F':
var16 = this.selectNumberRule(8, var11);
break;
case 'G':
var16 = new FastDatePrinter.TextField(0, var3);
break;
case 'H':
var16 = this.selectNumberRule(11, var11);
break;
default:
switch(var13) {
case 'K':
var16 = this.selectNumberRule(10, var11);
break;
case 'L':
if (var11 >= 4) {
var16 = new FastDatePrinter.TextField(2, var4);
} else if (var11 == 3) {
var16 = new FastDatePrinter.TextField(2, var5);
} else if (var11 == 2) {
var16 = FastDatePrinter.TwoDigitMonthField.INSTANCE;
} else {
var16 = FastDatePrinter.UnpaddedMonthField.INSTANCE;
}
break;
case 'M':
if (var11 >= 4) {
var16 = new FastDatePrinter.TextField(2, var4);
} else if (var11 == 3) {
var16 = new FastDatePrinter.TextField(2, var5);
} else if (var11 == 2) {
var16 = FastDatePrinter.TwoDigitMonthField.INSTANCE;
} else {
var16 = FastDatePrinter.UnpaddedMonthField.INSTANCE;
}
break;
default:
StringBuilder var17 = new StringBuilder();
var17.append("Illegal pattern component: ");
var17.append(var15);
throw new IllegalArgumentException(var17.toString());
}
}
}
} else if (var11 >= 4) {
var16 = new FastDatePrinter.TimeZoneNameRule(this.mTimeZone, this.mLocale, 1);
} else {
var16 = new FastDatePrinter.TimeZoneNameRule(this.mTimeZone, this.mLocale, 0);
}
} else if (var11 == 2) {
var16 = FastDatePrinter.TwoDigitYearField.INSTANCE;
} else {
if (var11 < 4) {
var11 = var14;
}
var16 = this.selectNumberRule(1, var11);
}
var2.add(var16);
}
return var2;
}
protected String parseToken(String var1, int[] var2) {
StringBuilder var3 = new StringBuilder();
int var4 = var2[0];
int var5 = var1.length();
char var6 = var1.charAt(var4);
int var8;
if ((var6 < 'A' || var6 > 'Z') && (var6 < 'a' || var6 > 'z')) {
var3.append('\'');
boolean var9 = false;
while(true) {
var8 = var4;
if (var4 >= var5) {
break;
}
var6 = var1.charAt(var4);
if (var6 == '\'') {
var8 = var4 + 1;
if (var8 < var5 && var1.charAt(var8) == '\'') {
var3.append(var6);
var4 = var8;
} else {
var9 ^= true;
}
} else {
if (!var9 && (var6 >= 'A' && var6 <= 'Z' || var6 >= 'a' && var6 <= 'z')) {
var8 = var4 - 1;
break;
}
var3.append(var6);
}
++var4;
}
} else {
var3.append(var6);
while(true) {
int var7 = var4 + 1;
var8 = var4;
if (var7 >= var5) {
break;
}
var8 = var4;
if (var1.charAt(var7) != var6) {
break;
}
var3.append(var6);
var4 = var7;
}
}
var2[0] = var8;
return var3.toString();
}
protected FastDatePrinter.NumberRule selectNumberRule(int var1, int var2) {
if (var2 != 1) {
return (FastDatePrinter.NumberRule)(var2 != 2 ? new FastDatePrinter.PaddedNumberField(var1, var2) : new FastDatePrinter.TwoDigitNumberField(var1));
} else {
return new FastDatePrinter.UnpaddedNumberField(var1);
}
}
public String toString() {
StringBuilder var1 = new StringBuilder();
var1.append("FastDatePrinter[");
var1.append(this.mPattern);
var1.append(",");
var1.append(this.mLocale);
var1.append(",");
var1.append(this.mTimeZone.getID());
var1.append("]");
return var1.toString();
}
private static class CharacterLiteral implements FastDatePrinter.Rule {
private final char mValue;
CharacterLiteral(char var1) {
this.mValue = (char)var1;
}
public void appendTo(StringBuffer var1, Calendar var2) {
var1.append(this.mValue);
}
public int estimateLength() {
return 1;
}
}
private interface NumberRule extends FastDatePrinter.Rule {
void appendTo(StringBuffer var1, int var2);
}
private static class PaddedNumberField implements FastDatePrinter.NumberRule {
private final int mField;
private final int mSize;
PaddedNumberField(int var1, int var2) {
if (var2 >= 3) {
this.mField = var1;
this.mSize = var2;
} else {
throw new IllegalArgumentException();
}
}
public final void appendTo(StringBuffer var1, int var2) {
int var3;
if (var2 < 100) {
var3 = this.mSize;
while(true) {
--var3;
if (var3 < 2) {
var1.append((char)(var2 / 10 + 48));
var1.append((char)(var2 % 10 + 48));
break;
}
var1.append('0');
}
} else {
if (var2 < 1000) {
var3 = 3;
} else {
var3 = Integer.toString(var2).length();
}
int var4 = this.mSize;
while(true) {
--var4;
if (var4 < var3) {
var1.append(Integer.toString(var2));
break;
}
var1.append('0');
}
}
}
public void appendTo(StringBuffer var1, Calendar var2) {
this.appendTo(var1, var2.get(this.mField));
}
public int estimateLength() {
return 4;
}
}
private interface Rule {
void appendTo(StringBuffer var1, Calendar var2);
int estimateLength();
}
private static class StringLiteral implements FastDatePrinter.Rule {
private final String mValue;
StringLiteral(String var1) {
this.mValue = var1;
}
public void appendTo(StringBuffer var1, Calendar var2) {
var1.append(this.mValue);
}
public int estimateLength() {
return this.mValue.length();
}
}
private static class TextField implements FastDatePrinter.Rule {
private final int mField;
private final String[] mValues;
TextField(int var1, String[] var2) {
this.mField = var1;
this.mValues = var2;
}
public void appendTo(StringBuffer var1, Calendar var2) {
var1.append(this.mValues[var2.get(this.mField)]);
}
public int estimateLength() {
int var1 = this.mValues.length;
int var2 = 0;
while(true) {
int var3 = var1 - 1;
if (var3 < 0) {
return var2;
}
int var4 = this.mValues[var3].length();
var1 = var3;
if (var4 > var2) {
var2 = var4;
var1 = var3;
}
}
}
}
private static class TimeZoneDisplayKey {
private final Locale mLocale;
private final int mStyle;
private final TimeZone mTimeZone;
TimeZoneDisplayKey(TimeZone var1, boolean var2, int var3, Locale var4) {
this.mTimeZone = var1;
if (var2) {
this.mStyle = Integer.MIN_VALUE | var3;
} else {
this.mStyle = var3;
}
this.mLocale = var4;
}
public boolean equals(Object var1) {
boolean var2 = true;
if (this == var1) {
return true;
} else if (!(var1 instanceof FastDatePrinter.TimeZoneDisplayKey)) {
return false;
} else {
FastDatePrinter.TimeZoneDisplayKey var3 = (FastDatePrinter.TimeZoneDisplayKey)var1;
if (!this.mTimeZone.equals(var3.mTimeZone) || this.mStyle != var3.mStyle || !this.mLocale.equals(var3.mLocale)) {
var2 = false;
}
return var2;
}
}
public int hashCode() {
return (this.mStyle * 31 + this.mLocale.hashCode()) * 31 + this.mTimeZone.hashCode();
}
}
private static class TimeZoneNameRule implements FastDatePrinter.Rule {
private final String mDaylight;
private final Locale mLocale;
private final String mStandard;
private final int mStyle;
TimeZoneNameRule(TimeZone var1, Locale var2, int var3) {
this.mLocale = var2;
this.mStyle = var3;
this.mStandard = FastDatePrinter.getTimeZoneDisplay(var1, false, var3, var2);
this.mDaylight = FastDatePrinter.getTimeZoneDisplay(var1, true, var3, var2);
}
public void appendTo(StringBuffer var1, Calendar var2) {
TimeZone var3 = var2.getTimeZone();
if (var3.useDaylightTime() && var2.get(16) != 0) {
var1.append(FastDatePrinter.getTimeZoneDisplay(var3, true, this.mStyle, this.mLocale));
} else {
var1.append(FastDatePrinter.getTimeZoneDisplay(var3, false, this.mStyle, this.mLocale));
}
}
public int estimateLength() {
return Math.max(this.mStandard.length(), this.mDaylight.length());
}
}
private static class TimeZoneNumberRule implements FastDatePrinter.Rule {
static final FastDatePrinter.TimeZoneNumberRule INSTANCE_COLON = new FastDatePrinter.TimeZoneNumberRule(true);
static final FastDatePrinter.TimeZoneNumberRule INSTANCE_NO_COLON = new FastDatePrinter.TimeZoneNumberRule(false);
final boolean mColon;
TimeZoneNumberRule(boolean var1) {
this.mColon = var1;
}
public void appendTo(StringBuffer var1, Calendar var2) {
int var3 = var2.get(15) + var2.get(16);
if (var3 < 0) {
var1.append('-');
var3 = -var3;
} else {
var1.append('+');
}
int var4 = var3 / 3600000;
var1.append((char)(var4 / 10 + 48));
var1.append((char)(var4 % 10 + 48));
if (this.mColon) {
var1.append(':');
}
var3 = var3 / '\uea60' - var4 * 60;
var1.append((char)(var3 / 10 + 48));
var1.append((char)(var3 % 10 + 48));
}
public int estimateLength() {
return 5;
}
}
private static class TwelveHourField implements FastDatePrinter.NumberRule {
private final FastDatePrinter.NumberRule mRule;
TwelveHourField(FastDatePrinter.NumberRule var1) {
this.mRule = var1;
}
public void appendTo(StringBuffer var1, int var2) {
this.mRule.appendTo(var1, var2);
}
public void appendTo(StringBuffer var1, Calendar var2) {
int var3 = var2.get(10);
int var4 = var3;
if (var3 == 0) {
var4 = var2.getLeastMaximum(10) + 1;
}
this.mRule.appendTo(var1, var4);
}
public int estimateLength() {
return this.mRule.estimateLength();
}
}
private static class TwentyFourHourField implements FastDatePrinter.NumberRule {
private final FastDatePrinter.NumberRule mRule;
TwentyFourHourField(FastDatePrinter.NumberRule var1) {
this.mRule = var1;
}
public void appendTo(StringBuffer var1, int var2) {
this.mRule.appendTo(var1, var2);
}
public void appendTo(StringBuffer var1, Calendar var2) {
int var3 = var2.get(11);
int var4 = var3;
if (var3 == 0) {
var4 = var2.getMaximum(11) + 1;
}
this.mRule.appendTo(var1, var4);
}
public int estimateLength() {
return this.mRule.estimateLength();
}
}
private static class TwoDigitMonthField implements FastDatePrinter.NumberRule {
static final FastDatePrinter.TwoDigitMonthField INSTANCE = new FastDatePrinter.TwoDigitMonthField();
TwoDigitMonthField() {
}
public final void appendTo(StringBuffer var1, int var2) {
var1.append((char)(var2 / 10 + 48));
var1.append((char)(var2 % 10 + 48));
}
public void appendTo(StringBuffer var1, Calendar var2) {
this.appendTo(var1, var2.get(2) + 1);
}
public int estimateLength() {
return 2;
}
}
private static class TwoDigitNumberField implements FastDatePrinter.NumberRule {
private final int mField;
TwoDigitNumberField(int var1) {
this.mField = var1;
}
public final void appendTo(StringBuffer var1, int var2) {
if (var2 < 100) {
var1.append((char)(var2 / 10 + 48));
var1.append((char)(var2 % 10 + 48));
} else {
var1.append(Integer.toString(var2));
}
}
public void appendTo(StringBuffer var1, Calendar var2) {
this.appendTo(var1, var2.get(this.mField));
}
public int estimateLength() {
return 2;
}
}
private static class TwoDigitYearField implements FastDatePrinter.NumberRule {
static final FastDatePrinter.TwoDigitYearField INSTANCE = new FastDatePrinter.TwoDigitYearField();
TwoDigitYearField() {
}
public final void appendTo(StringBuffer var1, int var2) {
var1.append((char)(var2 / 10 + 48));
var1.append((char)(var2 % 10 + 48));
}
public void appendTo(StringBuffer var1, Calendar var2) {
this.appendTo(var1, var2.get(1) % 100);
}
public int estimateLength() {
return 2;
}
}
private static class UnpaddedMonthField implements FastDatePrinter.NumberRule {
static final FastDatePrinter.UnpaddedMonthField INSTANCE = new FastDatePrinter.UnpaddedMonthField();
UnpaddedMonthField() {
}
public final void appendTo(StringBuffer var1, int var2) {
if (var2 < 10) {
var1.append((char)(var2 + 48));
} else {
var1.append((char)(var2 / 10 + 48));
var1.append((char)(var2 % 10 + 48));
}
}
public void appendTo(StringBuffer var1, Calendar var2) {
this.appendTo(var1, var2.get(2) + 1);
}
public int estimateLength() {
return 2;
}
}
private static class UnpaddedNumberField implements FastDatePrinter.NumberRule {
private final int mField;
UnpaddedNumberField(int var1) {
this.mField = var1;
}
public final void appendTo(StringBuffer var1, int var2) {
if (var2 < 10) {
var1.append((char)(var2 + 48));
} else if (var2 < 100) {
var1.append((char)(var2 / 10 + 48));
var1.append((char)(var2 % 10 + 48));
} else {
var1.append(Integer.toString(var2));
}
}
public void appendTo(StringBuffer var1, Calendar var2) {
this.appendTo(var1, var2.get(this.mField));
}
public int estimateLength() {
return 4;
}
}
}
|
[
"[email protected]"
] | |
030865896e1be4e0d3bc48428659bdd997b4b33e
|
dc4abe5cbc40f830725f9a723169e2cc80b0a9d6
|
/src/main/java/com/sgai/property/quality/dao/plan/PIRecordDaoVo.java
|
4dafda5af709caca82e0390ebe37eb1e44e771cf
|
[] |
no_license
|
ppliuzf/sgai-training-property
|
0d49cd4f3556da07277fe45972027ad4b0b85cb9
|
0ce7bdf33ff9c66f254faec70ea7eef9917ecc67
|
refs/heads/master
| 2020-05-27T16:25:57.961955 | 2019-06-03T01:12:51 | 2019-06-03T01:12:51 | 188,697,303 | 0 | 1 | null | null | null | null |
UTF-8
|
Java
| false | false | 377 |
java
|
package com.sgai.property.quality.dao.plan;
import com.sgai.property.commonService.dao.MoreDataSourceDao;
import com.sgai.property.quality.entity.plan.Record;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface PIRecordDaoVo extends MoreDataSourceDao<Record> {
List<Record> taskDay(Map<String, Object> map);
}
|
[
"[email protected]"
] | |
ea8d76411c5b4a6dbef6f9803f8639eb0853d9cb
|
b78f852f70f5a75b9485074b22baaf77cb2a54d4
|
/src/main/java/com/ptc/bo/ClassBasicBo.java
|
3a17b9e5e8e4162e5857e3252c6a409027784466
|
[] |
no_license
|
vikasshinde22105/PTCRestApi
|
36f8ee8fcde85ee19bb819d057d8a723b9476701
|
e7d83751ac981faf4d6031088c5cdba27f7e53e9
|
refs/heads/master
| 2021-01-10T02:00:03.847995 | 2015-06-08T05:50:52 | 2015-06-08T05:50:52 | 36,712,445 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 951 |
java
|
package com.ptc.bo;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ptc.dao.ClassBasicDao;
import com.ptc.dao.SchoolHomeDao;
import com.ptc.model.ClassInfo;
import com.ptc.model.School;
@Service
public class ClassBasicBo {
@Autowired
ClassBasicDao classBasic;
public List<ClassInfo> fetchAll() {
System.out.println("SchoolDao: fetchAll");
List<ClassInfo> fetchedClass = classBasic.fetchAll();
return fetchedClass;
}
public ClassInfo fetchById(int id) {
ClassInfo fetchedClass = classBasic.fetchById(id);
return fetchedClass;
}
public List<ClassInfo> fetchClassSectionById(int classId, String sectionName){
System.out.println("SectionDao");
List<ClassInfo> fetchedSection = classBasic.fetchSectioById(classId, sectionName);
return fetchedSection;
}
}
|
[
"[email protected]"
] | |
9d91d9e56c96eefae64d97bb9925d71253714c32
|
d5e5129850e4332a8d4ccdcecef81c84220538d9
|
/Games/Battlecraft/src/axe/g2f/Updatable2f.java
|
d30465d8b7330a7c4c2d88359aeb23675d5a486c
|
[] |
no_license
|
ClickerMonkey/ship
|
e52da76735d6bf388668517c033e58846c6fe017
|
044430be32d4ec385e01deb17de919eda0389d5e
|
refs/heads/master
| 2020-03-18T00:43:52.330132 | 2018-05-22T13:45:14 | 2018-05-22T13:45:14 | 134,109,816 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 114 |
java
|
package axe.g2f;
import axe.core.Updatable;
public interface Updatable2f extends Updatable<Scene2f>
{
}
|
[
"[email protected]"
] | |
cd32dc641da4feac7fd138aefffdc249002c057f
|
0de19d573a0231126c95be027140f962dcee2c81
|
/GridView/app/src/main/java/com/example/grid/list_item.java
|
a6117097f5d9fa0ee7a7c0a48f66a6303c0e7dcc
|
[] |
no_license
|
ehszl409/Android-Study
|
59534c801fca717a8667ab598ff0d87f21d9a207
|
f05d1ba13a5d289935d4ec205345438dffc3c894
|
refs/heads/master
| 2023-03-12T00:01:08.764699 | 2021-03-01T12:50:37 | 2021-03-01T12:50:37 | 338,934,065 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 331 |
java
|
package com.example.grid;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class list_item extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list_item);
}
}
|
[
"[email protected]"
] | |
1e3387d38070107304d266e6c7af1dcf494002d5
|
48e3b2147fd96242aa85fa5957fcd517635c4c39
|
/analizadorlexico/src/main/java/co/edu/eam/tlf/analizadorlexico/modelo/SimboloLexico.java
|
04541614cc4e0f125b6d11a74f06c6fcbd92918f
|
[] |
no_license
|
caferrerb/compilador
|
32a2633d43bbed480db572fac52dc1e3c3247036
|
e1f77e352c096c92f6b75b8890dc5d02deac3451
|
refs/heads/master
| 2021-07-12T08:56:13.756588 | 2019-09-13T13:31:54 | 2019-09-13T13:31:54 | 208,269,411 | 0 | 1 | null | 2020-10-13T16:00:55 | 2019-09-13T13:23:26 |
Java
|
UTF-8
|
Java
| false | false | 1,886 |
java
|
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package co.edu.eam.tlf.analizadorlexico.modelo;
import java.io.Serializable;
/**
*Clase que representa un lexema del lenguaje
* @author Camilo Andres Ferrer Bustos
*/
public class SimboloLexico implements Serializable {
/**
* Representacion textual del simbolo
*/
private String lexema;
/**
* Fila en la que se encuentra el lexema
*/
private int fila;
/**
* Columna donde se encuentra el lexema
*/
private int columna;
/**
* Tipo de simpbolo lexico.
*/
private TipoLexemaEnum tipo;
/**
* determina si el lexema esta erroneo.
*/
private boolean error;
/**
* COnstructor por defecto
*/
public SimboloLexico() {
}
/**
* COnstructor
* @param lexema
* @param fila
* @param columna
* @param tipo
*/
public SimboloLexico(String lexema, int fila, int columna, TipoLexemaEnum tipo) {
this.lexema = lexema;
this.fila = fila;
this.columna = columna;
this.tipo = tipo;
}
public int getColumna() {
return columna;
}
public void setColumna(int columna) {
this.columna = columna;
}
public int getFila() {
return fila;
}
public void setFila(int fila) {
this.fila = fila;
}
public String getLexema() {
return lexema;
}
public void setLexema(String lexema) {
this.lexema = lexema;
}
public TipoLexemaEnum getTipo() {
return tipo;
}
public void setTipo(TipoLexemaEnum tipo) {
this.tipo = tipo;
}
public boolean isError() {
return error;
}
public void setError(boolean error) {
this.error = error;
}
}
|
[
"[email protected]"
] | |
03b45d99dc1c63a5d070033086a8dcb1efefe7b3
|
ac12420d9b45e0f118a70746aac782180660c166
|
/src/test/java/Group11/GroupTests.java
|
806d879e7889e7dd3b5d6839e628e1d5b44e1e06
|
[] |
no_license
|
Project-2-2-Group6/GameInterop
|
8aa329efa35236e59105d645e0be6bae7ae9c2c5
|
083dd52fe7b750660a365e6f9871a285200a0fdd
|
refs/heads/master
| 2021-01-08T00:54:22.498056 | 2020-06-22T11:01:18 | 2020-06-22T11:01:18 | 242,841,100 | 1 | 0 | null | 2020-02-24T20:53:30 | 2020-02-24T20:53:30 | null |
UTF-8
|
Java
| false | false | 844 |
java
|
package Group11;
import SimpleUnitTest.SimpleUnitTest;
public class GroupTests extends SimpleUnitTest {
public static void main(String[] args) {
/*
*
* Here you can write your own tests.
*
* @see InteropTests for examples of simple unit tests usage.
* @see SimpleUnitTest for details on how simple unit tests are implemented.
*
* Please notice, tests of all groups will be run trough GitHub Actions.
* This will allow to verify that all code is working correctly.
*
* @see AllTests
* @see .github/workflows/maven.yml
*
* In order for you code to be accepted into GameInterop all tests must pass!
* You are not required to write any tests, however it is highly recommended!
*
*/
}
}
|
[
"[email protected]"
] | |
a161225f3a676bfb8d9035abc58af06cfc207f6b
|
5ca3901b424539c2cf0d3dda52d8d7ba2ed91773
|
/src_fernflower/com/google/security/zynamics/bindiff/gui/tabpanels/viewtabpanel/graphnodetree/treenodes/combined/callgraph/CombinedCallGraphFunctionTreeNode$1.java
|
1e1478f9cd821fb9077584d9f74fc225a6e5f3c4
|
[] |
no_license
|
fjh658/bindiff
|
c98c9c24b0d904be852182ecbf4f81926ce67fb4
|
2a31859b4638404cdc915d7ed6be19937d762743
|
refs/heads/master
| 2021-01-20T06:43:12.134977 | 2016-06-29T17:09:03 | 2016-06-29T17:09:16 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 995 |
java
|
package com.google.security.zynamics.bindiff.gui.tabpanels.viewtabpanel.graphnodetree.treenodes.combined.callgraph;
import com.google.security.zynamics.bindiff.enums.EMatchState;
// $FF: synthetic class
class CombinedCallGraphFunctionTreeNode$1 {
// $FF: synthetic field
static final int[] $SwitchMap$com$google$security$zynamics$bindiff$enums$EMatchState = new int[EMatchState.values().length];
static {
try {
$SwitchMap$com$google$security$zynamics$bindiff$enums$EMatchState[EMatchState.MATCHED.ordinal()] = 1;
} catch (NoSuchFieldError var3) {
;
}
try {
$SwitchMap$com$google$security$zynamics$bindiff$enums$EMatchState[EMatchState.PRIMARY_UNMATCHED.ordinal()] = 2;
} catch (NoSuchFieldError var2) {
;
}
try {
$SwitchMap$com$google$security$zynamics$bindiff$enums$EMatchState[EMatchState.SECONDRAY_UNMATCHED.ordinal()] = 3;
} catch (NoSuchFieldError var1) {
;
}
}
}
|
[
"[email protected]"
] | |
bf5eb1c10bddc4325d02ff6d8c8c066e3082349d
|
12f015caa6cda5c947810ba806c3bc5f49851d0b
|
/oa-common/src/main/java/cn/lonsun/vo/PageQueryVo.java
|
9ef75921352fa71d50ae9e57d8a15c618dfdc009
|
[] |
no_license
|
linking603/lonsun-goa
|
85899f8b39dc07e1cce80a7e42ba05426659bd51
|
cc330ed3b4ab4430773079653c74b33fd8e1eb67
|
refs/heads/master
| 2020-03-18T09:27:04.512267 | 2018-07-26T02:14:21 | 2018-07-26T02:14:21 | 134,563,445 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,355 |
java
|
package cn.lonsun.vo;
import java.io.Serializable;
public class PageQueryVo implements Serializable{
/**
* 页码 从0开始
*/
private Integer pageIndex = 0;
/**
* 每页记录数 默认为15
*/
private Integer pageSize = 15;
/**
* 排序字段名称
*/
private String sortField;
/**
* 排序形式 asc desc
*/
private String sortOrder = "desc";
/**
* 显示正常数据, 1 正常数据 0 逻辑删除
*/
private Integer recordStatus = 1;
public Integer getPageIndex() {
return pageIndex;
}
public void setPageIndex(Integer pageIndex) {
this.pageIndex = pageIndex;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public String getSortField() {
return sortField;
}
public void setSortField(String sortField) {
this.sortField = sortField;
}
public String getSortOrder() {
return sortOrder;
}
public void setSortOrder(String sortOrder) {
this.sortOrder = sortOrder;
}
public Integer getRecordStatus() {
return recordStatus;
}
public void setRecordStatus(Integer recordStatus) {
this.recordStatus = recordStatus;
}
}
|
[
"[email protected]"
] | |
555715db17e525de6ac00097570e6da975feabec
|
6060bf0279cbb4ceaf9ffa538165c158f84f70fc
|
/src/com/tong/actions/NewProjectDirAction.java
|
2e914b194109710ebbf2f66f036f74ba44d65705
|
[
"Apache-2.0"
] |
permissive
|
rohitnotes/DaggerHelper
|
f5ecd57e58081f0fb082b033e172c29d881d9f05
|
3f2e7201142b0f93a2c0b6322e4720401efed578
|
refs/heads/master
| 2021-06-14T15:55:16.745884 | 2016-12-07T07:29:18 | 2016-12-07T07:29:18 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,670 |
java
|
package com.tong.actions;
import com.intellij.ide.IdeView;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElement;
import com.tong.ui.BaseDialog;
import org.jetbrains.annotations.NotNull;
/**
* Created by Tong on 2016/11/20.
*/
public class NewProjectDirAction extends BaseAction {
@NotNull
@Override
protected void invokeDialog(AnActionEvent e,Project project, PsiDirectory dir) {
BaseDialog dialog = new BaseDialog("请输入基类前缀:",project);
dialog.show();
if (dialog.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
String prefix = dialog.getClassNamePrefix();
if(prefix != null && !prefix.isEmpty()){
Application application = ApplicationManager.getApplication();
application.runWriteAction(() -> {
PsiElement[] elements = createProjectDir(dir,prefix);
final IdeView view = e.getData(LangDataKeys.IDE_VIEW);
if(view != null){
for (PsiElement element : elements) {
view.selectElement(element);
}
}
});
}
}
}
private PsiElement[] createProjectDir(PsiDirectory dir, String prefix){
PsiDirectory common = dir.createSubdirectory("common");
createProjectCls(common,"ApplicationComponent","TApplicationComponent.java");
createProjectCls(common,"ApplicationModule","TApplicationModule.java");
createProjectCls(common,prefix+"Application","TApplication.java");
createProjectCls(common,"Config","TConfig.java");
PsiDirectory bases = common.createSubdirectory("bases");
PsiElement pageComponent = createProjectCls(bases,"PageComponent","TPageComponent.java");
createProjectCls(bases,"PageModule","TPageModule.java");
createProjectCls(bases,"PerPage","TPerPage.java");
PsiElement activity = createProjectCls(bases,prefix,"TActivity.java");
PsiElement fragment = createProjectCls(bases,prefix,"TFragment.java");
dir.createSubdirectory("jni");
dir.createSubdirectory("module");
dir.createSubdirectory("net");
dir.createSubdirectory("storage");
return new PsiElement[]{pageComponent,activity,fragment};
}
}
|
[
"[email protected]"
] | |
f3dfdbe96cf2f99e12ea4a1520088003aaacd4a9
|
b7c6fc5ee703ac2ca4b03c9f0f5e6b0afba71691
|
/app/src/main/java/com/cutebird/database/SoundDatabase.java
|
fd2aaf128ce910f298b06ee52692debaa3b6a88a
|
[
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] |
permissive
|
amorenew/ringdroid
|
b6f0d10f7253c42d25325aaf68745925fce1e500
|
e01cc769ccac6ca6d702358c27747857d9c05be1
|
refs/heads/master
| 2021-01-15T16:11:20.052602 | 2016-06-16T10:25:54 | 2016-06-16T10:25:54 | 61,164,704 | 0 | 0 | null | 2016-06-15T00:16:39 | 2016-06-15T00:16:39 | null |
UTF-8
|
Java
| false | false | 436 |
java
|
package com.cutebird.database;
import com.raizlabs.android.dbflow.annotation.Database;
/**
* Created by islam on 3/29/2016.
*/
/**
* Database config class
*/
@Database(name = SoundDatabase.NAME, version = SoundDatabase.VERSION)
public class SoundDatabase {
//database name without .db or .sqlite
public static final String NAME = "SoundDatabase";
//database version number
public static final int VERSION = 1;
}
|
[
"[email protected]"
] | |
8bee4021813e983b497a746c7f4bd49c317b9717
|
e6c10cafb96a7a44b6ac8dc0e015119bfa84a10a
|
/src/com/codingpatterns/searchingsorting/MergeSort.java
|
2895aa02beb4546badd37044ab4fd7c9b4d9e8c3
|
[] |
no_license
|
deepakchaudhari/CodingPatterns
|
daa88e681bb7f39e0de151ab56d39731c30bd94f
|
c267d33173e40e438f8583285743c605ef8c0614
|
refs/heads/main
| 2023-03-13T12:28:31.194578 | 2021-03-15T20:18:02 | 2021-03-15T20:18:02 | 316,048,810 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,281 |
java
|
package com.codingpatterns.searchingsorting;
class MergeSort {
public static void merge(int arr[], int left, int mid, int right) {
int i, j, k;
// Initialzing the sizes of the temporary arrays
int sizeLeft = mid - left + 1;
int sizeRight = right - mid;
// Initializing temporary arrays
int leftArr[] = new int[sizeLeft];
int rightArr[] = new int[sizeRight];
// Copying the given array into the temporary arrays
for (i = 0; i < sizeLeft; i++)
leftArr[i] = arr[left + i];
for (j = 0; j < sizeRight; j++)
rightArr[j] = arr[mid + 1 + j];
// Merging the temporary arrays back into the given array
i = 0; // Initial index of first subarray
j = 0; // Initial index of second subarray
k = left; // Initial index of the given array
// This is the main part of the algorithm
// Iterate over both arrays and copy the element that is smaller to the
// given array.
while (i < sizeLeft && j < sizeRight) {
if (leftArr[i] <= rightArr[j]) {
arr[k] = leftArr[i];
i++;
} else {
arr[k] = rightArr[j];
j++;
}
k++;
}
// Copying the remaining elements of leftArr[], if there are any
while (i < sizeLeft) {
arr[k] = leftArr[i];
i++;
k++;
}
// Copy the remaining elements of rightArr[], if there are any
while (j < sizeRight) {
arr[k] = rightArr[j];
j++;
k++;
}
}
public static void mergeSort(int arr[], int leftIndex, int rightIndex) {
// Sanity checks
if (leftIndex < 0 || rightIndex < 0)
return;
if (rightIndex > leftIndex) {
// Equivalent to (leftIndex+rightIndex)/2, but avoids overflow
int mid = leftIndex + (rightIndex - leftIndex) / 2;
// Sorting the first and second halves of the array
mergeSort(arr, leftIndex, mid);
mergeSort(arr, mid + 1, rightIndex);
// Merging the array
merge(arr, leftIndex, mid, rightIndex);
}
}
public static void main(String args[]) {
int arr[] = {5,4,1,0,5,95,4,-100,200,0};
int arrSize = 10;
mergeSort(arr, 0, arrSize - 1);
Helper obj = new Helper();
obj.printArray(arr, arrSize);
}
}
class Helper
{
static void printArray(int[]arr, int arrSize)
{
for(int i = 0; i < arrSize; i++)
System.out.print(arr[i] + " ");
System.out.println();
}
static int findMin(int[] arr, int start, int end) {
if(end<=0 || start < 0)
return 0;
int minInd = start;
for(int i = start+1; i <= end; i++) {
if(arr[minInd] > arr[i])
minInd = i;
}
return minInd;
}
int findMax(int[] arr, int start, int end) {
if(end<=0 || start < 0)
return 0;
int maxInd = start;
for(int i = start+1; i <= end; i++) {
if(arr[maxInd] < arr[i])
maxInd = i;
}
return maxInd;
}
}
|
[
"[email protected]"
] | |
a8ff54dad765bf5212a625d0ccb14bf0504cb911
|
39727ab097675f93d6ef025dfdc66f5037ad791b
|
/hc-mdm-web/src/main/java/com/hc/scm/mdm/web/controller/BasZoneController.java
|
8ff0003179b9553154a11f93b1f0303e9d68ed14
|
[] |
no_license
|
lijinxi/hc-mdm
|
be58e76b9b7310df0d67ba394fed4f1744c8b2da
|
5679e9257251417a8db268237648e6ea2c618087
|
refs/heads/master
| 2021-01-10T08:43:05.723534 | 2015-12-17T07:34:47 | 2015-12-17T07:34:47 | 47,642,075 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 889 |
java
|
package com.hc.scm.mdm.web.controller;
import com.hc.scm.common.base.service.BaseCrudService;
import com.hc.scm.common.base.web.BaseCrudController;
import com.hc.scm.mdm.dao.entity.BasZone;
import com.hc.scm.mdm.service.BasZoneService;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* Description: 库区维护Controller
* All rights Reserved, Designed Byhc* Copyright: Copyright(C) 2014-2015
* Company: Wonhigh.
* @author: lucheng
* @date: 2015-03-13 09:23:55
* @version 1.0.0
*/
@Controller
@RequestMapping("/bas_zone")
public class BasZoneController extends BaseCrudController<BasZone> {
@Resource
private BasZoneService basZoneService;
@Override
public BaseCrudService init() {
return basZoneService;
}
}
|
[
"[email protected]"
] | |
2b8f6beb6a237028057313ac908c1566b3433a76
|
979e664a83ec3bb61a6fea03ce63c56cddde1b7a
|
/ProjectHotel/src/br/com/fatec/view/AddAluguel.java
|
e40db8c01df0962dda45f17e51e79c0b81023acc
|
[] |
no_license
|
drextar/ProjetoHotel
|
482350964c1058c31b2408505f18c2e05647bc15
|
c0edbcb5882dfef51181034a83785733fa3e234b
|
refs/heads/main
| 2023-01-05T04:22:56.710767 | 2020-10-30T15:58:46 | 2020-10-30T15:58:46 | 308,421,268 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 22,747 |
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package br.com.fatec.view;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import br.com.fatec.dao.HospedeDAO;
import br.com.fatec.dao.QuartoDAO;
import br.com.fatec.dao.ReservarDAO;
import br.com.fatec.model.Hospede;
import br.com.fatec.model.Quarto;
import br.com.fatec.model.Reservar;
import java.awt.event.KeyEvent;
import java.sql.SQLException;
import java.text.DateFormat;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
*
* @author drextar
*/
public class AddAluguel extends javax.swing.JInternalFrame {
HospedeDAO hospedeDao = new HospedeDAO();
QuartoDAO qDao = new QuartoDAO();
ReservarDAO urDao = new ReservarDAO();
/**
* Creates new form AdicionarReserva
*/
public AddAluguel() {
initComponents();
//setDataAtualNaEntrada();
}
private void setDataAtualNaEntrada(){
txtEntrada.setText(getDataAtualFormatada().replace("/", ""));
}
private String getDataAtualFormatada(){
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
return dateFormat.format(getDataAtual());
}
private Date getDataAtual(){
return new Date();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel5 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
txtNomeHospede = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
txtNum = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();
txtTipo = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
txtTotal = new javax.swing.JTextField();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jLabel9 = new javax.swing.JLabel();
txtTot = new javax.swing.JTextField();
txtCpf = new javax.swing.JFormattedTextField();
txtSaida = new javax.swing.JFormattedTextField();
txtEntrada = new javax.swing.JFormattedTextField();
jLabel5.setText("jLabel5");
setTitle("Associar Aluguel-Hospede");
jLabel1.setText("CPF do Hospede");
jLabel2.setText("Nome do Hospede");
txtNomeHospede.setEnabled(false);
jLabel3.setText("Número do Quarto");
txtNum.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
txtNumFocusLost(evt);
}
});
txtNum.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
txtNumKeyTyped(evt);
}
});
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Files/imagens/icones/clipboards.png"))); // NOI18N
jButton1.setText("Verificar Disponibilidade");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jLabel4.setText("Tipo do Quarto");
txtTipo.setEnabled(false);
jLabel6.setText("Data de Entrada");
jLabel7.setText("Data de Saída");
jLabel8.setText("Valor Diaria");
txtTotal.setEnabled(false);
jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Files/imagens/icones/icons8-selecionado-24.png"))); // NOI18N
jButton2.setText("Confirmar");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Files/imagens/icones/icons8-cancelar-24.png"))); // NOI18N
jButton3.setText("Cancelar");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jLabel9.setText("Valor Total");
txtTot.setEnabled(false);
txtTot.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtTotActionPerformed(evt);
}
});
try {
txtCpf.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###.###.###-##")));
} catch (java.text.ParseException ex) {
ex.printStackTrace();
}
txtCpf.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
txtCpfFocusLost(evt);
}
});
try {
txtSaida.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("########")));
} catch (java.text.ParseException ex) {
ex.printStackTrace();
}
try {
txtEntrada.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("########")));
} catch (java.text.ParseException ex) {
ex.printStackTrace();
}
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addComponent(txtNomeHospede, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
.addComponent(jLabel6)
.addComponent(txtTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8)
.addComponent(txtCpf))
.addComponent(txtEntrada, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel4))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel9)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(txtTipo, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 121, Short.MAX_VALUE)
.addComponent(txtNum, javax.swing.GroupLayout.Alignment.LEADING))
.addComponent(jLabel7)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(txtTot)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(txtSaida, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(33, 33, 33)))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton3))
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 186, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(33, 33, 33))))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtNum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtCpf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtNomeHospede, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtTipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(jLabel7))
.addGap(7, 7, 7)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(txtSaida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(txtEntrada, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(jLabel9))
.addGap(5, 5, 5)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtTotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton2)
.addComponent(jButton3)
.addComponent(txtTot, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(24, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
hide();
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
if(txtCpf.getText().equals("") || txtNum.getText().equals("") || txtEntrada.getText().equals("") || txtSaida.getText().equals("")){
JOptionPane.showMessageDialog(rootPane, "Preencha todos os campos de reserva!");
} else {
Reservar ur = new Reservar();
ur.setCpf(txtCpf.getText());
ur.setNumQuarto(txtNum.getText());
ur.setValorTotal(Float.parseFloat(txtTot.getText()));
ur.setEntrada(txtEntrada.getText());
ur.setSaida(txtSaida.getText());
try {
if(urDao.inserirReserva(ur)){
JOptionPane.showMessageDialog(null, "Aluguel realizado com suceddo!");
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(null, "Erro ao alugar: " + ex);
} catch (ClassNotFoundException ex) {
JOptionPane.showMessageDialog(null, "Erro ao alugar! " + ex);
}
limpaDados();
}
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
if(txtNum.getText().equals("")){
JOptionPane.showMessageDialog(rootPane, "Insira o numero do quarto!");
} else if(txtEntrada.getText().equals("") || txtEntrada.getText().equals("")){
JOptionPane.showMessageDialog(rootPane, "Insira as datas de entrada/saída corretamente!");
} else {
Reservar ur = new Reservar();
ur.setNumQuarto(txtNum.getText());
try {
ur = urDao.consultarDisponibilidade(ur);
} catch (SQLException ex) {
JOptionPane.showMessageDialog(rootPane, "Erro: "
+ ex.getMessage());
} catch (ClassNotFoundException ex) {
Logger.getLogger(BuscaHospede.class.getName()).log(Level.SEVERE, null, ex);
}
if (ur == null) {
JOptionPane.showMessageDialog(rootPane, "Quarto disponível");
txtTot.setText(String.valueOf(Float.parseFloat(txtTotal.getText()) * (Integer.parseInt(txtSaida.getText()) - Integer.parseInt(txtEntrada.getText()))));
} else if (Integer.parseInt(txtEntrada.getText()) > Integer.parseInt(txtSaida.getText())){
} else if (Integer.parseInt(ur.getEntrada()) > Integer.parseInt(txtEntrada.getText())){
if(Integer.parseInt(ur.getEntrada()) < Integer.parseInt(txtSaida.getText())){
//insere no banco
JOptionPane.showMessageDialog(rootPane, "Quarto disponível nesta data!");
txtTot.setText(String.valueOf(Float.parseFloat(txtTotal.getText()) * (Integer.parseInt(txtSaida.getText()) - Integer.parseInt(txtEntrada.getText()))));
} else {
JOptionPane.showMessageDialog(rootPane, "Quarto indisponível nesta data!");
txtEntrada.setText("");
txtSaida.setText("");
}
} else if (Integer.parseInt(ur.getSaida()) < Integer.parseInt(txtEntrada.getText())){
// insere no banco
JOptionPane.showMessageDialog(rootPane, "Quarto disponível nesta data!");
txtTot.setText(String.valueOf(Float.parseFloat(txtTotal.getText()) * (Integer.parseInt(txtSaida.getText()) - Integer.parseInt(txtEntrada.getText()))));
} else if (Integer.parseInt(txtEntrada.getText()) > Integer.parseInt(ur.getEntrada())){
if(Integer.parseInt(txtEntrada.getText()) > Integer.parseInt(ur.getSaida())){
//insere no banco
JOptionPane.showMessageDialog(rootPane, "Quarto disponível nesta data!");
txtTot.setText(String.valueOf(Float.parseFloat(txtTotal.getText()) * (Integer.parseInt(txtSaida.getText()) - Integer.parseInt(txtEntrada.getText()))));
} else {
JOptionPane.showMessageDialog(rootPane, "Quarto indisponível nesta data!");
txtEntrada.setText("");
txtSaida.setText("");
}
}
}
}//GEN-LAST:event_jButton1ActionPerformed
private void txtNumFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtNumFocusLost
// TODO add your handling code here:
Quarto q = new Quarto();
q.setNumQuarto(txtNum.getText());
try {
q = qDao.buscar(q);
} catch (SQLException ex) {
JOptionPane.showMessageDialog(rootPane, "Erro: "
+ ex.getMessage());
} catch (ClassNotFoundException ex) {
Logger.getLogger(AddAluguel.class.getName()).log(Level.SEVERE, null, ex);
}
if(q != null){
txtTipo.setText(q.getTipoQuarto());
txtTotal.setText(String.valueOf(q.getValorDiaria()));
} else {
JOptionPane.showMessageDialog(rootPane, "Quarto não encontrado!");
txtTipo.setText("");
txtTotal.setText("");
}
}//GEN-LAST:event_txtNumFocusLost
private void txtNumKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNumKeyTyped
// TODO add your handling code here:
char c=evt.getKeyChar();
if(!Character.isDigit(c) || c==KeyEvent.VK_BACK_SPACE || c==KeyEvent.VK_DELETE){
evt.consume();
}
}//GEN-LAST:event_txtNumKeyTyped
private void txtTotActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtTotActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtTotActionPerformed
private void txtCpfFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_txtCpfFocusLost
// TODO add your handling code here:
Hospede hospede = new Hospede();
if(txtCpf.getText().equals("")){
JOptionPane.showMessageDialog(rootPane, "Preencha o campo CPF!");
} else {
hospede.setCpf(txtCpf.getText());
try {
hospede = hospedeDao.buscar(hospede);
} catch (SQLException ex) {
JOptionPane.showMessageDialog(rootPane, "Erro: "
+ ex.getMessage());
} catch (ClassNotFoundException ex) {
Logger.getLogger(BuscaHospede.class.getName()).log(Level.SEVERE, null, ex);
}
if (hospede != null) {
txtNomeHospede.setText(hospede.getNome());
} else {
JOptionPane.showMessageDialog(rootPane,
"CPF não cadastrado!");
}
}
}//GEN-LAST:event_txtCpfFocusLost
public void limpaDados(){
txtCpf.setText("");
txtNum.setText("");
txtNomeHospede.setText("");
txtTipo.setText("");
txtTotal.setText("");
txtEntrada.setText("");
txtSaida.setText("");
txtTot.setText("");
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JFormattedTextField txtCpf;
private javax.swing.JFormattedTextField txtEntrada;
private javax.swing.JTextField txtNomeHospede;
private javax.swing.JTextField txtNum;
private javax.swing.JFormattedTextField txtSaida;
private javax.swing.JTextField txtTipo;
private javax.swing.JTextField txtTot;
private javax.swing.JTextField txtTotal;
// End of variables declaration//GEN-END:variables
}
|
[
"[email protected]"
] | |
2fa57091e568dba1e071d80f118c58593f54a05a
|
7a494f355f39bc0664f4a236fe51ba7a77f699c5
|
/src/main/java/com/etc/shopsys/utils/DateUtil.java
|
98038f3a3e423837d05f1aaa280bf2bf2fa85778
|
[] |
no_license
|
clover34/shopsys
|
5bd9d51189dee287776df499c4ba520a46d78e7c
|
24a2159d61ed9b33873f00c5669bafc832133382
|
refs/heads/master
| 2022-12-25T02:51:42.512645 | 2020-10-09T12:06:21 | 2020-10-09T12:06:21 | 299,830,640 | 3 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 856 |
java
|
package com.etc.shopsys.utils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* @ClassName DateUtil
* @Description TODO
* @Author Administrator
* @Date 20/10/05 14:08
* @Version 1.0
**/
public class DateUtil {
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
/**
* Date 转换 String
* @param date
* @return
*/
public static String date2String(Date date){
return sdf.format(date);
}
/**
* String 转 date
* @param date
* @return
*/
public static Date string2Date(String date){
try {
return sdf.parse(date );
} catch (ParseException e) {
System.out.println("string转date异常");
e.printStackTrace();
}
return null;
}
}
|
[
"[email protected]"
] | |
a25191995f1aa7ed517162a72b44030925f330eb
|
7a637e9654f3b6720d996e9b9003f53e40f94814
|
/aylson-utils/src/main/java/com/fastweixin/api/response/GetJsApiTicketResponse.java
|
42775899427f12e0b1975e68d3907729135a1508
|
[] |
no_license
|
hemin1003/aylson-parent
|
118161fc9f7a06b583aa4edd23d36bdd6e000f33
|
1a2a4ae404705871717969449370da8531028ff9
|
refs/heads/master
| 2022-12-26T14:12:19.452615 | 2019-09-20T01:58:40 | 2019-09-20T01:58:40 | 97,936,256 | 161 | 103 | null | 2022-12-16T07:38:18 | 2017-07-21T10:30:03 |
JavaScript
|
UTF-8
|
Java
| false | false | 610 |
java
|
package com.fastweixin.api.response;
import com.alibaba.fastjson.annotation.JSONField;
/**
* @author daxiaoming
*/
public class GetJsApiTicketResponse extends BaseResponse {
private String ticket;
@JSONField(name = "expires_in")
private Integer expiresIn;
public String getTicket() {
return ticket;
}
public void setTicket(String ticket) {
this.ticket = ticket;
}
public Integer getExpiresIn() {
return expiresIn;
}
public void setExpiresIn(Integer expiresIn) {
this.expiresIn = expiresIn;
}
}
|
[
"[email protected]"
] | |
e5e5c747852d3a37ea7648f8a408d5d0350da8f5
|
ada1bcec0a05b6ad2cc75ebaf9c2881380d9a468
|
/account/src/main/java/ru/md/mdhr/service/dto/UserDTO.java
|
25191658b25021b154eb36282cc8d4530eac0806
|
[] |
no_license
|
chipnesh/mdhr
|
872442a97367b5ed9b8dc9b68929ba028e0c553c
|
f68af94133595dbbbacb884e4f3978c22a13d907
|
refs/heads/master
| 2021-04-28T05:51:06.117601 | 2018-04-04T19:32:56 | 2018-04-04T19:32:56 | 121,848,257 | 0 | 0 | null | 2018-02-17T11:08:05 | 2018-02-17T11:04:50 |
Java
|
UTF-8
|
Java
| false | false | 4,604 |
java
|
package ru.md.mdhr.service.dto;
import ru.md.mdhr.config.Constants;
import ru.md.mdhr.domain.Authority;
import ru.md.mdhr.domain.User;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.NotBlank;
import javax.validation.constraints.*;
import java.time.Instant;
import java.util.Set;
import java.util.stream.Collectors;
/**
* A DTO representing a user, with his authorities.
*/
public class UserDTO {
private Long id;
@NotBlank
@Pattern(regexp = Constants.LOGIN_REGEX)
@Size(min = 1, max = 50)
private String login;
@Size(max = 50)
private String firstName;
@Size(max = 50)
private String lastName;
@Email
@Size(min = 5, max = 100)
private String email;
@Size(max = 256)
private String imageUrl;
private boolean activated = false;
@Size(min = 2, max = 6)
private String langKey;
private String createdBy;
private Instant createdDate;
private String lastModifiedBy;
private Instant lastModifiedDate;
private Set<String> authorities;
public UserDTO() {
// Empty constructor needed for Jackson.
}
public UserDTO(User user) {
this.id = user.getId();
this.login = user.getLogin();
this.firstName = user.getFirstName();
this.lastName = user.getLastName();
this.email = user.getEmail();
this.activated = user.getActivated();
this.imageUrl = user.getImageUrl();
this.langKey = user.getLangKey();
this.createdBy = user.getCreatedBy();
this.createdDate = user.getCreatedDate();
this.lastModifiedBy = user.getLastModifiedBy();
this.lastModifiedDate = user.getLastModifiedDate();
this.authorities = user.getAuthorities().stream()
.map(Authority::getName)
.collect(Collectors.toSet());
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getLogin() {
return login;
}
public void setLogin(String login) {
this.login = login;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public boolean isActivated() {
return activated;
}
public void setActivated(boolean activated) {
this.activated = activated;
}
public String getLangKey() {
return langKey;
}
public void setLangKey(String langKey) {
this.langKey = langKey;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Instant getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Instant createdDate) {
this.createdDate = createdDate;
}
public String getLastModifiedBy() {
return lastModifiedBy;
}
public void setLastModifiedBy(String lastModifiedBy) {
this.lastModifiedBy = lastModifiedBy;
}
public Instant getLastModifiedDate() {
return lastModifiedDate;
}
public void setLastModifiedDate(Instant lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
}
public Set<String> getAuthorities() {
return authorities;
}
public void setAuthorities(Set<String> authorities) {
this.authorities = authorities;
}
@Override
public String toString() {
return "UserDTO{" +
"login='" + login + '\'' +
", firstName='" + firstName + '\'' +
", lastName='" + lastName + '\'' +
", email='" + email + '\'' +
", imageUrl='" + imageUrl + '\'' +
", activated=" + activated +
", langKey='" + langKey + '\'' +
", createdBy=" + createdBy +
", createdDate=" + createdDate +
", lastModifiedBy='" + lastModifiedBy + '\'' +
", lastModifiedDate=" + lastModifiedDate +
", authorities=" + authorities +
"}";
}
}
|
[
"[email protected]"
] | |
b694b1e7fb1e2b37bf0b5477ab9993ee94326bca
|
e225768f214e351b37b94c3fd94d78e14b02ba96
|
/EzEventManager/src/ezeventmanager/vendor/SurfaceTravelVendor.java
|
9babd758c2c2fb106063784ce6e047c8ac5b8085
|
[] |
no_license
|
pradeepkt/ezeventmgr
|
838149c37b6bc51198ef81d545512fe61788fe64
|
5ab4481608b684e997adae38305a97e3113f6a71
|
refs/heads/master
| 2021-01-17T18:06:43.733117 | 2016-06-22T16:45:31 | 2016-06-22T16:45:31 | 58,038,229 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 320 |
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ezeventmanager.vendor;
/**
*
* @author t.pradeepkumar
*/
public class SurfaceTravelVendor extends TransportsVendor{
}
|
[
"[email protected]"
] | |
a4c72c397793d1b3e868449dd2a44a35ace47b1c
|
75473a8ce7a1d904005d59f162401dad5ae70340
|
/src/main/java/com/sacompany/bookstore/config/DevConfig.java
|
8b3d457a083ea809cea9f5894e40ba3d65f5962f
|
[] |
no_license
|
sealexsandro/bookstore-API
|
8d3c1081198b0636c40feafcea1d6b5ea0cc413b
|
9f8eb702c56f8a5274b4f29a93b5bc33ce431c16
|
refs/heads/main
| 2023-03-30T12:14:19.146264 | 2021-03-30T16:46:05 | 2021-03-30T16:46:05 | 340,990,982 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 719 |
java
|
package com.sacompany.bookstore.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import com.sacompany.bookstore.service.DBService;
@Configuration
@Profile("dev")
public class DevConfig {
@Autowired
private DBService dbService;
@Value("${spring.jpa.hibernate.ddl-auto}")
private String strategy;
@Bean
public boolean instanciaBaseDeDados() {
if(strategy.equals("create")) {
this.dbService.instanciaBaseDeDados();
}
return false;
}
}
|
[
"[email protected]"
] | |
bfa912a46b11b83aac394278cf3156b95228aba3
|
bb2e2681a4b913ffcc4308bb1eb44193cc318acf
|
/sae/backend/unb-sae/src/main/java/br/unb/sae/model/RespostaEstudoSocioEconomico.java
|
f75f1970f23b77d55c303ab041e5432892c18d44
|
[] |
no_license
|
erlangMS/case-study
|
fc1ee9b324f8de461365f14694416f9314f0fb65
|
027086a8b2b27c8c40008a8e4cac17410bc6cb57
|
refs/heads/master
| 2021-01-18T05:10:39.097626 | 2017-02-02T18:43:25 | 2017-02-02T18:43:25 | 43,950,551 | 3 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,500 |
java
|
package br.unb.sae.model;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import br.erlangms.EmsUtil;
import br.erlangms.EmsValidationException;
import br.unb.sae.service.QuestionarioApplicationProxy;
import br.unb.sae.vo.PerguntaVo;
import br.unb.sae.vo.TipoRespostaVo;
@Entity
@Table(name="TB_RespostaEstudoSE",
uniqueConstraints = {@UniqueConstraint(columnNames={"RESESECodigoEstudo", "RESPerCodigoPergunta"})}
)
public class RespostaEstudoSocioEconomico implements Serializable {
private static final long serialVersionUID = -7635163647849931120L;
@Id
@Column(name = "id", nullable = false, insertable = true, updatable = true)
@GeneratedValue(strategy=GenerationType.AUTO)
private Integer id;
@OneToOne(fetch=FetchType.LAZY)
@JoinColumn(name="RESESECodigoEstudo")
private EstudoSocioEconomico estudo;
@Column(name = "RESPerCodigoPergunta", nullable = false)
private Integer pergunta;
@Column(name = "RESResCodigoResposta", nullable = true)
private Integer resposta;
@Column(name = "RESRespostaSubjetiva", nullable = true, length = 8000)
private String respostaSubjetiva;
@Column(name = "RESPontuacaoCalculada", nullable = false)
private double pontuacaoCalculada = 0.00;
@Column(name = "RESPontuacaoAtribuida", nullable = true)
private double pontuacaoAtribuida;
@Column(name = "RESAssistenteSocial", nullable = true, length = 80)
private String assistenteSocial;
@Column(name = "RESJustificativa", nullable = true, length = 8000)
private String justificativa;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public EstudoSocioEconomico getEstudoSocioEconomico() {
return estudo;
}
public void setEstudo(EstudoSocioEconomico estudo) {
this.estudo = estudo;
}
public Integer getPergunta() {
return pergunta;
}
public void setPergunta(Integer pergunta) {
this.pergunta = pergunta;
}
public Integer getResposta() {
return resposta;
}
public void setResposta(Integer resposta) {
this.resposta = resposta;
}
public EstudoSocioEconomico getEstudo() {
return estudo;
}
public String getRespostaSubjetiva() {
return respostaSubjetiva;
}
public void setRespostaSubjetiva(String respostaSubjetiva) {
this.respostaSubjetiva = respostaSubjetiva;
}
public double getPontuacaoCalculada() {
return pontuacaoCalculada;
}
public void setPontuacaoCalculada(double pontuacaoCalculada) {
this.pontuacaoCalculada = pontuacaoCalculada;
}
public double getPontuacaoAtribuida() {
return pontuacaoAtribuida;
}
public void setPontuacaoAtribuida(double pontuacaoAtribuida) {
this.pontuacaoAtribuida = pontuacaoAtribuida;
}
public String getAssistenteSocial() {
return assistenteSocial;
}
public void setAssistenteSocial(String assistenteSocial) {
this.assistenteSocial = assistenteSocial;
}
public String getJustificativa() {
return justificativa;
}
public void setJustificativa(String justificativa) {
this.justificativa = justificativa;
}
public void validar() {
EmsValidationException erro = new EmsValidationException();
if (!EmsUtil.isFieldObjectValid(getEstudoSocioEconomico())){
erro.addError("Informe o estudo socioeconomico.");
}
if (!EmsUtil.isFieldObjectValid(getPergunta())){
erro.addError("Informe a pergunta.");
}
PerguntaVo perguntaVo = QuestionarioApplicationProxy.getInstance()
.getPerguntaQuestionarioProxy()
.findById(getPergunta());
// Só é possível responder pergunta ativa
if (!perguntaVo.isAtiva()){
erro.addError("A pergunta foi desativada.");
}
// Se a pergunta for de multipla escolha ou uma escolha é preciso o id da resposta
if (perguntaVo.getTipoResposta() == TipoRespostaVo.EscolhaUma && !EmsUtil.isFieldObjectValid(getResposta())){
erro.addError("Informe resposta para pergunta de uma escolha.");
}
if (perguntaVo.getTipoResposta() == TipoRespostaVo.MultiplaEscola && !EmsUtil.isFieldObjectValid(getResposta())){
erro.addError("Informe resposta para pergunta de múltipla escolha.");
}
if(erro.getErrors().size() > 0) {
throw erro;
}
}
}
|
[
"[email protected]"
] | |
2da4dd60f821a389f5dfb553e1d918e6c25a40aa
|
52961343d4d8a33738e6518fb40d3a6cbff97a75
|
/HW4/Parser/Operators/ArityOperation.java
|
4959352d0705ef9eed9cf91b9043f400a4025e12
|
[] |
no_license
|
timchenko/mathlogic
|
b057cfcb6c70b89f44116a8d0c752ac514adafc4
|
7606eddc41521bfd6f95cbf4f3bec7e7a160516e
|
refs/heads/master
| 2021-01-20T15:05:07.395136 | 2017-04-26T12:43:48 | 2017-04-26T12:43:48 | 82,794,510 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,758 |
java
|
package Parser.Operators;
import java.util.ArrayList;
public abstract class ArityOperation implements IExpression {
public String name;
public int arity;
public ArrayList<IExpression> arguments;
public ArityOperation(String name, int arity, ArrayList<IExpression> arguments) {
this.name = name;
this.arity = arity;
this.arguments = arguments;
}
public abstract IExpression clone();
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(name).append("(");
for (IExpression a : arguments) {
sb.append(a.toString()).append(",");
}
sb.deleteCharAt(sb.length() - 1);
sb.append(")");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if(obj == this) return true;
if(obj == null) return false;
if (obj instanceof ArityOperation) {
ArityOperation ao = (ArityOperation) obj;
if (name.equals(ao.name) && ao.arity == this.arity) {
for (int i = 0; i < arity; i++) {
if (!ao.arguments.get(i).equals(arguments.get(i)))
{
return false;
}
}
} else {
return false;
}
return true;
}
return false;
}
@Override
public int hashCode() {
int hash = name.hashCode();
for (int i = 0; i < arity; i++)
{
hash += arguments.get(i).hashCode() * (int)Math.pow(19, i + 1);
hash %= 1_000_000_007;
}
return hash;
}
}
|
[
"[email protected]"
] | |
6d82d471d3cf1d9d3b20c49b328dce63accf9bf0
|
60a6a97e33382fd1d19ca74c2c17700122f9d2ff
|
/nuts/src/uk/dangrew/nuts/store/Database.java
|
df07db57083f02f74dac2a28da849eef30f36f86
|
[
"Apache-2.0"
] |
permissive
|
DanGrew/Nuts
|
19b946672a00651c1b36b4dc4b99dbedc6c08786
|
e0f6835f376dc911c630122c2b21c7130c437bfd
|
refs/heads/master
| 2021-06-03T08:23:02.295355 | 2021-02-10T08:04:59 | 2021-02-10T08:04:59 | 97,559,046 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,071 |
java
|
/*
* ----------------------------------------
* Nutrient Usage Tracking System
* ----------------------------------------
* Produced by Dan Grew
* 2017
* ----------------------------------------
*/
package uk.dangrew.nuts.store;
import uk.dangrew.nuts.configuration.NutsSettings;
import uk.dangrew.nuts.day.DayPlanController;
import uk.dangrew.nuts.day.DayPlanStore;
import uk.dangrew.nuts.food.FoodItemStore;
import uk.dangrew.nuts.goal.calorie.CalorieGoalStore;
import uk.dangrew.nuts.goal.proportion.ProportionGoalStore;
import uk.dangrew.nuts.label.LabelStore;
import uk.dangrew.nuts.meal.MealStore;
import uk.dangrew.nuts.persistence.resolution.Resolver;
import uk.dangrew.nuts.progress.custom.ProgressSeriesStore;
import uk.dangrew.nuts.progress.weight.WeightProgress;
import uk.dangrew.nuts.research.ResearchArticleStore;
import uk.dangrew.nuts.stock.StockStore;
import uk.dangrew.nuts.template.TemplateStore;
/**
* The {@link Database} provides access to the data for the system such as {@link Food}s.
*/
public class Database {
private final NutsSettings settings;
private final Resolver resolver;
private final WeightProgress weightProgress;
private final CalorieGoalStore calorieGoals;
private final ProportionGoalStore proportionGoals;
private final FoodItemStore foodItems;
private final MealStore meals;
private final TemplateStore templates;
private final DayPlanStore dayPlans;
private final DayPlanController dayPlanController;
private final MealStore shoppingLists;
private final StockStore stockLists;
private final LabelStore labels;
private final ProgressSeriesStore progressSeries;
private final ResearchArticleStore researchArticles;
/**
* Constructs a new {@link Database}.
*/
public Database() {
this.settings = new NutsSettings();
this.resolver = new Resolver( this );
this.weightProgress = new WeightProgress();
this.calorieGoals = new CalorieGoalStore();
this.proportionGoals = new ProportionGoalStore();
this.foodItems = new FoodItemStore();
this.meals = new MealStore();
this.templates = new TemplateStore();
this.dayPlans = new DayPlanStore();
this.dayPlanController = new DayPlanController();
this.shoppingLists = new MealStore();
this.stockLists = new StockStore();
this.labels = new LabelStore();
this.progressSeries = new ProgressSeriesStore();
this.researchArticles = new ResearchArticleStore();
}//End Constructor
public Resolver resolver(){
return resolver;
}//End Method
public NutsSettings settings() {
return settings;
}//End Method
/**
* Access to the {@link WeightProgress}.
* @return the {@link WeightProgress}.
*/
public WeightProgress weightProgress() {
return weightProgress;
}//End Method
/**
* Access to the {@link GoalStore}.
* @return the {@link GoalStore}.
*/
public CalorieGoalStore calorieGoals() {
return calorieGoals;
}//End Method
public ProportionGoalStore proportionGoals() {
return proportionGoals;
}//End Method
/**
* Access to the {@link FoodItem}s stored.
* @return the {@link ObjectStoreManager} of {@link uk.dangrew.nuts.food.FoodItem}s against
* their {@link uk.dangrew.nuts.food.FoodProperties#id()}.
*/
public FoodItemStore foodItems() {
return foodItems;
}//End Method
/**
* Access to the {@link uk.dangrew.nuts.meal.Meal}s stored.
* @return the {@link ObjectStoreManager} of {@link uk.dangrew.nuts.meal.Meal}s against
* their {@link uk.dangrew.nuts.food.FoodProperties#id()}.
*/
public MealStore meals() {
return meals;
}//End Method
/**
* Access to the {@link uk.dangrew.nuts.template.Template}s.
* @return the {@link TemplateStore} of {@link uk.dangrew.nuts.template.Template}s.
*/
public TemplateStore templates() {
return templates;
}//End Method
/**
* Access to the {@link uk.dangrew.nuts.day.DayPlan}s.
* @return the {@link DayPlanStore} of {@link uk.dangrew.nuts.day.DayPlan}s.
*/
public DayPlanStore dayPlans() {
return dayPlans;
}//End Method
public DayPlanController dayPlanController() {
return dayPlanController;
}//End Method
/**
* Access to the {@link uk.dangrew.nuts.meal.Meal}s stored as shopping lists.
* @return the {@link MealStore} of {@link uk.dangrew.nuts.meal.Meal}s against
* their {@link uk.dangrew.nuts.food.FoodProperties#id()}.
*/
public MealStore shoppingLists() {
return shoppingLists;
}//End Method
public StockStore stockLists() {
return stockLists;
}//End Method
public LabelStore labels() {
return labels;
}//End Method
public ProgressSeriesStore progressSeries() {
return progressSeries;
}//End Method
public ResearchArticleStore researchArticles() {
return researchArticles;
}//End Method
}//End Class
|
[
"[email protected]"
] | |
868a1db43caea73b8ed1ff06d17c9fc919c28fac
|
9f10dc73d6a0c0efe6a5d837924ef2be4aadd65a
|
/app/src/main/java/com/tufusi/ohho/model/User.java
|
3af6ec4f8b37149327cf017af41e41d148cb3d3a
|
[] |
no_license
|
LeoCheung0221/OhHo
|
fed193ce1c9a6bee77aaae4c0bd749dd7b3d3021
|
fce4fc1f59961de532bc5581174b916b9b936d22
|
refs/heads/master
| 2023-01-09T16:15:12.440997 | 2020-11-03T08:05:44 | 2020-11-03T08:05:44 | 292,489,809 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,133 |
java
|
package com.tufusi.ohho.model;
import androidx.databinding.BaseObservable;
import androidx.databinding.Bindable;
import androidx.databinding.library.baseAdapters.BR;
import java.io.Serializable;
/**
* Created by 鼠夏目 on 2020/9/24.
*
* @author 鼠夏目
* @description
*/
public class User extends BaseObservable implements Serializable {
/**
* id : 1250
* userId : 1578919786
* name : 、蓅哖╰伊人为谁笑
* avatar : http://qzapp.qlogo.cn/qzapp/101794421/FE41683AD4ECF91B7736CA9DB8104A5C/100
* description : 这是一只神秘的jetpack
* likeCount : 3
* topCommentCount : 0
* followCount : 0
* followerCount : 2
* qqOpenId : FE41683AD4ECF91B7736CA9DB8104A5C
* expires_time : 1586695789903
* score : 0
* historyCount : 222
* commentCount : 9
* favoriteCount : 0
* feedCount : 0
* hasFollow : false
*/
private long id;
private long userId;
private String name;
private String avatar;
private String description;
private int likeCount;
private int topCommentCount;
private int followCount;
private int followerCount;
private String qqOpenId;
private long expires_time;
private int score;
private int historyCount;
private int commentCount;
private int favoriteCount;
private int feedCount;
private boolean hasFollow;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public long getUserId() {
return userId;
}
public void setUserId(long userId) {
this.userId = userId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getLikeCount() {
return likeCount;
}
public void setLikeCount(int likeCount) {
this.likeCount = likeCount;
}
public int getTopCommentCount() {
return topCommentCount;
}
public void setTopCommentCount(int topCommentCount) {
this.topCommentCount = topCommentCount;
}
public int getFollowCount() {
return followCount;
}
public void setFollowCount(int followCount) {
this.followCount = followCount;
}
public int getFollowerCount() {
return followerCount;
}
public void setFollowerCount(int followerCount) {
this.followerCount = followerCount;
}
public String getQqOpenId() {
return qqOpenId;
}
public void setQqOpenId(String qqOpenId) {
this.qqOpenId = qqOpenId;
}
public long getExpires_time() {
return expires_time;
}
public void setExpires_time(long expires_time) {
this.expires_time = expires_time;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public int getHistoryCount() {
return historyCount;
}
public void setHistoryCount(int historyCount) {
this.historyCount = historyCount;
}
public int getCommentCount() {
return commentCount;
}
public void setCommentCount(int commentCount) {
this.commentCount = commentCount;
}
public int getFavoriteCount() {
return favoriteCount;
}
public void setFavoriteCount(int favoriteCount) {
this.favoriteCount = favoriteCount;
}
public int getFeedCount() {
return feedCount;
}
public void setFeedCount(int feedCount) {
this.feedCount = feedCount;
}
@Bindable
public boolean isHasFollow() {
return hasFollow;
}
public void setHasFollow(boolean hasFollow) {
this.hasFollow = hasFollow;
notifyPropertyChanged(BR._all);
}
}
|
[
"[email protected]"
] | |
639610ae3f41d0f129e42e347a5cc98955ebc0fa
|
fa6da19a5216a8e44c9a22e7cd387177c6d94570
|
/app/src/main/java/melvinlin/com/mvpdemo/bean/LatestNews.java
|
5c5e245426c46af56a226e5730b625628fd168d8
|
[] |
no_license
|
m9812011/MVPDemo
|
dfa7e00417da7daa780a8785d1713d6fb6e020cb
|
8c8468aba5cfdc0fba787e37c40577efc4b53f06
|
refs/heads/master
| 2020-05-30T03:17:08.556850 | 2019-06-10T09:08:28 | 2019-06-10T09:08:28 | 189,511,223 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,013 |
java
|
package melvinlin.com.mvpdemo.bean;
import java.util.List;
public class LatestNews {
/**
* 資料來源:https://news-at.zhihu.com/api/4/news/latest
*
* date : 20190605
* stories : [{"images":["https://pic4.zhimg.com/v2-24b6e91d7e8d542b03a7fede5a012913.jpg"],"type":0,"id":9712118,"ga_prefix":"060516","title":"写在全结局通关《隐形守护者》之后"},{"images":["https://pic2.zhimg.com/v2-bf447f5ac8778bc64837313139c407e9.jpg"],"type":0,"id":9712073,"ga_prefix":"060509","title":"「看电影」的能力,是需要学习的吗?"},{"images":["https://pic4.zhimg.com/v2-3093fb85665fa8c3e8f7ba005ec17f8b.jpg"],"type":0,"id":9712231,"ga_prefix":"060507","title":"为什么苹果会发布 Pro Display XDR?"},{"images":["https://pic1.zhimg.com/v2-ea02f5da298586bc1ca0c44395dc62b0.jpg"],"type":0,"id":9712097,"ga_prefix":"060506","title":"瞎扯 · 如何正确地吐槽"}]
* top_stories : [{"image":"https://pic1.zhimg.com/v2-af99447ded7fe236a2113bfae6f3aad8.jpg","type":0,"id":9712095,"ga_prefix":"060407","title":"Uniqlo x KAWS 的发售「乱象」,是怎么出现的?"},{"image":"https://pic1.zhimg.com/v2-cbc334204e7ffb639735367122eff48c.jpg","type":0,"id":9712142,"ga_prefix":"060408","title":"旗帜鲜明地反对断骨增高手术"},{"image":"https://pic1.zhimg.com/v2-96666b0894871ab0dbcf76dcccac6c40.jpg","type":0,"id":9712046,"ga_prefix":"060308","title":"结婚 5 年,双方父母没见面,过年各回各家,Papi 酱的婚姻模式适合你吗?"},{"image":"https://pic3.zhimg.com/v2-c041e9c1e28edc3100309532742509f2.jpg","type":0,"id":9712013,"ga_prefix":"053108","title":"百度最难捱的一夜:五名高管闪电辞职内幕"},{"image":"https://pic1.zhimg.com/v2-548d3d615b68aa27421475875d2b410c.jpg","type":0,"id":9711876,"ga_prefix":"053008","title":"高铁这么好的东西,美国人为什么不大力发展?"}]
*/
private String date;
private List<StoriesBean> stories;
private List<TopStoriesBean> top_stories;
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public List<StoriesBean> getStories() {
return stories;
}
public void setStories(List<StoriesBean> stories) {
this.stories = stories;
}
public List<TopStoriesBean> getTop_stories() {
return top_stories;
}
public void setTop_stories(List<TopStoriesBean> top_stories) {
this.top_stories = top_stories;
}
public static class StoriesBean {
/**
* images : ["https://pic4.zhimg.com/v2-24b6e91d7e8d542b03a7fede5a012913.jpg"]
* type : 0
* id : 9712118
* ga_prefix : 060516
* title : 写在全结局通关《隐形守护者》之后
*/
private int type;
private int id;
private String ga_prefix;
private String title;
private List<String> images;
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getGa_prefix() {
return ga_prefix;
}
public void setGa_prefix(String ga_prefix) {
this.ga_prefix = ga_prefix;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public List<String> getImages() {
return images;
}
public void setImages(List<String> images) {
this.images = images;
}
}
public static class TopStoriesBean {
/**
* image : https://pic1.zhimg.com/v2-af99447ded7fe236a2113bfae6f3aad8.jpg
* type : 0
* id : 9712095
* ga_prefix : 060407
* title : Uniqlo x KAWS 的发售「乱象」,是怎么出现的?
*/
private String image;
private int type;
private int id;
private String ga_prefix;
private String title;
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getGa_prefix() {
return ga_prefix;
}
public void setGa_prefix(String ga_prefix) {
this.ga_prefix = ga_prefix;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
}
|
[
"[email protected]"
] | |
0b4fcfd928535ef5112d2ef5eca3d1a534b061e8
|
262e1b9424a3374232a9fa27ff6fd995914341b4
|
/src/main/java/com/ci6225/marketzone/validator/FormValidation.java
|
ddd782ff89e7e35ae9ce37813017600e1b3a96bf
|
[] |
no_license
|
asankalakmal/MarketZone
|
8c11a0700cafd20442e4744b2ca8c9a5b8d233a7
|
db96fb5322082b7ee11983c93365d47d15de7f96
|
refs/heads/master
| 2020-03-12T13:36:20.140454 | 2018-04-23T05:51:44 | 2018-04-23T05:51:44 | 130,646,124 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,051 |
java
|
package com.ci6225.marketzone.validator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.validation.BindingResult;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import com.ci6225.marketzone.model.User;
import com.ci6225.marketzone.service.UserService;
@Component
public class FormValidation {
@Autowired
@Qualifier("userService")
private UserService userService;
public void registerValidate(User user, Errors errors, BindingResult bindingResult) {
if(user.getUserType() != 0 && user.getUserType()==2) {
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "shopName", "NotEmpty.userForm.shopName", "ShopName field is required.");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "description", "NotEmpty.userForm.description", "Description field is required.");
}
if(user.getConfirmPassword() != "" && !(user.getPassword().equals(user.getConfirmPassword()))){
errors.rejectValue("confirmPassword", "Notmatch.userForm.password", "Confirm password does not match with password");
}
if(user.getUserType() == 0 || !(user.getUserType() == 1 || user.getUserType() == 2)){
errors.rejectValue("userType", "Notmatch.userForm.userType", "Please select user type.");
}
if(!bindingResult.hasErrors()){
if(userService.findByUserCode(user.getUserCode()) != null) {
errors.rejectValue("userCode", "exists.userForm.userCode", "UserName already exists!");
}
if(userService.findByUserEmail(user.getEmail()) != null) {
errors.rejectValue("email", "exists.userForm.email", "Email already existes!");
}
}
}
public void loginValidate(User user, Errors errors) {
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "required.password", "Password is required.");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "userCode", "required.userCode", "Username is required.");
}
}
|
[
"[email protected]"
] | |
ea4badf7063142975739f42bbebb05869d81a7a9
|
3b43bbbf9db187c282ddac27694db26afe328c25
|
/src/net/mitrani/blackbook/MainActivity.java
|
3a940abb1e2f84cd5889faae2846e7f62e1fc793
|
[] |
no_license
|
yuvalmit/BlackBookProject
|
98999d02c9697a869a38886cac2fb803749323fa
|
079a740e36d2a49c68f790dccdc9b86d718eaa52
|
refs/heads/master
| 2021-01-10T01:40:58.468810 | 2013-02-27T22:52:32 | 2013-02-27T22:52:32 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,647 |
java
|
package net.mitrani.blackbook;
import com.google.analytics.tracking.android.EasyTracker;
import net.mitrani.blackbook.control.AppManager;
import net.mitrani.blackbook.control.ContactsListAdapter;
import net.mitrani.blackbook.datatype.ContactItem;
import net.mitrani.blackbook.datatype.ContactsArray;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract.Contacts;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.GridView;
public class MainActivity extends Activity
{
private static final int CONTACT_PICKER_RESULT = 1001;
private String _ID;
@Override
protected void onResume()
{
super.onResume();
ContactsListAdapter adapter = new ContactsListAdapter(this, ContactsArray.getInstance(this));
GridView gridView = (GridView) findViewById(R.id.main_contactsGridView);
gridView.setAdapter(adapter);
}
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ContactsListAdapter adapter = new ContactsListAdapter(this, ContactsArray.getInstance(this));
GridView gridView = (GridView) findViewById(R.id.main_contactsGridView);
Button addContact = (Button) findViewById(R.id.main_addContact);
gridView.setAdapter(adapter);
addContact.setBackgroundColor(Color.argb(100 , 0 , 204 , 0));
addContact.setOnClickListener(addCon);
gridView.setOnItemClickListener(conClick);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
if (resultCode == RESULT_OK)
{
switch (requestCode)
{
case CONTACT_PICKER_RESULT:
Uri result = data.getData();
String id = result.getLastPathSegment();
set_ID(id);
Context context = getApplicationContext();
ContactsListAdapter adapter = new ContactsListAdapter(context, ContactsArray.getInstance(context));
ContactItem obj = new ContactItem(AppManager.getInstance().getNameByID(this,get_ID()));
obj.setLookUpKey(get_ID());
adapter.addContact(obj);
break;
}
}
}
OnClickListener addCon = new OnClickListener()
{
@Override
public void onClick(View v)
{
Intent intent = new Intent(Intent.ACTION_PICK,Contacts.CONTENT_URI);
startActivityForResult(intent, CONTACT_PICKER_RESULT);
}
};
OnItemClickListener conClick = new OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> arg0, View v, int pos, long arg3)
{
Context context = v.getContext();
ContactsListAdapter adapter = new ContactsListAdapter(context, ContactsArray.getInstance(context));
Intent intent = new Intent(context,TaskListActivity.class);
intent.putExtra("name", adapter.getItem(pos).getName());
startActivity(intent);
}
};
@Override
protected void onStart()
{
super.onStart();
EasyTracker.getInstance().activityStart(this);
}
@Override
protected void onStop()
{
super.onStop();
EasyTracker.getInstance().activityStop(this);
}
public String get_ID()
{
return _ID;
}
public void set_ID(String _ID)
{
this._ID = _ID;
}
}
|
[
"[email protected]"
] | |
dcbfa3e9ab4a041e4bb17d1f1a2a673451a7889c
|
fa1e9c14bd27f8b9f90ef2c05f7a902acfe4a783
|
/src/main/java/br/com/swconsultoria/cte/schema_300/cteOS/TransformsType.java
|
9d0626ad27379bf72d15c721eb625583a8fa38ee
|
[
"MIT"
] |
permissive
|
godah/Java_CTe
|
2cc846b2e879a46a7902535dc66ab43223bb2084
|
2436625ffd5a72b6189a6338ac0d9c44687f8815
|
refs/heads/master
| 2020-04-25T10:54:42.770513 | 2019-02-05T19:03:09 | 2019-02-05T19:03:09 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,954 |
java
|
package br.com.swconsultoria.cte.schema_300.cteOS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Classe Java de TransformsType complex type.
*
* <p>O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe.
*
* <pre>
* <complexType name="TransformsType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Transform" type="{http://www.w3.org/2000/09/xmldsig#}TransformType" maxOccurs="2" minOccurs="2"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "TransformsType", namespace = "http://www.w3.org/2000/09/xmldsig#", propOrder = {
"transform"
})
public class TransformsType {
@XmlElement(name = "Transform", required = true)
protected List<TransformType> transform;
/**
* Gets the value of the transform property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the transform property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getTransform().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link TransformType }
*/
public List<TransformType> getTransform() {
if (transform == null) {
transform = new ArrayList<TransformType>();
}
return this.transform;
}
}
|
[
"[email protected]"
] | |
33d1eaaed552c9aaf4401d164cf884a4c6afeab1
|
94d4d70435dea2a16191541f211afb65b8a8b86f
|
/movingkey/TiltPhoto/TiltCode_New/app/src/main/java/tiltcode/movingkey/com/tiltcode_new/Model/HttpService.java
|
df94ea27d9c4eb1b3f83c147841854c55ca275d0
|
[] |
no_license
|
jin-sin/PGTest
|
b2e43d9b8feb2801430f7181dafa2963307a180b
|
8537dd9e67395c1a5ef26a0e635a263ff5f3290e
|
refs/heads/master
| 2021-06-08T01:34:30.096314 | 2016-07-07T06:38:55 | 2016-07-07T06:38:55 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,498 |
java
|
package tiltcode.movingkey.com.tiltcode_new.Model;
import retrofit.Callback;
import retrofit.http.Field;
import retrofit.http.FormUrlEncoded;
import retrofit.http.Multipart;
import retrofit.http.POST;
import retrofit.http.Part;
import retrofit.mime.TypedFile;
/**
* Created by Gyul on 2016-06-20.
*/
public interface HttpService {
@FormUrlEncoded
@POST("/users/signIn")
void signIn(@Field("username") String username,
@Field("pw") String pw,
Callback<SignInResult> ret);
@FormUrlEncoded
@POST("/users/enterUser")
void enterUser(@Field("udid") String udid,
@Field("model_name") String model_name,
@Field("push_token") String push_token,
@Field("language") String language,
@Field("latitude") String latitude,
@Field("longitude") String longitude,
Callback<SignInResult> ret);
@FormUrlEncoded
@POST("/users/signUp")
void signUp(@Field("latitude") String latitude,
@Field("longitude") String longitude,
@Field("image") TypedFile image,
@Field("gender") String gender,
@Field("dob") String dob,
@Field("snsID") String snsID,
@Field("snsType") String snsType,
@Field("email") String email,
@Field("username") String username,
@Field("firstname") String firstname,
@Field("lastname") String lastname,
@Field("pw") String pw,
Callback<SignUpResult> ret);
@Multipart
@POST("/users/signUp")
void snsSignUp(@Part("image") TypedFile image,
@Part("snsID") String snsID,
@Part("snsType") String snsType,
Callback<SignUpResult> ret);
@FormUrlEncoded
@POST("/getCouponOrPhoto")
void getCouponOrPhoto(@Field("username") String username,
@Field("loginType") String loginType,
@Field("degree") String degree,
@Field("latitude") String latitude,
@Field("longitude") String longitude,
@Field("option") String option,
Callback<CouponPhotoResult> ret);
@FormUrlEncoded
@POST("/ownCouponOrPhoto")
void ownCouponOrPhoto(@Field("username") String username,
@Field("coupon_id") String coupon_id,
@Field("photo_id") String photo_id,
Callback<CouponPhotoResult> ret);
@FormUrlEncoded
@POST("/listCoupon")
void listCoupon(@Field("username") String username,
@Field("page") String page,
Callback<ListCouponResult> ret);
@FormUrlEncoded
@POST("/users/listPhoto")
void listPhoto(@Field("username") String username,
@Field("page") String page,
Callback<ListPhotoResult> ret);
@FormUrlEncoded
@POST("/users/usedCoupon")
void usedCoupon(@Field("couponid") String couponid,
@Field("username") String username,
Callback<ListCouponResult> ret);
@FormUrlEncoded
@POST("/users/removeCoupon")
void removeCoupon(@Field("couponid") String couponid,
@Field("username") String username,
Callback<ListCouponResult> ret);
}
|
[
"[email protected]"
] | |
e3c8255afa5c2c0b4b33c386729b6541d2046b9f
|
99dd5648d7a8f12d737eae49c8686812145a0234
|
/src/main/java/com/ProductService/service/ProductService.java
|
259bd124524939df8cb4d2453f71bce9a957812c
|
[] |
no_license
|
Chandini999/Productservice
|
d229df82caa4888d2f4b209b357caf156212539b
|
9652b09e32852224e6cbc8da9ccb1f6e64d4ac8e
|
refs/heads/main
| 2023-08-29T04:01:44.544378 | 2021-11-10T05:58:18 | 2021-11-10T05:58:18 | 426,477,728 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,628 |
java
|
package com.ProductService.service;
import java.util.List;
import java.util.Optional;
import javax.transaction.Transactional;
//import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ProductService.dto.ProductDTO;
import com.ProductService.entity.Product;
import com.ProductService.repository.ProductRepository;
@Service
@Transactional
public class ProductService {
Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
ProductRepository prodrepo;
public void removeProduct(Integer prodid) {
prodrepo.deleteByProdid(prodid);
}
public Product addProduct(ProductDTO prodDTO) {
Product prod = new Product();
prod.setProdid(prodDTO.getProdid());
prod.setProdname(prodDTO.getProdname());
prod.setPrice(prodDTO.getPrice());
prod.setStock(prodDTO.getStock());
prod.setDescription(prodDTO.getDescription());
prod.setSellerid(prodDTO.getSellerid());
// prod.setBuyerid(prodDTO.getBuyerid());
prod.setCategory(prodDTO.getCategory());
prod.setSubcategory(prodDTO.getSubcategory());
prod.setProductrating(prodDTO.getProductrating());
prodrepo.save(prod);
return prod;
}
public List<Product> getProductByCategory(String category){
List<Product> p=prodrepo.findAllByCategory(category);
return p;
}
public List<Product> getProductByName(String prodname){
List<Product> p=prodrepo.findAllByprodname(prodname);
return p;
}
public Product searchProduct(String prodname, String category,ProductDTO productdto) {
Optional<Product> optimal = prodrepo.findByProdnameAndCategory(prodname,category);
if(optimal.isPresent()) {
Product p=optimal.get();
p.getProdname();
p.getCategory();
return p;
}
return null;
}
public Product searchProductByids(Integer prodid, Integer sellerid) {
Product prod= prodrepo.findByProdidAndSellerid(prodid,sellerid);
return prod;
}
public Product updatestatus(Integer prodid,Integer sellerid, Integer stock) {
Optional<Product> optimal = prodrepo.findBySelleridAndProdid(sellerid,prodid);
if(optimal.isPresent()) {
Product p= optimal.get();
p.setStock(stock);
prodrepo.save(p);
return p;
}
return null;
}
public Product updatestock(Integer prodid,Integer sellerid, Integer stock) {
Optional<Product> optimal = prodrepo.findBySelleridAndProdid(sellerid,prodid);
if(optimal.isPresent()) {
Product p= optimal.get();
p.setStock(stock);
prodrepo.save(p);
return p;
}
// TODO Auto-generated method stub
return null;
}
}
|
[
"[email protected]"
] | |
1b4c14d1839cacb61c295135e79a0be534d72103
|
5a7c1fffa7198f1eae36f7fbf752b075abb21e76
|
/service/src/main/java/org/building/pmservice/service/Enity/DjqxEnity.java
|
914a94f2e1cd52aa19bb439adf5f1d8c51dfa4b3
|
[] |
no_license
|
ethelbing/pmservice
|
7ee59dafbdf462c82e30490ff7231212985edf9c
|
0558d948fc0f2bc09aae06a348107884eb6ea991
|
refs/heads/master
| 2022-06-30T00:53:20.156556 | 2019-07-19T08:01:14 | 2019-07-19T08:01:14 | 197,709,880 | 0 | 0 | null | 2022-06-17T02:19:16 | 2019-07-19T05:49:25 |
Java
|
UTF-8
|
Java
| false | false | 460 |
java
|
package org.building.pmservice.service.Enity;
import java.util.List;
public class DjqxEnity {
private String V_SYSTEM;
private List<QxEnity> items;
public String getV_SYSTEM() {
return V_SYSTEM;
}
public void setV_SYSTEM(String v_SYSTEM) {
V_SYSTEM = v_SYSTEM;
}
public List<QxEnity> getItems() {
return items;
}
public void setItems(List<QxEnity> items) {
this.items = items;
}
}
|
[
"[email protected]"
] | |
44d92fd9c74cf2c3e6ed38474e402ee81a6f952f
|
fe1d73278a6452926dfc484a5b1a06402a3355bc
|
/app/src/main/java/com/example/owner/moon_observation_logger/MySQLiteHelper.java
|
c1816f5bb837da354b19d7bf861604353a6e2907
|
[] |
no_license
|
millyschumacher/Moon_Logger
|
8b7ff36a31906fd9eaf63c3ad99f6c94336dde05
|
d3dd42bc136ad3e4fe517fd071ed1afbd397ce9d
|
refs/heads/master
| 2020-03-17T02:44:28.209045 | 2018-05-13T01:13:13 | 2018-05-13T01:13:13 | 133,203,287 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 3,210 |
java
|
package com.example.owner.moon_observation_logger;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
/**
* MySQLiteHelper()
* This class performs database actions such as creating a table
* and upgrading to a current version if applicable
*/
public class MySQLiteHelper extends SQLiteOpenHelper {
//Table name
public static final String TABLE_LOG = "logs";
//Database name
private static final String DATABASE_NAME = "logs.db";
//This is the version number
private static final int DATABASE_VERSION = 1;
//Columns of the table
public static final String COLUMN_ID="id";
public static final String COLUMN_DATE="date";
public static final String COLUMN_TIME="time";
public static final String COLUMN_LATITUDE="latitude";
public static final String COLUMN_LONGITUDE="longitude";
public static final String COLUMN_LOCATION="location";
public static final String COLUMN_OBJECT_NAME="object_name";
/**
* Create TABLE
*
* This is the SQL statement required to create the empty table
*/
private static final String DATABASE_CREATE = String.format(
"Create TABLE %s( " +
"%s integer primary key autoincrement, " +
"%s text not null,%s text not null," +
"%s text not null,%s text not null," +
"%s text not null,%s text not null);",
TABLE_LOG,
COLUMN_ID,
COLUMN_DATE,
COLUMN_TIME,
COLUMN_LATITUDE,
COLUMN_LONGITUDE,
COLUMN_LOCATION,
COLUMN_OBJECT_NAME);
// private static MySQLiteHelper sInstance;
// public static synchronized MySQLiteHelper getInstance(Context context) {
//
// // Use the application context, which will ensure that you
// // don't accidentally leak an Activity's context.
// // See this article for more information: http://bit.ly/6LRzfx
// if (sInstance == null) {
// sInstance = new MySQLiteHelper(context.getApplicationContext());
// }
// return sInstance;
// }
/**
* MySQLiteHelper()
* This method calls the MySQLiteOpenHelper() constructor
* @param context
*/
public MySQLiteHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
/**
* The method executes the creation of a database
* @param database
*/
@Override
public void onCreate(SQLiteDatabase database) {
database.execSQL(DATABASE_CREATE);
}
/**
* Upon an upgrade, this method performs the task of dropping the old table
* @param db
* @param oldVersion
* @param newVersion
*/
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.w(MySQLiteHelper.class.getName(),
"Upgrading database from version " + oldVersion + " to "
+ newVersion + ", which will destroy all old data");
db.execSQL("DROP TABLE IF EXISTS " + TABLE_LOG);
onCreate(db);
}
}
|
[
"[email protected]"
] | |
7952706ec4efe9ec68ab6e62a4e5034e033e0664
|
fd3c7642109218d27b081dabbd38d2ecee3e2592
|
/kkyochon/src/shop/kkyochon/banban/order/action/MenuOrderFormAction.java
|
f1a8e5ed7cb66b02e071428a5401d3589b0479b5
|
[] |
no_license
|
ih0615/project
|
c642d7f1f836d7def9484f7ed479424cda921ef0
|
ccb353e9c4d0f3c54533774a531c1a7bf076262f
|
refs/heads/main
| 2023-01-29T21:20:15.388750 | 2020-12-08T03:42:54 | 2020-12-08T03:42:54 | 319,172,373 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 514 |
java
|
package shop.kkyochon.banban.order.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import shop.kkyochon.common.Action;
import shop.kkyochon.common.ActionForward;
public class MenuOrderFormAction implements Action{
@Override
public ActionForward execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
ActionForward forward = new ActionForward();
forward.setPath("/views/order/menuOrderForm.jsp");
return forward;
}
}
|
[
"[email protected]"
] | |
373c8156f3965afd5e4e213a0853cd48c6594e33
|
be3adf818b05e103a44b302cdec65f5c3b6bc807
|
/src/java_swing_erp/TestMain.java
|
c279e2c904a76f3cb59ad5ebf4175a7c86a43836
|
[] |
no_license
|
Yoonwonju/java_swing_erp_tea
|
c26b6f89d57ef654d68c83938c20c661f246e228
|
50aa373905509ebcb6dd08e0d497862b456f43c5
|
refs/heads/master
| 2022-12-01T17:06:47.125445 | 2020-08-17T03:33:57 | 2020-08-17T03:33:57 | 288,074,329 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,515 |
java
|
package java_swing_erp;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.regex.Pattern;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import java_swing_erp.dto.Department;
import java_swing_erp.dto.Student;
import java_swing_erp.ui.component.DepartmentManagement;
import java_swing_erp.ui.component.StudentManagement;
import java_swing_erp.ui.component.content.DepartmentPanel;
import java_swing_erp.ui.component.content.StudentPanel;
import java_swing_erp.ui.component.table.DepartmentTable;
import java_swing_erp.ui.component.table.StudentTable;
public class TestMain {
public static void main(String[] args) {
// test정규표현식적용();
// testDepartment();
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
StudentManagement stdframe = new StudentManagement();
DepartmentManagement deptframe = new DepartmentManagement();
stdframe.setVisible(true);
deptframe.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
private static void test정규표현식적용() {
String no = "ab";
boolean isValid = Pattern.matches("\\d{1,3}", no);
System.out.println(isValid);
String name = "이현석";
boolean isValidHan = Pattern.matches("^[가-힣]+$", name);
System.out.println(isValidHan);
String tel = "053-1111-111a";
boolean isValidTel = Pattern.matches("\\d{3}-\\d{3,4}-\\d{4}", tel);
System.out.println(isValidTel);
}
public static void testDepartment() {
JFrame frame = new JFrame();//기본 레이아웃은 borderlayout(동서남북)
frame.setSize(400, 600);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
DepartmentPanel sp = new DepartmentPanel();
frame.add(sp, BorderLayout.NORTH);//center에 들어감
Department std = new Department(1, "경영학", "053-111-3333");
sp.setItem(std);
JButton btn = new JButton("확인");//borderlayout의 south 에 추가
btn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println(sp.getItem());
}
});
frame.add(btn, BorderLayout.EAST);
ArrayList<Department> stdList = new ArrayList<>();
stdList.add(new Department(1, "경영", "053-1111-1111"));
stdList.add(new Department(2, "무역", "053-2222-2222"));
DepartmentTable table = new DepartmentTable();
table.setItems(stdList);
JScrollPane jp = new JScrollPane();
jp.setViewportView(table);
frame.add(jp, BorderLayout.CENTER);
Department tstd = new Department(3, "컴퓨터관광", "053-3333-3333");
stdList.add(tstd);
table.addRow(tstd);
table.removeRow(1);
stdList.remove(1);
tstd.setName("컴퓨터과학");
tstd.setTel("053-4444-4444");
int searchIdx = stdList.indexOf(tstd);
table.updateRow(searchIdx, tstd);
frame.setVisible(true);
}
public static void testStudent() {
JFrame frame = new JFrame();//기본 레이아웃은 borderlayout(동서남북)
frame.setSize(400, 600);
StudentPanel sp = new StudentPanel();
frame.add(sp, BorderLayout.NORTH);//center에 들어감
Student std = new Student(1, "김대훈", 90, 70, 60);
sp.setItem(std);
JButton btn = new JButton("확인");//borderlayout의 south 에 추가
btn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println(sp.getItem());
}
});
frame.add(btn, BorderLayout.EAST);
ArrayList<Student> stdList = new ArrayList<Student>();
stdList.add(new Student(1, "김대훈", 90, 80, 71));
stdList.add(new Student(2, "이현석", 91, 81, 100));
stdList.add(new Student(3, "윤원주", 92, 82, 90));
stdList.add(new Student(4, "배성덕", 93, 83, 60));
StudentTable table = new StudentTable();
table.setItems(stdList);
JScrollPane jp = new JScrollPane();
jp.setViewportView(table);
frame.add(jp, BorderLayout.CENTER);
Student tstd = new Student(5, "이지수", 80, 70, 60);
stdList.add(tstd);
table.addRow(tstd);
table.removeRow(1);
stdList.remove(1);
tstd.setName("백령");
tstd.setKor(100);
tstd.setEng(0);
tstd.setMath(100);
int searchIdx = stdList.indexOf(tstd);
table.updateRow(searchIdx, tstd);
frame.setVisible(true);
}
}
|
[
"[email protected]"
] | |
480b1119bfcd3cdfe117388c20d6f8496a66d653
|
d8188c5e621b5a54efb49034c1e2f39f6781291a
|
/src/KruskalAlgorithm/App.java
|
97f34eef7aa935bd40665b7cc9c2328f8fb49dac
|
[] |
no_license
|
npalaska/algorithms
|
d0e277a26e2f17ddbaad743b53d7d2a61d919865
|
cba55eaec1cd6e500bbddf21d29271fd32e93b20
|
refs/heads/master
| 2021-08-19T12:15:30.193273 | 2017-11-26T06:26:51 | 2017-11-26T06:26:51 | 110,798,956 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,690 |
java
|
package KruskalAlgorithm;
import java.util.ArrayList;
import java.util.List;
public class App {
public static void main (String[] args) {
List<Vertex> vertexList = new ArrayList<>();
vertexList.add(new Vertex("A"));
vertexList.add(new Vertex("B"));
vertexList.add(new Vertex("C"));
vertexList.add(new Vertex("D"));
vertexList.add(new Vertex("E"));
vertexList.add(new Vertex("F"));
vertexList.add(new Vertex("G"));
vertexList.add(new Vertex("H"));
List<Edge> edgeList = new ArrayList<>();
edgeList.add(new Edge(vertexList.get(0), vertexList.get(1), 3));
edgeList.add(new Edge(vertexList.get(0), vertexList.get(2), 2));
edgeList.add(new Edge(vertexList.get(0), vertexList.get(3), 5));
edgeList.add(new Edge(vertexList.get(1), vertexList.get(5), 13));
edgeList.add(new Edge(vertexList.get(1), vertexList.get(3), 2));
edgeList.add(new Edge(vertexList.get(2), vertexList.get(4), 5));
edgeList.add(new Edge(vertexList.get(2), vertexList.get(3), 2));
edgeList.add(new Edge(vertexList.get(3), vertexList.get(4), 4));
edgeList.add(new Edge(vertexList.get(3), vertexList.get(5), 6));
edgeList.add(new Edge(vertexList.get(3), vertexList.get(6), 3));
edgeList.add(new Edge(vertexList.get(4), vertexList.get(6), 6));
edgeList.add(new Edge(vertexList.get(5), vertexList.get(6), 2));
edgeList.add(new Edge(vertexList.get(5), vertexList.get(7), 3));
edgeList.add(new Edge(vertexList.get(6), vertexList.get(7), 6));
Algorithm al = new Algorithm();
al.kruskal(edgeList, vertexList);
}
}
|
[
"[email protected]"
] | |
4cf991fccbfb96721ff6145be251edcb1a743b0f
|
48fbd4d00428ccc1838fdcb26eb529a2af1bef67
|
/GamesCategory.java
|
0ce663b407e55ca3389fae369dd7d8b6bb6b7d09
|
[] |
no_license
|
vedant3598/Quiz-Up
|
95a8fa4ec1c7166dd36181b7eb8668ff971c9c15
|
331e7f8b7d6f5398b23edc271454c5a8f083c35d
|
refs/heads/master
| 2020-12-14T17:20:02.560471 | 2020-01-19T01:44:04 | 2020-01-19T01:44:04 | 234,822,740 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 13,706 |
java
|
package com.example.quizup;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import com.example.quizup.Model.Question;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.os.CountDownTimer;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class GamesCategory extends AppCompatActivity {
Button o1, o2, o3, o4;
TextView t1_score, t2_questionNumber, t3_question, t4_timer;
int total = 0;
int correct = 0;
int wrong = 0;
DatabaseReference reference;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_games_category);
o1 = findViewById(R.id.option1);
o2 = findViewById(R.id.option2);
o3 = findViewById(R.id.option3);
o4 = findViewById(R.id.option4);
t1_score = findViewById(R.id.score);
t2_questionNumber = findViewById(R.id.questionNumber);
t3_question = findViewById(R.id.questionsText);
t4_timer = findViewById(R.id.timer);
updateQuestion();
timer(30, t4_timer);
}
public void updateQuestion(){
total++;
if(total > 2){
Intent intent = new Intent(GamesCategory.this, ResultActivity.class);
intent.putExtra("total", String.valueOf(total));
intent.putExtra("correct", String.valueOf(correct));
intent.putExtra("wrong", String.valueOf(wrong));
startActivity(intent);
}
else{
reference = FirebaseDatabase.getInstance().getReference().child("Games").child(String.valueOf(total));
reference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
final Question question = dataSnapshot.getValue(Question.class);
t3_question.setText(question.getAnswer());
o1.setText(question.getOption1());
o2.setText(question.getOption2());
o3.setText(question.getOption3());
o4.setText(question.getOption4());
o1.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
if(o1.getText().toString().equals(question.getAnswer())){
o1.setBackgroundColor(Color.GREEN);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
correct++;
o1.setBackgroundColor(Color.parseColor("#03A9F4"));
updatePoints();
updateQuestion();
}
},1500);
}
else {
wrong++;
o1.setBackgroundColor(Color.RED);
if (o2.getText().toString().equals(question.getAnswer())) {
o2.setBackgroundColor(Color.GREEN);
} else if (o3.getText().toString().equals(question.getAnswer())) {
o3.setBackgroundColor(Color.GREEN);
} else if (o4.getText().toString().equals(question.getAnswer())) {
o4.setBackgroundColor(Color.GREEN);
}
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
o1.setBackgroundColor(Color.parseColor("#03A9F4"));
o2.setBackgroundColor(Color.parseColor("#03A9F4"));
o3.setBackgroundColor(Color.parseColor("#03A9F4"));
o4.setBackgroundColor(Color.parseColor("#03A9F4"));
updateQuestion();
}
},1500);
}
updateQuestionNum();
}
});
o2.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
if(o2.getText().toString().equals(question.getAnswer())){
o2.setBackgroundColor(Color.GREEN);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
correct++;
o2.setBackgroundColor(Color.parseColor("#03A9F4"));
updatePoints();
updateQuestion();
}
},1500);
}
else {
wrong++;
o2.setBackgroundColor(Color.RED);
if (o1.getText().toString().equals(question.getAnswer())) {
o1.setBackgroundColor(Color.GREEN);
} else if (o3.getText().toString().equals(question.getAnswer())) {
o3.setBackgroundColor(Color.GREEN);
} else if (o4.getText().toString().equals(question.getAnswer())) {
o4.setBackgroundColor(Color.GREEN);
}
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
o1.setBackgroundColor(Color.parseColor("#03A9F4"));
o2.setBackgroundColor(Color.parseColor("#03A9F4"));
o3.setBackgroundColor(Color.parseColor("#03A9F4"));
o4.setBackgroundColor(Color.parseColor("#03A9F4"));
updateQuestion();
}
},1500);
}
updateQuestionNum();
}
});
o3.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
if(o3.getText().toString().equals(question.getAnswer())){
o3.setBackgroundColor(Color.GREEN);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
correct++;
o3.setBackgroundColor(Color.parseColor("#03A9F4"));
updatePoints();
updateQuestion();
}
},1500);
}
else {
wrong++;
o3.setBackgroundColor(Color.RED);
if (o1.getText().toString().equals(question.getAnswer())) {
o1.setBackgroundColor(Color.GREEN);
} else if (o2.getText().toString().equals(question.getAnswer())) {
o2.setBackgroundColor(Color.GREEN);
} else if (o4.getText().toString().equals(question.getAnswer())) {
o4.setBackgroundColor(Color.GREEN);
}
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
o1.setBackgroundColor(Color.parseColor("#03A9F4"));
o2.setBackgroundColor(Color.parseColor("#03A9F4"));
o3.setBackgroundColor(Color.parseColor("#03A9F4"));
o4.setBackgroundColor(Color.parseColor("#03A9F4"));
updateQuestion();
}
},1500);
}
updateQuestionNum();
}
});
o4.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
if(o4.getText().toString().equals(question.getAnswer())){
o4.setBackgroundColor(Color.GREEN);
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
correct++;
o4.setBackgroundColor(Color.parseColor("#03A9F4"));
updatePoints();
updateQuestion();
}
},1500);
}
else {
wrong++;
o4.setBackgroundColor(Color.RED);
if (o2.getText().toString().equals(question.getAnswer())) {
o2.setBackgroundColor(Color.GREEN);
} else if (o3.getText().toString().equals(question.getAnswer())) {
o3.setBackgroundColor(Color.GREEN);
} else if (o1.getText().toString().equals(question.getAnswer())) {
o1.setBackgroundColor(Color.GREEN);
}
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
o1.setBackgroundColor(Color.parseColor("#03A9F4"));
o2.setBackgroundColor(Color.parseColor("#03A9F4"));
o3.setBackgroundColor(Color.parseColor("#03A9F4"));
o4.setBackgroundColor(Color.parseColor("#03A9F4"));
updateQuestion();
}
},1500);
}
updateQuestionNum();
}
});
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
public void timer(int seconds, final TextView tv){
new CountDownTimer(seconds * 1000 + 1000, 1000){
public void onTick(long millisUntilFinished){
int seconds = (int) (millisUntilFinished / 1000);
int minutes = seconds / 60;
seconds = seconds % 60;
tv.setText(String.format("%02d", minutes) + ":" + String.format("%02d", seconds));
}
public void onFinish(){
tv.setText("Completed");
Intent intent = new Intent(GamesCategory.this, ResultActivity.class);
intent.putExtra("total", String.valueOf(total));
intent.putExtra("correct", String.valueOf(correct));
intent.putExtra("wrong", String.valueOf(wrong));
startActivity(intent);
}
}.start();
}
private void updatePoints(){
t1_score.setText("Score: " + correct);
}
private void updateQuestionNum(){
t2_questionNumber.setText("Question: " + total);
}
}
|
[
"[email protected]"
] | |
4774c22e2606c2ed31c0a89bfccc32cf5efd17f3
|
4370971acf1f422557e3f7de83d47f7705fd3719
|
/ph-oton-ajax/src/main/java/com/helger/photon/ajax/AjaxRegistry.java
|
b46e2a62d8b9578ef70361949ede355869cf962d
|
[
"Apache-2.0"
] |
permissive
|
phax/ph-oton
|
848676b328507b5ea96877d0b8ba80d286fd9fb7
|
6d28dcb7de123f4deb77de1bc022faf77ac37e49
|
refs/heads/master
| 2023-08-27T20:41:11.706035 | 2023-08-20T15:30:44 | 2023-08-20T15:30:44 | 35,175,824 | 5 | 5 |
Apache-2.0
| 2023-02-23T20:20:41 | 2015-05-06T18:27:20 |
JavaScript
|
UTF-8
|
Java
| false | false | 3,824 |
java
|
/*
* Copyright (C) 2014-2023 Philip Helger (www.helger.com)
* philip[at]helger[dot]com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.helger.photon.ajax;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.helger.commons.ValueEnforcer;
import com.helger.commons.annotation.ReturnsMutableCopy;
import com.helger.commons.collection.impl.CommonsHashMap;
import com.helger.commons.collection.impl.ICommonsMap;
import com.helger.commons.concurrent.SimpleReadWriteLock;
import com.helger.commons.regex.RegExHelper;
import com.helger.commons.string.StringHelper;
import com.helger.commons.string.ToStringGenerator;
import com.helger.photon.ajax.decl.IAjaxFunctionDeclaration;
/**
* The default implementation of {@link IAjaxRegistry}.
*
* @author Philip Helger
* @since 8.1.4
*/
@ThreadSafe
public class AjaxRegistry implements IAjaxRegistry
{
private static final Logger LOGGER = LoggerFactory.getLogger (AjaxRegistry.class);
private final SimpleReadWriteLock m_aRWLock = new SimpleReadWriteLock ();
@GuardedBy ("m_aRWLock")
private final ICommonsMap <String, IAjaxFunctionDeclaration> m_aFuncDecls = new CommonsHashMap <> ();
public AjaxRegistry ()
{}
public static boolean isValidFunctionName (@Nullable final String sFunctionName)
{
// All characters allowed should be valid in URLs without masking
return StringHelper.hasText (sFunctionName) && RegExHelper.stringMatchesPattern ("^[a-zA-Z0-9\\-_]+$", sFunctionName);
}
@Nonnull
@ReturnsMutableCopy
public ICommonsMap <String, IAjaxFunctionDeclaration> getAllRegisteredFunctions ()
{
return m_aRWLock.readLockedGet (m_aFuncDecls::getClone);
}
@Nullable
public IAjaxFunctionDeclaration getRegisteredFunction (@Nullable final String sFunctionName)
{
if (StringHelper.hasNoText (sFunctionName))
return null;
return m_aRWLock.readLockedGet ( () -> m_aFuncDecls.get (sFunctionName));
}
public boolean isRegisteredFunction (@Nullable final String sFunctionName)
{
if (StringHelper.hasNoText (sFunctionName))
return false;
return m_aRWLock.readLockedBoolean ( () -> m_aFuncDecls.containsKey (sFunctionName));
}
public void registerFunction (@Nonnull final IAjaxFunctionDeclaration aFunctionDeclaration)
{
ValueEnforcer.notNull (aFunctionDeclaration, "FunctionDeclaration");
final String sFunctionName = aFunctionDeclaration.getName ();
m_aRWLock.writeLocked ( () -> {
if (m_aFuncDecls.containsKey (sFunctionName))
throw new IllegalArgumentException ("An Ajax function with the name '" +
sFunctionName +
"' is already registered. Replacing the old declaration.");
m_aFuncDecls.put (sFunctionName, aFunctionDeclaration);
});
if (LOGGER.isDebugEnabled ())
LOGGER.debug ("Registered AJAX function '" + sFunctionName + "' with executor factory " + aFunctionDeclaration.getExecutorFactory ());
}
@Override
public String toString ()
{
return new ToStringGenerator (this).append ("FuncDecls", m_aFuncDecls).getToString ();
}
}
|
[
"[email protected]"
] | |
fbfb32de5ac90c582b8de1d1b1e73b286efac2e1
|
d0f26e1fa163eee2cd5febc7e5c6a2c9d2b2cb1b
|
/src/main/java/hr/abc/psd2/model/sepa/camt/AmountAndCurrencyExchange3.java
|
5c6d389a381b504a421b2e5212f8b6dffff1c4cc
|
[] |
no_license
|
gorannovotny/psd2-test
|
70bfe06108f00ece993f757b3ca312862690e3e4
|
022fb9d13ea64b45f6ee5b876860470fe11fb3f0
|
refs/heads/master
| 2023-02-13T16:22:25.514618 | 2021-01-13T09:49:14 | 2021-01-13T09:49:14 | 329,260,474 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 5,446 |
java
|
package hr.abc.psd2.model.sepa.camt;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for AmountAndCurrencyExchange3 complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="AmountAndCurrencyExchange3">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="InstdAmt" type="{urn:iso:std:iso:20022:tech:xsd:camt.053.001.02}AmountAndCurrencyExchangeDetails3" minOccurs="0"/>
* <element name="TxAmt" type="{urn:iso:std:iso:20022:tech:xsd:camt.053.001.02}AmountAndCurrencyExchangeDetails3" minOccurs="0"/>
* <element name="CntrValAmt" type="{urn:iso:std:iso:20022:tech:xsd:camt.053.001.02}AmountAndCurrencyExchangeDetails3" minOccurs="0"/>
* <element name="AnncdPstngAmt" type="{urn:iso:std:iso:20022:tech:xsd:camt.053.001.02}AmountAndCurrencyExchangeDetails3" minOccurs="0"/>
* <element name="PrtryAmt" type="{urn:iso:std:iso:20022:tech:xsd:camt.053.001.02}AmountAndCurrencyExchangeDetails4" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AmountAndCurrencyExchange3", propOrder = {
"instdAmt",
"txAmt",
"cntrValAmt",
"anncdPstngAmt",
"prtryAmt"
})
public class AmountAndCurrencyExchange3 implements Serializable {
@XmlElement(name = "InstdAmt")
protected AmountAndCurrencyExchangeDetails3 instdAmt;
@XmlElement(name = "TxAmt")
protected AmountAndCurrencyExchangeDetails3 txAmt;
@XmlElement(name = "CntrValAmt")
protected AmountAndCurrencyExchangeDetails3 cntrValAmt;
@XmlElement(name = "AnncdPstngAmt")
protected AmountAndCurrencyExchangeDetails3 anncdPstngAmt;
@XmlElement(name = "PrtryAmt")
protected List<AmountAndCurrencyExchangeDetails4> prtryAmt;
/**
* Gets the value of the instdAmt property.
*
* @return
* possible object is
* {@link AmountAndCurrencyExchangeDetails3 }
*
*/
public AmountAndCurrencyExchangeDetails3 getInstdAmt() {
return instdAmt;
}
/**
* Sets the value of the instdAmt property.
*
* @param value
* allowed object is
* {@link AmountAndCurrencyExchangeDetails3 }
*
*/
public void setInstdAmt(AmountAndCurrencyExchangeDetails3 value) {
this.instdAmt = value;
}
/**
* Gets the value of the txAmt property.
*
* @return
* possible object is
* {@link AmountAndCurrencyExchangeDetails3 }
*
*/
public AmountAndCurrencyExchangeDetails3 getTxAmt() {
return txAmt;
}
/**
* Sets the value of the txAmt property.
*
* @param value
* allowed object is
* {@link AmountAndCurrencyExchangeDetails3 }
*
*/
public void setTxAmt(AmountAndCurrencyExchangeDetails3 value) {
this.txAmt = value;
}
/**
* Gets the value of the cntrValAmt property.
*
* @return
* possible object is
* {@link AmountAndCurrencyExchangeDetails3 }
*
*/
public AmountAndCurrencyExchangeDetails3 getCntrValAmt() {
return cntrValAmt;
}
/**
* Sets the value of the cntrValAmt property.
*
* @param value
* allowed object is
* {@link AmountAndCurrencyExchangeDetails3 }
*
*/
public void setCntrValAmt(AmountAndCurrencyExchangeDetails3 value) {
this.cntrValAmt = value;
}
/**
* Gets the value of the anncdPstngAmt property.
*
* @return
* possible object is
* {@link AmountAndCurrencyExchangeDetails3 }
*
*/
public AmountAndCurrencyExchangeDetails3 getAnncdPstngAmt() {
return anncdPstngAmt;
}
/**
* Sets the value of the anncdPstngAmt property.
*
* @param value
* allowed object is
* {@link AmountAndCurrencyExchangeDetails3 }
*
*/
public void setAnncdPstngAmt(AmountAndCurrencyExchangeDetails3 value) {
this.anncdPstngAmt = value;
}
/**
* Gets the value of the prtryAmt property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the prtryAmt property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPrtryAmt().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link AmountAndCurrencyExchangeDetails4 }
*
*
*/
public List<AmountAndCurrencyExchangeDetails4> getPrtryAmt() {
if (prtryAmt == null) {
prtryAmt = new ArrayList<AmountAndCurrencyExchangeDetails4>();
}
return this.prtryAmt;
}
}
|
[
"[email protected]"
] | |
9204db2f53261dbcaa7ae931b7f1c5020ec74379
|
86e20ded688968fd65a38fade92de893a5192412
|
/src/main/java/edu/wpi/cs3733/c20/teamS/serviceRequests/SelectServiceScreen.java
|
a70a2793a019e7fcd5b92dd401220a32f93d6813
|
[] |
no_license
|
CluelessTimeTraveler/Project-Team-S
|
df9a2fbcef35f94e1ca090fc04fdb71b24e7bded
|
53644c8eb44fc5c2bb244cc231b50a08bdf5a3d3
|
refs/heads/master
| 2021-02-04T13:12:12.311744 | 2020-02-26T19:22:24 | 2020-02-26T19:22:24 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,399 |
java
|
package edu.wpi.cs3733.c20.teamS.serviceRequests;
import edu.wpi.cs3733.c20.teamS.ThrowHelper;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Modality;
import javafx.stage.Stage;
import java.io.IOException;
public class SelectServiceScreen {
private final Stage stage;
private final Scene scene;
private final Employee loggedIn;
private SelectServiceScreen(Employee employee) {
if(employee == null) ThrowHelper.illegalNull("employee");
this.stage = new Stage();
this.loggedIn = employee;
stage.initModality(Modality.APPLICATION_MODAL);
stage.setResizable(false);
FXMLLoader loader = new FXMLLoader(getClass().getResource("/FXML/SelectServiceScreen.fxml"));
loader.setControllerFactory(e -> {
SelectServiceController cont = new SelectServiceController(stage, loggedIn);
return cont;
});
try {
Parent root = loader.load();
scene = new Scene(root);
}
catch (IOException ex) {
throw new RuntimeException(ex);
}
}
private void show() {
stage.setScene(scene);
stage.show();
}
public static void showDialog(Employee loggedIn) {
SelectServiceScreen screen = new SelectServiceScreen(loggedIn);
screen.show();
}
}
|
[
"[email protected]"
] | |
aa370a1834d1b81dd2fbf04c9f76a48d899cbef9
|
ba0a3dd5028c34378fea97f7006a798d80bea458
|
/app/src/main/java/com/example/cloudtranslator/MainActivity.java
|
60351f266713458e86950b1b77921a12a9c07fd2
|
[] |
no_license
|
xTrilton/CloudTranslator
|
d1b8692d25adb9d1fe0b1bb4101fe81ba0b9dff5
|
058e648cdbcddae79648fb5620cf0acb991d5b41
|
refs/heads/main
| 2023-01-05T18:55:56.518157 | 2020-11-05T10:46:34 | 2020-11-05T10:46:34 | 309,409,249 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,609 |
java
|
package com.example.cloudtranslator;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.speech.RecognizerIntent;
import android.view.View;
import android.widget.TextView;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
private TextView outputtxt;
private static final int REQUEST_CODE = 100;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
outputtxt= (TextView) findViewById(R.id.text_output);
}
//This method is called with the button is pressed and displays microphone dialog box
public void addSpeech(View v) {
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
//Start the Activity and wait for the response
startActivityForResult(intent, REQUEST_CODE);
}
//Handle the results
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//if the results are okay get the output
if (requestCode == REQUEST_CODE) {
if (resultCode == RESULT_OK && null != data) {
// retrieve converted output
ArrayList<String> result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
//display the output
outputtxt.setText(result.get(0));
}
}
}
}
|
[
"[email protected]"
] | |
4f6116b79b2da713ea36a728f417b58331f7a780
|
20b33e772c032d6c74c915997e219a2b0a151ddb
|
/src/main/java_weixin/cn/sdkd/csse/dbcourses/weixin/util/package-info.java
|
33132483d4664afc05e6347aa244b35d5e498c2e
|
[
"Apache-2.0"
] |
permissive
|
lijiaxing10086/dbcourses
|
e6e1a830e4799d61e507e0d6132b55379549afbe
|
cf55d6f0a915ab4c04780dae1819e71472e1c159
|
refs/heads/master
| 2020-03-15T03:12:11.992608 | 2018-08-20T09:11:54 | 2018-08-20T09:11:54 | 131,936,654 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 151 |
java
|
/**
* 工具类包
*
* Created by FirenzesEagle on 2016/6/27 0027.
* Email:[email protected]
*/
package cn.sdkd.csse.dbcourses.weixin.util;
|
[
"[email protected]"
] | |
3899a94321303307b8aaf4621b8615a033744bd1
|
dc2fc809ebeff5c390ef9646fcf1208e6efc70e6
|
/exercices 2/wellBalanced/src/dataStructures/stack/ArrayStack.java
|
12cf09e3d10d5f88b15c14e3b596d4cc907c5b36
|
[] |
no_license
|
Alkesst/DataStructures
|
ffbc35ffb117d1eca71070c277ca614797485819
|
676e88336f338a26a27ce41e24a2e34a72a42787
|
refs/heads/master
| 2021-03-19T06:50:36.705887 | 2018-01-04T19:37:09 | 2018-01-04T19:37:09 | 112,947,665 | 4 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 2,496 |
java
|
package dataStructures.stack; /**
* @author Pepe Gallardo, Data Structures, Grado en Informática. UMA.
*
* dataStructures.stack.Stack implementation using an array
*/
import dataStructures.stack.Stack;
import java.util.Arrays;
/**
* dataStructures.stack.Stack implemented using an array of elements. Size of array
* (capacity) is automatically increased when it runs out of capacity.
* @param <T> Type of elements in stack.
*/
public class ArrayStack<T> implements Stack<T> {
protected T[] elements;
protected int nextFree;
private static final int DEFAULT_INITIAL_CAPACITY = 128;
/**
* Creates an empty stack. Initial capacity is {@code n} elements.
* Capacity is automatically increased when needed.
* @param n Initial capacity.
* <p>Time complexity: O(1)
*/
@SuppressWarnings("unchecked")
public ArrayStack(int n) {
elements = (T[]) new Object[n];
nextFree = 0;
}
/**
* Creates an empty stack with default initial capacity.
* Capacity is automatically increased when needed.
* <p>Time complexity: O(1)
*/
public ArrayStack() {
this(DEFAULT_INITIAL_CAPACITY);
}
/**
* {@inheritDoc}
* <p>Time complexity: O(1)
*/
public boolean isEmpty() {
return nextFree == 0;
}
private void ensureCapacity() {
if (nextFree >= elements.length) {
elements = Arrays.copyOf(elements, 2*elements.length);
}
}
/**
* {@inheritDoc}
* <p>Time complexity: mostly O(1). O(n) when stack capacity has to be increased.
*/
public void push(T x) {
ensureCapacity();
elements[nextFree] = x;
nextFree++;
}
/**
* {@inheritDoc}
* <p>Time complexity: O(1)
* @throws EmptyStackException {@inheritDoc}
*/
public T top() {
if (isEmpty()){
throw new EmptyStackException("top on empty stack");
}
else
return elements[nextFree-1];
}
/**
* {@inheritDoc}
* <p>Time complexity: O(1)
* @throws EmptyStackException {@inheritDoc}
*/
public void pop() {
if (isEmpty()){
throw new EmptyStackException("pop on empty stack");
}
else
nextFree--;
}
/**
* Returns representation of stack as a String.
*/
@Override public String toString() {
String className = getClass().getName().substring(getClass().getPackage().getName().length()+1);
String s = className+"(";
for(int i=nextFree-1; i>=0; i--)
s += elements[i] + (i>0 ? "," : "");
s += ")";
return s;
}
}
|
[
"[email protected]"
] | |
5b3d6c1e031649fd8fc20a1a4ba686242a0488b2
|
dda4d5c1a9c16f2c57fe50d595eb720e6c726403
|
/src/main/java/chap_4/transformingObservables/ScanExample.java
|
145afa57ad2ff06d37793f2b5f4fb8a9194159dc
|
[] |
no_license
|
sdass12/RxJavaPractice
|
e6bec1e244b54008e668e0f447674cb14cacd81f
|
894c6044081846882965604d3f5737510a34176d
|
refs/heads/master
| 2020-06-01T06:14:32.331227 | 2019-06-11T09:30:11 | 2019-06-11T09:30:11 | 188,950,574 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,067 |
java
|
package chap_4.transformingObservables;
import common.Log;
import io.reactivex.Observable;
public class ScanExample {
public static void main(String[] args) {
String[] balls = {"1", "3", "5"};
Observable<String> source = Observable.fromArray(balls)
// scan() 함수는 실행할 때마다 입력값에 맞는 중간 결과 및 최종 결과를 구독자에게 발행함
.scan((ball1, ball2) -> ball2 + "(" + ball1 + ")");
source.subscribe(Log::i);
}
}
/*
* 결과가 reduce() 함수 때와 비슷한 것을 알 수 있음
* reduce()와 scan()의 큰 차이는 reduce()는 Maybe<T>인 반면 scan()은 Observable<T>라는 점이다.
* 그 이유는 reduce() 함수의 경우 마지막 값이 입력되지 않거나 onComplete 이벤트가 발생하지 않으면 값을 발행하지 않음
* 반면 scan() 함수는 값이 입력될 때마다 구독자에게 값을 발행한다. 따라서 Maybe가 아닌 Observable임.
*/
/* 결과
main | value = 1
main | value = 3(1)
main | value = 5(3(1))
*/
|
[
"[email protected]"
] | |
fd9628f7426b1c304a757eee334388b50939dc58
|
04fbd5fb9c22eb0ec5ac6b000ea0e4da3f5380f6
|
/JProgramming/src/lesson6/adapters/math/var2/AdapterByObject.java
|
a2de674645ddad49054a793baf502199ef46a0ef
|
[] |
no_license
|
PetroRulov/COURSE-JAVA-PROGRAMMER
|
56be01254d7112b1f915ddbaa681cafbbdbfd8e0
|
24260c12f052bfb543ef91dcf7e38b434113611d
|
refs/heads/master
| 2021-01-23T21:48:11.950605 | 2019-02-19T19:06:20 | 2019-02-19T19:06:20 | 56,302,822 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 515 |
java
|
package lesson6.adapters.math.var2;
import lesson6.adapters.math.Arithmetika;
import lesson6.adapters.math.var2.calc.Calculator;
public class AdapterByObject implements Calculator {
private Arithmetika arithmetic;
public AdapterByObject(){
arithmetic = new Arithmetika();
}
@Override
public int summa(int a, int b) {
return arithmetic.summa(new int[]{a, b});
}
@Override
public int multiply(int a, int b) {
return arithmetic.multiply(a, b);
}
}
|
[
"[email protected]"
] | |
2f0eb3a304489847a0b319f5d594ae8c49af0b1e
|
eae58bf423f936fd70941845596f034fec474a1e
|
/src/main/java/edu/mit/broad/xbench/xchoosers/TemplateSelectionMultiSource.java
|
5fc9050e902d33f30ce66e8e103fb90301ad6d8c
|
[
"BSD-3-Clause",
"BSD-2-Clause"
] |
permissive
|
Shicheng-Guo/gsea-desktop
|
eb3cc737855cfdded269ecee02e2699bf95bf394
|
c8b60984f65623412c09345d846fa3232dd53239
|
refs/heads/master
| 2022-11-24T13:48:36.828903 | 2020-07-30T20:27:23 | 2020-07-30T20:27:23 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 1,651 |
java
|
/*******************************************************************************
* Copyright (c) 2003-2016 Broad Institute, Inc., Massachusetts Institute of Technology, and Regents of the University of California. All rights reserved.
*******************************************************************************/
package edu.mit.broad.xbench.xchoosers;
import org.apache.log4j.Logger;
/**
* Inner class for a bag of templates possibly from seperate source files
*/
public class TemplateSelectionMultiSource extends TemplateSelection {
protected Logger log = Logger.getLogger(TemplateSelectionMultiSource.class);
// IMP IMP IMP
// Override sub-class as we want the full paths for ALL templates
// format is:
// fullpath2mainTemplate#foo,fullpath2mainTemplate#bar ...
// OVA and ALL_PAIRS are magic strings that expand
public String formatForUI() {
if (fTemplateNamesOrPaths == null) {
return null;
}
//klog.debug("TemplatePaths: " + fTemplatePaths);
String[] vals = (String[]) fTemplateNamesOrPaths.toArray(new String[fTemplateNamesOrPaths.size()]);
if (vals == null || vals.length == 0) {
return "";
}
StringBuffer buf = new StringBuffer();
for (int i = 0; i < vals.length; i++) {
if (vals[i] == null) {
continue;
}
buf.append(vals[i]);
if (i != vals.length - 1) {
buf.append(',');
}
}
log.debug("Got combo string: " + buf.toString());
return buf.toString();
}
} // End inner class MultiSource
|
[
"[email protected]"
] | |
76c099ae6bf2e79dce9d82f68ab92b65b8aa5c82
|
c4c20795d19d1713731a9be11ff0439704ac2d6c
|
/src/me/xtimdevx/scylehavex/events/loginEvents.java
|
fb2e0e66ed4d9fe3ffffae0be17a065e77a2df9e
|
[] |
no_license
|
xTimDevx/ScyleHavex
|
c9c224d6fcf0a766e0052dd3f2e737162e5f0dba
|
23dd61343c8a92812e0160f31457badfdc2043d3
|
refs/heads/master
| 2021-01-21T05:05:54.573914 | 2017-02-25T14:30:50 | 2017-02-25T14:30:50 | 83,134,303 | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 916 |
java
|
package me.xtimdevx.scylehavex.events;
import java.util.Date;
import java.util.TimeZone;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import me.xtimdevx.scylehavex.Main;
import me.xtimdevx.scylehavex.User;
public class loginEvents implements Listener{
public loginEvents(Main main) {
}
@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player player = e.getPlayer();
User user = User.get(player);
user.getFile().set("username", player.getName());
user.getFile().set("uuid", player.getUniqueId().toString());
user.getFile().set("ip", player.getAddress().getAddress().getHostAddress());
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
Date date = new Date();
user.getFile().set("lastlogin", date.getTime());
user.saveFile();
}
}
|
[
"[email protected]"
] | |
d73d0da16ff270c5ed74ef56ee67faf00ef6961a
|
1866ba7635ee7b8ed8c13c3ffeb3fe1de497a17b
|
/app/src/main/java/com/tourye/run/ui/adapter/CreateBattleAlbumAdapter.java
|
9c515367c4fee93c671a645f509a14941ae92a5d
|
[] |
no_license
|
Along-PC/yongyou_run
|
8a47dbb392da789b41e614cb8d6f5fe8b5a1724f
|
75b0146321b6e115bacc0992c74fbe3d2f56be88
|
refs/heads/master
| 2020-07-17T10:09:45.378635 | 2019-09-03T06:18:49 | 2019-09-03T06:18:49 | 206,000,094 | 1 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 6,953 |
java
|
package com.tourye.run.ui.adapter;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.luck.picture.lib.config.PictureConfig;
import com.luck.picture.lib.config.PictureMimeType;
import com.luck.picture.lib.entity.LocalMedia;
import com.luck.picture.lib.tools.DateUtils;
import com.luck.picture.lib.tools.StringUtils;
import com.tourye.run.R;
import com.tourye.run.base.BaseApplication;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
*
* @ClassName: GridImageAdapter
*
* @Author: along
*
* @Description: 创建战队相册适配器
*
* @CreateDate: 2019/4/9 3:25 PM
*
*/
public class CreateBattleAlbumAdapter extends RecyclerView.Adapter<CreateBattleAlbumAdapter.ViewHolder> {
public static final int TYPE_CAMERA = 1;
public static final int TYPE_PICTURE = 2;
private LayoutInflater mInflater;
private List<String> list = new ArrayList<>();
private int selectMax = 9;
private Context context;
private int mTotalWidth;
private int mDividerWidth;
/**
* 点击添加图片跳转
*/
private onAddPicClickListener mOnAddPicClickListener;
public interface onAddPicClickListener {
void onAddPicClick();
}
public CreateBattleAlbumAdapter(Context context, onAddPicClickListener mOnAddPicClickListener) {
this.context = context;
mInflater = LayoutInflater.from(context);
this.mOnAddPicClickListener = mOnAddPicClickListener;
}
public void setDividerData(int totalWidth,int dividerWidth){
mTotalWidth=totalWidth;
mDividerWidth=dividerWidth;
}
public void setSelectMax(int selectMax) {
this.selectMax = selectMax;
}
public void setList(List<String> list) {
this.list = list;
}
public class ViewHolder extends RecyclerView.ViewHolder {
ImageView mImg;
LinearLayout ll_del;
private RelativeLayout mRlGvFilterImage;
public ViewHolder(View view) {
super(view);
mImg = (ImageView) view.findViewById(R.id.fiv);
ll_del = (LinearLayout) view.findViewById(R.id.ll_del);
mRlGvFilterImage = (RelativeLayout) view.findViewById(R.id.rl_gv_filter_image);
}
}
@Override
public int getItemCount() {
if (list.size() < selectMax) {
return list.size() + 1;
} else {
return list.size();
}
}
@Override
public int getItemViewType(int position) {
if (isShowAddItem(position)) {
return TYPE_CAMERA;
} else {
return TYPE_PICTURE;
}
}
/**
* 创建ViewHolder
*/
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
View view = mInflater.inflate(R.layout.gv_filter_image,
viewGroup, false);
final ViewHolder viewHolder = new ViewHolder(view);
return viewHolder;
}
private boolean isShowAddItem(int position) {
int size = list.size() == 0 ? 0 : list.size();
return position == size;
}
/**
* 设置值
*/
@Override
public void onBindViewHolder(final ViewHolder viewHolder, final int position) {
int item_width = (mTotalWidth - mDividerWidth * 2) / 3;
ViewGroup.LayoutParams layoutParams = viewHolder.mRlGvFilterImage.getLayoutParams();
layoutParams.width=item_width;
layoutParams.height=item_width;
viewHolder.mRlGvFilterImage.setLayoutParams(layoutParams);
//少于8张,显示继续添加的图标
if (getItemViewType(position) == TYPE_CAMERA) {
viewHolder.mImg.setImageResource(R.drawable.addimg_1x);
viewHolder.mImg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mOnAddPicClickListener.onAddPicClick();
}
});
viewHolder.ll_del.setVisibility(View.INVISIBLE);
} else {
viewHolder.ll_del.setVisibility(View.VISIBLE);
viewHolder.ll_del.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int index = viewHolder.getAdapterPosition();
// 这里有时会返回-1造成数据下标越界,具体可参考getAdapterPosition()源码,
// 通过源码分析应该是bindViewHolder()暂未绘制完成导致
if (index != RecyclerView.NO_POSITION) {
list.remove(index);
notifyItemRemoved(index);
notifyItemRangeChanged(index, list.size());
//更新发表状态的文字
mOnItemDeleteListener.OnItemDelete(list,position);
}
}
});
String path = list.get(position);
RequestOptions requestOptions=new RequestOptions();
requestOptions.centerCrop()
.placeholder(R.color.color_f6)
.diskCacheStrategy(DiskCacheStrategy.ALL);
Glide.with(BaseApplication.mApplicationContext)
.load(path)
.apply(requestOptions)
.into(viewHolder.mImg);
//itemView 的点击事件
if (mItemClickListener != null) {
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int adapterPosition = viewHolder.getAdapterPosition();
mItemClickListener.onItemClick(adapterPosition, v);
}
});
}
}
}
protected OnItemClickListener mItemClickListener;
public interface OnItemClickListener {
void onItemClick(int position, View v);
}
public void setOnItemClickListener(OnItemClickListener listener) {
this.mItemClickListener = listener;
}
private OnItemDeleteListener mOnItemDeleteListener;
public interface OnItemDeleteListener{
public void OnItemDelete(List<String> list,int position);
}
public void setOnItemDeleteListener(OnItemDeleteListener onItemDeleteListener) {
mOnItemDeleteListener = onItemDeleteListener;
}
}
|
[
"[email protected]"
] | |
8abbb2c6d91930f6ef8444691cd01804bdf403ab
|
3ef0a831be1192274802e446034ce1ea29e0d7a8
|
/src/main/java/com/shixun/bean/Nation.java
|
5cfe99af8f41463a591cb4ffa3a78d6a2d341756
|
[] |
no_license
|
SYongheng/ihr_server
|
68503eea749294f498dd2f98191bf87d594f0c19
|
929ff6e2281058e7d8cd0ef98e3c55f4ae2c414b
|
refs/heads/master
| 2022-09-03T18:24:24.195435 | 2020-01-08T09:36:17 | 2020-01-08T09:36:17 | 232,462,316 | 4 | 1 | null | 2022-06-29T17:53:39 | 2020-01-08T02:42:14 |
TSQL
|
UTF-8
|
Java
| false | false | 870 |
java
|
package com.shixun.bean;
/**
* 民族类
*/
public class Nation {
//民族编号
private Long id;
//民族名称
private String name;
public Nation() {
}
public Nation(String name) {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Nation nation = (Nation) o;
return name != null ? name.equals(nation.name) : nation.name == null;
}
@Override
public int hashCode() {
return name != null ? name.hashCode() : 0;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
|
[
"[email protected]"
] | |
1047f53165468fa9c432ff4f3fc6db12313ce37a
|
86f03a48a5f01600a0c7e22b75f3f11e5d863832
|
/framework-db/framework-db-sh/src/main/java/com/fccfc/framework/db/spring/AutoProxyBeanFactory.java
|
6eebefe9f66aa22b902933fae0ba17136ebdfe3b
|
[] |
no_license
|
ligzy/framework
|
32a9f7a4a36652836c8ecfda099b10c95f4e1899
|
7daa636d1f989c40670101fbfd5ea50623eaf90b
|
refs/heads/master
| 2020-12-28T21:06:00.039098 | 2015-07-04T12:51:13 | 2015-07-04T12:51:13 | null | 0 | 0 | null | null | null | null |
UTF-8
|
Java
| false | false | 4,003 |
java
|
/****************************************************************************************
Copyright © 2003-2012 ZTEsoft Corporation. All rights reserved. Reproduction or <br>
transmission in whole or in part, in any form or by any means, electronic, mechanical <br>
or otherwise, is prohibited without the prior written consent of the copyright owner. <br>
****************************************************************************************/
package com.fccfc.framework.db.spring;
import java.util.List;
import java.util.Set;
import org.springframework.aop.framework.ProxyFactoryBean;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import com.fccfc.framework.common.utils.CommonUtil;
import com.fccfc.framework.common.utils.bean.BeanUtil;
import com.fccfc.framework.common.utils.logger.Logger;
import com.fccfc.framework.db.core.annotation.Dao;
import com.fccfc.framework.db.core.annotation.handler.SQLHandler;
/**
* <Description> <br>
*
* @author 王伟 <br>
* @version 1.0 <br>
* @CreateDate 2014年10月23日 <br>
* @see com.fccfc.framework.dao.beanfactory <br>
*/
public class AutoProxyBeanFactory implements BeanFactoryPostProcessor {
/**
* logger
*/
private static Logger logger = new Logger(AutoProxyBeanFactory.class);
/** 扫描路径 */
private List<String> packagesToScan;
/** interceptors */
private String[] interceptors;
/** SQL handler */
private SQLHandler handler;
/**
*
* Description: <br>
*
* @author yang.zhipeng <br>
* @taskId <br>
* @param beanFactory <br>
* @throws BeansException <br>
*/
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
try {
for (String pack : packagesToScan) {
if (CommonUtil.isNotEmpty(pack)) {
Set<Class<?>> clazzSet = BeanUtil.getClasses(pack);
String className = null;
for (Class<?> clazz : clazzSet) {
if (clazz.isAnnotationPresent(Dao.class)) {
className = clazz.getName();
logger.info("----->before set dao class[{0}]", className);
String beanName = CommonUtil.lowerCaseFirstChar(clazz.getSimpleName());
if (!beanFactory.containsBean(beanName)) {
// 此处不缓存SQL
// handler.invoke(clazz);
// 单独加载一个接口的代理类
ProxyFactoryBean factoryBean = new ProxyFactoryBean();
factoryBean.setBeanFactory(beanFactory);
factoryBean.setInterfaces(clazz);
factoryBean.setInterceptorNames(interceptors);
beanFactory.registerSingleton(beanName, factoryBean);
logger.info("Interface [{0}] init name is [{1}]", clazz.getName(), beanName);
}
logger.info("----->success set dao class[{0}]", className);
}
}
}
}
}
catch (Exception e) {
logger.error("------->自动扫描jar包失败", e);
}
}
public void setPackagesToScan(List<String> packagesToScan) {
this.packagesToScan = packagesToScan;
}
public void setInterceptors(String[] interceptors) {
this.interceptors = interceptors;
}
public void setHandler(SQLHandler handler) {
this.handler = handler;
}
}
|
[
"[email protected]"
] | |
5baf5ee62d977c079f41c392b6c74795de435d94
|
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/34/34_883248319712745e27df2547a069912fdb9724ee/TasksGeneral/34_883248319712745e27df2547a069912fdb9724ee_TasksGeneral_s.java
|
2b2a4faf003bc3cc84efaafe00106f96cb4f2ebc
|
[] |
no_license
|
zhongxingyu/Seer
|
48e7e5197624d7afa94d23f849f8ea2075bcaec0
|
c11a3109fdfca9be337e509ecb2c085b60076213
|
refs/heads/master
| 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null |
UTF-8
|
Java
| false | false | 2,510 |
java
|
package com.calendar.reporter;
import android.app.Activity;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Gravity;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import com.calendar.reporter.database.task.TaskDataSource;
import com.calendar.reporter.helper.DateListing;
import com.calendar.reporter.helper.LocalDate;
import com.calendar.reporter.helper.Session;
import com.calendar.reporter.helper.TableAdapter;
import android.widget.TableRow.LayoutParams;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class TasksGeneral extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.general);
SharedPreferences settings = getSharedPreferences(Session.PREFS_NAME, 0);
Session session = new Session(settings);
LocalDate localDate = new LocalDate(session.getDate(Session.GENERAL));
TextView lowerText = (TextView) findViewById(R.id.lowerTextGeneral);
lowerText.setText(localDate.getDayName());
TextView upperText = (TextView) findViewById(R.id.upperTextGeneral);
upperText.setText(localDate.getMonthName());
DateListing dateListing = new DateListing(this, session, Session.GENERAL);
dateListing.upperRightBehavior(R.id.upperRightGeneral);
dateListing.upperLeftBehavior(R.id.upperLeftGeneral);
dateListing.lowerRightBehavior(R.id.lowerRightGeneral);
dateListing.lowerLeftBehavior(R.id.lowerLeftGeneral);
TableLayout tableLayout = (TableLayout) findViewById(R.id.tableGeneral);
TaskDataSource taskDataSource = new TaskDataSource(this);
HashMap<String, String> generalInfo = taskDataSource.getGeneralInfo(session.getProjectId());
buidlTable(tableLayout, generalInfo);
}
private void buidlTable(TableLayout tableLayout, HashMap<String, String> generalInfo) {
Iterator it = generalInfo.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pairs = (Map.Entry) it.next();
TableAdapter tableAdapter = new TableAdapter(tableLayout, this);
tableAdapter.createRow((String) pairs.getKey(), (String) pairs.getValue());
it.remove(); // avoids a ConcurrentModificationException
}
}
}
|
[
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.