text
stringlengths 10
2.72M
|
|---|
package tasks.lift;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.CancelledKeyException;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.util.ArrayList;
import java.util.Iterator;
/**
* LiftChecker реализует сущность Проверятель лифта.
* @author Gureyev Ilya (mailto:ill-jah@yandex.ru)
* @version 2018-02-27
* @since 2018-02-05
*/
class LiftChecker extends Thread {
/**
* Адрес сервера.
*/
private final String address;
/**
* Буфер данных.
*/
private final ByteBuffer bBuf;
/**
* Синглтон.
*/
private static LiftChecker instance;
/**
* Номер порта сервера.
*/
private final int port;
/**
* Селектор.
*/
private final Selector selector;
/**
* Текущий статус лифта.
*/
private final int[] status;
/**
* Канал сокета.
*/
private final SocketChannel sockCh;
/**
* Конструктор.
* @param address адрес сервера.
* @param port номер порта сервера.
* @throws java.io.IOException исключение ввода-вывода.
*/
private LiftChecker(final String address, final int port) throws IOException {
this.address = address;
this.bBuf = ByteBuffer.allocate(8);
this.port = port;
this.selector = Selector.open();
this.sockCh = SocketChannel.open();
this.sockCh.configureBlocking(false);
this.setDaemon(true);
this.status = new int[]{0, 0};
}
/**
* Закрывает соединение.
*/
public void close() {
try {
this.selector.close();
this.sockCh.close();
} catch (IOException ex) {
System.err.println("IO exception in close().");
ex.printStackTrace();
}
}
/**
* Создаёт соединение.
* @return true если соединение установлено. Иначе false.
*/
private boolean connect() {
boolean result = false;
try {
this.sockCh.connect(new InetSocketAddress(this.address, this.port));
while (!this.sockCh.finishConnect()) {
System.err.println("Establishing connection to server.");
sleep(20);
}
result = this.sockCh.isConnected();
} catch (IllegalMonitorStateException | InterruptedException | IOException ex) {
System.err.println("Error connecting to server.");
ex.printStackTrace();
} finally {
return result;
}
}
/**
* Обменивается данными с сервером.
* @param command комманда серверу.
* @return код возврата.
* @throws java.nio.channels.ClosedChannelException исключение Канал закрыт.
* @throws java.io.IOException исключение ввода-вывода.
*/
private int exchange(String command) throws ClosedChannelException, IOException {
Integer code = null;
Iterator<SelectionKey> keyIter;
SelectionKey key;
byte[] outData = (command + '\0').getBytes();
this.sockCh.register(this.selector, SelectionKey.OP_WRITE);
//System.err.println("this.selector.select() != 0: " + (this.selector.select() != 0));
while (this.selector.select() != 0 && !Thread.currentThread().isInterrupted()) {
keyIter = selector.selectedKeys().iterator();
try {
while (keyIter.hasNext()) {
key = keyIter.next();
keyIter.remove();
if (key.isReadable()) {
code = this.read();
}
if (key.isWritable()) {
this.write(outData);
}
}
} catch (CancelledKeyException ex) {
System.err.println("LiftChecker.exchange() invalid key");
}
if (code != null) {
break;
}
//System.err.println("+++++ exchange(command): " + command);
}
//System.err.println("+++++ exchange(command): " + command + ". code: " + code);
return code;
}
/**
* Получает текущий статус лифта.
* @return текущий статус лифта.
*/
public int[] getStatus() {
//System.err.println(String.format("this.status[0]: %d, [1]: %d", this.status[0], this.status[1]));
return this.status;
}
/**
* Получает синглтон.
* @param address адрес сервера.
* @param port номер порта сервера.
* @throws java.io.IOException исключение ввода-вывода.
* @return синглтон.
*/
public static synchronized LiftChecker getInstance(final String address, final int port) throws IOException {
if (instance == null) {
instance = new LiftChecker(address, port);
}
return instance;
}
/**
* Читает данные из сокета.
* @return код ответа сервера.
* @throws java.io.IOException исключение ввода-вывода.
*/
private int read() throws IOException {
int result = 0;
try {
this.bBuf.clear();
int count;
byte[] inData;
ArrayList<Byte> listIn = new ArrayList<>();
while ((count = sockCh.read(bBuf)) != -1) {
if (count > 0) {
bBuf.flip();
while (bBuf.hasRemaining()) {
listIn.add(bBuf.get());
}
bBuf.clear();
bBuf.rewind();
if (bBuf.get(count - 1) == '\0') {
inData = new byte[listIn.size()];
for (int b = 0, size = listIn.size(); b < size; b++) {
inData[b] = listIn.get(b);
}
String str = new String(inData);
str = str.subSequence(0, str.indexOf('\0')).toString();
result = Integer.parseInt(str);
listIn.clear();
break;
}
}
}
} catch (NumberFormatException ex) {
System.err.println("Exception in read().");
ex.printStackTrace();
} finally {
return result;
}
}
/**
* Переопределёный метод.
*/
@Override
public void run() {
if (!this.connect()) {
return;
}
try {
while (true) {
this.status[0] = this.exchange("StatusFloor:0");
//System.err.println("StatusFloor: " + this.status[0]);
this.status[1] = this.exchange("StatusDoor:0");
//System.err.println("StatusDoor: " + this.status[1]);
//System.err.println(String.format("this.status[0]: %d, [1]: %d", this.status[0], this.status[1]));
sleep(1000);
}
} catch (ClosedChannelException ex) {
ex.printStackTrace();
} catch (IOException ex) {
this.close();
System.err.println("Lift is broken");
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
/**
* Переопределёный метод.
*/
@Override
public synchronized void start() {
if (Thread.State.NEW == this.getState()) {
super.start();
}
}
/**
* Пишет данные в сокет.
* @param outData массив байтов сообщения.
* @throws java.nio.channels.ClosedChannelException исключение Канал закрыт.
* @throws java.io.IOException исключение ввода-вывода.
*/
private void write(byte[] outData) throws ClosedChannelException, IOException {
int iter = 0;
while (true) {
bBuf.put(outData[iter++]);
if (bBuf.position() == bBuf.limit() || iter == outData.length) {
bBuf.flip();
while (bBuf.hasRemaining()) {
sockCh.write(bBuf);
}
bBuf.clear();
bBuf.rewind();
if (iter == outData.length) {
break;
}
}
}
this.sockCh.register(this.selector, SelectionKey.OP_READ);
}
}
|
package antColony;
public class Cell {
int pheromone;
int cellType;//0=normal, 1=finish
int[] loc;
//CONSTRUCTORS
public Cell(int x, int y){
pheromone=1;
cellType=0;
loc=new int[2];
loc[0]=x;
loc[1]=y;
}
//GET_METHODS
public int getPheromone(){
return pheromone;
}
public int[] getLocation(){
return loc;
}
public int getType(){
return cellType;
}
//SET_METHODS
public void setPheromone(int pheromone_in){
pheromone=pheromone_in;
}
///MUT_METHODS
public void incPheromone(int inc_in){
pheromone+=inc_in;
}
public void decPheromone(int dec_in){
pheromone-=dec_in;
}
public void makeObsticle(){
cellType=2;
}
public void makeFoodSource(){
cellType=1;
}
public void makeNormalCell(){
cellType=0;
}
public boolean isNextTo(int[] loc) {
if((Math.abs(loc[0] - this.loc[0]) <= 1) && (Math.abs(loc[1] - this.loc[1]) <= 1))
return true;
return false;
}
}
|
package com.example.selfhelpcity.view;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import com.alibaba.fastjson.JSON;
import com.comenjoysoft.baselibrary.util.SPUtils;
import com.example.selfhelpcity.R;
import com.example.selfhelpcity.base.Api;
import com.example.selfhelpcity.base.BaseActivity;
import com.example.selfhelpcity.base.Constant;
import com.example.selfhelpcity.bean.db.CommuityBean;
import com.example.selfhelpcity.bean.db.peopleBean;
import com.example.selfhelpcity.model.ObjectBox;
import com.example.selfhelpcity.services.KeepLiveService;
import com.yanzhenjie.permission.AndPermission;
import com.yanzhenjie.permission.runtime.Permission;
import com.zhy.http.okhttp.OkHttpUtils;
import com.zhy.http.okhttp.callback.StringCallback;
import java.util.List;
import okhttp3.Call;
/**
* 欢迎页
*/
public class SplashActivity extends BaseActivity {
@Override
protected int getContentView() {
return R.layout.activity_welcome;
}
@Override
protected void init(Bundle bundle) {
Intent intent = new Intent(SplashActivity.this, KeepLiveService.class);
startService(intent);
AndPermission.with(this)
.runtime()
.permission(Permission.Group.STORAGE)
.onGranted(data -> {
new Handler() {
@Override
public void handleMessage(Message msg) {
if (SPUtils.getInstance(SplashActivity.this).getBoolean(Constant.SP_KEY_FIRST_LAUNCH, true)) {
SPUtils.getInstance(SplashActivity.this).put(Constant.SP_KEY_FIRST_LAUNCH, false);
startActivity(new Intent(SplashActivity.this, LoginActivity.class));
finish();
overridePendingTransition(R.anim.enter_alpha, R.anim.exit_alpha);
} else {
String password = SPUtils.getInstance(getApplicationContext()).getString(Constant.SP_KEY_WALLET_ADDRESS, "");
if (!password.isEmpty()) {
startActivity(new Intent(SplashActivity.this, MainActivity.class));
finish();
} else {
startActivity(new Intent(SplashActivity.this, LoginActivity.class));
finish();
}
overridePendingTransition(R.anim.enter_alpha, R.anim.exit_alpha);
}
finish();
}
}.sendEmptyMessageDelayed(0, 2000);
})
.onDenied(data -> {
})
.start();
}
@Override
protected void initView() {
}
@Override
protected void initData() {
// OkGo.<String>get(Api.GET_PEOPLE_LIST).execute(new com.lzy.okgo.callback.StringCallback() {
// @Override
// public void onSuccess(Response<String> response) {
// Type type = new TypeToken<List<person>>(){}.getType();
// List<person> peopleBeans = new Gson().fromJson(response.body(), type);
// Log.d("ljyljy", "onSuccess: "+peopleBeans.get(0).getPassword());
// }
//
// @Override
// public void onError(Response<String> response) {
// super.onError(response);
// }
// });
getDataFormNet();
getDataFormNetCommunity();
}
private void getDataFormNetCommunity() {
OkHttpUtils
.get()
.url(Api.GET_COMMUNITY_LIST)
.build()
.execute(new StringCallback() {
@Override
public void onError(Call call, Exception e, int id) {
Log.d("ljy", e.getMessage());
}
@Override
public void onResponse(String response, int id) {
Log.d("ljyc", response);
processDataCommunity(response);
}
});
}
private void processDataCommunity(String response) {
if (response != null) {
List<CommuityBean> homeBean = JSON.parseArray(response, CommuityBean.class);
// result = homeBean.getResult();
// Log.d("ljy", result.getHot_info().get(0).getName());
Log.d("ljyc", "ProcessData: " + response);
ObjectBox.addCommuityToDB(homeBean);
}
}
private void getDataFormNet() {
OkHttpUtils
.get()
.url(Api.GET_PEOPLE_LIST)
.build()
.execute(new StringCallback() {
@Override
public void onError(Call call, Exception e, int id) {
Log.d("ljy", e.getMessage());
}
@Override
public void onResponse(String response, int id) {
Log.d("ljy", response);
ProcessData(response);
}
});
}
private void ProcessData(String json) {
if (json != null) {
List<peopleBean> homeBean = JSON.parseArray(json, peopleBean.class);
// result = homeBean.getResult();
// Log.d("ljy", result.getHot_info().get(0).getName());
Log.d("ljy", "ProcessData: " + homeBean.get(0).getAge());
ObjectBox.addPeopleList(homeBean);
}
}
@Override
protected void destroy() {
}
}
|
/*******************************************************************************
* Copyright 2013 Vitaliy Yakovchuk
*
* 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.foreignreader;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.DownloadManager;
import android.app.DownloadManager.Query;
import android.app.DownloadManager.Request;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import com.foreignreader.R;
import com.foreignreader.util.LongTranslationHelper;
import com.foreignreader.util.WordNetExtractor;
import com.lamerman.FileDialog;
import com.lamerman.SelectionMode;
import com.reader.common.BookMetadata;
import com.reader.common.BooksDatabase;
import com.reader.common.Database;
import com.reader.common.ObjectsFactory;
import com.reader.common.book.Book;
import com.reader.common.book.BookLoader;
import com.reader.common.book.Sentence;
import com.reader.common.book.SentenceParserCallback;
public class BooksActivity extends Activity {
private static final int REQUEST_LOAD = 0;
private static final int REQUEST_OPEN_WORDS = 1;
private static final int REQUEST_OPEN_SETTING = 2;
private BookFileAdapter adapter;
private List<BookMetadata> bookFiles;
public final static boolean TESTING_STORGE = false;// false;
private BooksDatabase booksDatabase;
private long enqueue;
private DownloadManager dm;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_books);
if (TESTING_STORGE)
ObjectsFactory.storageFile = new File(getFilesDir(), "words.db");
else {
File file = new File(Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES).getParentFile(),
"Foreign Reader");
file.mkdirs();
ObjectsFactory.storageFile = new File(file, "words.db");
}
final ListView books = (ListView) findViewById(R.id.bookListView);
books.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@SuppressWarnings("rawtypes")
@Override
public void onItemClick(AdapterView parentView, View childView,
int position, long id) {
loadBook(bookFiles.get(position));
}
});
booksDatabase = ObjectsFactory.getDefaultBooksDatabase();
bookFiles = booksDatabase.getBooks();
adapter = new BookFileAdapter(this, R.layout.book_item, bookFiles);
books.setAdapter(adapter);
// WordNet download section
BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(action)) {
Query query = new Query();
query.setFilterById(enqueue);
Cursor c = dm.query(query);
if (c.moveToFirst()) {
int columnIndex = c
.getColumnIndex(DownloadManager.COLUMN_STATUS);
if (DownloadManager.STATUS_SUCCESSFUL == c
.getInt(columnIndex)) {
String uriString = c
.getString(c
.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI));
try {
final Uri uri = Uri.parse(uriString);
WordNetExtractor extractor = new WordNetExtractor() {
protected void onPostExecute(Void result) {
getContentResolver().delete(uri, null,
null);
Toast.makeText(
getApplicationContext(),
getResources()
.getString(
R.string.word_net_downloaded),
Toast.LENGTH_SHORT).show();
return;
};
};
extractor.execute(getContentResolver()
.openInputStream(uri));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
}
}
};
registerReceiver(receiver, new IntentFilter(
DownloadManager.ACTION_DOWNLOAD_COMPLETE));
}
public void removeBook(View view) {
BookMetadata bm = (BookMetadata) view.getTag();
booksDatabase.removeBook(bm);
adapter.remove(bm);
adapter.notifyDataSetChanged();
}
public void openBook(View view) {
loadBook((BookMetadata) view.getTag());
}
public void scanBook(View view) {
final BookMetadata bm = (BookMetadata) view.getTag();
Book book;
try {
book = BookLoader.loadBook(new File(bm.getFileName()));
book.scanForSentences(new SentenceParserCallback() {
Database database = ObjectsFactory.getDefaultDatabase();
@Override
public boolean found(Sentence sentence) {
database.addSentence(sentence.text, bm.getName(),
sentence.section, -1);
return false;
}
});
} catch (Exception e) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(e.getLocalizedMessage());
builder.create().show();
}
}
protected void openAboutActivity() {
Intent intent = new Intent(getBaseContext(), AboutActivity.class);
startActivityForResult(intent, REQUEST_OPEN_SETTING);
}
protected void openSettingActivity() {
Intent intent = new Intent(getBaseContext(), SettingsActivity.class);
startActivityForResult(intent, REQUEST_OPEN_SETTING);
}
protected void openWordsActivity() {
Intent intent = new Intent(getBaseContext(), WordListActivity.class);
startActivityForResult(intent, REQUEST_OPEN_WORDS);
}
protected void loadBook(BookMetadata filebook) {
Intent intent = new Intent(getBaseContext(), ReaderActivity.class);
intent.putExtra(ReaderActivity.FILE, filebook.getFileName());
startActivity(intent);
}
private void downloadWordNet() {
if (LongTranslationHelper.getWordNetDict().exists()) {
Toast.makeText(getApplicationContext(),
getResources().getString(R.string.word_net_downloaded),
Toast.LENGTH_SHORT).show();
return;
}
dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
Request request = new Request(Uri.parse(getResources().getString(
R.string.word_net_download_uri)));
enqueue = dm.enqueue(request);
}
private void pickFile(File aFile) {
Intent intent = new Intent(getBaseContext(), FileDialog.class);
intent.putExtra(FileDialog.START_PATH, Environment
.getExternalStorageDirectory().getAbsolutePath());
// can user select directories or not
intent.putExtra(FileDialog.CAN_SELECT_DIR, false);
intent.putExtra(FileDialog.SELECTION_MODE, SelectionMode.MODE_OPEN);
// alternatively you can set file filter
// intent.putExtra(FileDialog.FORMAT_FILTER, new String[] { "png" });
startActivityForResult(intent, REQUEST_LOAD);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK) {
if (requestCode == REQUEST_LOAD) {
System.out.println("Loading...");
}
String filePath = data.getStringExtra(FileDialog.RESULT_PATH);
BookMetadata bookMetadata = createMetadata(filePath);
adapter.insert(bookMetadata, 0);
adapter.notifyDataSetChanged();
} else if (resultCode == Activity.RESULT_CANCELED) {
Logger.getLogger(BooksActivity.class.getName()).log(Level.WARNING,
"file not selected");
}
}
private BookMetadata createMetadata(String path) {
File file = new File(path);
BookMetadata bookMetadata = new BookMetadata();
bookMetadata.setFileName(file.getAbsolutePath());
// bookMetadata.setFontSize(ReaderActivity.FONT_SIZE);
bookMetadata.setLastOpen(new Date());
bookMetadata.setName(file.getName());
booksDatabase.setBook(bookMetadata);
return bookMetadata;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.books, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.add_file:
pickFile(null);
return true;
case R.id.action_settings:
openSettingActivity();
return true;
case R.id.known_words:
openWordsActivity();
return true;
case R.id.action_download_word_net:
downloadWordNet();
return true;
case R.id.action_about:
openAboutActivity();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
|
/*
* Copyright (C) 2019 The Android Open Source Project
*
* 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 art;
public class NonStandardExit {
public static native void popFrame(Thread thr);
public static native void forceEarlyReturnVoid(Thread thr);
public static native void forceEarlyReturnFloat(Thread thr, float f);
public static native void forceEarlyReturnDouble(Thread thr, double f);
public static native void forceEarlyReturnInt(Thread thr, int f);
public static native void forceEarlyReturnLong(Thread thr, long f);
public static native void forceEarlyReturnObject(Thread thr, Object f);
public static void forceEarlyReturn(Thread thr, Object o) {
if (o instanceof Number && o.getClass().getPackage().equals(Object.class.getPackage())) {
Number n = (Number)o;
if (n instanceof Integer || n instanceof Short || n instanceof Byte) {
forceEarlyReturnInt(thr, n.intValue());
} else if (n instanceof Long) {
forceEarlyReturnLong(thr, n.longValue());
} else if (n instanceof Float) {
forceEarlyReturnFloat(thr, n.floatValue());
} else if (n instanceof Double) {
forceEarlyReturnDouble(thr, n.doubleValue());
} else {
throw new IllegalArgumentException("Unknown number subtype: " + n.getClass() + " - " + n);
}
} else if (o instanceof Character) {
forceEarlyReturnInt(thr, ((Character)o).charValue());
} else if (o instanceof Boolean) {
forceEarlyReturnInt(thr, ((Boolean)o).booleanValue() ? 1 : 0);
} else {
forceEarlyReturnObject(thr, o);
}
}
}
|
package Shapes;
public class Circle implements Shapes{
double radius;
int edges = 0;
public Circle(double radius, int edges) {
this.radius = radius;
this.edges = edges;
}
public double getArea(){
return this.radius * this.radius * Math.PI;
}
public double getCircumference(){
return this.radius * 2 * Math.PI;
}
public int getNumEdges(){
return 0;
}
}
|
package tiles.inner;
import java.util.ArrayList;
import java.util.Observable;
import java.util.Observer;
import game.Player;
public class Corner extends Tile_observable implements Observer{
protected String links;
public boolean connected=false;
private boolean hasPort=false;
private boolean hasConstruct=false;
private boolean NeighborConstruct=false;
private boolean ConnectingRoad=false;
private Port port;
private Construct construct;
private Player owner;
public Corner(String links)
{
this.links=links;
}
public boolean hasConstruct()
{
return this.hasConstruct;
}
public Player owner()
{
return owner;
}
public boolean addConstruct(Construct ct, Player p)
{
if(canHasConstruct())
{
construct=ct;
hasConstruct=true;
owner=p;
if(this.hasPort)
owner.addPort(this.getPort());
owner.addConstruct(ct);
this.setChanged();
this.notifyObservers(this);
return true;
}
else if(hasConstruct)
{
if(construct instanceof Settlement && ct instanceof City)
{
owner.removeconstruct(construct);
construct=ct;
owner.addConstruct(ct);
return true;
}
}
return false;
}
public boolean initial_addConstruct(Construct ct, Player p)
{
if(initial_canHasConstruct())
{
construct=ct;
hasConstruct=true;
owner=p;
owner.addConstruct(ct);
this.setChanged();
this.notifyObservers(this);
return true;
}
return false;
}
public boolean initial_canHasConstruct()
{
return !hasConstruct && !NeighborConstruct;
}
public boolean canHasConstruct()
{
return !hasConstruct && !NeighborConstruct && ConnectingRoad;
}
public void append_status(int str)
{
boolean contained=false;
String[] temp=this.links.split(":");
for(String s : temp)
if(s.equals(""+str))
contained=true;
if(!contained)
this.links=this.links+":"+str;
}
public void addPort(Port p)
{
port = p;
hasPort = true;
}
public String toString()
{
return ""+getPort();
}
public void update(Observable o, Object arg) {
if(arg instanceof Corner)
this.NeighborConstruct=true;
else if(arg instanceof Edge)
{
if(((Edge)arg).owner().equals(this))
this.ConnectingRoad=true;
}
}
public Port getPort() {
return port;
}
public boolean hasPort() {
return hasPort;
}
}
|
package com.consultorio.repository;
import java.util.List;
import javax.persistence.Query;
import com.consultorio.model.EspecialidadeMedica;
public class EspecialidadeMedicaRepository extends Repository<EspecialidadeMedica> {
public List<EspecialidadeMedica> findAll(){
StringBuffer jpql = new StringBuffer();
jpql.append("SELECT ");
jpql.append("e ");
jpql.append("FROM ");
jpql.append("EspecialidadeMedica e");;
Query query = getEntityManager().createQuery(jpql.toString());
return query.getResultList();
}
public List<EspecialidadeMedica> findByNome(String nome){
StringBuffer jpql = new StringBuffer();
jpql.append("SELECT ");
jpql.append(" e ");
jpql.append("FROM ");
jpql.append(" EspecialidadeMedica e ");
jpql.append("WHERE ");
jpql.append(" upper(e.nome) like upper(:nome) ");
Query query = getEntityManager().createQuery(jpql.toString());
query.setParameter("nome", "%" + nome + "%");
return query.getResultList();
}
public EspecialidadeMedica findById(String id) {
StringBuffer jpql = new StringBuffer();
jpql.append("SELECT ");
jpql.append("e ");
jpql.append("FROM ");
jpql.append("Especialiade e ");
jpql.append("WHERE ");
jpql.append("e.id = ? ");
Query query = getEntityManager().createNativeQuery(jpql.toString());
query.setParameter(1, id);
return (EspecialidadeMedica) query.getSingleResult();
}
}
|
package msip.go.kr.member.service;
import java.util.List;
import msip.go.kr.member.entity.HeadMember;
import msip.go.kr.member.entity.Member;
import msip.go.kr.member.entity.MemberVO;
/**
* 본부 회원 관련 업무 처리를 위한 Sevice Interface 정의
*
* @author 정승철
* @since 2015.07.06
* @see <pre>
* == 개정이력(Modification Information) ==
*
* 수정일 수정자 수정내용
* ---------------------------------------------------------------------------------
* 2015.07.06 정승철 최초생성
*
* </pre>
*/
public interface HeadMemberService {
/**
* 선택된 id에 따라 본부의 회원 정보를 데이터베이스에서 삭제하도록 요청
* @param HeadMember entity
* @throws Exception
*/
public void remove(HeadMember entity) throws Exception;
/**
* 새로운 본부 회원 정보를 입력받아 데이터베이스에 저장하도록 요청
* @param HeadMember entity
* @return Long
* @throws Exception
*/
public void persist(HeadMember entity) throws Exception;
/**
* 본부의 전체 회원 목록을 데이터베이스에서 읽어와 화면에 출력하도록 요청
* @return List<HeadMember> 본부 회원 목록
* @throws Exception
*/
public List<HeadMember> findAll() throws Exception;
/**
* 수정된 본부의 회원 정보를 데이터베이스에 반영하도록 요청
* @param HeadMember entity
* @throws Exception
*/
public void merge(HeadMember entity) throws Exception;
/**
* 수정된 본부의 회원 정보를 데이터베이스에 반영하도록 요청
* @param HeadMember entity
* @throws Exception
*/
public void update(HeadMember entity) throws Exception;
/**
* 선택된 id에 따라 데이터베이스에서 본부의 회원 정보를 읽어와 화면에 출력하도록 요청
* @param Long id
* @return HeadMember entity
* @throws Exception
*/
public HeadMember findById(Long id) throws Exception;
/**
* 회원정보 조회
* @param esntlId 회원 일련번호
* @return
* @throws Exception
*/
public HeadMember findByEsntlId(String esntlId) throws Exception;
/**
* 회원정보 조회
* @param userName 사용자 이름
* @param email 이메일
* @return
* @throws Excpetion
*/
public HeadMember findByNameAndEmail(String userName, String email) throws Exception;
/**
* 본부 조직 회원의 목록을 데이터베이스에서 읽어와 화면에 출력하도록 요청
* @return List<HeadMember> 본부 회원 목록
* @throws Exception
*/
public List<Member> findList(MemberVO vo) throws Exception;
/**
* 본부 조직 회원의 카운트를 데이터베이스에서 읽어와 화면에 출력하도록 요청
* @return int 본부 회원 카운트
* @throws Exception
*/
public int count(MemberVO vo) throws Exception;
/**
* 본부 회원의 목록을 이름으로 데이터베이스에서 검색하도록 요청
* @return List<InstMember> 산하기관 회원 목록
* @throws Exception
*/
public List<Member> findListByName(String userName) throws Exception;
/**
* 관리자 목록을 조회한다.
* @return
* @throws Exception
*/
public List<HeadMember> findAllAdmin() throws Exception;
/**
* 메일계정으로 본부 사용자를 검색한다.
* @param email
* @return
* @throws Exception
*/
public int countByEmail(String email) throws Exception;
/**
* 관리자 추가
* @param member
* @throws Exception
*/
public void addAdmin(HeadMember member) throws Exception;
/**
* 관리자 삭제
* @param member
* @throws Exception
*/
public void removeAdmin(HeadMember member) throws Exception;
}
|
import java.io.IOException;
import java.util.StringTokenizer;
import org.apache.hadoop.mapreduce.*;
import org.apache.hadoop.io.*;
public class WordSortMapper extends Mapper<Text, IntWritable, IntWritable, Text> {
public void map(Text key, IntWritable value, Context context) throws IOException, InterruptedException {
//System.out.println("KEY:" + key.toString());
context.write(value, key);
//context.write(key, value);
}
}
|
//public class Main {
// public static void main(String[] args) {
//
//// LoginController loginController = new LoginController();
//// loginController.run();
////
//// CreepDAOImplementation creepDAOImplementation = new CreepDAOImplementation();
//// creepDAOImplementation.getAllMentorsFromDb();
//
//// MentorController mentorController = new MentorController();
//// StudentService studentService = new StudentService();
//// boolean isRunning = true;
//// while (isRunning) {
//// StaticUi.displayAllStudents(studentService.getStudentList());
//// break;
//// }
//
//// CreepController creepController = new CreepController();
//// creepController.run();
// /* StudentController studentController = new StudentController();
// studentController.run();*/
////
//// StudentDAOImplementation studentDAOImplementation = new StudentDAOImplementation();
//// studentDAOImplementation.getItemPrice(5);
//
// }
//}
|
package com.zhaoyan.ladderball.service.event.tmpmatch.handle;
import com.zhaoyan.ladderball.dao.match.TmpMatchPartDao;
import com.zhaoyan.ladderball.domain.eventofmatch.db.TmpEventOfMatch;
import com.zhaoyan.ladderball.domain.match.db.TmpMatchPart;
public class EventXiaoJieJieShuHandler extends EventHandler {
@Override
public boolean handleAddEvent(TmpEventOfMatch event) {
logger.debug("handleEvent() event: " + event);
TmpMatchPartDao matchPartDao = getMatchPartDao();
TmpMatchPart matchPart = matchPartDao.getMatchPartByMatchIdPartNumber(event.matchId, event.partNumber);
if (matchPart != null) {
matchPart.isComplete = true;
matchPartDao.modifyMatchPart(matchPart);
return true;
} else {
return false;
}
}
@Override
public boolean handleDeleteEvent(TmpEventOfMatch event) {
// 暂时不需要处理
return true;
}
}
|
package pl.lodz.uni.math.contactapp;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import java.util.HashMap;
public class AddContactIM extends AppCompatActivity {
private EditText GG;
private EditText webEX;
private EditText skype;
private HashMap<String, String> personDataWithIM;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_contact_im);
GG = (EditText) findViewById(R.id.GG);
webEX = (EditText) findViewById(R.id.webEx);
skype = (EditText) findViewById(R.id.skype);
personDataWithIM = (HashMap<String, String>) getIntent().getSerializableExtra("personData");
}
public void addContactIMCancel(View view) {
final Context context = this;
new AlertDialog.Builder(this)
.setTitle("Cancel")
.setMessage("Are you sure you want to cancel without saving data?")
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
startActivity(new Intent(context, Contacts.class));
}
})
.setNegativeButton("No", null)
.show();
}
public void addContactIMNext(View view) {
personDataWithIM.put("GG", GG.getText().toString());
personDataWithIM.put("webEx", webEX.getText().toString());
personDataWithIM.put("skype", skype.getText().toString());
Intent theIntent = new Intent(getApplication(), AddContactImage.class);
theIntent.putExtra("personDataWithIM", personDataWithIM);
startActivity(theIntent);
}
}
|
package gil.server.http;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.HashMap;
public class HTTPConnectionReader {
private static final String CRLF = "\r\n";
public HashMap<String, String> readRequest(BufferedReader bufferedReader) throws IOException {
HashMap<String, String> request = new HashMap<>();
request.put("request-line", readRequestLine(bufferedReader));
request.put("headers", readHeaders(bufferedReader));
request.put("body", readBody(bufferedReader));
return request;
}
private String readRequestLine(BufferedReader connectionInput) throws IOException {
return connectionInput.readLine();
}
private String readHeaders(BufferedReader connectionInput) throws IOException {
StringBuilder headers = new StringBuilder();
String line;
while((line = connectionInput.readLine()) != null) {
if (line.isEmpty()) break;
headers.append(line + CRLF);
}
return headers.toString();
}
private String readBody(BufferedReader connectionInput) throws IOException {
StringBuilder body = new StringBuilder();
int nothingToRead = -1;
int integer;
while (connectionInput.ready() && (integer = connectionInput.read()) != nothingToRead) {
char character = (char) integer;
body.append(character);
}
return body.toString();
}
}
|
import java.util.*;
public class TopKFrequent {
public static List<String> topKFrequent(String[] words,int k){
// 1.统计单词出现次数,放入 Map 中
Map<String,Integer> m = new HashMap<>();
for(String word:words){
m.put(word,m.getOrDefault(word,0)+1);
}
System.out.println(m);
// 2. 使用优先级队列 建小堆 (降序)
PriorityQueue<String> p = new PriorityQueue<>(
(o1,o2)->(m.get(o1) - m.get(o2) == 0? o2.compareTo(o1):m.get(o1) - m.get(o2)));
for(String s:m.keySet()){
p.add(s);
if(p.size() > k)
p.poll();
}
System.out.println(p);
// 3. 将小堆中元素放入集合 对集合排序
List<String> list = new ArrayList<>();
while (!p.isEmpty()){
list.add(p.poll());
}
list.sort((o1,o2)->(m.get(o2) - m.get(o1) == 0? o1.compareTo(o2):m.get(o2) - m.get(o1)));
return list;
}
public static void main(String[] args) {
String[] s = new String[]{"i", "love", "leetcode", "i", "love", "coding"};
int k = 2;
List<String> l = topKFrequent(s,k);
System.out.println(l);
}
}
|
package tim.project.lab.Services;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@Service
public class ListServiceImpl implements ListServiceInterface {
ArrayList<Integer> l;
private Random r = new Random();
@Override
public List<Integer> getList(int x){
l = new ArrayList<>(x);
for(int i = 0; i<x; i++){
l.add(r.nextInt(10) + 1);
}
return l;
}
public ArrayList<Integer> getAL(){
return l;
}
}
|
package com.t2p.persistence.entity;
import com.a97lynk.login.persistence.entity.User;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@Entity(name = "news")
public class News implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
@Column(name = "type_id")
private int typeId;
@Column(name = "user_id")
private int userId;
private String url;
@ManyToOne
@JoinColumn(name = "type_id",
insertable = false,
updatable = false)
private TypeOfNews typeOfNews;
@ManyToOne
@JoinColumn(name = "user_id",
insertable = false,
updatable = false)
private User user;
private String title;
@Column(columnDefinition = "TEXT")
private String content;
private Date createDate;
private Date lastModified;
public News() {
}
public News(String title, String content, Date createDate, Date lastModified, int titleID, int userID, String url) {
this.title = title;
this.content = content;
this.createDate = createDate;
this.lastModified = lastModified;
this.typeId = titleID;
this.userId = userID;
this.url = url;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getTypeId() {
return typeId;
}
public void setTypeId(int typeId) {
this.typeId = typeId;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public TypeOfNews getTypeOfNews() {
return typeOfNews;
}
public void setTypeOfNews(TypeOfNews typeOfNews) {
this.typeOfNews = typeOfNews;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Date getLastModified() {
return lastModified;
}
public void setLastModified(Date lastModified) {
this.lastModified = lastModified;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
|
package business.authentication;
public class LinkedinAuthentication {
public Boolean authenticateForEmail(String email, String password) {
return true;
}
public Boolean authenticateForPhone(int phone, String password) {
return true;
}
}
|
package com.gxtc.huchuan.bean;
/**
* Created by Gubr on 2017/6/1.
*/
public class SeriesSelBean {
/**
* id : 209
* seriesname : 43234
*/
private String id;
private String seriesname;
public String getId() { return id;}
public void setId(String id) { this.id = id;}
public String getSeriesname() { return seriesname;}
public void setSeriesname(String seriesname) { this.seriesname = seriesname;}
}
|
package mx.redts.adendas.service;
import java.io.File;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.List;
import mx.redts.adendas.dao.IAdendaDAO;
import mx.redts.adendas.dto.FacturaDTO;
import mx.redts.adendas.exception.AdendaException;
import mx.redts.adendas.model.FeDetalle;
import mx.redts.adendas.model.FeDirFiscal;
import mx.redts.adendas.model.FeDirReceptor;
import mx.redts.adendas.model.FeEncabezado;
import mx.redts.adendas.model.FeLugarEntrega;
import mx.redts.adendas.model.FeSumario;
import mx.redts.adendas.util.Common;
/**
*
* User Service
*
* @author Andres Cabrera
* @since 25 Mar 2012
* @version 1.0.0
*
*/
public class AdendaService implements IAdendaService {
private IAdendaDAO adendaDAO;
private String repositorioAdendas;
@Override
public boolean existeFacturaByID(String id) {
// TODO Auto-generated method stub
return adendaDAO.existeFacturaByID(id);
}
public void exportaFactura(List<FeEncabezado> encabezado,
List<FeLugarEntrega> lugarEntrega, List<FeSumario> sumario,
List<FeDirReceptor> dirReceptor, List<FeDirFiscal> dirFiscal,
List<FeDetalle> detalle) throws AdendaException {
if (encabezado != null && encabezado.size() > 0) {
try {
String idOb3 = encabezado.get(0).getOb3id();
// TODO Auto-generated method stub
System.out
.println(Messages.getString("AdendaService.0") + idOb3); //$NON-NLS-1$
FeDirFiscal fdirfisc = dirFiscal.get(0);
if (Messages
.getString("AdendaService.1").equals(dirReceptor.get(0).getNombreReceptorCliente().toUpperCase())) { //$NON-NLS-1$
fdirfisc.setGln(Messages.getString("AdendaService.2")); //$NON-NLS-1$
}
dirFiscal.set(0, fdirfisc);
FacturaDTO factura = new FacturaDTO(
encabezado,
dirFiscal,
dirReceptor,
null,
(lugarEntrega != null && lugarEntrega.size() > 0 ? lugarEntrega
.get(0) : null), (sumario != null
&& sumario.size() > 0 ? sumario.get(0) : null),
detalle);
// FacturaDTO factura = getFacturaByID(idOb3);
StringBuilder contenido = new StringBuilder();
contenido
.append(factura.getEncabezado().get(0))
.append(Messages.getString("AdendaService.3")).append(factura.getDirFiscal().get(0)).append(Messages.getString("AdendaService.4")).append(factura.getExpedidoEn()).append(Messages.getString("AdendaService.5")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
.append(factura.getDirReceptor().get(0))
.append(Messages.getString("AdendaService.6")).append(factura.getLugarEntrega()).append(Messages.getString("AdendaService.7")); //$NON-NLS-1$ //$NON-NLS-2$
for (FeDetalle det : factura.getDetalle())
contenido.append(det).append(
Messages.getString("AdendaService.8")); //$NON-NLS-1$
contenido.append(factura.getSumario());
String nomOrgDir = factura
.getDirFiscal()
.get(0)
.getNombreEmisorVende()
.toUpperCase()
.replaceAll(
Messages.getString("AdendaService.9"), Messages.getString("AdendaService.10")).replaceAll(Messages.getString("AdendaService.11"), Messages.getString("AdendaService.12")).replaceAll(Messages.getString("AdendaService.13"), Messages.getString("AdendaService.14")).replaceAll(Messages.getString("AdendaService.15"), Messages.getString("AdendaService.16")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
.replaceAll(
Messages.getString("AdendaService.17"), Messages.getString("AdendaService.18")).replaceAll(Messages.getString("AdendaService.19"), Messages.getString("AdendaService.20")).replaceAll(Messages.getString("AdendaService.21"), Messages.getString("AdendaService.22")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
// -- Previo
File dirRepo = new File(getRepositorioAdendas()
+ File.separator + nomOrgDir);
if (!dirRepo.exists())
dirRepo.mkdirs();
if (dirRepo.isDirectory() && dirRepo.canWrite()) {
// -- Previo
File archivoPAC = new File(dirRepo.getAbsolutePath()
+ File.separator
+ Common.generateFileNamePAC(factura
.getDirReceptor().get(0)
.getNombreReceptorCliente()));
archivoPAC.createNewFile();
FileWriter fw = new FileWriter(archivoPAC);
fw.write(contenido.toString());
fw.close();
adendaDAO
.saveFactura(
(encabezado != null
&& encabezado.size() > 0 ? encabezado
.get(0) : null),
(dirReceptor != null
&& dirReceptor.size() > 0 ? dirReceptor
.get(0) : null),
(dirFiscal != null && dirFiscal.size() > 0 ? dirFiscal
.get(0) : null),
null,
(lugarEntrega != null
&& lugarEntrega.size() > 0 ? lugarEntrega
.get(0) : null),
(sumario != null && sumario.size() > 0 ? sumario
.get(0) : null), detalle);
} else {
throw new AdendaException(
Messages.getString("AdendaService.23") + dirRepo); //$NON-NLS-1$
}
} catch (AdendaException e) {
e.printStackTrace();
throw e;
} catch (Exception e) {
e.printStackTrace();
// TODO Auto-generated catch block
throw new AdendaException(
Messages.getString("AdendaService.24") + e.getMessage()); //$NON-NLS-1$
} finally {
}
} else {
throw new AdendaException(Messages.getString("AdendaService.25")); //$NON-NLS-1$
}
}
/**
* @return the adendaDAO
*/
public IAdendaDAO getAdendaDAO() {
return adendaDAO;
}
@Override
public FacturaDTO getFacturaByID(String id) {
// TODO Auto-generated method stub
System.out.println(Messages.getString("AdendaService.26") + id); //$NON-NLS-1$
// return null;
ArrayList<FeEncabezado> e = new ArrayList<FeEncabezado>();
ArrayList<FeDirFiscal> f = new ArrayList<FeDirFiscal>();
ArrayList<FeDirReceptor> r = new ArrayList<FeDirReceptor>();
e.add(adendaDAO.consultaEncabezadoByID(id));
f.add(adendaDAO.consultaDirFiscalByID(id));
r.add(adendaDAO.consultaDirReceptorByID(id));
return new FacturaDTO(e, f, r, adendaDAO.consultaExpedidaEnByID(id),
adendaDAO.consultaLugarEntregaByID(id),
adendaDAO.consultaSumarioByID(id),
adendaDAO.consultaDetalleByID(id));
}
/**
* @return the repositorioAdendas
*/
public String getRepositorioAdendas() {
return repositorioAdendas;
}
// @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
// public void saveFactura(FeEncabezado encabezado, FeDirReceptor receptor,
// FeDirFiscal dirFiscal, FeExpedidoEn expedido, FeLugarEntrega lugar,
// FeSumario sumario, List<FeDetalle> detalle) {
// // TODO Auto-generated method stub
// adendaDAO.saveFactura(encabezado, receptor, dirFiscal, expedido, lugar,
// sumario, detalle);
// }
/**
* @param adendaDAO
* the adendaDAO to set
*/
public void setAdendaDAO(IAdendaDAO adendaDAO) {
this.adendaDAO = adendaDAO;
}
/**
* @param repositorioAdendas
* the repositorioAdendas to set
*/
public void setRepositorioAdendas(String repositorioAdendas) {
this.repositorioAdendas = repositorioAdendas;
}
}
|
package com.ats.communication_admin.db;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import com.ats.communication_admin.bean.ComplaintData;
import com.ats.communication_admin.bean.ComplaintDetail;
import com.ats.communication_admin.bean.FeedbackData;
import com.ats.communication_admin.bean.FeedbackDetail;
import com.ats.communication_admin.bean.Message;
import com.ats.communication_admin.bean.NotificationData;
import com.ats.communication_admin.bean.SchedulerList;
import com.ats.communication_admin.bean.SuggestionData;
import com.ats.communication_admin.bean.SuggestionDetail;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
/**
* Created by MAXADMIN on 29/1/2018.
*/
public class DatabaseHandler extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1;
private static final String DATABASE_NAME = "CommunicationApp";
private static final String TABLE_MESSAGE = "message";
private static final String TABLE_NOTICE = "notice";
private static final String TABLE_NOTIFICATION = "notification";
private static final String TABLE_SUGGESTION = "suggestion";
private static final String TABLE_SUGGESTION_DETAILS = "suggestionDetails";
private static final String TABLE_COMPLAINT = "complaint";
private static final String TABLE_COMPLAINT_DETAILS = "complaintDetails";
private static final String TABLE_FEEDBACK = "feedback";
private static final String TABLE_FEEDBACK_DETAILS = "feedbackDetails";
private static final String M_ID = "mId";
private static final String M_FROM_DATE = "mFromDate";
private static final String M_TO_DATE = "mToDate";
private static final String M_IMAGE = "mImage";
private static final String M_HEADER = "mHeader";
private static final String M_DETAILS = "mDetails";
private static final String M_IS_ACTIVE = "mIsActive";
private static final String M_DEL_STATUS = "mDelStatus";
private static final String M_READ = "mRead";
private static final String N_ID = "nId";
private static final String N_DATE = "nDate";
private static final String N_TO_DATE = "nToDate";
private static final String N_OCC_NAME = "nOccName";
private static final String N_Message = "nMessage";
private static final String N_FROM_DT = "nFromDT";
private static final String N_TO_DT = "nToDT";
private static final String N_IS_ACTIVE = "nIsActive";
private static final String N_DEL_STATUS = "nDelStatus";
private static final String N_READ = "nRead";
private static final String NF_ID = "nfId";
private static final String NF_SUBJECT = "nfSubject";
private static final String NF_USER_ID = "nfUserId";
private static final String NF_USER_NAME = "nfUserName";
private static final String NF_DESC = "nfDesc";
private static final String NF_PHOTO = "nfPhoto";
private static final String NF_DATE = "nfDate";
private static final String NF_TIME = "nfTime";
private static final String NF_IS_CLOSED = "nfIsClosed";
private static final String NF_READ = "nfRead";
private static final String SG_ID = "sgId";
private static final String SG_TITLE = "sgTitle";
private static final String SG_PHOTO = "sgPhoto";
private static final String SG_DESC = "sgDesc";
private static final String SG_DATE = "sgDate";
private static final String SG_TIME = "sgTime";
private static final String SG_FR_ID = "sgFrId";
private static final String SG_FR_NAME = "sgFrName";
private static final String SG_IS_CLOSED = "sgIsClosed";
private static final String SG_READ = "sgRead";
private static final String SD_ID = "sdId";
private static final String SD_SG_ID = "sgId";
private static final String SD_MESSAGE = "sdMessage";
private static final String SD_IS_ADMIN = "sdIsAdmin";
private static final String SD_FR_ID = "sdFrId";
private static final String SD_FR_NAME = "sdFrName";
private static final String SD_PHOTO = "sdPHOTO";
private static final String SD_DATE = "sdDate";
private static final String SD_TIME = "sdTime";
private static final String SD_READ = "sdRead";
private static final String C_ID = "cId";
private static final String C_TITLE = "cTitle";
private static final String C_DESC = "cDesc";
private static final String C_PHOTO1 = "cPhoto1";
private static final String C_PHOTO2 = "cPhoto2";
private static final String C_FR_ID = "cFrId";
private static final String C_FR_NAME = "cFrName";
private static final String C_CUST_NAME = "cCustName";
private static final String C_MOBILE = "cMobile";
private static final String C_DATE = "cDate";
private static final String C_TIME = "cTime";
private static final String C_IS_CLOSED = "cIsClosed";
private static final String C_READ = "cRead";
private static final String CD_ID = "cdId";
private static final String CD_C_ID = "cdCId";
private static final String CD_MESSAGE = "cdMessage";
private static final String CD_PHOTO = "cdPhoto";
private static final String CD_DATE = "cdDate";
private static final String CD_TIME = "cdTime";
private static final String CD_IS_ADMIN = "cdIsAdmin";
private static final String CD_FR_ID = "cdFrId";
private static final String CD_FR_NAME = "cdFrName";
private static final String CD_READ = "cdRead";
private static final String F_ID = "fId";
private static final String F_TITLE = "fTitle";
private static final String F_USER_ID = "fUserId";
private static final String F_USER_NAME = "fUserName";
private static final String F_PHOTO = "fPhoto";
private static final String F_DESC = "fDesc";
private static final String F_DATE = "fDate";
private static final String F_TIME = "fTime";
private static final String F_IS_CLOSED = "fIsClosed";
private static final String F_READ = "fRead";
private static final String FD_ID = "fdId";
private static final String FD_F_ID = "fdFId";
private static final String FD_MESSAGE = "fdMessage";
private static final String FD_IS_ADMIN = "fdIsAdmin";
private static final String FD_FR_ID = "fdFrID";
private static final String FD_FR_NAME = "fdFrName";
private static final String FD_PHOTO = "fdPhoto";
private static final String FD_DATE = "fdDate";
private static final String FD_TIME = "fdTime";
private static final String FD_READ = "fdRead";
String CREATE_TABLE_MESSAGE = "CREATE TABLE "
+ TABLE_MESSAGE + "("
+ M_ID + " INTEGER PRIMARY KEY, "
+ M_FROM_DATE + " TEXT, "
+ M_TO_DATE + " TEXT, "
+ M_IMAGE + " TEXT, "
+ M_HEADER + " TEXT, "
+ M_DETAILS + " TEXT, "
+ M_IS_ACTIVE + " INTEGER, "
+ M_DEL_STATUS + " INTEGER, "
+ M_READ + " INTEGER)";
String CREATE_TABLE_NOTICE = "CREATE TABLE "
+ TABLE_NOTICE + "("
+ N_ID + " INTEGER PRIMARY KEY, "
+ N_DATE + " TEXT, "
+ N_TO_DATE + " TEXT, "
+ N_OCC_NAME + " TEXT, "
+ N_Message + " TEXT, "
+ N_FROM_DT + " INTEGER, "
+ N_TO_DT + " INTEGER, "
+ N_IS_ACTIVE + " INTEGER, "
+ N_DEL_STATUS + " INTEGER, "
+ N_READ + " INTEGER)";
String CREATE_TABLE_NOTIFICATION = "CREATE TABLE "
+ TABLE_NOTIFICATION + "("
+ NF_ID + " INTEGER PRIMARY KEY, "
+ NF_SUBJECT + " TEXT, "
+ NF_USER_ID + " INTEGER, "
+ NF_USER_NAME + " TEXT, "
+ NF_DESC + " TEXT, "
+ NF_PHOTO + " TEXT, "
+ NF_DATE + " TEXT, "
+ NF_TIME + " TEXT, "
+ NF_IS_CLOSED + " INTEGER, "
+ NF_READ + " INTEGER)";
String CREATE_TABLE_SUGGESTION = "CREATE TABLE "
+ TABLE_SUGGESTION + "("
+ SG_ID + " INTEGER PRIMARY KEY, "
+ SG_TITLE + " TEXT, "
+ SG_PHOTO + " TEXT, "
+ SG_DESC + " TEXT, "
+ SG_DATE + " TEXT, "
+ SG_TIME + " TEXT, "
+ SG_FR_ID + " INTEGER, "
+ SG_FR_NAME + " TEXT, "
+ SG_IS_CLOSED + " INTEGER, "
+ SG_READ + " INTEGER)";
String CREATE_TABLE_SUGGESTION_DETAILS = "CREATE TABLE "
+ TABLE_SUGGESTION_DETAILS + "("
+ SD_ID + " INTEGER PRIMARY KEY, "
+ SD_SG_ID + " INTEGER, "
+ SD_MESSAGE + " TEXT, "
+ SD_IS_ADMIN + " TEXT, "
+ SD_FR_ID + " INTEGER, "
+ SD_FR_NAME + " TEXT, "
+ SD_PHOTO + " TEXT, "
+ SD_DATE + " TEXT, "
+ SD_TIME + " TEXT, "
+ SD_READ + " INTEGER)";
String CREATE_TABLE_COMPLAINT = "CREATE TABLE "
+ TABLE_COMPLAINT + " ("
+ C_ID + " INTEGER PRIMARY KEY, "
+ C_TITLE + " TEXT, "
+ C_DESC + " TEXT, "
+ C_PHOTO1 + " TEXT, "
+ C_PHOTO2 + " TEXT, "
+ C_FR_ID + " INTEGER, "
+ C_FR_NAME + " TEXT, "
+ C_CUST_NAME + " TEXT, "
+ C_MOBILE + " TEXT, "
+ C_DATE + " TEXT, "
+ C_TIME + " TEXT, "
+ C_IS_CLOSED + " INTEGER, "
+ C_READ + " INTEGER)";
String CREATE_TABLE_COMPLAINT_DETAIL = "CREATE TABLE "
+ TABLE_COMPLAINT_DETAILS + " ("
+ CD_ID + " INTEGER PRIMARY KEY, "
+ CD_C_ID + " INTEGER, "
+ CD_MESSAGE + " TEXT, "
+ CD_PHOTO + " TEXT, "
+ CD_DATE + " TEXT, "
+ CD_TIME + " TEXT, "
+ CD_IS_ADMIN + " INTEGER, "
+ CD_FR_ID + " INTEGER, "
+ CD_FR_NAME + " TEXT, "
+ CD_READ + " INTEGER)";
String CREATE_TABLE_FEEDBACK = "CREATE TABLE "
+ TABLE_FEEDBACK + " ("
+ F_ID + " INTEGER PRIMARY KEY, "
+ F_TITLE + " TEXT, "
+ F_USER_ID + " INTEGER, "
+ F_USER_NAME + " TEXT, "
+ F_PHOTO + " TEXT, "
+ F_DESC + " TEXT, "
+ F_DATE + " TEXT, "
+ F_TIME + " TEXT, "
+ F_IS_CLOSED + " INTEGER, "
+ F_READ + " INTEGER)";
String CREATE_TABLE_FEEDBACK_DETAIL = "CREATE TABLE "
+ TABLE_FEEDBACK_DETAILS + " ("
+ FD_ID + " INTEGER PRIMARY KEY, "
+ FD_F_ID + " INTEGER, "
+ FD_MESSAGE + " TEXT, "
+ FD_IS_ADMIN + " INTEGER, "
+ FD_FR_ID + " INTEGER, "
+ FD_FR_NAME + " TEXT, "
+ FD_PHOTO + " TEXT, "
+ FD_DATE + " TEXT, "
+ FD_TIME + " TEXT, "
+ FD_READ + " INTEGER)";
public DatabaseHandler(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
//Log.e("NOTICE TABLE : ", "----" + CREATE_TABLE_NOTICE);
db.execSQL(CREATE_TABLE_MESSAGE);
db.execSQL(CREATE_TABLE_NOTICE);
db.execSQL(CREATE_TABLE_NOTIFICATION);
db.execSQL(CREATE_TABLE_SUGGESTION);
db.execSQL(CREATE_TABLE_SUGGESTION_DETAILS);
db.execSQL(CREATE_TABLE_COMPLAINT);
db.execSQL(CREATE_TABLE_COMPLAINT_DETAIL);
db.execSQL(CREATE_TABLE_FEEDBACK);
db.execSQL(CREATE_TABLE_FEEDBACK_DETAIL);
}
@Override
public void onUpgrade(SQLiteDatabase db, int i, int i1) {
db.execSQL("DROP TABLE IF EXISTS " + TABLE_MESSAGE);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_NOTICE);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_NOTIFICATION);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_SUGGESTION);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_SUGGESTION_DETAILS);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_COMPLAINT);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_COMPLAINT_DETAILS);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_FEEDBACK);
db.execSQL("DROP TABLE IF EXISTS " + TABLE_FEEDBACK_DETAILS);
onCreate(db);
}
public void removeAll() {
SQLiteDatabase db = this.getWritableDatabase();
db.delete(TABLE_MESSAGE, null, null);
db.delete(TABLE_NOTICE, null, null);
db.delete(TABLE_NOTIFICATION, null, null);
db.delete(TABLE_SUGGESTION, null, null);
db.delete(TABLE_SUGGESTION_DETAILS, null, null);
db.delete(TABLE_COMPLAINT, null, null);
db.delete(TABLE_COMPLAINT_DETAILS, null, null);
db.delete(TABLE_FEEDBACK, null, null);
db.delete(TABLE_FEEDBACK_DETAILS, null, null);
db.close();
}
public void removeAllNotices() {
SQLiteDatabase db = this.getWritableDatabase();
db.delete(TABLE_NOTICE, null, null);
db.close();
}
public void removeAllMessages() {
SQLiteDatabase db = this.getWritableDatabase();
db.delete(TABLE_MESSAGE, null, null);
db.close();
}
//----------------------------------MESSAGE------------------------------------
public void addMessage(Message message) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(M_ID, message.getMsgId());
values.put(M_FROM_DATE, message.getMsgFrdt());
values.put(M_TO_DATE, message.getMsgTodt());
values.put(M_IMAGE, message.getMsgImage());
values.put(M_HEADER, message.getMsgHeader());
values.put(M_DETAILS, message.getMsgDetails());
values.put(M_IS_ACTIVE, message.getIsActive());
values.put(M_DEL_STATUS, message.getDelStatus());
values.put(M_READ, 0);
db.insert(TABLE_MESSAGE, null, values);
db.close();
}
public ArrayList<Message> getAllMessages() {
ArrayList<Message> messageList = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
String todaysDate = sdf.format(date.getTime());
//Log.e("TODAYS DATE : ", "-------------" + todaysDate);
//String query = "SELECT * FROM " + TABLE_MESSAGE + " WHERE " + M_TO_DATE + "<'" + todaysDate + "'";
String query = "SELECT * FROM " + TABLE_MESSAGE + " ORDER BY " + M_ID + " DESC";
//Log.e("QUERY : ", "-------------" + query);
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if (cursor.moveToFirst()) {
do {
Message message = new Message();
message.setMsgId(cursor.getInt(0));
message.setMsgFrdt(cursor.getString(1));
message.setMsgTodt(cursor.getString(2));
message.setMsgImage(cursor.getString(3));
message.setMsgHeader(cursor.getString(4));
message.setMsgDetails(cursor.getString(5));
message.setIsActive(cursor.getInt(6));
message.setDelStatus(cursor.getInt(7));
message.setRead(cursor.getInt(8));
messageList.add(message);
} while (cursor.moveToNext());
}
return messageList;
}
public Message getMessage(int id) {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(TABLE_MESSAGE, new String[]{M_ID,
M_FROM_DATE, M_TO_DATE, M_IMAGE, M_HEADER, M_DETAILS, M_IS_ACTIVE, M_DEL_STATUS, M_READ}, M_ID + "=?",
new String[]{String.valueOf(id)}, null, null, null, null);
Message msg = new Message();
if (cursor != null && cursor.moveToFirst()) {
msg = new Message(Integer.parseInt(cursor.getString(0)));
cursor.close();
}
return msg;
}
public int updateMessageById(Message message) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(M_ID, message.getMsgId());
values.put(M_FROM_DATE, message.getMsgFrdt());
values.put(M_TO_DATE, message.getMsgTodt());
values.put(M_IMAGE, message.getMsgImage());
values.put(M_HEADER, message.getMsgHeader());
values.put(M_DETAILS, message.getMsgDetails());
values.put(M_IS_ACTIVE, message.getIsActive());
values.put(M_DEL_STATUS, message.getDelStatus());
values.put(M_READ, 0);
// updating row
return db.update(TABLE_MESSAGE, values, "mId=" + message.getMsgId(), null);
}
public int updateMessageRead() {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(M_READ, 1);
// updating row
return db.update(TABLE_MESSAGE, values, "mRead=0", null);
}
public int getMessageUnreadCount() {
int count = 0;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT COUNT(*) FROM " + TABLE_MESSAGE + " WHERE " + M_READ + "=0", null);
if (cursor != null && cursor.moveToFirst()) {
count = cursor.getInt(0);
cursor.close();
}
return count;
}
//---------------------------NOTICE---------------------------------------
public void addNotices(SchedulerList notice) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(N_ID, notice.getSchId());
values.put(N_DATE, notice.getSchDate());
values.put(N_TO_DATE, notice.getSchTodate());
values.put(N_OCC_NAME, notice.getSchOccasionname());
values.put(N_Message, notice.getSchMessage());
values.put(N_FROM_DT, notice.getSchFrdttime());
values.put(N_TO_DT, notice.getSchTodttime());
values.put(N_IS_ACTIVE, notice.getIsActive());
values.put(N_DEL_STATUS, notice.getDelStatus());
values.put(N_READ, 0);
db.insert(TABLE_NOTICE, null, values);
db.close();
}
public ArrayList<SchedulerList> getAllSqliteNotices() {
ArrayList<SchedulerList> noticeList = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
String todaysDate = sdf.format(date.getTime());
//Log.e("TODAYS DATE : ", "-------------" + todaysDate);
String query = "SELECT * FROM " + TABLE_NOTICE + " ORDER BY " + N_ID + " DESC";
//String query = "SELECT * FROM " + TABLE_NOTICE + " WHERE " + N_TO_DATE + "<" + todaysDate;
//Log.e("QUERY : ", "------------------------------------" + query);
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if (cursor.moveToFirst()) {
do {
SchedulerList notice = new SchedulerList();
notice.setSchId(cursor.getInt(0));
notice.setSchDate(cursor.getString(1));
notice.setSchTodate(cursor.getString(2));
notice.setSchOccasionname(cursor.getString(3));
notice.setSchMessage(cursor.getString(4));
notice.setSchFrdttime(cursor.getDouble(5));
notice.setSchTodttime(cursor.getDouble(6));
notice.setIsActive(cursor.getInt(7));
notice.setDelStatus(cursor.getInt(8));
notice.setRead(cursor.getInt(9));
noticeList.add(notice);
} while (cursor.moveToNext());
}
//Log.e("NOTICE", "********************************" + noticeList);
return noticeList;
}
public SchedulerList getNotice(int id) {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(TABLE_NOTICE, new String[]{N_ID}, N_ID + "=?",
new String[]{String.valueOf(id)}, null, null, null, null);
SchedulerList notice = new SchedulerList();
if (cursor != null && cursor.moveToFirst()) {
notice = new SchedulerList(Integer.parseInt(cursor.getString(0)));
cursor.close();
}
return notice;
}
public int updateNoticeById(SchedulerList notice) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(N_ID, notice.getSchId());
values.put(N_DATE, notice.getSchDate());
values.put(N_TO_DATE, notice.getSchTodate());
values.put(N_OCC_NAME, notice.getSchOccasionname());
values.put(N_Message, notice.getSchMessage());
values.put(N_FROM_DT, notice.getSchFrdttime());
values.put(N_TO_DT, notice.getSchTodttime());
values.put(N_IS_ACTIVE, notice.getIsActive());
values.put(N_DEL_STATUS, notice.getDelStatus());
values.put(N_READ, 0);
// updating row
return db.update(TABLE_NOTICE, values, "nId=" + notice.getSchId(), null);
}
public int updateNoticeRead() {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(N_READ, 1);
// updating row
return db.update(TABLE_NOTICE, values, "nRead=0", null);
}
public int getNoticeUnreadCount() {
int count = 0;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT COUNT(*) FROM " + TABLE_NOTICE + " WHERE " + N_READ + "=0", null);
if (cursor != null && cursor.moveToFirst()) {
count = cursor.getInt(0);
cursor.close();
}
return count;
}
//---------------------------NOTIFICATION---------------------------------------
public void addNotifications(NotificationData data) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(NF_ID, data.getNotificationId());
values.put(NF_SUBJECT, data.getSubject());
values.put(NF_USER_ID, data.getUserId());
values.put(NF_USER_NAME, data.getUserName());
values.put(NF_DESC, data.getDescription());
values.put(NF_PHOTO, data.getPhoto());
values.put(NF_DATE, data.getDate());
values.put(NF_TIME, data.getTime());
values.put(NF_IS_CLOSED, data.getIsClosed());
values.put(NF_READ, 0);
db.insert(TABLE_NOTIFICATION, null, values);
db.close();
}
public ArrayList<NotificationData> getAllSqliteNotifications() {
ArrayList<NotificationData> notificationList = new ArrayList<>();
String query = "SELECT * FROM " + TABLE_NOTIFICATION + " ORDER BY " + NF_ID + " DESC";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if (cursor.moveToFirst()) {
do {
NotificationData notice = new NotificationData();
notice.setNotificationId(cursor.getInt(0));
notice.setSubject(cursor.getString(1));
notice.setUserId(cursor.getInt(2));
notice.setUserName(cursor.getString(3));
notice.setDescription(cursor.getString(4));
notice.setPhoto(cursor.getString(5));
notice.setDate(cursor.getString(6));
notice.setTime(cursor.getString(7));
notice.setIsClosed(cursor.getInt(8));
notice.setRead(cursor.getInt(9));
notificationList.add(notice);
} while (cursor.moveToNext());
}
return notificationList;
}
public NotificationData getNotification(int id) {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(TABLE_NOTIFICATION, new String[]{NF_ID}, NF_ID + "=?",
new String[]{String.valueOf(id)}, null, null, null, null);
NotificationData notification = new NotificationData();
if (cursor != null && cursor.moveToFirst()) {
notification = new NotificationData(Integer.parseInt(cursor.getString(0)));
cursor.close();
}
return notification;
}
public int updateNotificationRead() {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(NF_READ, 1);
// updating row
return db.update(TABLE_NOTIFICATION, values, "nfRead=0", null);
}
public int getNotificationUnreadCount() {
int count = 0;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT COUNT(*) FROM " + TABLE_NOTIFICATION + " WHERE " + NF_READ + "=0", null);
if (cursor != null && cursor.moveToFirst()) {
count = cursor.getInt(0);
cursor.close();
}
return count;
}
public int getNotificationLastId() {
int lastId = 0;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT MAX(" + NF_ID + ") FROM " + TABLE_NOTIFICATION, null);
if (cursor != null && cursor.moveToFirst()) {
lastId = cursor.getInt(0);
cursor.close();
}
return lastId;
}
public void deleteAllNotifications() {
SQLiteDatabase db = this.getWritableDatabase();
db.execSQL("delete from " + TABLE_NOTIFICATION);
//Log.e("DELETED : ", "-----------------------COMPLAINT");
}
//----------------------------------SUGGESTION------------------------------------
public void addSuggestion(SuggestionData suggestion) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(SG_ID, suggestion.getSuggestionId());
values.put(SG_TITLE, suggestion.getTitle());
values.put(SG_PHOTO, suggestion.getPhoto());
values.put(SG_DESC, suggestion.getDescription());
values.put(SG_DATE, suggestion.getDate());
values.put(SG_TIME, suggestion.getTime());
values.put(SG_FR_ID, suggestion.getFrId());
values.put(SG_FR_NAME, suggestion.getFrName());
values.put(SG_IS_CLOSED, suggestion.getIsClosed());
values.put(SG_READ, 0);
db.insert(TABLE_SUGGESTION, null, values);
db.close();
}
public ArrayList<SuggestionData> getAllSQLiteSuggestions() {
ArrayList<SuggestionData> suggestionList = new ArrayList<>();
String query = "SELECT * FROM " + TABLE_SUGGESTION + " ORDER BY " + SG_ID + " DESC";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if (cursor.moveToFirst()) {
do {
SuggestionData suggestion = new SuggestionData();
suggestion.setSuggestionId(cursor.getInt(0));
suggestion.setTitle(cursor.getString(1));
suggestion.setPhoto(cursor.getString(2));
suggestion.setDescription(cursor.getString(3));
suggestion.setDate(cursor.getString(4));
suggestion.setTime(cursor.getString(5));
suggestion.setFrId(cursor.getInt(6));
suggestion.setFrName(cursor.getString(7));
suggestion.setIsClosed(cursor.getInt(8));
suggestion.setRead(cursor.getInt(9));
suggestionList.add(suggestion);
} while (cursor.moveToNext());
}
return suggestionList;
}
public SuggestionData getSuggestion(int id) {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(TABLE_SUGGESTION, new String[]{SG_ID, SG_TITLE, SG_PHOTO, SG_DESC, SG_DATE, SG_TIME, SG_FR_ID, SG_FR_NAME, SG_IS_CLOSED, SG_READ}, SG_ID + "=?",
new String[]{String.valueOf(id)}, null, null, null, null);
SuggestionData sugg = new SuggestionData();
if (cursor != null && cursor.moveToFirst()) {
sugg = new SuggestionData(cursor.getInt(0), cursor.getString(1), cursor.getString(2), cursor.getString(3), cursor.getString(4), cursor.getString(5), cursor.getInt(6), cursor.getString(7), cursor.getInt(8), cursor.getInt(9));
cursor.close();
}
return sugg;
}
public int updateSuggestion(SuggestionData suggestionData) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(SG_TITLE, suggestionData.getTitle());
values.put(SG_PHOTO, suggestionData.getPhoto());
values.put(SG_DESC, suggestionData.getDescription());
values.put(SG_DATE, suggestionData.getDate());
values.put(SG_TIME, suggestionData.getTime());
values.put(SG_FR_ID, suggestionData.getFrId());
values.put(SG_FR_NAME, suggestionData.getFrName());
values.put(SG_IS_CLOSED, suggestionData.getIsClosed());
values.put(SG_READ, suggestionData.getRead());
// updating row
return db.update(TABLE_SUGGESTION, values, SG_ID + " = ?",
new String[]{String.valueOf(suggestionData.getSuggestionId())});
}
public int updateSuggestionRead() {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(SG_READ, 1);
// updating row
return db.update(TABLE_SUGGESTION, values, "sgRead=0", null);
}
public int getSuggestionUnreadCount() {
int count = 0;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT COUNT(*) FROM " + TABLE_SUGGESTION + " WHERE " + SG_READ + "=0", null);
if (cursor != null && cursor.moveToFirst()) {
count = cursor.getInt(0);
cursor.close();
}
return count;
}
public int getSuggestionLastId() {
int lastId = 0;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT MAX(" + SG_ID + ") FROM " + TABLE_SUGGESTION, null);
if (cursor != null && cursor.moveToFirst()) {
lastId = cursor.getInt(0);
cursor.close();
}
return lastId;
}
public void deleteAllSuggestion() {
SQLiteDatabase db = this.getWritableDatabase();
db.execSQL("delete from " + TABLE_SUGGESTION);
//Log.e("DELETED : ", "-----------------------SUGGESTION");
}
//----------------------------------SUGGESTION DETAILS------------------------------------
public void addSuggestionDetails(SuggestionDetail suggestion) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(SD_ID, suggestion.getSuggestionDetailId());
values.put(SD_SG_ID, suggestion.getSuggestionId());
values.put(SD_MESSAGE, suggestion.getMessage());
values.put(SD_IS_ADMIN, suggestion.getIsAdmin());
values.put(SD_FR_ID, suggestion.getFrId());
values.put(SD_FR_NAME, suggestion.getFrName());
values.put(SD_PHOTO, suggestion.getPhoto());
values.put(SD_DATE, suggestion.getDate());
values.put(SD_TIME, suggestion.getTime());
values.put(SD_READ, 0);
db.insert(TABLE_SUGGESTION_DETAILS, null, values);
db.close();
}
public ArrayList<SuggestionDetail> getAllSQLiteSuggestionDetails(int sgId) {
ArrayList<SuggestionDetail> suggestionDetailList = new ArrayList<>();
String query = "SELECT * FROM " + TABLE_SUGGESTION_DETAILS + " WHERE " + SD_SG_ID + "=" + sgId;
//Log.e("QUERY : ", "-------" + query);
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if (cursor.moveToFirst()) {
do {
SuggestionDetail suggestion = new SuggestionDetail();
suggestion.setSuggestionDetailId(cursor.getInt(0));
suggestion.setSuggestionId(cursor.getInt(1));
suggestion.setMessage(cursor.getString(2));
suggestion.setIsAdmin(cursor.getInt(3));
suggestion.setFrId(cursor.getInt(4));
suggestion.setFrName(cursor.getString(5));
suggestion.setPhoto(cursor.getString(6));
suggestion.setDate(cursor.getString(7));
suggestion.setTime(cursor.getString(8));
suggestion.setRead(cursor.getInt(9));
suggestionDetailList.add(suggestion);
} while (cursor.moveToNext());
}
return suggestionDetailList;
}
public SuggestionDetail getSuggestionDetail(int id) {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(TABLE_SUGGESTION_DETAILS, new String[]{SD_ID}, SD_ID + "=?",
new String[]{String.valueOf(id)}, null, null, null, null);
SuggestionDetail suggDet = new SuggestionDetail();
if (cursor != null && cursor.moveToFirst()) {
suggDet = new SuggestionDetail(Integer.parseInt(cursor.getString(0)));
cursor.close();
}
return suggDet;
}
public int updateSuggestionDetailRead() {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(SD_READ, 1);
// updating row
return db.update(TABLE_SUGGESTION_DETAILS, values, "sdRead=0", null);
}
public int updateSuggestionDetailRead(int suggestionId) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(SD_READ, 1);
// updating row
return db.update(TABLE_SUGGESTION_DETAILS, values, "sdRead=0 AND " + SD_SG_ID + "=" + suggestionId, null);
}
public int getSuggestionDetailUnreadCount() {
int count = 0;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT COUNT(*) FROM " + TABLE_SUGGESTION_DETAILS + " as sd,"+ TABLE_SUGGESTION + " as sh WHERE sd." + SD_READ + "=0 AND sd."+SD_SG_ID+"=sh."+SG_ID, null);
if (cursor != null && cursor.moveToFirst()) {
count = cursor.getInt(0);
cursor.close();
}
return count;
}
public ArrayList<SuggestionDetail> getUnreadSuggestionDetails() {
ArrayList<SuggestionDetail> suggestionDetailList = new ArrayList<>();
String query = "SELECT * FROM " + TABLE_SUGGESTION_DETAILS + " WHERE " + SD_READ + "=0";
//Log.e("QUERY : ", "-------" + query);
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if (cursor.moveToFirst()) {
do {
SuggestionDetail suggestion = new SuggestionDetail();
suggestion.setSuggestionDetailId(cursor.getInt(0));
suggestion.setSuggestionId(cursor.getInt(1));
suggestion.setMessage(cursor.getString(2));
suggestion.setIsAdmin(cursor.getInt(3));
suggestion.setFrId(cursor.getInt(4));
suggestion.setFrName(cursor.getString(5));
suggestion.setPhoto(cursor.getString(6));
suggestion.setDate(cursor.getString(7));
suggestion.setTime(cursor.getString(8));
suggestion.setRead(cursor.getInt(9));
suggestionDetailList.add(suggestion);
} while (cursor.moveToNext());
}
return suggestionDetailList;
}
public int getSuggestionDetailUnreadCount(int suggestionId) {
int count = 0;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT COUNT(*) FROM " + TABLE_SUGGESTION_DETAILS + " WHERE " + SD_READ + "=0 AND " + SD_SG_ID + "=" + suggestionId, null);
if (cursor != null && cursor.moveToFirst()) {
count = cursor.getInt(0);
cursor.close();
}
return count;
}
public int getSuggestionDetailLastId() {
int lastId = 0;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT MAX(" + SD_ID + ") FROM " + TABLE_SUGGESTION_DETAILS, null);
if (cursor != null && cursor.moveToFirst()) {
lastId = cursor.getInt(0);
cursor.close();
}
return lastId;
}
//----------------------------------COMPLAINT------------------------------------
public void addComplaint(ComplaintData complaint) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(C_ID, complaint.getComplaintId());
values.put(C_TITLE, complaint.getTitle());
values.put(C_DESC, complaint.getDescription());
values.put(C_PHOTO1, complaint.getPhoto1());
values.put(C_PHOTO2, complaint.getPhoto2());
values.put(C_FR_ID, complaint.getFrId());
values.put(C_FR_NAME, complaint.getFrName());
values.put(C_CUST_NAME, complaint.getCustomerName());
values.put(C_MOBILE, complaint.getMobileNumber());
values.put(C_DATE, complaint.getDate());
values.put(C_TIME, complaint.getTime());
values.put(C_IS_CLOSED, complaint.getIsClosed());
values.put(C_READ, 0);
db.insert(TABLE_COMPLAINT, null, values);
db.close();
}
public ArrayList<ComplaintData> getAllSQLiteComplaints() {
ArrayList<ComplaintData> complaintList = new ArrayList<>();
String query = "SELECT * FROM " + TABLE_COMPLAINT + " ORDER BY " + C_ID + " DESC";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if (cursor.moveToFirst()) {
do {
ComplaintData complaint = new ComplaintData();
complaint.setComplaintId(cursor.getInt(0));
complaint.setTitle(cursor.getString(1));
complaint.setDescription(cursor.getString(2));
complaint.setPhoto1(cursor.getString(3));
complaint.setPhoto2(cursor.getString(4));
complaint.setFrId(cursor.getInt(5));
complaint.setFrName(cursor.getString(6));
complaint.setCustomerName(cursor.getString(7));
complaint.setMobileNumber(cursor.getString(8));
complaint.setDate(cursor.getString(9));
complaint.setTime(cursor.getString(10));
complaint.setIsClosed(cursor.getInt(11));
complaint.setRead(cursor.getInt(12));
complaintList.add(complaint);
} while (cursor.moveToNext());
}
return complaintList;
}
public int updateComplaintRead() {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(C_READ, 1);
// updating row
return db.update(TABLE_COMPLAINT, values, "cRead=0", null);
}
public int getComplaintUnreadCount() {
int count = 0;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT COUNT(*) FROM " + TABLE_COMPLAINT + " WHERE " + C_READ + "=0", null);
if (cursor != null && cursor.moveToFirst()) {
count = cursor.getInt(0);
cursor.close();
}
return count;
}
public int getComplaintLastId() {
int lastId = 0;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT MAX(" + C_ID + ") FROM " + TABLE_COMPLAINT, null);
if (cursor != null && cursor.moveToFirst()) {
lastId = cursor.getInt(0);
cursor.close();
}
return lastId;
}
public ComplaintData getComplaint(int id) {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(TABLE_COMPLAINT, new String[]{C_ID, C_TITLE, C_DESC, C_PHOTO1, C_PHOTO2, C_FR_ID, C_FR_NAME, C_CUST_NAME, C_MOBILE, C_DATE, C_TIME, C_IS_CLOSED, C_READ}, C_ID + "=?",
new String[]{String.valueOf(id)}, null, null, null, null);
ComplaintData complaint = new ComplaintData();
if (cursor != null && cursor.moveToFirst()) {
complaint = new ComplaintData(cursor.getInt(0), cursor.getString(1), cursor.getString(2), cursor.getString(3), cursor.getString(4), cursor.getInt(5), cursor.getString(6), cursor.getString(7), cursor.getString(8), cursor.getString(9), cursor.getString(10), cursor.getInt(11), cursor.getInt(12));
cursor.close();
}
return complaint;
}
public void deleteAllComplaint() {
SQLiteDatabase db = this.getWritableDatabase();
db.execSQL("delete from " + TABLE_COMPLAINT);
//Log.e("DELETED : ", "-----------------------COMPLAINT");
}
//----------------------------------COMPLAINT DETAILS------------------------------------
public void addComplaintDetails(ComplaintDetail complaint) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(CD_ID, complaint.getCompDetailId());
values.put(CD_C_ID, complaint.getComplaintId());
values.put(CD_MESSAGE, complaint.getMessage());
values.put(CD_PHOTO, complaint.getPhoto());
values.put(CD_DATE, complaint.getDate());
values.put(CD_TIME, complaint.getTime());
values.put(CD_IS_ADMIN, complaint.getIsAdmin());
values.put(CD_FR_ID, complaint.getFrId());
values.put(CD_FR_NAME, complaint.getFrName());
values.put(CD_READ, 0);
Log.e("Complaint DETAIL INSERT", " : " + values);
db.insert(TABLE_COMPLAINT_DETAILS, null, values);
db.close();
}
public ArrayList<ComplaintDetail> getAllSQLiteComplaintDetails(int cId) {
ArrayList<ComplaintDetail> complaintDetailList = new ArrayList<>();
String query = "SELECT * FROM " + TABLE_COMPLAINT_DETAILS + " WHERE " + CD_C_ID + "=" + cId;
//Log.e("QUERY : ", "-------" + query);
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if (cursor.moveToFirst()) {
do {
ComplaintDetail complaint = new ComplaintDetail();
complaint.setCompDetailId(cursor.getInt(0));
complaint.setComplaintId(cursor.getInt(1));
complaint.setMessage(cursor.getString(2));
complaint.setPhoto(cursor.getString(3));
complaint.setDate(cursor.getString(4));
complaint.setTime(cursor.getString(5));
complaint.setIsAdmin(cursor.getInt(6));
complaint.setFrId(cursor.getInt(7));
complaint.setFrName(cursor.getString(8));
complaint.setRead(cursor.getInt(9));
complaintDetailList.add(complaint);
} while (cursor.moveToNext());
}
return complaintDetailList;
}
public int updateComplaintDetailRead() {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(CD_READ, 1);
// updating row
return db.update(TABLE_COMPLAINT_DETAILS, values, "cdRead=0", null);
}
public int updateComplaintDetailRead(int complaintId) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(CD_READ, 1);
// updating row
return db.update(TABLE_COMPLAINT_DETAILS, values, "cdRead=0 AND " + CD_C_ID + "=" + complaintId, null);
}
public int getComplaintDetailUnreadCount() {
int count = 0;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT COUNT(*) FROM " + TABLE_COMPLAINT_DETAILS + " as cd,"+TABLE_COMPLAINT+" as ch WHERE cd." + CD_READ + "=0 AND cd."+CD_C_ID+"=ch."+C_ID, null);
if (cursor != null && cursor.moveToFirst()) {
count = cursor.getInt(0);
cursor.close();
}
return count;
}
public int getComplaintDetailUnreadCount(int complaintId) {
int count = 0;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT COUNT(*) FROM " + TABLE_COMPLAINT_DETAILS + " WHERE " + CD_READ + "=0 AND " + CD_C_ID + "=" + complaintId, null);
if (cursor != null && cursor.moveToFirst()) {
count = cursor.getInt(0);
cursor.close();
}
return count;
}
public int getComplaintDetailLastId() {
int lastId = 0;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT MAX(" + CD_ID + ") FROM " + TABLE_COMPLAINT_DETAILS, null);
if (cursor != null && cursor.moveToFirst()) {
lastId = cursor.getInt(0);
cursor.close();
}
return lastId;
}
//----------------------------------FEEDBACK------------------------------------
public void addFeedBack(FeedbackData feedback) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(F_ID, feedback.getFeedbackId());
values.put(F_TITLE, feedback.getTitle());
values.put(F_USER_ID, feedback.getUserId());
values.put(F_USER_NAME, feedback.getUserName());
values.put(F_PHOTO, feedback.getPhoto());
values.put(F_DESC, feedback.getDescription());
values.put(F_DATE, feedback.getDate());
values.put(F_TIME, feedback.getTime());
values.put(F_IS_CLOSED, feedback.getIsClosed());
values.put(F_READ, 0);
db.insert(TABLE_FEEDBACK, null, values);
db.close();
}
public ArrayList<FeedbackData> getAllSQLiteFeedback() {
ArrayList<FeedbackData> feedbackList = new ArrayList<>();
String query = "SELECT * FROM " + TABLE_FEEDBACK + " ORDER BY " + F_ID + " DESC";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if (cursor.moveToFirst()) {
do {
FeedbackData feedback = new FeedbackData();
feedback.setFeedbackId(cursor.getInt(0));
feedback.setTitle(cursor.getString(1));
feedback.setUserId(cursor.getInt(2));
feedback.setUserName(cursor.getString(3));
feedback.setPhoto(cursor.getString(4));
feedback.setDescription(cursor.getString(5));
feedback.setDate(cursor.getString(6));
feedback.setTime(cursor.getString(7));
feedback.setIsClosed(cursor.getInt(8));
feedback.setRead(cursor.getInt(9));
feedbackList.add(feedback);
} while (cursor.moveToNext());
}
return feedbackList;
}
public int updateFeedbackRead() {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(F_READ, 1);
// updating row
return db.update(TABLE_FEEDBACK, values, "fRead=0", null);
}
public int getFeedbackUnreadCount() {
int count = 0;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT COUNT(*) FROM " + TABLE_FEEDBACK + " WHERE " + F_READ + "=0", null);
if (cursor != null && cursor.moveToFirst()) {
count = cursor.getInt(0);
cursor.close();
}
return count;
}
public int getFeedbackLastId() {
int lastId = 0;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT MAX(" + F_ID + ") FROM " + TABLE_FEEDBACK, null);
if (cursor != null && cursor.moveToFirst()) {
lastId = cursor.getInt(0);
cursor.close();
}
return lastId;
}
public FeedbackData getFeedback(int id) {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(TABLE_FEEDBACK, new String[]{F_ID, F_TITLE, F_USER_ID, F_USER_NAME, F_PHOTO, F_DESC, F_DATE, F_TIME, F_IS_CLOSED, F_READ}, F_ID + "=?",
new String[]{String.valueOf(id)}, null, null, null, null);
FeedbackData feedback = new FeedbackData();
if (cursor != null && cursor.moveToFirst()) {
feedback = new FeedbackData(Integer.parseInt(cursor.getString(0)), cursor.getString(1), cursor.getInt(2), cursor.getString(3), cursor.getString(4), cursor.getString(5), cursor.getString(6), cursor.getString(7), cursor.getInt(8), cursor.getInt(9));
cursor.close();
}
return feedback;
}
public void deleteAllFeedback() {
SQLiteDatabase db = this.getWritableDatabase();
db.execSQL("delete from " + TABLE_FEEDBACK);
//Log.e("DELETED : ", "-----------------------FEEDBACK");
}
//----------------------------------FEEDBACK DETAILS------------------------------------
public void addFeedbackDetails(FeedbackDetail feedback) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(FD_ID, feedback.getFeedbackDetailId());
values.put(FD_F_ID, feedback.getFeedbackId());
values.put(FD_MESSAGE, feedback.getMessage());
values.put(FD_IS_ADMIN, feedback.getIsAdmin());
values.put(FD_FR_ID, feedback.getFrId());
values.put(FD_FR_NAME, feedback.getFrName());
values.put(FD_PHOTO, feedback.getPhoto());
values.put(FD_DATE, feedback.getDate());
values.put(FD_TIME, feedback.getTime());
values.put(FD_READ, 0);
db.insert(TABLE_FEEDBACK_DETAILS, null, values);
db.close();
}
public ArrayList<FeedbackDetail> getAllSQLiteFeedbackDetails(int fId) {
ArrayList<FeedbackDetail> feedbackDetailList = new ArrayList<>();
String query = "SELECT * FROM " + TABLE_FEEDBACK_DETAILS + " WHERE " + FD_F_ID + "=" + fId;
//Log.e("QUERY : ", "-------" + query);
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
if (cursor.moveToFirst()) {
do {
FeedbackDetail feedback = new FeedbackDetail();
feedback.setFeedbackDetailId(cursor.getInt(0));
feedback.setFeedbackId(cursor.getInt(1));
feedback.setMessage(cursor.getString(2));
feedback.setIsAdmin(cursor.getInt(3));
feedback.setFrId(cursor.getInt(4));
feedback.setFrName(cursor.getString(5));
feedback.setPhoto(cursor.getString(6));
feedback.setDate(cursor.getString(7));
feedback.setTime(cursor.getString(8));
feedback.setRead(cursor.getInt(9));
feedbackDetailList.add(feedback);
} while (cursor.moveToNext());
}
Log.e("SQLITE", "*************************" + feedbackDetailList);
return feedbackDetailList;
}
public int updateFeedbackDetailRead() {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(FD_READ, 1);
// updating row
return db.update(TABLE_FEEDBACK_DETAILS, values, "fdRead=0", null);
}
public int updateFeedbackDetailRead(int feedbackId) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(FD_READ, 1);
// updating row
return db.update(TABLE_FEEDBACK_DETAILS, values, "fdRead=0 AND " + FD_F_ID + "=" + feedbackId, null);
}
public int getFeedbackDetailUnreadCount() {
int count = 0;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT COUNT(*) FROM " + TABLE_FEEDBACK_DETAILS + " as fd,"+TABLE_FEEDBACK+" as fh WHERE fd." + FD_READ + "=0 AND fd."+FD_F_ID+"=fh."+F_ID, null);
if (cursor != null && cursor.moveToFirst()) {
count = cursor.getInt(0);
cursor.close();
}
Log.e("FEEDBACK DETAIL", " UNREAD COUNT-----------------------" + count);
return count;
}
public int getFeedbackDetailUnreadCount(int feedbackId) {
int count = 0;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT COUNT(*) FROM " + TABLE_FEEDBACK_DETAILS + " WHERE " + FD_READ + "=0 AND " + FD_F_ID + "=" + feedbackId, null);
if (cursor != null && cursor.moveToFirst()) {
count = cursor.getInt(0);
cursor.close();
}
return count;
}
public int getFeedbackDetailLastId() {
int lastId = 0;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT MAX(" + FD_ID + ") FROM " + TABLE_FEEDBACK_DETAILS, null);
if (cursor != null && cursor.moveToFirst()) {
lastId = cursor.getInt(0);
cursor.close();
}
return lastId;
}
}
|
package com.kevin.cloud.service.config;
import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration;
import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @ProjectName: vue-blog-backend
* @Package: com.kevin.cloud.provider.config
* @ClassName: ElasticRegCenterConfig
* @Author: kevin
* @Description:
* @Date: 2020/2/11 14:54
* @Version: 1.0
*/
@Configuration
public class ElasticRegCenterConfig {
/**
* 配置zookeeper
* @param serverList
* @param namespace
* @return
*/
@Bean(initMethod = "init")
public ZookeeperRegistryCenter regCenter(
@Value("${regCenter.serverList}") final String serverList,
@Value("${regCenter.namespace}") final String namespace) {
return new ZookeeperRegistryCenter(new ZookeeperConfiguration(serverList, namespace));
}
}
|
package leetCode.copy.Other;
/**
* 9. 回文数
*
* 给你一个整数 x ,如果 x 是一个回文整数,返回 true ;否则,返回 false 。
* 回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。例如,121 是回文,而 123 不是。
*
* 示例 1:
* 输入:x = 121
* 输出:true
*
* 示例 2:
* 输入:x = -121
* 输出:false
* 解释:从左向右读, 为 -121 。 从右向左读, 为 121- 。因此它不是一个回文数。
*
* 示例 3:
* 输入:x = 10
* 输出:false
* 解释:从右向左读, 为 01 。因此它不是一个回文数。
*
* 示例 4:
* 输入:x = -101
* 输出:false
*
* 提示:
* -2^31 <= x <= 2^31 - 1
*
* 进阶:你能不将整数转为字符串来解决这个问题吗?
*
* 链接:https://leetcode-cn.com/problems/palindrome-number
*/
public class no9_palindrome_number {
public boolean isPalindrome(int x) {
if(x<0) return false;
String temp = x+"";
for(int i=0,j=temp.length()-1;i<=j;){
if(temp.charAt(i) == temp.charAt(j)){
i++;
j--;
}else{
return false;
}
}
return true;
}
}
|
package cn.com.signheart.component.core.core.dao;
import cn.com.signheart.component.core.core.model.TbPlatFormConfig;
import java.sql.SQLException;
import java.util.List;
/**
* Created by ao.ouyang on 16-1-11.
*/
public interface IPlatFormCfgDao {
/**
* 查询所有配置
* @return
* @throws SQLException
*/
public List<TbPlatFormConfig> getAllCfg() throws SQLException;
}
|
/*
* Copyright 2002-2023 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
*
* https://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.springframework.test.context.support;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.assertj.core.api.AssertionsForClassTypes;
import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.AliasFor;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.BootstrapTestUtils;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.MergedContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.support.BootstrapTestUtilsMergedConfigTests.EmptyConfigTestCase.Nested;
import org.springframework.test.context.web.WebDelegatingSmartContextLoader;
import org.springframework.test.context.web.WebMergedContextConfiguration;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
/**
* Unit tests for {@link BootstrapTestUtils} involving {@link MergedContextConfiguration}.
*
* @author Sam Brannen
* @since 3.1
*/
class BootstrapTestUtilsMergedConfigTests extends AbstractContextConfigurationUtilsTests {
@Test
void buildImplicitMergedConfigWithoutAnnotation() {
Class<?> testClass = Enigma.class;
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, DelegatingSmartContextLoader.class);
}
/**
* @since 4.3
*/
@Test
void buildMergedConfigWithContextConfigurationWithoutLocationsClassesOrInitializers() {
assertThatIllegalStateException().isThrownBy(() ->
buildMergedContextConfiguration(MissingContextAttributesTestCase.class))
.withMessageStartingWith("DelegatingSmartContextLoader was unable to detect defaults, "
+ "and no ApplicationContextInitializers or ContextCustomizers were declared for context configuration attributes");
}
@Test
void buildMergedConfigWithBareAnnotations() {
Class<?> testClass = BareAnnotations.class;
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertMergedConfig(
mergedConfig,
testClass,
array("classpath:/org/springframework/test/context/support/AbstractContextConfigurationUtilsTests$BareAnnotations-context.xml"),
EMPTY_CLASS_ARRAY, DelegatingSmartContextLoader.class);
}
@Test
void buildMergedConfigWithLocalAnnotationAndLocations() {
Class<?> testClass = LocationsFoo.class;
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertMergedConfig(mergedConfig, testClass, array("classpath:/foo.xml"), EMPTY_CLASS_ARRAY,
DelegatingSmartContextLoader.class);
}
@Test
void buildMergedConfigWithMetaAnnotationAndLocations() {
Class<?> testClass = MetaLocationsFoo.class;
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertMergedConfig(mergedConfig, testClass, array("classpath:/foo.xml"), EMPTY_CLASS_ARRAY,
DelegatingSmartContextLoader.class);
}
@Test
void buildMergedConfigWithMetaAnnotationAndClasses() {
buildMergedConfigWithMetaAnnotationAndClasses(Dog.class);
buildMergedConfigWithMetaAnnotationAndClasses(WorkingDog.class);
buildMergedConfigWithMetaAnnotationAndClasses(GermanShepherd.class);
}
private void buildMergedConfigWithMetaAnnotationAndClasses(Class<?> testClass) {
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, array(FooConfig.class,
BarConfig.class), DelegatingSmartContextLoader.class);
}
@Test
void buildMergedConfigWithLocalAnnotationAndClasses() {
Class<?> testClass = ClassesFoo.class;
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, array(FooConfig.class),
DelegatingSmartContextLoader.class);
}
/**
* Introduced to investigate claims made in a discussion on
* <a href="https://stackoverflow.com/questions/24725438/what-could-cause-a-class-implementing-applicationlistenercontextrefreshedevent">Stack Overflow</a>.
*/
@Test
void buildMergedConfigWithAtWebAppConfigurationWithAnnotationAndClassesOnSuperclass() {
Class<?> webTestClass = WebClassesFoo.class;
Class<?> standardTestClass = ClassesFoo.class;
WebMergedContextConfiguration webMergedConfig = (WebMergedContextConfiguration) buildMergedContextConfiguration(webTestClass);
MergedContextConfiguration standardMergedConfig = buildMergedContextConfiguration(standardTestClass);
assertThat(webMergedConfig).isEqualTo(webMergedConfig);
assertThat(standardMergedConfig).isEqualTo(standardMergedConfig);
assertThat(webMergedConfig).isNotEqualTo(standardMergedConfig);
assertThat(standardMergedConfig).isNotEqualTo(webMergedConfig);
assertMergedConfig(webMergedConfig, webTestClass, EMPTY_STRING_ARRAY, array(FooConfig.class),
WebDelegatingSmartContextLoader.class);
assertMergedConfig(standardMergedConfig, standardTestClass, EMPTY_STRING_ARRAY,
array(FooConfig.class), DelegatingSmartContextLoader.class);
}
@Test
void buildMergedConfigWithLocalAndInheritedAnnotationsAndLocations() {
Class<?> testClass = LocationsBar.class;
String[] expectedLocations = array("/foo.xml", "/bar.xml");
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertMergedConfig(mergedConfig, testClass, expectedLocations, EMPTY_CLASS_ARRAY,
AnnotationConfigContextLoader.class);
}
@Test
void buildMergedConfigWithLocalAndInheritedAnnotationsAndClasses() {
Class<?> testClass = ClassesBar.class;
Class<?>[] expectedClasses = array(FooConfig.class, BarConfig.class);
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, expectedClasses,
AnnotationConfigContextLoader.class);
}
@Test
void buildMergedConfigWithAnnotationsAndOverriddenLocations() {
Class<?> testClass = OverriddenLocationsBar.class;
String[] expectedLocations = array("/bar.xml");
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertMergedConfig(mergedConfig, testClass, expectedLocations, EMPTY_CLASS_ARRAY,
AnnotationConfigContextLoader.class);
}
@Test
void buildMergedConfigWithAnnotationsAndOverriddenClasses() {
Class<?> testClass = OverriddenClassesBar.class;
Class<?>[] expectedClasses = array(BarConfig.class);
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, expectedClasses,
AnnotationConfigContextLoader.class);
}
@Test
void buildMergedConfigAndVerifyLocationPathsAreCleanedEquivalently() {
assertMergedConfigForLocationPaths(AbsoluteFooXmlLocationWithoutClasspathPrefix.class);
assertMergedConfigForLocationPaths(AbsoluteFooXmlLocationWithInnerRelativePathWithoutClasspathPrefix.class);
assertMergedConfigForLocationPaths(AbsoluteFooXmlLocationWithClasspathPrefix.class);
assertMergedConfigForLocationPaths(RelativeFooXmlLocation.class);
}
@SuppressWarnings("deprecation")
private void assertMergedConfigForLocationPaths(Class<?> testClass) {
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertThat(mergedConfig).isNotNull();
assertThat(mergedConfig.getTestClass()).isEqualTo(testClass);
assertThat(mergedConfig.getContextLoader()).isInstanceOf(DelegatingSmartContextLoader.class);
assertThat(mergedConfig.getLocations()).containsExactly("classpath:/example/foo.xml");
assertThat(mergedConfig.getPropertySourceLocations()).containsExactly("classpath:/example/foo.properties");
assertThat(mergedConfig.getClasses()).isEmpty();
assertThat(mergedConfig.getActiveProfiles()).isEmpty();
assertThat(mergedConfig.getContextInitializerClasses()).isEmpty();
assertThat(mergedConfig.getPropertySourceProperties()).isEmpty();
}
/**
* @since 5.3
*/
@Test
public void buildMergedConfigForNestedTestClassWithInheritedConfig() {
Class<?> testClass = OuterTestCase.NestedTestCaseWithInheritedConfig.class;
Class<?>[] expectedClasses = array(FooConfig.class);
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, expectedClasses,
AnnotationConfigContextLoader.class);
}
/**
* @since 5.3
*/
@Test
public void buildMergedConfigForNestedTestClassWithMergedInheritedConfig() {
Class<?> testClass = OuterTestCase.NestedTestCaseWithMergedInheritedConfig.class;
Class<?>[] expectedClasses = array(FooConfig.class, BarConfig.class);
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, expectedClasses,
AnnotationConfigContextLoader.class);
}
/**
* @since 5.3
*/
@Test
public void buildMergedConfigForNestedTestClassWithOverriddenConfig() {
Class<?> testClass = OuterTestCase.NestedTestCaseWithOverriddenConfig.class;
Class<?>[] expectedClasses = array(BarConfig.class);
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, expectedClasses,
DelegatingSmartContextLoader.class);
}
/**
* @since 5.3
*/
@Test
public void buildMergedConfigForDoubleNestedTestClassWithInheritedOverriddenConfig() {
Class<?> testClass = OuterTestCase.NestedTestCaseWithOverriddenConfig.DoubleNestedTestCaseWithInheritedOverriddenConfig.class;
Class<?>[] expectedClasses = array(BarConfig.class);
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, expectedClasses,
DelegatingSmartContextLoader.class);
}
/**
* @since 5.3
*/
@Test
public void buildMergedConfigForContextHierarchy() {
Class<?> testClass = ContextHierarchyOuterTestCase.class;
Class<?>[] expectedClasses = array(BarConfig.class);
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertThat(mergedConfig).as("merged config").isNotNull();
MergedContextConfiguration parent = mergedConfig.getParent();
assertThat(parent).as("parent config").isNotNull();
// The following does not work -- at least not in Eclipse.
// assertThat(parent.getClasses())...
// So we use AssertionsForClassTypes directly.
AssertionsForClassTypes.assertThat(parent.getClasses()).containsExactly(FooConfig.class);
assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, expectedClasses,
AnnotationConfigContextLoader.class);
}
/**
* @since 5.3
*/
@Test
public void buildMergedConfigForNestedTestClassWithInheritedConfigForContextHierarchy() {
Class<?> enclosingTestClass = ContextHierarchyOuterTestCase.class;
Class<?> testClass = ContextHierarchyOuterTestCase.NestedTestCaseWithInheritedConfig.class;
Class<?>[] expectedClasses = array(BarConfig.class);
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertThat(mergedConfig).as("merged config").isNotNull();
MergedContextConfiguration parent = mergedConfig.getParent();
assertThat(parent).as("parent config").isNotNull();
AssertionsForClassTypes.assertThat(parent.getClasses()).containsExactly(FooConfig.class);
assertMergedConfig(mergedConfig, enclosingTestClass, EMPTY_STRING_ARRAY, expectedClasses,
AnnotationConfigContextLoader.class);
}
/**
* @since 5.3
*/
@Test
public void buildMergedConfigForNestedTestClassWithMergedInheritedConfigForContextHierarchy() {
Class<?> testClass = ContextHierarchyOuterTestCase.NestedTestCaseWithMergedInheritedConfig.class;
Class<?>[] expectedClasses = array(BarConfig.class, BazConfig.class);
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertThat(mergedConfig).as("merged config").isNotNull();
MergedContextConfiguration parent = mergedConfig.getParent();
assertThat(parent).as("parent config").isNotNull();
AssertionsForClassTypes.assertThat(parent.getClasses()).containsExactly(FooConfig.class);
assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, expectedClasses,
AnnotationConfigContextLoader.class);
}
/**
* @since 5.3
*/
@Test
public void buildMergedConfigForNestedTestClassWithOverriddenConfigForContextHierarchy() {
Class<?> testClass = ContextHierarchyOuterTestCase.NestedTestCaseWithOverriddenConfig.class;
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertThat(mergedConfig).as("merged config").isNotNull();
MergedContextConfiguration parent = mergedConfig.getParent();
assertThat(parent).as("parent config").isNotNull();
assertMergedConfig(parent, testClass, EMPTY_STRING_ARRAY, array(QuuxConfig.class),
AnnotationConfigContextLoader.class);
assertMergedConfig(mergedConfig, ContextHierarchyOuterTestCase.class, EMPTY_STRING_ARRAY,
array(BarConfig.class), AnnotationConfigContextLoader.class);
}
/**
* @since 5.3
*/
@Test
void buildMergedConfigWithDuplicateConfigurationOnSuperclassAndSubclass() {
compareApplesToApples(AppleConfigTestCase.class, DuplicateConfigAppleConfigTestCase.class);
compareApplesToApples(DuplicateConfigAppleConfigTestCase.class, SubDuplicateConfigAppleConfigTestCase.class);
compareApplesToOranges(ApplesAndOrangesConfigTestCase.class, DuplicateConfigApplesAndOrangesConfigTestCase.class);
compareApplesToOranges(DuplicateConfigApplesAndOrangesConfigTestCase.class, SubDuplicateConfigApplesAndOrangesConfigTestCase.class);
}
/**
* @since 5.3
*/
@Test
void buildMergedConfigWithDuplicateConfigurationOnEnclosingClassAndNestedClass() {
compareApplesToApples(AppleConfigTestCase.class, AppleConfigTestCase.Nested.class);
compareApplesToApples(AppleConfigTestCase.Nested.class, AppleConfigTestCase.Nested.DoubleNested.class);
compareApplesToOranges(ApplesAndOrangesConfigTestCase.class, ApplesAndOrangesConfigTestCase.Nested.class);
compareApplesToOranges(ApplesAndOrangesConfigTestCase.Nested.class, ApplesAndOrangesConfigTestCase.Nested.DoubleNested.class);
}
private void compareApplesToApples(Class<?> parent, Class<?> child) {
MergedContextConfiguration parentMergedConfig = buildMergedContextConfiguration(parent);
assertMergedConfig(parentMergedConfig, parent, EMPTY_STRING_ARRAY, array(AppleConfig.class),
DelegatingSmartContextLoader.class);
MergedContextConfiguration childMergedConfig = buildMergedContextConfiguration(child);
assertMergedConfig(childMergedConfig, child, EMPTY_STRING_ARRAY, array(AppleConfig.class),
DelegatingSmartContextLoader.class);
assertThat(parentMergedConfig.getActiveProfiles()).as("active profiles")
.containsExactly("apples")
.isEqualTo(childMergedConfig.getActiveProfiles());
assertThat(parentMergedConfig).isEqualTo(childMergedConfig);
}
private void compareApplesToOranges(Class<?> parent, Class<?> child) {
MergedContextConfiguration parentMergedConfig = buildMergedContextConfiguration(parent);
assertMergedConfig(parentMergedConfig, parent, EMPTY_STRING_ARRAY, array(AppleConfig.class),
DelegatingSmartContextLoader.class);
MergedContextConfiguration childMergedConfig = buildMergedContextConfiguration(child);
assertMergedConfig(childMergedConfig, child, EMPTY_STRING_ARRAY, array(AppleConfig.class),
DelegatingSmartContextLoader.class);
assertThat(parentMergedConfig.getActiveProfiles()).as("active profiles")
.containsExactly("oranges", "apples")
.isEqualTo(childMergedConfig.getActiveProfiles());
assertThat(parentMergedConfig).isEqualTo(childMergedConfig);
}
/**
* @since 5.3
*/
@Test
void buildMergedConfigWithEmptyConfigurationOnSuperclassAndSubclass() {
// not equal because different defaults are detected for each class
assertEmptyConfigsAreNotEqual(EmptyConfigTestCase.class, SubEmptyConfigTestCase.class, SubSubEmptyConfigTestCase.class);
}
private void assertEmptyConfigsAreNotEqual(Class<?> parent, Class<?> child, Class<?> grandchild) {
MergedContextConfiguration parentMergedConfig = buildMergedContextConfiguration(parent);
assertMergedConfig(parentMergedConfig, parent, EMPTY_STRING_ARRAY,
array(EmptyConfigTestCase.Config.class), DelegatingSmartContextLoader.class);
MergedContextConfiguration childMergedConfig = buildMergedContextConfiguration(child);
assertMergedConfig(childMergedConfig, child, EMPTY_STRING_ARRAY,
array(EmptyConfigTestCase.Config.class, SubEmptyConfigTestCase.Config.class), DelegatingSmartContextLoader.class);
assertThat(parentMergedConfig.getActiveProfiles()).as("active profiles")
.isEqualTo(childMergedConfig.getActiveProfiles());
assertThat(parentMergedConfig).isNotEqualTo(childMergedConfig);
MergedContextConfiguration grandchildMergedConfig = buildMergedContextConfiguration(grandchild);
assertMergedConfig(grandchildMergedConfig, grandchild, EMPTY_STRING_ARRAY,
array(EmptyConfigTestCase.Config.class, SubEmptyConfigTestCase.Config.class, SubSubEmptyConfigTestCase.Config.class),
DelegatingSmartContextLoader.class);
assertThat(childMergedConfig.getActiveProfiles()).as("active profiles")
.isEqualTo(grandchildMergedConfig.getActiveProfiles());
assertThat(childMergedConfig).isNotEqualTo(grandchildMergedConfig);
}
/**
* @since 5.3
*/
@Test
void buildMergedConfigWithEmptyConfigurationOnEnclosingClassAndExplicitConfigOnNestedClass() {
Class<EmptyConfigTestCase> enclosingClass = EmptyConfigTestCase.class;
Class<Nested> nestedClass = EmptyConfigTestCase.Nested.class;
MergedContextConfiguration enclosingMergedConfig = buildMergedContextConfiguration(enclosingClass);
assertMergedConfig(enclosingMergedConfig, enclosingClass, EMPTY_STRING_ARRAY,
array(EmptyConfigTestCase.Config.class), DelegatingSmartContextLoader.class);
MergedContextConfiguration nestedMergedConfig = buildMergedContextConfiguration(nestedClass);
assertMergedConfig(nestedMergedConfig, nestedClass, EMPTY_STRING_ARRAY,
array(EmptyConfigTestCase.Config.class, AppleConfig.class), DelegatingSmartContextLoader.class);
assertThat(enclosingMergedConfig.getActiveProfiles()).as("active profiles")
.isEqualTo(nestedMergedConfig.getActiveProfiles());
assertThat(enclosingMergedConfig).isNotEqualTo(nestedMergedConfig);
}
@ContextConfiguration
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface SpringAppConfig {
@AliasFor(annotation = ContextConfiguration.class)
Class<?>[] classes() default {};
}
@SpringAppConfig(classes = { FooConfig.class, BarConfig.class })
public static abstract class Dog {
}
public static abstract class WorkingDog extends Dog {
}
public static class GermanShepherd extends WorkingDog {
}
@ContextConfiguration
static class MissingContextAttributesTestCase {
}
@ContextConfiguration(locations = "/example/foo.xml")
@TestPropertySource("/example/foo.properties")
static class AbsoluteFooXmlLocationWithoutClasspathPrefix {
}
@ContextConfiguration(locations = "/example/../org/../example/foo.xml")
@TestPropertySource("/example/../org/../example/foo.properties")
static class AbsoluteFooXmlLocationWithInnerRelativePathWithoutClasspathPrefix {
}
@ContextConfiguration(locations = "classpath:/example/foo.xml")
@TestPropertySource("classpath:/example/foo.properties")
static class AbsoluteFooXmlLocationWithClasspathPrefix {
}
// org.springframework.test.context.support --> 5 levels up to the root of the classpath
@ContextConfiguration(locations = "../../../../../example/foo.xml")
@TestPropertySource("../../../../../example/foo.properties")
static class RelativeFooXmlLocation {
}
static class AppleConfig {
}
@ContextConfiguration(classes = AppleConfig.class)
@ActiveProfiles("apples")
static class AppleConfigTestCase {
@ContextConfiguration(classes = AppleConfig.class)
@ActiveProfiles({"apples", "apples"})
class Nested {
@ContextConfiguration(classes = AppleConfig.class)
@ActiveProfiles({"apples", "apples", "apples"})
class DoubleNested {
}
}
}
@ContextConfiguration(classes = AppleConfig.class)
@ActiveProfiles({"apples", "apples"})
static class DuplicateConfigAppleConfigTestCase extends AppleConfigTestCase {
}
@ContextConfiguration(classes = AppleConfig.class)
@ActiveProfiles({"apples", "apples", "apples"})
static class SubDuplicateConfigAppleConfigTestCase extends DuplicateConfigAppleConfigTestCase {
}
@ContextConfiguration(classes = AppleConfig.class)
@ActiveProfiles({"oranges", "apples"})
static class ApplesAndOrangesConfigTestCase {
@ContextConfiguration(classes = AppleConfig.class)
@ActiveProfiles(profiles = {"oranges", "apples"}, inheritProfiles = false)
class Nested {
@ContextConfiguration(classes = AppleConfig.class)
@ActiveProfiles(profiles = {"oranges", "apples", "oranges"}, inheritProfiles = false)
class DoubleNested {
}
}
}
@ContextConfiguration(classes = AppleConfig.class)
@ActiveProfiles(profiles = {"oranges", "apples", "oranges"}, inheritProfiles = false)
static class DuplicateConfigApplesAndOrangesConfigTestCase extends ApplesAndOrangesConfigTestCase {
}
@ContextConfiguration(classes = AppleConfig.class)
@ActiveProfiles(profiles = {"oranges", "apples", "oranges"}, inheritProfiles = false)
static class SubDuplicateConfigApplesAndOrangesConfigTestCase extends DuplicateConfigApplesAndOrangesConfigTestCase {
}
@ContextConfiguration
static class EmptyConfigTestCase {
@ContextConfiguration(classes = AppleConfig.class)
class Nested {
// inner classes cannot have static nested @Configuration classes
}
@Configuration
static class Config {
}
}
@ContextConfiguration
static class SubEmptyConfigTestCase extends EmptyConfigTestCase {
@Configuration
static class Config {
}
}
@ContextConfiguration
static class SubSubEmptyConfigTestCase extends SubEmptyConfigTestCase {
@Configuration
static class Config {
}
}
}
|
package com.peternwerner.iagogame;
public class LevelListFiller {
public void fillList() {
// how many levels are in n index?
int[] lengths = {0, 0, 18, 96, 96, 48, 0, 0, 0, 0};
// tell maingame the size of each level list
for(int i = 0; i < MainGame.levelListSize.length; i++) {
MainGame.levelListSize[i] = lengths[i];
}
// populate maingame level lists
for(int i = 0; i < MainGame.levelList.length; i++) {
for(int j = 0; j < lengths[i]; j++) {
String name;
if(j < 10)
name = "Level 0" + j + " (" + i + "x" + i + ")";
else
name = "Level " + j + " (" + i + "x" + i + ")";
MainGame.levelList[i][j] = name;
}
}
}
}
|
package com.choco.rpc.service.impl;
import com.alibaba.dubbo.config.annotation.Service;
import com.choco.common.entity.Admin;
import com.choco.common.result.BaseResult;
import com.choco.common.utils.JsonUtil;
import com.choco.rpc.service.CartService;
import com.choco.rpc.vo.CartResult;
import com.choco.rpc.vo.CartVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Created by choco on 2021/1/7 14:13
*/
@Service(interfaceClass = CartService.class)
@Component
public class CartServiceImpl implements CartService {
@Autowired
private RedisTemplate redisTemplate;
@Value("${user.cart}")
private String userCart;
//提取公共模板
@Override
public BaseResult addCart(CartVo cartVo, Admin admin) {
//判断用户
if (admin == null || admin.getAdminId() == null) {
return BaseResult.error();
}
HashOperations<String, String, String> hashOperations = redisTemplate.opsForHash();
//获取购物车
Map<String, String> cartVoMap = hashOperations.entries(userCart + ":" + admin.getAdminId());
//
if (CollectionUtils.isEmpty(cartVoMap)) {
//如果整个购物车为空
cartVoMap = new HashMap<String, String>();
cartVoMap.put(String.valueOf(cartVo.getGoodsId()), JsonUtil.object2JsonStr(cartVo));
} else {
//获取已存在的cartvo.
String goodsJson = cartVoMap.get(String.valueOf(cartVo.getGoodsId()));
//
if (StringUtils.isEmpty(goodsJson)) {
//如果购物车的这个商品为空
//直接存入map
cartVoMap.put(String.valueOf(cartVo.getGoodsId()), JsonUtil.object2JsonStr(cartVo));
} else {
CartVo vo = JsonUtil.jsonStr2Object(goodsJson, CartVo.class);
//重新设置商品数量
vo.setGoodsNum(vo.getGoodsNum() + cartVo.getGoodsNum());
//重新设置商品价格
vo.setMarketPrice(cartVo.getMarketPrice());
//这里需要重新存入vo, 不是cartVo
cartVoMap.put(String.valueOf(cartVo.getGoodsId()), JsonUtil.object2JsonStr(vo));
}
}
hashOperations.putAll(userCart + ":" + admin.getAdminId(), cartVoMap);
return BaseResult.success();
}
Integer cartNum = 0;
@Override
public Integer getCartNums(Admin admin) {
//判断用户
if (admin == null || admin.getAdminId() == null) {
return 0;
}
HashOperations<String, String, String> hashOperations = redisTemplate.opsForHash();
//通过key获取redis购物车
Map<String, String> cartMap = hashOperations.entries(userCart + ":" + admin.getAdminId());
if (!CollectionUtils.isEmpty(cartMap)) {
for (Map.Entry<String, String> entry : cartMap.entrySet()) {
// entry.getValue()为json
CartVo cartVo = JsonUtil.jsonStr2Object(entry.getValue(), CartVo.class);
cartNum += cartVo.getGoodsNum();
}
return cartNum;
}
return 0;
}
@Override
public CartResult getCartList(Admin admin) {
if (null == admin && null == admin.getAdminId()) {
return null;
}
CartResult cartResult = null;
HashOperations<String, String, String> hashOperations = redisTemplate.opsForHash();
Map<String, String> cartMap = hashOperations.entries(userCart + ":" + admin.getAdminId());
if (!StringUtils.isEmpty(cartMap)) {
cartResult = new CartResult();
//把map的value转换为cartList
List<CartVo> cartVoList = cartMap.values().stream().map(e -> JsonUtil.jsonStr2Object(e, CartVo.class)).collect(Collectors.toList());
//计算总价
BigDecimal totalPrice = cartVoList.stream().map(e -> e.getMarketPrice().multiply(new BigDecimal(String.valueOf(e.getGoodsNum())))).reduce(BigDecimal.ZERO, BigDecimal::add);
//采取保留2位, 四舍五入的方式
totalPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
cartResult.setCartList(cartVoList);
cartResult.setTotalPrice(totalPrice);
return cartResult;
}
return null;
}
@Override
public BaseResult clearCart(Admin admin) {
if (null == admin && null == admin.getAdminId()) {
return null;
}
HashOperations hashOperations = redisTemplate.opsForHash();
//获取购物车,判断是否为空
Map<String, String> entries = hashOperations.entries(userCart + ":" + admin.getAdminId());
if (!StringUtils.isEmpty(entries)) {
//为空,则删除对于的key
redisTemplate.delete(userCart + ":" + admin.getAdminId());
return BaseResult.success();
}
return BaseResult.error();
}
}
|
/*
* Copyright Verizon Media, Licensed under the terms of the Apache License, Version 2.0. See LICENSE file in project root for terms.
*/
package com.yahoo.cubed.service;
import com.yahoo.cubed.dao.DAOFactory;
import com.yahoo.cubed.dao.FieldKeyDAO;
import com.yahoo.cubed.model.FieldKey;
import com.yahoo.cubed.service.exception.DatabaseException;
import org.hibernate.Session;
import com.yahoo.cubed.service.exception.DataValidatorException;
/**
* Field key service implementation.
*/
public class FieldKeyServiceImpl extends AbstractServiceImpl<FieldKey> implements FieldKeyService {
@Override
protected FieldKeyDAO getDAO() {
return DAOFactory.fieldKeyDAO();
}
/** Check before saving model. */
protected void preSaveCheck(Session session, FieldKey model) throws DataValidatorException {
super.preSaveCheck(session, model);
String modelName = this.getDAO().getEntityClass().getSimpleName();
// check name is set
if (model.getKeyName() == null) {
throw new DataValidatorException("The name of the " + modelName + " is not provided.");
}
}
/**
* Check if a composite name is valid.
*/
protected boolean isNameValid(String s) {
if (s == null) {
return false;
}
String[] parts = s.split(FieldKey.FIELD_KEY_NAME_SEPARATOR);
if (parts.length != 3) {
return false;
}
return NAME_PATTERN.matcher(parts[2]).matches();
}
/**
* Check model before update.
*/
protected FieldKey preUpdateCheck(Session session, FieldKey newModel) throws DataValidatorException {
super.preUpdateCheck(session, newModel);
String modelName = this.getDAO().getEntityClass().getSimpleName();
// check name is set
if (newModel.getKeyName() == null) {
throw new DataValidatorException("The name of the " + modelName + " is not provided.");
}
// check if id exists
FieldKey oldModel = this.getDAO().fetchByCompositeKey(session, newModel.getSchemaName(), newModel.getFieldId(), newModel.getKeyId());
if (oldModel == null) {
throw new DataValidatorException("The " + modelName + " with id [" + newModel.getKeyId() + "] does not exist.");
}
// check name unique
FieldKey modelWithSameName = this.getDAO().fetchBySchemaNameFieldIdKeyName(session, newModel.getSchemaName(), newModel.getFieldId(), newModel.getKeyName());
if (modelWithSameName != null && modelWithSameName.getKeyId() != newModel.getKeyId()) {
throw new DataValidatorException("The name of the " + modelName + " is already used by another " + modelName + ".");
}
return this.getDAO().fetchByCompositeKey(session, newModel.getSchemaName(), newModel.getFieldId(), newModel.getKeyId());
}
/**
* Model check before model delete.
*/
protected FieldKey preDeleteCheck(Session session, String schemaName, long fieldId, long fieldKeyId) throws DataValidatorException {
// check if id valid
if (fieldKeyId <= 0) {
throw new DataValidatorException("The id of the field key model is not provided.");
}
// check if id exists
FieldKey oldModel = this.getDAO().fetchByCompositeKey(session, schemaName, fieldId, fieldKeyId);
if (oldModel == null) {
throw new DataValidatorException("The " + this.getDAO().getEntityClass().getSimpleName() + " with id [" + fieldKeyId + "] does not exist.");
}
return oldModel;
}
/**
* Delete entity.
*/
public void delete(String schemaName, long fieldId, long fieldKeyId) throws DataValidatorException, DatabaseException {
Session session = this.createSession();
FieldKey model = this.preDeleteCheck(session, schemaName, fieldId, fieldKeyId);
try {
this.getDAO().delete(session, model);
} catch (RuntimeException e) {
throw new DatabaseException("Database exception: delete " + this.getDAO().getEntityClass().getSimpleName() + " failed.", e);
} finally {
this.reclaimSession(session);
}
}
/**
* Fetch entity.
*/
public FieldKey fetchByCompositeKey(String schemaName, long fieldId, long keyId) throws DataValidatorException, DatabaseException {
Session session = this.createSession();
FieldKey model = null;
try {
model = this.getDAO().fetchByCompositeKey(session, schemaName, fieldId, keyId);
} catch (RuntimeException e) {
throw new DatabaseException("Database exception: cannot query " + this.getDAO().getEntityClass().getSimpleName() + " with id [" + keyId + "].", e);
} finally {
this.reclaimSession(session);
}
if (model == null) {
throw new DataValidatorException("Cannot find " + this.getDAO().getEntityClass().getSimpleName() + " with id [" + keyId + "] and fieldId " + fieldId + " schema name [" + schemaName + "].");
}
return model;
}
}
|
/*
* Copyright 2002-2008 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
*
* https://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.springframework.jdbc.support.xml;
import org.springframework.jdbc.support.SqlValue;
/**
* Subinterface of {@link org.springframework.jdbc.support.SqlValue}
* that supports passing in XML data to specified column and adds a
* cleanup callback, to be invoked after the value has been set and
* the corresponding statement has been executed.
*
* @author Thomas Risberg
* @since 2.5.5
* @see org.springframework.jdbc.support.SqlValue
*/
public interface SqlXmlValue extends SqlValue {
}
|
package com.pos.porschetower.utils;
import java.util.ArrayList;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
public class FitFragment extends Fragment {
public ArrayList<BackStack> hMapTabs = new ArrayList<BackStack>();
public BackFragmentCallback mCallback ;
public int stackSize() {
return hMapTabs.size();
}
public void backFragment() {
BackStack backStack = (BackStack)hMapTabs.get(hMapTabs.size() - 1);
BackStack newStack = hMapTabs.get(hMapTabs.size() - 2);
hMapTabs.remove(hMapTabs.size() - 1);
FragmentManager manager = getChildFragmentManager();
FragmentTransaction ft = manager.beginTransaction();
ft.replace(newStack.containerID, newStack.fragment);
ft.commit();
if (backStack != null && backStack.fragment != null) {
//backStack.fragment.onDestroy();
}
if (mCallback != null)
mCallback.backFragment(newStack);
}
public void addFragment(Fragment f, int containerID, int type) {
BackStack newStack = new BackStack();
newStack.fragment = f;
newStack.containerID = containerID;
newStack.type = type;
hMapTabs.add(newStack);
FragmentManager manager = getChildFragmentManager();
FragmentTransaction ft = manager.beginTransaction();
ft.replace(containerID, f);
ft.commit();
}
public interface BackFragmentCallback {
public abstract void backFragment(BackStack f);
}
}
|
package com.bytest.autotest.innerService;
import com.bytest.autotest.domain.BreEventParam;
import java.util.List;
/**
* 策略引擎事件请求和响应参数表(BreEventParam)表服务接口
*
* @author makejava
* @since 2020-08-20 16:09:08
*/
public interface BreEventParamService {
/**
* 通过ID查询单条数据
*
* @param requestId 主键
* @return 实例对象
*/
BreEventParam queryById(String requestId,String day);
List<BreEventParam> queryByIdAndDay(String eventId,String day);
/**
* 查询多条数据
*
* @param offset 查询起始位置
* @param limit 查询条数
* @return 对象列表
*/
List<BreEventParam> queryAllByLimit(int offset, int limit,String day);
/**
* 新增数据
*
* @param breEventParam 实例对象
* @return 实例对象
*/
BreEventParam insert(BreEventParam breEventParam,String day);
/**
* 修改数据
*
* @param breEventParam 实例对象
* @return 实例对象
*/
BreEventParam update(BreEventParam breEventParam,String day);
/**
* 通过主键删除数据
*
* @param requestId 主键
* @return 是否成功
*/
boolean deleteById(String requestId,String day);
}
|
package org.datadozer.parser;
import java.time.Instant;
import java.util.Date;
import java.util.Map;
class Test {
Date dateNow() {
return Date.from(Instant.EPOCH);
}
Double sort(Map<String, String> p, Map<String, String> d) {
return ((0.3 * Double.parseDouble(p.get("sap"))) / 10.0) + (0.7 * Double.parseDouble(p.get("score")));
}
Double score(Map<String, String> p, Map<String, String> d) {
return ((0.3 * Double.parseDouble(p.get("sap"))) / 10.0) + (0.7 * Double.parseDouble(p.get("score")));
}
Object column(Map<String, String> p, Map<String, String> d) {
if (p.get("bypass") == "1") {
return "";
} else {
return "";
}
}
}
|
package com.jagdish.bakingapp.db;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Transaction;
import com.jagdish.bakingapp.data.Ingredient;
import com.jagdish.bakingapp.data.Recipe;
import com.jagdish.bakingapp.data.RecipeFilter;
import com.jagdish.bakingapp.data.Step;
import java.util.List;
@Dao
public abstract class RecipeDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
public abstract void insertIngredients(List<Ingredient> ingredients);
@Insert(onConflict = OnConflictStrategy.REPLACE)
public abstract void insertSteps(List<Step> steps);
@Insert(onConflict = OnConflictStrategy.REPLACE)
public abstract void insertRecipe(Recipe recipe);
public void insertOrReplaceRecipe(Recipe recipe) {
List<Ingredient> ingredients = recipe.getIngredients();
for (Ingredient ingredient : ingredients) {
ingredient.setRecipeId(recipe.getId());
}
// check if ingredients already exist then delete older one
deleteIngredientsByRecipeId(recipe.getId());
// insert values now
insertIngredients(ingredients);
List<Step> steps = recipe.getSteps();
for (Step step : steps) {
step.setRecipeId(recipe.getId());
}
insertSteps(steps);
insertRecipe(recipe);
}
@Transaction
@Query("SELECT * FROM Recipe WHERE id = :id")
public abstract RecipeFilter getRecipeById(int id);
@Query("DELETE FROM Ingredient WHERE recipeId = :recipeId")
public abstract int deleteIngredientsByRecipeId(final int recipeId);
// @Query("DELETE FROM Step WHERE recipeId = :recipeId")
// public abstract int deleteStepsByRecipeId(final int recipeId);
}
|
package pro.likada.service.serviceImpl;
import pro.likada.dao.DocumentDAO;
import pro.likada.dao.DriveStateDAO;
import pro.likada.model.Document;
import pro.likada.model.DriveState;
import pro.likada.service.DriveStateService;
import javax.inject.Inject;
import javax.inject.Named;
import javax.transaction.Transactional;
import java.util.List;
/**
* Created by bumur on 28.03.2017.
*/
@Named("driveStateService")
@Transactional
public class DriveStateServiceImpl implements DriveStateService {
@Inject
private DriveStateDAO driveStateDAO;
@Inject
private DocumentDAO documentDAO;
@Override
public DriveState findById(long id) {
return driveStateDAO.findById(id);
}
@Override
public void deleteById(Long id) {
driveStateDAO.deleteById(id);
}
@Override
public void save(DriveState driveState) {
driveStateDAO.save(driveState);
}
@Override
public List<DriveState> getAllDriveStates() {
return driveStateDAO.getAllDriveStates();
}
@Override
public Document findDriveStateDocument(DriveState driveState) {
List<Document> document = null;
document = documentDAO.findByParentTypeId(driveState.getId(),DriveState.class.getSimpleName());
if(document.size()>0)
return document.get(0);
else
return null;
}
}
|
package com.tscloud.common.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLDecoder;
public class HttpRequest {
private static Logger logger= LoggerFactory.getLogger(HttpRequest.class);
/**
*
* @param url
* @return
*/
public static String sendGet(String url) throws IOException{
logger.info("get请求的url:{}",URLDecoder.decode(url,"UTF-8"));
System.out.println(URLDecoder.decode(url,"UTF-8"));
String result = "";
URLConnection connection = null;
try {
URL realUrl = new URL(url);
// 打开和URL之间的连接
connection = realUrl.openConnection();
// 设置通用的请求属性
connection.setRequestProperty("accept", "*/*");
connection.setRequestProperty("connection", "Keep-Alive");
connection.setRequestProperty("user-agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
connection.setRequestProperty("Accept-Charset", "UTF-8");
// connection.setRequestProperty("Accept-Language","zh-CN,zh;q=0.9");
connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
// 建立实际的连接
connection.connect();
result = readStrByCode(connection.getInputStream(), "UTF-8");
} catch (IOException e) {
logger.error("发送GET请求出现异常!{}",e);
throw e;
}
return result;
}
/**
* 向指定URL发送GET方法的请求
* @param url 发送请求的URL
* @param params 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return URL 所代表远程资源的响应结果
*/
public static String sendGet(String url,String params) throws IOException {
if (url.indexOf("?")<0){
return sendGet(url + "?" + params);
}
return sendGet(url + "&" + params);
}
public static String readStrByCode(InputStream is, String code) {
StringBuilder builder = new StringBuilder();
BufferedReader reader = null;
String line = "";
try {
reader = new BufferedReader(new InputStreamReader(is, code));
while ((line = reader.readLine()) != null) {
builder.append(line);
}
} catch (Exception e) {
e.printStackTrace();
try {
reader.close();
} catch (IOException e1) {
e1.printStackTrace();
}
} finally {
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return builder.toString();
}
/**
* 向指定 URL 发送POST方法的请求
*
* @param url 发送请求的 URL
* @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
* @return 所代表远程资源的响应结果
*/
public static String sendPost(String url, String param) throws IOException {
logger.info("post请求的url:{}",url);
PrintWriter out = null;
BufferedReader in = null;
String resultMap = "";
try {
URL realUrl = new URL(url);
// 打开和URL之间的连接
URLConnection conn = realUrl.openConnection();
// 设置通用的请求属性
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
conn.setRequestProperty("Content-Type", "application/json; charset=utf-8");
// 发送POST请求必须设置如下两行
conn.setDoOutput(true);
conn.setDoInput(true);
// 获取URLConnection对象对应的输出流
out = new PrintWriter(conn.getOutputStream());
// 发送请求参数
out.print(param);
// flush输出流的缓冲
out.flush();
// 定义BufferedReader输入流来读取URL的响应
in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
resultMap += line;
}
} catch (IOException e) {
logger.error("发送 POST 请求出现异常!{}",e);
throw e;
}
//使用finally块来关闭输出流、输入流
finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
} catch (IOException ex) {
throw ex;
}
}
return resultMap;
}
public static void main(String[] args) {
String url="http://192.168.100.28:8008/?opt=adddata&address=广东省珠海市香洲区前山街道翠前新村&adcode=440402&level=6&x=113.51844874555556&y=22.268632811944443&type=170000";
try {
// URLEncoder.encode(url, "utf-8")
String result=sendGet(url);
JSONObject json=JSON.parseObject(result);
System.out.println(json);
} catch (Exception e) {
e.printStackTrace();
}
}
}
|
package download.service;
public interface DownLoadService {
/**
* 获取所有股票历史数据
*/
public void getYahooFinanceStockData();
/**
* 启动定时器下载
*/
public void startDownLoadJobThread();
}
|
package io.jrevolt.sysmon.client.ui;
import io.jrevolt.sysmon.model.ClusterDef;
import io.jrevolt.sysmon.model.EndpointStatus;
import io.jrevolt.sysmon.model.EndpointType;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import java.net.URI;
/**
* @author <a href="mailto:patrikbeno@gmail.com">Patrik Beno</a>
*/
public class Endpoint {
StringProperty cluster = new SimpleStringProperty();
StringProperty server = new SimpleStringProperty();
StringProperty artifact = new SimpleStringProperty();
ObjectProperty<URI> uri = new SimpleObjectProperty<>();
ObjectProperty<EndpointType> type = new SimpleObjectProperty<>();
ObjectProperty<EndpointStatus> status = new SimpleObjectProperty<>();
StringProperty comment = new SimpleStringProperty();
public String getCluster() {
return cluster.get();
}
public StringProperty clusterProperty() {
return cluster;
}
public void setCluster(String cluster) {
this.cluster.set(cluster);
}
public String getServer() {
return server.get();
}
public StringProperty serverProperty() {
return server;
}
public void setServer(String server) {
this.server.set(server);
}
public String getArtifact() {
return artifact.get();
}
public StringProperty artifactProperty() {
return artifact;
}
public void setArtifact(String artifact) {
this.artifact.set(artifact);
}
public URI getUri() {
return uri.get();
}
public ObjectProperty<URI> uriProperty() {
return uri;
}
public void setUri(URI uri) {
this.uri.set(uri);
}
public EndpointType getType() {
return type.get();
}
public ObjectProperty<EndpointType> typeProperty() {
return type;
}
public void setType(EndpointType type) {
this.type.set(type);
}
public EndpointStatus getStatus() {
return status.get();
}
public ObjectProperty<EndpointStatus> statusProperty() {
return status;
}
public void setStatus(EndpointStatus status) {
this.status.set(status);
}
public String getComment() {
return comment.get();
}
public StringProperty commentProperty() {
return comment;
}
public void setComment(String comment) {
this.comment.set(comment);
}
///
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Endpoint endpoint = (Endpoint) o;
if (artifact != null ? !artifact.equals(endpoint.artifact) : endpoint.artifact != null) return false;
if (!cluster.equals(endpoint.cluster)) return false;
if (!server.equals(endpoint.server)) return false;
if (!type.equals(endpoint.type)) return false;
if (!uri.equals(endpoint.uri)) return false;
return true;
}
@Override
public int hashCode() {
int result = cluster.hashCode();
result = 31 * result + server.hashCode();
result = 31 * result + (artifact != null ? artifact.hashCode() : 0);
result = 31 * result + uri.hashCode();
result = 31 * result + type.hashCode();
return result;
}
}
|
package com.javaorigin.test.apk;
import android.app.ActionBar;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.provider.MediaStore;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.TextView;
import android.widget.Toast;
import java.io.FileOutputStream;
public class PrefActivity extends Activity implements android.view.View.OnClickListener{
CheckBox check;
Button btn;
String blocked;
Button btn5;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
check = (CheckBox)findViewById(R.id.checkBox);
btn = (Button)findViewById(R.id.button);
btn5=(Button)findViewById(R.id.button5);
btn.setOnClickListener(this);
btn5.setOnClickListener(this);
}
@Override
public void onClick(View v){
if(v.getId()==R.id.button) {
if (check.isChecked()) {
Toast toast = Toast.makeText(this, "Please Uncheck Block All numbers to block a specific numbetr", Toast.LENGTH_LONG);
toast.show();
} else {
Intent intent = new Intent(this, BlockSepcific.class);
intent.putExtra("Radio", blocked);
startActivity(intent);
}
}
if(v.getId()==R.id.button5){
Intent intent = new Intent(this, SecondaryActivity.class);
startActivity(intent);
}
}
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
/*protected void onStart() {
super.onStart();
//getPrefs();
}
/*private void getPrefs() {
// we need to show the user's existing prefs, this isn't done
// automatically by the activity
SharedPreferences myprefs = getSharedPreferences("myBlocker", 0);
((CheckBoxPreference) findPreference("blockCalls")).setChecked(myprefs.getBoolean("blockCalls", false));
}*/
}
|
import java.util.Scanner;
class Lesson_33_Activity_One {
public static void upper(String[] x) {
for (int i = 0; i < x.length; i ++) {
x[i] = x[i].toUpperCase();
System.out.println(x[i]);
}
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String list[] = new String[10];
int c = 0;
for (int i = 0; i < list.length; i ++) {
list[i] = scan.nextLine();
}
upper(list);
}
}
|
package com.hfjy.framework.database.nosql;
import java.util.List;
import com.google.gson.JsonObject;
public interface DataAccess {
boolean save(JsonObject data);
boolean saveList(List<JsonObject> data);
long wipe(Condition condition);
JsonObject find();
JsonObject find(Condition condition);
List<JsonObject> findList();
List<JsonObject> findList(Condition condition);
List<JsonObject> findPage(int page, int size);
List<JsonObject> findPage(Condition condition, int page, int size);
long swop(Condition condition, JsonObject newData);
long size();
long size(Condition condition);
void lose();
}
|
package com.spreadtrum.android.eng;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
public class phonetest extends ListActivity {
static final String[] pts = new String[]{"Full phone test", "View phone test result", "Item test"};
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new ArrayAdapter(this, R.layout.list_item, pts));
ListView lv = getListView();
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
switch (i) {
case 2:
phonetest.this.startActivity(new Intent(phonetest.this.getApplicationContext(), wifitest.class));
break;
}
if (view instanceof TextView) {
Toast.makeText(phonetest.this.getApplicationContext(), ((TextView) view).getText(), 0).show();
}
}
});
}
}
|
package exam.iz0_803;
public class Exam_107 {
}
/*
Given the code fragment:
public static void main(String[] args) {
ArrayList<String> list = new ArrayList<>();
list.add("one");
list.add("two");
list.add("three");
list.remove(list.size() - 2);
System.out.println("This size is: " + list.size());
System.out.println("Values are: " + list);
}
What is the result?
A. This size is: 2
Values are: [one, three]
B. This size is: 2
Values are: [two, three]
C. This size is: 3
Values are: [one, three]
D. This size is: 4
Values are: [one, two]
E. This size is: 4
Values are: [one, three]
Answer: A
*/
|
import java.util.Scanner;
public class Fifteen {
public static void main(String[] args) {
// 15. 1~100 사이의 숫자 하나를 정한 뒤(랜덤으로 생성해도 됨), 10번 이내로 그 숫자를 맞추는 게임을 작성하시오.(10번 이내로 못 맞추었을 경우는 약간 머리가 딸리는 사람이므로 Game Over 처리를 신랄하게 해 주기 바람)
System.out.println("15번 문제");
int num, i, a;
num = 78;
i = 1;
Scanner input = new Scanner(System.in);
while(i<=10) {
System.out.println("숫자를 입력하시오 : ");
a = input.nextInt();
if(num<a) {
System.out.println("입력하신 숫자보다 작습니다");
i++;
}
else if(num>a) {
System.out.println("입력하신 숫자보다 큽니다");
i++;
}
else {
System.out.println("정답입니다");
System.out.println("=======프로그램 종료========");
break;
}
}
if(i>10) {
System.out.println("========Game Over========");
System.out.println("=======프로그램 종료========");
}
}
}
|
package DAO;
import java.util.ArrayList;
import models.PropostaTC;
import models.Serializar;
public class PropostaTCDAO implements DAO<PropostaTC>{
ArrayList<PropostaTC> lista = Serializar.load("listaPropostas.ser");
public boolean update(PropostaTC object, PropostaTC newObject) {
if(object.copy(newObject)){
Serializar.serializar("listaPropostas.ser", lista);
return true;
}
return false;
}
//search PropostaTC by title
@Override
public PropostaTC search(String title) {
for(PropostaTC i : lista) {
if (i.getTitulo().equals(title)) {
return i;
}
}
return null;
}
public ArrayList<PropostaTC> getLista() {
return lista;
}
@Override
public boolean add(PropostaTC object) {
if(lista.add(object)){
Serializar.serializar("listaPropostas.ser", lista);
return true;
}
return false;
}
@Override
public boolean remove(PropostaTC object) {
if(lista.remove(object)){
Serializar.serializar("listaPropostas.ser", lista);
return true;
}
return false;
}
}
|
package novoda.rest.cursors;
import java.io.IOException;
import novoda.rest.handlers.QueryHandler;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.ClientProtocolException;
// not used for now
public class CursorFactory {
private static final String APPLICATION_JSON = "application/json";
private static final String CONTENT_TYPE = "Content-Type";
public static QueryHandler<JsonCursor> create(String root) throws ClientProtocolException,
IOException {
return new JsonCursor(root);
}
public static boolean isJson(HttpResponse response) {
if (response.containsHeader(CONTENT_TYPE)
&& response.getFirstHeader(CONTENT_TYPE).equals(APPLICATION_JSON)) {
return true;
}
return false;
}
public static boolean isOK(HttpResponse response) {
if (response != null && response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
return true;
}
return false;
}
}
|
package com.nitnelave.CreeperHeal.block;
import org.bukkit.block.BlockState;
class CreeperPlate extends CreeperBlock
{
protected CreeperPlate(BlockState blockState)
{
super(blockState);
blockState.setRawData((byte) 0);
}
}
|
package br.com.ocjp7.concorrencia;
import java.util.ArrayList;
import java.util.Collections;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
public class MaxValueCollections {
ArrayList listArray = new ArrayList<>();
ReadWriteLock readWriteLock = new ReentrantReadWriteLock();
public void add(Integer i){
readWriteLock.writeLock().lock();
try {
listArray.add("valores");
} finally {
this.readWriteLock.readLock().unlock();
}
}
public int findMax(){
this.readWriteLock.readLock().lock();
try {
return Collections.max( listArray );
} finally {
readWriteLock.writeLock().unlock();
}
}
public static void main(String[] args) {
}
}
|
package com.wipro.HMS;
public abstract class HealthInsurancePlan {
// Code for 'coverage' field goes here
protected double coverage;
private InsuranceBrand offeredBy;
public InsuranceBrand getOfferedBy()
{
return offeredBy;
}
public void setOfferedBy(InsuranceBrand offeredBy)
{
this.offeredBy = offeredBy;
}
// Don't worry about the below code and also the InsuranceBrand class
public double getCoverage() {
return coverage;
}
public void setCoverage(double coverage) {
this.coverage = coverage;
}
public double computeMonthlyPremium(double salary, int age, boolean smoking) {
// TODO Auto-generated method stub
return 0;
}
}
|
package cs3500.singleMoveModel;
import java.util.Iterator;
import java.util.Stack;
/**
* Abstraction class over different singleMoveModel piles.
*/
abstract class APile extends Stack<Card> implements Pile {
/**
* Gives a String representation of each element in this Pile.
* @return String
*/
public String toString() {
StringBuilder state = new StringBuilder();
Card c;
Iterator<Card> it = this.iterator();
if (it.hasNext()) {
c = it.next();
state.append(c.toString());
}
while (it.hasNext()) {
c = it.next();
state.append(", ").append(c.toString());
}
return state.toString();
}
}
|
package com.zantong.mobilecttx.user.activity;
import android.content.Intent;
import com.zantong.mobilecttx.R;
import com.zantong.mobilecttx.base.activity.MvpBaseActivity;
import com.zantong.mobilecttx.common.Injection;
import com.zantong.mobilecttx.presenter.MegDetailAtyPresenter;
import com.zantong.mobilecttx.user.fragment.MegDetailFragment;
import com.zantong.mobilecttx.user.fragment.MegTypeFragment;
import cn.qqtheme.framework.util.AtyUtils;
/**
* 消息详情页面
*/
public class MegDetailActivity extends MvpBaseActivity {
/**
* 请求id
*/
private String messageDetailId;
@Override
protected int getContentResId() {
return R.layout.activity_base_frame;
}
@Override
protected void setTitleView() {
Intent intent = getIntent();
if (intent != null) {
String title = intent.getStringExtra("title");
messageDetailId = intent.getStringExtra("messageDetailId");
setTitleText(title);
}
}
@Override
protected void initMvPresenter() {
MegDetailFragment megDetailFragment =
(MegDetailFragment) getSupportFragmentManager().findFragmentById(R.id.lay_base_frame);
if (megDetailFragment == null) {
megDetailFragment = MegDetailFragment.newInstance(messageDetailId);
AtyUtils.addFragmentToActivity(
getSupportFragmentManager(), megDetailFragment, R.id.lay_base_frame);
}
MegDetailAtyPresenter mPresenter = new MegDetailAtyPresenter(
Injection.provideRepository(getApplicationContext()), megDetailFragment);
}
/**
* 前页面刷新
*/
public void setResultForRefresh() {
setResult(MegTypeFragment.MESSAGE_RESULT_CODE);
}
@Override
protected void onDestroy() {
super.onDestroy();
}
}
|
package phonebook;
import java.lang.reflect.Field;
/**
* Class representing a phone number.
* Structure mainly taken from Effective Java.
* @author jherwitz
*/
public final class PhoneNumber implements Comparable<PhoneNumber> {
private final Short areaCode;
private final Short prefix;
private final Short lineNumber;
/**
* Constructs a PhoneNumber object.
* @param areaCode The first three digits of the phone number.
* @param prefix Unintuitively, the middle three digits of the phone number.
* @param lineNumber The last four digits of the phone number.
*/
public PhoneNumber(int areaCode, int prefix, int lineNumber) {
PhoneNumber.rangeCheck(areaCode, 999, "area code");
PhoneNumber.rangeCheck(prefix, 999, "prefix");
PhoneNumber.rangeCheck(lineNumber, 9999, "line number");
this.areaCode = (short) areaCode;
this.prefix = (short) prefix;
this.lineNumber = (short) lineNumber;
}
/**
* Method which validates whether a given integer n satisfies the expression: 0 <= n <= max.
* Shamelessly taken from Effective Java.
* @param arg int to validate
* @param max maximum value for arg
* @param name name of value for exception messaging.
*/
private static void rangeCheck(int arg, int max, String name) {
if(arg < 0 || arg > max){
throw new IllegalArgumentException(name + ": " + arg);
}
}
/**
* Returns the hashcode of this object.
*/
@Override public int hashCode() {
int result = 17;
result = 31 * result + areaCode;
result = 31 * result + prefix;
result = 31 * result + lineNumber;
return result;
}
/**
* Method that generically generates this object's hashcode using reflection. Should be equivalent to hashCode().
* Could probably be generalized to other objects, but it requires private field access.
*/
public int genericHashCode(){
int result = 17;
Field[] fields = this.getClass().getDeclaredFields();
for(Field field : fields){
if(field.getType().isPrimitive()){
//todo
}
else{
try {
result = 31 * result + field.get(this).hashCode();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return result;
}
/**
* Returns the phone number in string form. This takes the form of "(XYX)-XYX-XXYX".
*/
@Override
public String toString() {
return String.format("(%03d)-%03d-%04d", areaCode, prefix, lineNumber);
}
/**
* Comparable method for two PhoneNumbers. Assumes precedence of areaCode > prefix > lineNumber.
* Modified from method in Effective Java.
*/
@Override
public int compareTo(PhoneNumber number) {
if(number == null){
throw new IllegalArgumentException("null paramter passed to compareTo");
}
int areaCodeDiff = areaCode - number.areaCode;
if(areaCodeDiff != 0) {
return areaCodeDiff;
}
int prefixDiff = prefix - number.prefix;
if(prefixDiff != 0) {
return prefixDiff;
}
return lineNumber - number.lineNumber;
}
/**
* Method which tests equality between two PhoneNumber objects.
* It adheres to the general contract for equals:
* <ul>
* <li> Reflexivity: x.equals(x) <-> true </li>
* <li> Symmetry: x.equals(x) <-> y.equals(x) </li>
* <li> Transitivity: x.equals(y) ^ y.equals(z) -> x.equals(z) </li>
* <li> Consistency: x(t).equals(y(t)) <-> x(t+1).equals(y(t+t))
* if x(t)=x(t+1) ^ y(t)=y(t+1) </li>
* </ul>
* These properties have been unit tested in tst/phonebook.PhoneNumberTests
*/
@Override
public boolean equals(Object o){
if(!(o instanceof PhoneNumber)){
return false;
}
PhoneNumber pn = (PhoneNumber) o;
return
areaCode.equals(pn.areaCode)
&& prefix.equals(pn.prefix)
&& lineNumber.equals(pn.lineNumber);
}
}
|
package com.zaiou.common.mybatis.po;
import java.io.Serializable;
import java.util.Date;
public class SysScheduleLog implements Po {
private Long id;
private String taskKey;
private String taskName;
private Date exeDate;
private Integer result;
private String remark;
private Date startTime;
private Date endTime;
private Date createTime;
private static final long serialVersionUID = 1L;
public SysScheduleLog(Long id, String taskKey, String taskName, Date exeDate, Integer result, String remark, Date startTime, Date endTime, Date createTime) {
this.id = id;
this.taskKey = taskKey;
this.taskName = taskName;
this.exeDate = exeDate;
this.result = result;
this.remark = remark;
this.startTime = startTime;
this.endTime = endTime;
this.createTime = createTime;
}
public SysScheduleLog() {
super();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTaskKey() {
return taskKey;
}
public void setTaskKey(String taskKey) {
this.taskKey = taskKey == null ? null : taskKey.trim();
}
public String getTaskName() {
return taskName;
}
public void setTaskName(String taskName) {
this.taskName = taskName == null ? null : taskName.trim();
}
public Date getExeDate() {
return exeDate;
}
public void setExeDate(Date exeDate) {
this.exeDate = exeDate;
}
public Integer getResult() {
return result;
}
public void setResult(Integer result) {
this.result = result;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
|
package com.bdqn.exception;
import com.bdqn.pojo.User;
/**
*@ClassName:业务异常通用的枚举
*@Description:
*@Author:lzq
*@Date: 2019/9/9 9:05
**/
public enum EnumBusinessError implements CommonError{
UNKNOWERROR(10001,"未知错误"),
USER_NOT_FOUND(20001,"用户未找到"),
ROLES_NOT_FOUND(30001,"用户角色数据未找到"),
;
private int errCode;//错误代码
private String errMsg;//错误描述
EnumBusinessError(int errCode, String errMsg) {
this.errCode = errCode;
this.errMsg = errMsg;
}
EnumBusinessError() {
}
public int getErrorCode() {
return this.errCode;
}
public String getErrMsg() {
return this.errMsg;
}
public CommonError setErrMsg(String errMsg) {
this.errMsg=errMsg;
return this;
}
public static void main(String[] args) {
// Object o=new User();
// o.toString();
// CommonError commonError=new EnumBusinessError(30000,"供应商信息错误");
// BusinessExcpetion businessExcpetion=new BusinessExcpetion(EnumBusinessError.UNKNOWERROR);
BusinessExcpetion businessExcpetion=new BusinessExcpetion(EnumBusinessError.USER_NOT_FOUND);
System.out.println( businessExcpetion.getErrMsg());
System.out.println( businessExcpetion.getErrorCode());
}
}
|
/*
* 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 fp.dam.gestiondeficheros;
import java.io.File;
/**
*
* @author manuel
*/
public class ClaseFile {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
//Ruta do directorio que queremos listar
String rutaDirectorio = ".";
//Devuelve un array de String con los nombres de ficheros y
//directorios asociados al objeto File.
File directorio = new File(rutaDirectorio);
String[] archivos = directorio.list();
System.out.printf("Ficheros del directorio %s : %d %n", rutaDirectorio, archivos.length);
//Recorremos todos los ficheros para imprimir su información
for (int i = 0; i < archivos.length; i++) {
File archivoAux = new File(rutaDirectorio, archivos[i]);
if (archivoAux.isFile()) {
System.out.printf("Archivo: %s %n", archivoAux.getName());
} else if (archivoAux.isDirectory()) {
System.out.printf("Directorio: %s %n", archivoAux.getName());
}
}
}
}
|
package stack;
public class ResizingArrayStackOfStrings implements StackOfStrings {
private String[] s;
private int N = 0;
public ResizingArrayStackOfStrings(int capacity){
s = new String[1];
}
@Override
public void push(String item) {
if (N == s.length) resize(2 * s.length);
s[N++] = item;
}
@Override
public String pop() {
String item = s[--N];
s[N] = null;
if (N > 0 && N == s.length/4) resize (s.length/2);
return item;
}
@Override
public boolean isEmpty() {
return N==0;
}
@Override
public int size() {
return N;
}
private void resize(int capacity)
{
String[] copy = new String[capacity];
for (int i = 0; i < N; i++){
copy[i] = s[i];
}
s = copy;
}
}
|
/*
* 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 com.mfs.datareward.apigw.config;
import com.elcom.util.miscellaneous.cfg.configloader.ConfigLoader;
import com.elcom.util.miscellaneous.cfg.configloader.ConfigObject;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* @author TrisTDT
*/
public class ConfigManager {
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigManager.class);
public ConfigManager() {
}
public static final String configFile = System.getProperty("user.dir") + File.separator + "etc" + File.separator + "dataRewardApiGW.cfg";
public static int param_nTimeOut;
public static String DB_URL;
public static String DB_User;
public static String DB_Pass;
public static String DBClassDriverName;
public ConfigLoader configLoader = null;
public String getDefaultContent() {
String content = "";
content += ""
+ "#Config File of module RequestRouter" + "\n"
+ "CONFIG: _" + "\n"
+ "Timeout = 10 _" + "\n"
+ "\n"
+ "LOG: _" + "\n"
+ "level = 1 _" + "\n"
+ "host = \"127.0.0.1\" _" + "\n"
+ "\n"
+ "DATABASE: _" + "\n"
+ "DBURL = \"jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=root)))\" _" + "\n"
+ "DBUser = \"autosms\" _" + "\n"
+ "DBPass = \"autosms\" _" + "\n"
+ "DBClassDriverName = \"oracle.jdbc.driver.OracleDriver\" _" + "\n"
+ "\n";
return content;
}
public void loadConfigFromFile() {
LOGGER.info("Need load config from: " + configFile);
try {
File file = new File(configFile);
if (!file.exists()) {
GenerateDefaultFile(getDefaultContent());
}
this.configLoader = new ConfigLoader();
this.configLoader.loadFile(configFile);
ConfigObject o_db = this.configLoader.findObject("DATABASE")[0];
DB_URL = getStringValue(o_db, "DBURL");
DB_User = getStringValue(o_db, "DBUser");
DB_Pass = getStringValue(o_db, "DBPass");
DBClassDriverName = getStringValue(o_db, "DBClassDriverName");
} catch (Exception e) {
// LOGGER.error("", e);
LOGGER.error("Can not load Config");
String message = e.toString();
StackTraceElement[] stack = e.getStackTrace();
for (StackTraceElement stack1 : stack) {
message += "\n" + stack1.toString();
}
LOGGER.error("Exception catched!\n" + message);
}
}
private String getStringValue(ConfigObject configObject, String key) throws Exception {
try {
String s = configObject.findParameter(key)[0].getValue();
LOGGER.info("----- " + key + " = " + s);
return s;
} catch (Exception e) {
LOGGER.error("Can not get: " + key + " from: " + configObject.getName());
throw new Exception();
}
}
private int getIntValue(ConfigObject configObject, String key) throws Exception {
try {
String s = getStringValue(configObject, key);
return Integer.parseInt(s);
} catch (Exception e) {
LOGGER.error("Can not get: " + key + " from: " + configObject.getName());
throw new Exception();
}
}
private double getDoubleValue(ConfigObject configObject, String key) throws Exception {
try {
String s = getStringValue(configObject, key);
return Double.parseDouble(s);
} catch (Exception e) {
LOGGER.error("Can not get: " + key + " from: " + configObject.getName());
throw new Exception();
}
}
private long getLongValue(ConfigObject configObject, String key) throws Exception {
try {
String s = getStringValue(configObject, key);
return Long.parseLong(s);
} catch (Exception e) {
LOGGER.error("Can not get: " + key + " from: " + configObject.getName());
throw new Exception();
}
}
private void GenerateDefaultFile(String defaultContent) {
FileOutputStream f = null;
try {
f = new FileOutputStream(ConfigManager.configFile);
} catch (FileNotFoundException e) {
} finally {
if (null != f) {
try {
f.write(defaultContent.getBytes());
} catch (IOException e) {
} finally {
try {
f.close();
} catch (IOException e) {
}
}
}
}
}
}
|
package uk.co.mtford.jalp.abduction.rules.visitor;
import uk.co.mtford.jalp.JALPException;
import uk.co.mtford.jalp.abduction.DefinitionException;
import uk.co.mtford.jalp.abduction.Store;
import uk.co.mtford.jalp.abduction.logic.instance.*;
import uk.co.mtford.jalp.abduction.logic.instance.constraints.ConstraintInstance;
import uk.co.mtford.jalp.abduction.logic.instance.constraints.InListConstraintInstance;
import uk.co.mtford.jalp.abduction.logic.instance.constraints.NegativeConstraintInstance;
import uk.co.mtford.jalp.abduction.logic.instance.equalities.EqualityInstance;
import uk.co.mtford.jalp.abduction.logic.instance.equalities.InEqualityInstance;
import uk.co.mtford.jalp.abduction.logic.instance.term.ConstantInstance;
import uk.co.mtford.jalp.abduction.logic.instance.term.ListInstance;
import uk.co.mtford.jalp.abduction.logic.instance.term.VariableInstance;
import uk.co.mtford.jalp.abduction.rules.*;
import java.util.*;
/**
* Interface defining the types of nodes that a RuleNodeVisitor must be capable of visiting and applying state rewriting
* rules to.
*/
public interface IRuleNodeVisitor {
public void visit(A1RuleNode ruleNode);
public void visit(A2RuleNode ruleNode);
public void visit(D1RuleNode ruleNode);
public void visit(D2RuleNode ruleNode);
public void visit(E1RuleNode ruleNode);
public void visit(InE1RuleNode ruleNode);
public void visit(E2RuleNode ruleNode);
public void visit(E2bRuleNode ruleNode);
public void visit(E2cRuleNode ruleNode);
public void visit(InE2RuleNode ruleNode);
public void visit(N1RuleNode ruleNode);
public void visit(N2RuleNode ruleNode);
public void visit(F1RuleNode ruleNode);
public void visit(F2RuleNode ruleNode);
public void visit(F2bRuleNode ruleNode);
public void visit(PositiveTrueRuleNode ruleNode);
public void visit(NegativeTrueRuleNode ruleNode);
public void visit(PositiveFalseRuleNode ruleNode);
public void visit(NegativeFalseRuleNode ruleNode);
public void visit(LeafRuleNode ruleNode);
}
|
package me.ewriter.rxgank;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
import me.ewriter.rxgank.adapter.SimpeFragmentAdapter;
import me.ewriter.rxgank.api.ApiManager;
import me.ewriter.rxgank.api.entity.GankData;
import me.ewriter.rxgank.api.entity.GankItem;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Func1;
import rx.schedulers.Schedulers;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* to handle interaction events.
* Use the {@link SimpleFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class SimpleFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
private RecyclerView mRecyclerView;
private SimpeFragmentAdapter adapter;
private List<GankItem> mTitleList;
private LinearLayoutManager mLayoutManager;
int page = 1;
public SimpleFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment SimpleFragment.
*/
// TODO: Rename and change types and number of parameters
public static SimpleFragment newInstance(String param1, String param2) {
SimpleFragment fragment = new SimpleFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_simple, container, false);
}
@Override
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
mTitleList = new ArrayList<>();
adapter = new SimpeFragmentAdapter(getActivity(), mTitleList);
mRecyclerView.setAdapter(adapter);
mLayoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
mRecyclerView.setLayoutManager(mLayoutManager);
loadData();
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
// 当前可见item 数量
int visibleItemCount = recyclerView.getLayoutManager().getChildCount();
// 总共 item
int totalItemCount = recyclerView.getLayoutManager().getItemCount();
//第一个可见的position,这个方法必须要转换成指定的LayoutManager
int firstItemPosition = mLayoutManager.findFirstVisibleItemPosition();
if (visibleItemCount + firstItemPosition >= totalItemCount) {
// Toast.makeText(getActivity(), "到达底部", Toast.LENGTH_SHORT).show();
loadData();
}
Log.d("SimpleFragment", "visibleItemCount = " + visibleItemCount +
"; totalItemCount = " + totalItemCount + ";firstItemPosition = " + firstItemPosition);
}
});
}
private void loadData() {
String type = "";
if (mParam1.equals("0")) {
type = ApiManager.CATEGORY_ANDROID;
} else if (mParam1.equals("1")) {
type = ApiManager.CATEGORY_IOS;
}
// ApiManager.getsGankApi().getGankData(type, page)
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .map(new Func1<GankData, List<GankItem>>() {
// @Override
// public List<GankItem> call(GankData gankData) {
// return gankData.getResults();
// }
// })
// .subscribe(new Subscriber<List<GankItem>>() {
// @Override
// public void onCompleted() {
//
// }
//
// @Override
// public void onError(Throwable e) {
//
// }
//
// @Override
// public void onNext(List<GankItem> gankItems) {
// mTitleList.addAll(gankItems);
// adapter.notifyDataSetChanged();
// }
// });
// 这种请求和上面是相同的,只是一个直接处理成 List,然后addAll, 下面是拆分成 item 再添加
ApiManager.getsGankApi().getGankData(type, page)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.map(new Func1<GankData, List<GankItem>>() {
@Override
public List<GankItem> call(GankData gankData) {
return gankData.getResults();
}
})
.flatMap(new Func1<List<GankItem>, rx.Observable<GankItem>>() {
@Override
public rx.Observable<GankItem> call(List<GankItem> gankItems) {
return rx.Observable.from(gankItems);
}
})
.subscribe(new Subscriber<GankItem>() {
@Override
public void onCompleted() {
page++;
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(GankItem gankItem) {
mTitleList.add(gankItem);
adapter.notifyItemInserted(mTitleList.size() - 1);
}
});
}
}
|
package com.gaoshin.onsalelocal.slocal.entity;
import javax.persistence.Entity;
import javax.persistence.Table;
import common.db.entity.DbEntity;
@Entity
@Table
public class Deal extends DbEntity {
private Long dateAdded;
private Long endDate;
private String active;
private Integer discount;
private Integer price;
private Integer value;
private String title;
private String url;
private String smallImage;
private String largeImage;
private String divisionId;
private String tags;
private String businessId;
private String source;
public Long getDateAdded() {
return dateAdded;
}
public void setDateAdded(Long dateAdded) {
this.dateAdded = dateAdded;
}
public Long getEndDate() {
return endDate;
}
public void setEndDate(Long endDate) {
this.endDate = endDate;
}
public String getActive() {
return active;
}
public void setActive(String active) {
this.active = active;
}
public Integer getDiscount() {
return discount;
}
public void setDiscount(Integer discount) {
this.discount = discount;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public Integer getValue() {
return value;
}
public void setValue(Integer value) {
this.value = value;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getSmallImage() {
return smallImage;
}
public void setSmallImage(String smallImage) {
this.smallImage = smallImage;
}
public String getLargeImage() {
return largeImage;
}
public void setLargeImage(String largeImage) {
this.largeImage = largeImage;
}
public String getDivisionId() {
return divisionId;
}
public void setDivisionId(String divisionId) {
this.divisionId = divisionId;
}
public String getTags() {
return tags;
}
public void setTags(String tags) {
this.tags = tags;
}
public String getBusinessId() {
return businessId;
}
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
}
|
package io.github.satr.aws.lambda.bookstore.repositories;
// Copyright © 2022, github.com/satr, MIT License
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBScanExpression;
import com.amazonaws.services.dynamodbv2.model.AttributeValue;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public abstract class AbstractRepository {
protected final DynamoDBMapper dbMapper;
public AbstractRepository(DynamoDBMapper dbMapper) {
this.dbMapper = dbMapper;
}
protected <T> List<T> scan(Class<T> type, String filterExpression, Map<String, AttributeValue> expressionValueMap) {
DynamoDBScanExpression scanExpression = new DynamoDBScanExpression()
.withFilterExpression(filterExpression)
.withExpressionAttributeValues(expressionValueMap);
return dbMapper.scan(type, scanExpression);
}
protected <T> List<T> scan(Class<T> type, String name, String value) {
String attrValue = ":v_attr";
String filterExpression = String.format("%s=%s", name, attrValue);
Map<String, AttributeValue> expressionValueMap = new HashMap<>();
expressionValueMap.put(attrValue, new AttributeValue().withS(value));
return scan(type, filterExpression, expressionValueMap);
}
}
|
package lotro.web;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ParseForum
{
private static final String INPUT_PATH = "C:/pkgs/workspace/LOTRO/LOTRO-coords.txt";
private static final String OUTPUT_PATH = "C:/pkgs/workspace/LOTRO/sql/LOTRO2.";
private static final String LOC_REGEX = "([0-9]+[.][0-9][NS],? *[0-9]+[.][0-9][EW]) *";
private static final Pattern ENTRY_PATTERN =
Pattern.compile ("(?:[-]: )?([-A-Za-z '&()]+):? [(]?" + LOC_REGEX + "[)]?");
private static final Pattern REGION_PATTERN = Pattern.compile ("[A-Z][-A-Za-z ']+");
private List<Entry> entries = new ArrayList<Entry>();
private PrintStream sql = null;
private PrintStream wiki = null;
public ParseForum()
{
try
{
sql = new PrintStream (new FileOutputStream (OUTPUT_PATH + "sql"));
wiki = new PrintStream (new FileOutputStream (OUTPUT_PATH + "wiki"));
read (INPUT_PATH);
Collections.sort (entries);
writeSQL();
writeWiki();
}
catch (Exception x)
{
System.out.println (x);
x.printStackTrace();
}
finally
{
if (sql != null)
{
sql.println ("\ndisconnect;\n");
sql.flush();
sql.close();
}
if (wiki != null)
{
wiki.flush();
wiki.close();
}
}
}
private void writeSQL()
{
sql.println ("connect Demo;\n");
sql.println ("drop table LOTRO;");
sql.println ("create table LOTRO (\n" +
" Region VARCHAR,\n" +
" Locale VARCHAR,\n" +
" Symbol VARCHAR,\n" +
" Landmark VARCHAR,\n" +
" Location VARCHAR,\n" +
" Notes VARCHAR);\n");
StringBuffer sb = new StringBuffer();
for (Entry entry : entries)
{
sb.setLength (0);
sb.append ("insert into LOTRO values (");
sb.append (quoteValue (entry.region) + ", ");
sb.append (quoteValue (entry.locale) + ", ");
sb.append (quoteValue (entry.symbol) + ", ");
sb.append (quoteValue (entry.name) + ", ");
sb.append (quoteValue (entry.location) + ", ");
sb.append ("'');");
sql.println (sb.toString());
}
}
private void writeWiki()
{
String prevRegion = null;
String prevLocale = null;
for (Entry entry : entries)
{
if (!entry.locale.equals (prevLocale))
{
if (!entry.region.equals (prevRegion))
{
wiki.println ("<br>\n");
wiki.println ("== [[" + entry.region + "]] ==");
prevRegion = entry.region;
}
wiki.println ("=== [[" + entry.locale + "]] ===");
prevLocale = entry.locale;
}
wiki.println ("* [[" + entry.name + "]] - " + entry.location);
}
}
public void read (final String address)
{
System.out.println ("\nReading: " + address);
try
{
InputStreamReader isr = null;
if (new File (address).exists())
isr = new FileReader (address);
if (isr == null)
{
System.out.println ("Unable to open: " + address);
return;
}
BufferedReader br = new BufferedReader (isr);
String line;
String region = null;
String locale = null;
while ((line = br.readLine()) != null)
{
line = line.trim();
if (line.length() == 0)
{
if (region == null)
region = locale;
continue;
}
Matcher m = ENTRY_PATTERN.matcher (line);
if (m.matches())
{
String place = m.group (1);
String coord = m.group (2);
addEntry (region, locale, place, coord);
}
else if (line.startsWith ("-: "))
// System.out.println ("? [" + line + "]");
continue;
else if (line.startsWith ("---"))
{
// System.out.println ("Clearing region");
region = null;
locale = null;
}
else if (REGION_PATTERN.matcher (line).matches())
{
locale = line;
// System.out.println ("Locale: [" + locale + "]");
}
else
System.out.println ("? [" + line + "]");
}
br.close();
}
catch (Exception x)
{
System.out.println (x);
x.printStackTrace();
}
}
private static String quoteValue (final String value)
{
if (value == null)
return "''";
return "'" + value.replaceAll ("'", "''") + "'";
}
void addEntry (final String region, final String locale,
final String name, final String location)
{
Entry entry = new Entry();
entry.region = region;
entry.locale = locale;
entry.symbol = getSymbol (name.toLowerCase());
entry.name = name;
entry.location = location;
entries.add (entry);
}
private String getSymbol (final String name)
{
if (name.contains ("bank")) return "Bank";
if (name.contains ("vault")) return "Bank";
if (name.contains ("bard")) return "Bard";
if (name.contains ("fields")) return "Crops";
if (name.contains ("farm")) return "Farm";
if (name.contains ("flower")) return "Flower";
if (name.contains ("forge")) return "Forge";
if (name.contains ("mailbox")) return "Mailbox";
if (name.contains ("oven")) return "Oven";
if (name.contains ("provisioner")) return "Provisioner";
if (name.contains ("stable")) return "Stable";
if (name.contains ("trainer")) return "Trainer";
if (name.contains ("workbench")) return "Workbench";
return "LOTRO";
}
class Entry implements Comparable<Entry>
{
private String region;
private String locale;
private String symbol;
private String name;
private String location;
@Override
public String toString()
{
return region + ":" + locale + ":" + name + ":" + location;
}
public int compareTo (final Entry other)
{
return toString().compareTo (other.toString());
}
}
public static void main (final String[] args) throws Exception
{
new ParseForum();
}
}
|
/*
* 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 org.rdcit.tools;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
* @author sa841
*/
public class Strings {
public static String replaceLast(String s, String reglex, String replacement) {
int lastIndex = s.lastIndexOf(reglex);
s = s.substring(0, lastIndex);
s = s.concat(replacement);
return s;
}
public static Object[] splitWithEscape(String s, String reglex, String escape) {
String ar[] = s.split(reglex);
ArrayList<String> arResult = new ArrayList<>();
for (int i = 0; i < ar.length; i++) {
String sTmp = ar[i];
while (ar[i].endsWith(escape)) {
sTmp = sTmp.replace(escape, "").concat("," + ar[i + 1].replace(escape, ""));
i++;
}
arResult.add(sTmp);
}
return arResult.toArray();
}
public static String[] splitFirst(String s, String reglex) {
String[] res = new String[2];
int indexFirst = s.indexOf(reglex);
res[0] = startTrim(s.substring(0, indexFirst));
res[1] = startTrim(s.substring(indexFirst, s.length()).replaceFirst(reglex, ""));
return res;
}
public static String replaceEscape(String s, String oldEscape, String newEscape) {
if (s.contains(oldEscape)) {
s = s.replaceAll(oldEscape, newEscape);
}
return s;
}
public static String endTrim(String s) {
while (s.endsWith(" ")) {
s = replaceLast(s, " ", "");
}
return s;
}
public static String startTrim(String s) {
while (s.startsWith(" ")) {
s = s.replaceFirst(" ", "");
}
return s;
}
public static boolean notEmpty(String s) {
return s.matches(".*\\w.*");
}
public static String extractFromPattern(String s, String beginPattern, String endPattern) {
if (!s.startsWith(beginPattern)) {
s = s.substring(s.indexOf(beginPattern), s.length());
}
s = s.substring(beginPattern.length(), s.length());
if (!s.endsWith(endPattern)) {
s = s.substring(0, s.indexOf(endPattern));
} else {
s = s.substring(0, s.length() - 1);
}
return s;
}
public static String putIntoPattern(String s, String beginPattern, String endPattern) {
return beginPattern + s + endPattern;
}
public static boolean patternTester(String pattern, String s) {
Pattern p = Pattern.compile(pattern);
Matcher m = p.matcher(s.replaceAll("\\s", ""));
return m.matches();
}
public static String format(String s) {
return s.replaceAll("[^\\w]", "");
}
}
|
package com.lovers.java.mapper;
import com.lovers.java.domain.LoversIncident;
import com.lovers.java.domain.LoversIncidentExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface LoversIncidentMapper{
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table lovers_incident
*
* @mbg.generated Wed Sep 25 10:59:33 CST 2019
*/
long countByExample(LoversIncidentExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table lovers_incident
*
* @mbg.generated Wed Sep 25 10:59:33 CST 2019
*/
int deleteByExample(LoversIncidentExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table lovers_incident
*
* @mbg.generated Wed Sep 25 10:59:33 CST 2019
*/
int deleteByPrimaryKey(Integer incidentId);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table lovers_incident
*
* @mbg.generated Wed Sep 25 10:59:33 CST 2019
*/
int insert(LoversIncident record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table lovers_incident
*
* @mbg.generated Wed Sep 25 10:59:33 CST 2019
*/
int insertSelective(LoversIncident record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table lovers_incident
*
* @mbg.generated Wed Sep 25 10:59:33 CST 2019
*/
List<LoversIncident> selectByExample(LoversIncidentExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table lovers_incident
*
* @mbg.generated Wed Sep 25 10:59:33 CST 2019
*/
LoversIncident selectByPrimaryKey(Integer incidentId);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table lovers_incident
*
* @mbg.generated Wed Sep 25 10:59:33 CST 2019
*/
int updateByExampleSelective(@Param("record") LoversIncident record, @Param("example") LoversIncidentExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table lovers_incident
*
* @mbg.generated Wed Sep 25 10:59:33 CST 2019
*/
int updateByExample(@Param("record") LoversIncident record, @Param("example") LoversIncidentExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table lovers_incident
*
* @mbg.generated Wed Sep 25 10:59:33 CST 2019
*/
int updateByPrimaryKeySelective(LoversIncident record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table lovers_incident
*
* @mbg.generated Wed Sep 25 10:59:33 CST 2019
*/
int updateByPrimaryKey(LoversIncident record);
}
|
package com.example.canalu.ui.orders.details;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
import com.example.canalu.model.Orders;
import com.example.canalu.model.OrdersDetails;
import com.example.canalu.request.ApiClient;
import java.util.ArrayList;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class OrdersDetailsViewModel extends ViewModel {
private MutableLiveData<ArrayList<OrdersDetails>> orders;
private MutableLiveData<String> error;
private MutableLiveData<String> totalAmount;
private MutableLiveData<String> dateOreder;
public LiveData<ArrayList<OrdersDetails>> getOrdersDetails(){
if(orders == null){
orders = new MutableLiveData<ArrayList<OrdersDetails>>();
}
return orders;
}
public LiveData<String> getError(){
if(error == null){
error = new MutableLiveData<>();
}
return error;
}
public LiveData<String> getTotalAmount(){
if(totalAmount == null){
totalAmount = new MutableLiveData<>();
}
return totalAmount;
}
public void updateOrdersDetails(){
}
public void setOrdersDetails(ArrayList<OrdersDetails> ordersDetails){
orders.setValue(ordersDetails);
double total=0;
for (OrdersDetails i: ordersDetails) {
total += i.getOrdersDetailsTotalProducts()*i.getProducts().getProductsUnitPrice();
}
totalAmount.setValue(total+"");
}
public void getDateOrder(){}
}
|
package com.triview.demo.gateway;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableOAuth2Client;
import org.springframework.security.oauth2.provider.error.OAuth2AccessDeniedHandler;
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true, proxyTargetClass = true)
public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(final HttpSecurity http) throws Exception {
http
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeRequests()
.antMatchers("/api/login").permitAll()
.antMatchers("/api/register").permitAll()
.antMatchers("/api/**").authenticated()
.anyRequest().authenticated()
.and()
.formLogin().permitAll()
.and().exceptionHandling().accessDeniedHandler(new OAuth2AccessDeniedHandler());
}
}
|
package com.opentangerine.genotype.html;
import com.sun.media.sound.FFT;
import org.apache.commons.lang3.StringUtils;
import org.hamcrest.MatcherAssert;
import org.hamcrest.Matchers;
import org.jsoup.Jsoup;
import org.junit.Test;
import java.util.stream.Stream;
import static com.opentangerine.genotype.html.Wizard.*;
import static com.opentangerine.genotype.html.Wizard.strong;
/**
* @author Grzegorz Gajos
*/
public class HtmlTest {
@Test
public void example() {
Stream<String> arrays = Stream.of("1", "2");
String html = div.classAttr("large-12 columns").in(
div.id("333"),
div.classAttr("logo-img"),
h1.in("Heading"),
a.href("http://google.com/"),
h2.id("4asd").src("asokdvamsoka").in("Heading"),
div.classAttr("inline-list sub-header-info").in(
ul.classAttr("inline-list sub-header-info").in(
li.in(
strong.in("JAVA"),
strong.in("AI"),
strong.in("NLP"),
strong.in("BIG DATA")
)
)
),
ul.classAttr("x-inline-list").in(
li.in(
arrays.map(strong::in)
)
)
).render();
html = Jsoup.parseBodyFragment(html).body().html();
MatcherAssert.assertThat(
html,
Matchers.equalToIgnoringWhiteSpace(StringUtils.join(
" <div class=\"large-12 columns\">",
" <div id=\"333\"></div>",
" <div class=\"logo-img\"></div>",
" <h1>Heading</h1>",
" <a href=\"http://google.com/\"></a>",
" <h2 id=\"4asd\" src=\"asokdvamsoka\">Heading</h2>",
" <div class=\"inline-list sub-header-info\">",
" <ul class=\"inline-list sub-header-info\">",
" <li><strong>JAVA</strong><strong>AI</strong><strong>NLP</strong><strong>BIG DATA</strong></li>",
" </ul>",
" </div>",
" <ul class=\"x-inline-list\">",
" <li><strong>1</strong><strong>2</strong></li>",
" </ul>",
" </div>"
))
);
}
@Test
public void strong() {
MatcherAssert.assertThat(
strong.in("123").render(),
Matchers.equalToIgnoringWhiteSpace("<strong>123</strong>")
);
}
@Test
public void div() {
MatcherAssert.assertThat(
div.id("333").render(),
Matchers.equalToIgnoringWhiteSpace("<div id=\"333\"></div>")
);
}
@Test
public void divWithContent() {
MatcherAssert.assertThat(
div.id("333").in("content").render(),
Matchers.equalToIgnoringWhiteSpace("<div id=\"333\">content</div>")
);
}
@Test
public void divWithNestedDiv() {
MatcherAssert.assertThat(
div.id("333").in(
div.id("nest1").in("n1"),
div.id("nest2").in("n2")
).render(),
Matchers.equalToIgnoringWhiteSpace("<div id=\"333\">" +
"<div id=\"nest1\">n1</div>" +
"<div id=\"nest2\">n2</div>" +
"</div>"
)
);
}
@Test
public void emptyDiv() {
MatcherAssert.assertThat(
div.render(),
// FIXME GG: in progress, div should have content (check all tags)
Matchers.equalToIgnoringWhiteSpace("<div></div>")
);
}
@Test
public void emptyOptgroup() {
MatcherAssert.assertThat(
optgroup.render(),
Matchers.equalToIgnoringWhiteSpace("<optgroup></optgroup>")
);
}
@Test
public void customAttrWithoutValue() {
MatcherAssert.assertThat(
optgroup.attr("itemscope").render(),
Matchers.equalToIgnoringWhiteSpace("<optgroup itemscope></optgroup>")
);
}
@Test
// FIXME GG: in progress,
public void checkThatCustomElementWithoutParentCanBeRendered() {
MatcherAssert.assertThat(
nil.in("content").render(),
Matchers.equalToIgnoringWhiteSpace("content")
);
}
@Test
// FIXME GG: in progress,
public void checkThatCustomElementHeaderWithoutParentCanBeRendered() {
MatcherAssert.assertThat(
nil.in(
nil.in("<DOCTYPE!>"),
html.in("anything")
).render(),
Matchers.equalToIgnoringWhiteSpace("<DOCTYPE!><html>anything</html>")
);
}
@Test
public void autocloseTagIfNoContent() {
MatcherAssert.assertThat(
ul.href("//ggajos.com").render(),
Matchers.equalTo("<ul href=\"//ggajos.com\"></ul>")
);
}
@Test
public void doNotAutocloseTagIfForSpecialTags() {
MatcherAssert.assertThat(
base.href("//ggajos.com").render(),
Matchers.equalTo("<base href=\"//ggajos.com\">")
);
}
@Test
public void exampleMeta() {
MatcherAssert.assertThat(
meta.name("viewport").content("width=device-width, initial-scale=1.0").render(),
Matchers.equalTo("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">")
);
}
}
|
/*
* Copyright 2002-2022 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
*
* https://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.springframework.web.reactive.function.server;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import reactor.core.publisher.Mono;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.lang.Nullable;
import org.springframework.util.CollectionUtils;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.reactive.result.view.View;
import org.springframework.web.reactive.result.view.ViewResolver;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.testfixture.http.server.reactive.bootstrap.HttpServer;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.web.reactive.function.server.HandlerFilterFunction.ofResponseProcessor;
import static org.springframework.web.reactive.function.server.RequestPredicates.GET;
import static org.springframework.web.reactive.function.server.RouterFunctions.route;
/**
* @author Arjen Poutsma
* @since 5.0
*/
class RenderingResponseIntegrationTests extends AbstractRouterFunctionIntegrationTests {
private final RestTemplate restTemplate = new RestTemplate();
@Override
protected RouterFunction<?> routerFunction() {
RenderingResponseHandler handler = new RenderingResponseHandler();
RouterFunction<RenderingResponse> normalRoute = route(GET("/normal"), handler::render);
RouterFunction<RenderingResponse> filteredRoute = route(GET("/filter"), handler::render)
.filter(ofResponseProcessor(
response -> RenderingResponse.from(response)
.modelAttribute("qux", "quux")
.build()));
return normalRoute.and(filteredRoute);
}
@Override
protected HandlerStrategies handlerStrategies() {
return HandlerStrategies.builder()
.viewResolver(new DummyViewResolver())
.build();
}
@ParameterizedHttpServerTest
void normal(HttpServer httpServer) throws Exception {
startServer(httpServer);
ResponseEntity<String> result =
restTemplate.getForEntity("http://localhost:" + port + "/normal", String.class);
assertThat(result.getStatusCode()).isEqualTo(HttpStatus.OK);
Map<String, String> body = parseBody(result.getBody());
assertThat(body).hasSize(2);
assertThat(body.get("name")).isEqualTo("foo");
assertThat(body.get("bar")).isEqualTo("baz");
}
@ParameterizedHttpServerTest
void filter(HttpServer httpServer) throws Exception {
startServer(httpServer);
ResponseEntity<String> result =
restTemplate.getForEntity("http://localhost:" + port + "/filter", String.class);
assertThat(result.getStatusCode()).isEqualTo(HttpStatus.OK);
Map<String, String> body = parseBody(result.getBody());
assertThat(body).hasSize(3);
assertThat(body.get("name")).isEqualTo("foo");
assertThat(body.get("bar")).isEqualTo("baz");
assertThat(body.get("qux")).isEqualTo("quux");
}
private Map<String, String> parseBody(String body) {
String[] lines = body.split("\\n");
Map<String, String> result = CollectionUtils.newLinkedHashMap(lines.length);
for (String line : lines) {
int idx = line.indexOf('=');
String key = line.substring(0, idx);
String value = line.substring(idx + 1);
result.put(key, value);
}
return result;
}
private static class RenderingResponseHandler {
public Mono<RenderingResponse> render(ServerRequest request) {
return RenderingResponse.create("foo")
.modelAttribute("bar", "baz")
.build();
}
}
private static class DummyViewResolver implements ViewResolver {
@Override
public Mono<View> resolveViewName(String viewName, Locale locale) {
return Mono.just(new DummyView(viewName));
}
}
private static class DummyView implements View {
private final String name;
public DummyView(String name) {
this.name = name;
}
@Override
public List<MediaType> getSupportedMediaTypes() {
return Collections.singletonList(MediaType.TEXT_PLAIN);
}
@Override
public Mono<Void> render(@Nullable Map<String, ?> model, @Nullable MediaType contentType,
ServerWebExchange exchange) {
StringBuilder builder = new StringBuilder();
builder.append("name=").append(this.name).append('\n');
for (Map.Entry<String, ?> entry : model.entrySet()) {
builder.append(entry.getKey()).append('=').append(entry.getValue()).append('\n');
}
builder.setLength(builder.length() - 1);
byte[] bytes = builder.toString().getBytes(StandardCharsets.UTF_8);
ServerHttpResponse response = exchange.getResponse();
DataBuffer buffer = response.bufferFactory().wrap(bytes);
response.getHeaders().setContentType(MediaType.TEXT_PLAIN);
return response.writeWith(Mono.just(buffer));
}
}
}
|
package com.vipvideo.api;
import android.util.SparseArray;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.lixh.rxhttp.ApiFactory;
import com.lixh.rxhttp.convert.JsonConverterFactory;
import com.vipvideo.util.web.mahua.AesUtil;
import com.vipvideo.util.web.mahua.HeaderInfo;
import com.vipvideo.util.web.mahua.MhSdk;
import com.vipvideo.util.web.mahua.RHelp;
import okhttp3.Headers;
import okhttp3.HttpUrl;
import okhttp3.Request;
import static com.vipvideo.api.BasicParamsInterceptor.Builder;
/**
* Api Retrofit build
*/
public class Api {
private static SparseArray<Api> sRetrofitManager = new SparseArray<>(HostType.TYPE_COUNT);
public ApiService apiService;
//构造方法私有
private Api(int hostType) {
BasicParamsInterceptor paramsInterceptor = new Builder().addIntercept(this::resetRequest).build();
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").serializeNulls().create();
apiService = ApiFactory.INSTANCE.createApi(ApiConstants.getHost(hostType), ApiService.class, JsonConverterFactory.create(gson), paramsInterceptor);
}
private Request resetRequest(Request request) {
HttpUrl url = request.url();
switch (url.host()) {
case "api.hbzjmf.com":
return getApiHbzRequest(request);
default:
return request;
}
}
private Request getApiHbzRequest(Request request) {
HttpUrl.Builder httpUrl = request.url().newBuilder();
Request.Builder requestBuilder = request.newBuilder();
Headers.Builder header = request.headers().newBuilder();
String encryptToHex = AesUtil.encryptToHex(MhSdk.init().getAppInfo().getEncryptPackageId(), AesUtil.getKey(true));
String path = request.url().url().getPath();
StringBuilder stringBuilder2 = new StringBuilder();
stringBuilder2.append(path);
stringBuilder2.append(MhSdk.init().getAppInfo().getTerminal());
stringBuilder2.append("/");
stringBuilder2.append(RHelp.getPackageId());
path = stringBuilder2.toString();
HeaderInfo createHeaderInfo = MhSdk.init().getAppInfo().createHeaderInfo(path);
header.add("Accept", "application/json");
header.add("Content-Type", "application/json");
header.add("accessToken", encryptToHex);
header.add("X-Client-NonceStr", createHeaderInfo.getXClientNonceStr());
header.add("X-Client-IP", createHeaderInfo.getXClientIP());
header.add("X-Client-TimeStamp", createHeaderInfo.getXClientTimeStamp());
header.add("X-Client-Version", createHeaderInfo.getXClientVersion());
header.add("X-Client-Sign", createHeaderInfo.getXClientSign());
header.add("X-Auth-Token", createHeaderInfo.getXAuthToken());
if (request.method().equals("GET")) {
httpUrl.addPathSegment(MhSdk.init().getAppInfo().getTerminal()).addPathSegments(RHelp.getPackageId());
httpUrl.addQueryParameter("time", System.currentTimeMillis() + "");
request = requestBuilder.url(httpUrl.build()).headers(header.build()).build();
}
return request;
}
public static ApiService getDefault() {
return getDefault(1);
}
/**
* @param hostType
*/
public static ApiService getDefault(int hostType) {
Api retrofitManager = sRetrofitManager.get(hostType);
if (retrofitManager == null) {
retrofitManager = new Api(hostType);
sRetrofitManager.put(hostType, retrofitManager);
}
return retrofitManager.apiService;
}
}
|
/**
*/
package iso20022.impl;
import java.io.IOException;
import java.net.URL;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.common.util.WrappedException;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.impl.EPackageImpl;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
import iso20022.Iso20022Factory;
import iso20022.Iso20022Package;
/**
* <!-- begin-user-doc -->
* An implementation of the model <b>Package</b>.
* <!-- end-user-doc -->
* @generated
*/
public class Iso20022PackageImpl extends EPackageImpl implements Iso20022Package {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected String packageFilename = "iso20022.ecore";
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass addressEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass modelEntityEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass broadcastListEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass messagingEndpointEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass messageTransportSystemEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass transportMessageEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass messageInstanceEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass syntaxMessageSchemeEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass topLevelCatalogueEntryEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass repositoryConceptEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass semanticMarkupEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass semanticMarkupElementEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass docletEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass constraintEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass businessProcessCatalogueEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass repositoryEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass dataDictionaryEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass topLevelDictionaryEntryEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass messageDefinitionEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass repositoryTypeEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass messageSetEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass syntaxEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass encodingEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass businessAreaEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass xorEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass messageElementEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass messageConstructEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass constructEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass multiplicityEntityEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass logicalTypeEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass messageConceptEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass businessComponentEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass businessElementTypeEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass businessConceptEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass businessElementEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass messageComponentTypeEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass messageBuildingBlockEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass dataTypeEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass businessAssociationEndEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass messageElementContainerEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass messageComponentEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass messageChoreographyEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass businessTransactionEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass businessProcessEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass businessRoleEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass participantEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass receiveEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass messageTransmissionEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass sendEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass messageTransportModeEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass messageDefinitionIdentifierEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass conversationEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass messageAssociationEndEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass messageAttributeEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass businessAttributeEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass textEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass stringEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass identifierSetEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass indicatorEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass booleanEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass rateEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass decimalEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass externalSchemaEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass quantityEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass codeEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass codeSetEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass amountEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass choiceComponentEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass abstractDateTimeConceptEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass endPointCategoryEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass binaryEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass dateEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass dateTimeEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass dayEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass durationEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass monthEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass monthDayEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass timeEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass yearEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass yearMonthEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass userDefinedEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass industryMessageSetEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass convergenceDocumentationEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass iso15022MessageSetEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass schemaTypeEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EEnum registrationStatusEEnum = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EEnum aggregationEEnum = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EEnum deliveryAssuranceEEnum = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EEnum durabilityEEnum = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EEnum messageCastingEEnum = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EEnum messageDeliveryOrderEEnum = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EEnum messageValidationLevelEEnum = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EEnum messageValidationOnOffEEnum = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EEnum messageValidationResultsEEnum = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EEnum receiverAsynchronicityEEnum = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EEnum senderAsynchronicityEEnum = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EEnum processContentEEnum = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EEnum namespaceEEnum = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EEnum schemaTypeKindEEnum = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EEnum iso20022VersionEEnum = null;
/**
* Creates an instance of the model <b>Package</b>, registered with
* {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
* package URI value.
* <p>Note: the correct way to create the package is via the static
* factory method {@link #init init()}, which also performs
* initialization of the package, or returns the registered package,
* if one already exists.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.emf.ecore.EPackage.Registry
* @see iso20022.Iso20022Package#eNS_URI
* @see #init()
* @generated
*/
private Iso20022PackageImpl() {
super(eNS_URI, Iso20022Factory.eINSTANCE);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private static boolean isInited = false;
/**
* Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
*
* <p>This method is used to initialize {@link Iso20022Package#eINSTANCE} when that field is accessed.
* Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #eNS_URI
* @generated
*/
public static Iso20022Package init() {
if (isInited) return (Iso20022Package)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI);
// Obtain or create and register package
Iso20022PackageImpl theIso20022Package = (Iso20022PackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof Iso20022PackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new Iso20022PackageImpl());
isInited = true;
// Load packages
theIso20022Package.loadPackage();
// Fix loaded packages
theIso20022Package.fixPackageContents();
// Mark meta-data to indicate it can't be changed
theIso20022Package.freeze();
// Update the registry and return the package
EPackage.Registry.INSTANCE.put(Iso20022Package.eNS_URI, theIso20022Package);
return theIso20022Package;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getAddress() {
if (addressEClass == null) {
addressEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(0);
}
return addressEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getAddress_BroadCastList() {
return (EReference)getAddress().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getAddress_Endpoint() {
return (EReference)getAddress().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getModelEntity() {
if (modelEntityEClass == null) {
modelEntityEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(1);
}
return modelEntityEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getModelEntity_NextVersions() {
return (EReference)getModelEntity().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getModelEntity_PreviousVersion() {
return (EReference)getModelEntity().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getModelEntity_ObjectIdentifier() {
return (EAttribute)getModelEntity().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getBroadcastList() {
if (broadcastListEClass == null) {
broadcastListEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(2);
}
return broadcastListEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBroadcastList_Address() {
return (EReference)getBroadcastList().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMessagingEndpoint() {
if (messagingEndpointEClass == null) {
messagingEndpointEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(3);
}
return messagingEndpointEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessagingEndpoint_TransportSystem() {
return (EReference)getMessagingEndpoint().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessagingEndpoint_ReceivedMessage() {
return (EReference)getMessagingEndpoint().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessagingEndpoint_SentMessage() {
return (EReference)getMessagingEndpoint().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessagingEndpoint_Location() {
return (EReference)getMessagingEndpoint().getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMessageTransportSystem() {
if (messageTransportSystemEClass == null) {
messageTransportSystemEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(4);
}
return messageTransportSystemEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageTransportSystem_Endpoint() {
return (EReference)getMessageTransportSystem().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getTransportMessage() {
if (transportMessageEClass == null) {
transportMessageEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(5);
}
return transportMessageEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getTransportMessage_Sender() {
return (EReference)getTransportMessage().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getTransportMessage_MessageInstance() {
return (EReference)getTransportMessage().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getTransportMessage_Receiver() {
return (EReference)getTransportMessage().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getTransportMessage__SameMessageTransportSystem__Map_DiagnosticChain() {
return getTransportMessage().getEOperations().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMessageInstance() {
if (messageInstanceEClass == null) {
messageInstanceEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(6);
}
return messageInstanceEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageInstance_Specification() {
return (EReference)getMessageInstance().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageInstance_TransportMessage() {
return (EReference)getMessageInstance().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getSyntaxMessageScheme() {
if (syntaxMessageSchemeEClass == null) {
syntaxMessageSchemeEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(7);
}
return syntaxMessageSchemeEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getSyntaxMessageScheme_MessageDefinitionTrace() {
return (EReference)getSyntaxMessageScheme().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getTopLevelCatalogueEntry() {
if (topLevelCatalogueEntryEClass == null) {
topLevelCatalogueEntryEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(8);
}
return topLevelCatalogueEntryEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getTopLevelCatalogueEntry_BusinessProcessCatalogue() {
return (EReference)getTopLevelCatalogueEntry().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getRepositoryConcept() {
if (repositoryConceptEClass == null) {
repositoryConceptEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(9);
}
return repositoryConceptEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getRepositoryConcept_Name() {
return (EAttribute)getRepositoryConcept().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getRepositoryConcept_Definition() {
return (EAttribute)getRepositoryConcept().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getRepositoryConcept_SemanticMarkup() {
return (EReference)getRepositoryConcept().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getRepositoryConcept_Doclet() {
return (EReference)getRepositoryConcept().getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getRepositoryConcept_Example() {
return (EAttribute)getRepositoryConcept().getEStructuralFeatures().get(4);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getRepositoryConcept_Constraint() {
return (EReference)getRepositoryConcept().getEStructuralFeatures().get(5);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getRepositoryConcept_RegistrationStatus() {
return (EAttribute)getRepositoryConcept().getEStructuralFeatures().get(6);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getRepositoryConcept_RemovalDate() {
return (EAttribute)getRepositoryConcept().getEStructuralFeatures().get(7);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getRepositoryConcept__RemovalDateRegistrationStatus__Map_DiagnosticChain() {
return getRepositoryConcept().getEOperations().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getRepositoryConcept__NameFirstLetterUppercase__Map_DiagnosticChain() {
return getRepositoryConcept().getEOperations().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getSemanticMarkup() {
if (semanticMarkupEClass == null) {
semanticMarkupEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(10);
}
return semanticMarkupEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getSemanticMarkup_Type() {
return (EAttribute)getSemanticMarkup().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getSemanticMarkup_Elements() {
return (EReference)getSemanticMarkup().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getSemanticMarkupElement() {
if (semanticMarkupElementEClass == null) {
semanticMarkupElementEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(11);
}
return semanticMarkupElementEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getSemanticMarkupElement_Name() {
return (EAttribute)getSemanticMarkupElement().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getSemanticMarkupElement_Value() {
return (EAttribute)getSemanticMarkupElement().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getDoclet() {
if (docletEClass == null) {
docletEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(12);
}
return docletEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getDoclet_Type() {
return (EAttribute)getDoclet().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getDoclet_Content() {
return (EAttribute)getDoclet().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getConstraint() {
if (constraintEClass == null) {
constraintEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(13);
}
return constraintEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getConstraint_Expression() {
return (EAttribute)getConstraint().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getConstraint_ExpressionLanguage() {
return (EAttribute)getConstraint().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getConstraint_Owner() {
return (EReference)getConstraint().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getBusinessProcessCatalogue() {
if (businessProcessCatalogueEClass == null) {
businessProcessCatalogueEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(15);
}
return businessProcessCatalogueEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessProcessCatalogue_Repository() {
return (EReference)getBusinessProcessCatalogue().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessProcessCatalogue_TopLevelCatalogueEntry() {
return (EReference)getBusinessProcessCatalogue().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getBusinessProcessCatalogue__EntriesHaveUniqueName__Map_DiagnosticChain() {
return getBusinessProcessCatalogue().getEOperations().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getRepository() {
if (repositoryEClass == null) {
repositoryEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(16);
}
return repositoryEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getRepository_DataDictionary() {
return (EReference)getRepository().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getRepository_BusinessProcessCatalogue() {
return (EReference)getRepository().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getDataDictionary() {
if (dataDictionaryEClass == null) {
dataDictionaryEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(17);
}
return dataDictionaryEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getDataDictionary_TopLevelDictionaryEntry() {
return (EReference)getDataDictionary().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getDataDictionary_Repository() {
return (EReference)getDataDictionary().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getDataDictionary__EntriesHaveUniqueName__Map_DiagnosticChain() {
return getDataDictionary().getEOperations().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getTopLevelDictionaryEntry() {
if (topLevelDictionaryEntryEClass == null) {
topLevelDictionaryEntryEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(18);
}
return topLevelDictionaryEntryEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getTopLevelDictionaryEntry_DataDictionary() {
return (EReference)getTopLevelDictionaryEntry().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMessageDefinition() {
if (messageDefinitionEClass == null) {
messageDefinitionEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(19);
}
return messageDefinitionEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageDefinition_MessageSet() {
return (EReference)getMessageDefinition().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageDefinition_XmlName() {
return (EAttribute)getMessageDefinition().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageDefinition_XmlTag() {
return (EAttribute)getMessageDefinition().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageDefinition_BusinessArea() {
return (EReference)getMessageDefinition().getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageDefinition_Xors() {
return (EReference)getMessageDefinition().getEStructuralFeatures().get(4);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageDefinition_RootElement() {
return (EAttribute)getMessageDefinition().getEStructuralFeatures().get(5);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageDefinition_MessageBuildingBlock() {
return (EReference)getMessageDefinition().getEStructuralFeatures().get(6);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageDefinition_Choreography() {
return (EReference)getMessageDefinition().getEStructuralFeatures().get(7);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageDefinition_Trace() {
return (EReference)getMessageDefinition().getEStructuralFeatures().get(8);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageDefinition_MessageDefinitionIdentifier() {
return (EReference)getMessageDefinition().getEStructuralFeatures().get(9);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageDefinition_Derivation() {
return (EReference)getMessageDefinition().getEStructuralFeatures().get(10);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getMessageDefinition__BusinessAreaNameMatch__Map_DiagnosticChain() {
return getMessageDefinition().getEOperations().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getRepositoryType() {
if (repositoryTypeEClass == null) {
repositoryTypeEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(20);
}
return repositoryTypeEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMessageSet() {
if (messageSetEClass == null) {
messageSetEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(21);
}
return messageSetEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageSet_GeneratedSyntax() {
return (EReference)getMessageSet().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageSet_ValidEncoding() {
return (EReference)getMessageSet().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageSet_MessageDefinition() {
return (EReference)getMessageSet().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getMessageSet__GeneratedSyntaxDerivation__Map_DiagnosticChain() {
return getMessageSet().getEOperations().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getSyntax() {
if (syntaxEClass == null) {
syntaxEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(22);
}
return syntaxEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getSyntax_PossibleEncodings() {
return (EReference)getSyntax().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getSyntax_GeneratedFor() {
return (EReference)getSyntax().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getSyntax__GeneratedForDerivation__Map_DiagnosticChain() {
return getSyntax().getEOperations().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getEncoding() {
if (encodingEClass == null) {
encodingEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(23);
}
return encodingEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getEncoding_MessageSet() {
return (EReference)getEncoding().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getEncoding_Syntax() {
return (EReference)getEncoding().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getBusinessArea() {
if (businessAreaEClass == null) {
businessAreaEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(24);
}
return businessAreaEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getBusinessArea_Code() {
return (EAttribute)getBusinessArea().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessArea_MessageDefinition() {
return (EReference)getBusinessArea().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getXor() {
if (xorEClass == null) {
xorEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(25);
}
return xorEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getXor_ImpactedElements() {
return (EReference)getXor().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getXor_MessageComponent() {
return (EReference)getXor().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getXor_ImpactedMessageBuildingBlocks() {
return (EReference)getXor().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getXor_MessageDefinition() {
return (EReference)getXor().getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMessageElement() {
if (messageElementEClass == null) {
messageElementEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(26);
}
return messageElementEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageElement_IsTechnical() {
return (EAttribute)getMessageElement().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageElement_BusinessComponentTrace() {
return (EReference)getMessageElement().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageElement_BusinessElementTrace() {
return (EReference)getMessageElement().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageElement_ComponentContext() {
return (EReference)getMessageElement().getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageElement_IsDerived() {
return (EAttribute)getMessageElement().getEStructuralFeatures().get(4);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getMessageElement__NoMoreThanOneTrace__Map_DiagnosticChain() {
return getMessageElement().getEOperations().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getMessageElement__CardinalityAlignment__Map_DiagnosticChain() {
return getMessageElement().getEOperations().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMessageConstruct() {
if (messageConstructEClass == null) {
messageConstructEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(27);
}
return messageConstructEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageConstruct_XmlTag() {
return (EAttribute)getMessageConstruct().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageConstruct_XmlMemberType() {
return (EReference)getMessageConstruct().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getConstruct() {
if (constructEClass == null) {
constructEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(28);
}
return constructEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getConstruct_MemberType() {
return (EReference)getConstruct().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMultiplicityEntity() {
if (multiplicityEntityEClass == null) {
multiplicityEntityEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(29);
}
return multiplicityEntityEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMultiplicityEntity_MaxOccurs() {
return (EAttribute)getMultiplicityEntity().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMultiplicityEntity_MinOccurs() {
return (EAttribute)getMultiplicityEntity().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getLogicalType() {
if (logicalTypeEClass == null) {
logicalTypeEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(30);
}
return logicalTypeEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMessageConcept() {
if (messageConceptEClass == null) {
messageConceptEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(31);
}
return messageConceptEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getBusinessComponent() {
if (businessComponentEClass == null) {
businessComponentEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(32);
}
return businessComponentEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessComponent_SubType() {
return (EReference)getBusinessComponent().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessComponent_SuperType() {
return (EReference)getBusinessComponent().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessComponent_Element() {
return (EReference)getBusinessComponent().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessComponent_DerivationComponent() {
return (EReference)getBusinessComponent().getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessComponent_AssociationDomain() {
return (EReference)getBusinessComponent().getEStructuralFeatures().get(4);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessComponent_DerivationElement() {
return (EReference)getBusinessComponent().getEStructuralFeatures().get(5);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getBusinessComponent__BusinessElementsHaveUniqueNames__Map_DiagnosticChain() {
return getBusinessComponent().getEOperations().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getBusinessElementType() {
if (businessElementTypeEClass == null) {
businessElementTypeEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(33);
}
return businessElementTypeEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getBusinessConcept() {
if (businessConceptEClass == null) {
businessConceptEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(34);
}
return businessConceptEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getBusinessElement() {
if (businessElementEClass == null) {
businessElementEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(35);
}
return businessElementEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getBusinessElement_IsDerived() {
return (EAttribute)getBusinessElement().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessElement_Derivation() {
return (EReference)getBusinessElement().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessElement_BusinessElementType() {
return (EReference)getBusinessElement().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessElement_ElementContext() {
return (EReference)getBusinessElement().getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMessageComponentType() {
if (messageComponentTypeEClass == null) {
messageComponentTypeEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(36);
}
return messageComponentTypeEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageComponentType_MessageBuildingBlock() {
return (EReference)getMessageComponentType().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageComponentType_IsTechnical() {
return (EAttribute)getMessageComponentType().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageComponentType_Trace() {
return (EReference)getMessageComponentType().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMessageBuildingBlock() {
if (messageBuildingBlockEClass == null) {
messageBuildingBlockEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(37);
}
return messageBuildingBlockEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageBuildingBlock_SimpleType() {
return (EReference)getMessageBuildingBlock().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageBuildingBlock_ComplexType() {
return (EReference)getMessageBuildingBlock().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getMessageBuildingBlock__MessageBuildingBlockHasExactlyOneType__Map_DiagnosticChain() {
return getMessageBuildingBlock().getEOperations().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getDataType() {
if (dataTypeEClass == null) {
dataTypeEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(38);
}
return dataTypeEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getBusinessAssociationEnd() {
if (businessAssociationEndEClass == null) {
businessAssociationEndEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(39);
}
return businessAssociationEndEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessAssociationEnd_Opposite() {
return (EReference)getBusinessAssociationEnd().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getBusinessAssociationEnd_Aggregation() {
return (EAttribute)getBusinessAssociationEnd().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessAssociationEnd_Type() {
return (EReference)getBusinessAssociationEnd().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getBusinessAssociationEnd__AtMostOneAggregatedEnd__Map_DiagnosticChain() {
return getBusinessAssociationEnd().getEOperations().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getBusinessAssociationEnd__ContextConsistentWithType__Map_DiagnosticChain() {
return getBusinessAssociationEnd().getEOperations().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMessageElementContainer() {
if (messageElementContainerEClass == null) {
messageElementContainerEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(41);
}
return messageElementContainerEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageElementContainer_MessageElement() {
return (EReference)getMessageElementContainer().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getMessageElementContainer__MessageElementsHaveUniqueNames__Map_DiagnosticChain() {
return getMessageElementContainer().getEOperations().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getMessageElementContainer__TechnicalElement__Map_DiagnosticChain() {
return getMessageElementContainer().getEOperations().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMessageComponent() {
if (messageComponentEClass == null) {
messageComponentEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(42);
}
return messageComponentEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageComponent_Xors() {
return (EReference)getMessageComponent().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMessageChoreography() {
if (messageChoreographyEClass == null) {
messageChoreographyEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(43);
}
return messageChoreographyEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageChoreography_BusinessTransactionTrace() {
return (EReference)getMessageChoreography().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageChoreography_MessageDefinition() {
return (EReference)getMessageChoreography().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getBusinessTransaction() {
if (businessTransactionEClass == null) {
businessTransactionEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(44);
}
return businessTransactionEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessTransaction_BusinessProcessTrace() {
return (EReference)getBusinessTransaction().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessTransaction_Participant() {
return (EReference)getBusinessTransaction().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessTransaction_Transmission() {
return (EReference)getBusinessTransaction().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessTransaction_MessageTransportMode() {
return (EReference)getBusinessTransaction().getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessTransaction_SubTransaction() {
return (EReference)getBusinessTransaction().getEStructuralFeatures().get(4);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessTransaction_ParentTransaction() {
return (EReference)getBusinessTransaction().getEStructuralFeatures().get(5);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessTransaction_Trace() {
return (EReference)getBusinessTransaction().getEStructuralFeatures().get(6);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getBusinessTransaction__MessageTransmissionsHaveUniqueNames__Map_DiagnosticChain() {
return getBusinessTransaction().getEOperations().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getBusinessTransaction__ParticipantsHaveUniqueNames__Map_DiagnosticChain() {
return getBusinessTransaction().getEOperations().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getBusinessProcess() {
if (businessProcessEClass == null) {
businessProcessEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(45);
}
return businessProcessEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessProcess_Extender() {
return (EReference)getBusinessProcess().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessProcess_Extended() {
return (EReference)getBusinessProcess().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessProcess_Included() {
return (EReference)getBusinessProcess().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessProcess_Includer() {
return (EReference)getBusinessProcess().getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessProcess_BusinessRole() {
return (EReference)getBusinessProcess().getEStructuralFeatures().get(4);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessProcess_BusinessProcessTrace() {
return (EReference)getBusinessProcess().getEStructuralFeatures().get(5);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getBusinessRole() {
if (businessRoleEClass == null) {
businessRoleEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(46);
}
return businessRoleEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessRole_BusinessRoleTrace() {
return (EReference)getBusinessRole().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessRole_BusinessProcess() {
return (EReference)getBusinessRole().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getParticipant() {
if (participantEClass == null) {
participantEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(47);
}
return participantEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getParticipant_BusinessTransaction() {
return (EReference)getParticipant().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getParticipant_Receives() {
return (EReference)getParticipant().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getParticipant_Sends() {
return (EReference)getParticipant().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getParticipant_BusinessRoleTrace() {
return (EReference)getParticipant().getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getReceive() {
if (receiveEClass == null) {
receiveEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(48);
}
return receiveEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getReceive_MessageTransmission() {
return (EReference)getReceive().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getReceive_Receiver() {
return (EReference)getReceive().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMessageTransmission() {
if (messageTransmissionEClass == null) {
messageTransmissionEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(49);
}
return messageTransmissionEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageTransmission_BusinessTransaction() {
return (EReference)getMessageTransmission().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageTransmission_Derivation() {
return (EReference)getMessageTransmission().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageTransmission_MessageTypeDescription() {
return (EAttribute)getMessageTransmission().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageTransmission_Send() {
return (EReference)getMessageTransmission().getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageTransmission_Receive() {
return (EReference)getMessageTransmission().getEStructuralFeatures().get(4);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getSend() {
if (sendEClass == null) {
sendEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(50);
}
return sendEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getSend_Sender() {
return (EReference)getSend().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getSend_MessageTransmission() {
return (EReference)getSend().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMessageTransportMode() {
if (messageTransportModeEClass == null) {
messageTransportModeEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(51);
}
return messageTransportModeEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageTransportMode_BoundedCommunicationDelay() {
return (EAttribute)getMessageTransportMode().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageTransportMode_MaximumClockVariation() {
return (EAttribute)getMessageTransportMode().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageTransportMode_MaximumMessageSize() {
return (EAttribute)getMessageTransportMode().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageTransportMode_MessageDeliveryWindow() {
return (EAttribute)getMessageTransportMode().getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageTransportMode_MessageSendingWindow() {
return (EAttribute)getMessageTransportMode().getEStructuralFeatures().get(4);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageTransportMode_DeliveryAssurance() {
return (EAttribute)getMessageTransportMode().getEStructuralFeatures().get(5);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageTransportMode_Durability() {
return (EAttribute)getMessageTransportMode().getEStructuralFeatures().get(6);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageTransportMode_MessageCasting() {
return (EAttribute)getMessageTransportMode().getEStructuralFeatures().get(7);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageTransportMode_MessageDeliveryOrder() {
return (EAttribute)getMessageTransportMode().getEStructuralFeatures().get(8);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageTransportMode_MessageValidationLevel() {
return (EAttribute)getMessageTransportMode().getEStructuralFeatures().get(9);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageTransportMode_MessageValidationOnOff() {
return (EAttribute)getMessageTransportMode().getEStructuralFeatures().get(10);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageTransportMode_MessageValidationResults() {
return (EAttribute)getMessageTransportMode().getEStructuralFeatures().get(11);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageTransportMode_ReceiverAsynchronicity() {
return (EAttribute)getMessageTransportMode().getEStructuralFeatures().get(12);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageTransportMode_SenderAsynchronicity() {
return (EAttribute)getMessageTransportMode().getEStructuralFeatures().get(13);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageTransportMode_BusinessTransaction() {
return (EReference)getMessageTransportMode().getEStructuralFeatures().get(14);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMessageDefinitionIdentifier() {
if (messageDefinitionIdentifierEClass == null) {
messageDefinitionIdentifierEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(61);
}
return messageDefinitionIdentifierEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageDefinitionIdentifier_BusinessArea() {
return (EAttribute)getMessageDefinitionIdentifier().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageDefinitionIdentifier_MessageFunctionality() {
return (EAttribute)getMessageDefinitionIdentifier().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageDefinitionIdentifier_Flavour() {
return (EAttribute)getMessageDefinitionIdentifier().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageDefinitionIdentifier_Version() {
return (EAttribute)getMessageDefinitionIdentifier().getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getConversation() {
if (conversationEClass == null) {
conversationEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(62);
}
return conversationEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMessageAssociationEnd() {
if (messageAssociationEndEClass == null) {
messageAssociationEndEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(63);
}
return messageAssociationEndEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getMessageAssociationEnd_IsComposite() {
return (EAttribute)getMessageAssociationEnd().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageAssociationEnd_Type() {
return (EReference)getMessageAssociationEnd().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMessageAttribute() {
if (messageAttributeEClass == null) {
messageAttributeEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(64);
}
return messageAttributeEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageAttribute_SimpleType() {
return (EReference)getMessageAttribute().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getMessageAttribute_ComplexType() {
return (EReference)getMessageAttribute().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getMessageAttribute__MessageAttributeHasExactlyOneType__Map_DiagnosticChain() {
return getMessageAttribute().getEOperations().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getBusinessAttribute() {
if (businessAttributeEClass == null) {
businessAttributeEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(65);
}
return businessAttributeEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessAttribute_SimpleType() {
return (EReference)getBusinessAttribute().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getBusinessAttribute_ComplexType() {
return (EReference)getBusinessAttribute().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getBusinessAttribute__BusinessAttributeHasExactlyOneType__Map_DiagnosticChain() {
return getBusinessAttribute().getEOperations().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getBusinessAttribute__NoDerivingCodeSetType__Map_DiagnosticChain() {
return getBusinessAttribute().getEOperations().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getText() {
if (textEClass == null) {
textEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(66);
}
return textEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getString() {
if (stringEClass == null) {
stringEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(67);
}
return stringEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getString_MinLength() {
return (EAttribute)getString().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getString_MaxLength() {
return (EAttribute)getString().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getString_Length() {
return (EAttribute)getString().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getString_Pattern() {
return (EAttribute)getString().getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getIdentifierSet() {
if (identifierSetEClass == null) {
identifierSetEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(68);
}
return identifierSetEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getIdentifierSet_IdentificationScheme() {
return (EAttribute)getIdentifierSet().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getIndicator() {
if (indicatorEClass == null) {
indicatorEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(69);
}
return indicatorEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getIndicator_MeaningWhenTrue() {
return (EAttribute)getIndicator().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getIndicator_MeaningWhenFalse() {
return (EAttribute)getIndicator().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getBoolean() {
if (booleanEClass == null) {
booleanEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(70);
}
return booleanEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getBoolean_Pattern() {
return (EAttribute)getBoolean().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getRate() {
if (rateEClass == null) {
rateEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(71);
}
return rateEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getRate_BaseValue() {
return (EAttribute)getRate().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getRate_BaseUnitCode() {
return (EAttribute)getRate().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getDecimal() {
if (decimalEClass == null) {
decimalEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(72);
}
return decimalEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getDecimal_MinInclusive() {
return (EAttribute)getDecimal().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getDecimal_MinExclusive() {
return (EAttribute)getDecimal().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getDecimal_MaxInclusive() {
return (EAttribute)getDecimal().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getDecimal_MaxExclusive() {
return (EAttribute)getDecimal().getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getDecimal_TotalDigits() {
return (EAttribute)getDecimal().getEStructuralFeatures().get(4);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getDecimal_FractionDigits() {
return (EAttribute)getDecimal().getEStructuralFeatures().get(5);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getDecimal_Pattern() {
return (EAttribute)getDecimal().getEStructuralFeatures().get(6);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getExternalSchema() {
if (externalSchemaEClass == null) {
externalSchemaEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(73);
}
return externalSchemaEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getExternalSchema_NamespaceList() {
return (EAttribute)getExternalSchema().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getExternalSchema_ProcessContent() {
return (EAttribute)getExternalSchema().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getQuantity() {
if (quantityEClass == null) {
quantityEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(75);
}
return quantityEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getQuantity_UnitCode() {
return (EAttribute)getQuantity().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getCode() {
if (codeEClass == null) {
codeEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(76);
}
return codeEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getCode_CodeName() {
return (EAttribute)getCode().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getCode_Owner() {
return (EReference)getCode().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getCodeSet() {
if (codeSetEClass == null) {
codeSetEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(77);
}
return codeSetEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getCodeSet_Trace() {
return (EReference)getCodeSet().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getCodeSet_Derivation() {
return (EReference)getCodeSet().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getCodeSet_IdentificationScheme() {
return (EAttribute)getCodeSet().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getCodeSet_Code() {
return (EReference)getCodeSet().getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getAmount() {
if (amountEClass == null) {
amountEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(78);
}
return amountEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getAmount_CurrencyIdentifierSet() {
return (EReference)getAmount().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getChoiceComponent() {
if (choiceComponentEClass == null) {
choiceComponentEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(79);
}
return choiceComponentEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getChoiceComponent__AtLeastOneProperty__Map_DiagnosticChain() {
return getChoiceComponent().getEOperations().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getAbstractDateTimeConcept() {
if (abstractDateTimeConceptEClass == null) {
abstractDateTimeConceptEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(81);
}
return abstractDateTimeConceptEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getAbstractDateTimeConcept_MinInclusive() {
return (EAttribute)getAbstractDateTimeConcept().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getAbstractDateTimeConcept_MinExclusive() {
return (EAttribute)getAbstractDateTimeConcept().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getAbstractDateTimeConcept_MaxInclusive() {
return (EAttribute)getAbstractDateTimeConcept().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getAbstractDateTimeConcept_MaxExclusive() {
return (EAttribute)getAbstractDateTimeConcept().getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getAbstractDateTimeConcept_Pattern() {
return (EAttribute)getAbstractDateTimeConcept().getEStructuralFeatures().get(4);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getEndPointCategory() {
if (endPointCategoryEClass == null) {
endPointCategoryEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(82);
}
return endPointCategoryEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getEndPointCategory_EndPoints() {
return (EReference)getEndPointCategory().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getBinary() {
if (binaryEClass == null) {
binaryEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(83);
}
return binaryEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getBinary_MinLength() {
return (EAttribute)getBinary().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getBinary_MaxLength() {
return (EAttribute)getBinary().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getBinary_Length() {
return (EAttribute)getBinary().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getBinary_Pattern() {
return (EAttribute)getBinary().getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getDate() {
if (dateEClass == null) {
dateEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(84);
}
return dateEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getDateTime() {
if (dateTimeEClass == null) {
dateTimeEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(85);
}
return dateTimeEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getDay() {
if (dayEClass == null) {
dayEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(86);
}
return dayEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getDuration() {
if (durationEClass == null) {
durationEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(87);
}
return durationEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMonth() {
if (monthEClass == null) {
monthEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(88);
}
return monthEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getMonthDay() {
if (monthDayEClass == null) {
monthDayEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(89);
}
return monthDayEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getTime() {
if (timeEClass == null) {
timeEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(90);
}
return timeEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getYear() {
if (yearEClass == null) {
yearEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(91);
}
return yearEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getYearMonth() {
if (yearMonthEClass == null) {
yearMonthEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(92);
}
return yearMonthEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getUserDefined() {
if (userDefinedEClass == null) {
userDefinedEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(93);
}
return userDefinedEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getUserDefined_Namespace() {
return (EAttribute)getUserDefined().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getUserDefined_NamespaceList() {
return (EAttribute)getUserDefined().getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getUserDefined_ProcessContents() {
return (EAttribute)getUserDefined().getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getIndustryMessageSet() {
if (industryMessageSetEClass == null) {
industryMessageSetEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(94);
}
return industryMessageSetEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getConvergenceDocumentation() {
if (convergenceDocumentationEClass == null) {
convergenceDocumentationEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(95);
}
return convergenceDocumentationEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getISO15022MessageSet() {
if (iso15022MessageSetEClass == null) {
iso15022MessageSetEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(96);
}
return iso15022MessageSetEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getSchemaType() {
if (schemaTypeEClass == null) {
schemaTypeEClass = (EClass)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(97);
}
return schemaTypeEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getSchemaType_Kind() {
return (EAttribute)getSchemaType().getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EEnum getRegistrationStatus() {
if (registrationStatusEEnum == null) {
registrationStatusEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(14);
}
return registrationStatusEEnum;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EEnum getAggregation() {
if (aggregationEEnum == null) {
aggregationEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(40);
}
return aggregationEEnum;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EEnum getDeliveryAssurance() {
if (deliveryAssuranceEEnum == null) {
deliveryAssuranceEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(52);
}
return deliveryAssuranceEEnum;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EEnum getDurability() {
if (durabilityEEnum == null) {
durabilityEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(53);
}
return durabilityEEnum;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EEnum getMessageCasting() {
if (messageCastingEEnum == null) {
messageCastingEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(54);
}
return messageCastingEEnum;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EEnum getMessageDeliveryOrder() {
if (messageDeliveryOrderEEnum == null) {
messageDeliveryOrderEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(55);
}
return messageDeliveryOrderEEnum;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EEnum getMessageValidationLevel() {
if (messageValidationLevelEEnum == null) {
messageValidationLevelEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(56);
}
return messageValidationLevelEEnum;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EEnum getMessageValidationOnOff() {
if (messageValidationOnOffEEnum == null) {
messageValidationOnOffEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(57);
}
return messageValidationOnOffEEnum;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EEnum getMessageValidationResults() {
if (messageValidationResultsEEnum == null) {
messageValidationResultsEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(58);
}
return messageValidationResultsEEnum;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EEnum getReceiverAsynchronicity() {
if (receiverAsynchronicityEEnum == null) {
receiverAsynchronicityEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(59);
}
return receiverAsynchronicityEEnum;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EEnum getSenderAsynchronicity() {
if (senderAsynchronicityEEnum == null) {
senderAsynchronicityEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(60);
}
return senderAsynchronicityEEnum;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EEnum getProcessContent() {
if (processContentEEnum == null) {
processContentEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(74);
}
return processContentEEnum;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EEnum getNamespace() {
if (namespaceEEnum == null) {
namespaceEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(80);
}
return namespaceEEnum;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EEnum getSchemaTypeKind() {
if (schemaTypeKindEEnum == null) {
schemaTypeKindEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(98);
}
return schemaTypeKindEEnum;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EEnum getISO20022Version() {
if (iso20022VersionEEnum == null) {
iso20022VersionEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(Iso20022Package.eNS_URI).getEClassifiers().get(99);
}
return iso20022VersionEEnum;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Iso20022Factory getIso20022Factory() {
return (Iso20022Factory)getEFactoryInstance();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private boolean isLoaded = false;
/**
* Laods the package and any sub-packages from their serialized form.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void loadPackage() {
if (isLoaded) return;
isLoaded = true;
URL url = getClass().getResource(packageFilename);
if (url == null) {
throw new RuntimeException("Missing serialized package: " + packageFilename);
}
URI uri = URI.createURI(url.toString());
Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
try {
resource.load(null);
}
catch (IOException exception) {
throw new WrappedException(exception);
}
initializeFromLoadedEPackage(this, (EPackage)resource.getContents().get(0));
createResource(eNS_URI);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private boolean isFixed = false;
/**
* Fixes up the loaded package, to make it appear as if it had been programmatically built.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void fixPackageContents() {
if (isFixed) return;
isFixed = true;
fixEClassifiers();
}
/**
* Sets the instance class on the given classifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void fixInstanceClass(EClassifier eClassifier) {
if (eClassifier.getInstanceClassName() == null) {
eClassifier.setInstanceClassName("iso20022." + eClassifier.getName());
setGeneratedClassName(eClassifier);
}
}
} //Iso20022PackageImpl
|
package com.esum.wp.ims.backupinfo.struts.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.esum.appframework.exception.ApplicationException;
import com.esum.appframework.struts.action.BaseDelegateAction;
import com.esum.appframework.struts.actionform.BeanUtilForm;
import com.esum.framework.core.management.ManagementException;
import com.esum.imsutil.util.ReloadXTrusAdmin;
import com.esum.router.RouterConfig;
import com.esum.wp.ims.backupinfo.BackupInfo;
import com.esum.wp.ims.tld.XtrusLangTag;
public class BackupInfoAction extends BaseDelegateAction {
protected ActionForward doService(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
if (method.equals("select")) {
BackupInfo backupInfo = null;
BeanUtilForm beanUtilForm = (BeanUtilForm)form;
request.removeAttribute("inputObject");
request.removeAttribute("outputObject");
Object inputObject = null;
if (beanUtilForm != null) {
inputObject = beanUtilForm.getBean();
}else {
beanUtilForm = new BeanUtilForm();
}
if(inputObject == null) {
backupInfo = new BackupInfo();
}else {
backupInfo = (BackupInfo)inputObject;
}
beanUtilForm.setBean(backupInfo);
request.setAttribute("inputObject", backupInfo);
return super.doService(mapping, beanUtilForm, request, response);
} else if (method.equals("update")) {
BackupInfo backupInfo = null;
BeanUtilForm beanUtilForm = (BeanUtilForm)form;
request.removeAttribute("inputObject");
request.removeAttribute("outputObject");
Object inputObject = null;
if (beanUtilForm != null) {
inputObject = beanUtilForm.getBean();
}else {
beanUtilForm = new BeanUtilForm();
}
if(inputObject == null) {
backupInfo = new BackupInfo();
}else {
backupInfo = (BackupInfo)inputObject;
}
beanUtilForm.setBean(backupInfo);
request.setAttribute("inputObject", backupInfo);
ActionForward forward = super.doService(mapping, beanUtilForm, request, response);
request.setAttribute("outputObject", backupInfo);
try {
String ids[] = new String[1];
ids[0] = backupInfo.getBackupId();
String configId = RouterConfig.BACKUP_INFO_TABLE_ID;
ReloadXTrusAdmin reload = ReloadXTrusAdmin.getInstance();
reload.reloadInfoRecord(ids, configId);
}catch (ManagementException me) {
String errorMsg = XtrusLangTag.getMessage("error.management.exception");
ApplicationException are = new ApplicationException(me);
ApplicationException ae = new ApplicationException(errorMsg);
are.printException("");
request.setAttribute("servletpath", request.getServletPath());
request.setAttribute("exception", ae);
return mapping.findForward("failure");
} catch (RuntimeException re) {
String errorMsg = XtrusLangTag.getMessage("error.runtime.exception");
ApplicationException are = new ApplicationException(re);
ApplicationException ae = new ApplicationException(errorMsg);
are.printException("");
request.setAttribute("servletpath", request.getServletPath());
request.setAttribute("exception", ae);
return mapping.findForward("failure");
}catch(Exception e){
e.printStackTrace();
ApplicationException ae = new ApplicationException(e);
request.setAttribute("servletpath", request.getServletPath());
request.setAttribute("exception", ae);
return mapping.findForward("failure");
}
return forward;
} else {
return super.doService(mapping, form, request, response);
}
}
}
|
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.ImageIO;
class Pixel {
BufferedImage image;
int width;
int height;
public Pixel() {
try {
File input = new File("technext.jpg");
image = ImageIO.read(input);
width = image.getWidth();
height = image.getHeight();
int count = 0;
for(int i=0; i<height; i++){
for(int j=0; j<width; j++){
count++;
Color c = new Color(image.getRGB(j, i));
System.out.println("S.No: " + count + " Red: " + c.getRed() +" Green: " + c.getGreen() + " Blue: " + c.getBlue());
}
}
} catch (Exception e) {}
}
static public void main(String args[]) throws Exception
{
Pixel obj = new Pixel();
}
}
|
package com.git.cloud.resmgt.common.model;
public enum DatastoreTypeEnum {
DATASTORE_TYPE_LOCAL_DISK("LOCAL_DISK"), // 本地磁盘
DATASTORE_TYPE_NAS_DATASTORE("NAS_DATASTORE"), // 共享NAS
;
private final String value;
private DatastoreTypeEnum(String value) {
this.value = value;
}
public String getValue() {
return value;
}
public static DatastoreTypeEnum fromString(String value ) {
if (value != null) {
for (DatastoreTypeEnum c : DatastoreTypeEnum.values()) {
if (value.equalsIgnoreCase(c.value)) {
return c;
}
}
}
return null;
}
}
|
package com.baidu.serivce;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baidu.dal.dao.ServerInfoRepository;
import com.baidu.dal.model.ServerInfo;
/**
* <p>
* create by mayongbin01 2017/01/22
* <p>
* Service
* <p>
* provide interface for controller
*/
@Service
public class ServerInfoService {
private static Logger logger = LoggerFactory.getLogger(ServerInfoService.class);
@Autowired
private ServerInfoRepository serverInfoRepository;
/**
* save serverInfo to DB
*
* @param serverInfo
*
* @return
*/
public boolean addServerInfo(ServerInfo serverInfo) {
return serverInfoRepository.save(serverInfo) == null;
}
/**
* delete serverInfo by id
*
* @param id
*/
public void deleteServerInfo(int id) {
serverInfoRepository.delete(id);
}
}
|
package org.avaeriandev.killchests.chests.soul.versioning;
import org.avaeriandev.api.versioning.VersionUpgrader;
import org.avaeriandev.api.versioning.VersionableData;
public class SoulData_v2 implements VersionUpgrader {
@Override
public void upgrade(VersionableData data) {
// TODO: upgrade data from v1 to v2
}
}
|
package java_learning;
class A
{
public A()
{
System.out.println("in A");
}
public A(int i)
{
System.out.println("in A int");
}
}
class B extends A
{
public B()
{
super();
System.out.println("in B");
}
public B(int i)
{
super(i); //super class is used to call parameterised constructor
//of super class from the sub class
// super class is automatically called by the compiler if there
//are no parameters
System.out.println("in B int");
}
}
public class SuperDemo {
public static void main(String args[])
{
B obj = new B(5);
}
}
|
package apiAlquilerVideoJuegos.basedatos;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import apiAlquilerVideoJuegos.modelos.Tercero;
@Repository
public interface TerceroBD extends CrudRepository<Tercero, Long>{
}
|
package jthrift;
public class TList extends TContainer {
private TType elemType;
public TList(TType elemType) {
this.elemType = elemType;
}
@Override
public VirtualType getVirtualType() { return VirtualType.LIST; }
}
|
package com.example.pramesh.demo;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import java.util.Calendar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
DatabaseHelper myDb;
EditText editName, editSurname, editMarks, editTextId;
Button buttonInsert, buttonView, buttonUpdate, buttonDelete;
public static final String titleBegMsg = "What's This?";
public static final String messageBodyAlertBox = "App That Takes In Your Task And Displays It.\n\n\n\n\n\n By - Pramesh Bajracharya";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myDb = new DatabaseHelper(this);
editName = (EditText) findViewById(R.id.editText);
editSurname = (EditText) findViewById(R.id.editText2);
editMarks = (EditText) findViewById(R.id.editText3);
editTextId = (EditText) findViewById(R.id.editTextId);
buttonInsert = (Button) findViewById(R.id.button_add);
buttonView = (Button) findViewById(R.id.button_view);
buttonUpdate = (Button) findViewById(R.id.update);
buttonDelete = (Button) findViewById(R.id.buttonDelete);
if (isFirstTime()) {
showBeginning(titleBegMsg, messageBodyAlertBox);
}
AddData();
viewData();
updateData();
deleteData();
// Create Notification Alert Every 24 hours ...
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 7);
calendar.set(Calendar.MINUTE, 20);
calendar.set(Calendar.SECOND, 0);
Intent intent1 = new Intent(MainActivity.this, AlarmReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(MainActivity.this, 10120, intent1, PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager am = (AlarmManager) MainActivity.this.getSystemService(MainActivity.this.ALARM_SERVICE);
am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pendingIntent);
}
private boolean isFirstTime() {
SharedPreferences preferences = getPreferences(MODE_PRIVATE);
boolean ranBefore = preferences.getBoolean("RanBefore", false);
if (!ranBefore) {
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("RanBefore", true);
editor.commit();
}
return !ranBefore;
}
public void AddData() {
buttonInsert.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
if (editName.getText().toString().length() == 0) {
editName.setError("Task 1 is required!");
if (editSurname.getText().toString().length() == 0) {
editSurname.setError("Task 2 is required!");
if (editMarks.getText().toString().length() == 0) {
editMarks.setError("Task 3 is required!");
}
}
} else {
boolean isInserted = myDb.insertData(editName.getText().toString(), editSurname.getText().toString(), editMarks.getText().toString());
if (isInserted == true) {
Toast.makeText(MainActivity.this, "Data Inserted", Toast.LENGTH_LONG).show();
editMarks.setText("");
editSurname.setText("");
editName.setText("");
editTextId.setText("");
} else {
Toast.makeText(MainActivity.this, "Data Inserted", Toast.LENGTH_LONG).show();
editMarks.setText("");
editSurname.setText("");
editName.setText("");
editTextId.setText("");
}
}
}
}
);
}
public void viewData() {
buttonView.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
Cursor res = myDb.getAllData();
if (res.getCount() == 0) {
Toast.makeText(MainActivity.this, "Data Not found", Toast.LENGTH_LONG).show();
showMessage("Add Something!", "Add Some Task. You currently have no task to be displayed.");
return;
} else {
StringBuffer buffer = new StringBuffer();
while (res.moveToNext()) {
buffer.append("Number :" + res.getString(0) + "\n");
buffer.append("Task 1 :" + res.getString(1) + "\n");
buffer.append("Task 2 :" + res.getString(2) + "\n");
buffer.append("Task 3 :" + res.getString(3) + "\n\n");
}
// Show All data ...
showMessage("List Of Task ", buffer.toString());
}
}
}
);
}
public void updateData() {
buttonUpdate.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
if (editTextId.getText().toString().length() == 0) {
editTextId.setError("Please enter Number here");
} else {
boolean isUpdated = myDb.updateData(
editTextId.getText().toString(),
editName.getText().toString(),
editSurname.getText().toString(),
editMarks.getText().toString()
);
if (isUpdated == true) {
Toast.makeText(MainActivity.this, "Data Updated", Toast.LENGTH_LONG).show();
editMarks.setText("");
editSurname.setText("");
editName.setText("");
editTextId.setText("");
} else {
editMarks.setText("");
editSurname.setText("");
editName.setText("");
editTextId.setText("");
Toast.makeText(MainActivity.this, "Data Not Updated", Toast.LENGTH_LONG).show();
}
}
}
}
);
}
public void deleteData() {
buttonDelete.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
if (editTextId.getText().toString().length() == 0) {
editTextId.setError("Please enter Number here");
} else {
Integer deletedRows = myDb.deletedata(editTextId.getText().toString());
if (deletedRows > 0) {
Toast.makeText(MainActivity.this, "Data Deleted", Toast.LENGTH_SHORT).show();
editTextId.setText("");
} else {
Toast.makeText(MainActivity.this, "Data Not Deleted. Make sure you have enter the number right.", Toast.LENGTH_LONG).show();
editTextId.setText("");
}
}
}
}
);
}
private void showMessage(String title, String message) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(true);
builder.setTitle(title);
builder.setMessage(message);
builder.show();
}
private void showBeginning(String title, String message) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(true);
builder.setTitle(title);
builder.setMessage(message);
builder.show();
}
}
|
//индекс массы тела
package Tasks;
import java.io.*;
public class Task9 {
public static void main(String[] args) throws IOException {
BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
double weight = Double.parseDouble(buff.readLine());
double height = Double.parseDouble(buff.readLine());
Mass.calcMass(weight, height);
}
public static class Mass {
public static void calcMass(double weight, double height) {
double a = weight / (height*height);
if (a < 18.5) {
System.out.println("Недовес: меньше чем 18.5");
}
if (a < 25 && a >= 18.5) {
System.out.println("Нормальный: между 18.5 и 25");
}
if ( a < 30 && a >= 25 ) {
System.out.println("Избыточный вес: между 25 и 30");
}
if (a >= 30) {
System.out.println("Ожирение: 30 или больше");
}
}
}
}
|
package gameUI;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.Border;
import Connection.GameClient;
import Connection.SendData;
import gameUI.InsertNameUI.JTextFieldLimit;
import javafx.beans.InvalidationListener;
import javafx.beans.Observable;
import javafx.collections.SetChangeListener;
/**
* Index UI for this game when user playing.
* @author
*
*/
public class IndexUI{
private JPanel panel;
private JButton single, dual;
private JTextField insertIP;
private String ip;
/**
* Create the application.
*/
public IndexUI() {
initialize();
}
/**
* Initialize the contains of the panel.
*/
private void initialize() {
// System.out.println("Run index...");
panel = new JPanel() {
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
try {
BufferedImage img = ImageIO.read(this.getClass().getResource("/res/index.png"));
g.drawImage(img, 0, 0, 1280, 720, null);
} catch (IOException e) {
}
}
};
panel.setBounds(0, 0, 1280, 720);
panel.setLayout(null);
ImageIcon img = new ImageIcon(getClass().getResource("/res/player1_v4.png"));
single = new JButton(img);
single.setOpaque(false);
single.setContentAreaFilled(false);
single.setBorderPainted(false);
single.setBounds(120, 270, 444, 111);
single.addActionListener((e) -> {
InsertNameUI goTo = new InsertNameUI();
MainFrame.setPanel(goTo.getPanel());
});
panel.add(single);
insertIP = new JTextField();
insertIP.setBounds(1005, 196, 125, 35);
insertIP.setForeground(Color.gray);
insertIP.setText(" Insert Sever's IP");
insertIP.setBorder(BorderFactory.createLineBorder(Color.black));
insertIP.addMouseListener(new MouseListener() {
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mousePressed(MouseEvent e) {
insertIP.setText("");
insertIP.setForeground(Color.black);
}
@Override
public void mouseExited(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseClicked(MouseEvent e) {
}
});
panel.add(insertIP);
ImageIcon img2 = new ImageIcon(getClass().getResource("/res/player2_v4.png"));
dual = new JButton(img2);
dual.setOpaque(false);
dual.setContentAreaFilled(false);
dual.setBorderPainted(false);
dual.setBounds(690, 270, 444, 111);
panel.add(dual);
dual.addActionListener((e) -> {
WaitingUI goTo = new WaitingUI();
ip = insertIP.getText().trim();
try {
if(!ip.isEmpty()) {
// System.out.println("IP: "+ip);
GameClient client = new GameClient(ip, 55555, goTo);
MainFrame.setPanel(goTo.getPanel());
}else {
// System.out.println("insert IP");
}
} catch (IOException e1) {
e1.printStackTrace();
}
});
}
/**
* Return panel of IndexUI.
* @return panel of IndexUI.
*/
public JPanel getPanel() {
return panel;
}
}
|
package Problem_10867;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int N = Integer.parseInt(br.readLine());
int[] arr = new int[N];
StringTokenizer st = new StringTokenizer(br.readLine());
for(int i = 0; i<N; i++) arr[i] = Integer.parseInt(st.nextToken());
HashSet<Integer> hashset = new HashSet<>();
for(int i = 0 ; i<N; i++) hashset.add(arr[i]);
Object[] arr2 = hashset.toArray();
Arrays.sort(arr2);
for(Object obj : arr2) sb.append(obj).append(" ");
System.out.print(sb.toString());
}
}
|
package io.indreams.ecommerceuserinfoservice.service;
import io.indreams.ecommerceuserinfoservice.configuration.security.dao.UserRepository;
import io.indreams.ecommerceuserinfoservice.dao.UserRepo;
import io.indreams.ecommerceuserinfoservice.exception.UserFoundException;
import io.indreams.ecommerceuserinfoservice.model.Address;
import io.indreams.ecommerceuserinfoservice.model.User;
import io.indreams.ecommerceuserinfoservice.model.UserDAO;
import io.indreams.ecommerceuserinfoservice.model.requestDTO.UserRegisterationRequestDTO;
import io.indreams.ecommerceuserinfoservice.model.responseDTO.UserResponseDTO;
import io.indreams.ecommerceuserinfoservice.utility.Constants;
import org.modelmapper.ModelMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@Service
public class UserServiceImpl implements UserService {
private static final Logger LOGGER = LoggerFactory.getLogger(UserServiceImpl.class);
@Autowired
private UserRepo userRepo; //MONGO
@Autowired
private UserRepository userRepository; //JPA
@Autowired
private ModelMapper modelMapper;
@Override
public String registerUser(UserRegisterationRequestDTO userRegisterationRequestDTO) {
LOGGER.info(Constants.USER_REGISTERATION_SERVICE_START);
UserDAO user = modelMapper.map(userRegisterationRequestDTO, UserDAO.class);
Optional<User> userModel = userRepository.findByUsername(user.getUserName());
if (userModel.isPresent()) throw new UserFoundException(Constants.USER_FOUND_EXCEPTION);
User userCred = modelMapper.map(userRegisterationRequestDTO, User.class);
userRepository.save(userCred);
LOGGER.info(Constants.USER_REGISTERATION_PHASE_1_COMPLETED);
userRepo.save(user);
LOGGER.info(Constants.USER_REGISTERATION_PHASE_2_COMPLETED);
LOGGER.info(Constants.USER_REGISTERATION_SERVICE_END);
return Constants.SUCCESS;
}
@Override
public boolean validateUser(String userName) {
Optional<User> userModel = userRepository.findByUsername(userName);
return userModel.isPresent();
}
@Override
public String addUserAddress(Address address, String userName) {
Optional<UserDAO> entity = userRepo.findById(userName);
if (!entity.isPresent()) throw new UsernameNotFoundException(Constants.NO_USER_FOUND);
UserDAO dbUserDetails = entity.get();
dbUserDetails.getAddressList().add(address);
userRepo.save(dbUserDetails);
return Constants.SUCCESS;
}
@Override
public List<Address> getAddresses(String userName) {
Optional<UserDAO> entity = userRepo.findById(userName);
if (!entity.isPresent()) throw new UsernameNotFoundException(Constants.NO_USER_FOUND);
UserDAO dbUserDetails = entity.get();
return dbUserDetails.getAddressList();
}
@Override
public List<UserResponseDTO> getAllUsers() {
return userRepo.findAll().stream().map(user -> {
return modelMapper.map(user, UserResponseDTO.class);
}).collect(Collectors.toList());
}
}
|
package gameState;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import main.Game;
import objectMap.BlockMap;
import objectMap.blocks.*;
import utilities.Button;
public class School implements GameState {
private final int GRASS_ID = 0;
private final int BRICK_ID = 1;
private final int TILE_ID = 2;
private BlockMap blockMap;
private boolean left, right, up, down;
private final int cameraSpeed = 5;
private boolean placeable;
private boolean currentlyPlacing;
private Point originPlacingPoint;
private Block blockToPlace;
private boolean shiftHeld;
/////Bottom Menu/////
private Button[] bottomMenuButtons = { new Button(10, (Game.HEIGHT - 40), 50, 30, "Building"),
new Button(70, (Game.HEIGHT - 40), 50, 30, "Blocks")};
private Button[] optionButtons;
private boolean clicked;
private Point popUpMenuPosition;
private BottomMenuOption option;
private final int popUpMenuWidth = 170;
private final int popUpMenuHeight = 50;
private Point mousePosition;
public School(){
blockMap = new BlockMap();
blockMap.loadMap();
boolean left, right, up, down = false;
placeable = false;
currentlyPlacing = false;
originPlacingPoint = new Point(0,0);
blockToPlace = new Grass();
shiftHeld = false;
/////Bottom Menu/////
optionButtons = new Button[0];
clicked = false;
popUpMenuPosition = new Point(10, (Game.HEIGHT - 100));
option = BottomMenuOption.NOT_SELECTED;
mousePosition = new Point(600, 500);
}
public void init(){
}
@Override
public void update() {
Point pos = blockMap.getViewPosition();
if (right){
blockMap.setViewPosition(new Point(pos.x-cameraSpeed, pos.y));
pos.x-=cameraSpeed;
blockMap.fixBounds();
}
if (left){
blockMap.setViewPosition(new Point(pos.x+cameraSpeed, pos.y));
pos.x+=cameraSpeed;
blockMap.fixBounds();
}
if (down){
blockMap.setViewPosition(new Point(pos.x, pos.y-cameraSpeed));
pos.y-=cameraSpeed;
blockMap.fixBounds();
}
if (up){
blockMap.setViewPosition(new Point(pos.x, pos.y+cameraSpeed));
pos.y+=cameraSpeed;
blockMap.fixBounds();
}
}
@Override
public void draw(Graphics2D g) {
g.setColor(Color.WHITE);
g.fillRect(0, 0, Game.WIDTH, Game.HEIGHT);
if (currentlyPlacing){
blockMap.draw(g, true, mousePosition, originPlacingPoint, blockToPlace);
}else {
blockMap.draw(g, placeable);
}
/////Bottom Menu//////
g.setColor(new Color(0, 0, 0, 100));
g.fillRect(0, Game.HEIGHT - 50, Game.WIDTH, Game.HEIGHT);
for (Button b : bottomMenuButtons){
g.setColor(Color.BLUE);
g.setFont(new Font("Tahoma", Font.BOLD, 10));
b.draw(g);
}
if (clicked){
g.setColor(new Color(0, 0, 0, 100));
g.fillRect(popUpMenuPosition.x, popUpMenuPosition.y, popUpMenuWidth, popUpMenuHeight);
g.setColor(Color.ORANGE);
for (Button b : optionButtons){
b.draw(g);
}
}
if (placeable){
int size = blockMap.getSize();
blockToPlace.draw(g, mousePosition.x - (size/2), mousePosition.y - (size/2), size);
}
}
@Override
public void mouseClicked(MouseEvent e) {
int x = e.getX();
int y = e.getY();
for (int i = 0; i < optionButtons.length; i++){
if (optionButtons[i].containsPoint(x, y)){
selectOption(i);
}
}
boolean switched = false;
for (int i = 0; i < bottomMenuButtons.length; i++){
if (bottomMenuButtons[i].containsPoint(x, y)){
switchMenu(BottomMenuOption.BLOCK);
switched = true;
break;
}
}
switch (option){
case NOT_SELECTED:
break;
default:
if (!switched){
switchMenu(BottomMenuOption.NOT_SELECTED);
}
break;
}
}
private void selectOption(int buttonNumber) {
switch(option) {
case BLOCK:
if (buttonNumber == GRASS_ID){
placeable = true;
blockToPlace = new Grass();
} else if (buttonNumber == BRICK_ID){
placeable = true;
blockToPlace = new Brick();
} else if (buttonNumber == TILE_ID){
placeable = true;
blockToPlace = new Tile();
} else {
placeable = false;
}
}
}
private void switchMenu(BottomMenuOption b){
option = b;
switch(option){
case BLOCK:
optionButtons = new Button[3];
optionButtons[0] = new Button(20, (Game.HEIGHT - 90), 30, 30, "Grass");
optionButtons[1] = new Button(60, (Game.HEIGHT - 90), 30, 30, "Brick");
optionButtons[2] = new Button(100, (Game.HEIGHT - 90), 30, 30, "Tile");
popUpMenuPosition = new Point(10, (Game.HEIGHT - 100));
clicked = true;
break;
case BUILDING:
placeable = true;
blockToPlace = new Brick();
break;
case NOT_SELECTED:
optionButtons = new Button[0];
popUpMenuPosition = new Point(10, (Game.HEIGHT - 100));
clicked = false;
break;
}
}
@Override
public void mousePressed(MouseEvent e) {
if (placeable){
currentlyPlacing = true;
originPlacingPoint = e.getPoint();
}
}
@Override
public void mouseReleased(MouseEvent e) {
int x = e.getX();
int y = e.getY();
if (placeable){
if (!bottomMenuContains(x, y) && blockMap.contains(x, y)){
int size = blockMap.getSize();
if (blockToPlace.getPlacingType() == Block.LINE){
if (Math.abs(mousePosition.x - originPlacingPoint.x) >= Math.abs(mousePosition.y - originPlacingPoint.y)){
int mouseX = x;
int originX = originPlacingPoint.x;
if (mouseX < originX){
int temp = mouseX;
mouseX = originX;
originX = temp;
mouseX+=size/2;
}
for (int placingX = originX; placingX < mouseX; placingX+=size){
blockMap.place(placingX, originPlacingPoint.y, blockToPlace);
}
} else {
int mouseY = y;
int originY = originPlacingPoint.y;
if (mouseY < originY){
int temp = mouseY;
mouseY = originY;
originY = temp;
mouseY+=size/2;
}
for (int placingY = originY; placingY < mouseY; placingY+=size){
blockMap.place(originPlacingPoint.x, placingY, blockToPlace);
}
}
} else if (blockToPlace.getPlacingType() == Block.SQUARE) {
int mouseX = x;
int originX = originPlacingPoint.x;
int mouseY = y;
int originY = originPlacingPoint.y;
if (mouseX < originX){
int temp = mouseX;
mouseX = originX;
originX = temp;
mouseX+=size/2;
}
if (mouseY < originY){
int temp = mouseY;
mouseY = originY;
originY = temp;
mouseY+=size/2;
}
for (int placingX = originX; placingX < mouseX; placingX+=size){
for (int placingY = originY; placingY < mouseY; placingY+=size){
blockMap.place(placingX, placingY, blockToPlace);
}
}
}
currentlyPlacing = false;
if (!shiftHeld){
placeable = false;
}
}
}
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
int button = e.getKeyCode();
if (button == KeyEvent.VK_A){
left = true;
} else if (button == KeyEvent.VK_D){
right = true;
} else if (button == KeyEvent.VK_W){
up = true;
} else if (button == KeyEvent.VK_S){
down = true;
} else if (button == KeyEvent.VK_SHIFT){
shiftHeld = true;
}
}
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
int button = e.getKeyCode();
if (button == KeyEvent.VK_A){
left = false;
} else if (button == KeyEvent.VK_D){
right = false;
} else if (button == KeyEvent.VK_W){
up = false;
} else if (button == KeyEvent.VK_S){
down = false;
} else if (button == KeyEvent.VK_SHIFT){
shiftHeld = false;
}
}
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
int notches = e.getWheelRotation();
int size = blockMap.getSize();
if (notches < 0){
if (size < 100){
blockMap.setSize(blockMap.getSize() + 1);
int newX = Math.round((e.getX() * 100/Game.WIDTH));
int newY = Math.round((e.getY() * 100/Game.HEIGHT));
Point oldPos = blockMap.getViewPosition();
blockMap.setViewPosition(new Point(oldPos.x - newX, oldPos.y - newY));
}
}else{
if (size > 4){
blockMap.setSize(blockMap.getSize() - 1);
int newX = Math.round((e.getX() * 100 /Game.WIDTH));
int newY = Math.round((e.getY() * 100/Game.HEIGHT));
Point oldPos = blockMap.getViewPosition();
blockMap.setViewPosition(new Point(oldPos.x + newX, oldPos.y + newY));
}
}
}
private boolean bottomMenuContains(int x, int y) {
if(y > Game.HEIGHT - 50){
return true;
}
if (clicked){
if (x >= popUpMenuPosition.x && x <= popUpMenuPosition.x + popUpMenuWidth && y >= popUpMenuPosition.y && y <= popUpMenuPosition.y + popUpMenuHeight){
return true;
}
}
return false;
}
@Override
public void mouseMoved(MouseEvent e) {
mousePosition = e.getPoint();
}
@Override
public void mouseDragged(MouseEvent e) {
mousePosition = e.getPoint();
}
}
|
package com.example.client;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ImportResource;
@SpringBootApplication(scanBasePackages = {"com.example.client"})
@ImportResource("classpath:demo-dubbo-client.xml")
public class ClientApplication {
public static void main(String[] args) {
SpringApplication.run(ClientApplication.class, args);
}
}
|
package com.example.controllers;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/ping")
public class HomeController {
@GetMapping
public String ping(){
return "OK";
}
}
|
import java.util.Scanner;
public class app {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
mailbox mail = new mailbox();
boolean isRunning = true;
while (isRunning) {
System.out.println("To enter new message press 'N'"+"\n"+"To delete message press 'D'"+"\n" +"To view messages press 'V"+"\n"+"To list all messages press'L"+"\n"+"To quit program press any other button");
String act= sc.next().toUpperCase();
if(act.contentEquals("N")){
System.out.println("please enter name of Sender");
String S = sc.next();
System.out.println("please enter name of Recipient");
String R = sc.next();
message mess = new message(S, R);
System.out.println("please enter message");
String T = sc.next();
mess.append(T);
mail.addMessage(mess);
}
else if (act.contentEquals("D")){
System.out.println("please enter index of message that you wish to delete");
int g = sc.nextInt();
mail.removeMessage(g);
}
else if (act.contentEquals("V")) {
System.out.println("please enter index of message that you wish to view");
int g = sc.nextInt();
System.out.println(mail.getMessage(g));
}
else if (act.contentEquals("L")) {
for (message menu : mail.listMessages()) {
System.out.println(menu);
}
}
else if(act.contentEquals("Q")) {
System.out.println("goodbye");
isRunning = false;
}
}
}
}
|
package com.davivienda.utilidades.ws.cliente.solicitarNotaDebitoCuentaCorrienteServiceATM;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceFeature;
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.6-1b01
* Generated source version: 2.2
*
*/
@WebServiceClient(name = "SolictarNotaDebitoCuentaCorrienteServiceATMService", targetNamespace = "http://solictarnotadebitocuentacorriente.servicios.procesadortransacciones.davivienda.com/")
public class SolictarNotaDebitoCuentaCorrienteServiceATMService
extends Service
{
private final static QName SOLICTARNOTADEBITOCUENTACORRIENTESERVICEATMSERVICE_QNAME = new QName("http://solictarnotadebitocuentacorriente.servicios.procesadortransacciones.davivienda.com/", "SolictarNotaDebitoCuentaCorrienteServiceATMService");
public SolictarNotaDebitoCuentaCorrienteServiceATMService(URL wsdlLocation) {
super(wsdlLocation, SOLICTARNOTADEBITOCUENTACORRIENTESERVICEATMSERVICE_QNAME);
}
@WebEndpoint(name = "SolictarNotaDebitoCuentaCorrienteServiceATMPort")
public ISolictarNotaDebitoCuentaCorrienteServiceATM getSolictarNotaDebitoCuentaCorrienteServiceATMPort() {
return super.getPort(new QName("http://solictarnotadebitocuentacorriente.servicios.procesadortransacciones.davivienda.com/", "SolictarNotaDebitoCuentaCorrienteServiceATMPort"), ISolictarNotaDebitoCuentaCorrienteServiceATM.class);
}
}
|
package com.quaspecsystems.payspec.lib.service;
import java.util.List;
import com.quaspecsystems.payspec.lib.exception.QuaspecServiceException;
import com.quaspecsystems.payspec.lib.model.IProduct;
public interface IProductService {
List<? extends IProduct> getAll() throws QuaspecServiceException;
List<? extends IProduct> getByIOrganization(String username) throws QuaspecServiceException;
IProduct get(String name) throws QuaspecServiceException;
IProduct createProduct(IProduct iProduct) throws QuaspecServiceException;
}
|
package waitfortest;
import testarch.io.BaseIO;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class YFS extends BaseIO {
public static void main(String[] args) {
// Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] arr = new int[n];
// 查找下边界
int lastFloorFirstYeZi;
for (lastFloorFirstYeZi = 0; lastFloorFirstYeZi < n; lastFloorFirstYeZi = 2 * lastFloorFirstYeZi + 1)
; //查找最后一层,从左到右第一个叶子节点
lastFloorFirstYeZi = (lastFloorFirstYeZi - 1) / 2;
List<Integer> rightYeZi = new ArrayList<>();
List<Integer> leftYeZi = new ArrayList<>();
for (int i = 0; i < n; i++) {
arr[i] = sc.nextInt();
if (i * 2 + 1 >= n) { //叶子节点
if (i < lastFloorFirstYeZi) {
rightYeZi.add(i);
} else {
leftYeZi.add(i);
}
}
}
// 直接输出左边界
int left = 0;
while (left < lastFloorFirstYeZi) {
System.out.print(arr[left] + " ");
left = left * 2 + 1;
}
// 输出下边界
for (Integer i : leftYeZi) {
System.out.print(arr[i] + " ");
}
for (Integer i : rightYeZi) {
System.out.print(arr[i] + " ");
}
// 输出右边界
List<Integer> r = new ArrayList<>();
for (int right = 0; right < n; right = 2 * right + 2) {
if (right*2+1 < n)
r.add(right);
}
Collections.reverse(r);
for (int k = 0; k < r.size() - 1; k++) {
System.out.print(arr[r.get(k)] + " ");
}
// System.out.println(" ");
}
}
|
package com.kieferlam.battlelan.game.map;
import com.kieferlam.battlelan.game.Game;
import com.kieferlam.battlelan.game.shaders.Shader;
import com.kieferlam.battlelan.game.shaders.ShaderProgram;
import org.jbox2d.collision.shapes.Shape;
import org.jbox2d.common.Vec2;
import org.jbox2d.dynamics.*;
import org.lwjgl.opengl.GL20;
import java.io.IOException;
/**
* Created by Kiefer on 26/04/2015.
*/
public class PhysicsWorld {
public ShaderProgram renderProgram;
public Shader vertexShader, fragmentShader;
public int uniformPositionLocation;
public World world;
public Vec2 gravity;
public PhysicsWorld(Vec2 gravity){
this.gravity = gravity;
world = new World(gravity);
world.setSleepingAllowed(false);
renderProgram = new ShaderProgram();
vertexShader = new Shader(GL20.GL_VERTEX_SHADER);
fragmentShader = new Shader(GL20.GL_FRAGMENT_SHADER);
try {
vertexShader.loadSource(System.getProperty("user.dir") + "/Battlelan/src/com/kieferlam/battlelan/game/shaders/mapObjectVertexShader.vert");
fragmentShader.loadSource(System.getProperty("user.dir") + "/Battlelan/src/com/kieferlam/battlelan/game/shaders/mapObjectFragmentShader.frag");
vertexShader.attachSource();
fragmentShader.attachSource();
vertexShader.compile();
fragmentShader.compile();
renderProgram.attachShader(vertexShader);
renderProgram.attachShader(fragmentShader);
renderProgram.link();
renderProgram.validate();
renderProgram.use();
uniformPositionLocation = renderProgram.getUniformLocation("position");
} catch (IOException e) {
e.printStackTrace();
}
}
public Body createBody(Vec2 position, BodyType bt){
BodyDef def = new BodyDef();
def.setPosition(position);
def.setType(bt);
return world.createBody(def);
}
public Fixture createFixture(Shape s, float friction, float density, Body b){
FixtureDef def = new FixtureDef();
def.density = density;
def.friction = friction;
def.shape = s;
return b.createFixture(def);
}
public void useProgram(){
renderProgram.use();
}
public void update(float delta){
world.step(delta / 1000.0f, 6, 2);
}
}
|
/**
* Common MVC logic for matching incoming requests based on conditions.
*/
@NonNullApi
@NonNullFields
package org.springframework.web.servlet.mvc.condition;
import org.springframework.lang.NonNullApi;
import org.springframework.lang.NonNullFields;
|
import java.util.Date;
public class Request {
private int seller_id;
private int type; //»õÎïÖÖÀà
private double weight;
private char start;
private char destination;
private Boolean urgent;
public Request(int seller_id, int type, double weight, char start, char destination, Boolean urgent) {
// TODO Auto-generated constructor stub
this.seller_id = seller_id;
this.type = type;
this.weight = weight;
this.start = start;
this.destination = destination;
this.urgent = urgent;
}
public int getSeller_id() {
return seller_id;
}
public int getType() {
return type;
}
public double getWeight() {
return weight;
}
public char getStart() {
return start;
}
public char getDestination() {
return destination;
}
public Boolean getUrgent() {
return urgent;
}
public void setSeller_id(int seller_id) {
this.seller_id = seller_id;
}
public void setType(int type) {
this.type = type;
}
public void setWeight(double weight) {
this.weight = weight;
}
public void setStart(char start) {
this.start = start;
}
public void setDestination(char destination) {
this.destination = destination;
}
public void setUrgent(Boolean urgent) {
this.urgent = urgent;
}
}
|
/**
* $Id: Cast.java,v 1.18 2005/09/09 22:32:46 nicks Exp nicks $
*
* Contains information about cast member for particular performance.
* Performance is essentially a container class (among other things)
* for Casts.
*
* Originally part of the AMATO application.
*
* @author Nick Seidenman <nick@seidenman.net>
* @version $Revision: 1.18 $
*
* $Log: Cast.java,v $
* Revision 1.18 2005/09/09 22:32:46 nicks
* Changed all remaining explicit calls to JOptionPanel to Amato.errorPopup.
*
* Revision 1.17 2005/09/07 15:47:08 nicks
* Now able to edit performances. Will proceed to add this capability
* to other Add*Frame.java components.
*
* Revision 1.16 2005/08/16 21:17:27 nicks
* Changed comment header to comply with javadoc convention.
*
* Revision 1.15 2005/08/16 02:18:02 nicks
* Cast was adding itself to Performance. Now all instances
* of this call Performance.add_cast.
*
* Revision 1.14 2005/08/15 14:26:28 nicks
* Changed as_* to to* (more java-esque)
*
* Revision 1.13 2005/07/22 22:12:39 nicks
* Started work on Drag-n-Drop within RosterPanel.
* Cleaned up nearly all warnings. Only a few left in Opera.java, Operas.java,
* and Performance.java and these pertain to strict type-checking ala 1.5.
* Just wanted to check everything in now as a check point. I'll continue
* to work on getting a totally clean compilation.
*
* Revision 1.12 2005/07/17 11:48:35 nicks
* toJPanel instead of as_JLabel (instead of toHTML).
*
* Revision 1.11 2005/07/14 22:27:40 nicks
* Replaced println messages with ErrorDialog box.
*
* Revision 1.10 2005/06/29 19:51:37 nicks
* Added conductor(s) to performance(s).
*
* Revision 1.9 2005/06/24 22:31:14 nicks
* Added constructor for making copies of Cast instances.
*
* Revision 1.8 2005/06/23 19:43:28 nicks
* File operations (other than Print) now working.
*
* Revision 1.7 2005/06/20 22:34:38 nicks
* SeasonPanel is now working in a cheesy, demo-only sort of way. It's
* at least enough for me to get the idea across to Irene and talk
* through how it will work when finished.d
*
* Revision 1.6 2005/06/20 18:27:58 nicks
* Now sorts cast members, production names, performance date/time.
*
* Revision 1.5 2005/06/20 18:07:48 nicks
* A few minor tweaks.
*
* Revision 1.4 2005/06/20 17:31:30 nicks
* SeasonPanel (dummy'd up) now working.
*
* Revision 1.3 2005/06/16 15:25:05 nicks
* Added object_name (HashMap aMap) constructor so that I can simply pass
* the attribute map from the parser without the parser itself ever
* needing to know such details as which attributes are required and
* which are optional. This is a slicker, cleaner, more OO way to
* handle XML tag attributes.
*
* Revision 1.2 2005/06/15 20:47:04 nicks
* Everything (but Roster) is now working fine. I can digest an AmatoBase,
* spit it back out, digest it again, spit it out again, and the third
* gen matches the second gen.
*
* Revision 1.1 2005/06/15 20:23:07 nicks
* Initial revision
*
*/
import java.io.*;
import java.util.*;
import javax.swing.*;
public class Cast
implements Serializable
{
private static final long serialVersionUID = 20050915163000L;
private Performance perf;
private Opera opera;
private Role role;
private Constituent actor;
private String call;
private boolean isCover;
public Cast (Performance perf, Roster roster, HashMap aMap)
{
this.perf = perf;
String first_name = (String) aMap.get ("first_name");
String last_name = (String) aMap.get ("last_name");
actor = null;
Object[] cmList = roster.findByName (first_name, last_name);
if (cmList.length == 0) {
Amato.errorPopup ("Cast member \"" + first_name + " " + last_name + "\"" +
" isn't on the roster. Ignored.");
return;
}
// Just take the first person we find.
actor = (Constituent) cmList[0];
call = (String) aMap.get ("call");
isCover = false;
if (call == null || !call.equals ("cover")) {
call = new String ("on");
isCover = false;
}
else {
call = new String ("cover");
isCover = true;
}
opera = this.perf.getProduction().getOpera();
if (opera != null) {
role = opera.getRoleByName ((String) aMap.get ("role"));
}
else {
Amato.errorPopup ("No entry found for specified opera.\n" +
"Ignored.");
return;
}
}
public Cast (Cast c) // Make a copy of Cast instance.
{
this.perf = c.perf;
actor = c.actor;
call = c.call;
if (call == null || (!(call.equals ("on") || call.equals ("cover")))) {
call = new String ("on");
isCover = false;
}
else {
call = new String ("cover");
isCover = true;
}
opera = c.opera;
role = c.role;
}
final public String toXML ()
{
String result;
result = "<cast first_name=\"" + getFirstName() + "\"" +
" last_name=\"" + getLastName() + "\"" +
" role=\"" + role.getName() + "\"" +
" call=\"" + call + "\"/>";
return result;
}
final public Role getRole ()
{
return role;
}
final public String getFirstName () { return actor.getFirstName(); }
final public String getLastName () { return actor.getLastName(); }
final public String getName () { return actor.toString(); }
final public Constituent getActor () { return actor; }
final public String getCall () { return call; }
final public boolean equals (Constituent c) { return actor.equals (c); }
final public boolean isCover () { return isCover; }
}
|
package com.example.thelimitbreaker.tabexperiment;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
TabLayout tabLayout= findViewById(R.id.tabLayout);
tabLayout.addTab(tabLayout.newTab().setText("Tab 1"));
tabLayout.addTab(tabLayout.newTab().setText("Tab 2"));
tabLayout.addTab(tabLayout.newTab().setText("Tab 3"));
final ViewPager viewPager = findViewById(R.id.pager);
PagerAdapter pagerAdapter = new PagerAdapter(getSupportFragmentManager(),tabLayout.getTabCount());
viewPager.setAdapter(pagerAdapter);
// adds Swipe to page change and tab change
// NOT tab click to change to page change
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
viewPager.setCurrentItem(tab.getPosition(),true);
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main,menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()){
case R.id.action_Settings:
Toast.makeText(this,"Settings",Toast.LENGTH_SHORT).show();
break;
}
return super.onOptionsItemSelected(item);
}
}
|
package com.example.enchanterswapna.foodpanda;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by enchanterswapna on 13/7/17.
*/
public class dealivlist implements Parcelable {
String ptypes;
String pptypes;
String pcost;
public String getPtypes() {
return ptypes;
}
public void setPtypes(String ptypes) {
this.ptypes = ptypes;
}
public String getPptypes() {
return pptypes;
}
public void setPptypes(String pptypes) {
this.pptypes = pptypes;
}
public String getPcost() {
return pcost;
}
public void setPcost(String pcost) {
this.pcost = pcost;
}
protected dealivlist(Parcel in) {
ptypes = in.readString();
pptypes = in.readString();
pcost = in.readString();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(ptypes);
dest.writeString(pptypes);
dest.writeString(pcost);
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<dealivlist> CREATOR = new Creator<dealivlist>() {
@Override
public dealivlist createFromParcel(Parcel in) {
return new dealivlist(in);
}
@Override
public dealivlist[] newArray(int size) {
return new dealivlist[size];
}
};
}
|
/*
* Created by Angel Leon (@gubatron), Alden Torres (aldenml), Erich Pleny (erichpleny)
* Copyright (c) 2012, FrostWire(R). All rights reserved.
*
* 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.frostwire.gui.mplayer;
public class AlphaAnimationThread extends Thread {
private static final int TARGET_ALPHA = 90 * 255 / 100;
private static final int ALPHA_STEP = 20;
private boolean disposed = false;
private Object animationStart = new Object();
private boolean isHiding;
private boolean isShowing;
private int currentAlpha = TARGET_ALPHA;
private boolean stopAlphaThread = false;
private AlphaTarget target;
public AlphaAnimationThread(AlphaTarget target) {
this.target = target;
}
public void setDisposed() {
disposed = true;
}
public void animateToTransparent() {
if (isHiding) {
return;
}
if (isShowing) {
isShowing = false;
}
isHiding = true;
synchronized (animationStart) {
animationStart.notify();
}
}
public void animateToOpaque() {
if (isShowing) {
return;
}
if (isHiding) {
isHiding = false;
}
isShowing = true;
synchronized (animationStart) {
animationStart.notify();
}
}
private float currentAlphaValue() {
return (currentAlpha * 1f) / TARGET_ALPHA;
}
public void run() {
while (!stopAlphaThread && !disposed) {
if (isHiding) {
if (currentAlpha > 0) {
if (currentAlpha >= ALPHA_STEP) {
currentAlpha -= ALPHA_STEP;
} else {
currentAlpha = 0;
}
target.setAlpha(currentAlphaValue());
} else {
isHiding = false;
}
}
if (isShowing) {
if (currentAlpha < TARGET_ALPHA) {
if (currentAlpha <= TARGET_ALPHA - ALPHA_STEP) {
currentAlpha += ALPHA_STEP;
} else {
currentAlpha = TARGET_ALPHA;
}
target.setAlpha(currentAlphaValue());
} else {
isShowing = false;
}
}
try {
if (isShowing || isHiding) {
Thread.sleep(50);
} else {
synchronized (animationStart) {
if (stopAlphaThread) {
return;
}
animationStart.wait();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
|
package enshud.s2.parser.parsers;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import enshud.s1.lexer.TokenStruct;
import enshud.s2.parser.ParserException;
import enshud.syntaxtree.AbstractSyntaxNode;
import enshud.syntaxtree.NonterminalNode;
public class AbstractNonterminalParser implements IParser {
public List<ArrayList<IParser>> generativeRule; // プログラマが事前に与える
protected Map<Integer, ArrayList<IParser>> parseRule; // プログラムが生成する
protected String variableName; // プログラマが事前に与える
@Override
public AbstractSyntaxNode parse(Queue<TokenStruct> tokenQueue) throws ParserException {
AbstractSyntaxNode syntaxNode = new NonterminalNode(variableName);
if (parseRule == null)
first();
if (tokenQueue.isEmpty())
throw new RuntimeException("tokenQueue must not be empty");
TokenStruct peekToken = tokenQueue.peek();
if (parseRule.containsKey(peekToken.type)) {
for (IParser parser : parseRule.get(peekToken.type)) {
var childNode = parser.parse(tokenQueue);
if(syntaxNode.size() == 0)
syntaxNode.startLineNumber = childNode.startLineNumber;
syntaxNode.add(childNode);
}
} else if (parseRule.containsKey(EPSILON)) {
for (IParser parser : parseRule.get(EPSILON)) {
var childNode = parser.parse(tokenQueue);
if(syntaxNode.size() == 0)
syntaxNode.startLineNumber = childNode.startLineNumber;
syntaxNode.add(childNode);
}
} else if (peekToken.type == EPSILON)
throw new ParserException("Unexpected EOF", peekToken);
else {
throw new ParserException("Unexpected token", peekToken);
}
return syntaxNode;
}
@Override
public Set<Integer> first() {
// parseRuleの生成をコンストラクタで行うと,継承関係でparseRuleの生成順がおかしくなるので.
if (parseRule == null) {
if (generativeRule == null)
throw new RuntimeException("generativeRule is not defined");
// parseRuleの生成
parseRule = calculateParseRule(generativeRule);
/*
try {
parseRule = calculateParseRule(generativeRule);
} catch(Exception ex) {
System.out.println(((NonterminalParser)this).variableName);
ex.printStackTrace();
}
*/
}
return parseRule.keySet();
}
// 生成規則から,FIRST集合に基づくパーサの処理規則を計算する
protected final static Map<Integer, ArrayList<IParser>> calculateParseRule(
List<ArrayList<IParser>> generativeRule) {
Map<Integer, ArrayList<IParser>> res = new HashMap<Integer, ArrayList<IParser>>();
generationLoop: for (ArrayList<IParser> parsers : generativeRule) {
for (IParser parser : parsers) {
Set<Integer> firstSet = parser.first();
boolean conatinsEpsilon = firstSet.contains(EPSILON);
for (int first : firstSet) {
if (first == EPSILON)
continue;
if (res.containsKey(first))
throw new RuntimeException("The grammar is not LL(1)");
res.put(first, parsers);
}
if (!conatinsEpsilon)
continue generationLoop;
}
if (res.containsKey(EPSILON))
throw new RuntimeException("The grammar is not LL(1)");
res.put(EPSILON, parsers);
}
return res;
}
}
|
package com.learningjava.VideoRentalApi.repositories;
import com.learningjava.VideoRentalApi.entity.RentalHistory;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import javax.persistence.Id;
@Repository
public interface RentalHistoryRepository extends JpaRepository<RentalHistory, Integer> {
}
|
package com.zlb.permission.sample;
import android.Manifest;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import com.zlb.permission.PermissionManager;
import com.zlb.permission.anno.RequestPermissions;
import com.zlb.permission.callback.PermissionCallBack;
public class MainActivity extends AppCompatActivity {
private String TAG=getClass().getSimpleName();
@RequestPermissions(permission = {Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.READ_CONTACTS})
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.btn_request).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PermissionManager pm = new PermissionManager(MainActivity.this);
pm.request(new PermissionCallBack() {
@Override
public void onSuccess() {
Log.d(TAG,"权限申请成功");
}
@Override
public void onFailt() {
Log.d(TAG,"权限申请失败");
}
});
}
});
}
}
|
/**
* Copyright (C) 2014-2017 Philip Helger (www.helger.com)
* philip[at]helger[dot]com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.helger.commons.collection.attr;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Arrays;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.helger.commons.typeconvert.TypeConverter;
/**
* Contains static conversion routines used by the attribute container classes.
*
* @author Philip Helger
*/
@Immutable
public final class AttributeValueConverter
{
private static final Logger s_aLogger = LoggerFactory.getLogger (AttributeValueConverter.class);
private AttributeValueConverter ()
{}
@Nullable
private static String _getAsSingleString (@Nullable final Object aParamName,
@Nonnull final String [] aArray,
@Nullable final String sDefault)
{
// expected a single string but got an array
s_aLogger.warn ("The attribute '" +
aParamName +
"' is an array with " +
aArray.length +
" items; using the first one if possible: " +
Arrays.toString (aArray));
return aArray.length > 0 ? aArray[0] : sDefault;
}
/**
* Get the string representation of the passed value, suitable for parameters.
*
* @param aParamName
* The name of the parameters. Has just informal character, for
* warnings. May be <code>null</code>.
* @param aValue
* The value to be converted to a String. May be <code>null</code>.
* Explicitly supported data types are: String, String[]. All other
* data types are returned as "toString()".
* @param sDefault
* The default value to be returned, if the passed value is
* <code>null</code> or an empty String array.
* @return The default value if the value is <code>null</code> or an empty
* String array, the value as string otherwise. If the value is a
* String[] than the first element is returned, and the other elements
* are discarded.
*/
@Nullable
public static String getAsString (@Nullable final Object aParamName,
@Nullable final Object aValue,
@Nullable final String sDefault)
{
if (aValue == null)
return sDefault;
if (aValue instanceof String)
return (String) aValue;
if (aValue instanceof String [])
return _getAsSingleString (aParamName, (String []) aValue, sDefault);
return TypeConverter.convertIfNecessary (aValue, String.class, sDefault);
}
public static int getAsInt (@Nullable final Object aParamName, @Nullable final Object aValue, final int nDefault)
{
if (aValue == null)
return nDefault;
if (aValue instanceof Number)
return ((Number) aValue).intValue ();
if (aValue instanceof String [])
return TypeConverter.convertToInt (_getAsSingleString (aParamName, (String []) aValue, null), nDefault);
return TypeConverter.convertToInt (aValue, nDefault);
}
public static long getAsLong (@Nullable final Object aParamName, @Nullable final Object aValue, final long nDefault)
{
if (aValue == null)
return nDefault;
if (aValue instanceof Number)
return ((Number) aValue).longValue ();
if (aValue instanceof String [])
return TypeConverter.convertToLong (_getAsSingleString (aParamName, (String []) aValue, null), nDefault);
return TypeConverter.convertToLong (aValue, nDefault);
}
public static double getAsDouble (@Nullable final Object aParamName,
@Nullable final Object aValue,
final double dDefault)
{
if (aValue == null)
return dDefault;
if (aValue instanceof Number)
return ((Number) aValue).doubleValue ();
if (aValue instanceof String [])
return TypeConverter.convertToDouble (_getAsSingleString (aParamName, (String []) aValue, null), dDefault);
return TypeConverter.convertToDouble (aValue, dDefault);
}
public static float getAsFloat (@Nullable final Object aParamName,
@Nullable final Object aValue,
final float fDefault)
{
if (aValue == null)
return fDefault;
if (aValue instanceof Number)
return ((Number) aValue).floatValue ();
if (aValue instanceof String [])
return TypeConverter.convertToFloat (_getAsSingleString (aParamName, (String []) aValue, null), fDefault);
return TypeConverter.convertToFloat (aValue, fDefault);
}
public static boolean getAsBoolean (@Nullable final Object aParamName,
@Nullable final Object aValue,
final boolean bDefault)
{
if (aValue == null)
return bDefault;
if (aValue instanceof Boolean)
return ((Boolean) aValue).booleanValue ();
if (aValue instanceof String [])
return TypeConverter.convertToBoolean (_getAsSingleString (aParamName, (String []) aValue, null), bDefault);
return TypeConverter.convertToBoolean (aValue, bDefault);
}
@Nullable
public static BigInteger getAsBigInteger (@Nullable final Object aParamName,
@Nullable final Object aValue,
@Nullable final BigInteger aDefault)
{
if (aValue instanceof String [])
return TypeConverter.convertIfNecessary (_getAsSingleString (aParamName, (String []) aValue, null),
BigInteger.class,
aDefault);
return TypeConverter.convertIfNecessary (aValue, BigInteger.class, aDefault);
}
@Nullable
public static BigDecimal getAsBigDecimal (@Nullable final Object aParamName,
@Nullable final Object aValue,
@Nullable final BigDecimal aDefault)
{
if (aValue instanceof String [])
return TypeConverter.convertIfNecessary (_getAsSingleString (aParamName, (String []) aValue, null),
BigDecimal.class,
aDefault);
return TypeConverter.convertIfNecessary (aValue, BigDecimal.class, aDefault);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.