text stringlengths 10 2.72M |
|---|
package com.app.gamaacademy.cabrasdoagrest.bankline.config;
import java.util.ArrayList;
import java.util.List;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMethod;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.builders.ResponseMessageBuilder;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.service.ResponseMessage;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2).select()
.apis(RequestHandlerSelectors.basePackage("com.app.gamaacademy.cabrasdoagrest.bankline.controllers"))
.paths(PathSelectors.any()).build().useDefaultResponseMessages(false)
.globalResponseMessage(RequestMethod.GET, responseMessageForGet())
.globalResponseMessage(RequestMethod.POST, responseMessageForPost()).apiInfo(apiInfo());
}
@SuppressWarnings("serial")
private List<ResponseMessage> responseMessageForGet() {
return new ArrayList<ResponseMessage>() {
{
add(new ResponseMessageBuilder().code(HttpStatus.OK.value()).message(HttpStatus.OK.getReasonPhrase())
.build());
add(new ResponseMessageBuilder().code(HttpStatus.NOT_FOUND.value())
.message(HttpStatus.NOT_FOUND.getReasonPhrase()).build());
}
};
}
@SuppressWarnings("serial")
private List<ResponseMessage> responseMessageForPost() {
return new ArrayList<ResponseMessage>() {
{
add(new ResponseMessageBuilder().code(HttpStatus.OK.value()).message(HttpStatus.OK.getReasonPhrase())
.build());
add(new ResponseMessageBuilder().code(HttpStatus.BAD_REQUEST.value())
.message(HttpStatus.BAD_REQUEST.getReasonPhrase()).build());
}
};
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder().title("Api Bankline")
.description(
"Projeto final desenvolvido pelo time cabras do agREST no curso oferecido pela Gama Academy.")
.contact(new Contact("cabras do agREST",
"https://github.com/EmmanuelReis/bankline-gama-academy/tree/main", "gloureiro100@gmail.com"))
.build();
}
}
|
package ch24.ex24_02;
import java.util.Locale;
import java.util.Currency;
class CurrencyDisplay {
public static void main(String[] args) {
Locale[] locales = {
Locale.US,
Locale.CHINA,
Locale.FRANCE,
Locale.GERMANY,
Locale.JAPAN,
Locale.UK,
};
Currency[] currencies = {
Currency.getInstance("USD"),
Currency.getInstance("CNY"),
Currency.getInstance("DEM"),
Currency.getInstance("FRF"),
Currency.getInstance("JPY"),
Currency.getInstance("GBP"),
};
for (int i = 0; i < currencies.length; ++i) {
System.out.println(currencies[i] + ": " + currencies[i].getSymbol(locales[i]));
}
}
}
|
package com.espendwise.manta.i18n;
import com.espendwise.manta.util.Constants;
import com.espendwise.manta.util.IOUtility;
import com.espendwise.manta.util.ResourceNames;
import com.espendwise.manta.util.Utility;
import com.espendwise.manta.util.alert.AppLocale;
import com.espendwise.manta.util.alert.I18nResolvedOutput;
import com.espendwise.manta.util.alert.ResolvedOutput;
import com.espendwise.manta.util.parser.Parse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.NoSuchMessageException;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.ResourceLoader;
import javax.annotation.Resource;
import java.io.*;
import java.text.MessageFormat;
import java.util.*;
import java.util.concurrent.locks.ReentrantLock;
@Resource(mappedName = ResourceNames.MESSAGE_RESOURCE)
public class MessageResourceImpl implements StoreMessageResource {
private static Log logger = LogFactory.getLog(MessageResourceImpl.class);
private ResourceLoader resourceLoader = new DefaultResourceLoader();
private String resourceDirectory;
private String messagesPrefix;
private String messagesExt;
private String storeImplOn;
private I18nMessages i18nMessages;
private StoreLocales storeLocales;
private ReentrantLock lock;
private static final String DEFAULT_MESSAGE_PREFIX = "messages";
private static final String DEFAULT_MESSAGE_EXT = ".properties";
public void setResourceDirectory(String resourceDirectory) {
this.resourceDirectory = resourceDirectory;
}
public void setMessagesPrefix(String messagesPrefix) {
this.messagesPrefix = messagesPrefix;
}
public String getMessagesPrefix() {
return messagesPrefix == null ? DEFAULT_MESSAGE_PREFIX : messagesPrefix;
}
public String getMessagesExt() {
return messagesExt == null ? DEFAULT_MESSAGE_EXT : messagesExt;
}
public void setMessagesExt(String messagesExt) {
this.messagesExt = messagesExt;
}
public void setResourceLoader(ResourceLoader resourceLoader) {
this.resourceLoader = resourceLoader;
}
public String getResourceDirectory() {
return resourceDirectory;
}
public String getStoreImplOn() {
return storeImplOn;
}
public void setStoreImplOn(String storeImplOn) {
this.storeImplOn = storeImplOn;
}
public void init() throws IOException {
this.i18nMessages = new I18nMessages();
this.storeLocales = new StoreLocales();
this.lock = new ReentrantLock();
loadMessages();
}
public String getMessage(Long pStoreId,
Locale pLocale,
String key,
Object arg0,
Object arg1,
Object arg2,
Object arg3,
Object arg4,
String arg0Type,
String arg1Type,
String arg2Type,
String arg3Type,
String arg4Type) {
Object args[] = new Object[]{arg0, arg1, arg2, arg3, arg4};
String types[] = new String[]{arg0Type, arg1Type, arg2Type, arg3Type, arg4Type};
return getMessage(pStoreId, pLocale, key, args, types);
}
public String getMessage(Locale locale, String key, Object[] args) {
return getMessage(null, locale, key, args);
}
public String getMessage(Long storeId, Locale locale, String key) {
return getMessage(storeId, locale, key, new Object[0], new String[0]);
}
public String getMessage(Long storeId, Locale locale, String key, Object[] args) {
return getMessage(storeId, locale, key, args, new String[0]);
}
public String getMessage(Long pStoreId, Locale pLocale, String pKey, Object[] pArgs, String[] pTyps) {
if (pArgs != null) {
for (int i = 0; i < pArgs.length; i++) {
if (pArgs[i] == null) {
pArgs[i] = Constants.EMPTY;
}
}
}
StoreLocaleKey scratchLocale = getStoreLocaleKey(pStoreId, pLocale);
return getMessage(scratchLocale, pKey, pArgs);
}
public String getMessage(String pKey, Locale pLocale) {
return getMessage(null, pLocale, pKey, new Object[0], new String[0]);
}
public String getMessage(String key, AppLocale locale) {
return getMessage(null, locale == null ? null : locale.getLocale(), key, new Object[0], new String[0]);
}
public String getMessage(String pKey, Object[] pArgs) {
return getMessage(null, null, pKey, pArgs, new String[0]);
}
public String getMessage(StoreLocaleKey pLocaleKey, String pKey, Object pArgs[]) {
return getMessage(getI18nMessages(), pLocaleKey, pKey, pArgs);
}
private String getMessage(I18nMessages pI18nMessages, StoreLocaleKey pLocaleKey, String pKey, Object pArgs[]) {
if (pI18nMessages == null || pKey == null) {
return null;
}
logger.debug("getMessage()=> pLocaleKey=" + pLocaleKey + ", pKey=" + pKey);
String message = null;
I18nMessageValues<LocaleKey, String> map = pI18nMessages.get(pKey);
if (map != null) {
StoreLocaleKey.StoreLocaleKeyIterator keyIterator = pLocaleKey.getKeyIterator();
while (keyIterator.hasNext()) {
String lkey = keyIterator.next();
logger.debug("getMessage()=> searching " + pKey + " for locale " + lkey);
if (map.containsKey(new LocaleKey(lkey))) {
message = map.get(new LocaleKey(lkey));
logger.debug("getMessage()=> message for key " + pKey + " found in locale " + lkey + ", value: " + message);
break;
}
}
}
Locale locale = new Locale(pLocaleKey.getKeyPartLanguage(),
pLocaleKey.getKeyPartCountry(),
pLocaleKey.getKeyPartDialect()
);
Object[] args = new Object[pArgs == null ? 0 : pArgs.length];
if (pArgs != null) {
int i = 0;
for (Object arg : pArgs) {
if (arg instanceof I18nResolvedOutput) {
args[i++] = ((I18nResolvedOutput) arg).resolve(new AppLocale(locale));
} else if (arg instanceof ResolvedOutput) {
args[i++] = ((ResolvedOutput) arg).resolve();
} else {
args[i++] = String.valueOf(arg);
}
}
}
if (Utility.isSet(message)) {
MessageFormat format = new MessageFormat(Utility.escape(message));
format.setLocale(locale);
return format.format(args);
} else {
return message;
}
}
public synchronized void loadMessages() throws IOException {
logger.info("loadI18nMessages()=> BEGIN");
try {
lock.lockInterruptibly();
try {
i18nMessages = new I18nMessages();
File resourceDirectory = resourceLoader.getResource(getResourceDirectory()).getFile();
logger.info("loadI18nMessages()=> resourceDirectory: " + resourceDirectory.getAbsolutePath());
if (resourceDirectory.exists()) {
File[] i18nfiles = resourceDirectory.listFiles(new FilenameFilter() {
public boolean accept(File dir, String name) {
String ext = IOUtility.getFileExt(name);
return getMessagesExt().equalsIgnoreCase(ext) && name.startsWith(getMessagesPrefix());
}
});
logger.info("loadI18nMessages()=> i18nfiles.length: " + i18nfiles.length);
for (File file : i18nfiles) {
String ext = IOUtility.getFileExt(file.getName());
String key = file.getName().replaceAll(getMessagesPrefix(), Constants.EMPTY).replaceAll(ext, Constants.EMPTY);
key = Utility.isSet(key) ? key.substring(1) : null;
logger.info("loadI18nMessages()=> loading file: " + file.getName() + ", key: " + key);
if (Utility.isSet(key)) {
StoreLocaleKey storeLocaleKey = new StoreLocaleKey(key);
if (storeLocaleKey.isValid() && (!storeLocaleKey.isStore() || isStoreImplOn())) {
Properties props = new Properties();
try {
props.load(new InputStreamReader(new FileInputStream(file), Constants.ENCODING.UTF8));
} catch (IOException e) {
logger.error("loadI18nMessages()", e);
}
if (props.isEmpty()) {
continue;
}
for (Object o : props.keySet()) {
String mkey = (String) o;
I18nMessageValues<LocaleKey, String> i18nValues = i18nMessages.get(mkey);
if (i18nValues == null) {
i18nValues = new I18nMessageValues<LocaleKey, String>();
i18nMessages.put(mkey, i18nValues);
}
String messageValue = props.getProperty(mkey);
i18nValues.put(new LocaleKey(key), messageValue);
}
}
}
}
}
} finally {
lock.unlock();
}
} catch (InterruptedException e) {
logger.error(e.getMessage(), e);
}
logger.info("loadI18nMessages()=> i18nMessages.size: " + i18nMessages.size());
logger.info("loadI18nMessages()=> END.");
}
public I18nMessages getI18nMessages() {
return i18nMessages;
}
private String getDefaultLocaleKey() {
String defLocale = System.getProperty("i18n.messages.locale.default");
return Utility.isSet(defLocale) ? defLocale : Locale.ENGLISH.toString();
}
private boolean isStoreImplOn() {
return Utility.isTrue(getStoreImplOn());
}
public Map<Long, Map<String, StoreLocaleKey>> getStoreLocale() {
return storeLocales;
}
public StoreLocaleKey getStoreLocaleKey(Long pStoreId, Locale pLocale) {
logger.debug("getStoreLocaleKey()=> BEGIN. storeLocales: " + this.storeLocales + ", pLocale: " + pLocale);
Map<String, StoreLocaleKey> m = this.storeLocales.get(isStoreImplOn() ? pStoreId : null);
if (m == null) {
m = new HashMap<String, StoreLocaleKey>();
this.storeLocales.put(isStoreImplOn() ? pStoreId : null, m);
}
StoreLocaleKey v = m.get(pLocale.toString());
if (v == null) {
v = new StoreLocaleKey(isStoreImplOn() ? pStoreId : null, pLocale);
m.put(pLocale.toString(), v);
}
logger.debug("getStoreLocaleKey()=> END.");
return v;
}
@Override
public String getMessage(String s, Object[] objects, String s1, Locale locale) {
String message = getMessage(locale,
s,
objects
);
return message != null ? message : s1;
}
@Override
public String getMessage(String s, Object[] objects, Locale locale) throws NoSuchMessageException {
return getMessage(locale,
s,
objects
);
}
public class LocaleKey {
private String mKey;
public LocaleKey(String pKey) {
this.mKey = pKey;
}
public String toString() {
return mKey;
}
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
LocaleKey that = (LocaleKey) o;
return mKey.equals(that.mKey);
}
public int hashCode() {
return mKey.hashCode();
}
}
public interface II18nMessageValues<K, V> extends Serializable {
public Set<K> keySet();
public Collection<V> values();
public V put(K key, V daKa);
public V remove(K key);
public V get(K key);
public void clear();
public int size();
public boolean containsKey(K key);
}
public class I18nMessageValues<K, V> extends HashMap<K, V> implements II18nMessageValues<K, V> {
}
public class I18nMessages extends HashMap<String, I18nMessageValues<LocaleKey, String>> {
}
public class StoreLocales extends HashMap<Long, Map<String, StoreLocaleKey>> {
}
public class StoreLocaleKey {
private static final String LECALE_DELIM = "_";
Long mStoreId;
String mLanguage;
String mCountry;
String mDialect;
private List<String> mLocalesOrder;
public StoreLocaleKey(Long pStoreId, String pLanguage, String pCountry, String pDialect) {
init(pStoreId, pLanguage, pCountry, pDialect);
}
public StoreLocaleKey(String pStoreLocalKey) {
this.init(pStoreLocalKey);
}
public StoreLocaleKey(Long pStoreId, String pLocaleKey) {
init(pStoreId, pLocaleKey);
}
public StoreLocaleKey(Long pStoreId, Locale pLocale) {
init(pStoreId, pLocale.getLanguage(), pLocale.getCountry(), pLocale.getVariant());
}
public String getKey() {
return mLocalesOrder.get(0);
}
public StoreLocaleKeyIterator getKeyIterator() {
return new StoreLocaleKeyIterator(getLocaleOrder());
}
public Long getStore() {
return mStoreId;
}
public String getKeyPartLanguage() {
return mLanguage;
}
public String getKeyPartCountry() {
return mCountry;
}
public String getKeyPartDialect() {
return mDialect;
}
public List<String> getLocaleOrder() {
return mLocalesOrder;
}
private void init(String pStoreLocalKey) {
String localeKey = null;
Long storeId = null;
if (pStoreLocalKey != null) {
//break the locale key into the store local id and the remaining locale
//ex: passed in value = 1_en_US
// posibleStoreId = 1
// remainingLocaleKey = en_US
int pos = pStoreLocalKey.indexOf(LECALE_DELIM);
String posibleStoreId;
String remainingLocaleKey;
if (pos > 0) {
//split the locale key
posibleStoreId = pStoreLocalKey.substring(0, pos);
remainingLocaleKey = pStoreLocalKey.substring(pos + 1);
} else {
//assume that the store id is the only thing passed in
posibleStoreId = null;
remainingLocaleKey = pStoreLocalKey;
}
try {
if (Utility.isSet(posibleStoreId)) {
storeId = Parse.parseLong(posibleStoreId);
}
localeKey = remainingLocaleKey;
} catch (Exception e) {
storeId = null;
localeKey = pStoreLocalKey;
}
}
init(storeId, localeKey);
}
private void init(Long pStoreId, String pLocaleKey) {
String language = null;
String country = null;
String dialect = null;
StringTokenizer st = new StringTokenizer(pLocaleKey, LECALE_DELIM);
if (st.hasMoreElements()) {
int i = 0;
while (st.hasMoreElements()) {
switch (i) {
case 0: language = (String) st.nextElement(); break;
case 1:country = (String) st.nextElement(); break;
case 2:dialect = (String) st.nextElement(); break;
default: dialect += (Utility.isSet(dialect) ? LECALE_DELIM : Constants.EMPTY) + st.nextElement();
}
i++;
}
} else {
language = pLocaleKey;
}
init(pStoreId, language, country, dialect);
}
private void init(Long pStoreId, String pLanguage, String pCountry, String pDialect) {
this.mStoreId = pStoreId;
this.mLanguage = pLanguage;
this.mCountry = pCountry;
this.mDialect = pDialect;
this.mLocalesOrder = createLocaleOrder(pStoreId);
}
private List<String> createLocaleOrder(Long pStoreId) {
List<String> list = new ArrayList<String>();
String[] keyParts = getKeyParts();
if (pStoreId != null && isStoreImplOn()) {
fillList(list, pStoreId, true, keyParts);
fillList(list, null, true, keyParts);
} else {
fillList(list, null, true, keyParts);
}
return list;
}
private void fillList(List<String> pList, Long pStoreId, boolean pIncludeDefault, String... pKeyParts) {
for (int i = pKeyParts.length - 1; i >= 0; i--) {
String m = (pStoreId != null && isStoreImplOn() ? pStoreId.toString() + LECALE_DELIM : Constants.EMPTY);
String s = Constants.EMPTY;
for (int j = 0; j < i; j++) {
if (Utility.isSet(pKeyParts[j])) {
s += (Utility.isSet(s) ? LECALE_DELIM : Constants.EMPTY) + pKeyParts[j];
}
}
if (Utility.isSet(s)) {
m += s;
if (!pList.contains(m)) {
pList.add(m);
}
}
}
if (pIncludeDefault) {
String defaultLocale = (pStoreId != null && isStoreImplOn() ? pStoreId.toString() + LECALE_DELIM : Constants.EMPTY);
defaultLocale += getDefaultLocaleKey();
if (!pList.contains(defaultLocale)) {
pList.add(defaultLocale);
}
}
}
public String[] getKeyParts() {
return new String[]{getKeyPartLanguage(), getKeyPartCountry(), getKeyPartDialect()};
}
public boolean isStore() {
return mStoreId != null;
}
public boolean isValid() {
return Utility.isSet(mLanguage);
}
public class StoreLocaleKeyIterator implements Iterator {
Iterator<String> mIterator;
public StoreLocaleKeyIterator(List<String> pLocaleKeysOrder) {
mIterator = pLocaleKeysOrder.iterator();
}
public boolean hasNext() {
return mIterator.hasNext();
}
public String next() {
return mIterator.next();
}
public void remove() {
mIterator.remove();
}
}
public String toString() {
return getKey();
}
}
}
|
package myproject;
import java.util.Scanner;
class NegativeinputException extends Exception {
/**
*
*/
private static final long serialVersionUID = 1L;
NegativeinputException(String s){
super(s);
}
}
public class AverageException {
public static void main(String[] args) {
int sum = 0,i;
float average;
Scanner sc=new Scanner(System.in);
System.out.println("Enter how many numbers to calulate average:");
int n=sc.nextInt();
int[] numbers = new int[n];
System.out.println("Enter "+n+" Numbers");
for( i=0;i<numbers.length;i++)
numbers[i]=sc.nextInt();
sc.close();
for( i=0; i < numbers.length ; i++)
for( i=0; i < numbers.length ; i++) {
try
{
if(numbers[i] < 0)
{
throw new NegativeinputException("Numbers must be Positive!!! Enter inputs again..");
}
else{
sum += numbers[i]; }
}
catch (NegativeinputException e)
{
System.out.println("Exception Occurred. . "+e);
System.exit(0);
}
}sc.close();
average = sum / numbers.length;
System.out.println("Average of elements is : " + average);
}
} |
package com.magit.logic.system.objects;
import com.magit.logic.exceptions.IllegalPathException;
import com.magit.logic.exceptions.PreviousCommitsLimitExceededException;
import com.magit.logic.system.MagitEngine;
import com.magit.logic.system.managers.RepositoryManager;
import com.magit.logic.utils.file.FileHandler;
import com.magit.logic.utils.file.WorkingCopyUtils;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.ParseException;
import java.util.ArrayList;
public class ClonedRepository extends Repository {
private Repository repository;
private ClonedRepository(String mRepositoryLocation, String mRepositoryName) {
super(mRepositoryLocation, mRepositoryName);
}
@Override
protected void setRepositoryName(String name) {
super.setRepositoryName(name);
}
public static ClonedRepository getClone(Repository toClone, String clonedRepositoryName, String clonedRepositoryLocation){
Repository repository = toClone.clone();
ClonedRepository clonedRepository = new ClonedRepository(clonedRepositoryLocation,clonedRepositoryName);
clonedRepository.repository = repository;
clonedRepository.setRepositoryName(clonedRepositoryName);
clonedRepository.setBranches(repository.getBranches());
clonedRepository.setRemoteReference(new RemoteReference(repository.getRepositoryName(),repository.getmRepositoryLocation()));
clonedRepository.createRemoteTrackingBranchForHead();
return clonedRepository;
}
public void create() throws IOException, IllegalPathException {
createInitialMagitFolder();
createObjectsFiles();
createCommitsFile();
try {
RepositoryManager.unzipHeadBranchCommitWorkingCopy(this);
} catch (ParseException e) {
e.printStackTrace();
} catch (PreviousCommitsLimitExceededException e) {
e.printStackTrace();
}
}
private void createObjectsFiles() throws IOException {
if(Files.notExists(repository.getObjectsFolderPath())) return;
this.getObjectsFolderPath().toFile().mkdirs();
FileUtils.copyDirectory(repository.getObjectsFolderPath().toFile(),this.getObjectsFolderPath().toFile());
}
private void createInitialMagitFolder() throws IOException, IllegalPathException {
super.create();
}
private void createCommitsFile() throws IOException {
Path pathToOriginalCommitsFile = Paths.get(repository.getMagitFolderPath().toString(), "COMMITS");
Path pathToClonedCommitsFile = Paths.get(this.getMagitFolderPath().toString(), "COMMITS");
if(pathToOriginalCommitsFile.toFile().exists())
FileUtils.copyFile(pathToOriginalCommitsFile.toFile(), new File(pathToClonedCommitsFile.toString()));
}
private void createRemoteTrackingBranchForHead(){
Branch branch = repository.getBranches().get("HEAD");
branch.setIsTracking(true);
branch.setTrackingAfter(String.join("\\", repository.getRepositoryName(), branch.getBranchName()));
getBranches().put(branch.getBranchName(),branch);
}
}
|
package com.tencent.mm.plugin.freewifi.model;
import android.content.Intent;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import com.tencent.map.geolocation.TencentLocationListener;
import com.tencent.mm.plugin.freewifi.g.c;
import com.tencent.mm.plugin.freewifi.m;
import com.tencent.mm.sdk.platformtools.ad;
import com.tencent.mm.sdk.platformtools.ao;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public final class d {
private static Map<Integer, String> jjK = new HashMap<Integer, String>() {
{
put(Integer.valueOf(-1), "CONNECT_STATE_NOT_CONNECT");
put(Integer.valueOf(0), "CONNECT_STATE_NOT_WECHAT_WIFI");
put(Integer.valueOf(1), "CONNECT_STATE_CONNECTING");
put(Integer.valueOf(2), "CONNECT_STATE_CONNECT_SUCCESS");
put(Integer.valueOf(3), "CONNECT_STATE_CONNECT_FAILED");
put(Integer.valueOf(4), "CONNECT_STATE_WAIT_START");
}
};
public static int BX(String str) {
if (bi.oW(str)) {
x.d("MicroMsg.FreeWifi.FreeWifiManager", "Illegal SSID");
return 0;
}
c Cg = j.aOK().Cg(str);
if (Cg == null || !str.equalsIgnoreCase(Cg.field_ssid)) {
return 0;
}
if (Cg.field_connectState == 2 && Cg.field_expiredTime > 0 && Cg.field_expiredTime - bi.VE() <= 0) {
Cg.field_connectState = 1;
boolean c = j.aOK().c(Cg, new String[0]);
x.i("MicroMsg.FreeWifi.FreeWifiManager", "Expired, re-auth, expired time : %d, current time : %d, ret : %b", new Object[]{Long.valueOf(Cg.field_expiredTime), Long.valueOf(bi.VE()), Boolean.valueOf(c)});
}
return Cg.field_connectState;
}
public static void release() {
}
public static boolean BY(String str) {
x.i("MicroMsg.FreeWifi.FreeWifiManager", "check is wechat free wifi, ssid : %s", new Object[]{str});
if (bi.oW(str)) {
x.e("MicroMsg.FreeWifi.FreeWifiManager", "ssid is null or nil");
return false;
}
String aOz = aOz();
if (bi.oW(aOz) || !aOz.equals(str)) {
return false;
}
return true;
}
public static int BZ(String str) {
WifiManager wifiManager = (WifiManager) ad.getContext().getSystemService(TencentLocationListener.WIFI);
if (wifiManager == null) {
x.e("MicroMsg.FreeWifi.FreeWifiManager", "addWifiNetWork, get wifi manager failed");
return -11;
}
int Cb = Cb(str);
if (Cb > 0) {
x.i("MicroMsg.FreeWifi.FreeWifiManager", "addWifiNetWork, the network has exsited, just enable it");
} else {
WifiConfiguration wifiConfiguration = new WifiConfiguration();
wifiConfiguration.allowedAuthAlgorithms.clear();
wifiConfiguration.allowedGroupCiphers.clear();
wifiConfiguration.allowedKeyManagement.clear();
wifiConfiguration.allowedPairwiseCiphers.clear();
wifiConfiguration.allowedProtocols.clear();
wifiConfiguration.SSID = "\"" + str + "\"";
x.i("MicroMsg.FreeWifi.FreeWifiManager", "check is the same ssid is exist, %b", new Object[]{Boolean.valueOf(Ca(str))});
wifiConfiguration.allowedKeyManagement.set(0);
wifiConfiguration.wepTxKeyIndex = 0;
Cb = wifiManager.addNetwork(wifiConfiguration);
}
x.i("MicroMsg.FreeWifi.FreeWifiManager", "addWifiNetWork netid : %d, result : %b", new Object[]{Integer.valueOf(Cb), Boolean.valueOf(wifiManager.enableNetwork(Cb, true))});
if (wifiManager.enableNetwork(Cb, true)) {
return 0;
}
return -14;
}
public static int d(String str, String str2, int i, boolean z) {
x.i("MicroMsg.FreeWifi.FreeWifiManager", "addWifiNetWork by encrypt, ssid is : %s, password : %s, cryptType :%d, hideSSID = %b", new Object[]{str, str2, Integer.valueOf(i), Boolean.valueOf(z)});
if (bi.oW(str)) {
x.e("MicroMsg.FreeWifi.FreeWifiManager", "addWifiNetWork by encrypt alg failed, ssid is null");
return -12;
} else if (i == 0) {
return BZ(str);
} else {
if (bi.oW(str2)) {
x.e("MicroMsg.FreeWifi.FreeWifiManager", "encrypt type is not none, while password is null");
return -15;
}
WifiManager wifiManager = (WifiManager) ad.getContext().getSystemService(TencentLocationListener.WIFI);
if (wifiManager == null) {
x.e("MicroMsg.FreeWifi.FreeWifiManager", "addWifiNetWork by encrypt alg, get wifi manager failed");
return -11;
}
int addNetwork;
WifiConfiguration wifiConfiguration;
if (com.tencent.mm.compatible.util.d.fR(21)) {
if (!bi.oW(str)) {
List<WifiConfiguration> configuredNetworks = ((WifiManager) ad.getContext().getSystemService(TencentLocationListener.WIFI)).getConfiguredNetworks();
if (configuredNetworks != null) {
x.i("MicroMsg.FreeWifi.FreeWifiManager", "get wificonfiguration list size : %d", new Object[]{Integer.valueOf(configuredNetworks.size())});
for (WifiConfiguration wifiConfiguration2 : configuredNetworks) {
if (wifiConfiguration2.SSID.equals("\"" + str + "\"")) {
break;
}
}
}
x.e("MicroMsg.FreeWifi.FreeWifiManager", "get wifi list is null");
} else {
x.e("MicroMsg.FreeWifi.FreeWifiManager", "null or nill ssid");
}
wifiConfiguration2 = null;
if (wifiConfiguration2 == null) {
wifiConfiguration2 = v(str, str2, i);
wifiConfiguration2.hiddenSSID = z;
addNetwork = wifiManager.addNetwork(wifiConfiguration2);
} else {
if (wifiConfiguration2 != null) {
wifiConfiguration2.SSID = "\"" + str + "\"";
wifiConfiguration2.status = 2;
switch (i) {
case 1:
wifiConfiguration2.wepKeys = new String[]{"\"" + str2 + "\""};
wifiConfiguration2.allowedKeyManagement.set(0);
break;
case 2:
case 3:
wifiConfiguration2.preSharedKey = "\"" + str2 + "\"";
wifiConfiguration2.allowedKeyManagement.set(1);
break;
default:
x.e("MicroMsg.FreeWifi.FreeWifiManager", "unsupport encrypt type : %d", new Object[]{Integer.valueOf(i)});
break;
}
}
wifiConfiguration2.hiddenSSID = z;
addNetwork = wifiConfiguration2.networkId;
}
wifiManager.saveConfiguration();
} else {
addNetwork = Cb(str);
if (addNetwork > 0) {
boolean removeNetwork = wifiManager.removeNetwork(addNetwork);
x.i("MicroMsg.FreeWifi.FreeWifiManager", "this network has exist : %s, try to remove it : %b", new Object[]{str, Boolean.valueOf(removeNetwork)});
}
wifiConfiguration2 = v(str, str2, i);
wifiConfiguration2.hiddenSSID = z;
addNetwork = wifiManager.addNetwork(wifiConfiguration2);
wifiManager.saveConfiguration();
}
x.i("MicroMsg.FreeWifi.FreeWifiManager", "addWifiNetWork by encrypt alg, netid : %d, result : %b", new Object[]{Integer.valueOf(addNetwork), Boolean.valueOf(wifiManager.enableNetwork(addNetwork, true))});
if (wifiManager.enableNetwork(addNetwork, true)) {
return 0;
}
return -14;
}
}
private static WifiConfiguration v(String str, String str2, int i) {
WifiConfiguration wifiConfiguration = new WifiConfiguration();
wifiConfiguration.SSID = "\"" + str + "\"";
wifiConfiguration.status = 2;
switch (i) {
case 1:
wifiConfiguration.wepKeys = new String[]{"\"" + str2 + "\""};
wifiConfiguration.allowedKeyManagement.set(0);
break;
case 2:
case 3:
wifiConfiguration.preSharedKey = "\"" + str2 + "\"";
wifiConfiguration.allowedKeyManagement.set(1);
break;
default:
x.e("MicroMsg.FreeWifi.FreeWifiManager", "unsupport encrypt type : %d", new Object[]{Integer.valueOf(i)});
break;
}
return wifiConfiguration;
}
public static boolean isWifiEnabled() {
WifiManager wifiManager = (WifiManager) ad.getContext().getSystemService(TencentLocationListener.WIFI);
if (wifiManager == null) {
x.e("MicroMsg.FreeWifi.FreeWifiManager", "get wifi manager failed");
return false;
}
x.i("MicroMsg.FreeWifi.FreeWifiManager", "is wifi enalbe now : %b", new Object[]{Boolean.valueOf(wifiManager.isWifiEnabled())});
return wifiManager.isWifiEnabled();
}
public static boolean aOw() {
WifiManager wifiManager = (WifiManager) ad.getContext().getSystemService(TencentLocationListener.WIFI);
if (wifiManager != null) {
return wifiManager.setWifiEnabled(true);
}
x.e("MicroMsg.FreeWifi.FreeWifiManager", "get wifi manager failed");
return false;
}
public static boolean Ca(String str) {
int Cb = Cb(str);
x.i("MicroMsg.FreeWifi.FreeWifiManager", "get network id by ssid :%s, netid is %d", new Object[]{str, Integer.valueOf(Cb)});
if (Cb == -1) {
x.i("MicroMsg.FreeWifi.FreeWifiManager", "ssid is not exist : %s", new Object[]{str});
return false;
}
WifiManager wifiManager = (WifiManager) ad.getContext().getSystemService(TencentLocationListener.WIFI);
boolean removeNetwork = wifiManager.removeNetwork(Cb);
wifiManager.saveConfiguration();
x.i("MicroMsg.FreeWifi.FreeWifiManager", "remove ssid : %s, ret = %b", new Object[]{str, Boolean.valueOf(removeNetwork)});
return removeNetwork;
}
private static int Cb(String str) {
if (bi.oW(str)) {
x.e("MicroMsg.FreeWifi.FreeWifiManager", "null or nill ssid");
return -1;
}
List<WifiConfiguration> configuredNetworks = ((WifiManager) ad.getContext().getSystemService(TencentLocationListener.WIFI)).getConfiguredNetworks();
if (configuredNetworks == null) {
x.e("MicroMsg.FreeWifi.FreeWifiManager", "get wifi list is null");
return -1;
}
x.i("MicroMsg.FreeWifi.FreeWifiManager", "get wificonfiguration list size : %d", new Object[]{Integer.valueOf(configuredNetworks.size())});
for (WifiConfiguration wifiConfiguration : configuredNetworks) {
if (wifiConfiguration.SSID.equals("\"" + str + "\"")) {
return wifiConfiguration.networkId;
}
}
return -1;
}
public static String pZ(int i) {
String str = (String) jjK.get(Integer.valueOf(i));
if (str == null) {
return "";
}
return str;
}
public static void a(String str, int i, Intent intent) {
x.i("MicroMsg.FreeWifi.FreeWifiManager", "sessionKey=%s, step=%d, method=FreeWifiManager.updateConnectState, desc=it changes the connect state of the model to %s. state=%d", new Object[]{m.E(intent), Integer.valueOf(m.F(intent)), pZ(i), Integer.valueOf(i)});
c Cg = j.aOK().Cg(str);
if (Cg != null) {
Cg.field_connectState = i;
boolean c = j.aOK().c(Cg, new String[0]);
x.i("MicroMsg.FreeWifi.FreeWifiManager", "update %s, connect state : %d, return : %b", new Object[]{str, Integer.valueOf(i), Boolean.valueOf(c)});
}
}
public static String aOx() {
if (ao.getNetType(ad.getContext()) == 0) {
WifiInfo aOA = aOA();
if (!(aOA == null || aOA.getBSSID() == null)) {
x.i("MicroMsg.FreeWifi.FreeWifiManager", "getConnectWifiMacAddress, get bssid now : %s", new Object[]{aOA.getBSSID()});
return aOA.getBSSID();
}
}
return null;
}
public static int aOy() {
if (ao.getNetType(ad.getContext()) == 0) {
WifiInfo aOA = aOA();
if (aOA != null) {
x.i("MicroMsg.FreeWifi.FreeWifiManager", "getConnectWifiSignal, get rssi now : %d", new Object[]{Integer.valueOf(aOA.getRssi())});
return aOA.getRssi();
}
}
return 0;
}
public static String aOz() {
x.i("MicroMsg.FreeWifi.FreeWifiManager", "networkType = %d", new Object[]{Integer.valueOf(ao.getNetType(ad.getContext()))});
if (ao.getNetType(ad.getContext()) == 0) {
WifiInfo aOA = aOA();
if (!(aOA == null || aOA.getSSID() == null)) {
x.i("MicroMsg.FreeWifi.FreeWifiManager", "get ssid now : %s", new Object[]{aOA.getSSID().replace("\"", "")});
return aOA.getSSID().replace("\"", "");
}
}
return null;
}
public static WifiInfo aOA() {
WifiManager wifiManager = (WifiManager) ad.getContext().getSystemService(TencentLocationListener.WIFI);
if (wifiManager == null) {
x.e("MicroMsg.FreeWifi.FreeWifiManager", "get wifi manager failed");
return null;
}
try {
return wifiManager.getConnectionInfo();
} catch (Exception e) {
x.e("MicroMsg.FreeWifi.FreeWifiManager", "getConnectionInfo failed : %s", new Object[]{e.getMessage()});
return null;
}
}
public static String aOB() {
WifiManager wifiManager = (WifiManager) ad.getContext().getSystemService(TencentLocationListener.WIFI);
if (wifiManager == null) {
x.e("MicroMsg.FreeWifi.FreeWifiManager", "get wifi manager failed");
return "";
}
try {
WifiInfo connectionInfo = wifiManager.getConnectionInfo();
if (connectionInfo == null) {
return "";
}
String bssid = connectionInfo.getBSSID();
if (bssid == null) {
return "";
}
return bssid;
} catch (Exception e) {
x.e("MicroMsg.FreeWifi.FreeWifiManager", "getConnectWifiBssid failed : %s", new Object[]{e.getMessage()});
return "";
}
}
public static String aOC() {
WifiManager wifiManager = (WifiManager) ad.getContext().getSystemService(TencentLocationListener.WIFI);
if (wifiManager == null) {
x.e("MicroMsg.FreeWifi.FreeWifiManager", "get wifi manager failed");
return "";
}
try {
WifiInfo connectionInfo = wifiManager.getConnectionInfo();
if (connectionInfo == null) {
return "";
}
String ssid = connectionInfo.getSSID();
if (ssid == null) {
return "";
}
return m.BQ(ssid);
} catch (Exception e) {
x.e("MicroMsg.FreeWifi.FreeWifiManager", "getConnectWifiBssid failed : %s", new Object[]{e.getMessage()});
return "";
}
}
public static int getNetworkType() {
return ao.getNetType(ad.getContext());
}
}
|
package com.example.githubsample;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonArrayRequest;
import org.json.JSONArray;
public class HomeActivity extends AppCompatActivity {
private static final String TAG = HomeActivity.class.getSimpleName();
private Button getUsersBtn;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
getUsersBtn = (Button) findViewById(R.id.get_all_users_btn);
getUsersBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
RequestQueue requestQueue = VolleyAppController.getInstance().getRequestQueue();
String url = Constants.BASE_URL+"/users";
JsonArrayRequest userRequest = new JsonArrayRequest(Request.Method.GET,
url, new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
Bundle bundle = new Bundle();
bundle.put
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
})
}
});
}
}
|
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
/**
* Created by Iwan on 14.2.3.
*/
public class FairSquare {
static char[] digits = "0123456789".toCharArray();
static List<Long> fairSquares;
public static void main(String[] args) {
generateList(10000000);
FileManager fm;
/*fm = new FileManager(
"D:\\Google2013\\C-small-practice.in",
"D:\\Google2013\\C-small-practice.out");*/
/*
fm = new FileManager(
"D:\\Google2013\\C-large-practice-1.in",
"D:\\Google2013\\C-large-practice-1.out");
int k = fm.getCases();
System.out.println("Cases: " + k);
for (int j = 1; j <= k; j++) {
long[] bounds = fm.getLongVector();
long min = bounds[0];
long max = bounds[1];
Iterator x = fairSquares.listIterator(0);
int p = 0;
Long i = Long.valueOf(0);
while (x.hasNext()) {
i = (Long) x.next();
//System.out.println(i);
if (i >= min) {
p++;
break;
}
}
if (i > max) {
p--;
} else
while (x.hasNext()) {
i = (Long) x.next();
p++;
//System.out.println(i);
if (i > max) {
p--;
break;
}
}
System.out.println(min + " " + max + ": " + p);
String answer = "Case #" + j + ": " + p;
System.out.println(answer);
fm.sendLine(answer);
}
fm.finish();
*/
}
public static void generateList(long max) {
fairSquares = new LinkedList<Long>();
generateFairSquares(max);
Collections.sort(fairSquares);
System.out.println("List:");
for (Long i : fairSquares) {
System.out.format("%d\t\t\t%.0f%n", i, Math.sqrt(i));
}
}
public static void generateFairSquares(long max) {
for (int j = 1; j <= 9; j++) {
//System.out.println(j);
check(j);
}
String x;
String r;
for (long i = 1; i <= max; i++) {
String s = Long.toString(i);
//System.out.println(s);
r = reverse(s);
x = s + r;
check(x);
for (char c : digits) {
x = s + c + r;
check(x);
}
}
}
public static void check(String s) {
long i = Long.parseLong(s);
check(i);
}
public static void check(long d) {
long x = d * d;
//System.out.format("%.0f\t\t\t%.0f%n", d, x);
if (isPalindrome(x)) {
fairSquares.add(x);
}
}
public static String reverse(String s) {
return new StringBuilder(s).reverse().toString();
}
public static boolean isPalindrome(long i) {
String s = Long.toString(i);
return isPalindrome(s);
}
public static boolean isPalindrome(String s) {
int n = s.length();
int k = n / 2;
boolean p;// = true;
for (int i = 0; i < k; i++) {
/*System.out.println("Step " + i);
System.out.println("Comparing " + s.charAt(i) + " and " +
s.charAt(n - i - 1));*/
p = s.charAt(i) == s.charAt(n - i - 1);
/*System.out.println("Result: " + p);*/
if (!p) return false;
}
return true;
}
}
|
package com.zhonghuilv.shouyin.controller;
import com.zhonghuilv.shouyin.common.BasicController;
import com.zhonghuilv.shouyin.mapper.OrderBackMapper;
import com.zhonghuilv.shouyin.pojo.OrderBack;
import com.zhonghuilv.shouyin.result.ApiResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import java.time.LocalDateTime;
import java.util.List;
/**
* Created by mengfanguang on 2018-07-04 17:13:47
*/
@RestController
@RequestMapping("/order_back")
@Api(value = "OrderBackController", description = "订单退货表")
public class OrderBackController extends BasicController<OrderBack> {
private OrderBackMapper orderBackMapper;
@Autowired
public OrderBackController(OrderBackMapper orderBackMapper) {
super(orderBackMapper);
this.orderBackMapper =orderBackMapper;
}
@Override
@ApiOperation(value="新增退款单",notes = "新增退款单",tags = "订单管理",response = OrderBack.class)
@PostMapping(value = "")
public ApiResult<OrderBack> save(@RequestBody OrderBack model){
return super.save(model);
}
}
|
package com.ibm.training.bootcamp.rest.sample01.domain;
public class ExpenseCategory {
Long id;
private String categoryName;
public ExpenseCategory() {
}
public ExpenseCategory(String categoryName) {
this(null, categoryName);
}
public ExpenseCategory(Long id, String categoryName) {
this.id = id;
this.categoryName = categoryName;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getCategoryName() {
return categoryName;
}
public void setCategoryName(String categoryName) {
this.categoryName = categoryName;
}
}
|
/** ****************************************************************************
* Copyright (c) The Spray Project.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Spray Dev Team - initial API and implementation
**************************************************************************** */
package org.eclipselabs.spray.shapes.generator;
import org.eclipse.jdt.core.formatter.CodeFormatter;
import org.eclipse.xtext.generator.IFileSystemAccess;
import org.eclipse.xtext.generator.IOutputConfigurationProvider;
import org.eclipse.xtext.service.AbstractGenericModule;
import org.eclipselabs.spray.xtext.generator.IPostProcessor;
import org.eclipselabs.spray.xtext.generator.filesystem.JavaIoFileSystemAccessExt;
import org.eclipselabs.spray.xtext.generator.formatting.CodeFormatterProvider;
import org.eclipselabs.spray.xtext.generator.formatting.JavaPostProcessor;
import org.eclipselabs.spray.xtext.generator.importmanager.ImportUtil;
import org.eclipselabs.spray.xtext.generator.outputconfig.SprayOutputConfigurationProvider;
import com.google.inject.Binder;
import com.google.inject.Scopes;
import com.google.inject.name.Names;
public class ShapesGeneratorModule extends AbstractGenericModule {
@Override
public void configure(Binder binder) {
super.configure(binder);
binder.bind(ImportUtil.class).in(Scopes.SINGLETON);
}
public Class<? extends org.eclipse.xtext.generator.IGenerator> bindIGenerator() {
return ShapeGenerator.class;
}
public Class<? extends IFileSystemAccess> bindJavaIoFileSystemAccess() {
return JavaIoFileSystemAccessExt.class;
}
public void configureCodeFormatterProvider(Binder binder) {
binder.bind(CodeFormatter.class).toProvider(CodeFormatterProvider.class);
}
public void configureJavaPostProcessor(Binder binder) {
binder.bind(IPostProcessor.class).annotatedWith(Names.named("java")).to(JavaPostProcessor.class);
}
public void configureJavaFormatterConfig(Binder binder) {
binder.bind(String.class).annotatedWith(Names.named(CodeFormatterProvider.JDT_FORMATTER_CONFIG)).toInstance("org/eclipselabs/spray/xtext/generator/formatting/formatter.xml");
}
public Class<? extends IOutputConfigurationProvider> bindIOutputConfigurationProvider() {
return SprayOutputConfigurationProvider.class;
}
}
|
package ua.lviv.lgs.application;
import java.util.HashSet;
import java.util.Set;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import ua.lviv.lgs.model.Cart;
import ua.lviv.lgs.model.Item;
public class Application {
public static void main(String[] args) {
Configuration configuration = new Configuration();
configuration.configure("hibernate.cfg.xml");
SessionFactory sessionFactory = configuration.buildSessionFactory();
Session session = sessionFactory.openSession();
session.getTransaction().begin();;
Item item1 = new Item();
item1.setTotal(19.0);
Item item2 = new Item();
item2.setTotal(23.0);
Item item3 = new Item();
item3.setTotal(56.0);
Item item4 = new Item();
item4.setTotal(6.0);
Set<Item> items = new HashSet<>();
items.add(item1);
items.add(item2);
items.add(item3);
items.add(item4);
Cart cart = new Cart();
cart.setName("cart1");
cart.setTotal(120.0);
cart.setItems(items);
session.persist(cart);
session.getTransaction().commit();
}
}
|
/*
* Copyright © 2019 The GWT Project Authors
*
* 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 org.gwtproject.dom.builder.client;
import org.gwtproject.dom.builder.shared.TableCellBuilder;
import org.gwtproject.dom.client.TableCellElement;
/** DOM-based implementation of {@link TableCellBuilder}. */
public class DomTableCellBuilder extends DomElementBuilderBase<TableCellBuilder, TableCellElement>
implements TableCellBuilder {
DomTableCellBuilder(DomBuilderImpl delegate) {
super(delegate);
}
@Override
public TableCellBuilder align(String align) {
assertCanAddAttribute().setAlign(align);
return this;
}
@Override
public TableCellBuilder ch(String ch) {
assertCanAddAttribute().setCh(ch);
return this;
}
@Override
public TableCellBuilder chOff(String chOff) {
assertCanAddAttribute().setChOff(chOff);
return this;
}
@Override
public TableCellBuilder colSpan(int colSpan) {
assertCanAddAttribute().setColSpan(colSpan);
return this;
}
@Override
public TableCellBuilder headers(String headers) {
assertCanAddAttribute().setHeaders(headers);
return this;
}
@Override
public TableCellBuilder rowSpan(int rowSpan) {
assertCanAddAttribute().setRowSpan(rowSpan);
return this;
}
@Override
public TableCellBuilder vAlign(String vAlign) {
assertCanAddAttribute().setVAlign(vAlign);
return this;
}
}
|
package boj;
class member{
String name;
int id;
public member(){}
public member(String name){
this.name =name;
}
public member(String name, int id) {
this.name = name;
this.id = id;
}
public void go() {
System.out.println("go");
}
public void go(int b, String x) {
System.out.println("go");
}
public void go(int a) {
System.out.println("go");
}
}
public class test {
public static void main(String[] args) {
member m = new member("aa");
System.out.println(m.name);
System.out.println(m.id);
}
}
|
/*
* Copyright 2002-2016 the original author or authors.
*
* 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.niubimq.service.impl;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.niubimq.dao.ProducerManageDao;
import com.niubimq.pojo.Producer;
import com.niubimq.service.ProducerManageService;
/**
* @Description:
* @author junjin4838
* @version 1.0
*/
@Service
@Transactional
public class ProducerManageServiceImpl implements ProducerManageService {
@Autowired
private ProducerManageDao producerManageDao;
/**
* 查询生产者信息
*/
public List<Producer> showProducer(String producerSign) {
List<Producer> producerList = producerManageDao.selectProducer(producerSign);
return producerList;
}
/**
* 新增生产者信息
* */
public void addProducer(Producer producer) {
producerManageDao.deleteProducer(producer);
producerManageDao.insertProducer(producer);
}
/**
* 删除生产者信息
* */
public void deleteProducer(Producer p) {
producerManageDao.deleteProducer(p);
}
/**
* 修改生产者信息
* */
public void updateProducer(Producer producer) {
producerManageDao.updateProducer(producer);
}
/**
* 校验生产者内置参数
*/
public String validateProducerParams(Producer producer) {
String errMsg = "";
if(StringUtils.isEmpty(producer.getProducerSign())){
errMsg = "生产者标识不能为空";
return errMsg;
}else if(StringUtils.isEmpty(producer.getDescription())){
errMsg = "生产者需求不能为空";
return errMsg;
}
return errMsg;
}
}
|
/*
* 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.
*/
/**
* Josué Cifuentes 15275
* Pablo Muñoz 15258
* @author Josue
*/
public class Paciente implements Comparable<Paciente>{
private String nombre;
private String enfermedad;
private String prioridad;
/**
*
* @param nombre
* @param enfermedad
* @param prioridad
*/
public Paciente(String nombre, String enfermedad, String prioridad) {
this.nombre = nombre;
this.enfermedad = enfermedad;
this.prioridad = prioridad;
}
/**
*
* @return
*/
public String getNombre() {
return nombre;
}
/**
*
* @param nombre
*/
public void setNombre(String nombre) {
this.nombre = nombre;
}
/**
*
* @return
*/
public String getEnfermedad() {
return enfermedad;
}
/**
*
* @param enfermedad
*/
public void setEnfermedad(String enfermedad) {
this.enfermedad = enfermedad;
}
/**
*
* @return
*/
public String getPrioridad() {
return prioridad;
}
/**
*
* @param prioridad
*/
public void setPrioridad(String prioridad) {
this.prioridad = prioridad;
}
@Override
public String toString() {
return nombre + ", " + enfermedad + ", "+ prioridad;
}
@Override
//Compara la prioridad del paciente actual con la del paciente o.
/**
*
* @param o
* @return
*/
public int compareTo(Paciente o) {
String priority = o.getPrioridad();
return prioridad.compareTo(priority);
}
}
|
package com.smxknife.softmarket.usermgr;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(scanBasePackages = "com.smxknife.softmarket")
public class UserMgrBoot {
public static void main(String[] args) {
SpringApplication.run(UserMgrBoot.class, args);
}
}
|
package system.enums;
/**
* @Author: mol
* @Description:
* @Date: create in 15:06 2018/3/26
*/
public enum BuildAreaEnum {
SCHOOL("school","学校"),
AREA("area","地区"),
;
private String type;
private String desc;
BuildAreaEnum(String type,String desc){
this.type = type;
this.desc = desc;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
|
package com.spring.domain;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="sme_dealer_lender_loan_approval_file")
public class DealerLenderLoanApprovalFile implements java.io.Serializable {
/**
*
*/
private static final long serialVersionUID = 2344259487198155458L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
private long id;
private Integer Innoviti_Application_Id ;
private String Offer_Id ;
private String External_Seller_Id ;
private String Loan_Amount ;
private String Loan_Preference ;
private String Loan_Tenure ;
private String Applying_as ;
private String Seller_Display_Name ;
private String Name_of_business ;
private String Office_Building_No ;
private String Office_Street ;
private String Office_Locality ;
private String Office_City ;
private String Office_State ;
private String Office_Pin_Code ;
private String Office_Contact_No ;
private String Email_ID ;
private String PAN ;
private String TAN ;
private String VAT_TIN ;
private String Date_of_incorporation ;
private String Contact_number ;
private String Share_holding_percentage ;
private String First_Name ;
private String Middle_Name ;
private String Last_Name ;
private String Date_of_Birth ;
private String Gender ;
private String PARTNER_PAN ;
private String Mobile_number ;
private String House_Flat_No ;
private String Street ;
private String Locality ;
private String City ;
private String State ;
private String Pin_code ;
private String Loan_account_number ;
private String Approved_Loan_amount ;
private String Limit_Active ;
private String nach_number ;
private String nach_status ;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public Integer getInnoviti_Application_Id() {
return Innoviti_Application_Id;
}
public void setInnoviti_Application_Id(Integer innoviti_Application_Id) {
Innoviti_Application_Id = innoviti_Application_Id;
}
public String getOffer_Id() {
return Offer_Id;
}
public void setOffer_Id(String offer_Id) {
Offer_Id = offer_Id;
}
public String getExternal_Seller_Id() {
return External_Seller_Id;
}
public void setExternal_Seller_Id(String external_Seller_Id) {
External_Seller_Id = external_Seller_Id;
}
public String getLoan_Amount() {
return Loan_Amount;
}
public void setLoan_Amount(String loan_Amount) {
Loan_Amount = loan_Amount;
}
public String getLoan_Preference() {
return Loan_Preference;
}
public void setLoan_Preference(String loan_Preference) {
Loan_Preference = loan_Preference;
}
public String getLoan_Tenure() {
return Loan_Tenure;
}
public void setLoan_Tenure(String loan_Tenure) {
Loan_Tenure = loan_Tenure;
}
public String getApplying_as() {
return Applying_as;
}
public void setApplying_as(String applying_as) {
Applying_as = applying_as;
}
public String getSeller_Display_Name() {
return Seller_Display_Name;
}
public void setSeller_Display_Name(String seller_Display_Name) {
Seller_Display_Name = seller_Display_Name;
}
public String getName_of_business() {
return Name_of_business;
}
public void setName_of_business(String name_of_business) {
Name_of_business = name_of_business;
}
public String getOffice_Building_No() {
return Office_Building_No;
}
public void setOffice_Building_No(String office_Building_No) {
Office_Building_No = office_Building_No;
}
public String getOffice_Street() {
return Office_Street;
}
public void setOffice_Street(String office_Street) {
Office_Street = office_Street;
}
public String getOffice_Locality() {
return Office_Locality;
}
public void setOffice_Locality(String office_Locality) {
Office_Locality = office_Locality;
}
public String getOffice_City() {
return Office_City;
}
public void setOffice_City(String office_City) {
Office_City = office_City;
}
public String getOffice_State() {
return Office_State;
}
public void setOffice_State(String office_State) {
Office_State = office_State;
}
public String getOffice_Pin_Code() {
return Office_Pin_Code;
}
public void setOffice_Pin_Code(String office_Pin_Code) {
Office_Pin_Code = office_Pin_Code;
}
public String getOffice_Contact_No() {
return Office_Contact_No;
}
public void setOffice_Contact_No(String office_Contact_No) {
Office_Contact_No = office_Contact_No;
}
public String getEmail_ID() {
return Email_ID;
}
public void setEmail_ID(String email_ID) {
Email_ID = email_ID;
}
public String getPAN() {
return PAN;
}
public void setPAN(String pAN) {
PAN = pAN;
}
public String getTAN() {
return TAN;
}
public void setTAN(String tAN) {
TAN = tAN;
}
public String getVAT_TIN() {
return VAT_TIN;
}
public void setVAT_TIN(String vAT_TIN) {
VAT_TIN = vAT_TIN;
}
public String getDate_of_incorporation() {
return Date_of_incorporation;
}
public void setDate_of_incorporation(String date_of_incorporation) {
Date_of_incorporation = date_of_incorporation;
}
public String getContact_number() {
return Contact_number;
}
public void setContact_number(String contact_number) {
Contact_number = contact_number;
}
public String getShare_holding_percentage() {
return Share_holding_percentage;
}
public void setShare_holding_percentage(String share_holding_percentage) {
Share_holding_percentage = share_holding_percentage;
}
public String getFirst_Name() {
return First_Name;
}
public void setFirst_Name(String first_Name) {
First_Name = first_Name;
}
public String getMiddle_Name() {
return Middle_Name;
}
public void setMiddle_Name(String middle_Name) {
Middle_Name = middle_Name;
}
public String getLast_Name() {
return Last_Name;
}
public void setLast_Name(String last_Name) {
Last_Name = last_Name;
}
public String getDate_of_Birth() {
return Date_of_Birth;
}
public void setDate_of_Birth(String date_of_Birth) {
Date_of_Birth = date_of_Birth;
}
public String getGender() {
return Gender;
}
public void setGender(String gender) {
Gender = gender;
}
public String getPARTNER_PAN() {
return PARTNER_PAN;
}
public void setPARTNER_PAN(String pARTNER_PAN) {
PARTNER_PAN = pARTNER_PAN;
}
public String getMobile_number() {
return Mobile_number;
}
public void setMobile_number(String mobile_number) {
Mobile_number = mobile_number;
}
public String getHouse_Flat_No() {
return House_Flat_No;
}
public void setHouse_Flat_No(String house_Flat_No) {
House_Flat_No = house_Flat_No;
}
public String getStreet() {
return Street;
}
public void setStreet(String street) {
Street = street;
}
public String getLocality() {
return Locality;
}
public void setLocality(String locality) {
Locality = locality;
}
public String getCity() {
return City;
}
public void setCity(String city) {
City = city;
}
public String getState() {
return State;
}
public void setState(String state) {
State = state;
}
public String getPin_code() {
return Pin_code;
}
public void setPin_code(String pin_code) {
Pin_code = pin_code;
}
public String getLoan_account_number() {
return Loan_account_number;
}
public void setLoan_account_number(String loan_account_number) {
Loan_account_number = loan_account_number;
}
public String getApproved_Loan_amount() {
return Approved_Loan_amount;
}
public void setApproved_Loan_amount(String approved_Loan_amount) {
Approved_Loan_amount = approved_Loan_amount;
}
public String getLimit_Active() {
return Limit_Active;
}
public void setLimit_Active(String limit_Active) {
Limit_Active = limit_Active;
}
public String getNach_number() {
return nach_number;
}
public void setNach_number(String nach_number) {
this.nach_number = nach_number;
}
public String getNach_status() {
return nach_status;
}
public void setNach_status(String nach_status) {
this.nach_status = nach_status;
}
}
|
package org.iptc.extra.core.eql.tree.visitor;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.iptc.extra.core.daos.RulesDAO;
import org.iptc.extra.core.eql.EQLParser;
import org.iptc.extra.core.eql.tree.SyntaxTree;
import org.iptc.extra.core.eql.tree.nodes.ErrorMessageNode;
import org.iptc.extra.core.eql.tree.nodes.ReferenceClause;
import org.iptc.extra.core.types.Rule;
public class ReferenceClausesVisitor extends SyntaxTreeVisitor<List<ErrorMessageNode>> {
private RulesDAO dao;
private Set<String> ruleIds = new HashSet<String>();
public ReferenceClausesVisitor(RulesDAO dao, String rootRuleId) {
this.dao = dao;
ruleIds.add(rootRuleId);
}
@Override
public List<ErrorMessageNode> visitReferenceClause(ReferenceClause referenceClause) {
List<ErrorMessageNode> errors = new ArrayList<ErrorMessageNode>();
String ruleId = referenceClause.getRuleId();
if(ruleIds.contains(ruleId)) {
referenceClause.setValid(false);
ErrorMessageNode errorNode = new ErrorMessageNode();
errorNode.setErrorMessage("Cyclic reference: " + ruleIds + " - " + ruleId);
errors.add(errorNode);
}
else {
ruleIds.add(ruleId);
Rule rule = dao.get(ruleId);
if(rule != null) {
referenceClause.setRule(rule);
String referencedEql = rule.getQuery();
SyntaxTree referencedSyntaxTree = EQLParser.parse(referencedEql);
referenceClause.setRuleSyntaxTree(referencedSyntaxTree);
if(!referencedSyntaxTree.hasErrors() && referencedSyntaxTree.getRootNode() != null) {
visit(referencedSyntaxTree.getRootNode());
}
else {
referenceClause.setValid(false);
ErrorMessageNode errorNode = new ErrorMessageNode();
errorNode.setErrorMessage("Referenced rule " + ruleId + " has invalid syntax.");
errors.add(errorNode);
}
}
else {
referenceClause.setValid(false);
ErrorMessageNode errorNode = new ErrorMessageNode();
errorNode.setErrorMessage("Referenced rule " + ruleId + " does not exist.");
errors.add(errorNode);
}
}
return errors;
}
protected List<ErrorMessageNode> aggregateResult(List<ErrorMessageNode> aggregate, List<ErrorMessageNode> nextResult) {
aggregate.addAll(nextResult);
return aggregate;
}
protected List<ErrorMessageNode> defaultResult() {
return new ArrayList<ErrorMessageNode>();
}
}
|
/**
* This class is generated by jOOQ
*/
package com.bolly.jooq.tables;
import com.bolly.jooq.Bolly;
import com.bolly.jooq.Keys;
import com.bolly.jooq.tables.records.MovieActorRecord;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Generated;
import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.UniqueKey;
import org.jooq.impl.TableImpl;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.8.4"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class MovieActor extends TableImpl<MovieActorRecord> {
private static final long serialVersionUID = -312541774;
/**
* The reference instance of <code>bolly.MOVIE_ACTOR</code>
*/
public static final MovieActor MOVIE_ACTOR = new MovieActor();
/**
* The class holding records for this type
*/
@Override
public Class<MovieActorRecord> getRecordType() {
return MovieActorRecord.class;
}
/**
* The column <code>bolly.MOVIE_ACTOR.movie_id</code>.
*/
public final TableField<MovieActorRecord, Integer> MOVIE_ID = createField("movie_id", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
/**
* The column <code>bolly.MOVIE_ACTOR.actor_id</code>.
*/
public final TableField<MovieActorRecord, Integer> ACTOR_ID = createField("actor_id", org.jooq.impl.SQLDataType.INTEGER.nullable(false), this, "");
/**
* Create a <code>bolly.MOVIE_ACTOR</code> table reference
*/
public MovieActor() {
this("MOVIE_ACTOR", null);
}
/**
* Create an aliased <code>bolly.MOVIE_ACTOR</code> table reference
*/
public MovieActor(String alias) {
this(alias, MOVIE_ACTOR);
}
private MovieActor(String alias, Table<MovieActorRecord> aliased) {
this(alias, aliased, null);
}
private MovieActor(String alias, Table<MovieActorRecord> aliased, Field<?>[] parameters) {
super(alias, null, aliased, parameters, "");
}
/**
* {@inheritDoc}
*/
@Override
public Schema getSchema() {
return Bolly.BOLLY;
}
/**
* {@inheritDoc}
*/
@Override
public List<UniqueKey<MovieActorRecord>> getKeys() {
return Arrays.<UniqueKey<MovieActorRecord>>asList(Keys.KEY_MOVIE_ACTOR_MA_UNIQ);
}
/**
* {@inheritDoc}
*/
@Override
public List<ForeignKey<MovieActorRecord, ?>> getReferences() {
return Arrays.<ForeignKey<MovieActorRecord, ?>>asList(Keys.FK_MA_MOV, Keys.FK_MA_ACT);
}
/**
* {@inheritDoc}
*/
@Override
public MovieActor as(String alias) {
return new MovieActor(alias, this);
}
/**
* Rename this table
*/
public MovieActor rename(String name) {
return new MovieActor(name, null);
}
}
|
/*
* [y] hybris Platform
*
* Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.cmsfacades.cmsitems.attributevalidators;
import static de.hybris.platform.cmsfacades.common.validator.ValidationErrorBuilder.newValidationErrorBuilder;
import static de.hybris.platform.cmsfacades.constants.CmsfacadesConstants.FIELD_MAX_VIOLATED;
import static de.hybris.platform.cmsfacades.constants.CmsfacadesConstants.FIELD_MIN_VIOLATED;
import de.hybris.platform.cmsfacades.validator.data.ValidationError;
import de.hybris.platform.core.model.type.AttributeDescriptorModel;
import de.hybris.platform.validation.model.constraints.AttributeConstraintModel;
import de.hybris.platform.validation.model.constraints.jsr303.MaxConstraintModel;
import de.hybris.platform.validation.model.constraints.jsr303.MinConstraintModel;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.common.collect.Sets;
/**
* Integer validator adds validation errors when the value does not respects the attribute's constraints.
*/
public class NumberAttributeContentValidator extends AbstractAttributeContentValidator<Object>
{
private final Set<String> constraints = Sets.newHashSet(MinConstraintModel._TYPECODE, MaxConstraintModel._TYPECODE);
@Override
public List<ValidationError> validate(final Object value, final AttributeDescriptorModel attribute)
{
final List<ValidationError> errors = new ArrayList<>();
if (value == null)
{
return errors;
}
final Map<String, AttributeConstraintModel> validConstraintsMap = getConstraintMap(attribute, constraint -> getConstraints().contains(constraint.getItemtype()));
final MinConstraintModel minConstraint = (MinConstraintModel) validConstraintsMap.get(MinConstraintModel._TYPECODE);
final MaxConstraintModel maxConstraint = (MaxConstraintModel) validConstraintsMap.get(MaxConstraintModel._TYPECODE);
if (minConstraint != null && Long.valueOf(value.toString()) < minConstraint.getValue())
{
errors.add(
newValidationErrorBuilder() //
.field(attribute.getQualifier()) //
.errorCode(FIELD_MIN_VIOLATED) //
.build()
);
}
if (maxConstraint != null && Long.valueOf(value.toString()) > maxConstraint.getValue())
{
errors.add(
newValidationErrorBuilder() //
.field(attribute.getQualifier()) //
.errorCode(FIELD_MAX_VIOLATED) //
.build()
);
}
return errors;
}
protected Set<String> getConstraints()
{
return constraints;
}
}
|
package it.usi.xframe.xas.bfimpl.a2psms.providers.vodafonepop;
import ie.omk.smpp.util.DefaultAlphabetEncoding;
import ie.omk.smpp.util.GSMConstants;
import ie.omk.smpp.util.PacketStatus;
import it.usi.xframe.xas.bfimpl.a2psms.configuration.Originator;
import it.usi.xframe.xas.bfimpl.a2psms.configuration.Provider;
import it.usi.xframe.xas.bfimpl.a2psms.configuration.XasUser;
import it.usi.xframe.xas.bfimpl.a2psms.dataobject.InternalSmsRequest;
import it.usi.xframe.xas.bfimpl.a2psms.dataobject.InternalSmsResponse;
import it.usi.xframe.xas.bfimpl.a2psms.providers.GatewayA2Psms;
import it.usi.xframe.xas.bfimpl.sms.SMPPUtil;
import it.usi.xframe.xas.bfimpl.sms.SMPPUtilities;
import it.usi.xframe.xas.bfutil.Constants;
import it.usi.xframe.xas.bfutil.SplunkConstants;
import it.usi.xframe.xas.bfutil.XASException;
import it.usi.xframe.xas.bfutil.data.SmsResponse3;
import it.usi.xframe.xas.util.json.XConstants;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.URL;
import java.rmi.RemoteException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Random;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.xml.rpc.ServiceException;
import org.apache.log4j.MDC;
import org.apache.soap.encoding.Hex;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.ibm.ws.webservices.engine.client.Stub;
import SoapSmppGW.GWService;
import SoapSmppGW.GWServiceServiceLocator;
import SoapSmppGW.GWSession;
import SoapSmppGW.Submit_resp;
import SoapSmppGW.Submit_sm;
import eu.unicredit.xframe.slf.Chronometer;
import eu.unicredit.xframe.slf.SmartLog;
import eu.unicredit.xframe.slf.UUID;
public class GatewaySmsProvider extends GatewayA2Psms {
private static Logger logger = LoggerFactory.getLogger(GatewaySmsProvider.class);
final static Byte DELIVERY_REPORT_NO = new Byte((byte)0);
final static Byte DELIVERY_REPORT_YES = new Byte((byte)1);
// *** MULTIPART DEFINITION ***
final static byte UDH_LEN = 0x05; // UDH length (5 bytes)
final static byte NUMBERING_8BITS = 0x00; // 8bit numbering for concatenated message
final static byte INFO_LEN = 0x03; // info length (3 more bytes)
final static Byte SM_UDH_GSM = new Byte((byte)0x40); // Set User Data Header Indicator(UDHI) which is done by setting 0x40 in ESM Class of the SMS
final static Byte SM_REPLACE_TYPE_1 = new Byte((byte)0x41); // Replacement for CARDS
final static int IX_REFERENCE_NUMBER = 3;
final static int IX_TOT_PARTS = 4;
final static int IX_PART_NUM = 5;
final static byte[] UDH_TEMPLATE = {
UDH_LEN, // user data header
NUMBERING_8BITS,
INFO_LEN,
0x00, // reference number for this concatenated message
0x00, // total parts number
0x00 // current part number
};
final static int MAX_BYTES_PER_PART = 140 - UDH_TEMPLATE.length; // cut the header length from message length
private static byte multipartSmppReferenceNumber;
static {
Random rnd = new Random();
multipartSmppReferenceNumber = (byte)rnd.nextInt(256);
}
private synchronized byte nextMultipartReferenceNumber() {
return ++GatewaySmsProvider.multipartSmppReferenceNumber ;
}
// *** MULTIPART DEFINITION ***
public InternalSmsResponse sendMessage(InternalSmsResponse internalSmsResponse, InternalSmsRequest internalSmsRequest, XasUser xasUser, Provider provider, Originator originator, boolean multipart, Chronometer chronometer) throws XASException {
String myUUID = (String) MDC.get(Constants.MY_UUID_KEY);
if (myUUID == null) myUUID = UUID.randomUUID().toString();
SmartLog sl = new SmartLog(SmartLog.COUPLING_LOOSE_I).logItCompact(Constants.MY_APPL_ID, Constants.MY_LOG_VER, GatewaySmsProvider.class.getName(), myUUID, SmartLog.V_SCOPE_DEBUG)
.logIt(SmartLog.K_METHOD, "sendMessage").preset("default");
if (logger.isDebugEnabled()) {
logger.debug(sl.logIt(SmartLog.K_PHASE, SmartLog.V_PHASE_ENTER
, "a_internalSmsRequest", XConstants.XSTREAMER.toXML(internalSmsRequest)
, "a_xasUser", XConstants.XSTREAMER.toXML(xasUser)
, "a_provider", XConstants.XSTREAMER.toXML(provider)
, "a_originator", XConstants.XSTREAMER.toXML(originator)
).getLogRow(true)); // Debug and keep row
}
sl.reload("default").logIt(SmartLog.K_PHASE, SmartLog.V_PHASE_INIT).preset("default");
SmsResponse3 smsResponse3 = new SmsResponse3();
internalSmsResponse = new InternalSmsResponse(smsResponse3);
GWServiceServiceLocator locator = new GWServiceServiceLocator();
GWService service;
try {
service = locator.getGWService(getVodafonePopURL());
if(service == null)
throw new XASException(Constants.XAS00098E_MESSAGE, null, Constants.XAS00098E_CODE, new Object[] {"Failed to instantiate SMS VodafonePop proxy for " + Configuration.JNDI_POP_SOAP_URL});
setTimeOut((Stub) service, provider.getTimeOut());
} catch (ServiceException e) {
StringWriter errors = new StringWriter();
e.printStackTrace(new PrintWriter(errors));
throw new XASException(Constants.XAS00098E_MESSAGE, errors.toString(), Constants.XAS00098E_CODE, new Object[] {"ServiceException for " + Configuration.JNDI_POP_SOAP_URL, errors.toString()});
}
// instantiate the service
Submit_sm sm = new Submit_sm();
// set authentication account
Customization customization = (Customization)provider.getCustomization();
GWSession gws = new GWSession();
gws.setAccountName(customization.getUser()); // user Pop
gws.setAccountPassword(customization.getDecryptedPassword()); // password Pop
// service type
// sm.setService_type(null); // null = default value
sm.setSource_addr_npi(IntToByte(originator.getNumPlanId().intValue()));
sm.setSource_addr_ton(IntToByte(originator.getTypeOfNumber().intValue()));
sm.setSource_addr(originator.getOriginator());
sm.setDest_addr_ton(IntToByte(GSMConstants.GSM_TON_INTERNATIONAL)); // costante - tipo destinatario
sm.setDest_addr_npi(IntToByte(GSMConstants.GSM_NPI_E164)); // costante - tipo destinatario
sm.setDestination_addr(internalSmsRequest.getPhoneNumber()); // numero telefono destinatario
// sm.setEsm_class(IntToByte(0x40)); // set UDHI flag to true (enable concatenated messages)
// Override protocolId for sms message if present
if (internalSmsRequest.getReplaceClass() != null) {
logger.debug(sl.logIt(SmartLog.K_STEP, "Using protocolID: " + IntToByte(internalSmsRequest.getProtocolId())).getLogRow(true));
// sm.setProtocol_id(IntToByte(internalSmsRequest.getProtocolId()));
}
// sm.setPriority_flag(null); // ? null
if (internalSmsRequest.getValidity() != null) {
String validityString = SMPPUtilities.getInstance().convertDate(internalSmsRequest.getValidity());
sm.setValidity_period(validityString);
}
if (internalSmsRequest.getDeliveryTime() != null) {
String delivery = SMPPUtilities.getInstance().convertDate(internalSmsRequest.getDeliveryTime());
sm.setSchedule_delivery_time(delivery);
}
// sm.setSchedule_delivery_time(null); //
sm.setRegistered_delivery(DELIVERY_REPORT_YES); // set 1 = Delivery Report 0 = No delivery Report
// sm.setReplace_if_present_flag(null); // Replace on SMSC
sm.setData_coding(new Byte(internalSmsRequest.getEncoding())); // codifica messaggio (ascii 7bit) o (UTF-8)
// sm.setSm_default_msg_id(null); //
// sm.setSm_length(null); // lunghezza corpo messaggio
Submit_resp resp;
String[] smsIdS = null;
int totSMSes = 1;
if (!multipart) {
if(internalSmsRequest.isEncodingGSM338()) {
logger.debug(sl.logIt(SmartLog.K_STEP, "Encoding GSM338").getLogRow(true));
sm.setShort_message(new DefaultAlphabetEncoding().decodeString(internalSmsRequest.getMsgBytes()));
} else if(internalSmsRequest.isEncodingUCS2()) {
logger.debug(sl.logIt(SmartLog.K_STEP, "Encoding UCS2").getLogRow(true));
sm.setMessage_payload(Hex.encode(internalSmsRequest.getMsgBytes()));
} else throw new XASException(Constants.XAS00098E_MESSAGE, null, Constants.XAS00098E_CODE, new Object[] {"Encoding message not yet implemented", new Byte(internalSmsRequest.getEncoding())});
internalSmsResponse.setGatewayContacted(true);
internalSmsResponse.setTotalSms(1);
resp = sendVodafone(myUUID, service, sm, gws, chronometer);
smsIdS = new String[] {resp.getMessage_id()};
} else {
byte[] encodedBytes =
internalSmsRequest.isEncodingGSM338()
? (new DefaultAlphabetEncoding().decodeString(internalSmsRequest.getMsgBytes())).getBytes()
: internalSmsRequest.getMsgBytes();
// *** MULTIPART DEFINITION ***
sm.setEsm_class(SM_UDH_GSM); // set UDHI flag to true (enable concatenated messages)
byte multipartReference = nextMultipartReferenceNumber();
// split msg in parts and send them
int totParts = (int) Math.ceil( (1.0*encodedBytes.length) / MAX_BYTES_PER_PART ); // max length of each message part
// logger.debug("Sending message as concatenated message (" + totParts + " parts)");
ArrayList smsIdList = new ArrayList();
int nByte = 0;
internalSmsResponse.setGatewayContacted(true);
internalSmsResponse.setTotalSms(totParts);
for (int byteCount=0, partNumb = 1;
byteCount < encodedBytes.length;
byteCount += nByte, partNumb += 1) {
nByte = Math.min(MAX_BYTES_PER_PART, encodedBytes.length - byteCount);
byte[] part = new byte[nByte];
System.arraycopy(encodedBytes, byteCount, part, 0, nByte);
byte[] udh = UDH_TEMPLATE;
udh[IX_REFERENCE_NUMBER] = multipartReference; // not relevant since only 1 concatenated msg is sent
udh[IX_TOT_PARTS] = (byte) totParts;
udh[IX_PART_NUM] = (byte) partNumb;
sm.setMessage_payload(Hex.encode(udh) + Hex.encode(part)); // the sms message part
// logger.debug("Sending part " + partNumb + "/" + totParts + "...");
// send sms
resp = sendVodafone(myUUID, service, sm, gws, chronometer);
smsIdList.add(resp.getMessage_id());
}
smsIdS = (String[]) smsIdList.toArray(new String[0]);
totSMSes = totParts;
}
// Success
smsResponse3.setSmsIds(smsIdS);
smsResponse3.setCode(Constants.XAS00000I_CODE);
smsResponse3.setMessage(MessageFormat.format(Constants.XAS00000I_MESSAGE2, new String[]{internalSmsRequest.getUuid(), Integer.toString(internalSmsRequest.getDstByteLength()), Integer.toString(totSMSes), internalSmsRequest.getEncodingDescription()}));
if (logger.isDebugEnabled()) {
logger.debug(sl.reload("default").logIt(SmartLog.K_PHASE, SmartLog.V_PHASE_RETURN, SmartLog.K_RETURN_VALUE, XConstants.XSTREAMER.toXML(internalSmsResponse)).getLogRow());
}
return internalSmsResponse;
}
/**
* Send sms via Vodafone service.
* @param service
* @param sm
* @param gws
* @return Submit_resp response from the service.
* @throws XASException
*/
private Submit_resp sendVodafone(String myUUID, GWService service, Submit_sm sm, GWSession gws, Chronometer chronometer) throws XASException {
Submit_resp resp;
try {
chronometer.partial(Configuration.TYPE + ".send." + SplunkConstants.K_TIME_SECTION_START);
resp = service.submit(sm, gws);
chronometer.partial(Configuration.TYPE + ".send." + SplunkConstants.K_TIME_SECTION_END);
} catch (RemoteException e) {
StringWriter errors = new StringWriter();
e.printStackTrace(new PrintWriter(errors));
logger.error(myUUID + ":" + errors.toString());
throw new XASException(Constants.XAS00098E_MESSAGE, errors.toString(), Constants.XAS00098E_CODE, new Object[] {"RemoteException for " + Configuration.JNDI_POP_SOAP_URL, e.getCause()});
}
if(resp == null)
throw new XASException(Constants.XAS00098E_MESSAGE, null, Constants.XAS00098E_CODE, new Object[] {"Null response object returned by Vodafone service"});
if (resp.getCommand_status().intValue() != PacketStatus.OK) {
// Failure
String errorMessage = SMPPUtil.getSMPPErrorDescription(resp.getCommand_status().intValue());
throw new XASException(Constants.XAS00098E_MESSAGE, null, Constants.XAS00098E_CODE, new Object[] {errorMessage, resp.getError_code()});
}
return resp;
}
/**
* Get the URP from the JNDI.
* @return
* @throws XASException
*/
public static URL getVodafonePopURL() throws XASException {
URL vodafonePopURL;
try {
Context ctx = new InitialContext();
vodafonePopURL= (URL)ctx.lookup(Configuration.JNDI_POP_SOAP_URL);
} catch (NamingException e) {
StringWriter errors = new StringWriter();
e.printStackTrace(new PrintWriter(errors));
logger.error(errors.toString());
throw new XASException(Constants.XAS00098E_MESSAGE, errors.toString(), Constants.XAS00098E_CODE, new Object[] {"NamingException for " + Configuration.JNDI_POP_SOAP_URL, errors.toString()});
}
return vodafonePopURL;
}
}
|
import tester.Tester;
//Represents a boolean-valued question over values of type T
interface IPred<T> {
boolean apply(T t);
}
// predicate that tests of two strings are the same
class SameString implements IPred<String> {
String s;
SameString(String s) {
this.s = s;
}
public boolean apply(String that) {
return this.s.equals(that);
}
}
// predicate that test of two ints are the same
class SameInt implements IPred<Integer> {
Integer num;
SameInt(Integer num) {
this.num = num;
}
public boolean apply(Integer that) {
return this.num == that;
}
}
//represents a list that can add things on at both ends
class Deque<T> {
Sentinel<T> header;
// default constructor
Deque() {
this.header = new Sentinel<T>();
}
// convenience constructor passing in a sentinel node
Deque(Sentinel<T> header) {
this.header = header;
}
// returns the size of this
public int size() {
return this.header.next.calcSize(0);
}
// adds that data to the head of this deque
public void addAtHead(T that) {
this.header.next = new Node<T>(that, this.header.next, this.header);
}
// adds that data to the tail of this deque
public void addAtTail(T that) {
this.header.prev = new Node<T>(that, this.header, this.header.prev);
}
// adds that data to the head of this deque
public T removeFromHead() {
return this.header.next.removeThis();
}
// adds that data to the tail of this deque
public T removeFromTail() {
return this.header.prev.removeThis();
}
// takes a predicate and produces the first node in this Deque for which the given
// predicate returns true
public ANode<T> find(IPred<T> pred) {
return this.header.next.findHelp(pred);
}
// removes a given node from
public void removeNode(ANode<T> node) {
node.removeNodeHelp();
}
}
// abstract class for deque nodes
abstract class ANode<T> {
ANode<T> next;
ANode<T> prev;
// default constructor
ANode(ANode<T> next, ANode<T> prev) {
this.next = next;
this.prev = prev;
}
// convenience constructor for no arguments
ANode() {
this.next = null;
this.prev = null;
}
// calculates the size of the this linked list of nodes
abstract int calcSize(int count);
// removes this ANode
abstract T removeThis();
// returns the first node that satisfies the given predicate
// if no node does, it returns the header
abstract ANode<T> findHelp(IPred<T> pred);
// removes the desired node
abstract void removeNodeHelp();
}
// a sentinel of a list
class Sentinel<T> extends ANode<T> {
Sentinel(ANode<T> next, ANode<T> prev) {
super(next, prev);
}
Sentinel() {
super();
this.next = this;
this.prev = this;
}
// throws an error if the user tries to remove an item from an empty list
public T removeThis() {
throw new RuntimeException("Cannot remove items from an empty list!");
}
// finds the first node that passes a predicate
public ANode<T> findHelp(IPred<T> pred) {
return this;
}
// removes the desired node, does nothing on a sentinel
public void removeNodeHelp() {
// shouldn't do anything when inside a sentinel
}
// returns the size of this list
int calcSize(int count) {
return count;
}
}
// a node inside a deque
class Node<T> extends ANode<T> {
T data;
// default node constructor, next and prev are set to null
Node(T data) {
super(null, null);
this.data = data;
}
// convenience node constructor where data, next, and prev nodes are passed in
Node(T data, ANode<T> next, ANode<T> prev) {
super(next, prev);
if (next == null || prev == null) {
throw new IllegalArgumentException("You cannot make a node pointing to null objects!");
}
else {
this.data = data;
this.next.prev = this;
this.prev.next = this;
}
}
// calculates the size of this list
int calcSize(int count) {
return this.next.calcSize(count + 1);
}
// removes this node from the list that its in
public T removeThis() {
ANode<T> tempNext = this.next;
ANode<T> tempPrev = this.prev;
this.prev.next = tempNext;
this.next.prev = tempPrev;
return this.data;
}
// finds the first node that passes this predicate
public ANode<T> findHelp(IPred<T> pred) {
if (pred.apply(this.data)) {
return this;
}
else {
return next.findHelp(pred);
}
}
// removes the desired node
public void removeNodeHelp() {
this.removeThis();
}
}
class ExamplesDeque {
// example
Deque<String> deque1;
Sentinel<String> deque2Sent;
ANode<String> nodeABC;
ANode<String> nodeBCD;
ANode<String> nodeCDE;
ANode<String> nodeDEF;
Deque<String> deque2;
Sentinel<String> deque3Sent;
ANode<String> nodeFirst;
ANode<String> nodeSecond;
ANode<String> nodeThird;
ANode<String> nodeFourth;
ANode<String> nodeFifth;
Deque<String> deque3;
Deque<String> shortDeque;
ANode<String> shortNode;
ANode<String> ENode1;
Sentinel<String> ESentinel1;
Deque<String> EDeque1;
// Effect: resets all data
void initData() {
this.deque1 = new Deque<String>();
this.deque2Sent = new Sentinel<String>();
this.nodeABC = new Node<String>("abc", this.deque2Sent, this.deque2Sent);
this.nodeBCD = new Node<String>("bcd", this.deque2Sent, this.nodeABC);
this.nodeCDE = new Node<String>("cde", this.deque2Sent, this.nodeBCD);
this.nodeDEF = new Node<String>("def", this.deque2Sent, this.nodeCDE);
this.deque2 = new Deque<String>(this.deque2Sent);
this.deque3Sent = new Sentinel<String>();
this.nodeFirst = new Node<String>("first", this.deque3Sent, this.deque3Sent);
this.nodeSecond = new Node<String>("second", this.deque3Sent, this.nodeFirst);
this.nodeThird = new Node<String>("third", this.deque3Sent, this.nodeSecond);
this.nodeFourth = new Node<String>("fourth", this.deque3Sent, this.nodeThird);
this.nodeFifth = new Node<String>("fifth", this.deque3Sent, this.nodeFourth);
this.deque3 = new Deque<String>(this.deque3Sent);
this.ENode1 = new Node<String>("node 1");
this.ESentinel1 = new Sentinel<String>();
this.EDeque1 = new Deque<String>(this.ESentinel1);
this.shortDeque = new Deque<String>();
this.shortNode = new Node<String>("short 1", this.shortDeque.header, this.shortDeque.header);
}
// tests for node constructor
void testNodeConstructor(Tester t) {
initData();
t.checkConstructorException(
new IllegalArgumentException("You cannot make a node pointing to null objects!"), "Node",
"hi", null, null);
t.checkConstructorException(
new IllegalArgumentException("You cannot make a node pointing to null objects!"), "Node",
"hi", this.ENode1, null);
t.checkConstructorException(
new IllegalArgumentException("You cannot make a node pointing to null objects!"), "Node",
"hi", null, this.ENode1);
}
// test for sentinel constructor
void testsentinelConstructor(Tester t) {
initData();
t.checkExpect(this.ESentinel1.next, this.ESentinel1);
}
// testing to see if examples are constructed correctly, order and linking
void testDequeBuilding(Tester t) {
initData();
t.checkExpect(this.deque3.header.next, this.nodeFirst);
t.checkExpect(this.deque3.header.next.next, this.nodeSecond);
t.checkExpect(this.deque3.header.next.next.next.next.next.next, this.deque3.header);
t.checkExpect(this.deque3.header.next.next.next.next.next, this.nodeFifth);
t.checkExpect(this.deque3.header.prev, this.nodeFifth);
t.checkExpect(this.deque3.header.prev.prev, this.nodeFourth);
t.checkExpect(this.deque3.header.prev.prev.prev, this.nodeThird);
t.checkExpect(this.deque3.header.prev.prev.prev.prev, this.nodeSecond);
t.checkExpect(this.deque3.header.prev.prev.prev.prev.prev, this.nodeFirst);
t.checkExpect(this.deque3.header.prev.prev.prev.prev.prev.prev, this.deque3.header);
}
// tests for size
void testSize(Tester t) {
initData();
t.checkExpect(this.deque1.size(), 0);
t.checkExpect(this.deque2.size(), 4);
t.checkExpect(this.deque3.size(), 5);
t.checkExpect(this.shortDeque.size(), 1);
}
// tests for addAtHead
void testaddAtHead(Tester t) {
initData();
t.checkExpect(this.EDeque1.header.next, this.ESentinel1);
this.EDeque1.addAtHead("hello");
t.checkExpect(this.EDeque1.header.next,
new Node<String>("hello", this.ESentinel1, this.ESentinel1));
this.deque3.addAtHead("hello");
t.checkExpect(this.deque3.header.next,
new Node<String>("hello", this.nodeFirst, this.deque3.header));
t.checkExpect(this.nodeFirst.prev,
new Node<String>("hello", this.nodeFirst, this.deque3.header));
}
// tests for addAtTail
void testaddAtTail(Tester t) {
initData();
t.checkExpect(this.EDeque1.header.prev, this.ESentinel1);
this.EDeque1.addAtTail("hello");
t.checkExpect(this.EDeque1.header.prev,
new Node<String>("hello", this.ESentinel1, this.ESentinel1));
this.deque3.addAtTail("hello");
t.checkExpect(this.deque3.header.prev,
new Node<String>("hello", this.deque3.header, this.nodeFifth));
t.checkExpect(this.nodeFifth.next,
new Node<String>("hello", this.deque3.header, this.nodeFifth));
}
// tests for removeFromHead
void testremoveFromHead(Tester t) {
initData();
t.checkExpect(this.shortDeque.header.next, this.shortNode);
t.checkExpect(this.shortDeque.size(), 1);
t.checkExpect(this.shortDeque.removeFromHead(), "short 1");
t.checkExpect(this.shortDeque.size(), 0);
t.checkExpect(this.deque3.header.next, this.nodeFirst);
t.checkExpect(this.deque3.removeFromHead(), "first");
t.checkExpect(this.deque3.header.next, this.nodeSecond);
t.checkExpect(this.deque3.header.next.next, this.nodeThird);
t.checkExpect(this.deque3.header.prev.prev.prev.prev.prev, this.deque3.header);
}
// tests for removeFromTail
void testremoveFromTail(Tester t) {
initData();
t.checkExpect(this.shortDeque.header.next, this.shortNode);
t.checkExpect(this.shortDeque.size(), 1);
t.checkExpect(this.shortDeque.removeFromTail(), "short 1");
t.checkExpect(this.shortDeque.size(), 0);
t.checkExpect(this.deque3.removeFromTail(), "fifth");
}
// tests for find
void testFind(Tester t) {
initData();
t.checkExpect(this.deque2.find(new SameString("abc")), this.nodeABC);
t.checkExpect(this.deque2.find(new SameString("def")), this.nodeDEF);
t.checkExpect(this.deque2.find(new SameString("abcc")), this.deque2Sent);
}
// tests for removeNode
void testRemoveNode(Tester t) {
initData();
t.checkExpect(this.deque2.header.next, this.nodeABC);
this.deque2.removeNode(this.nodeABC);
t.checkExpect(this.deque2.header.next, this.nodeBCD);
t.checkExpect(this.deque2.header.prev.prev.prev.prev, this.deque2Sent);
this.deque2.removeNode(this.nodeABC);
t.checkExpect(this.deque2.header.next, this.nodeBCD);
t.checkExpect(this.deque2.header.prev.prev.prev.prev, this.deque2Sent);
t.checkExpect(this.deque3.header.next.next.next, this.nodeThird);
this.deque2.removeNode(this.nodeThird);
t.checkExpect(this.deque3.header.next.next.next, this.nodeFourth);
t.checkExpect(this.deque3.header.prev.prev.prev, this.nodeSecond);
}
} |
/**
*/
package ConceptMapDSL;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
/**
* <!-- begin-user-doc -->
* The <b>Package</b> for the model.
* It contains accessors for the meta objects to represent
* <ul>
* <li>each class,</li>
* <li>each feature of each class,</li>
* <li>each enum,</li>
* <li>and each data type</li>
* </ul>
* <!-- end-user-doc -->
* @see ConceptMapDSL.ConceptMapDSLFactory
* @model kind="package"
* @generated
*/
public interface ConceptMapDSLPackage extends EPackage {
/**
* The package name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
String eNAME = "ConceptMapDSL";
/**
* The package namespace URI.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
String eNS_URI = "http://spray.eclipselabs.org/examples/Conceptmap";
/**
* The package namespace name.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
String eNS_PREFIX = "conceptmap";
/**
* The singleton instance of the package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
ConceptMapDSLPackage eINSTANCE = ConceptMapDSL.impl.ConceptMapDSLPackageImpl.init();
/**
* The meta object id for the '{@link ConceptMapDSL.impl.NamedElementImpl <em>Named Element</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see ConceptMapDSL.impl.NamedElementImpl
* @see ConceptMapDSL.impl.ConceptMapDSLPackageImpl#getNamedElement()
* @generated
*/
int NAMED_ELEMENT = 0;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int NAMED_ELEMENT__NAME = 0;
/**
* The number of structural features of the '<em>Named Element</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int NAMED_ELEMENT_FEATURE_COUNT = 1;
/**
* The meta object id for the '{@link ConceptMapDSL.impl.ConceptMapImpl <em>Concept Map</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see ConceptMapDSL.impl.ConceptMapImpl
* @see ConceptMapDSL.impl.ConceptMapDSLPackageImpl#getConceptMap()
* @generated
*/
int CONCEPT_MAP = 1;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int CONCEPT_MAP__NAME = NAMED_ELEMENT__NAME;
/**
* The feature id for the '<em><b>Mapelements</b></em>' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int CONCEPT_MAP__MAPELEMENTS = NAMED_ELEMENT_FEATURE_COUNT + 0;
/**
* The number of structural features of the '<em>Concept Map</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int CONCEPT_MAP_FEATURE_COUNT = NAMED_ELEMENT_FEATURE_COUNT + 1;
/**
* The meta object id for the '{@link ConceptMapDSL.impl.MapElementsImpl <em>Map Elements</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see ConceptMapDSL.impl.MapElementsImpl
* @see ConceptMapDSL.impl.ConceptMapDSLPackageImpl#getMapElements()
* @generated
*/
int MAP_ELEMENTS = 2;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int MAP_ELEMENTS__NAME = NAMED_ELEMENT__NAME;
/**
* The number of structural features of the '<em>Map Elements</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int MAP_ELEMENTS_FEATURE_COUNT = NAMED_ELEMENT_FEATURE_COUNT + 0;
/**
* The meta object id for the '{@link ConceptMapDSL.impl.ElementImpl <em>Element</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see ConceptMapDSL.impl.ElementImpl
* @see ConceptMapDSL.impl.ConceptMapDSLPackageImpl#getElement()
* @generated
*/
int ELEMENT = 3;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int ELEMENT__NAME = MAP_ELEMENTS__NAME;
/**
* The number of structural features of the '<em>Element</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int ELEMENT_FEATURE_COUNT = MAP_ELEMENTS_FEATURE_COUNT + 0;
/**
* The meta object id for the '{@link ConceptMapDSL.impl.ArrowConnectionImpl <em>Arrow Connection</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see ConceptMapDSL.impl.ArrowConnectionImpl
* @see ConceptMapDSL.impl.ConceptMapDSLPackageImpl#getArrowConnection()
* @generated
*/
int ARROW_CONNECTION = 4;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int ARROW_CONNECTION__NAME = MAP_ELEMENTS__NAME;
/**
* The feature id for the '<em><b>From Element</b></em>' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int ARROW_CONNECTION__FROM_ELEMENT = MAP_ELEMENTS_FEATURE_COUNT + 0;
/**
* The feature id for the '<em><b>To Element</b></em>' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int ARROW_CONNECTION__TO_ELEMENT = MAP_ELEMENTS_FEATURE_COUNT + 1;
/**
* The number of structural features of the '<em>Arrow Connection</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int ARROW_CONNECTION_FEATURE_COUNT = MAP_ELEMENTS_FEATURE_COUNT + 2;
/**
* The meta object id for the '{@link ConceptMapDSL.impl.DoubleArrowConnectionImpl <em>Double Arrow Connection</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see ConceptMapDSL.impl.DoubleArrowConnectionImpl
* @see ConceptMapDSL.impl.ConceptMapDSLPackageImpl#getDoubleArrowConnection()
* @generated
*/
int DOUBLE_ARROW_CONNECTION = 5;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int DOUBLE_ARROW_CONNECTION__NAME = MAP_ELEMENTS__NAME;
/**
* The feature id for the '<em><b>From Element</b></em>' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int DOUBLE_ARROW_CONNECTION__FROM_ELEMENT = MAP_ELEMENTS_FEATURE_COUNT + 0;
/**
* The feature id for the '<em><b>To Element</b></em>' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int DOUBLE_ARROW_CONNECTION__TO_ELEMENT = MAP_ELEMENTS_FEATURE_COUNT + 1;
/**
* The number of structural features of the '<em>Double Arrow Connection</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int DOUBLE_ARROW_CONNECTION_FEATURE_COUNT = MAP_ELEMENTS_FEATURE_COUNT + 2;
/**
* The meta object id for the '{@link ConceptMapDSL.impl.DefaultConnectionImpl <em>Default Connection</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see ConceptMapDSL.impl.DefaultConnectionImpl
* @see ConceptMapDSL.impl.ConceptMapDSLPackageImpl#getDefaultConnection()
* @generated
*/
int DEFAULT_CONNECTION = 6;
/**
* The feature id for the '<em><b>Name</b></em>' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int DEFAULT_CONNECTION__NAME = MAP_ELEMENTS__NAME;
/**
* The feature id for the '<em><b>From Element</b></em>' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int DEFAULT_CONNECTION__FROM_ELEMENT = MAP_ELEMENTS_FEATURE_COUNT + 0;
/**
* The feature id for the '<em><b>To Element</b></em>' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int DEFAULT_CONNECTION__TO_ELEMENT = MAP_ELEMENTS_FEATURE_COUNT + 1;
/**
* The number of structural features of the '<em>Default Connection</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
int DEFAULT_CONNECTION_FEATURE_COUNT = MAP_ELEMENTS_FEATURE_COUNT + 2;
/**
* Returns the meta object for class '{@link ConceptMapDSL.NamedElement <em>Named Element</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Named Element</em>'.
* @see ConceptMapDSL.NamedElement
* @generated
*/
EClass getNamedElement();
/**
* Returns the meta object for the attribute '{@link ConceptMapDSL.NamedElement#getName <em>Name</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Name</em>'.
* @see ConceptMapDSL.NamedElement#getName()
* @see #getNamedElement()
* @generated
*/
EAttribute getNamedElement_Name();
/**
* Returns the meta object for class '{@link ConceptMapDSL.ConceptMap <em>Concept Map</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Concept Map</em>'.
* @see ConceptMapDSL.ConceptMap
* @generated
*/
EClass getConceptMap();
/**
* Returns the meta object for the containment reference list '{@link ConceptMapDSL.ConceptMap#getMapelements <em>Mapelements</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference list '<em>Mapelements</em>'.
* @see ConceptMapDSL.ConceptMap#getMapelements()
* @see #getConceptMap()
* @generated
*/
EReference getConceptMap_Mapelements();
/**
* Returns the meta object for class '{@link ConceptMapDSL.MapElements <em>Map Elements</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Map Elements</em>'.
* @see ConceptMapDSL.MapElements
* @generated
*/
EClass getMapElements();
/**
* Returns the meta object for class '{@link ConceptMapDSL.Element <em>Element</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Element</em>'.
* @see ConceptMapDSL.Element
* @generated
*/
EClass getElement();
/**
* Returns the meta object for class '{@link ConceptMapDSL.ArrowConnection <em>Arrow Connection</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Arrow Connection</em>'.
* @see ConceptMapDSL.ArrowConnection
* @generated
*/
EClass getArrowConnection();
/**
* Returns the meta object for the reference '{@link ConceptMapDSL.ArrowConnection#getFromElement <em>From Element</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>From Element</em>'.
* @see ConceptMapDSL.ArrowConnection#getFromElement()
* @see #getArrowConnection()
* @generated
*/
EReference getArrowConnection_FromElement();
/**
* Returns the meta object for the reference '{@link ConceptMapDSL.ArrowConnection#getToElement <em>To Element</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>To Element</em>'.
* @see ConceptMapDSL.ArrowConnection#getToElement()
* @see #getArrowConnection()
* @generated
*/
EReference getArrowConnection_ToElement();
/**
* Returns the meta object for class '{@link ConceptMapDSL.DoubleArrowConnection <em>Double Arrow Connection</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Double Arrow Connection</em>'.
* @see ConceptMapDSL.DoubleArrowConnection
* @generated
*/
EClass getDoubleArrowConnection();
/**
* Returns the meta object for the reference '{@link ConceptMapDSL.DoubleArrowConnection#getFromElement <em>From Element</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>From Element</em>'.
* @see ConceptMapDSL.DoubleArrowConnection#getFromElement()
* @see #getDoubleArrowConnection()
* @generated
*/
EReference getDoubleArrowConnection_FromElement();
/**
* Returns the meta object for the reference '{@link ConceptMapDSL.DoubleArrowConnection#getToElement <em>To Element</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>To Element</em>'.
* @see ConceptMapDSL.DoubleArrowConnection#getToElement()
* @see #getDoubleArrowConnection()
* @generated
*/
EReference getDoubleArrowConnection_ToElement();
/**
* Returns the meta object for class '{@link ConceptMapDSL.DefaultConnection <em>Default Connection</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Default Connection</em>'.
* @see ConceptMapDSL.DefaultConnection
* @generated
*/
EClass getDefaultConnection();
/**
* Returns the meta object for the reference '{@link ConceptMapDSL.DefaultConnection#getFromElement <em>From Element</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>From Element</em>'.
* @see ConceptMapDSL.DefaultConnection#getFromElement()
* @see #getDefaultConnection()
* @generated
*/
EReference getDefaultConnection_FromElement();
/**
* Returns the meta object for the reference '{@link ConceptMapDSL.DefaultConnection#getToElement <em>To Element</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>To Element</em>'.
* @see ConceptMapDSL.DefaultConnection#getToElement()
* @see #getDefaultConnection()
* @generated
*/
EReference getDefaultConnection_ToElement();
/**
* Returns the factory that creates the instances of the model.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the factory that creates the instances of the model.
* @generated
*/
ConceptMapDSLFactory getConceptMapDSLFactory();
/**
* <!-- begin-user-doc -->
* Defines literals for the meta objects that represent
* <ul>
* <li>each class,</li>
* <li>each feature of each class,</li>
* <li>each enum,</li>
* <li>and each data type</li>
* </ul>
* <!-- end-user-doc -->
* @generated
*/
interface Literals {
/**
* The meta object literal for the '{@link ConceptMapDSL.impl.NamedElementImpl <em>Named Element</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see ConceptMapDSL.impl.NamedElementImpl
* @see ConceptMapDSL.impl.ConceptMapDSLPackageImpl#getNamedElement()
* @generated
*/
EClass NAMED_ELEMENT = eINSTANCE.getNamedElement();
/**
* The meta object literal for the '<em><b>Name</b></em>' attribute feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EAttribute NAMED_ELEMENT__NAME = eINSTANCE.getNamedElement_Name();
/**
* The meta object literal for the '{@link ConceptMapDSL.impl.ConceptMapImpl <em>Concept Map</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see ConceptMapDSL.impl.ConceptMapImpl
* @see ConceptMapDSL.impl.ConceptMapDSLPackageImpl#getConceptMap()
* @generated
*/
EClass CONCEPT_MAP = eINSTANCE.getConceptMap();
/**
* The meta object literal for the '<em><b>Mapelements</b></em>' containment reference list feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EReference CONCEPT_MAP__MAPELEMENTS = eINSTANCE.getConceptMap_Mapelements();
/**
* The meta object literal for the '{@link ConceptMapDSL.impl.MapElementsImpl <em>Map Elements</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see ConceptMapDSL.impl.MapElementsImpl
* @see ConceptMapDSL.impl.ConceptMapDSLPackageImpl#getMapElements()
* @generated
*/
EClass MAP_ELEMENTS = eINSTANCE.getMapElements();
/**
* The meta object literal for the '{@link ConceptMapDSL.impl.ElementImpl <em>Element</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see ConceptMapDSL.impl.ElementImpl
* @see ConceptMapDSL.impl.ConceptMapDSLPackageImpl#getElement()
* @generated
*/
EClass ELEMENT = eINSTANCE.getElement();
/**
* The meta object literal for the '{@link ConceptMapDSL.impl.ArrowConnectionImpl <em>Arrow Connection</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see ConceptMapDSL.impl.ArrowConnectionImpl
* @see ConceptMapDSL.impl.ConceptMapDSLPackageImpl#getArrowConnection()
* @generated
*/
EClass ARROW_CONNECTION = eINSTANCE.getArrowConnection();
/**
* The meta object literal for the '<em><b>From Element</b></em>' reference feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EReference ARROW_CONNECTION__FROM_ELEMENT = eINSTANCE.getArrowConnection_FromElement();
/**
* The meta object literal for the '<em><b>To Element</b></em>' reference feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EReference ARROW_CONNECTION__TO_ELEMENT = eINSTANCE.getArrowConnection_ToElement();
/**
* The meta object literal for the '{@link ConceptMapDSL.impl.DoubleArrowConnectionImpl <em>Double Arrow Connection</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see ConceptMapDSL.impl.DoubleArrowConnectionImpl
* @see ConceptMapDSL.impl.ConceptMapDSLPackageImpl#getDoubleArrowConnection()
* @generated
*/
EClass DOUBLE_ARROW_CONNECTION = eINSTANCE.getDoubleArrowConnection();
/**
* The meta object literal for the '<em><b>From Element</b></em>' reference feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EReference DOUBLE_ARROW_CONNECTION__FROM_ELEMENT = eINSTANCE.getDoubleArrowConnection_FromElement();
/**
* The meta object literal for the '<em><b>To Element</b></em>' reference feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EReference DOUBLE_ARROW_CONNECTION__TO_ELEMENT = eINSTANCE.getDoubleArrowConnection_ToElement();
/**
* The meta object literal for the '{@link ConceptMapDSL.impl.DefaultConnectionImpl <em>Default Connection</em>}' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see ConceptMapDSL.impl.DefaultConnectionImpl
* @see ConceptMapDSL.impl.ConceptMapDSLPackageImpl#getDefaultConnection()
* @generated
*/
EClass DEFAULT_CONNECTION = eINSTANCE.getDefaultConnection();
/**
* The meta object literal for the '<em><b>From Element</b></em>' reference feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EReference DEFAULT_CONNECTION__FROM_ELEMENT = eINSTANCE.getDefaultConnection_FromElement();
/**
* The meta object literal for the '<em><b>To Element</b></em>' reference feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
EReference DEFAULT_CONNECTION__TO_ELEMENT = eINSTANCE.getDefaultConnection_ToElement();
}
} //ConceptMapDSLPackage
|
package edu.temple.nearbyresearch;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
public class NearbyAdapter extends RecyclerView.Adapter<NearbyAdapter.ViewHolder> {
private ArrayList<String> localDataSet;
public static class ViewHolder extends RecyclerView.ViewHolder {
private final TextView textView;
public ViewHolder(View view) {
super(view);
// TODO: Define an on click listener for ViewHolder's View
// Perhaps we need an interface to call a method in the Activity
// that connects this device to the device named in the list item?
textView = view.findViewById(R.id.row_text);
}
public TextView getTextView() {
return textView;
}
}
public NearbyAdapter(ArrayList<String> dataSet) {
localDataSet = dataSet;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.text_row_item, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(NearbyAdapter.ViewHolder holder, int position) {
holder.getTextView().setText(localDataSet.get(position));
}
@Override
public int getItemCount() {
return localDataSet.size();
}
}
|
package zust.service.Impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import zust.dao.UserMapper;
import zust.model.User;
import zust.service.UserService;
@Service
public class UserServiceImpl implements UserService {
@Autowired
UserMapper userMapper;
public User insertUser(User user) {
userMapper.insertSelective(user);
return user;
}
}
|
package edu.uci.ics.sdcl.firefly;
import java.io.Serializable;
import java.util.Vector;
public class MethodSignature implements Serializable{
protected String Name;
protected String Modifier; //Visibility
protected Vector<MethodParameter> ParameterList;
public MethodSignature(String name, String modifier) {
Name = name;
Modifier = modifier;
this.ParameterList = new Vector<MethodParameter>();
}
/**
* Compare the current method against a provided one.
* @return true is methods are the same (name and parameters match), otherwise false
*/
public boolean isEqualTo(MethodSignature target){
boolean matched = true;
if(target.getName().compareTo(this.Name)==0){
Vector<MethodParameter> targetList = target.getParameterList();
if(targetList.size() == this.ParameterList.size()){
int i = 0;
int j = 0;
while((i<ParameterList.size() && j<targetList.size()) && matched){
MethodParameter sourceParam = this.ParameterList.get(i);
MethodParameter targetParam = targetList.get(j);
if(!sourceParam.getName().toString().
equalsIgnoreCase(targetParam.getName().toString()))
{
matched=false;
}
else{
i++;
j++;
}
}
}
else
return false;
}
else
return false;
return matched;
}
public void addMethodParameters(MethodParameter parameter){
this.ParameterList.add(parameter);
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getModifier() {
return Modifier;
}
public void setModifier(String modifier) {
Modifier = modifier;
}
public Vector<MethodParameter> getParameterList() {
return ParameterList;
}
public void setParameterList(Vector<MethodParameter> parameters) {
ParameterList = parameters;
}
public boolean hasParameters(){
if(this.ParameterList.size()>0)
return true;
else
return false;
}
@Override
public String toString()
{
StringBuffer methodSignature = new StringBuffer();
methodSignature.append(Modifier);
methodSignature.append(" ");
methodSignature.append(Name);
methodSignature.append("(");
for (MethodParameter parameter : ParameterList)
{
methodSignature.append(parameter.getTypeName());
methodSignature.append(" ");
methodSignature.append(parameter.getName());
if (parameter != ParameterList.get(ParameterList.size()-1) ) // if it is not the last one...
methodSignature.append(", ");
}
return methodSignature.toString();
}
}
|
package com.yuta.clocktime.adapter;
import java.util.ArrayList;
import java.util.List;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.TextView;
import com.yuta.clocktime.R;
import com.yuta.clocktime.model.AlarmClock;
public class AlarmAdapter extends BaseAdapter{
private static final String debug = "com.yuta.clocktime.adapter.AlarmAdapter";
private List<AlarmClock> alarmData = new ArrayList<AlarmClock>();
private List<Boolean> states = new ArrayList<Boolean>();
private int layoutId;
private ViewHolder mHolder;
private Context context;
private boolean isOn = false;;
public AlarmAdapter(List<AlarmClock> data, List<Boolean> states, int layoutId, Context context){
alarmData = data;
this.layoutId = layoutId;
this.context = context;
this.states = states;
}
@Override
public int getCount() {
return alarmData.size();
}
@Override
public Object getItem(int position) {
return alarmData.get(position);
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view;
final AlarmClock alarm = alarmData.get(position);
if(convertView==null){
mHolder = new ViewHolder();
view = LayoutInflater.from(context).inflate(layoutId, null);
mHolder.mTime = (TextView)view.findViewById(R.id.id_textview_time);
mHolder.mLabel = (TextView)view.findViewById(R.id.id_textview_label);
mHolder.mFrequency = (TextView)view.findViewById(R.id.id_textview_freq);
mHolder.mCheckBox = (CheckBox)view.findViewById(R.id.id_checkbox_alarm);
view.setTag(mHolder);
}else{
view = convertView;
mHolder = (ViewHolder) view.getTag();
}
mHolder.mTime.setText(alarm.getAlarmTime());
mHolder.mLabel.setText(alarm.getLabel());
String selectedDay = new String();
if(alarm.getFrequency().size()==7){
selectedDay = "每天";
}else if(alarm.getFrequency().size()==0){
selectedDay = "仅一次";
}else{
selectedDay = "周";
for(String str: alarm.getFrequency()){
selectedDay += str;
}
}
mHolder.mFrequency.setText(selectedDay);
mHolder.mCheckBox.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
switch(v.getId()){
case R.id.id_checkbox_alarm:
// if((CheckBox)v.is)
}
}
});
return view;
}
class ViewHolder{
TextView mTime;
TextView mLabel;
TextView mFrequency;
CheckBox mCheckBox;
}
}
|
package com.cnk.travelogix.supplier.inventory.service;
import com.cnk.travelogix.acco.inventory.core.model.AccoInventoryGridModel;
import com.cnk.travelogix.accoinventory.core.model.AccoInventoryDefinitionModel;
import com.cnk.travelogix.accoinventory.core.model.AccoInventoryDetailModel;
import com.cnk.travelogix.accoinventory.core.model.AccoPenaltyChargesReleaseModel;
import com.cnk.travelogix.accoinventory.core.model.InventoryRoomInfoModel;
import com.cnk.travelogix.common.inventory.core.enums.InventoryType;
import com.cnk.travelogix.masterdata.core.enums.RoomCategory;
import com.cnk.travelogix.masterdata.core.enums.RoomType;
import com.cnk.travelogix.supplier.commercials.core.advancedefinition.model.accommodation.AccoSupplierAdvanceDefinitionModel;
public interface InventoryService {
public AccoInventoryDefinitionModel getInventoryDefination(String supplier , String code);
public AccoInventoryGridModel getInventoryGrid();
public AccoInventoryDetailModel getInventroyDetail(String productCode ,String cityIso,InventoryType inventoryType);
public InventoryRoomInfoModel getInventryRoomInfo(String productCode, String cityIso, RoomCategory roomCategory , RoomType roomType);
public AccoSupplierAdvanceDefinitionModel getAccoSupplierAdvanceDefinition(String supplier, RoomCategory roomCategory , RoomType roomType);
public AccoPenaltyChargesReleaseModel getPenaltychargesRelease(String supplier, RoomCategory roomCategory,RoomType roomType);
} |
/*
* 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 twitteranalysis;
import java.io.File;
import java.util.HashMap;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author Fraser
*/
public class SupervisedLearningTest {
public SupervisedLearningTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
/**
* Test of readConditionsFromTxt method, of class SupervisedLearning.
*/
@Test
public void testReadConditionsFromTxt() {
System.out.println("readConditionsFromTxt");
File file = new File("C:\\Users\\Fraser\\Google Drive\\GitProjects\\TwitterAnalysis\\src\\twitteranalysis\\SupervisedLearningTxt\\" + "test" + ".txt");
int expResult = 2;
int result = SupervisedLearning.readConditionsFromTxt(file).get(1).intValue();
assertEquals(expResult, result);
}
}
|
package com.elvarg.world.entity.impl.player;
import java.io.File;
import java.io.FileWriter;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.logging.Level;
import com.elvarg.Elvarg;
import com.elvarg.util.Misc;
import com.elvarg.world.model.container.impl.Bank;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
public class PlayerSaving {
public static void save(Player player) {
// Create the path and file objects.
Path path = Paths.get("./data/saves/characters/", player.getUsername() + ".json");
File file = path.toFile();
file.getParentFile().setWritable(true);
// Attempt to make the player save directory if it doesn't
// exist.
if (!file.getParentFile().exists()) {
try {
file.getParentFile().mkdirs();
} catch (SecurityException e) {
System.out.println("Unable to create directory for player data!");
}
}
try (FileWriter writer = new FileWriter(file)) {
Gson builder = new GsonBuilder().setPrettyPrinting().create();
JsonObject object = new JsonObject();
object.addProperty("username", player.getUsername().trim());
object.addProperty("password", player.getPassword().trim());
object.addProperty("staff-rights", player.getRights().name());
object.add("position", builder.toJsonTree(player.getPosition()));
object.addProperty("spell-book", player.getSpellbook().name());
object.addProperty("fight-type", player.getCombat().getFightType().name());
object.addProperty("auto-retaliate", player.getCombat().autoRetaliate());
object.addProperty("xp-locked", player.experienceLocked());
object.addProperty("clanchat", player.getClanChatName());
object.addProperty("target-teleport", player.isTargetTeleportUnlocked());
object.addProperty("preserve", player.isPreserveUnlocked());
object.addProperty("rigour", player.isRigourUnlocked());
object.addProperty("augury", player.isAuguryUnlocked());
object.addProperty("has-veng", player.hasVengeance());
object.addProperty("last-veng", player.getVengeanceTimer().secondsRemaining());
object.addProperty("running", player.isRunning());
object.addProperty("openPresetsOnDeath", player.isOpenPresetsOnDeath());
object.addProperty("run-energy", player.getRunEnergy());
object.addProperty("spec-percentage", player.getSpecialPercentage());
object.addProperty("recoil-damage", player.getRecoilDamage());
object.addProperty("poison-damage", player.getPoisonDamage());
object.addProperty("poison-immunity", player.getCombat().getPoisonImmunityTimer().secondsRemaining());
object.addProperty("fire-immunity", player.getCombat().getFireImmunityTimer().secondsRemaining());
object.addProperty("teleblock-timer", player.getCombat().getTeleBlockTimer().secondsRemaining());
object.addProperty("prayerblock-timer", player.getCombat().getPrayerBlockTimer().secondsRemaining());
object.addProperty("target-search-timer", player.getTargetSearchTimer().secondsRemaining());
object.addProperty("special-attack-restore-timer", player.getSpecialAttackRestore().secondsRemaining());
object.addProperty("skull-timer", player.getSkullTimer());
object.addProperty("skull-type", player.getSkullType().name());
object.addProperty("total-kills", player.getTotalKills());
object.addProperty("target-kills", player.getTargetKills());
object.addProperty("normal-kills", player.getNormalKills());
object.addProperty("killstreak", player.getKillstreak());
object.addProperty("highest-killstreak", player.getHighestKillstreak());
object.add("recent-kills", builder.toJsonTree(player.getRecentKills()));
object.addProperty("deaths", player.getDeaths());
object.addProperty("points", player.getPoints());
object.addProperty("amount-donated", player.getAmountDonated());
object.addProperty("poison-damage", player.getPoisonDamage());
object.addProperty("blowpipe-scales", player.getBlowpipeScales());
object.add("inventory", builder.toJsonTree(player.getInventory().getItems()));
object.add("equipment", builder.toJsonTree(player.getEquipment().getItems()));
object.add("appearance", builder.toJsonTree(player.getAppearance().getLook()));
object.add("skills", builder.toJsonTree(player.getSkillManager().getSkills()));
object.add("quick-prayers", builder.toJsonTree(player.getQuickPrayers().getPrayers()));
object.add("friends", builder.toJsonTree(player.getRelations().getFriendList().toArray()));
object.add("ignores", builder.toJsonTree(player.getRelations().getIgnoreList().toArray()));
/** PRESETS **/
object.add("presets", builder.toJsonTree(player.getPresets()));
/** BANK **/
for(int i = 0; i < player.getBanks().length; i++) {
if(i == Bank.BANK_SEARCH_TAB_INDEX) {
continue;
}
if(player.getBank(i) != null) {
object.add("bank-"+i, builder.toJsonTree(player.getBank(i).getValidItems()));
}
}
writer.write(builder.toJson(object));
writer.close();
} catch (Exception e) {
// An error happened while saving.
Elvarg.getLogger().log(Level.WARNING,
"An error has occured while saving a character file!", e);
}
}
public static boolean playerExists(String p) {
p = Misc.formatPlayerName(p.toLowerCase());
return new File("./data/saves/characters/"+p+".json").exists();
}
}
|
package Pojos;
// Generated Sep 19, 2015 12:30:29 PM by Hibernate Tools 4.3.1
import java.util.HashSet;
import java.util.Set;
/**
* Laboratorio generated by hbm2java
*/
public class Laboratorio implements java.io.Serializable {
private Integer idLaboratorio;
private String nombreLaboratorio;
private String direccionLaboratorio;
private String telefonoLaboratorio;
private String correoLaboratorio;
private boolean estadoLaboratorio;
private Set empleadoLaboratorios = new HashSet(0);
public Laboratorio() {
}
public Laboratorio(String nombreLaboratorio, String direccionLaboratorio, String telefonoLaboratorio, String correoLaboratorio, boolean estadoLaboratorio) {
this.nombreLaboratorio = nombreLaboratorio;
this.direccionLaboratorio = direccionLaboratorio;
this.telefonoLaboratorio = telefonoLaboratorio;
this.correoLaboratorio = correoLaboratorio;
this.estadoLaboratorio = estadoLaboratorio;
}
public Laboratorio(String nombreLaboratorio, String direccionLaboratorio, String telefonoLaboratorio, String correoLaboratorio, boolean estadoLaboratorio, Set empleadoLaboratorios) {
this.nombreLaboratorio = nombreLaboratorio;
this.direccionLaboratorio = direccionLaboratorio;
this.telefonoLaboratorio = telefonoLaboratorio;
this.correoLaboratorio = correoLaboratorio;
this.estadoLaboratorio = estadoLaboratorio;
this.empleadoLaboratorios = empleadoLaboratorios;
}
public Integer getIdLaboratorio() {
return this.idLaboratorio;
}
public void setIdLaboratorio(Integer idLaboratorio) {
this.idLaboratorio = idLaboratorio;
}
public String getNombreLaboratorio() {
return this.nombreLaboratorio;
}
public void setNombreLaboratorio(String nombreLaboratorio) {
this.nombreLaboratorio = nombreLaboratorio;
}
public String getDireccionLaboratorio() {
return this.direccionLaboratorio;
}
public void setDireccionLaboratorio(String direccionLaboratorio) {
this.direccionLaboratorio = direccionLaboratorio;
}
public String getTelefonoLaboratorio() {
return this.telefonoLaboratorio;
}
public void setTelefonoLaboratorio(String telefonoLaboratorio) {
this.telefonoLaboratorio = telefonoLaboratorio;
}
public String getCorreoLaboratorio() {
return this.correoLaboratorio;
}
public void setCorreoLaboratorio(String correoLaboratorio) {
this.correoLaboratorio = correoLaboratorio;
}
public boolean isEstadoLaboratorio() {
return this.estadoLaboratorio;
}
public void setEstadoLaboratorio(boolean estadoLaboratorio) {
this.estadoLaboratorio = estadoLaboratorio;
}
public Set getEmpleadoLaboratorios() {
return this.empleadoLaboratorios;
}
public void setEmpleadoLaboratorios(Set empleadoLaboratorios) {
this.empleadoLaboratorios = empleadoLaboratorios;
}
}
|
package org.alienideology.jcord.event.guild.update;
import org.alienideology.jcord.Identity;
import org.alienideology.jcord.event.guild.GuildUpdateEvent;
import org.alienideology.jcord.handle.guild.IGuild;
/**
* @author AlienIdeology
*/
public class GuildContentFilterUpdateEvent extends GuildUpdateEvent {
private final IGuild.ContentFilterLevel oldContentFilter;
public GuildContentFilterUpdateEvent(Identity identity, int sequence, IGuild guild, IGuild.ContentFilterLevel oldContentFilter) {
super(identity, sequence, guild);
this.oldContentFilter = oldContentFilter;
}
public IGuild.ContentFilterLevel getNewContentFilter() {
return getGuild().getContentFilterLevel();
}
public IGuild.ContentFilterLevel getOldContentFilter() {
return oldContentFilter;
}
}
|
/**
*
*/
package com.shubhendu.javaworld.datastructures.arrays;
/**
* @author ssingh
*
*/
public class MedianSortedArrays {
public double findMedianSortedArrays(int[] nums1, int[] nums2) {
int hi1 = nums1.length;
int hi2 = nums2.length;
return findMedianSortedArrays(nums1, nums2, 0, hi1 - 1, 0, hi2 - 1);
}
private double findMedianSortedArrays(int[] nums1, int[] nums2, int lo1, int hi1, int lo2, int hi2) {
if (hi1 == lo1 && hi2 == lo2) {
return (nums1[lo1] + nums2[lo2]) / 2;
}
if (hi1 - lo1 == 1 && hi2 - lo2 == 1) {
return (double) (Math.max(nums1[lo1], nums2[lo2]) + Math.min(nums1[hi1], nums2[hi2])) / 2;
}
double median1 = 0;
int mid1 = -1;
if (lo1 == hi1) {
median1 = nums1[lo1];
} else {
mid1 = lo1 + (hi1 - lo1) / 2;
if ( ((hi1 - lo1) + 1) % 2 == 0) {
median1 = (double) (nums1[mid1] + nums1[mid1 + 1]) / 2.0;
} else {
median1 = nums1[mid1];
}
}
double median2 = 0;
int mid2 = -1;
if (lo2 == hi2) {
median2 = nums2[lo2];
} else {
mid2 = lo2 + (hi2 - lo2) / 2;
if (((hi2 - lo2) + 1) % 2 == 0) {
median2 = (double) (nums2[mid2] + nums2[mid2 + 1]) / 2.0;
} else {
median2 = nums2[mid2];
}
}
if (median1 == median2) {
return median1;
} else if (median1 > median2) {
if (mid1 < 0) {
mid1 = hi1 + 1;
}
if (mid2 < 0) {
mid2 = lo2 - 1;
}
return findMedianSortedArrays(nums1, nums2, lo1, mid1, mid2 + 1, hi2);
} else {
if (mid1 < 0) {
mid1 = lo1 - 1;
}
if (mid2 < 0) {
mid2 = hi2 + 1;
}
return findMedianSortedArrays(nums1, nums2, mid1 + 1, hi1, lo2, mid2);
}
}
/**
* @param args
*/
public static void main(String[] args) {
int [] nums1 = new int[] {1,3,7,8};
int [] nums2 = new int[] {2,9};
MedianSortedArrays m = new MedianSortedArrays();
double median = m.findMedianSortedArrays(nums1, nums2);
System.out.println(median);
}
}
|
package net.smile.ssm.config;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.ConfigurableWebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.filter.CharacterEncodingFilter;
import org.springframework.web.servlet.DispatcherServlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;
/**
* Created by smile on 8/25/16.
*/
public class WebInitializer implements WebApplicationInitializer {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
applicationContext.register(FrameworkConfiguration.class);
applicationContext.setServletContext(servletContext);
initFilter(servletContext);
addDispatchServlet(servletContext, applicationContext);
}
/**
* 配置springMVC DispatchServlet
* @param servletContext
*/
private void addDispatchServlet(ServletContext servletContext,
ConfigurableWebApplicationContext applicationContext){
ServletRegistration.Dynamic dispatchServlet =
servletContext.addServlet("dispatch",new DispatcherServlet(applicationContext));
dispatchServlet.setLoadOnStartup(1);
//配置dispatchServlet拦截路径
dispatchServlet.addMapping("/");
}
/**
* 设置过滤器
* @param servletContext
*/
private void initFilter(ServletContext servletContext){
//添加字符集过滤器
CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
characterEncodingFilter.setEncoding("UTF-8");
servletContext.addFilter("characterEncodingFilter", characterEncodingFilter);
}
}
|
package ch13.ex13_06;
public class QuoInsert {
static String quoInsert(String number, int quo, String separator) {
StringBuilder buf = new StringBuilder(number);
//指定された桁ごとにループをまわす
for (int point = buf.length() - quo; point > 0; point-= quo) {
//セパレーターの挿入
buf.insert(point, separator);
}
return buf.toString();
}
}
|
package com.mideas.rpg.v2.command;
public class Command {
public void read() {}
}
|
/*
* Purpose:-Implementation of Eager initialization Singleton Pattern
*
* @Author:-Arpana Kumari
* Version:-1.0
* @Since:-7 May, 2018
*/
package com.bridgeit.creationalDesignPatterens;
public class EagerInitialization {
// Early, instance will be created at load time
private static final EagerInitialization instance = new EagerInitialization();
// private constructor to avoid client applications to use constructor
private EagerInitialization() {
};
public static EagerInitialization getInstance() {
return instance;
}
public static void main(String[] args) {
EagerInitialization instance1 = new EagerInitialization();
EagerInitialization instance2 = new EagerInitialization();
System.out.println("bridge lab");
System.out.println(instance1);
System.out.println(instance2);
}
}
|
package com.yauheni.ananchuk.service;
import com.yauheni.ananchuk.domain.Per;
import com.yauheni.ananchuk.domain.Room;
import com.yauheni.ananchuk.repository.PerRepository;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.yauheni.ananchuk.repository.RoomRepository;
import java.util.List;
@Component
public class RoomManager {
@Autowired
private RoomRepository roomRepository;
@Autowired
private PerRepository perRepository;
public void addRoom(Room room){ roomRepository.save(room); }
public void deleteRoom(Room room){ roomRepository.delete(room);}
public void updateRoom(Room room, String comment) {
room.setComments(comment);
}
public List<Per> getPersInRoom(Room room) { return room.getPers();}
public void deletePerInRoom(Room room,Per per){
room.getPers().remove(per);
roomRepository.save(room);
perRepository.delete(per);
}
public Iterable<Room> findAllRoom() { return roomRepository.findAll(); }
public void deletePersInRoomBySurname(Room room, String surname){
List<Per> perList = room.getPers();
for(int i = 0; i < perList.size();i++){
if(perList.get(i).getSurname() == surname) {
ObjectId id = perList.get(i).getId();
perList.remove(i);
perRepository.delete(id);
i--;
}
}
roomRepository.save(room);
}
}
|
package com.foodie.homeslice.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class Item {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long itemId;
private String itemName;
private String image;
private Long categoryId;
private Double price;
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public Long getItemId() {
return itemId;
}
public void setItemId(Long itemId) {
this.itemId = itemId;
}
public String getItemName() {
return itemName;
}
public void setItemName(String itemName) {
this.itemName = itemName;
}
public Long getCategoryId() {
return categoryId;
}
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
}
|
package com.netflix.governator;
/**
* Core governator features. Features are configured/enabled on {@link GovernatorConfiguration}
*
* @author elandau
* @deprecated Functionality moved https://github.com/Netflix/karyon/tree/3.x
*/
@Deprecated
public enum GovernatorFeatures implements GovernatorFeature {
/**
* When disabled, if the injector created using Governator.createInjector() fails the resulting
* application will not shutdown and @PreDestroy methods will not be invoked. This is useful
* for debugging an application that failed to start by allowing admin servers to continue
* running.
*/
SHUTDOWN_ON_ERROR(true),
;
private final boolean enabled;
GovernatorFeatures(boolean enabled) {
this.enabled = enabled;
}
@Override
public boolean isEnabledByDefault() {
return enabled;
}
}
|
package com.realcom.helloambulance.util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
public abstract class CommonDao<T> {
@Autowired
protected JdbcTemplate jdbcTemplate;
public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
} |
package com.bcgbcg.br.util;
public class QnaPaging {
public static String getPaging(String path, int nowPage, int recordPerPage, int totalRecord) {
StringBuffer sb = new StringBuffer();
// nowPage : 현재 페이지 번호
// recordPerPage : 한 페이지에 표시할 레코드(회원, 게시글) 개수
// totalRecord : 전체 레코드 개수
int totalPage = 0;
int beginPageOfBlock = 0; // 블록의 시작 페이지 번호
int endPageOfBlock = 0; // 블록의 끝 페이지 번호
int pagePerBlock = 3; // 한 블록당 표시할 페이지 개수
// 전체 레코드 개수와 한 페이지에 표시할 레코드 개수를 알면
// 전체 페이지 개수를 알 수 있다.
totalPage= (int)(totalRecord / recordPerPage);
if((totalRecord%recordPerPage) != 0) {
totalPage++;
}
// totalPage조정 (잘못된 연산/이동 대비용)
if(nowPage>totalPage) {
totalPage = nowPage;
}
// 블록에 표시할 시작 페이지 번호와 끝 페이지 번호 계산
beginPageOfBlock = (int)(((nowPage-1) / pagePerBlock) * pagePerBlock) + 1;
endPageOfBlock = beginPageOfBlock + pagePerBlock - 1;
// endPageOfBlock 조정(자주 발생)
if(endPageOfBlock > totalPage) {
endPageOfBlock = totalPage;
}
// 이전 버튼 표시
// 이전 버튼의 링크 필요 유무에 따라 if 처리
// 1. 이전 버튼의 링크가 필요 없는 경우 : beginPageOfBlock<pagePerBlock
// 2. 이전 버튼의 링크가 필요한 경우
if(beginPageOfBlock < pagePerBlock) {
sb.append("<span style='color:lightgray;'>◀</span> ");
}else {
sb.append("<a href='" + path + "?currentPage=" + (beginPageOfBlock - 1) + "'>◀</a> ");
}
// 페이지 번호 표시
// 페이지 번호의 링크 필요 유무에 따라 if처리
// 1. 페이지 번호의 링크가 필요없는 경우 : page == nowPage
// 2. 페이지 번호의 링크가 필요한 경우 : 그 외...
for(int page = beginPageOfBlock; page <= endPageOfBlock; page++) {
if(page == nowPage) {
sb.append("<span style='font-weight:bold'>" + page + "</span> ");
}else {
//sb.append("<a href='" + path + "?currentPage=" + (page) + "'>" + page + "</a> ");
sb.append("<a href='" + path + "?currentPage=" + (page) + "'>" + page + "</a> ");
}
}
// 다음 버튼 표시
if(endPageOfBlock >= totalPage) {
sb.append(" <span style='color:lightgray;'>▶</span>");
}else {
sb.append(" <a href='" + path + "?currentPage=" + (endPageOfBlock + 1) + "'>▶</a>");
}
return sb.toString();
}
} |
package com.pybeta.ui.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.view.View.OnClickListener;
import com.pybeta.daymatter.R;
public class UcTitleBar extends LinearLayout implements OnClickListener {
private Context mContext = null;
private TextView mTvTitle = null;
private ImageView mImgMenu = null;
private ImageView mImgClose = null;
private ImageView mImgBack = null;
private ImageButton mBtnAdd = null;
private ImageButton mBtnEdit = null;
private ImageButton mBtnComplete = null;
private ImageButton mBtnShare = null;
private ImageButton mBtnFeedback = null;
private ITitleBarListener mListener = null;
public UcTitleBar(Context context) {
super(context);
// TODO Auto-generated constructor stub
initView(context);
}
public UcTitleBar(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
initView(context);
}
private void initView(Context context) {
this.mContext = context;
LayoutInflater inflater = LayoutInflater.from(context);
ViewGroup vg = (ViewGroup) inflater.inflate(R.layout.uc_title_bar, null);
mImgClose = (ImageView) vg.findViewById(R.id.img_close_titlebar);
mImgBack = (ImageView) vg.findViewById(R.id.img_back_titlebar);
mImgMenu = (ImageView) vg.findViewById(R.id.img_menu_titlebar);
mTvTitle = (TextView) vg.findViewById(R.id.tv_title);
mBtnAdd = (ImageButton) vg.findViewById(R.id.btn_add);
mBtnEdit = (ImageButton) vg.findViewById(R.id.btn_edit);
mBtnComplete = (ImageButton) vg.findViewById(R.id.btn_complete);
mBtnShare = (ImageButton) vg.findViewById(R.id.btn_share);
mBtnFeedback = (ImageButton) vg.findViewById(R.id.btn_feedback);
mImgClose.setOnClickListener(this);
mBtnAdd.setOnClickListener(this);
mImgMenu.setOnClickListener(this);
mImgBack.setOnClickListener(this);
mBtnEdit.setOnClickListener(this);
mBtnComplete.setOnClickListener(this);
mBtnShare.setOnClickListener(this);
mBtnFeedback.setOnClickListener(this);
this.addView(vg);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if (null == mListener) {
mListener = tempListener;
}
if(v == mImgClose){
mListener.closeClick(null);
}else if (v == mImgMenu){
mListener.menuClick(null);
}else if (v == mImgBack) {
mListener.backClick(null);
}else if(v == mBtnAdd){
mListener.addClick(null);
} else if (v == mBtnEdit) {
mListener.editClick(null);
} else if (v == mBtnComplete) {
mListener.completeClick(null);
} else if (v == mBtnShare) {
mListener.shareClick(null);
}else if(v == mBtnFeedback){
mListener.feedBackClick(null);
}
}
public interface ITitleBarListener {
void closeClick(Object obj);
void menuClick(Object obj);
void backClick(Object obj);
void addClick(Object obj);
void editClick(Object obj);
void completeClick(Object obj);
void shareClick(Object obj);
void feedBackClick(Object obj);
}
private ITitleBarListener tempListener = new ITitleBarListener() {
@Override
public void shareClick(Object obj) {
// TODO Auto-generated method stub
}
@Override
public void editClick(Object obj) {
// TODO Auto-generated method stub
}
@Override
public void completeClick(Object obj) {
// TODO Auto-generated method stub
}
@Override
public void backClick(Object obj) {
// TODO Auto-generated method stub
}
@Override
public void menuClick(Object obj) {
// TODO Auto-generated method stub
}
@Override
public void feedBackClick(Object obj) {
// TODO Auto-generated method stub
}
@Override
public void addClick(Object obj) {
// TODO Auto-generated method stub
}
@Override
public void closeClick(Object obj) {
// TODO Auto-generated method stub
}
};
//--------------------公开方法----------------------
/**
* 初始化监听器
* @param listener
*/
public void setListener(ITitleBarListener listener) {
mListener = listener;
}
/**
* 设置bar中间的文字
* @param text
*/
public void setTitleText(String text){
this.mTvTitle.setText(text+"");
}
/**
* 设置视图是否可视
* @param isCloseVisible 关闭
* @param isBackVisible 返回
* @param isMenuVisible 菜单
* @param isAddVisible 添加
* @param isEidtVisible 编辑
* @param isCompleteVisible 完成
* @param isShareVisible 分享
* @param isFeedbackVisible 反馈
*
*/
public void setViewVisible(boolean isCloseVisible,boolean isBackVisible ,boolean isMenuVisible , boolean isAddVisible, boolean isEidtVisible, boolean isCompleteVisible, boolean isShareVisible, boolean isFeedbackVisible){
this.mBtnAdd.setVisibility(isAddVisible ? View.VISIBLE :View.GONE);
this.mBtnEdit.setVisibility(isEidtVisible ? View.VISIBLE :View.GONE);
this.mBtnComplete.setVisibility(isCompleteVisible ? View.VISIBLE :View.GONE);
this.mBtnShare.setVisibility(isShareVisible ? View.VISIBLE :View.GONE);
this.mBtnFeedback.setVisibility(isFeedbackVisible ? View.VISIBLE :View.GONE);
this.mImgBack.setVisibility(isBackVisible ? View.VISIBLE :View.GONE);
this.mImgMenu.setVisibility(isMenuVisible ? View.VISIBLE :View.GONE);
this.mImgClose.setVisibility(isCloseVisible ? View.VISIBLE :View.GONE);
}
}
|
package com.demo.withdrawal.model;
import java.math.BigDecimal;
public class PendingOrder {
private final Integer orderId;
private final Tokens token;
private final BigDecimal amount;
public PendingOrder(Integer orderId, Tokens token, BigDecimal amount) {
this.orderId = orderId;
this.token = token;
this.amount = amount;
}
public Integer getOrderId() {
return orderId;
}
public Tokens getToken() {
return token;
}
public BigDecimal getAmount() {
return amount;
}
}
|
package com.tencent.mm.plugin.bbom;
import com.tencent.mm.bg.c;
import com.tencent.mm.kernel.a.b.a;
import com.tencent.mm.kernel.a.b.b;
import com.tencent.mm.kernel.g;
import com.tencent.mm.model.p;
import com.tencent.mm.plugin.fts.a.n;
public final class f extends p implements b {
public f() {
super(c.Un("search"));
}
public final void parallelsDependency() {
a.a(this, com.tencent.mm.kernel.api.c.class).aN(g.n(n.class));
}
}
|
package exercise2;
import static org.junit.Assert.*;
import org.junit.Test;
public class PalindromeTest {
@Test
public void test1() {
assertEquals(false, StringUtility.isPalindrome("I am aliveevilam aI"));
}
@Test
public void test2() {
assertEquals(true, StringUtility.isPalindrome("aibohphobia"));
}
@Test
public void test3() {
assertEquals(false, StringUtility.isPalindrome(" ,. ., "));
}
@Test
public void test4() {
assertEquals(true, StringUtility.isPalindrome(""));
}
@Test
public void test5() {
assertEquals(true, StringUtility.isPalindrome(" "));
}
@Test
public void test6() {
assertEquals(true, StringUtility.isPalindrome("z"));
}
@Test
public void test7() {
assertEquals(false, StringUtility.isPalindrome("aAccX' 'xccAa"));
}
@Test
public void test8() {
assertEquals(true, StringUtility.isPalindrome("\n\\ \\\n"));
}
@Test
public void test9() {
assertEquals(false, StringUtility.isPalindrome("(([ [] ]))"));
}
}
|
/*
* [y] hybris Platform
*
* Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.cmsfacades.common.predicate;
import de.hybris.platform.catalog.CatalogVersionService;
import org.springframework.beans.factory.annotation.Required;
import java.util.function.Predicate;
/**
* Predicate to test if a given catalog exists.
* <p>
* Returns <tt>TRUE</tt> if the given catalog exists; <tt>FALSE</tt> otherwise.
* </p>
*/
public class CatalogExistsPredicate implements Predicate<String>
{
private CatalogVersionService catalogVersionService;
@Override
public boolean test(final String catalogId)
{
return getCatalogVersionService().getAllCatalogVersions().stream()
.anyMatch(cat -> cat.getCatalog().getId().equals(catalogId));
}
protected CatalogVersionService getCatalogVersionService()
{
return catalogVersionService;
}
@Required
public void setCatalogVersionService(final CatalogVersionService catalogVersionService)
{
this.catalogVersionService = catalogVersionService;
}
}
|
package lotto.step3.domain;
import lotto.step3.domain.LottoNumber;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
class LottoNumberTest {
@ParameterizedTest
@DisplayName("로또 번호는 1~45 사이 숫자만 올 수 있다.")
@ValueSource(ints = {-1, 0, 46})
void checkValidLottoNumber(int number) {
Assertions.assertThatThrownBy(() -> new LottoNumber(number)).isInstanceOf(IllegalArgumentException.class);
}
}
|
package com.binary.mindset.tasklistmanagement.service;
import com.binary.mindset.tasklistmanagement.model.Task;
import java.util.List;
public interface TaskService {
List<Task> findAllByProject(Integer projectId);
Task findByTaskIdAndProjectId(Integer taskId, Integer projectId);
void deleteAllByProjectId(Integer projectId);
void deleteById(Integer taskId);
void deleteByIdAndProjectId(Integer taskId, Integer projectId);
}
|
package com.bingo.code.example.design.flyweight.nodesign;
import java.util.*;
/**
* ��ȫ����ʵ�ֳɵ���
*/
public class SecurityMgr {
private static SecurityMgr securityMgr = new SecurityMgr();
private SecurityMgr(){
}
public static SecurityMgr getInstance(){
return securityMgr;
}
/**
* �������ڼ䣬������ŵ�¼��Ա��Ӧ��Ȩ�ޣ�
* ��WebӦ���У���Щ����ͨ�����ŵ�session��
*/
private Map<String,Collection<AuthorizationModel>> map =
new HashMap<String,Collection<AuthorizationModel>>();
/**
* ģ���¼�Ĺ���
* @param user ��¼���û�
*/
public void login(String user){
//��¼��ʱ�����Ҫ�Ѹ��û���ӵ�е�Ȩ�ޣ������ݿ���ȡ�������ŵ�������ȥ
Collection<AuthorizationModel> col = queryByUser(user);
map.put(user, col);
}
/**
* �ж�ij�û���ij����ȫʵ���Ƿ�ӵ��ijȨ��
* @param user �����Ȩ���û�
* @param securityEntity ��ȫʵ��
* @param permit Ȩ��
* @return true��ʾӵ����ӦȨ�ޣ�false��ʾû����ӦȨ��
*/
public boolean hasPermit(String user,String securityEntity,String permit){
Collection<AuthorizationModel> col = map.get(user);
if(col==null || col.size()==0){
System.out.println(user+"û�е�¼����û�б������κ�Ȩ��");
return false;
}
for(AuthorizationModel am : col){
//�����ǰʵ���������Ƿ�ͬһ��ʵ������
System.out.println("am=="+am);
if(am.getSecurityEntity().equals(securityEntity)
&& am.getPermit().equals(permit)){
return true;
}
}
return false;
}
/**
* �����ݿ��л�ȡij����ӵ�е�Ȩ��
* @param user ��Ҫ��ȡ��ӵ�е�Ȩ����Ա
* @return ij����ӵ�е�Ȩ��
*/
private Collection<AuthorizationModel> queryByUser(String user){
Collection<AuthorizationModel> col = new ArrayList<AuthorizationModel>();
for(String s : TestDB.colDB){
String ss[] = s.split(",");
if(ss[0].equals(user)){
AuthorizationModel am = new AuthorizationModel();
am.setUser(ss[0]);
am.setSecurityEntity(ss[1]);
am.setPermit(ss[2]);
col.add(am);
}
}
return col;
}
}
|
package com.tencent.mm.plugin.luckymoney.ui;
import com.tencent.mm.plugin.luckymoney.b.i;
import com.tencent.mm.plugin.luckymoney.ui.LuckyMoneyMyRecordUI.4;
import com.tencent.mm.ui.base.h.c;
class LuckyMoneyMyRecordUI$4$1 implements c {
final /* synthetic */ int kVN;
final /* synthetic */ 4 kVO;
LuckyMoneyMyRecordUI$4$1(4 4, int i) {
this.kVO = 4;
this.kVN = i;
}
public final void ju(int i) {
switch (i) {
case 0:
i sm = LuckyMoneyMyRecordUI.f(this.kVO.kVL).sm(this.kVN);
if (sm != null) {
LuckyMoneyMyRecordUI.b(this.kVO.kVL, this.kVN);
LuckyMoneyMyRecordUI.a(this.kVO.kVL, sm, this.kVN);
return;
}
return;
default:
return;
}
}
}
|
package cn.ehanmy.hospital.mvp.model.entity.member_info;
import java.io.Serializable;
public class MemberMiniInfoBean implements Serializable {
private String memberId;
private String userName;
private String nickName;
private String mobile;
private String headImage;
@Override
public String toString() {
return "MemberMiniInfoBean{" +
"memberId='" + memberId + '\'' +
", userName='" + userName + '\'' +
", nickName='" + nickName + '\'' +
", mobile='" + mobile + '\'' +
", headImage='" + headImage + '\'' +
'}';
}
public String getMemberId() {
return memberId;
}
public void setMemberId(String memberId) {
this.memberId = memberId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getHeadImage() {
return headImage;
}
public void setHeadImage(String headImage) {
this.headImage = headImage;
}
}
|
/**
* com.takshine.jf.controller.LoginController.java
* COPYRIGHT © 2014 TAKSHINE.com Inc.,ALL RIGHTS RESERVED.
* 北京德成鸿业咨询服务有限公司版权所有.
*/
package com.takshine.wxcrm.controller;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.takshine.core.service.CRMService;
import com.takshine.wxcrm.base.common.Constants;
import com.takshine.wxcrm.base.common.ErrCode;
import com.takshine.wxcrm.base.util.DateTime;
import com.takshine.wxcrm.base.util.UserUtil;
import com.takshine.wxcrm.domain.AccessLogs;
import com.takshine.wxcrm.message.error.CrmError;
import com.takshine.wxcrm.message.sugar.AccesslogAdd;
import com.takshine.wxcrm.message.sugar.AccesslogResp;
import com.takshine.wxcrm.message.sugar.UserAdd;
import com.takshine.wxcrm.message.sugar.UserReq;
import com.takshine.wxcrm.message.sugar.UsersResp;
import com.takshine.wxcrm.service.AccessLogsService;
/**
* 文章信息 页面控制器
*
* @author [liulin Date:2014-01-10]
*
*/
@Controller
@RequestMapping("/access")
public class AccessController {
// 日志
protected static Logger logger = Logger
.getLogger(AccessController.class.getName());
@Autowired
@Qualifier("cRMService")
private CRMService cRMService;
/**
*
*
* @param request
* @param response
* @return
* @throws Exception
*/
@RequestMapping("/total")
public String accessCount(HttpServletRequest request, HttpServletResponse response)
throws Exception {
String weekly = request.getParameter("weekly");
weekly = (null == weekly ? "curr":weekly);
String type = request.getParameter("type");
type = (null == type ? "day" : type);
String crmId = UserUtil.getCurrUser(request).getCrmId();
String openId = UserUtil.getCurrUser(request).getOpenId();
StringBuffer dim = new StringBuffer();
StringBuffer fact = new StringBuffer();
String startDate = null,endDate = null;
Calendar calendar=Calendar.getInstance(Locale.CHINA);
if(null == weekly || "curr".equals(weekly)){
calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
startDate = DateTime.date2Str(calendar.getTime(),"yyyy-MM-dd");
calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
calendar.add(Calendar.WEEK_OF_YEAR, 1);
endDate = DateTime.date2Str(calendar.getTime(),"yyyy-MM-dd");
}else{
calendar.add(Calendar.DATE, -1 * 7);
calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
startDate = DateTime.date2Str(calendar.getTime(),"yyyy-MM-dd");
calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
calendar.add(Calendar.WEEK_OF_YEAR, 1);
endDate = DateTime.date2Str(calendar.getTime(),"yyyy-MM-dd");
}
List<AccessLogs> accessList = null;
if(null != type && ("day".equals(type) || "module".equals(type))){
accessList = cRMService.getDbService().getAccessLogsService().countAccessLogs(openId,startDate, endDate, type);
if(null != accessList && accessList.size() >0){
//日访问
if(null != type && "day".equals(type)){
AccessLogs log = null;
for(int i=0;i<accessList.size();i++){
log = accessList.get(i);
dim.append("'"+log.getStartDate()+"'");
fact.append(log.getAccessCount());
if(i<accessList.size() - 1){
dim.append(",");
fact.append(",");
}
}
}
//模块访问
else if(null != type && "module".equals(type)){
List<String> dateList = new ArrayList<String>();
List<String> moduleList = new ArrayList<String>();
Map<String,Integer> map = new HashMap<String, Integer>();
AccessLogs log = null;
//获取日期及模块
for(int i=0;i<accessList.size();i++){
log = accessList.get(i);
if(!dateList.contains(log.getStartDate())){
dateList.add(log.getStartDate());
if("".equals(dim.toString())){
dim.append("'"+log.getStartDate()+"'");
}else{
dim.append(",'").append(log.getStartDate()+"'");
}
}
if(!moduleList.contains(log.getAccessModule())){
moduleList.add(log.getAccessModule());
}
map.put(log.getStartDate()+"_"+log.getAccessModule(), Integer.valueOf(log.getAccessCount()));
}
//拼装数据
for(int i=0;i<moduleList.size();i++){
if("".equals(fact.toString())){
fact.append("{name:'").append(moduleList.get(i)).append("',");
}else{
fact.append(",").append("{name:'").append(moduleList.get(i)).append("',");
}
fact.append("data:[");
for(int j=0;j<dateList.size();j++){
if(j != 0){
fact.append(",");
}
if(map.containsKey(dateList.get(j) +"_"+moduleList.get(i))){
fact.append(map.get(dateList.get(j) +"_"+moduleList.get(i)));
}else{
fact.append("0");
}
}
fact.append("]}");
}
}
request.setAttribute("dim", dim.toString());
request.setAttribute("fact", fact.toString());
}else{
request.setAttribute("flag", "nodata");
}
}
//用户访问
else if(null != type && "user".equals(type)){
List<AccessLogs> logs = new ArrayList<AccessLogs>();
accessList = cRMService.getDbService().getAccessLogsService().countAccessLogs(openId,startDate, endDate, "top5");
logs.addAll(accessList);
request.setAttribute("logs", JSONArray.fromObject(logs));
}
request.setAttribute("type", type);
request.setAttribute("weekly", weekly);
return "access/access";
}
/**
* 查询 用户行为 信息列表
*
* @param request
* @param response
* @return
* @throws Exception
*/
@RequestMapping("/addlist")
@ResponseBody
public String addlist(HttpServletRequest request, HttpServletResponse response)
throws Exception {
String str = "";
//查询参数
String weekly = request.getParameter("weekly");
weekly = (null == weekly ? "curr":weekly);
String crmId = UserUtil.getCurrUser(request).getCrmId();
//error 对象
CrmError crmErr = new CrmError();
//判断crmId是否为空
if(null != crmId && !"".equals(crmId)){
String startDate = null,endDate = null;
Calendar calendar=Calendar.getInstance(Locale.CHINA);
if(null == weekly || "curr".equals(weekly)){
calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
startDate = DateTime.date2Str(calendar.getTime(),"yyyy-MM-dd");
calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
calendar.add(Calendar.WEEK_OF_YEAR, 1);
endDate = DateTime.date2Str(calendar.getTime(),"yyyy-MM-dd");
}else{
calendar.add(Calendar.DATE, -1 * 7);
calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
startDate = DateTime.date2Str(calendar.getTime(),"yyyy-MM-dd");
calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
calendar.add(Calendar.WEEK_OF_YEAR, 1);
endDate = DateTime.date2Str(calendar.getTime(),"yyyy-MM-dd");
}
AccessLogs sche = new AccessLogs();
sche.setCrmId(crmId);
sche.setStartDate(startDate);
sche.setEndDate(endDate);
// 查询返回结果
AccesslogResp cResp = cRMService.getDbService().getAccessLogsService().addcountAccessLogs(sche,"WX");
String errorCode = cResp.getErrcode();
if(ErrCode.ERR_CODE_0.equals(errorCode)){
List<AccesslogAdd> cList = cResp.getAccesslog();
logger.info("cList is ->" + cList.size());
str = JSONArray.fromObject(cList).toString();
logger.info("str is ->" + str);
return str;
}else{
crmErr.setErrorCode(cResp.getErrcode());
crmErr.setErrorMsg(cResp.getErrmsg());
}
}else {
crmErr.setErrorCode(ErrCode.ERR_CODE_1001001);
crmErr.setErrorMsg(ErrCode.ERR_MSG_UNBIND);
}
return JSONObject.fromObject(crmErr).toString();
}
} |
package com.puxtech.reuters.offset;
import com.puxtech.reuters.rfa.Common.ConfigNode;
import com.puxtech.reuters.rfa.Common.Configuration;
import com.puxtech.reuters.rfa.Common.SubNode;
import com.puxtech.reuters.rfa.utility.CommonAdjust;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Job;
import org.quartz.JobBuilder;
import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import org.quartz.SimpleScheduleBuilder;
import org.quartz.Trigger;
import org.quartz.TriggerBuilder;
import org.quartz.impl.StdSchedulerFactory;
import com.puxtech.reuters.db.ReuterDao;
import com.puxtech.reuters.model.ContractOffset;
import com.puxtech.reuters.model.OffsetTreeMap;
import com.puxtech.reuters.model.T_offset;
public enum Singleton {
INSTANCE;
private final Log offsetLog = LogFactory.getLog("offset");
private ConcurrentHashMap<String, ContractOffset> optimalContractOffset;
private Singleton() {}
//getter setter begin
private static String quoteSource = Configuration.getInstance().getQuoteSource();
public static String getServerName() {
return quoteSource;
}
//getter setter end
//处理价差对象 begin
private ConcurrentHashMap<String, Vector<ContractOffset>> t_contractOffset;
public ConcurrentHashMap<String, Vector<ContractOffset>> getT_contractOffset() {
t_contractOffset = ReuterDao.getInstance().queryT_contractoffset();
return t_contractOffset;
}
public void setT_contractOffset(ConcurrentHashMap<String, Vector<ContractOffset>> offset) {
t_contractOffset = offset;
}
public void refreshT_contractOffset(){
t_contractOffset = ReuterDao.getInstance().queryT_contractoffset();
offsetLog.info("刷新价差对象成功:" + t_contractOffset.size());
}
//处理价差对象 end
private static ConcurrentHashMap<String,Integer> diffMap = new ConcurrentHashMap<String,Integer>();
public static ConcurrentHashMap<String, Integer> getDiffMap() {
return diffMap;
}
public void loadDiffPeriod() {
offsetLog.info("loadDiffPeriod");
refreshDiffPeriod();
List<SubNode> allList = ReuterDao.queryDiffPeriod(quoteSource, 3);
for (SubNode cn : allList) {
addClearJob(cn.getAttenEndTime());
addRefreshJob(cn.getAttenBeginTime());
}
}
public void refreshDiffPeriod() {
offsetLog.info("refreshDiffPeriod");
List<SubNode> list = ReuterDao.queryDiffPeriod(quoteSource, 1);
int trycount=3;
while(trycount-->0 &&list.isEmpty()){
offsetLog.warn("没有获得点差衰减周期,10秒后重试");
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
}
list = ReuterDao.queryDiffPeriod(quoteSource, 1);
}
if(list.isEmpty()){
offsetLog.error("没有获得点差衰减周期,error");
}
for (SubNode cn : list) {
diffMap.put(cn.getExchangeCode(), cn.getDiffPricePeriod());
}
for (String key : diffMap.keySet()) {
offsetLog.info("价差衰减map:" + key + "," + diffMap.get(key));
}
}
private void addClearJob(java.util.Date date) {
try {
SchedulerFactory sf = new StdSchedulerFactory();
JobDetail jobDetail = JobBuilder.newJob(ClearDiffMapJob.class).build();
Trigger trigger = TriggerBuilder.newTrigger().startAt(date)
.withSchedule(SimpleScheduleBuilder.simpleSchedule()).build();
Scheduler sched = sf.getScheduler();
sched.scheduleJob(jobDetail, trigger);
sched.start();
} catch (SchedulerException e) {
offsetLog.info("addClearJob发生异常" + e.getMessage());
//e.printStackTrace();
}
}
private void addRefreshJob(java.util.Date date) {
try {
SchedulerFactory sf = new StdSchedulerFactory();
JobDetail jobDetail = JobBuilder.newJob(RefreshDiffMapJob.class).build();
Trigger trigger = TriggerBuilder.newTrigger().startAt(date).withSchedule(SimpleScheduleBuilder.simpleSchedule()).build();
Scheduler sched = sf.getScheduler();
sched.scheduleJob(jobDetail, trigger);
sched.start();
} catch (SchedulerException e) {
offsetLog.info("addRefreshJob发生异常" + e.getMessage());
//e.printStackTrace();
}
}
/**
* 投票选出理想价差,保证不同行情源投票选出唯一的价差值
*
* @param chm
* @return
*/
@SuppressWarnings("unchecked")
public synchronized ConcurrentHashMap<String, ContractOffset> voteOptimalContractOffset() {
if (t_contractOffset == null || t_contractOffset.size() == 0) {
return null;
} else {
ConcurrentHashMap<String, ContractOffset> result = new ConcurrentHashMap<String, ContractOffset>();
for (String commodityIdKey : t_contractOffset.keySet()) {
Vector<ContractOffset> cos = t_contractOffset.get(commodityIdKey);
OffsetTreeMap<ContractOffset, Integer> sortkey = new OffsetTreeMap<ContractOffset, Integer>();
for (ContractOffset contractOffset : cos) {
if (sortkey.containsKey(contractOffset)) {
sortkey.put(contractOffset, sortkey.get(contractOffset) + 1);
} else {
sortkey.put(contractOffset, 0);
}
}
List<ContractOffset> arrayList = new ArrayList(sortkey.entrySet());
Collections.sort(arrayList, new Comparator() {
public int compare(Object o1, Object o2) {
Map.Entry obj1 = (Map.Entry) o1;
Map.Entry obj2 = (Map.Entry) o2;
return ((Integer) obj2.getValue()).compareTo((Integer) obj1.getValue());
}
});
if (arrayList.size() > 0) {
result.put(commodityIdKey, (ContractOffset) ((Map.Entry) arrayList.get(0)).getKey());
offsetLog.info("最优价差:" + result.get(commodityIdKey));
} else {
return null;
}
}
return result;
}
}
/**
* 计算价差(价差 = 过去时间 * 原始价差 / 价差周期)
*
* @param contractOffset
* 价差对象
* @return
*/
public synchronized ConcurrentHashMap<String, Double> calDiff() {
ConcurrentHashMap<String, Double> result = new ConcurrentHashMap<String, Double>();
optimalContractOffset = voteOptimalContractOffset();
if (optimalContractOffset == null) {
offsetLog.info("optimalContractOffset为空");
return null;
} else {
for (String commodityId : optimalContractOffset.keySet()) {
Long nowMill = Calendar.getInstance().getTimeInMillis();
Long quotationMill = optimalContractOffset.get(commodityId).getOccurtime().getTime();
Long diffSec = (nowMill - quotationMill) / 1000;
if (diffMap != null && diffMap.keySet().contains(commodityId)) {
Double tempD = diffSec * 1d / diffMap.get(commodityId);
if (tempD >= 1 || tempD <= 0) {
result.put(commodityId, 0d);
T_offset co = new T_offset();
co.setCommodityId(commodityId);
co.setNowTime(new Date(nowMill));
co.setRecTime(new Date(quotationMill));
co.setDiffTime((nowMill - quotationMill) / 1000);
co.setDownset(0d);
co.setOffset(optimalContractOffset.get(commodityId).getOffset());
co.setDiffPricePeriod(diffMap.get(commodityId));
co.setSrc(quoteSource);
offsetLog.info("更新价差表:" + co.toString());
ReuterDao.updateT_OFFSET(co);
} else {
Double tempResult = optimalContractOffset.get(commodityId).getOffset() * Math.abs(1 - tempD);
result.put(commodityId, tempResult);
T_offset co = new T_offset();
co.setCommodityId(commodityId);
co.setNowTime(new Date(nowMill));
co.setRecTime(new Date(quotationMill));
co.setDiffTime((nowMill - quotationMill) / 1000);
co.setDownset(tempResult);
co.setOffset(optimalContractOffset.get(commodityId).getOffset());
co.setDiffPricePeriod(diffMap.get(commodityId));
co.setSrc(quoteSource);
offsetLog.info("更新价差表:" + co.toString());
ReuterDao.updateT_OFFSET(co);
}
}
}
}
return result;
}
private static void testVoteSys(){
ConcurrentHashMap<String, Vector<ContractOffset>> offset = new ConcurrentHashMap<String, Vector<ContractOffset>>();
Vector<ContractOffset> vectors = new Vector<ContractOffset>();
Date date = Calendar.getInstance().getTime();
ContractOffset co1 = new ContractOffset();
co1.setNewContract("new");
co1.setOldContract("old");
co1.setOccurtime(date);
co1.setOffset(12.3d);
co1.setSrc("src1");
co1.setSwitchDate("20150528");
co1.setWorldCommodityId("WTI");
ContractOffset co2 = new ContractOffset();
co2.setNewContract("new");
co2.setOldContract("old");
co2.setOccurtime(date);
co2.setOffset(12.4d);
co2.setSrc("src2");
co2.setSwitchDate("20150528");
co2.setWorldCommodityId("WTI");
vectors.add(co1);
vectors.add(co2);
// ContractOffset co3 = new ContractOffset();
// co3.setNewContract("new");
// co3.setOldContract("old");
// co3.setOccurtime(date);
// co3.setOffset(12.4d);
// co3.setSrc("src3");
// co3.setSwitchDate("20150528");
// co3.setWorldCommodityId("WTI");
// vectors.add(co3);
offset.put("WTI", vectors);
Singleton.INSTANCE.setT_contractOffset(offset);
while (true) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ConcurrentHashMap<String, ContractOffset> chm = Singleton.INSTANCE.voteOptimalContractOffset();
for (String key : chm.keySet()) {
// System.out.println(key + "," + chm.get(key));
if (chm.get(key).getOffset().equals(12.4)) {
System.out.println(chm.get(key).getOffset());
}
}
}
}
public static void main(String[] args){
Singleton.testVoteSys();
}
} |
package br.eti.ns.nssuite.requisicoes.nfe;
import br.eti.ns.nssuite.requisicoes._genericos.DownloadEventoReq;
public class DownloadEventoReqNFe extends DownloadEventoReq {
public String chNFe;
}
|
package jsettlers.logic.movable.civilian;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import jsettlers.algorithms.simplebehaviortree.BehaviorTreeHelper;
import jsettlers.algorithms.simplebehaviortree.Node;
import jsettlers.algorithms.simplebehaviortree.Root;
import jsettlers.common.buildings.EBuildingType;
import jsettlers.common.buildings.jobs.EBuildingJobType;
import jsettlers.common.buildings.jobs.IBuildingJob;
import jsettlers.common.mapobject.EMapObjectType;
import jsettlers.common.material.EMaterialType;
import jsettlers.common.menu.messages.SimpleMessage;
import jsettlers.common.movable.EDirection;
import jsettlers.common.movable.EMovableAction;
import jsettlers.common.movable.EMovableType;
import jsettlers.common.player.ECivilisation;
import jsettlers.common.position.ShortPoint2D;
import jsettlers.logic.map.grid.partition.manager.manageables.interfaces.IWorkerRequestBuilding;
import jsettlers.logic.movable.Movable;
import jsettlers.logic.movable.interfaces.AbstractMovableGrid;
import jsettlers.logic.player.Player;
import static jsettlers.algorithms.simplebehaviortree.BehaviorTreeHelper.*;
public class LegacyBuildingWorkerMovable extends BuildingWorkerMovable {
private transient IBuildingJob currentJob = null;
private EMaterialType poppedMaterial;
public LegacyBuildingWorkerMovable(AbstractMovableGrid grid, EMovableType movableType, ShortPoint2D position, Player player, Movable replace) {
super(grid, movableType, position, player, replace, tree);
}
private static final Root<LegacyBuildingWorkerMovable> tree = new Root<>(createBuildingWorkerBehaviour());
private static Node<LegacyBuildingWorkerMovable> createBuildingWorkerBehaviour() {
return defaultFramework(
guard(mov -> mov.currentJob != null,
selector(
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.GO_TO),
nodeToJob(goToPos(LegacyBuildingWorkerMovable::getCurrentJobPos, LegacyBuildingWorkerMovable::pathStep))
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.TRY_TAKING_RESOURCE),
nodeToJob(condition(LegacyBuildingWorkerMovable::tryTakingResource))
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.TRY_TAKING_FOOD),
nodeToJob(condition(mov -> mov.building.tryTakingFood(mov.currentJob.getFoodOrder())))
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.WAIT),
BehaviorTreeHelper.sleep(mov -> (int)(mov.currentJob.getTime()*1000)),
jobFinishedNode()
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.WALK),
nodeToJob(goInDirectionWaitFree(mov -> mov.currentJob.getDirection(), LegacyBuildingWorkerMovable::pathStep))
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.SHOW),
waitFor(isAllowedToWork()),
action(mov -> {
ShortPoint2D pos = mov.getCurrentJobPos();
if (mov.currentJob.getDirection() != null) {
mov.lookInDirection(mov.currentJob.getDirection());
}
mov.setPosition(pos);
}),
show(),
jobFinishedNode()
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.HIDE),
hide(),
jobFinishedNode()
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.SET_MATERIAL),
action(mov -> {mov.setMaterial(mov.currentJob.getMaterial());}),
jobFinishedNode()
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.TAKE),
nodeToJob(take(mov -> mov.currentJob.getMaterial(), mov -> mov.currentJob.isTakeMaterialFromMap(), mov -> {}))
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.DROP),
nodeToJob(dropProduced(mov -> mov.currentJob.getMaterial()))
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.DROP_POPPED),
nodeToJob(dropProduced(mov -> mov.poppedMaterial))
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.PRE_SEARCH),
nodeToJob(condition(mov -> mov.preSearchPathAction(true)))
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.FOLLOW_SEARCHED),
nodeToJob(followPresearchedPathMarkTarget(LegacyBuildingWorkerMovable::pathStep))
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.LOOK_AT_SEARCHED),
nodeToJob(condition(LegacyBuildingWorkerMovable::lookAtSearched))
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.LOOK_AT),
action(mov -> {mov.setDirection(mov.currentJob.getDirection());}),
jobFinishedNode()
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.EXECUTE),
nodeToJob(condition(mov -> mov.grid.executeSearchType(mov, mov.position, mov.currentJob.getSearchType())))
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.PLAY_ACTION1),
playAction(EMovableAction.ACTION1, mov -> (short)(mov.currentJob.getTime()*1000)),
jobFinishedNode()
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.PLAY_ACTION2),
playAction(EMovableAction.ACTION2, mov -> (short)(mov.currentJob.getTime()*1000)),
jobFinishedNode()
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.PLAY_ACTION3),
playAction(EMovableAction.ACTION3, mov -> (short)(mov.currentJob.getTime()*1000)),
jobFinishedNode()
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.AVAILABLE),
nodeToJob(condition(mov -> mov.grid.canTakeMaterial(mov.getCurrentJobPos(), mov.currentJob.getMaterial())))
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.NOT_FULL),
nodeToJob(condition(mov -> mov.grid.canPushMaterial(mov.getCurrentJobPos())))
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.SMOKE_ON),
action(mov -> {
mov.grid.placeSmoke(mov.getCurrentJobPos(), true);
mov.building.addMapObjectCleanupPosition(mov.getCurrentJobPos(), EMapObjectType.SMOKE);
}),
jobFinishedNode()
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.SMOKE_OFF),
action(mov -> {
mov.grid.placeSmoke(mov.getCurrentJobPos(), false);
mov.building.addMapObjectCleanupPosition(mov.getCurrentJobPos(), EMapObjectType.SMOKE);
}),
jobFinishedNode()
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.PIG_IS_ADULT),
nodeToJob(condition(mov -> mov.grid.isPigAdult(mov.getCurrentJobPos())))
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.PIG_IS_THERE),
nodeToJob(condition(mov -> mov.grid.hasPigAt(mov.getCurrentJobPos())))
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.PIG_PLACE),
action(mov -> {
mov.grid.placePigAt(mov.getCurrentJobPos(), true);
mov.building.addMapObjectCleanupPosition(mov.getCurrentJobPos(), EMapObjectType.PIG);
}),
jobFinishedNode()
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.PIG_REMOVE),
action(mov -> {
mov.grid.placePigAt(mov.getCurrentJobPos(), false);
mov.building.addMapObjectCleanupPosition(mov.getCurrentJobPos(), EMapObjectType.PIG);
}),
jobFinishedNode()
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.POP_TOOL),
nodeToJob(condition(LegacyBuildingWorkerMovable::popToolRequestAction))
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.POP_WEAPON),
nodeToJob(
condition(mov -> {
mov.poppedMaterial = mov.building.getMaterialProduction().getWeaponToProduce();
return mov.poppedMaterial != null;
})
)
),
sequence(
condition(mov -> mov.currentJob.getType() == EBuildingJobType.GROW_DONKEY),
nodeToJob(
sequence(
condition(mov -> mov.grid.feedDonkeyAt(mov.getCurrentJobPos())),
action(mov -> {
mov.building.addMapObjectCleanupPosition(mov.getCurrentJobPos(), EMapObjectType.DONKEY);
})
)
)
),
// unknown job type
action(LegacyBuildingWorkerMovable::abortJob)
)
)
);
}
private static Node<LegacyBuildingWorkerMovable> jobFailedNode() {
return action(LegacyBuildingWorkerMovable::jobFailed);
}
private static Node<LegacyBuildingWorkerMovable> jobFinishedNode() {
return action(LegacyBuildingWorkerMovable::jobFinished);
}
private static Node<LegacyBuildingWorkerMovable> nodeToJob(Node<LegacyBuildingWorkerMovable> child) {
return selector(
sequence(
child,
jobFinishedNode()
),
jobFailedNode()
);
}
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
ois.defaultReadObject();
String currentJobName = ois.readUTF();
if (currentJobName.equals("null")) {
currentJob = null;
} else {
EBuildingType building = (EBuildingType) ois.readObject();
ECivilisation civilisation = (ECivilisation) ois.readObject();
currentJob = building.getVariant(civilisation).getJobByName(currentJobName);
}
}
private void writeObject(ObjectOutputStream oos) throws IOException {
oos.defaultWriteObject();
if (currentJob != null) {
oos.writeUTF(currentJob.getName());
oos.writeObject(building.getBuildingVariant().getType());
oos.writeObject(building.getPlayer().getCivilisation());
} else {
oos.writeUTF("null");
}
}
@Override
protected void decoupleMovable() {
super.decoupleMovable();
}
private boolean isJobless() {
return currentJob == null;
}
private boolean popToolRequestAction() {
poppedMaterial = building.getMaterialProduction().drawRandomAbsolutelyRequestedTool(); // first priority: Absolutely set tool production requests of user
if (poppedMaterial == null) {
poppedMaterial = grid.popToolProductionRequest(building.getDoor()); // second priority: Tools needed by settlers (automated production)
}
if (poppedMaterial == null) {
poppedMaterial = building.getMaterialProduction().drawRandomRelativelyRequestedTool(); // third priority: Relatively set tool production requests of user
}
return poppedMaterial != null;
}
/**
* @param dijkstra
* if true, dijkstra algorithm is used<br>
* if false, in area finder is used.
*/
private boolean preSearchPathAction(boolean dijkstra) {
super.setPosition(getCurrentJobPos());
ShortPoint2D workAreaCenter = building.getWorkAreaCenter();
boolean pathFound = super.preSearchPath(dijkstra, workAreaCenter.x, workAreaCenter.y, building.getBuildingVariant().getWorkRadius(),
currentJob.getSearchType());
if (pathFound) {
searchFailedCtr = 0;
this.building.setCannotWork(false);
return true;
} else {
searchFailedCtr++;
if (searchFailedCtr > 10) {
this.building.setCannotWork(true);
player.showMessage(SimpleMessage.cannotFindWork(building));
}
return false;
}
}
private void jobFinished() {
this.currentJob = this.currentJob.getNextSucessJob();
}
private void jobFailed() {
this.currentJob = this.currentJob.getNextFailJob();
}
private ShortPoint2D getCurrentJobPos() {
return currentJob.calculatePoint(building);
}
private boolean lookAtSearched() {
EDirection direction = grid.getDirectionOfSearched(position, currentJob.getSearchType());
if (direction != null) {
setDirection(direction);
return true;
} else {
return false;
}
}
@Override
public void setWorkerJob(IWorkerRequestBuilding building) {
super.setWorkerJob(building);
this.currentJob = building.getBuildingVariant().getStartJob();
}
@Override
protected void abortJob() {
if(building != null) {
currentJob = null;
}
super.abortJob();
}
@Override
public void buildingDestroyed() {
super.buildingDestroyed();
currentJob = null;
}
private boolean pathStep() {
return isJobless() || building != null; // TODO
}
}
|
/**
* Created by Michael on 7/23/2015.
*/
public class FileStructureTable {
}
|
package org.zqu.yiban.schedule.model.json;
/**
* Created by zqh on 2017/7/18.
*/
public class AuthorizeBaseResponse {
/**
* visit_time : 访问unix时间戳
* visit_user : {"userid":"易班用户ID"}
* visit_oauth : false
*/
private int visit_time;
public int getVisit_time() {
return visit_time;
}
public void setVisit_time(int visit_time) {
this.visit_time = visit_time;
}
}
|
package com.tencent.mm.plugin.profile.ui;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
class ContactMoreInfoUI$1 implements OnMenuItemClickListener {
final /* synthetic */ ContactMoreInfoUI lVo;
ContactMoreInfoUI$1(ContactMoreInfoUI contactMoreInfoUI) {
this.lVo = contactMoreInfoUI;
}
public final boolean onMenuItemClick(MenuItem menuItem) {
this.lVo.finish();
return true;
}
}
|
package hirondelle.web4j.model;
import hirondelle.web4j.model.Id;
import hirondelle.web4j.model.ModelCtorException;
import hirondelle.web4j.model.ModelUtil;
import hirondelle.web4j.model.Check;
import hirondelle.web4j.security.SafeText;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
/**
An item in a code table.
<P>Here, a value in a code table is modeled with one required item (text), and four optional items
(id, short form, long form, and order index). The id is optional, since for 'add' operations it is not yet
specified. This class is offered as a convenience for implementing Code Tables.
Applications are not required to use it.
<P>Please see the example application for an example of one way of implementing code tables.
<h3>Code Tables</h3>
<P>A code table is an informal term describing a set of related values. It resembles
an enumeration. Simple examples :
<ul>
<li>geographical divisions - countries, states or provinces
<li>list of accepted credit cards - Mastercard, Visa, and so on
<li>the account types offered by a bank - chequing, savings, and so on
</ul>
Other important aspects of code tables :
<ul>
<li>most applications use them.
<li>they often appear in the user interface as drop-down <tt>SELECT</tt> controls.
<li>they usually don't change very often.
<li>they may have a specific sort order, unrelated to alphabetical ordering.
<li>it is almost always desirable that the user-visible text attached to a code be unique (in a given code table),
since the user will usually have no means to distinguish the identical items.
<li>it is often desirable to present the same code in different ways, according to context.
For example, report listings may present codes in an abbreviated style, while a tool-tips may present a
codes in a more verbose style, to explain their meaning.
<li>they are usually closely related to various foreign keys in the database.
</ul>
<h3>Underlying Data</h3>
Code tables may be implemented in various ways, including
<ul>
<li>database tables constructed explicitly for that purpose
<li>database tables that have already been constructed to hold problem domain items. That is,
data from an existing table may be extracted in a shortened form, to be used as a code table.
<li>simple in-memory data. For example, a <tt>1..10</tt> rating system might use simple <tt>Integer</tt>
objects created upon startup.
</ul>
<h3>Avoiding Double-Escaping</h3>
This class uses {@link SafeText}, which escapes special characters.
When rendering a <tt>Code</tt> object in a JSP, some care must be taken to ensure that
special characters are not mistakenly escaped <em>twice</em>.
<P>In a single language app, it's usually safe to render a <tt>Code</tt> by simply using <tt>${code}</tt>. This
calls {@link #toString()}, which returns escaped text, safe for direct rendering in a JSP.
<P>In a multilingual app, however, the various translation tags
(<tt><w:txt>, <w:txtFlow>, <w:tooltip></tt>) <em>already escape special characters</em>.
So, if a translation tag encounters a <tt>Code</tt> somewhere its body, the <tt>Code</tt> must be in
an <em>unescaped</em> form, otherwise it wil be escaped <em>twice</em>, which undesirable.
<span class='highlight'>In a multilingual app, you should usually render a <tt>Code</tt> using <tt>${code.text.rawString}</tt>.</span>
<P>This asymmetry between single-language and many-language apps is somewhat displeasing, and
constitutes a pitfall of using this class. If desired, you could define an alternate <tt>Code</tt> class
whose <tt>toString</tt> returns a <tt>String</tt> instead of {@link SafeText}.
*/
public final class Code implements Serializable {
/**
Full constructor.
@param aId underlying database identifier for the code value. Optional, 1..50 characters.
@param aText default text for presentation to the end user. Required, 1..50 characters.
@param aShortText short form for text presented to the end user. This item is useful for terse
presentation in reports, often as an abbreviation of one or two letters. Optional, 1..10 characters.
@param aLongText long form for text presented to the user. For example, this may be a description
or definition of the meaning of the code. Optional, 1..200 characters.
@param aOrderIdx defines the order of appearance of this item in a listing. Optional, range 1..1000.
This item is used to provide explicit control over the order of appearance of items as presented to
the user, and will often be related to an <tt>ORDER BY</tt> clause in an SQL statement.
*/
public Code(Id aId, SafeText aText, SafeText aShortText, SafeText aLongText, Integer aOrderIdx) throws ModelCtorException {
fId = aId;
fText = aText;
fShortText = aShortText;
fLongText = aLongText;
fOrderIdx = aOrderIdx;
validateState();
}
/** As in the full constructor, but without a short description, long description, or an order index. */
public Code(Id aId, SafeText aText) throws ModelCtorException {
fId = aId;
fText = aText;
fShortText = null;
fLongText = null;
fOrderIdx = null;
validateState();
}
/** As in the full constructor, but without a long description or order index. */
public Code(Id aId, SafeText aText, SafeText aShortText) throws ModelCtorException {
fId = aId;
fText = aText;
fShortText = aShortText;
fLongText = null;
fOrderIdx = null;
validateState();
}
/** As in the full constructor, but without an order index. */
public Code(Id aId, SafeText aText, SafeText aShortText, SafeText aLongText) throws ModelCtorException {
fId = aId;
fText = aText;
fShortText = aShortText;
fLongText = aLongText;
fOrderIdx = null;
validateState();
}
/** Return the Id passed to the constructor. */
public Id getId() { return fId; }
/** Return the Text passed to the constructor. */
public SafeText getText() { return fText; }
/** Return the Short Text passed to the constructor. */
public SafeText getShortText() { return fShortText; }
/** Return the Long Text passed to the constructor. */
public SafeText getLongText() { return fLongText; }
/** Return the Order Index passed to the constructor. */
public Integer getOrderIdx() { return fOrderIdx; }
/**
Returns {@link #getText()}.toString().
<P>This is the most user-friendly form of a code, and is useful for rendering in JSPs.
*/
@Override public String toString(){
return fText.toString();
}
@Override public boolean equals(Object aThat){
Boolean result = ModelUtil.quickEquals(this, aThat);
if ( result == null ){
Code that = (Code) aThat;
result = ModelUtil.equalsFor(this.getSignificantFields(), that.getSignificantFields());
}
return result;
}
@Override public int hashCode() {
if ( fHashCode == 0 ) {
fHashCode = ModelUtil.hashCodeFor(getSignificantFields());
}
return fHashCode;
}
// PRIVATE
/** @serial */
private final Id fId;
/** @serial */
private final SafeText fText;
/** @serial */
private final SafeText fShortText;
/** @serial */
private final SafeText fLongText;
/** @serial */
private final Integer fOrderIdx;
/** @serial */
private int fHashCode;
/**
For evolution of this class, see Sun guidelines :
http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/version.html#6678
*/
private static final long serialVersionUID = 8856876119383545215L;
private Object[] getSignificantFields(){
return new Object[] {fId, fText, fShortText, fLongText, fOrderIdx};
}
private void validateState() throws ModelCtorException {
ModelCtorException ex = new ModelCtorException();
if ( ! Check.optional(fId, Check.min(1), Check.max(50))) {
ex.add("Code Id is optional, 1..50 chars.");
}
if ( ! Check.required(fText, Check.range(1,50))) {
ex.add("Text is required, 1..50 chars.");
}
if ( ! Check.optional(fShortText, Check.range(1,10))) {
ex.add("Short Text is optional, 1..10 chars.");
}
if ( ! Check.optional(fLongText, Check.range(1,200))) {
ex.add("Long Text is optional, 1..200 chars.");
}
if ( ! Check.optional(fOrderIdx, Check.range(1,1000))) {
ex.add("Order Idx is optional, 1..1000.");
}
if ( ! ex.isEmpty() ) throw ex;
}
/**
Always treat de-serialization as a full-blown constructor, by
validating the final state of the de-serialized object.
*/
private void readObject(ObjectInputStream aInputStream) throws ClassNotFoundException, IOException, ModelCtorException {
//always perform the default de-serialization first
aInputStream.defaultReadObject();
//make defensive copy of mutable fields (none here)
//ensure that object state has not been corrupted or tampered with maliciously
validateState();
}
/**
This is the default implementation of writeObject.
Customise if necessary.
*/
private void writeObject(ObjectOutputStream aOutputStream) throws IOException {
//perform the default serialization for all non-transient, non-static fields
aOutputStream.defaultWriteObject();
}
}
|
package design.pattern.project.example.store.domain;
/*
* The Custome object which is associated to shopping cart
* Also it acts as observer for any sales happening at the mall
*/
import design.pattern.project.example.store.observer.NotifySalesObserver;
public class Customer extends NotifySalesObserver {
private String name;
private ShoppingCart shoppingCart; //the shopping cart being used by the customer
private Store store; // the store the customer is currently in
public Customer(String name) {
super();
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public ShoppingCart getShoppingCart() {
return shoppingCart;
}
public void setShoppingCart(ShoppingCart shoppingCart) {
this.shoppingCart = shoppingCart;
}
public Store getStore() {
return store;
}
public void setStore(Store store) {
this.store = store;
}
@Override
public void doUpdate(boolean isSales) {
// TODO Auto-generated method stub
System.out.println("Customer:NotifySalesObserver doUpdate : Sales Happening :"+this.getName());
}
}
|
package com.cs4125.bookingapp.repositories;
import android.os.Build;
import androidx.annotation.RequiresApi;
import com.cs4125.bookingapp.entities.Booking;
import com.cs4125.bookingapp.entities.Route;
import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
public class BookingRepositoryCacheProxy implements BookingRepository, Serializable
{
private BookingRepository bookingRepository;
private ConcurrentHashMap<Integer, String> cachedResults;
private Date lastUpdate;
public BookingRepositoryCacheProxy()
{
bookingRepository = new BookingRepositoryImpl();
cachedResults = new ConcurrentHashMap<>();
}
@Override
public void userBooking(Route route, Booking booking, String discountCode, ResultCallback callback)
{
bookingRepository.userBooking(route, booking, discountCode, callback);
}
@Override
public void bookingUpdate(Booking booking, ResultCallback callback)
{
bookingRepository.bookingUpdate(booking, callback);
}
@Override
public void bookingList(Booking booking, ResultCallback resultCallback)
{
long diffMinutes = 99;
long diffHours = 99;
if(lastUpdate != null)
{
long diffInMillis = Calendar.getInstance().getTime().getTime() - lastUpdate.getTime();
diffMinutes = TimeUnit.MILLISECONDS.toMinutes(diffInMillis);
diffHours = TimeUnit.MILLISECONDS.toMinutes(diffInMillis);
}
if (diffHours < 1 && diffMinutes < 20 && cachedResults.containsKey(booking.getPassengerID()))
{
resultCallback.onResult(cachedResults.get(booking.getPassengerID()));
}
else
{
lastUpdate = Calendar.getInstance().getTime();
// for this we need to store the result from the request if it was successful
// otherwise just send back the error received
bookingRepository.bookingList(booking, new ResultCallback()
{
@Override
public void onResult(String result)
{
cachedResults.put(booking.getPassengerID(), result);
resultCallback.onResult(result);
}
@Override
public void onFailure(Throwable error)
{
resultCallback.onFailure(error);
}
});
}
}
@Override
public void getBooking(Booking booking, ResultCallback resultCallback)
{
if(cachedResults.containsKey(booking.getBookingID()))
{
resultCallback.onResult(cachedResults.get(booking.getBookingID()));
}
else
{
bookingRepository.bookingList(booking, new ResultCallback()
{
@Override
public void onResult(String result)
{
cachedResults.put(booking.getBookingID(), result);
resultCallback.onResult(result);
}
@Override
public void onFailure(Throwable error)
{
resultCallback.onFailure(error);
}
});
}
}
@Override
public void bookingCancel(Booking booking, ResultCallback resultCallback)
{
bookingRepository.bookingCancel(booking, resultCallback);
}
public void resetCache()
{
cachedResults.clear();
}
}
|
package br.edu.ifam.saf.api.data;
import java.util.Arrays;
import java.util.List;
import br.edu.ifam.saf.api.dto.ItemDTO;
public class ItensResponse {
private List<ItemDTO> items;
public ItensResponse(List<ItemDTO> items) {
this.items = items;
}
public ItensResponse(ItemDTO... itens) {
this.items = Arrays.asList(itens);
}
public List<ItemDTO> getItems() {
return items;
}
public void setItems(List<ItemDTO> items) {
this.items = items;
}
}
|
package com.qunchuang.carmall.graphql.security;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;
import org.springframework.security.web.savedrequest.HttpSessionRequestCache;
import org.springframework.security.web.savedrequest.RequestCache;
import org.springframework.security.web.savedrequest.SavedRequest;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* 登录成功后的处理:只是去除重定向
* 具体的实现代码细节参考了 Spring 提供的另外一个实现类 {@link SavedRequestAwareAuthenticationSuccessHandler}
*
* @author zzk
* @date 2018/11/12
*/
@Component
public class RestAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
@Autowired
private ObjectMapper mapper;
private RequestCache requestCache = new HttpSessionRequestCache();
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws IOException {
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE,PATCH, OPTIONS");
response.setHeader("Access-Control-Allow-Headers", "authorization, content-type, X-Auth-Token");
response.addHeader("Access-Control-Expose-Headers", "X-Auth-Token");
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
response.setCharacterEncoding("UTF-8");
//todo : 是否需要过滤输出信息?
response.getWriter().write(mapper.writeValueAsString(authentication.getPrincipal()));
SavedRequest savedRequest = requestCache.getRequest(request, response);
if (savedRequest == null) {
clearAuthenticationAttributes(request);
return;
}
String targetUrlParam = getTargetUrlParameter();
if (isAlwaysUseDefaultTargetUrl()
|| (targetUrlParam != null
&& StringUtils.hasText(request.getParameter(targetUrlParam)))) {
requestCache.removeRequest(request, response);
clearAuthenticationAttributes(request);
return;
}
clearAuthenticationAttributes(request);
}
public void setRequestCache(RequestCache requestCache) {
this.requestCache = requestCache;
}
}
|
package test;
import Dominio.*;
public class Test {
public static void main(String[] args) {
Empleado e = new EmpleadoAsalariado(700);
imprimirLiquidacion(e);
Empleado eh = new EmpladoPorHora(100, 150, 39);
imprimirLiquidacion(eh);
}
public static void imprimirLiquidacion(Empleado e){
System.out.println("Liquidacion=" + e.getLiquidacion());
}
}
|
package com.qd.mystudy.jartest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Created by liqingdong911 on 2015/1/5.
*/
public class LogUsage {
// private final static Logger lbLogger = LoggerFactory.getLogger(LogUsage.class);
public static void info(){
// lbLogger.info("info");
}
public static void cinfo(){
ClientLogger.getLog().info("client log");
}
public static void main(String[] argc){
// info();
ClientLogger.getLog().info("client log");
info();
}
}
|
/*
* WelcomeController.java
*
* Copyright (C) 2017 Universidad de Sevilla
*
* The use of this project is hereby constrained to the conditions of the
* TDG Licence, a copy of which you may download from
* http://www.tdg-seville.info/License.html
*/
package controllers;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import services.ActorService;
import services.ChirpService;
import services.UserService;
import domain.Chirp;
import domain.User;
@Controller
@RequestMapping("/welcome")
public class WelcomeController extends AbstractController {
@Autowired
private UserService userService;
@Autowired
private ChirpService chirpService;
@Autowired
private ActorService actorService;
// Constructors -----------------------------------------------------------
public WelcomeController() {
super();
}
// Index ------------------------------------------------------------------
@RequestMapping(value = "/index")
public ModelAndView index() {
final ModelAndView result = new ModelAndView("welcome/index");
SimpleDateFormat formatter;
String moment;
final Collection<Chirp> chirps = new ArrayList<Chirp>();
try {
final User principal = this.userService.findByPrincipal();
chirps.addAll(this.chirpService.findByCreatorId(principal.getId()));
for (final User f : principal.getFollowing())
chirps.addAll(this.chirpService.findByCreatorId(f.getId()));
if (!chirps.isEmpty())
result.addObject("chirps", chirps);
} catch (final Throwable oops) {
}
formatter = new SimpleDateFormat("dd/MM/yyyy HH:mm");
moment = formatter.format(new Date());
String name = null;
try {
name = this.actorService.findByPrincipal().getUserAccount().getUsername();
} catch (final Throwable oops) {
}
if (name == null)
name = "John Doe";
result.addObject("name", name);
result.addObject("moment", moment);
return result;
}
}
|
package com.pangpang6.books.pattern.bridgems.bridge;
import com.pangpang6.books.pattern.bridgems.control.LGControl;
import com.pangpang6.books.pattern.bridgems.control.SharpControl;
import com.pangpang6.books.pattern.bridgems.control.SonyControl;
/**
* 桥接模式:将实现与抽象放在两个不同的类层次中,使两个层次可以独立改变
* 目的:分离抽象与实现,使抽象和实现可以独立变化
* 使用:系统有多维度分类时,每一种分类又有可能变化
* 抽象继承抽象
* 实现实现接口(行为)
*
* 与策略模式的差异:
* 策略的目的:将复杂的算法封装起来,从而便于替换不同的算法
* 桥接模式往往是为了利用已有的方法或类
* 策略模式是为了扩展和修改,并提供动态配置
*
* 桥接模式强调接口对象仅提供基本操作
* 策略模式强调接口对象提供一种算法
*/
public class MainTest {
public static void main(String[] args) {
TvControl mLGTvControl;
TvControl mSonyTvControl;
mSonyTvControl = new TvControl(new SonyControl());
mLGTvControl = new TvControl(new LGControl());
mLGTvControl.Onoff();
mLGTvControl.nextChannel();
mLGTvControl.nextChannel();
mLGTvControl.preChannel();
mLGTvControl.Onoff();
mSonyTvControl.Onoff();
mSonyTvControl.preChannel();
mSonyTvControl.preChannel();
mSonyTvControl.preChannel();
mSonyTvControl.Onoff();
newTvControl mSharpTvControl;
mSharpTvControl = new newTvControl(new SharpControl());
mSharpTvControl.Onoff();
mSharpTvControl.nextChannel();
mSharpTvControl.setChannel(9);
mSharpTvControl.setChannel(28);
mSharpTvControl.Back();
mSharpTvControl.Onoff();
}
}
|
package edu.ssafy.root.dao;
import java.util.ArrayList;
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import edu.ssafy.root.food.Food;
import edu.ssafy.root.food.Nutrient;
@Repository("FoodDAOImpl")
public class FoodDAOImpl implements FoodDAO{
@Autowired
private SqlSession session;
private FoodDAOImpl() {
}
@Override
public int foodCount() {
return session.selectOne("foody.getcount");
}
public List<Food> searchAll() {
return session.selectList("foody.getlistall");
}
@Override
public Food search(int fcode) {
Food food = session.selectOne("foody.getfood", fcode);
Nutrient nutri = session.selectOne("foody.getdetail", fcode);
food.setNutrient(nutri.getNutri());
return food;
}
@Override
public List<Food> searchBest() {
////////////////////////////////////// 세부사항 베스트 음식
// return list;
return null;
}
@Override
public List<Food> searchByname(String fname) {
return session.selectList("foody.getfoodbyname", fname);
}
@Override
public void updateAllergy() {
List<Food> li = searchAll();
String[] all = {"대두","땅콩","우유","게","새우","참치","연어","쑥","소고기","닭고기","돼지고기","복숭아","민들레","계란흰자"};
for(Food f : li) {
String aList = f.getAllergyList();
int cnt = 0;
for(String str : all) {
if(f.getFmaterial().contains(str)) {
if(cnt == 0) {
aList = str;
} else {
aList += ", "+str;
}
cnt++;
}
}
if(f.getFmaterial().contains("원유")) {
if(cnt == 0) {
aList = "우유";
} else {
aList += ", 우유";
}
cnt++;
}
f.setAllergyList(aList);
if(cnt > 0)
session.update("foody.setAllergyList", f);
System.out.println(f);
}
}
@Override
public int getMaxFcode() {
return session.selectOne("foody.getMaxFcode");
}
}
|
package pt.ist.sonet.service;
import java.util.ArrayList;
import java.util.List;
import jvstm.Atomic;
import pt.ist.fenixframework.FenixFramework;
import pt.ist.sonet.domain.*;
import pt.ist.sonet.exception.*;
import pt.ist.sonet.service.dto.*;
public class GetOrganizationFriendsService extends SonetService {
private AgentDto agentToList;
private List<AgentDto> organizations;
public GetOrganizationFriendsService(AgentDto agent){
this.agentToList = agent;
}
public final void dispatch() throws AgentNotFoundException{
Sonet sonet = FenixFramework.getRoot();
List<AgentDto> organizations = new ArrayList<AgentDto>();
Agent agent = sonet.getAgentByUsername(agentToList.getUsername());
AgentDto dto;
if(agent != null){
for(Agent a : agent.getFriends()){
if(a.getClass().getSimpleName().equals("Organization")){
dto = a.createDto();
organizations.add(dto);
}
}
this.organizations = organizations;
} else {
throw new AgentNotFoundException(agentToList.getUsername());
}
}
public List<AgentDto> getOrganizations(){
return this.organizations;
}
}
|
package com.tencent.mm.plugin.fingerprint.b;
import com.tencent.mm.g.a.lg;
import com.tencent.mm.kernel.g;
import com.tencent.mm.plugin.fingerprint.a;
import com.tencent.mm.pluginsdk.wallet.k;
import com.tencent.mm.sdk.b.b;
import com.tencent.mm.sdk.b.c;
import com.tencent.mm.sdk.platformtools.x;
public final class i extends c<lg> {
private String bOd;
private a jgK;
lg jgL;
private k jgM;
private Runnable jgN;
boolean jgq;
public i() {
this.jgM = null;
this.jgN = null;
this.jgq = false;
this.bOd = "";
this.sFo = lg.class.getName().hashCode();
}
public final /* synthetic */ boolean a(b bVar) {
lg lgVar = (lg) bVar;
if (g.Eg().Dx()) {
this.jgq = false;
if (lgVar instanceof lg) {
x.i("MicroMsg.OpenFingerPrintAuthEventListener", "handle OpenFingerPrintAuthEventListener");
if (e.aNm()) {
this.jgL = lgVar;
if (this.jgL == null) {
x.e("MicroMsg.OpenFingerPrintAuthEventListener", null, new Object[]{"mEvent is null !!!"});
} else {
this.jgN = this.jgL.bVz.bVD;
this.bOd = lgVar.bVz.bQa;
a.aMW();
if (a.aMX() == null) {
return true;
}
a.aMW();
a.aMX();
boolean aNf = c.aNf();
if (this.jgK == null) {
this.jgK = new a(this);
}
a.aMW();
a.aMX();
this.jgM = ((com.tencent.mm.pluginsdk.k) g.l(com.tencent.mm.pluginsdk.k.class)).aNr();
if (this.jgM == null) {
return fd(false);
}
this.jgM.a(new com.tencent.mm.pluginsdk.wallet.a() {
public final void af(int i, String str) {
x.i("MicroMsg.OpenFingerPrintAuthEventListener", "hy: pre processing done. errCode: %d, errMsg: %s", new Object[]{Integer.valueOf(i), str});
if (i == 0) {
i.this.fd(false);
} else {
i.this.U(1, "");
}
}
});
return aNf;
}
}
x.e("MicroMsg.OpenFingerPrintAuthEventListener", "device is not support FingerPrintAuth");
this.jgq = true;
U(1, "");
return true;
}
}
x.e("MicroMsg.OpenFingerPrintAuthEventListener", "OpenFingerPrintAuthEvent account is not ready");
return false;
}
public final void release() {
a.aMW();
if (a.aMX() != null) {
a.aMW();
a.aMX();
c.release();
}
this.jgL = null;
}
public static void aND() {
a.aMW();
if (a.aMX() != null) {
boolean z;
a.aMW();
a.aMX();
c.abort();
a.aMW();
a.aMX();
c.release();
String str = "MicroMsg.OpenFingerPrintAuthEventListener";
String str2 = "stopIdentify() isSoter: %b";
Object[] objArr = new Object[1];
a.aMW();
a.aMX();
if (((com.tencent.mm.pluginsdk.k) g.l(com.tencent.mm.pluginsdk.k.class)).type() == 2) {
z = true;
} else {
z = false;
}
objArr[0] = Boolean.valueOf(z);
x.i(str, str2, objArr);
}
}
final boolean fd(boolean z) {
aND();
a.aMW();
a.aMX();
if (c.aNf()) {
a.aMW();
a.aMX();
if (c.a(this.jgK, z) != 0) {
x.e("MicroMsg.OpenFingerPrintAuthEventListener", "failed to start identify");
release();
this.jgq = true;
U(1, "");
return false;
}
x.i("MicroMsg.OpenFingerPrintAuthEventListener", "startIdentify()");
return true;
}
x.e("MicroMsg.OpenFingerPrintAuthEventListener", "no fingerprints enrolled, use settings to enroll fingerprints first");
release();
this.jgq = true;
U(1, "");
return false;
}
final void U(int i, String str) {
x.i("MicroMsg.OpenFingerPrintAuthEventListener", "onFail()");
a.aMW();
a.aMX();
((com.tencent.mm.pluginsdk.k) g.l(com.tencent.mm.pluginsdk.k.class)).a(this.jgL, i, str);
if (this.jgq) {
this.jgL = null;
}
x.i("MicroMsg.OpenFingerPrintAuthEventListener", "callback OpenFingerPrintAuthEvent onFail()");
}
}
|
package com.espendwise.manta.web.controllers;
import com.espendwise.manta.model.view.AccountListView;
import com.espendwise.manta.model.view.SiteListView;
import com.espendwise.manta.service.SiteService;
import com.espendwise.manta.spi.AutoClean;
import com.espendwise.manta.util.Constants;
import com.espendwise.manta.util.Utility;
import com.espendwise.manta.util.alert.ArgumentedMessage;
import com.espendwise.manta.util.criteria.SiteListViewCriteria;
import com.espendwise.manta.web.forms.SiteFilterForm;
import com.espendwise.manta.web.forms.SiteFilterResultForm;
import com.espendwise.manta.web.util.*;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.WebRequest;
import javax.servlet.http.HttpSession;
import java.util.List;
@Controller
@RequestMapping(UrlPathKey.SITE.FILTER)
@SessionAttributes({SessionKey.SITE_FILTER_RESULT, SessionKey.SITE_FILTER})
@AutoClean(SessionKey.SITE_FILTER_RESULT)
public class SiteFilterController extends BaseController {
private static final Logger logger = Logger.getLogger(SiteFilterController.class);
private SiteService siteService;
@Autowired
public SiteFilterController(SiteService siteService) {
this.siteService = siteService;
}
@RequestMapping(value = "", method = RequestMethod.GET)
public String filter(@ModelAttribute(SessionKey.SITE_FILTER) SiteFilterForm filterForm) {
return "site/filter";
}
@RequestMapping(value = "/filter", method = RequestMethod.GET)
public String findSites(WebRequest request,
@ModelAttribute(SessionKey.SITE_FILTER_RESULT) SiteFilterResultForm form,
@ModelAttribute(SessionKey.SITE_FILTER) SiteFilterForm filterForm) throws Exception {
WebErrors webErrors = new WebErrors(request);
List<? extends ArgumentedMessage> validationErrors = WebAction.validate(filterForm);
if (!validationErrors.isEmpty()) {
webErrors.putErrors(validationErrors);
return "site/filter";
}
form.reset();
SiteListViewCriteria criteria = new SiteListViewCriteria(getStoreId(), Constants.FILTER_RESULT_LIMIT.SITE);
criteria.setSiteId(parseNumberNN(filterForm.getSiteId()));
criteria.setSiteName(filterForm.getSiteName(), filterForm.getSiteNameFilterType());
criteria.setRefNumber(filterForm.getRefNumber(), filterForm.getRefNumberFilterType());
criteria.setCity(filterForm.getCity(), Constants.FILTER_TYPE.START_WITH);
criteria.setState(filterForm.getState(), Constants.FILTER_TYPE.START_WITH);
criteria.setPostalCode(filterForm.getPostalCode(), Constants.FILTER_TYPE.START_WITH);
criteria.setStoreId(getStoreId());
criteria.setAccountIds(Utility.splitLong(filterForm.getAccountFilter()));
criteria.setActiveOnly(!Utility.isTrue(filterForm.getShowInactive()));
List<SiteListView> sites = siteService.findSitesByCriteria(criteria);
form.setSites(sites);
WebSort.sort(form, SiteListView.SITE_NAME);
return "site/filter";
}
@RequestMapping(value = "/filter/sortby/{field}", method = RequestMethod.GET)
public String sort(@ModelAttribute(SessionKey.SITE_FILTER_RESULT) SiteFilterResultForm form, @PathVariable String field) throws Exception {
WebSort.sort(form, field);
return "site/filter";
}
@RequestMapping(value = "/filter/clear", method = RequestMethod.POST)
public String clear(WebRequest request, @ModelAttribute(SessionKey.SITE_FILTER) SiteFilterForm form) throws Exception {
form.reset();
return redirect(request, UrlPathKey.SITE.FILTER);
}
@RequestMapping(value = "/filter/clear/account", method = RequestMethod.POST)
public String clearAccountFilter(WebRequest request, @ModelAttribute(SessionKey.SITE_FILTER) SiteFilterForm form) throws Exception {
form.setFilteredAccounts(Utility.emptyList(AccountListView.class));
form.setAccountFilter(null);
return redirect(request, UrlPathKey.SITE.FILTER);
}
@ModelAttribute(SessionKey.SITE_FILTER_RESULT)
public SiteFilterResultForm init(HttpSession session) {
SiteFilterResultForm siteFilterResult = (SiteFilterResultForm) session.getAttribute(SessionKey.SITE_FILTER_RESULT);
if (siteFilterResult == null) {
siteFilterResult = new SiteFilterResultForm();
}
return siteFilterResult;
}
@ModelAttribute(SessionKey.SITE_FILTER)
public SiteFilterForm initFilter(HttpSession session) {
SiteFilterForm siteFilter = (SiteFilterForm) session.getAttribute(SessionKey.SITE_FILTER);
if (siteFilter == null || !siteFilter.isInitialized()) {
siteFilter = new SiteFilterForm();
siteFilter.initialize();
}
return siteFilter;
}
}
|
// Sun Certified Java Programmer
// Chapter 7, 543_2
// Generics and Collections
public class BobTest {
public static void main(String[] args) {
Bob f = new Bob("GoBobGo", 19);
System.out.println(f);
}
}
|
package fr.umlv.escape.editor;
import fr.umlv.escape.R;
import fr.umlv.escape.game.Level;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
public class LevelAdapter extends BaseAdapter{
Level level;
LayoutInflater inflater;
public LevelAdapter(Context context, Level level) {
inflater = LayoutInflater.from(context);
this.level = level;
}
@Override
public int getCount() {
return level.getWaveList().size();
}
@Override
public Object getItem(int position) {
return level.getWaveList().get(position);
}
@Override
public long getItemId(int position) {
return position;
}
private class ViewHolder {
Spinner waveList;
EditText delay;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if(convertView == null) {
holder = new ViewHolder();
convertView = inflater.inflate(R.layout.select_wave_layout, null);
holder.waveList = (Spinner)convertView.findViewById(R.id.wave_list_select);
holder.delay = (EditText)convertView.findViewById(R.id.hint_launching_wave);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
return convertView;
}
}
|
package my_package;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import static org.junit.Assert.*;
/**
* Created by lapte on 28.06.2016.
*/
public class MyCalculatorTest {
@BeforeClass
public static void messageStart(){
System.out.println("Start of the TestClass");
}
@AfterClass
public static void messageFinish(){
System.out.println("Finish of the TestClass");
}
} |
package com.cnk.travelogix.custom.mappingtable.maintain;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for FindMappingTableResponse complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="FindMappingTableResponse">
* <complexContent>
* <extension base="{http://schema.ws.highdeal.com/}SearchResponse">
* <sequence>
* <element name="mappingTable" type="{http://subscribermappingtable.ws.highdeal.com/}SubscriberMappingTable" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "FindMappingTableResponse", namespace = "http://schema.subscribermappingtablemanagement.ws.highdeal.com/", propOrder = {
"mappingTable"
})
public class FindMappingTableResponse
extends SearchResponse
{
protected List<SubscriberMappingTable> mappingTable;
/**
* Gets the value of the mappingTable 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 mappingTable property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getMappingTable().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link SubscriberMappingTable }
*
*
*/
public List<SubscriberMappingTable> getMappingTable() {
if (mappingTable == null) {
mappingTable = new ArrayList<SubscriberMappingTable>();
}
return this.mappingTable;
}
}
|
package org.android.olp.foursquare.db;
import java.util.List;
import org.json.JSONObject;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
public class DBAdapter {
public static final String KEY_ID = "id";
public static final String KEY_NAME = "name";
public static final String KEY_ADDRESS = "address";
public static final String KEY_DIST = "distance";
private static final String DB_TABLE = "venues";
private Context context;
private SQLiteDatabase db;
private DbHelper dbHelper;
public DBAdapter (Context context) {
this.context = context;
}
public DBAdapter open() throws SQLException {
dbHelper = new DbHelper(context);
db =dbHelper.getWritableDatabase();
return this;
}
public void close() {
dbHelper.close();
}
/**
* Insert an record to the database
*
* @param name
* @param address
* @param distance
*
* @return the rowid of the new venue or -1 if have an error
*/
public long createRecord(String name, String address, String distance) {
ContentValues value = createContent(name, address, distance);
return db.insert(DB_TABLE, null, value);
}
/**
* Refresh the database
*
* @param input
* @return true if success
*/
public boolean refresh(List<JSONObject> input) {
db.execSQL("DELETE FROM "+DB_TABLE);
for (int i = 0; i < input.size(); i++) {
JSONObject js = input.get(i);
createRecord(js.optString("name"), js.optString("address"), js.optString("distance"));
Log.i("DB", js.toString() + " added");
}
Log.i("DB", "refresh databse! ");
return true;
}
/**
* Fetch all the record in the database
*
* @return Cursor object
*/
public Cursor fetchAll() {
return db.query(DB_TABLE, new String[] {KEY_ID, KEY_NAME, KEY_ADDRESS, KEY_DIST}, null, null, null, null, null);
}
private ContentValues createContent(String name, String address, String distance) {
ContentValues value = new ContentValues();
value.put(KEY_NAME, name);
value.put(KEY_ADDRESS, address);
value.put(KEY_DIST, distance);
return value;
}
} |
package org.nishkarma.book.restful;
import static java.util.Collections.singletonList;
import java.net.URI;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.nishkarma.book.model.Book;
import org.nishkarma.book.model.BookPaginator;
import org.nishkarma.book.service.BookService;
import org.nishkarma.common.paging.model.PagingParam;
import org.nishkarma.common.restful.exception.JsonErrorUtil;
import org.nishkarma.common.restful.exception.RESTfulException;
import org.nishkarma.common.restful.exception.RESTfulValidateException;
import org.nishkarma.common.restful.util.ValidationUtil;
import org.nishkarma.common.util.NishkarmaMessageSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Controller;
import org.springframework.web.util.UriTemplate;
@Path("/book")
@Controller
public class BookController {
Logger logger = LoggerFactory.getLogger(BookController.class);
@Autowired
private BookService bookService;
@GET
@Path("/{id}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Book read(@PathParam("id") int id) {
Book book = null;
try {
book = bookService.findBookById(id);
} catch (Exception e) {
logger.error(ExceptionUtils.getStackTrace(e));
throw new RESTfulException(e.getMessage(),
Response.Status.INTERNAL_SERVER_ERROR);
}
return book;
}
@SuppressWarnings("rawtypes")
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public BookPaginator listBooks(@Context HttpServletRequest req) {
BookPaginator<Book> bookPaginator = new BookPaginator<Book>();
try {
PagingParam pagingParam = new PagingParam(req);
new ValidationUtil<PagingParam>().validate(pagingParam);
bookPaginator.setPage(pagingParam.getPage_page());
bookPaginator.setPageSize(pagingParam.getPage_size());
bookPaginator.setRows((List<Book>) bookService
.findBooks(pagingParam));
bookPaginator.setTotal(bookService.findBooksCount());
} catch (RESTfulValidateException validateException) {
throw validateException;
} catch (Exception e) {
logger.error(ExceptionUtils.getStackTrace(e));
throw new RESTfulException(JsonErrorUtil.getErrorResponse(
Response.Status.INTERNAL_SERVER_ERROR, "ERROR",
NishkarmaMessageSource.getMessage("exception_message")));
}
return bookPaginator;
}
@PUT
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response createBook(@Context HttpServletRequest req, Book book) {
URI uri = null;
try {
new ValidationUtil<Book>().validate(book);
logger.debug("[Nishkarma]-createBook");
logger.debug(" book.getAuthor()=" + book.getAuthor());
logger.debug(" book.getComments()=" + book.getComments());
logger.debug(" book.getCover()=" + book.getCover());
logger.debug(" book.getTitle()=" + book.getTitle());
logger.debug(" book.getPublishedyear()=" + book.getPublishedyear());
logger.debug(" book.getAvailable()=" + book.getAvailable());
bookService.saveBook(book);
uri = new UriTemplate("{requestUrl}/{id}").expand(req
.getRequestURL().toString(), book.getId());
HttpHeaders headers = new HttpHeaders();
headers.put("Location", singletonList(uri.toASCIIString()));
logger.debug("[Nishkarma]-new uri =" + uri.toASCIIString());
} catch (RESTfulValidateException validateException) {
throw validateException;
} catch (Exception e) {
logger.error(ExceptionUtils.getStackTrace(e));
throw new RESTfulException(JsonErrorUtil.getErrorResponse(
Response.Status.INTERNAL_SERVER_ERROR, "ERROR",
NishkarmaMessageSource.getMessage("exception_message")));
}
return Response.created(uri).build();
}
@POST
@Path("/{id}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response save(Book book) {
logger.debug("[Nishkarma]--save");
try {
new ValidationUtil<Book>().validate(book);
logger.debug(" book.getAuthor()=" + book.getAuthor());
logger.debug(" book.getComments()=" + book.getComments());
logger.debug(" book.getCover()=" + book.getCover());
logger.debug(" book.getTitle()=" + book.getTitle());
logger.debug(" book.getPublishedyear()=" + book.getPublishedyear());
logger.debug(" book.getAvailable()=" + book.getAvailable());
int cnt = bookService.saveBook(book);
if (cnt == 0) {
return Response.noContent().build();
}
} catch (RESTfulValidateException validateException) {
throw validateException;
} catch (Exception e) {
logger.error(ExceptionUtils.getStackTrace(e));
throw new RESTfulException(JsonErrorUtil.getErrorResponse(
Response.Status.INTERNAL_SERVER_ERROR, "ERROR",
NishkarmaMessageSource.getMessage("exception_message")));
}
return Response.ok().build();
}
@DELETE
@Path("/{id}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response deleteBook(@PathParam("id") int id) {
try {
int cnt = bookService.deleteBook(id);
if (cnt == 0) {
return Response.noContent().build();
}
} catch (Exception e) {
logger.error(ExceptionUtils.getStackTrace(e));
throw new RESTfulException(JsonErrorUtil.getErrorResponse(
Response.Status.INTERNAL_SERVER_ERROR, "ERROR",
NishkarmaMessageSource.getMessage("exception_message")));
}
return Response.ok().build();
}
}
|
package org.kiirun.adventofcode.day5;
import com.google.common.collect.ContiguousSet;
import com.google.common.collect.DiscreteDomain;
import com.google.common.collect.Sets;
import com.google.common.primitives.Chars;
import reactor.core.publisher.Flux;
import java.util.List;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
public class Day5 {
private static final String[] INPUT = {"FBFFFFFLLL", "FFBFFFFRRR", "FFFBBBBLRL", "FBFFBBFLLL", "FFFBFBBLLL",
"FBFFFFBRLR", "BFFBBFBLLL", "FBFBFFBLLL", "BFFFBBBRLL", "FBFBBFBRLR", "BFBFFFBRLR", "FFFBBFFRLR",
"FFFFFBFRRR", "FBFBBBFRRL", "FBFBBFBRRR", "FBFBBBFLRR", "BBFFFBBRLL", "FBBBBBFRLL", "FBFFFFBLLR",
"FBFFFFFLRR", "FBFBFFBLRR", "FBFBFBBRRL", "FFFFBFFRRL", "FFFFBBFLRR", "BFFBBFBRLR", "BBFFFFFRLR",
"FFBFBBBRLL", "FFBFBBBLRL", "FBFFFBBLLL", "FFFFBBFRLR", "FBFBBFFLLR", "FBBFFBFRLL", "BFFFBFBLLR",
"FBFFBBBLLL", "FFFFBBBLRR", "FFBFFBFLLL", "BFBFBFBRRL", "BFBFFFBRRL", "FBFBFBFLLL", "FBBBBFFRRR",
"FBFFBFBRRR", "BBFFFFFRRL", "BFFFFFFLRL", "FFFFFBBLLR", "FBBFBFBRRL", "BFBFFBFLLL", "FFFFBBBRLL",
"BFFFBFBRLL", "FFFBBFFLLL", "BFFFFFBRLR", "FBFBBFFRLR", "BFFBBBFRLR", "BBFFBFFRRR", "BFFBFFFRLL",
"FFFBBBFLLR", "FBFBFFFRRL", "FBBFFFBLLR", "BFBFFBFLRR", "BFFBBFBRRR", "FFFBBBBRLR", "BBFFBFFRLR",
"FBBBBBFRRR", "FBFBBBFRLR", "FBFFFBBLRL", "FFBFBFFLRR", "BFFFBFFRLL", "FBFFBFBLRL", "BFBBFBFLLR",
"BFFFBBFRLL", "BFBFBFBLRR", "BFFFFBBRLR", "BFBBFFBRRL", "BFFBFFBRRR", "FBFFFBFRLL", "FFFFBFFLLR",
"FBFFFBFLLR", "FBFFFFFRRL", "FBBBFBBLLR", "BFBFFFBLLR", "BFFBFFBLLR", "FFFBBBFRLL", "FBBBBFFRRL",
"FBBFBBFRRR", "BFBFBFFLLR", "BFFFBBBRRL", "FBBFBBBRRL", "FFBFBBFRLL", "FBBFBFFLLL", "FBBBBBFRLR",
"BFBFBFFRRL", "BFFBBFFRRR", "BFBFBFBRLL", "BFFBFFBRLR", "BBFFBFBLRL", "FFBFBFBLLL", "FFBBBFBRRR",
"BBFFFFBLRR", "BFBBBBBRLR", "BFFFFFBLLR", "FBFBBBBRRR", "FBBBFBFLRR", "FBBFBBFLLL", "BBFFFFBLRL",
"FFBBFBFLLL", "FBBBBFBLLR", "FFFBBBBRRL", "FFBFFBFRLL", "BFFBBBFLLR", "FFFBFBBLRR", "FFBBFFBLLR",
"FFBFFBFLRR", "FBBBBFBLRL", "FBBBFBFRLL", "FBFBFFFRLL", "FBBFBBFRLR", "BFFFFBBLLL", "FBFBFBFLRL",
"FBBBFFBRRR", "FFFFBFFLLL", "BFBBBFFRLL", "FBBBFBFLLR", "FBBFBBFLRR", "FBFFBBBLRL", "FBFFBBFLRR",
"FBBBFFBRRL", "FBFBBFBRRL", "FBFBBFBLRL", "BFBFFBBLLL", "FBFFFBFLRR", "FBFFBBFRLL", "FFBBFFFRLR",
"FBFBBBBRLL", "FBBBBFFRLR", "BFBFBFBRLR", "BFFBFBFRLR", "FFFBFFBLLL", "FFFFBBFLLR", "FFBFBBFRRL",
"FBBFBFBRLR", "FBFBBFBLRR", "BFBBBBFLRL", "BFFFFBBRRR", "FBBFBFBLLL", "BFFFFBFLLR", "FFFFFBBLRR",
"FFFBFBBRRL", "BFBFFFFRRR", "FBFBBFFLRL", "FBFFBBBRLL", "FFBBBBFLLR", "FFFBFFBLLR", "FBFFFFFRLL",
"BFBFFFBLLL", "FBBBBFBRLL", "FFFFFFBRRL", "FFBFBFBLLR", "FBFBFBFRLR", "FBBBBBBLLL", "BFFBFFBLRL",
"FFBBBFBLRL", "FBBFFFFRLL", "BBFFBFBLRR", "BFBFFBFLLR", "FFBBFBBRLR", "FBBFFFFRRL", "FBFFBFBRLR",
"BFBFBFFLLL", "FFFBFFFLLL", "BFBFBFFLRL", "BFBFBBFLLL", "FFFBBBBLRR", "BFFBFBFLLL", "BFBBFBFRRR",
"BFBBFFFLLL", "BFFFBBBLRL", "FFBBFBFLRL", "FFFFBFBLLR", "FBFBFFFLLL", "BFBFFFBLRR", "FFBBFBBLLR",
"FFFFBBFLRL", "BFBBFBBLLR", "BFFBBFBLLR", "BFFBFFBRLL", "BFFFBBFLLR", "FFBBFBFLLR", "FBBBFFBRLR",
"FFBFBFFLLR", "FBFFFBBRLR", "FBBFFFBRLL", "FBBFFBBLRL", "BBFFFFBRRL", "FFBFFFBRLL", "BFFFBFFLRL",
"FFFFFBBRRR", "FBFFBBFRRL", "FBFBFBFLRR", "FBBFFBFLRR", "BFBBFBBLLL", "FFFBFBFLRL", "BBFFFFBLLR",
"BBFFBFBLLL", "BFBBFBFRRL", "FBBFFFBRRL", "BFFBBBFLRR", "FFBBBBFRRL", "FBBBBBBRLR", "FFFBFFBRRL",
"FFFBBFBLRL", "FBBBBBBRRL", "FFFFBFFRRR", "FFFBBBBRLL", "FFBBFFBLLL", "BFBFBBFRLR", "FFBFFBBRLL",
"BFBBBBFLRR", "FBFFBFFLLR", "FBBBFFBLLR", "BFFBBBBRRR", "FFBFFFFLRL", "BFFBBFBRLL", "FFBFBBBRRL",
"FFBBBFFRLL", "FBBFFBFLLR", "FBFFBFFLRR", "BBFFFFFLRL", "FFBBBBFRLR", "BBFFFBBLRR", "FFFFFFBRRR",
"FBBBFBBLRL", "BFFBBFBRRL", "BFBFBBFRRL", "BFBBFBBRLL", "BFBFFFBRLL", "BFFBFFFLRL", "BFFBBBBRLL",
"FFBBBBBRRL", "FBBFFBFRRR", "BFBBBBBLRL", "BFFFFFBLRL", "BBFFFFBRLR", "FFBBBBBLRL", "BFFBFBFLRL",
"BFBBFFFLRR", "BFFBBBFLRL", "BFFBFFFLRR", "BFBBFBFLRR", "BBFFFFFLLR", "FFBFFBBLRL", "BFFBBBBLLR",
"FBFFBBBRLR", "BFFFFBBLRR", "BFFFBFFRRR", "FBBFFBBRLL", "FBFBFBFRRL", "FFFFBFBRRR", "FFBBBFBRLL",
"FBFFBFBRRL", "FFBFBFBLRR", "BFFFFFFRLL", "BFFBFFBRRL", "FBFBFFFLLR", "BFBFFBBRLL", "FFBFFBBLLR",
"FBFBBFBLLL", "FFBBFBFLRR", "FFFBBFBRLL", "FBBFFBFLRL", "FFBFBFFRRR", "FBBBFBBRLL", "FBFFFFBLRL",
"FFFFFFBLRR", "BFFBFFFRRL", "BFFBFBBLRR", "FBBFFFBLRL", "FBFFBBFRRR", "BBFFFBFLRL", "BBFFBFFLRL",
"FFBBFFFLRR", "BFBBBFBLLR", "FBFBFBFRLL", "BFBFBBFRLL", "FFBBFBBRLL", "BFBBBFBRRL", "BFFFBBFLRR",
"FFFBFFFRLL", "BBFFBFFLRR", "BBFFBFFLLR", "FFFBFFBLRR", "BFFBFFFRRR", "FBFBFFFRLR", "FBFBFFBLLR",
"FBBFBFBLRR", "FBFBBBBLRL", "FBFBBFFRRR", "BFFFFBFLRR", "FBBFBBBRLL", "FFBFFBBLRR", "FFBFBFFRLR",
"FBBBBBBLLR", "BFBFFFFLRR", "BFFFBBFRRR", "FFBFBFFLLL", "FFBFBBFRRR", "BFFBBBFRLL", "BFBBFBFRLL",
"BFBBBFFRRR", "BFFFBBBLRR", "FFFBBFBRLR", "BBFFFBBLLR", "BFFFBBBLLL", "FFFBFFBRRR", "BFBFBBBLRR",
"BFBFBFFLRR", "FBFBFBBLLL", "FBBBFBBLRR", "FBFFBBBRRR", "FFBFFBBRLR", "FFFBBFFRRL", "FBBFFBBRLR",
"BFFBFBBRRL", "FBBBFFFLRL", "FBBFFFFLLR", "FFBBFFBRRR", "FFFFFBFLRL", "BBFFFFFRLL", "BFBBBFFLLL",
"FBFBBFBRLL", "FBFBBBFRLL", "FBBBFFFLLR", "BFBBFBBLRL", "FFFFBBFLLL", "BFBBBBBRRR", "FFFBFBFRLR",
"FBFFBFBLLL", "BFBBBBBLLR", "FFBBFFFRLL", "FFFBFFFLRL", "FFBBBFFRRL", "FFBFFFFRLR", "BFFFBBBLLR",
"BFBFFFFLRL", "FBBFFBFRLR", "FBFFFFFRLR", "BBFFFBBRRL", "BBFFFBBLRL", "FBFFFBFLRL", "FBBFFFFLRR",
"FBFFFFBLRR", "FBFFBFFLRL", "BFBFFBFRLL", "BFBFBBFRRR", "FBBBFBFLLL", "BBFFFFFLLL", "FFFFBFFLRL",
"FBBFBBFLRL", "FBBFBBBRLR", "FFBFFFFLLR", "FFBFBFBRRR", "FBBBFBBLLL", "FBFBBBBLLR", "BFFFFBBLRL",
"BFFBFBFLLR", "BFFBBBFRRR", "BBFFFBFLRR", "FBFFFFFLRL", "BFFFFFFRRL", "BFFBFFBLLL", "BFFFFFFLLL",
"FFFBFFBLRL", "BFFFFBFRRL", "FBBBFFFRLR", "BFBFBBBLRL", "BBFFFBFRRR", "BFFFFBBLLR", "BFBFBBBRRR",
"FBFFFBFLLL", "FBBBFBFRLR", "FFFFFFBLRL", "FBFBBFFRRL", "BFBBFBFLLL", "FFBFFBBRRL", "BFBFFFFLLL",
"FBBFFBFLLL", "FBFFFBFRRR", "BFBBBBFRRL", "BBFFFBFRLL", "FBBFBFBLRL", "FFBBFFFLRL", "FBBFBBFRRL",
"FBBFBBFLLR", "BFBFBFBLLR", "FBBFFFFRRR", "FBBFFBFRRL", "BFFFFFFRRR", "BFBBFBBRLR", "FFFBFBFRLL",
"FBFFBBBLLR", "BFBBBBBRLL", "BFFBFFFRLR", "BFBBBFFLRL", "BFBBBFFRRL", "FFBBFBFRRR", "FFBFBBFRLR",
"FFBFBFFLRL", "FBFBFFBLRL", "FBBBFFBLRR", "BFBBBFFRLR", "BBFFBFFRRL", "FBBBBBFRRL", "FBFBBFFLLL",
"BFBBFBFRLR", "FFBFBFFRRL", "BBFFFFFLRR", "FBBBFBFRRL", "BFBFBBBRLR", "FFBFFBFRLR", "FFBBFBFRLR",
"FBFFBFFLLL", "BFBFBBBLLL", "BFFFFFBRLL", "FFBFBBFLRR", "BFBBFFFLRL", "BFFFFBFLRL", "FFBBFBFRRL",
"FFFFBBFRRR", "FBFBFFBRLL", "FBBBBFBLRR", "BFBBFBBRRL", "FFFBFBFRRL", "FBFFBFBLLR", "FFBFBBBLRR",
"BBFFFBFLLL", "BFBBBBFRLR", "FFFFFBFRLL", "BBFFFBBRRR", "BFFBBFFRLR", "FBFBBBFLRL", "BFBBFFBLRL",
"BFBBBFFLRR", "FBBBFFFRRR", "FFFFBFBLRL", "BFFBBBFLLL", "FBBBBFBRRL", "BFFBFBBRRR", "FBBBBBFLLR",
"BFBFBBBRLL", "FFFFFBFLRR", "BFFFBBFRRL", "FFFBBBFLRL", "FBBBBFBLLL", "FBBFBBBLLR", "FBFBBFBLLR",
"FBFBFFFLRR", "BFFFFBFRLR", "FFFBBBBLLL", "BFBFFFFRRL", "FBFBBBBLRR", "FBBBBFFLRL", "BFBBBFBLLL",
"FBBFFFBRRR", "FFFBBFFLRL", "FBBFFFFLLL", "BFFFFBBRLL", "FBBBBFBRLR", "FFBBBFBLLL", "BFFFBFFLLL",
"BFBBBBBLRR", "FFBFFFFLRR", "FBBFBFFRLL", "BFFBBBFRRL", "FFFBFBFLLR", "BFFFBFFRRL", "FBFBFBBLLR",
"FBFBBBFRRR", "FBBFBFBRLL", "BBFFFBBLLL", "FBFFBFBRLL", "BFBFFBBLLR", "FFFBBFFLRR", "FBBFBBBLRL",
"FFFFBFFRLL", "FFBBFFFLLL", "BFFBBBBLRL", "BFBBBFFLLR", "FFBBFBFRLL", "BFBBBFBLRL", "BFBBBFBRLR",
"BFFBBFFLRL", "FFBBBBBRLL", "FBBFBFFLRR", "FFFBBFBLRR", "FBBFFBBRRL", "FFFBBFBLLR", "FFFBBFBLLL",
"FBFBFFFRRR", "FFFFFFFRRR", "BFFFBFFLLR", "FFBFFBFLRL", "FFFBFFFLRR", "FBBFBFFRLR", "FBFBFBFLLR",
"FBFFFBBRRL", "FBFFFBBRLL", "FFBBFFBLRL", "FFFFBFBRRL", "FFFFFBFRRL", "BFBBFFBLLR", "FBFFFBBLRR",
"FFFFBFFRLR", "BFFBBFFLRR", "FBBBBBFLLL", "BBFFBFFRLL", "BFFFFFBRRL", "FFFBBBFLLL", "FFBBBBBRLR",
"FFBBBBBLRR", "BFFFFFFLRR", "FFFBBBFRRR", "FFBBBFBRRL", "BFBBBFBLRR", "FBBFFBBLLR", "FFFBFBBRRR",
"FBFBFBBRRR", "FBBFFFBLRR", "FFBFFFBLRR", "FFBFBBBRLR", "FFFBFBFRRR", "BFFBFBFRLL", "FFFFFBBLRL",
"FFBBFFFRRL", "FFBFBBBRRR", "FFBFFBBRRR", "FFFFFBBRLL", "FFFFBBBLLL", "FBFBFFBRRL", "FFFBFBFLRR",
"BFBBFBBRRR", "BFFBFBBLLR", "BFBFBBBLLR", "FBBBBBBRLL", "BFFBFBBRLL", "FBFFBFFRRR", "BFFFBFBRLR",
"FFBBFBBLRL", "BFFFBBFLRL", "FFFBBFFRRR", "BFFBFFBLRR", "FFFFFFBLLR", "BFFBFBBRLR", "FBFBBBBRRL",
"BFBBFFFRLL", "FBFBBFFLRR", "FBBFBBFRLL", "FFBBFBBLRR", "BFBBFFBRRR", "FBBBFBFRRR", "FFFFBFBRLR",
"FFFFFBFRLR", "FBBBFFFRRL", "FBBFFFFRLR", "FFFFBBFRLL", "FBBBFBFLRL", "BBFFFBFRLR", "BFBBFFFLLR",
"BFFBFBFRRL", "FBBBFBBRLR", "FBBFBFBRRR", "FBFFBBFRLR", "FFBBFBBRRL", "FBFFFFBLLL", "FBFFBBFLLR",
"BBFFBFBRLR", "FBFBBBFLLR", "FFFFFFFRRL", "FFBFBBBLLL", "FFFFBFBLRR", "BFFFBFFLRR", "FFFFBBBLLR",
"FFBFBFBRLR", "BFFBBFFLLL", "BFBBBFBRLL", "BBFFFBFLLR", "FFFBFBFLLL", "FFFFBFFLRR", "FFBBBBBLLL",
"FFFFFBFLLL", "FBFBFBBLRR", "BFFFFFBLLL", "BFBBFFBRLL", "FBFBFBBRLR", "FBFBFBBLRL", "FBBBBBBLRR",
"FFBFFFBRRL", "FBBFBFFLLR", "FBBFFBBRRR", "BFBBBBFLLR", "BFFBBBBRRL", "FFFBFFFRRR", "BFBFBBFLLR",
"FFBBFFBLRR", "BFFBFFFLLL", "FBBFBFBLLR", "FFBFFFBLLL", "FFFBFFFRRL", "FFBFFFFRRL", "FFFBBBFRLR",
"FBFFBBBLRR", "FFBBFFBRLR", "FFFBBFBRRL", "BFFFFFBLRR", "BFBFBFFRLR", "FFBBFBBLLL", "FFFFFBBLLL",
"FFFFBBBRRL", "BFFBFBFLRR", "FFBBFFBRLL", "FFBFBFBRRL", "BFBFFFFLLR", "BFFBBBBLRR", "FFFBBBBRRR",
"FFBFBFBLRL", "FBFFFBBRRR", "FFBFFFFLLL", "FFBBBFFRLR", "FBFBBBBRLR", "FBBBBFFLLR", "BFFFBFBRRR",
"FBBFBBBRRR", "FFBFFBFLLR", "FFBBBFBLRR", "BFBFFFFRLL", "BFBBBBBLLL", "BFBFFBFRRR", "BFFFBFBRRL",
"FBFBBBFLLL", "FFBBBBFLLL", "BFFBBFFLLR", "BFBFFBFRLR", "FBBBBFBRRR", "FBFFFBFRRL", "FFBBBFBLLR",
"FBFFBBFLRL", "BFFBFBBLLL", "FFFFFFBRLR", "FBBFBBBLLL", "FFFBFFBRLR", "BFBBBFBRRR", "BFFFFFFRLR",
"BFFFBBFRLR", "FFBBBBFRRR", "FFFFFBBRLR", "BFBFFBBRRR", "FBBFBFFRRR", "FFBBBBFLRL", "FBBBFBBRRL",
"FBBBBBBLRL", "FBBBBBFLRR", "BFBFFBFRRL", "FFFFBFBRLL", "FBBBBFFRLL", "FBBFFFBLLL", "BBFFFBFRRL",
"FFBFFFBLRL", "FFFBFFFLLR", "FFBFFFBLLR", "BFFFBFBLLL", "BFBBBBFRRR", "BFBBFBBLRR", "BFBBFFBLLL",
"FBFFBFFRRL", "FBBFBFFRRL", "FFFBBBBLLR", "FFBBBFFLLL", "BFFBBFBLRR", "FBFBFFBRLR", "FFBFFFBRRR",
"FFFFBBBRRR", "BFBFFFFRLR", "FFBBBFFLLR", "FBBBFFFRLL", "FBBFFBBLRR", "FFBBBFFLRR", "FFBFBFBRLL",
"BFBFBBFLRL", "BFBFFBFLRL", "FBBBFFFLLL", "FFBBBFFLRL", "FBFBBBBLLL", "FFBBBBFRLL", "FBBBFFFLRR",
"FBFBBFFRLL", "BFBFFBBLRL", "FBBBFFBLLL", "BBFFBFBLLR", "FBBBFBBRRR", "BBFFFFBRLL", "FFFBFBBLLR",
"BFBFBBBRRL", "BBFFFFFRRR", "BFFFFFFLLR", "FFBFFFFRLL", "FBBFFFFLRL", "FFFBBBFLRR", "FFBFBBFLLR",
"BFBBFBFLRL", "FFBFBBBLLR", "BFFFFFBRRR", "BFBBBBBRRL", "BFFBFFFLLR", "BFBBFFFRRL", "FFFBFBBLRL",
"FBBBBBBRRR", "FFFFBFBLLL", "FFBBBFFRRR", "BFFFFBFRRR", "FFFFFFBRLL", "FFFFFBFLLR", "FFBFBBFLRL",
"BFFFFBBRRL", "BFBFBBFLRR", "FBFBFBFRRR", "FBFFBFFRLL", "FFFFBBBRLR", "BFBBFFBRLR", "BFBFBFFRRR",
"FFBFFFBRLR", "FBBFBBBLRR", "FBFFFBBLLR", "FFFBBFFLLR", "FBBFBFFLRL", "BFFFFBFRLL", "BFFFBBBRRR",
"FBFFFFFLLR", "FFBBBBBLLR", "FBFFFFFRRR", "FBFBFBBRLL", "BBFFFFBRRR", "BFFFBFBLRR", "BFFFBFBLRL",
"BFFFBFFRLR", "FFFBFBBRLL", "BFBFFFBRRR", "FFBFFBFRRR", "BFBFBFFRLL", "BFBBBBFLLL", "FBBFFFBRLR",
"BBFFBFBRLL", "FFBFFBFRRL", "BFFBBBBLLL", "BFBFFFBLRL", "BFBBFFFRLR", "FBBBBBFLRL", "FFFFBBBLRL",
"FFFBBFBRRR", "BFFBFBFRRR", "FBFFFFBRLL", "FBFFBBBRRL", "FFBFBBFLLL", "FFFFBBFRRL", "FBFFBFFRLR",
"BFBFFBBRRL", "FFFFFFBLLL", "BFBFFBBRLR", "FBBBFFBLRL", "BFFBBBBRLR", "BBFFFFBLLL", "FBFFFBFRLR",
"FBBBBFFLLL", "BBFFFBBRLR", "FFFBBBFRRL", "BFBFBFBLRL", "FFFFFBBRRL", "BFBFBFBLLL", "FFFBFBBRLR",
"FBBFFBBLLL", "FFBBBBBRRR", "BFFFBBFLLL", "BFBFBFBRRR", "BFFBFBBLRL", "FFBBFFFLLR", "BFFBBFFRRL",
"BFFBBFBLRL", "FBFFFFBRRR", "FBBBFFBRLL", "FFFBFFFRLR", "BFBFFBBLRR", "FFBBFBBRRR", "FFBBBFBRLR",
"FFBBFFBRRL", "BFBBFFBLRR", "FBFBFFBRRR", "BFBBFFFRRR", "FBBBBFFLRR", "BFFFFBFLLL", "FBFFFFBRRL",
"FFFBFFBRLL", "BFFFBBBRLR", "FBFBFFFLRL", "FFBFBFFRLL", "FFBBFFFRRR", "BFBBBBFRLL", "BBFFBFFLLL",
"FFBBBBFLRR", "FFBFFBBLLL", "FBFFBFBLRR", "FFFBBFFRLL"};
public static void main(final String[] args) {
final Flux<Integer> passportIds = Flux.fromArray(INPUT)
.map(pass -> new BoardingPass(pass, 128, 8))
.map(BoardingPass::getId)
.sort()
.cache();
passportIds.last()
.subscribe(System.out::println);
final Set<Integer> allIds = ContiguousSet.closed(0, 127 * 8 + 7).stream().collect(Collectors.toSet());
passportIds.collect(Collectors.toSet())
.map(existingIds -> Sets.difference(allIds, existingIds))
.flatMapIterable(Function.identity())
.buffer(2, 1)
.filter(window -> window.get(1) - window.get(0) > 1)
.take(1)
.map(window -> window.get(1))
.subscribe(System.out::println);
}
private static class BoardingPass {
private static final DiscreteDomain<Integer> INTEGERS = DiscreteDomain.integers();
private final List<Character> directions;
private final int rowCount;
private final int columnCount;
private ContiguousSet<Integer> rows;
private ContiguousSet<Integer> columns;
public BoardingPass(final String directions, final int rowCount, final int columnCount) {
this.directions = Chars.asList(directions.toCharArray());
this.rowCount = rowCount;
this.columnCount = columnCount;
rows = ContiguousSet.closedOpen(0, rowCount);
columns = ContiguousSet.closedOpen(0, columnCount);
calculateId();
}
private void calculateId() {
directions.forEach(this::narrow);
}
private void narrow(final Character direction) {
if (direction == 'F') {
final int distanceMoved = (int) INTEGERS.distance(rows.first(), rows.last() + 1) / 2;
rows = rows.headSet(rows.last() + 1 - distanceMoved);
} else if (direction == 'B') {
final int distanceMoved = (int) INTEGERS.distance(rows.first(), rows.last() + 1) / 2;
rows = rows.tailSet(rows.first() + distanceMoved);
} else if (direction == 'L') {
final int distanceMoved = (int) INTEGERS.distance(columns.first(), columns.last() + 1) / 2;
columns = columns.headSet(columns.last() + 1 - distanceMoved);
} else if (direction == 'R') {
final int distanceMoved = (int) INTEGERS.distance(columns.first(), columns.last() + 1) / 2;
columns = columns.tailSet(columns.first() + distanceMoved);
} else {
throw new IllegalArgumentException("Unknown direction " + direction);
}
}
private final int getId() {
return rows.last() * columnCount + columns.last();
}
}
}
|
package com.rofour.baseball.controller.model;
/**
* @ClassName: SelectModel
* @Description: 下拉返回对象
* @author cy
* @date
*
*/
public class SelectModel {
private String id;
private String text;
public SelectModel() {
}
public SelectModel(String id,String text) {
this.id = id;
this.text = text;
}
public java.util.List<SelectModel> getChildren() {
return children;
}
public void setChildren(java.util.List<SelectModel> children) {
this.children = children;
}
private java.util.List<SelectModel> children;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}
|
package com.tencent.mm.plugin.webview.fts;
import com.tencent.mm.ab.b;
import com.tencent.mm.ab.b.a;
import com.tencent.mm.ab.l;
import com.tencent.mm.network.k;
import com.tencent.mm.network.q;
import com.tencent.mm.plugin.websearch.api.p;
import com.tencent.mm.protocal.c.aqs;
import com.tencent.mm.protocal.c.cda;
import com.tencent.mm.protocal.c.cdb;
import com.tencent.mm.sdk.platformtools.x;
public final class e extends l implements k {
public int bWo = -1;
b diG;
private com.tencent.mm.ab.e diJ;
public e() {
a aVar = new a();
aVar.dIG = new cda();
aVar.dIH = new cdb();
aVar.uri = "/cgi-bin/mmux-bin/wxaapp/weappsearchguide";
aVar.dIF = 1866;
this.diG = aVar.KT();
aqs JU = p.JU();
cda cda = (cda) this.diG.dID.dIL;
if (JU != null) {
cda.syE = (double) JU.rms;
cda.syF = (double) JU.rmr;
}
cda.syG = p.bjC();
}
public final int getType() {
return this.diG.dIF;
}
public final int a(com.tencent.mm.network.e eVar, com.tencent.mm.ab.e eVar2) {
this.diJ = eVar2;
return a(eVar, this.diG, this);
}
public final void a(int i, int i2, int i3, String str, q qVar, byte[] bArr) {
x.i("MicroMsg.NetSceneWeAppSearchGuide", "onGYNetEnd, errType = %d, errCode = %d, errMsg = %s", new Object[]{Integer.valueOf(i2), Integer.valueOf(i3), str});
if (this.diJ != null) {
this.diJ.a(i2, i3, str, this);
}
}
}
|
package com.he.loader;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.CharBuffer;
public final class LoadScriptSample {
private static final long epoch_start = System.currentTimeMillis() * 1000L - System.nanoTime() / 1000L;
public final boolean cacheAccepted;
public final boolean cacheHit;
public final int cacheSize;
public final int codeSize;
public final long compileStart;
public final long decodeStringStart;
public final boolean eagerCompiled;
public final long end;
public final long executeStart;
public final long loadCacheStart;
public final long loadCodeStart;
public final String path;
public final long start;
public LoadScriptSample(ByteBuffer paramByteBuffer, int paramInt) {
paramByteBuffer.order(ByteOrder.LITTLE_ENDIAN);
char[] arrayOfChar = new char[paramByteBuffer.getInt(paramInt)];
CharBuffer charBuffer = paramByteBuffer.asCharBuffer();
charBuffer.position((paramInt >> 1) + 2);
charBuffer.get(arrayOfChar);
this.path = new String(arrayOfChar);
this.start = paramByteBuffer.getLong(paramInt + 256);
this.loadCodeStart = paramByteBuffer.getLong(paramInt + 264);
this.decodeStringStart = paramByteBuffer.getLong(paramInt + 272);
this.loadCacheStart = paramByteBuffer.getLong(paramInt + 280);
this.compileStart = paramByteBuffer.getLong(paramInt + 288);
this.executeStart = paramByteBuffer.getLong(paramInt + 296);
this.end = paramByteBuffer.getLong(paramInt + 304);
this.codeSize = paramByteBuffer.getInt(paramInt + 312);
paramInt = paramByteBuffer.getInt(paramInt + 316);
this.cacheSize = 0xFFFFFFF & paramInt;
boolean bool2 = false;
if (paramInt != 0) {
bool1 = true;
} else {
bool1 = false;
}
this.cacheHit = bool1;
if ((Integer.MIN_VALUE & paramInt) == 0) {
bool1 = true;
} else {
bool1 = false;
}
this.cacheAccepted = bool1;
boolean bool1 = bool2;
if ((paramInt & 0x40000000) != 0)
bool1 = true;
this.eagerCompiled = bool1;
}
public static long toEpochTime(long paramLong) {
return (epoch_start + paramLong) / 1000L;
}
public final String toString() {
String str;
StringBuilder stringBuilder = new StringBuilder("LoadScriptSample {\n path : \"");
stringBuilder.append(this.path);
stringBuilder.append("\"\n start : ");
stringBuilder.append(toEpochTime(this.start));
stringBuilder.append('\n');
stringBuilder.append(" load code : +");
stringBuilder.append(this.decodeStringStart - this.loadCodeStart);
stringBuilder.append('\n');
stringBuilder.append(" decode string : +");
stringBuilder.append(this.loadCacheStart - this.decodeStringStart);
stringBuilder.append('\n');
stringBuilder.append(" load cache: +");
stringBuilder.append(this.compileStart - this.loadCacheStart);
stringBuilder.append('\n');
stringBuilder.append(" compile : +");
stringBuilder.append(this.executeStart - this.compileStart);
stringBuilder.append('\n');
stringBuilder.append(" execute : +");
stringBuilder.append(this.end - this.executeStart);
stringBuilder.append('\n');
stringBuilder.append(" total : +");
stringBuilder.append(this.end - this.start);
stringBuilder.append('\n');
stringBuilder.append(" code size : ");
stringBuilder.append(this.codeSize);
stringBuilder.append('\n');
stringBuilder.append(" cache : ");
if (this.cacheHit) {
StringBuilder stringBuilder1 = new StringBuilder();
if (this.cacheAccepted) {
str = "accepted";
} else {
str = "rejected";
}
stringBuilder1.append(str);
stringBuilder1.append(", size ");
stringBuilder1.append(this.cacheSize);
stringBuilder1.append(", ");
if (this.eagerCompiled) {
str = "eager";
} else {
str = "lazy";
}
stringBuilder1.append(str);
stringBuilder1.append(" compiled\n");
str = stringBuilder1.toString();
} else {
str = "miss\n";
}
stringBuilder.append(str);
stringBuilder.append("}");
return stringBuilder.toString();
}
public static interface Callback {
void onSample(LoadScriptSample param1LoadScriptSample);
}
}
/* Location: C:\Users\august\Desktop\tik\df_miniapp\classes.jar!\com\he\loader\LoadScriptSample.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 1.1.3
*/ |
package com.root.mssm.List.List.suggestionlist;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class SearchChild {
@SerializedName("child_name")
@Expose
private String childName;
@SerializedName("photo")
@Expose
private String photo;
@SerializedName("childid")
@Expose
private String childid;
public String getChildName() {
return childName;
}
public void setChildName(String childName) {
this.childName = childName;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public String getChildid() {
return childid;
}
public void setChildid(String childid) {
this.childid = childid;
}
}
|
import java.util.Scanner;
public class VotingRight{
public static void main(String[] args){
Scanner myScan = new Scanner(System.in); //initializes myScan
System.out.print("How old are you? ");
int usersAge = myScan.nextInt();
int yearsLeft = 18-usersAge;
String years;
if(usersAge < 18){
if(yearsLeft == 1){
years = "year";
}
else{
years = "years";
}
System.out.println("You will be allowed to in " + yearsLeft + " " + years + ".");
}
else{ //if the user is older than or is 18 years old
System.out.println("You have the right to vote!");
}
}
}
|
/*
* 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 wickersoft.root.command;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Player;
/**
*
* @author Dennis
*/
public class Portal extends PlayerCommand {
@Override
boolean onCommand(Player player, String[] args) {
String worldName = player.getWorld().getName();
String remoteWorldName = null;
boolean inNether = false;
if (worldName.endsWith("_the_end")) {
}
if (worldName.endsWith("_nether")) {
inNether = true;
remoteWorldName = worldName.substring(0, worldName.length() - 7);
} else {
remoteWorldName = worldName + "_nether";
}
if (Bukkit.getWorld(remoteWorldName) == null) {
}
if (args.length == 0) {
} else {
switch (args[0]) {
case "tp":
Location loc = player.getLocation();
player.sendMessage(ChatColor.GRAY + "Teleporting to proper portal destination..");
if (inNether) {
Location destination = new Location(
Bukkit.getWorld(remoteWorldName),
loc.getX() * 8,
loc.getY(),
loc.getZ() * 8,
loc.getYaw(),
loc.getPitch());
destination = destination.getWorld().getHighestBlockAt(destination).getLocation();
//player.teleport();
} else {
player.teleport(new Location(
Bukkit.getWorld(remoteWorldName),
loc.getX() / 8,
loc.getY(),
loc.getZ() / 8,
loc.getYaw(),
loc.getPitch()));
}
break;
case "create":
break;
}
}
return true;
}
@Override
public String getSyntax() {
return "/portal (tp/create)";
}
@Override
public String getDescription() {
return "Creates portals and fixes links";
}
}
|
package restricao;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.hibernate.validator.constraints.NotEmpty;
@Data
@EqualsAndHashCode(exclude = { "programacoes", "irregularidades" }, callSuper = false)
@ToString(exclude = { "programacoes", "irregularidades" })
@Entity
@Table(name="RES_TBRESTRICAO")
public class ResRestricao {
@Id
@NotNull(message = "Deve ser selecionado uma restrição existente.")
@Column(name="RESTRICAO_ID", nullable = false)
private Long id;
@NotEmpty(message = "A Restrição deve possuir uma descrição.")
@Column(name="DESCRICAO", updatable=false)
private String descricao;
private boolean fixo;
@OneToMany
private List<ResProgramacao> programacoes = new ArrayList<ResProgramacao>(0);
@OneToMany(mappedBy="restricao")
private List<ResIrregularidade> irregularidades;
@ManyToOne
@JoinColumn(name = "tipo_restricao_id")
private ResTipoRestricao tipoRestricao;
public ResRestricao() {}
public ResRestricao(Long id, String descricao) {
this.id = id;
this.descricao = descricao;
}
}
|
package com.youthchina.domain.Qinghong;
import java.sql.Timestamp;
import java.util.Date;
public class SubInfo {
private Integer sub_id;
private String sub_course;
private String sub_honor;
private String sub_award;
private String sub_skill;
private String sub_foreign;
private String sub_interest;
private String sub_introduction;
private Integer stu_id;
private Integer is_delete;
private Timestamp is_delete_time;
public Integer getSub_id() {
return sub_id;
}
public void setSub_id(Integer sub_id) {
this.sub_id = sub_id;
}
public String getSub_course() {
return sub_course;
}
public void setSub_course(String sub_course) {
this.sub_course = sub_course;
}
public String getSub_honor() {
return sub_honor;
}
public void setSub_honor(String sub_honor) {
this.sub_honor = sub_honor;
}
public String getSub_award() {
return sub_award;
}
public void setSub_award(String sub_award) {
this.sub_award = sub_award;
}
public String getSub_skill() {
return sub_skill;
}
public void setSub_skill(String sub_skill) {
this.sub_skill = sub_skill;
}
public String getSub_foreign() {
return sub_foreign;
}
public void setSub_foreign(String sub_foreign) {
this.sub_foreign = sub_foreign;
}
public String getSub_interest() {
return sub_interest;
}
public void setSub_interest(String sub_interest) {
this.sub_interest = sub_interest;
}
public String getSub_introduction() {
return sub_introduction;
}
public void setSub_introduction(String sub_introduction) {
this.sub_introduction = sub_introduction;
}
public Integer getStu_id() {
return stu_id;
}
public void setStu_id(Integer stu_id) {
this.stu_id = stu_id;
}
public Integer getIs_delete() {
return is_delete;
}
public void setIs_delete(Integer is_delete) {
this.is_delete = is_delete;
}
public Timestamp getIs_delete_time() {
return is_delete_time;
}
public void setIs_delete_time(Timestamp is_delete_time) {
this.is_delete_time = is_delete_time;
}
} |
package com.jim.multipos.data.operations;
import com.jim.multipos.data.db.model.products.Category;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.Single;
/**
* Created by DEV on 16.08.2017.
*/
public interface CategoryOperations {
Observable<Long> addCategory(Category category);
Observable<Long> addSubCategory(Category subcategory);
Observable<Boolean> addCategory(List<Category> categoryList);
Observable<Long> replaceCategory(Category category);
Observable<List<Category>> getAllCategories();
Single<List<Category>> getAllActiveCategories();
Single<List<Category>> getAllActiveSubCategories(Category parent);
Observable<List<Category>> getSubCategories(Category category);
Observable<Category> getCategoryByName(String name);
Observable<Boolean> isCategoryNameExists(String name);
Observable<Category> getSubCategoryByName(String category, Long id);
Observable<Boolean> isSubCategoryNameExists(String parentName, String name);
Observable<Category> getCategoryById(Long id);
Observable<Boolean> removeCategory(Category category);
Observable<List<Category>> getActiveCategories();
}
|
package com.codepath.apps.restclienttemplate.activities;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ImageView;
import android.widget.TextView;
import com.codepath.apps.restclienttemplate.R;
import com.codepath.apps.restclienttemplate.fragments.UserTimelineFragment;
import com.codepath.apps.restclienttemplate.models.User;
import com.codepath.apps.restclienttemplate.network.TwitterClient;
import com.squareup.picasso.Picasso;
/**
* Created by ankit on 4/2/16.
*/
public class ProfileActivity extends ActionBarActivity {
private User user;
private TwitterClient client;
private TextView tvUserName;
private TextView tvDescription;
private ImageView ivUserPhoto;
private TextView tvTweetCount;
private TextView tvFollowingCount;
private TextView tvFollowerCount;
private ImageView ivBackgroundImage;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
}
private void populateViews(Bundle savedInstanceState) {
// Find views
tvUserName = (TextView) findViewById(R.id.tvUsername);
tvDescription = (TextView) findViewById(R.id.tvBody);
ivUserPhoto = (ImageView) findViewById(R.id.ivProfileImage);
tvTweetCount = (TextView) findViewById(R.id.tvTweetCount);
tvFollowingCount = (TextView) findViewById(R.id.tvFollowingCount);
tvFollowerCount = (TextView) findViewById(R.id.tvFollowersCount);
// Populate information
tvUserName.setText(user.getName());
tvDescription.setText(user.getDescription());
tvTweetCount.setText(user.getTweetCount().toString() + " Tweets");
tvFollowerCount.setText(user.getFollowerCount().toString() + " Followers");
tvFollowingCount.setText(user.getFollowingCount().toString() + " Following");
// Clear user photo
ivUserPhoto.setImageResource(android.R.color.transparent);
// Populate user photo
Picasso.with(getApplicationContext()).load(user.getProfileImageURL()).into(ivUserPhoto);
getSupportActionBar().setTitle("@" + user.getScreenName());
if (savedInstanceState == null) {
// Get screen name
String screenName = user.getScreenName();
// Create user timeline fragment
UserTimelineFragment fragment = UserTimelineFragment.newInstance(screenName);
// Display user fragment
FragmentTransaction ft = getSupportFragmentManager() .beginTransaction();
ft.replace(R.id.flContainer, fragment);
ft.commit();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_profile, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
|
package com.pybeta.daymatter.ui;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.pybeta.daymatter.DayMatter;
import com.pybeta.daymatter.IContants;
import com.pybeta.daymatter.R;
import com.pybeta.daymatter.core.DataManager;
import com.pybeta.daymatter.utils.DateUtils;
import com.pybeta.ui.utils.ItemListAdapter;
import com.pybeta.ui.utils.ItemView;
import com.pybeta.util.AsyncLoader;
import com.umeng.fb.UMFeedbackService;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.Loader;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ListView;
import android.widget.TextView;
public class HolidayActivity extends BaseActivity implements LoaderCallbacks<List<DayMatter>> {
private ListView mListView;
private HolidayMatterAdapter mDateAdapter;
protected List<DayMatter> mMatterList = Collections.emptyList();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_holiday);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle(R.string.title_activity_holiday);
mListView = (ListView) findViewById(R.id.view_list);
mDateAdapter = new HolidayMatterAdapter(this);
mListView.setAdapter(mDateAdapter);
getSupportLoaderManager().initLoader(0, null, this);
}
@Override
public Loader<List<DayMatter>> onCreateLoader(int id, Bundle args) {
return new MatterListLoader(this);
}
@Override
public void onLoadFinished(Loader<List<DayMatter>> loader, List<DayMatter> data) {
if (data == null) {
mMatterList = Collections.emptyList();
} else {
mMatterList = data;
}
mDateAdapter.setItems(mMatterList.toArray());
}
@Override
public void onLoaderReset(Loader<List<DayMatter>> loader) {
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getSupportMenuInflater().inflate(R.menu.activity_count_down, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home: {
finish();
break;
}
case R.id.menu_item_action_setting: {
Intent intent = new Intent(this, SettingsActivity.class);
startActivity(intent);
break;
}
case R.id.menu_item_action_feedback: {
UMFeedbackService.openUmengFeedbackSDK(this);
break;
}
default:
break;
}
return super.onOptionsItemSelected(item);
}
public static class MatterListLoader extends AsyncLoader<List<DayMatter>> {
private Context context;
public MatterListLoader(Context context) {
super(context);
this.context = context;
}
@Override
public List<DayMatter> loadInBackground() {
ArrayList<DayMatter> matterList = DataManager.getInstance(context).getHolidayList();
return DataManager.getInstance(context).sortMatters(matterList, IContants.SORT_BY_DATE_AESC);
}
}
public class HolidayMatterAdapter extends ItemListAdapter<DayMatter, HolidayMatterView> {
private Context context;
public HolidayMatterAdapter(Context context) {
super(R.layout.holiday_list_item, LayoutInflater.from(context));
this.context = context;
}
@Override
protected void update(int position, HolidayMatterView view, DayMatter item) {
DateUtils.showDayMatter(context, item, null, null, view.date, view.nums, null);
view.title.setText(item.getMatter());
}
@Override
protected HolidayMatterView createView(View view) {
return new HolidayMatterView(view);
}
}
public class HolidayMatterView extends ItemView {
protected TextView title;
protected TextView date;
protected TextView nums;
public HolidayMatterView(View view) {
super(view);
title = (TextView) view.findViewById(R.id.tv_matter_title);
date = (TextView) view.findViewById(R.id.tv_matter_date);
nums = (TextView) view.findViewById(R.id.tv_matter_days);
}
}
}
|
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
public class Server {
}
class Company extends UnicastRemoteObject {
protected Company() throws RemoteException {
super();
}
} |
package edu.john.test;
public class Test {
public static void main(String[] args) {
int[][] scores = {
{ 82, 90, 91 },
{ 68, 72, 64 },
{ 95, 91, 89 },
{ 67, 52, 60 },
{ 79, 81, 85 },
};
// TODO 二维数组求平均数
double sum=0.0;
int count=0;
for (int[] arr : scores ) {
for (int n : arr) {
sum+=n;
count++;
}
}
double average = sum/(count*1.0);
System.out.println(average);
}
} |
package com.example.healthmanage.ui.activity.healthreport.ui;
import android.os.Bundle;
import android.view.View;
import androidx.lifecycle.Observer;
import com.blankj.utilcode.util.StringUtils;
import com.example.healthmanage.BR;
import com.example.healthmanage.R;
import com.example.healthmanage.base.BaseActivity;
import com.example.healthmanage.databinding.ActivityReportDetailBinding;
import com.example.healthmanage.ui.activity.healthreport.response.HealthReportDetailResponse;
import com.example.healthmanage.ui.activity.healthreport.viewmodel.HealthReportViewModel;
import com.example.healthmanage.utils.ToolUtil;
import com.example.healthmanage.widget.TitleToolBar;
/**
* 健康报告详情
*/
public class HealthReportDetailActivity extends BaseActivity<ActivityReportDetailBinding, HealthReportViewModel> implements TitleToolBar.OnTitleIconClickCallBack, View.OnClickListener {
private TitleToolBar titleToolBar = new TitleToolBar();
private int id;
private String name;
@Override
public void onClick(View v) {
}
@Override
protected void initData() {
id = getIntent().getIntExtra("id",0);
name = getIntent().getStringExtra("name");
if (StringUtils.isEmpty(name)){
titleToolBar.setTitle("健康报告");
}else {
titleToolBar.setTitle(name);
}
titleToolBar.setLeftIconVisible(true);
titleToolBar.setTitleColor(getResources().getColor(R.color.colorBlack));
dataBinding.layoutTitle.toolbarTitle.setBackgroundColor(getResources().getColor(R.color.white));
titleToolBar.setBackIconSrc(R.drawable.back_black);
viewModel.setTitleToolBar(titleToolBar);
viewModel.getHealthReport(id);
}
@Override
protected void registerUIChangeEventObserver() {
super.registerUIChangeEventObserver();
viewModel.healthReportDetailData.observe(this, new Observer<HealthReportDetailResponse.DataBean>() {
@Override
public void onChanged(HealthReportDetailResponse.DataBean dataBean) {
if (dataBean!=null){
viewModel.bloodPressure.postValue(dataBean.getBloodPressure());
viewModel.bloodSugar.postValue(dataBean.getBloodSugar());
viewModel.bloodOxygen.postValue(dataBean.getBloodOxygen());
viewModel.temprature.postValue(dataBean.getTemperature());
viewModel.sportStatus.postValue(dataBean.getSport());
viewModel.sleepStatus.postValue(dataBean.getSleep());
viewModel.reportStartTime.postValue(dataBean.getStartTime());
viewModel.reportEndTime.postValue(dataBean.getEndTime());
viewModel.reportCreateTime.postValue(ToolUtil.timeStampToDate(String.valueOf(dataBean.getCreateTime()),null));
}
}
});
}
@Override
protected int initVariableId() {
return BR.ViewModel;
}
@Override
protected int setContentViewSrc(Bundle savedInstanceState) {
return R.layout.activity_report_detail;
}
@Override
public void initViewListener() {
super.initViewListener();
titleToolBar.setOnClickCallBack(this);
}
@Override
public void onRightIconClick() {
}
@Override
public void onBackIconClick() {
finish();
}
}
|
/*
* Copyright (C) 2015 Miquel Sas
*
* This program 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.
*
* This program 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 this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
package com.qtplaf.library.util;
/**
* Lists this library icon path names.
*
* @author Miquel Sas
*/
public interface Icons {
/** Very flat and simple icons 16x16 */
String flat_16x16_cancel = "images/flat/16x16/cancel.png";
String flat_16x16_close = "images/flat/16x16/close.png";
String flat_16x16_info = "images/flat/16x16/info.png";
String flat_16x16_pause = "images/flat/16x16/pause.png";
String flat_16x16_resume = "images/flat/16x16/resume.png";
/** Very flat and simple icons 24x24 */
String flat_24x24_cancel = "images/flat/24x24/cancel.png";
String flat_24x24_close = "images/flat/24x24/close.png";
String flat_24x24_info = "images/flat/24x24/info.png";
String flat_24x24_pause = "images/flat/24x24/pause.png";
String flat_24x24_resume = "images/flat/24x24/resume.png";
/** Common application icons 16x16 */
String app_16x16_accept = "images/app/16x16/accept.png";
String app_16x16_browse = "images/app/16x16/browse.png";
String app_16x16_cancel = "images/app/16x16/cancel.png";
String app_16x16_chart = "images/app/16x16/chart.png";
String app_16x16_checked = "images/app/16x16/checked.png";
String app_16x16_clear = "images/app/16x16/clear.png";
String app_16x16_close = "images/app/16x16/close.png";
String app_16x16_columns = "images/app/16x16/columns.png";
String app_16x16_create = "images/app/16x16/new.png";
String app_16x16_delete = "images/app/16x16/delete.png";
String app_16x16_download = "images/app/16x16/download.png";
String app_16x16_execute = "images/app/16x16/execute.png";
String app_16x16_list = "images/app/16x16/list.png";
String app_16x16_new = "images/app/16x16/new.png";
String app_16x16_purge = "images/app/16x16/purge.png";
String app_16x16_select_all = "images/app/16x16/select-all.png";
String app_16x16_sort = "images/app/16x16/sort.png";
String app_16x16_stop = "images/app/16x16/stop.png";
String app_16x16_unchecked = "images/app/16x16/unchecked.png";
/** Chart icons 16x16 */
String chart_16x16_button_info = "images/chart/16x16/button_info.png";
String chart_16x16_button_pause = "images/chart/16x16/button_pause.png";
String chart_16x16_button_resume = "images/chart/16x16/button_resume.png";
String chart_16x16_button_stop = "images/chart/16x16/button_stop.png";
String chart_16x16_drawing_ellipse = "images/chart/16x16/drawing_ellipse.png";
String chart_16x16_drawing_line_horizontal = "images/chart/16x16/drawing_line_horizontal.png";
String chart_16x16_drawing_line_long = "images/chart/16x16/drawing_line_long.png";
String chart_16x16_drawing_line_poly = "images/chart/16x16/drawing_line_poly.png";
String chart_16x16_drawing_line_short = "images/chart/16x16/drawing_line_short.png";
String chart_16x16_drawing_line_vertical = "images/chart/16x16/drawing_line_vertical.png";
String chart_16x16_drawing_rectangle = "images/chart/16x16/drawing_rectangle.png";
String chart_16x16_drawing_triangle = "images/chart/16x16/drawing_triangle.png";
String chart_16x16_titlebar_chart_active = "images/chart/16x16/titlebar_chart_active.png";
String chart_16x16_titlebar_chart_inactive = "images/chart/16x16/titlebar_chart_inactive.png";
String chart_16x16_titlebar_close_tab = "images/chart/16x16/titlebar_close_tab.png";
String chart_16x16_toolbar_cursor = "images/chart/16x16/toolbar_cursor.png";
String chart_16x16_toolbar_drawings = "images/chart/16x16/toolbar_drawings.png";
String chart_16x16_toolbar_indicators = "images/chart/16x16/toolbar_indicators.png";
String chart_16x16_toolbar_ohlc = "images/chart/16x16/toolbar_ohlc.png";
}
|
package net.minecraft.inventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
public interface ISidedInventory extends IInventory {
int[] getSlotsForFace(EnumFacing paramEnumFacing);
boolean canInsertItem(int paramInt, ItemStack paramItemStack, EnumFacing paramEnumFacing);
boolean canExtractItem(int paramInt, ItemStack paramItemStack, EnumFacing paramEnumFacing);
}
/* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\net\minecraft\inventory\ISidedInventory.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/ |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.inftel.scrum.model;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
/**
*
* @author Fernando
*/
@Entity
@Table(name = "REUNIONES")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Reuniones.findAll", query = "SELECT r FROM Reuniones r"),
@NamedQuery(name = "Reuniones.findById", query = "SELECT r FROM Reuniones r WHERE r.id = :id"),
@NamedQuery(name = "Reuniones.findByAsunto", query = "SELECT r FROM Reuniones r WHERE r.asunto = :asunto"),
@NamedQuery(name = "Reuniones.findByFecha", query = "SELECT r FROM Reuniones r WHERE r.fecha = :fecha"),
@NamedQuery(name = "Reuniones.findByLugar", query = "SELECT r FROM Reuniones r WHERE r.lugar = :lugar")})
public class Reuniones implements Serializable {
private static final long serialVersionUID = 1L;
// @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
@Id
@Basic(optional = false)
@NotNull
@Column(name = "ID")
private BigDecimal id;
@Size(max = 30)
@Column(name = "ASUNTO")
private String asunto;
@Column(name = "FECHA")
@Temporal(TemporalType.TIMESTAMP)
private Date fecha;
@Size(max = 50)
@Column(name = "LUGAR")
private String lugar;
@JoinColumn(name = "USUARIO_ID", referencedColumnName = "ID")
@ManyToOne
private Usuario usuarioId;
public Reuniones() {
}
public Reuniones(BigDecimal id) {
this.id = id;
}
public BigDecimal getId() {
return id;
}
public void setId(BigDecimal id) {
this.id = id;
}
public String getAsunto() {
return asunto;
}
public void setAsunto(String asunto) {
this.asunto = asunto;
}
public Date getFecha() {
return fecha;
}
public void setFecha(Date fecha) {
this.fecha = fecha;
}
public String getLugar() {
return lugar;
}
public void setLugar(String lugar) {
this.lugar = lugar;
}
public Usuario getUsuarioId() {
return usuarioId;
}
public void setUsuarioId(Usuario usuarioId) {
this.usuarioId = usuarioId;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Reuniones)) {
return false;
}
Reuniones other = (Reuniones) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "org.inftel.scrum.model.Reuniones[ id=" + id + " ]";
}
}
|
package com.hesoyam.pharmacy.pharmacy.dto;
import com.hesoyam.pharmacy.util.report.ReportResult;
import java.util.List;
public class SalesDTO {
private List<String> labels;
private List<Double> results;
public SalesDTO(ReportResult reportResult){
labels = reportResult.getLabels();
results = reportResult.getData();
}
public SalesDTO(){
//Empty ctor for JSON serializer
}
public List<String> getLabels() {
return labels;
}
public void setLabels(List<String> labels) {
this.labels = labels;
}
public List<Double> getResults() {
return results;
}
public void setResults(List<Double> results) {
this.results = results;
}
}
|
package com.omaraly.photoweatherapp.Activities;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import com.omaraly.photoweatherapp.R;
import com.omaraly.photoweatherapp.SharedPreferences.ConfigurationFile;
import com.omaraly.photoweatherapp.Utilities.IntentClass;
import com.omaraly.photoweatherapp.databinding.ActivitySplashBinding;
public class SplashActivity extends AppCompatActivity {
private Activity activity;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
ActivitySplashBinding activitySplashBinding = DataBindingUtil.setContentView (this, R.layout.activity_splash);
activity = this;
ConfigurationFile.setCurrentLanguage (activity, "en");
new Handler ().postDelayed (new Runnable () {
@Override
public void run() {
IntentClass.goToActivityAndClear (activity, MainActivity.class, null);
}
}, 3000);
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.