blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1cd1947d21a0f9e34a401faf37ead620975af095 | f586e378c3618948beafb3ede1d143d5d2e6f685 | /app/src/main/java/com/autodetectimage/console/ConsoleAdapter.java | 1690db7b95ba922cbaf3fe21db5fe2ef1d542e2a | []
| no_license | Mahikadu/AndroidWorkspace | 91c85279f0381ca4be8b922460f376fe9cd7103a | 296a74b2e52dcd2d7316b35ebff18588045fceb8 | refs/heads/master | 2021-07-01T18:07:43.137412 | 2017-09-22T08:53:01 | 2017-09-22T08:53:01 | 104,453,290 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,238 | java | package com.autodetectimage.console;
import android.content.Context;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.autodetectimage.R;
import com.autodetectimage.util.IntPair;
import com.autodetectimage.util.Utils;
import java.util.ArrayList;
import java.util.Arrays;
/**
* Created by Denis on 10.06.2016.
*/
public class ConsoleAdapter extends RecyclerView.Adapter<ConsoleAdapter.ConsoleViewHolder>
implements ConsoleView.IConsole {
private final Context mContext;
private final ArrayList<ConsoleLineImpl> mLines = new ArrayList<>();
public class ConsoleLineImpl extends ConsoleView.ConsoleLine implements Runnable {
public ConsoleLineImpl(Object tag, CharSequence text, long showDelay) {
super(tag, text, showDelay);
}
@Override
public void run() {
final int [] removed = findLine(this);
remove(removed, false);
notifyRemoved(removed);
}
}
class ConsoleViewHolder extends RecyclerView.ViewHolder {
final ConsoleTextView mConsoleText;
ConsoleViewHolder(View itemView) {
super(itemView);
mConsoleText = (ConsoleTextView) itemView.findViewById(android.R.id.text1);
}
}
private int mDockSide = -1;
public ConsoleAdapter(@NonNull Context context) {
mContext = context;
}
@Override
public int getItemCount() {
return mLines.size();
}
@Override
public ConsoleViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
View itemView = inflater.inflate(R.layout.list_row_console, parent, false);
return new ConsoleViewHolder(itemView);
}
@Override
public void onBindViewHolder(ConsoleViewHolder holder, int position) {
// Reposition text
ViewGroup.LayoutParams params = holder.itemView.getLayoutParams();
if (ConsoleView.isVertical(mDockSide)) {
params.width = ViewGroup.LayoutParams.WRAP_CONTENT;
params.height = ViewGroup.LayoutParams.MATCH_PARENT;
} else {
params.width = ViewGroup.LayoutParams.MATCH_PARENT;
params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
}
holder.itemView.setLayoutParams(params);
final ConsoleLineImpl line = (ConsoleLineImpl) mLines.get(position);
holder.mConsoleText.setText(line.text);
holder.mConsoleText.setDockSide(mDockSide);
}
// Array adapter simulation
private Context getContext() {
return mContext;
}
/**
* NOTE: No adapter notification!
* @param removed
* @param fromHandler
*/
private void remove(@NonNull int [] removed, boolean fromHandler) {
for (int index : removed) {
final ConsoleLineImpl line = mLines.remove(index);
if (fromHandler) {
mShowHandler.removeCallbacks(line);
}
}
}
private int [] findTag(Object tag) {
// Collect line indices with same tag
final int [] indices = new int[mLines.size()];
int count = 0;
for (int i = mLines.size()-1; i >= 0; i--) {
ConsoleLineImpl line = mLines.get(i);
if (line.tag == tag) {
indices[count++] = i;
}
}
return Arrays.copyOf(indices, count);
}
private int [] findLine(ConsoleLineImpl line) {
// Collect line indices with same tag
final int [] indices = new int[mLines.size()];
int count = 0;
for (int i = mLines.size()-1; i >= 0; i--) {
ConsoleLineImpl item = mLines.get(i);
if (line == item) {
indices[count++] = i;
}
}
return Arrays.copyOf(indices, count);
}
private ConsoleView.ConsoleLine getItem(int position) {
return mLines.get(position);
}
private final Handler mShowHandler = new Handler();
@Override
public void appendLine(Object tag, @StringRes int textId, long showDelay) {
appendLine(tag, getContext().getString(textId), showDelay);
}
@Override
public void appendLine(Object tag, CharSequence text, long showDelay) {
// Remove line with same tag
int removed [] = findTag(tag);
remove(removed, true);
final ConsoleLineImpl line = new ConsoleLineImpl(tag, text, showDelay);
mLines.add(line);
if (removed.length > 0) {
// Entire content changed
notifyDataSetChanged();
} else {
// Only append occurs
notifyItemInserted(mLines.size() - 1);
}
if (showDelay != ConsoleView.INFINITE) {
mShowHandler.postDelayed(line, showDelay);
}
}
@Override
public void removeLine(Object tag) {
int removed [] = findTag(tag); // Find all indices
remove(removed, true); // really remove from list
notifyRemoved(removed);
}
private void notifyRemoved(@NonNull int [] removed) {
final IntPair[] pairs = Utils.collectRanges(removed, removed.length);
if (pairs.length == 1) {
// One range removed
final IntPair pair = pairs[0];
notifyItemRangeRemoved(pair.first, pair.second - pair.first + 1);
} else if (pairs.length > 1) {
// Notify entire view if removed
notifyDataSetChanged();
}
}
@Override
public void clear() {
mShowHandler.removeCallbacksAndMessages(null);
mLines.clear();
notifyDataSetChanged();
}
public void setDockSide(int dockSide) {
if (mDockSide != dockSide) {
mDockSide = dockSide;
notifyItemRangeChanged(0, getItemCount());
}
}
}
| [
"[email protected]"
]
| |
f94e51440fe0ab6b3a0a4f459dc7150a5b4c902c | 2e91f10217264b39d9fffe27b06437ae050ef16c | /src/main/java/com/tsavo/hippo/OHLCVData.java | 07631c8fee889fbfdadd9910200c1c41329c774f | [
"Apache-2.0"
]
| permissive | TSavo/Hippo | b3ac3b7f9edd5681182bd78ea91c75ddc4dac783 | a8fb5552a95af5f00cff5a5e497edcdf783dccd5 | refs/heads/master | 2020-12-26T04:16:21.778660 | 2017-10-05T21:20:33 | 2017-10-05T21:20:33 | 33,804,315 | 9 | 7 | Apache-2.0 | 2020-12-28T19:00:50 | 2015-04-12T05:20:29 | Java | UTF-8 | Java | false | false | 2,091 | java | package com.tsavo.hippo;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.joda.time.DateTime;
import org.joda.time.Duration;
import org.knowm.xchange.dto.marketdata.Trade;
import java.math.BigDecimal;
import java.util.List;
import java.util.Set;
import java.util.SortedSet;
import java.util.stream.Collectors;
public class OHLCVData implements Comparable<OHLCVData> {
public DateTime startDate;
public Duration length;
public BigDecimal open;
public BigDecimal high;
public BigDecimal low;
public BigDecimal close;
public BigDecimal volume;
public OHLCVData(DateTime aDate, Duration aLength, BigDecimal aOpen, BigDecimal aHigh, BigDecimal aLow, BigDecimal aClose, BigDecimal aVolume){
startDate = aDate;
length = aLength;
open = aOpen;
high = aHigh;
low = aLow;
close = aClose;
volume = aVolume;
}
public OHLCVData(DateTime aDate, Duration aLength, Set<Trade> dbData) {
startDate = aDate;
length = aLength;
DateTime endDate = startDate.plus(aLength);
List<Trade> trades = dbData.stream().filter(x -> new DateTime(x.getTimestamp().getTime()).isAfter(startDate) && new DateTime(x.getTimestamp()).isBefore(endDate)).collect(Collectors.toList());
if (trades.size() == 0) {
return;
}
open = trades.stream().min((x, y) -> x.getTimestamp().compareTo(y.getTimestamp())).get().getPrice();
close = trades.stream().max((x, y) -> x.getTimestamp().compareTo(y.getTimestamp())).get().getPrice();
low = trades.stream().min((x, y) -> x.getPrice().compareTo(y.getPrice())).get().getPrice();
high = trades.stream().max((x, y) -> x.getPrice().compareTo(y.getPrice())).get().getPrice();
volume = trades.stream().map((x) -> x.getTradableAmount()).reduce((x, y) -> x.add(y)).get();
}
@Override
public int compareTo(OHLCVData o) {
return startDate.compareTo(o.startDate);
}
@Override
public String toString() {
return new ToStringBuilder(this).append("Date", startDate).append("Length", length).append("Open", open).append("High", high).append("Low", low).append("Close", close)
.append("Volume", volume).toString();
}
}
| [
"[email protected]"
]
| |
379ddf2a66f9613ebfaaccd0865e969a87f373ed | 189f16d38236a2ebe488e150bb9b4f93532e63cb | /src/main/java/org/smart4j/framework/helper/BeanHelper.java | b0f448a99f3a276f8790bd1b0f7163e165ac9d5c | []
| no_license | ben1247/smart-framework | d616785ffaf4d0eb70053814709e15ed23b3177e | 6dc342ae0e6b19d7127c7d11d5b33eea6f5ba5bc | refs/heads/master | 2021-08-08T22:37:22.784194 | 2017-11-11T13:49:02 | 2017-11-11T13:49:02 | 106,567,084 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,258 | java | package org.smart4j.framework.helper;
import org.smart4j.framework.util.ReflectionUtil;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* Bean 助手类
* Created by yuezhang on 17/10/6.
*/
public final class BeanHelper {
private static final Map<Class<?>,Object> BEAN_MAP;
static {
BEAN_MAP = new HashMap<>();
Set<Class<?>> beanClassSet = ClassHelper.getBeanClassSet();
for(Class<?> beanClass : beanClassSet){
Object obj = ReflectionUtil.newInstance(beanClass);
BEAN_MAP.put(beanClass,obj);
}
}
/**
* 获取Bean映射
* @return
*/
public static Map<Class<?>,Object> getBeanMap(){
return BEAN_MAP;
}
/**
* 获取Bean实例
* @param cls
* @param <T>
* @return
*/
@SuppressWarnings("unchecked")
public static <T> T getBean(Class<T> cls){
if(!BEAN_MAP.containsKey(cls)){
throw new RuntimeException("can not get bean by class: " + cls);
}
return (T) BEAN_MAP.get(cls);
}
/**
* 设置Bean实例
* @param cls
* @param obj
*/
public static void setBean(Class<?> cls ,Object obj){
BEAN_MAP.put(cls,obj);
}
}
| [
"[email protected]"
]
| |
5b0ca6ce8c7f214be5c76fdc8063891b28fddbeb | f2263542ddfc833d81f1e9b496b6ed11ae2ef04b | /src/main/java/com/bigstalker/service/AbstractService.java | 5ffde3d9c40ff92e1ec9fece2ac6c99e8ccc468e | []
| no_license | sabotageBR/bigstalker | 8ea26af69a3d510d0f9c805ae4ac151c2f5940f0 | b0f7117b102d57a65a2acccb06840ba81aae2635 | refs/heads/master | 2021-03-17T09:23:02.937677 | 2021-03-04T03:46:46 | 2021-03-04T03:46:46 | 246,977,538 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 658 | java | package com.bigstalker.service;
import java.io.Serializable;
import java.util.List;
import com.bigstalker.dao.AbstractDAO;
public abstract class AbstractService<T> {
public abstract AbstractDAO<T> getDAO();
public void incluir(T entidade){
getDAO().incluir(entidade);
}
public void alterar(T entidade){
getDAO().alterar(entidade);
}
public void excluir(T entidade){
getDAO().excluir(entidade);
}
public T recuperar(Serializable id){
return getDAO().recuperar(id);
}
public List<T> listar(){
return getDAO().listar();
}
public void incluirLista(List<T> listaEntidade){
getDAO().incluirLista(listaEntidade);
}
}
| [
"sabotageBR@sabotageBR"
]
| sabotageBR@sabotageBR |
9f3f4044149610a805d5479b8925aa5f352c7168 | 9966310a034d716656cd7eb78ac5e95b6da72584 | /DataStructure/src/main/java/com/ti/class21/DeepCopyUndirectedGraph.java | b059df23d540cbc0bdc5753336aeb7e873ad1c07 | []
| no_license | shipengx/ParentModule | 03d63ecd7e95b9d17f8bcdd30ef77d611f8fb060 | bb1a90903026074fa2c92099903fe8993135b4a7 | refs/heads/master | 2022-12-22T13:58:08.154949 | 2020-02-23T00:35:55 | 2020-02-23T00:35:55 | 73,237,424 | 0 | 0 | null | 2022-12-15T23:30:34 | 2016-11-08T23:52:47 | Java | UTF-8 | Java | false | false | 67 | java | package com.ti.class21;
public class DeepCopyUndirectedGraph {
}
| [
"[email protected]"
]
| |
59cb4d59c1ac0e9034443e1f6b88219d4238bac0 | d5271287310e51984f4caf9f64791006b5883edc | /java/codingbat/HKUSTx/src/graphicaluserinterface/CreatingAWindow.java | 6d38d3b4234edc0d451db850c489d877a1b0a0d5 | []
| no_license | mxd369/java_ish | 9dafbb82655c05faaaffe59b95b7dc1986255b4e | 1ea4fc5f659f718cfeca5182efa50b87e40ab802 | refs/heads/master | 2020-05-22T15:21:46.007829 | 2017-03-17T03:06:48 | 2017-03-17T03:06:48 | 84,697,644 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 550 | java | package graphicaluserinterface;
import javax.swing.JFrame;
public class CreatingAWindow {
public static void main(String[] args) {
JFrame aWindow = new JFrame("This is the Window Title");
int windowWidth = 400; // Window width in pixels
int windowHeight = 150; // Window height in pixels
aWindow.setBounds(50, 100, // Set position
windowWidth, windowHeight); // and size
aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
aWindow.setVisible(true); // Display the window
}
} | [
"[email protected]"
]
| |
200742bcb0fcaacb417357db69f10b7f94918c07 | 96cbcd1a19adcea9b42a72e596ab17fffb96419f | /QLcontacts/app/src/main/java/vkz/android/dev/qlcontacts/DatabaseHandler.java | 2ebff42a91957d043d89516698adfee085663f39 | []
| no_license | sonyu/android_projects | bb793b52658ae27567d609af695bb1f9a5b24fa8 | 16077f2b4a4e47174e998defa20b31bb4d571aa5 | refs/heads/master | 2021-01-19T09:55:21.667682 | 2017-02-22T02:05:22 | 2017-02-22T02:05:22 | 82,152,516 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,710 | java | package vkz.android.dev.qlcontacts;
import java.util.ArrayList;
import java.util.List;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.content.Context;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase;
/**
* Created by Administrator on 12/13/2016.
*/
public class DatabaseHandler extends SQLiteOpenHelper {
// All Static variables
// Database Version
private static final int DATABASE_VERSION = 1;
// Database Name
private static final String DATABASE_NAME = "contactsManager";
// Contacts table name
private static final String TABLE_CONTACTS = "contacts";
// Contacts Table Columns names
private static final String KEY_ID = "id";
private static final String KEY_NAME = "name";
private static final String KEY_PH_NO = "phone_number";
public DatabaseHandler(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
// Creating Tables
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_CONTACTS_TABLE = "CREATE TABLE " + TABLE_CONTACTS + "("
+ KEY_ID + " INTEGER PRIMARY KEY," + KEY_NAME + " TEXT,"
+ KEY_PH_NO + " TEXT" + ")";
db.execSQL(CREATE_CONTACTS_TABLE);
}
// Upgrading database
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// Drop older table if existed
db.execSQL("DROP TABLE IF EXISTS " + TABLE_CONTACTS);
// Create tables again
onCreate(db);
}
/**
* All CRUD(Create, Read, Update, Delete) Operations
*/
// Adding new contact
void addContact(Contact contact) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(KEY_NAME, contact.get_name()); // Contact Name
values.put(KEY_PH_NO, contact.get_phone_number()); // Contact Phone
// Inserting Row
db.insert(TABLE_CONTACTS, null, values);
db.close(); // Closing database connection
}
// Getting single contact
Contact getContact(int id) {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(TABLE_CONTACTS, new String[] { KEY_ID,
KEY_NAME, KEY_PH_NO }, KEY_ID + "=?",
new String[] { String.valueOf(id) }, null, null, null, null);
if (cursor != null)
cursor.moveToFirst();
Contact contact = new Contact(Integer.parseInt(cursor.getString(0)),
cursor.getString(1), cursor.getString(2));
// return contact
return contact;
}
// Getting All Contacts
public List<Contact> getAllContacts() {
List<Contact> contactList = new ArrayList<Contact>();
// Select All Query
String selectQuery = "SELECT * FROM " + TABLE_CONTACTS;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
Contact contact = new Contact();
contact.set_id(Integer.parseInt(cursor.getString(0)));
contact.set_name(cursor.getString(1));
contact.set_phone_number(cursor.getString(2));
// Adding contact to list
contactList.add(contact);
} while (cursor.moveToNext());
}
// return contact list
return contactList;
}
// Updating single contact
public int updateContact(Contact contact) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(KEY_NAME, contact.get_name());
values.put(KEY_PH_NO, contact.get_phone_number());
// updating row
return db.update(TABLE_CONTACTS, values, KEY_ID + " = ?",
new String[] { String.valueOf(contact.get_id()) });
}
// Deleting single contact
public void deleteContact(Contact contact) {
SQLiteDatabase db = this.getWritableDatabase();
db.delete(TABLE_CONTACTS, KEY_ID + " = ?",
new String[] { String.valueOf(contact.get_id()) });
db.close();
}
// Getting contacts Count
public int getContactsCount() {
String countQuery = "SELECT * FROM " + TABLE_CONTACTS;
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(countQuery, null);
cursor.close();
// return count
return cursor.getCount();
}
}
| [
"[email protected]"
]
| |
dbce0ce2eadaea2a7a5458c45eedf48a5fc874b2 | 9159c6f20fe08ad7992a4cd044fc3206398f7c58 | /corejava/src/com/tyss/javaapp/lamda/AddTwo.java | 4050b168d7cdc36aa44b07e22b20b69da867df1f | []
| no_license | bhavanar315/ELF-06June19-tyss-bhavani | 91def5b909f567536d04e69c9bb6193503398a04 | e2ee506ee99e0e958fb72e3bdaaf6e3315b84975 | refs/heads/master | 2020-07-21T07:45:19.944727 | 2019-09-06T07:43:42 | 2019-09-06T07:43:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 308 | java | package com.tyss.javaapp.lamda;
import java.util.logging.Logger;
import lombok.extern.java.Log;
@Log
public class AddTwo {
private static final Logger log=Logger.getLogger("bhavani");
public static void main(String[] args) {
MyMath m= Demo :: add;
int i= m.add(5, 6);
log.info("sum is"+i);
}
}
| [
"[email protected]"
]
| |
22697568bd5ce2a8ec8dd2d7adebde3a83a11cdd | 55a263bac51ff291a83a760a99281039c396691e | /src/test/java/samsara/webapicourse/Options204.java | 862bfb379fc35ca5605b9bb2d362b1509ab5abd0 | []
| no_license | sanjamiladinovic/SamsaraTesting | 5054fa769a06d52f304c1857f9fbfc508aaa83a4 | 6eea6db8092d4c3c92666caae0cdfd324dfb3cde | refs/heads/master | 2022-11-24T22:02:01.775685 | 2020-05-12T09:30:28 | 2020-05-12T09:30:28 | 241,398,091 | 0 | 0 | null | 2022-11-16T01:24:22 | 2020-02-18T15:34:42 | HTML | UTF-8 | Java | false | false | 844 | java | package samsara.webapicourse;
import static org.testng.Assert.assertEquals;
import java.io.IOException;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpOptions;
import org.testng.annotations.Test;
import resources.BaseClassAPI;
import util.ResponseAPIUtils;
public class Options204 extends BaseClassAPI {
@Test
public void optionsReturnsCorrectMethodsList() throws ClientProtocolException, IOException {
//Testiramo da li su nam dozvoljene metode iz expectedReply
String header = "Access-Control-Allow-Methods";
String expectedReply = "GET, POST, PATCH, PUT, DELETE";
HttpOptions request = new HttpOptions(BASE_ENDPOINT);
response = client.execute(request);
String actualValue = ResponseAPIUtils.getHeader(response, header);
assertEquals(actualValue, expectedReply);
}
}
| [
"[email protected]"
]
| |
4a573c57c0686270627778c17d23122830f23554 | e3c8172ff2d3caa15e712954ad12fbbe97d3c7aa | /app/src/main/java/com/example/food/Login/signup4.java | ac847a00c28d7850a4395b8f85a6a4b8fcc04411 | []
| no_license | AbhishekThakur1007/DinnerToDoor | 46440c8d84d14bc735e6bbb200ff14571124156c | f3f2db8659335d65ff24ac6907f852382fcca679 | refs/heads/master | 2023-07-11T03:55:09.919380 | 2021-08-20T05:42:59 | 2021-08-20T05:42:59 | 398,166,988 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,782 | java | package com.example.food.Login;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.location.Address;
import android.location.Geocoder;
import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.SearchView;
import android.widget.TextView;
import android.widget.Toast;
import com.example.food.R;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.common.api.ResolvableApiException;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.location.LocationSettingsRequest;
import com.google.android.gms.location.LocationSettingsResponse;
import com.google.android.gms.location.LocationSettingsStatusCodes;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textfield.TextInputLayout;
import java.io.IOException;
import java.util.List;
import java.util.Objects;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.fragment.app.FragmentActivity;
public class signup4 extends FragmentActivity implements OnMapReadyCallback{
Button button;
ImageButton sign_back41;
GoogleMap googleMap;
SupportMapFragment fragment;
TextInputEditText HomeAddress,Village1;
SearchView searchView;
RelativeLayout relativeLayout,DialogAddFloat1;
boolean GpsLocationCheck;
Animation slide_down, slide_up;
public static final int REQUEST_CHECK_SETTING = 1001;
public static final int REQUEST_CHECK = 1002;
Button Location, Manual;
ImageButton SetAuto;
TextInputLayout HouseNumber,Vill;
private LocationRequest locationRequest;
FusedLocationProviderClient fusedLocationClient;
String staffno, LatitudeFinal, LongitudeFinal;
TextView Heading;
android.location.Location locationFinal;
LatLng displayLatLng;
String nameS2,emailS2,passwordS2,genderS2,dateS2,phoneNo,staff;
Animation FloatEditTextUp,FloatEditTextDown;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_signup4);
// Heading Address
Heading = findViewById(R.id.Gpdgg);
//Edit Text
HomeAddress = findViewById(R.id.HomeAddress);
Village1 = findViewById(R.id.Village);
//Text Layout
HouseNumber = findViewById(R.id.plz1);
Vill = findViewById(R.id.plz2);
//Save And Proceed to next
button = findViewById(R.id.NextMap);
DialogAddFloat1 = findViewById(R.id.LayAddEdit);
FloatEditTextUp = AnimationUtils.loadAnimation(this,R.anim.top_send_up);
FloatEditTextDown = AnimationUtils.loadAnimation(this,R.anim.top_send_down);
//Map
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this);
// Gps Automatic Detection Button
SetAuto = findViewById(R.id.SetAuto);
// Back
sign_back41 = findViewById(R.id.sign_back4);
sign_back41.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
// Animation
slide_down = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_down);
slide_up = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_up);
//Retrieve Data from SignUp3
nameS2 = getIntent().getStringExtra("name");
/*String userS2= getIntent().getStringExtra("user");*/
emailS2 = getIntent().getStringExtra("email");
passwordS2 = getIntent().getStringExtra("password");
genderS2 = getIntent().getStringExtra("gender");
dateS2 = getIntent().getStringExtra("date");
phoneNo = getIntent().getStringExtra("phone");
staff = getIntent().getStringExtra("staff");
if (staff != null && staff.equals("kitchenenter")) {
staffno = getIntent().getStringExtra("Admin");
}
// Automatically detect data
SetAuto.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
googleMap.clear();
Village1.clearFocus();
HomeAddress.clearFocus();
Automatic();
}
});
//Dialog Appears
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Check Edit Text
if(!Check()){
return;
}else{
if(!Check1()){
return;
}
}
Village1.clearFocus();
HomeAddress.clearFocus();
searchView.setVisibility(View.VISIBLE);
SetAuto.setVisibility(View.VISIBLE);
// Check GPS
if(GpsLocationCheck){
SendToNextActivity();
}else{
DialogGPS();
}
}
});
setFocus(HomeAddress);
HomeAddress.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus){
SetAuto.setVisibility(View.GONE);
searchView.setVisibility(View.GONE);
GpsLocationCheck = false;
button.setText("Save Address");
}
}
});
HomeAddress.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
HouseNumber.setErrorEnabled(false);
HouseNumber.setError(null);
}
@Override
public void afterTextChanged(Editable s) {
}
});
// Remove Error
Village1.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
Vill.setErrorEnabled(false);
Vill.setError(null);
}
@Override
public void afterTextChanged(Editable s) {
}
});
Village1.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
Vill.setErrorEnabled(false);
SetAuto.setVisibility(View.GONE);
searchView.setVisibility(View.GONE);
GpsLocationCheck = false;
button.setText("Save Address");
}
});
fragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.MapSearch);
searchView = findViewById(R.id.sv_Location);
searchView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if(hasFocus){
DialogAddFloat1.setVisibility(View.GONE);
SetAuto.setVisibility(View.GONE);
}
}
});
fragment.getMapAsync(this);
}
private void SendToNextActivity() {
GpsLocationCheck = false;
Intent intent = new Intent(signup4.this, otp.class);
intent.putExtra("name", nameS2);
intent.putExtra("Village", Objects.requireNonNull(Village1.getText()).toString());
intent.putExtra("email", emailS2);
intent.putExtra("password", passwordS2);
intent.putExtra("gender", genderS2);
intent.putExtra("date", dateS2);
intent.putExtra("phone", phoneNo);
intent.putExtra("staff", staff);
intent.putExtra("Address", Objects.requireNonNull(HomeAddress.getText()).toString());
intent.putExtra("whatToDo", "new");
intent.putExtra("Latitude", LatitudeFinal);
intent.putExtra("Longitude", LongitudeFinal);
if (staff.equals("kitchenenter")) {
intent.putExtra("staffno", staffno);
}
startActivity(intent);
}
private boolean Check() {
if(Objects.requireNonNull(HomeAddress.getText()).toString().length() == 0){
HouseNumber.setError("Please Enter Address");
setFocus(HomeAddress);
return false;
}else{
HouseNumber.setError(null);
HouseNumber.setErrorEnabled(false);
return true;
}
}
private boolean Check1(){
if(Objects.requireNonNull(Village1.getText()).toString().length() == 0){
Vill.setError("Please Enter Village Name");
setFocus(Village1);
return false;
}else{
Vill.setError(null);
Vill.setErrorEnabled(false);
return true;
}
}
// Ask GPS Option
private void DialogGPS() {
final Dialog dialog = new Dialog(this);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
dialog.setContentView(R.layout.signup4_dialog);
dialog.getWindow().setAttributes(lp);
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
dialog.getWindow().setDimAmount(0.6f);
Location = dialog.findViewById(R.id.Automatic1);
Manual = dialog.findViewById(R.id.Manual1);
Location.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Village1.clearFocus();
HomeAddress.clearFocus();
Manual();
OnMapClick();
Automatic();
dialog.dismiss();
}
});
Manual.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Manual();
OnMapClick();
dialog.dismiss();
}
});
dialog.show();
}
private void Automatic() {
if (ActivityCompat.checkSelfPermission(signup4.this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
//Ask for Permission of location
GpsOnPermission();
} else {
if (ActivityCompat.shouldShowRequestPermissionRationale(signup4.this, Manifest.permission.ACCESS_FINE_LOCATION)) {
ActivityCompat.requestPermissions(signup4.this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_CHECK);
}else{
ActivityCompat.requestPermissions(signup4.this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_CHECK);
}
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == REQUEST_CHECK) {
GpsOnPermission();
}
}
@SuppressLint("MissingPermission")
private void GpsOnPermission() {
//Get Coordinates
//GPS On builder
fusedLocationClient.getLastLocation().addOnCompleteListener(new OnCompleteListener<android.location.Location>() {
@Override
public void onComplete(@NonNull final Task<android.location.Location> task1) {
locationRequest = LocationRequest.create();
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
locationRequest.setInterval(3000);
locationRequest.setFastestInterval(2000);
LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder().addLocationRequest(locationRequest);
builder.setAlwaysShow(true);
Task<LocationSettingsResponse> result = LocationServices.getSettingsClient(getApplicationContext()).checkLocationSettings(builder.build());
result.addOnCompleteListener(new OnCompleteListener<LocationSettingsResponse>() {
@Override
public void onComplete(@NonNull Task<LocationSettingsResponse> task) {
try {
LocationSettingsResponse response = task.getResult(ApiException.class);
if(response.getLocationSettingsStates().isGpsPresent()){
googleMap.setMyLocationEnabled(true);
getLocation();
}
} catch (ApiException e) {
switch (e.getStatusCode()) {
case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
try {
ResolvableApiException resolvableApiException = (ResolvableApiException) e;
resolvableApiException.startResolutionForResult(signup4.this, REQUEST_CHECK_SETTING);
} catch (IntentSender.SendIntentException sendIntentException) {
sendIntentException.printStackTrace();
}
break;
case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:
break;
}
}
}
private void getLocation() {
locationFinal = task1.getResult();
if (locationFinal != null) {
LatLng latLng = new LatLng(locationFinal.getLatitude(), locationFinal.getLongitude());
GetLocationDetails(latLng);
} else {
GpsOnPermission();
}
}
});
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CHECK_SETTING) {
Toast.makeText(this, "GPS is On", Toast.LENGTH_SHORT).show();
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
// Do something after 5s = 5000ms
Automatic();
}
}, 2000);
}
else {
Toast.makeText(this, "GPS needs to be On.", Toast.LENGTH_SHORT).show();
}
}
private void Manual() {
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
String location = searchView.getQuery().toString();
List<Address> addresses = null;
Geocoder geocoder = new Geocoder(signup4.this);
try {
addresses = geocoder.getFromLocationName(location, 1);
} catch (IOException e) {
e.printStackTrace();
}
assert addresses != null;
Address addressFinal = addresses.get(0);
LatLng latLng = new LatLng(addressFinal.getLatitude(), addressFinal.getLongitude());
GetLocationDetails(latLng);
return true;
}
@Override
public boolean onQueryTextChange(String newText) {
return false;
}
});
}
public void setFocus(TextInputEditText editText){
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
editText.requestFocus();
imm.showSoftInput(editText,InputMethodManager.SHOW_IMPLICIT);
}
private void OnMapClick() {
//Async map
fragment.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final GoogleMap googleMap) {
googleMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
@Override
public void onMapClick(LatLng latLng) {
GetLocationDetails(latLng);
}
});
}
});
}
public void GetLocationDetails(LatLng latLng){
displayLatLng = latLng;
googleMap.clear();
LatitudeFinal = String.valueOf(latLng.latitude);
LongitudeFinal = String.valueOf(latLng.longitude);
GpsLocationCheck = true;
MarkerOptions markerOptions = new MarkerOptions();
if(displayLatLng != null){
googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(displayLatLng, 20));
markerOptions.position(displayLatLng).title("Saved Location");
markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
googleMap.addMarker(markerOptions);
}
if(Check1() && Check() && LatitudeFinal.length() != 0 && LongitudeFinal.length() != 0){
button.setText("Proceed");
}else{
button.setText("Save Address");
}
}
@Override
public void onMapReady(GoogleMap Map) {
googleMap = Map;
googleMap.getUiSettings().setMyLocationButtonEnabled(false);
googleMap.setBuildingsEnabled(true);
googleMap.setIndoorEnabled(true);
}
} | [
"[email protected]"
]
| |
aa8665878bc2528c7c017e67c5f97f388c8fc02d | 8c5117c9de24d8dd42398cdb36948c9f8baf29ad | /QuickFindUF2.java | fddd7a1eee5d7713ad3ef27fa891274ef8505fc1 | []
| no_license | maniprataprana/algorithms | 8cc51c598f9c96935135e42e524217a5f4e666d6 | f54e96ce31f776a738dbd796c45a3f0efd197108 | refs/heads/master | 2021-01-20T08:48:43.558736 | 2015-11-07T15:47:43 | 2015-11-07T15:47:43 | 3,947,388 | 1 | 5 | null | null | null | null | UTF-8 | Java | false | false | 820 | java | //easy implementation of Quick find union operation
//while doing algo course on coursera
//o(n)
public class QuickFindUF2 {
private int[] id;
public QuickFindUF2(int N) {
id = new int[N];
//default set each object to itself
for (int i=0; i<N ; i++) {
id[i] =i;
}
}
public boolean connected(int p,int q) {
return (root(p) == root(q) );
}
private int root(int i) {
while(i != id[i]) {
i = id[i];
}
return i;
}
public void union(int p,int q) {
int i = root(p);
int j = root(q);
id[i] = j;
}
void print() {
for (int i = 0; i < id.length ; i++ ) {
System.out.print(" "+id[i]);
}
System.out.println();
}
public static void main(String []args) {
QuickFindUF q = new QuickFindUF(10);
q.print();
q.union(1,2);
q.union(2,6);
q.union(7,2);
q.print();
}
} | [
"[email protected]"
]
| |
1ab4afd6cd65a46431f875a845426fa66aa0f19f | 3d33a22844d7329969ed3ff40e769dbb33159911 | /app/src/main/java/com/cambricon/productdisplay/utils/LogUtil.java | bfb397c73c5dd0e1489a6e6b848f89ca529a2732 | []
| no_license | xusiwei/DDK_DEMO | 5a43e5ab45a111509b7e531f713f2796d87177fb | 8a94e17ccd3160fd0f09fa9d8f0c8200ec85efc5 | refs/heads/master | 2020-03-31T19:59:52.956951 | 2018-06-15T10:03:45 | 2018-06-15T10:03:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,879 | java | package com.cambricon.productdisplay.utils;
import android.util.Log;
/**
* 日志工具类
*/
public class LogUtil {
private static final int VERBOSE = 1;
private static final int DEBUG = 2;
private static final int INFO = 3;
private static final int WARN = 4;
private static final int ERROR = 5;
private static final int NOTHING = 6;
//日志输出当前级别
public static final int level = VERBOSE;
private static final String TAG = "ProductDisPlay";
private LogUtil() {
throw new UnsupportedOperationException("cannot be instantiated");
}
/**
* 默认TAG方法
* @param msg
*/
public static void v(String msg)
{
if (level <= VERBOSE)
Log.v(TAG, msg);
}
public static void d(String msg)
{
if (level <= DEBUG)
Log.d(TAG, msg);
}
public static void i(String msg)
{
if (level <= INFO)
Log.i(TAG, msg);
}
public static void w(String msg)
{
if (level <= WARN)
Log.w(TAG, msg);
}
public static void e(String msg)
{
if (level <= ERROR)
Log.e(TAG, msg);
}
/**
* 传入自定义tag方法
* @param tag
* @param msg
*/
public static void i(String tag, String msg)
{
if (level <= INFO)
Log.i(tag, msg);
}
public static void d(String tag, String msg)
{
if (level <= DEBUG)
Log.d(tag, msg);
}
public static void e(String tag, String msg)
{
if (level <= ERROR)
Log.e(tag, msg);
}
public static void v(String tag, String msg)
{
if (level <= VERBOSE)
Log.v(tag, msg);
}
public static void w(String tag, String msg)
{
if (level <= WARN)
Log.w(tag, msg);
}
}
| [
"[email protected]"
]
| |
1e1350cc1d6d5b2f1013ba8e66e0e2efe8fbc460 | 7527e6e2c770cab2614b5812df2827446213dc7a | /app/src/test/java/com/example/pacod/proyecto/ExampleUnitTest.java | b796e675cf72921cca18c0464b16eac3f7245eb6 | []
| no_license | pacojulian/Photo | d00092dd741f86c9595b251304fa5a6fe39aaeca | d44235245bbf873027d4cf8a4bdfa712dafa87ec | refs/heads/master | 2021-07-18T16:51:13.220153 | 2017-10-24T05:04:37 | 2017-10-24T05:04:37 | 105,835,359 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 404 | java | package com.example.pacod.proyecto;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
]
| |
f41bd0e72471058e6e6d17fcfb14d78d5648eb09 | 51dc61072c6ba314932772b51b0c5457a9cd3983 | /java/designpattern/src/behavioral/visitor/Keyboard.java | 3cdd5011bcec916bb55aeca214ec28d01b392b5b | []
| no_license | shiv4289/codes | 6bbadfcf1d1dcb1661f329d24a346dc956766a31 | 6d9e4bbbe37ebe2a92b58fa10e9c66b1ccff772d | refs/heads/master | 2021-01-20T14:31:38.981796 | 2017-07-07T13:43:10 | 2017-07-07T13:43:10 | 90,625,900 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 173 | java | package behavioral.visitor;
public class Keyboard implements I_ComputerPart {
@Override
public void accept(I_ComputerPartVisitor visitor) {
visitor.visit(this);
}
}
| [
"[email protected]"
]
| |
dbc710ec39a999d17a4a16f6f301a790fd65a5f2 | 95df9643ab82f60e0e0878aaf8fb62d0fc434927 | /crm/CRM/src/main/java/com/yuchengdai/crm/workbench/service/impl/ClueActivityRelationServiceImpl.java | 255dbcaedc3731ba98177f3d0aff128eee571531 | []
| no_license | 361keji/crm | afd24241a330af48c37126626e65c5f7884d40a5 | 62f0f6030313ae8a786271e160a4276ebe0717f7 | refs/heads/master | 2023-04-09T13:47:11.746108 | 2020-05-21T13:40:55 | 2020-05-21T13:40:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,851 | java | package com.yuchengdai.crm.workbench.service.impl;
import com.yuchengdai.crm.workbench.domain.ClueActivityRelation;
import com.yuchengdai.crm.workbench.mapper.clue.ClueActivityRelationMapper;
import com.yuchengdai.crm.workbench.service.ClueActivityRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* RoyDai
* 2017/3/26 20:22
*/
@Service
public class ClueActivityRelationServiceImpl implements ClueActivityRelationService {
private ClueActivityRelationMapper clueActivityRelationMapper;
@Autowired
public ClueActivityRelationServiceImpl setClueActivityRelationMapper(ClueActivityRelationMapper clueActivityRelationMapper) {
this.clueActivityRelationMapper = clueActivityRelationMapper;
return this;
}
/**
* 批量添加线索活动关联内容
*
* @param clueActivityRelationList
* @return
*/
@Override
public int addClueActivityRelation(List<ClueActivityRelation> clueActivityRelationList) {
return clueActivityRelationMapper.insertClueActivityRelation(clueActivityRelationList);
}
/**
* 通过clueId获取对应关系市场活动集合内容
*
* @param clueId
* @return
*/
@Override
public List<ClueActivityRelation> queryClueActivityRelation(String clueId) {
return clueActivityRelationMapper.selectClueActivityRelationByClueId(clueId);
}
/**
* 通过clueId确定线索
* 通过activityId确定删除的市场活动
*
* @param map
* @return
*/
@Override
public int deleteClueActivityRelationByClueIdActivityId(Map<String, Object> map) {
return clueActivityRelationMapper.deleteClueActivityRelationByClueIdActivityId(map);
}
}
| [
"[email protected]"
]
| |
8e16aea348fd3c20de1aa2b5d357d53c49a808bc | d93abc9ac9207be4a6f6b8d10bd164604e1b59e5 | /codes/code for labs/lab2/bank/src/main/java/bank/service/InterestCalculator.java | 824fffdc8bdca7013ebdc3ebb72b39ded1a1270e | []
| no_license | zithiat/asd | 20c50fc27376c74f438fef16291e17251a915345 | 5e684a8f7f92d232bf738e5a3ea22713d72874f4 | refs/heads/master | 2021-01-04T14:38:54.884582 | 2020-06-21T14:49:02 | 2020-06-21T14:49:02 | 240,592,810 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 551 | java | package bank.service;
import bank.domain.AccountTypes;
public class InterestCalculator {
private final InterestCalculationStrategy savings = new SavingsInterestCalculator();
private final InterestCalculationStrategy checkings = new CheckingsnterestCalculator();
public double calculateInterest(AccountTypes accountType, double accountBalance) {
switch (accountType) {
case SAVINGS:
return savings.calculateInterest(accountBalance);
case CHECKINGS:
return checkings.calculateInterest(accountBalance);
default:
return 0;
}
}
}
| [
"[email protected]"
]
| |
26efc630b8283e4323de1f55ec0b2e534595e41e | 222967e9d652382604a856766ca0fedf7893db56 | /common/src/main/java/kpaschal/wordnet/common/database/hibernate/CriteriaIterator.java | 1674cc180baa0d3f7c0caab40c2b4620c2035350 | []
| no_license | kpaschal/wordnet | 0d5e61e928e94748840e12b3811bdb0572d44adb | 94d925deb94a58ad752d8eac34fdcb5542bfe8c8 | refs/heads/master | 2020-03-19T07:42:43.808516 | 2018-06-16T03:54:59 | 2018-06-16T03:54:59 | 136,142,408 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,264 | java | package kpaschal.wordnet.common.database.hibernate;
import java.util.Iterator;
import java.util.List;
import org.hibernate.Criteria;
/**
*
*/
public class CriteriaIterator<T> implements Iterator<T> {
private int bufferSize;
private Criteria criteria;
private Iterator<T> resultIterator;
private int currentResult;
public CriteriaIterator(Criteria criteria, int bufferSize) {
this.bufferSize = bufferSize;
this.criteria = criteria;
this.currentResult = 0;
}
@Override
public boolean hasNext() {
boolean hasNext = resultIterator == null ? false : resultIterator.hasNext();
if (!hasNext) {
hasNext = getNextResults();
}
return hasNext;
}
@Override
public T next() {
currentResult++;
return resultIterator.next();
}
private boolean getNextResults() {
List result = criteria.setFirstResult(currentResult)
.setMaxResults(bufferSize).list();
if (result.isEmpty()) {
return false;
}
resultIterator = result.iterator();
return true;
}
@Override
public void remove() {
throw new UnsupportedOperationException("Not supported yet.");
}
}
| [
"[email protected]"
]
| |
00832061db9e218a44aa33cf24d5f0450280b6c1 | 9bbe9827880ecc2585ddba5edc44767665ee41e3 | /src/test_2022/sk1.java | 6ecc48a2a0f7168d0e8d78fb83315f71f498a6a7 | []
| no_license | hyeyeon2964/algo_study | 2f703d015980648a392868cf86e8b7bcb063c4ba | 6ba73a6f38453dcadd879cbc6212eae85c58e0bc | refs/heads/master | 2022-05-17T23:57:39.102580 | 2022-03-21T13:09:50 | 2022-03-21T13:09:50 | 285,786,048 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | package test_2022;
public class sk1 {
public static int[][] getDirection(boolean clockwise) {
if (true) {
return new int[][]{{0, 1, 0, -1}, {1, 0, -1, 0}};
}
else {
return new int[][]{{0, -1, 0, 1}, {1, 0, -1, 0}};
}
}
public void trueClockwise(int n) {
int[][] answer = new int[n][n];
int[][] start = {{0,0}, {0,n-1}, {n-1, 0}, {n-1, n-1}};
for(int i = 0; i<4; i++) {
int num = 1;
for(int j = 1; j<n-j; j++) {
}
}
}
public int[][] solution(int n, boolean clockwise) {
int[][] answer = {};
return answer;
}
public static void main(String[] args) {
}
}
| [
"[email protected]"
]
| |
ae38e5c01e5474b92ed268318fe060399452efea | 40207cba83ccabf8f237a42927e89c7c58267698 | /NameSurfer.java | 0c2717c3c36d420c849e3298794c7599545d31b4 | [
"MIT"
]
| permissive | maximusdrex/NameSurfer | 2d704e596562354aac7ef086fda13097907b5511 | 8ae6965ccc9652c9efc41a96e78aa25f2399ac4b | refs/heads/master | 2016-08-07T00:17:15.728884 | 2014-08-01T03:34:39 | 2014-08-01T03:34:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,533 | java | /*
* File: NameSurfer.java
* ---------------------
* When it is finished, this program will implements the viewer for
* the baby-name database described in the assignment handout.
*/
import acm.program.*;
import java.awt.event.*;
import javax.swing.*;
public class NameSurfer extends ConsoleProgram implements NameSurferConstants {
NameSurferGraph Graph;
JTextField NameField;
/* Method: init() */
/**
* This method has the responsibility for reading in the data base
* and initializing the interactors at the top of the window.
*/
public void init() {
String GUIButtonLocation = NORTH;
Graph = new NameSurferGraph();
int FieldLength = 8;
NameField = new JTextField(FieldLength);
NameField.setActionCommand("Graph");
add(Graph);
add(new JLabel("Name:"), GUIButtonLocation);
add(NameField, GUIButtonLocation);
add(new JButton("Graph"), GUIButtonLocation);
add(new JButton("Clear"), GUIButtonLocation);
addActionListeners();
}
/* Method: actionPerformed(e) */
/**
* This class is responsible for detecting when the buttons are
* clicked, so you will have to define a method to respond to
* button actions.
*/
public void actionPerformed(ActionEvent e) {
NameSurferDataBase DataBase = new NameSurferDataBase(NAMES_DATA_FILE);
String cmd = e.getActionCommand();
if(cmd == "Graph") {
String Name = NameField.getText();
println(Name);
NameSurferEntry Entry = DataBase.findEntry(NameField.getText());
if(Entry != null) Graph.addEntry(Entry);
}
}
}
| [
"[email protected]"
]
| |
dd8a61efd6ac367725d5c0a9a57c7d76c99d95ad | dfdc2c4805cf0fead91983434765fbbd525e0de0 | /src/fitnesse/responders/run/slimResponder/SlimTableTest.java | 914ce01fa5fe7bb73771497de0b5c04c584b1689 | []
| no_license | smryoo/fitnesse | fb2b997e357ce5a18c602b87cb40ad959a1a49b3 | 77a11a67cfb9fc3d18cdf3182af4ef8061c4934b | refs/heads/master | 2020-12-25T03:12:07.458197 | 2008-12-09T15:00:26 | 2008-12-09T15:00:26 | 88,666 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,186 | java | package fitnesse.responders.run.slimResponder;
import static fitnesse.responders.run.slimResponder.SlimTable.Disgracer.disgraceClassName;
import static fitnesse.responders.run.slimResponder.SlimTable.Disgracer.disgraceMethodName;
import static fitnesse.responders.run.slimResponder.SlimTable.approximatelyEqual;
import static org.junit.Assert.*;
import org.junit.Test;
public class SlimTableTest {
@Test
public void gracefulClassNames() throws Exception {
assertEquals("MyClass", disgraceClassName("my class"));
assertEquals("myclass", disgraceClassName("myclass"));
assertEquals("x.y", disgraceClassName("x.y"));
assertEquals("x_y", disgraceClassName("x_y"));
assertEquals("MeAndMrs_jones", disgraceClassName("me and mrs_jones"));
assertEquals("PageCreator", disgraceClassName("Page creator."));
}
@Test
public void gracefulMethodNames() throws Exception {
assertEquals("myMethodName", disgraceMethodName("my method name"));
assertEquals("myMethodName", disgraceMethodName("myMethodName"));
assertEquals("my_method_name", disgraceMethodName("my_method_name"));
assertEquals("getStringArgs", disgraceMethodName("getStringArgs"));
assertEquals("setMyVariableName", disgraceMethodName("set myVariableName"));
}
@Test
public void trulyEqual() throws Exception {
assertTrue(approximatelyEqual("3.0", "3.0"));
}
@Test
public void veryUnequal() throws Exception {
assertFalse(approximatelyEqual("5", "3"));
}
@Test
public void isWithinPrecision() throws Exception {
assertTrue(approximatelyEqual("3", "2.5"));
}
@Test
public void justTooBig() throws Exception {
assertFalse(approximatelyEqual("3.000", "3.0005"));
}
@Test
public void justTooSmall() throws Exception {
assertFalse(approximatelyEqual("3.0000", "2.999949"));
}
@Test
public void justSmallEnough() throws Exception {
assertTrue(approximatelyEqual("-3.00", "-2.995"));
}
@Test
public void justBigEnough() throws Exception {
assertTrue(approximatelyEqual("-3.000000", "-3.000000499"));
}
@Test
public void x() throws Exception {
assertTrue(approximatelyEqual("3.05", "3.049"));
}
}
| [
"robertmartin"
]
| robertmartin |
93d0c7ff85e362e13202adc45aa601a089832383 | 974327f5b58aed4fd9ab639b8a95b035ed3625f8 | /App/src/main/java/pe/zefira/accesototal/HomeActivity.java | c67423c2ee14c5c129080b21fde8ede4f2b2e530 | []
| no_license | diegoyep/peopleandroid | 89f488007a2d672b34012d34571a7d5cb72383f3 | 328920e50bcf9addac70c8e15edd37c0d3dda3ce | refs/heads/master | 2016-09-11T02:06:28.531575 | 2013-12-01T19:10:54 | 2013-12-01T19:10:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,160 | java | package pe.zefira.accesototal;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.os.Build;
import android.widget.Button;
import android.widget.TextView;
public class HomeActivity extends Activity {
TextView test;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
test = (TextView) findViewById(R.id.text_name);
SharedPreferences settings = getSharedPreferences("User", 0);
String name = settings.getString("name", "No esta");
test.setText("Hola " + name);
final Button buttonPlaces = (Button) findViewById(R.id.buttonPlaces);
buttonPlaces.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intentPlaces = new Intent(view.getContext(), PlacesActivity.class);
startActivityForResult(intentPlaces, 0);
}
});
final Button buttonPeople = (Button) findViewById(R.id.buttonGente);
buttonPeople.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intentPlaces = new Intent(view.getContext(), PeopleActivity.class);
startActivityForResult(intentPlaces, 0);
}
});
final Button buttonEvents = (Button) findViewById(R.id.buttonEventos);
buttonEvents.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intentPlaces = new Intent(view.getContext(), EventsActivity.class);
startActivityForResult(intentPlaces, 0);
}
});
}
}
| [
"[email protected]"
]
| |
18d33e3b81684305fedc3868ff722284d09a2b7c | 0318633c86d3e04c067c55a1dc5f6772817c281d | /src/main/java/com/dianwoba/rha/tx/reids/RedisCompensatableTransactionHelper.java | b6c1dbcfee6a1c96c00a63a309e6d6e17287b729 | []
| no_license | chenghet/rha | a9d07eea82b03d70a3c076ba36c788bbea5b343f | fa5e056797c2479c8db28afae308d8f282dd9915 | refs/heads/master | 2021-01-21T01:44:08.023809 | 2016-07-25T09:09:43 | 2016-07-25T09:09:43 | 63,475,621 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,830 | java | package com.dianwoba.rha.tx.reids;
import com.dianwoba.rha.tx.CompensableTransactionHelper;
import com.dianwoba.rha.tx.CompensableTransactionType;
import com.dianwoba.rha.tx.TransactionItem;
import org.springframework.data.redis.core.RedisOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ZSetOperations;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* 分布式事务补偿机制的帮助类-redis
*
* @author Het on 2016/6/24.
*/
public class RedisCompensatableTransactionHelper implements CompensableTransactionHelper {
private RedisTemplate redisTemplate;
public RedisCompensatableTransactionHelper(RedisTemplate redisTemplate) {
this.redisTemplate = redisTemplate;
}
// 预设
public void preset(final Object bizNo, final CompensableTransactionType... txTypes) {
if (txTypes == null) {
return;
}
new AbstractRedisTransaction(redisTemplate) {
public void redisOps(RedisOperations redisOperations) {
long t = System.currentTimeMillis();
for (CompensableTransactionType type : txTypes) {
redisOperations.opsForZSet().add(getCacheKey(type), new TransactionItem(type, bizNo), -t);
}
}
}.execute();
}
// 提交
public void commit(final Object bizNo, final CompensableTransactionType... txTypes) {
if (txTypes == null) {
return;
}
new AbstractRedisTransaction(redisTemplate) {
public void redisOps(RedisOperations redisOperations) {
long t = System.currentTimeMillis();
for (CompensableTransactionType type : txTypes) {
redisOperations.opsForZSet().add(getCacheKey(type), new TransactionItem(type, bizNo, t), t);
}
}
}.execute();
}
// 释放
public void release(final Object bizNo, final CompensableTransactionType xtype) {
if (xtype == null) {
return;
}
redisTemplate.opsForZSet().remove(getCacheKey(xtype), new TransactionItem(xtype, bizNo));
}
// 超时未提交部分
public List<TransactionItem> uncommitted(CompensableTransactionType txType) {
long bgn = -System.currentTimeMillis() + RELEASE_OVERTIME_PERIOD_MS;
List<TransactionItem> list = new ArrayList<TransactionItem>();
Set<ZSetOperations.TypedTuple<TransactionItem>> set =
redisTemplate.opsForZSet().rangeByScoreWithScores(getCacheKey(txType), bgn, 0);
for (ZSetOperations.TypedTuple<TransactionItem> tuple : set) {
TransactionItem xitem = tuple.getValue();
xitem.setTimestamp(tuple.getScore().longValue());
list.add(xitem);
}
return list;
}
// 超时未释放部分
public List<TransactionItem> unreleased(CompensableTransactionType txType) {
long end = System.currentTimeMillis() - COMMIT_OVERTIME_PERIOD_MS;
List<TransactionItem> list = new ArrayList<TransactionItem>();
Set<ZSetOperations.TypedTuple<TransactionItem>> set =
redisTemplate.opsForZSet().rangeByScoreWithScores(getCacheKey(txType), 0, end);
for (ZSetOperations.TypedTuple<TransactionItem> tuple : set) {
TransactionItem xitem = tuple.getValue();
xitem.setTimestamp(-tuple.getScore().longValue());
list.add(xitem);
}
return list;
}
public void setRedisTemplate(RedisTemplate redisTemplate) {
this.redisTemplate = redisTemplate;
}
public static String getCacheKey(CompensableTransactionType transactionType) {
return String.format("DTX_KEY:%s", transactionType.name());
}
}
| [
"[email protected]"
]
| |
0153a01cb862d687b38ed4a169a36b33cf6807ee | a996b02caa1ce8cedb7e40003bc33510844ec3db | /src/DynamicProxy/Subject.java | ca91158ebb12da256841f9f917d3fadd94c64970 | []
| no_license | zjdznl/learnJava | 54603ca14a0e5126ac98ced910a0c0c6a261828d | 268bfe752ceab5b87b1f9a30f02c5265c851eaa9 | refs/heads/master | 2020-03-13T22:36:15.734044 | 2018-05-03T15:22:31 | 2018-05-03T15:22:31 | 131,319,381 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 103 | java | package DynamicProxy;
public interface Subject {
void play();
void sayHello(String string);
} | [
"[email protected]"
]
| |
9496fd4cf3abfa144a349d8994e69c460a29912a | 9bd092d467d79ff7f350e59076cf09120153e6f7 | /user-service-provider/src/main/java/com/mlk/dubbo/demo/dao/UsersMapper.java | c9000706f277675e870d309abee057c499cec765 | []
| no_license | malikai01/spring-boot-dubbo-demo | 9c07b479ed544262032965b41eb900c07ea48ee5 | 9811d037a09522b1367e2455b608a995da9dd412 | refs/heads/master | 2023-04-11T07:31:24.865222 | 2021-04-26T09:17:20 | 2021-04-26T09:17:20 | 361,686,357 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 443 | java | package com.mlk.dubbo.demo.dao;
import com.mlk.dubbo.demo.model.Users;
import org.springframework.stereotype.Repository;
/**
* @author malikai
* @version 1.0.0
* @date 2021-4-25 17:01
**/
@Repository
public interface UsersMapper {
/**
* 获取用户信息
*
* @param userId
* @return org.apache.catalina.User
* @author malikai
* @date 2021-4-25 17:02
**/
Users queryUserById(Integer userId);
} | [
"[email protected]"
]
| |
65ea8e8721f4ae73bf35201b30dbcf5f41c0d017 | 53efcbcb8210a01c3a57cdc2784926ebc22d6412 | /src/main/java/br/com/fieesq/model54330/FieEsq45303.java | 3f5c5fdda8eaa35811c7083182fc235778ef8dc4 | []
| no_license | fie23777/frontCercamento | d57846ac985f4023a8104a0872ca4a226509bbf2 | 6282f842544ab4ea332fe7802d08cf4e352f0ae3 | refs/heads/master | 2021-04-27T17:29:56.793349 | 2018-02-21T10:32:23 | 2018-02-21T10:32:23 | 122,322,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | java | package br.com.fieesq.model54330;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Transient;
@Entity
public class FieEsq45303 {
@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
private String numEsq45303;
@Transient
private String esqParam;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNumEsq45303() {
return numEsq45303;
}
public void setNumEsq45303(String numEsq45303) {
this.numEsq45303 = numEsq45303;
}
public String getEsqParam() {
return esqParam;
}
public void setEsqParam(String esqParam) {
this.esqParam = esqParam;
}
}
| [
"[email protected]"
]
| |
aab792713546f596efc945953e92f1bb90ec4138 | b9f9ebfccb6e52d6ad240bb686afdec1bdb0ce78 | /chapter06/src/main/java/com/example/chapter06/util/SharedUtil.java | 9071604606659ae37eaa45c7e39c23d5b70d64a5 | []
| no_license | bugkill/myapp | 0f47706edef69c6bc09e76d155e4af4193025cd6 | d0a70b4785148dac6fad48a0b973769c97cd423d | refs/heads/master | 2023-08-26T01:41:57.528944 | 2021-11-07T05:50:22 | 2021-11-07T05:50:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,799 | java | package com.example.chapter06.util;
import android.content.Context;
import android.content.SharedPreferences;
// 这是共享参数的工具类,统一对共享参数的读写操作
public class SharedUtil {
private static SharedUtil mUtil; // 声明一个共享参数工具类的实例
private static SharedPreferences mShared; // 声明一个共享参数的实例
// 通过单例模式获取共享参数工具类的唯一实例
public static SharedUtil getIntance(Context ctx) {
if (mUtil == null) {
mUtil = new SharedUtil();
}
// 从cart.xml中获取共享参数对象
mShared = ctx.getSharedPreferences("cart", Context.MODE_PRIVATE);
return mUtil;
}
// 把键名与字符串的配对信息写入共享参数
public void writeString(String key, String value) {
SharedPreferences.Editor editor = mShared.edit(); // 获得编辑器的对象
editor.putString(key, value); // 添加一个指定键名的字符串参数
editor.commit(); // 提交编辑器中的修改
}
// 根据键名到共享参数中查找对应的字符串对象
public String readString(String key, String defaultValue) {
return mShared.getString(key, defaultValue);
}
// 把键名与整型数的配对信息写入共享参数
public void writeInt(String key, int value) {
SharedPreferences.Editor editor = mShared.edit(); // 获得编辑器的对象
editor.putInt(key, value); // 添加一个指定键名的整型数参数
editor.commit(); // 提交编辑器中的修改
}
// 根据键名到共享参数中查找对应的整型数对象
public int readInt(String key, int defaultValue) {
return mShared.getInt(key, defaultValue);
}
}
| [
"[email protected]"
]
| |
1a32f8e9a20b5fe31abe8ec6a75e6b1c8b78909d | af200a8dc7886f9a0e4ca1252e9558f412377807 | /org.xjtusicd3.portal/src/main/java/org/xjtusicd3/portal/service/AnswerService.java | e9a2603820c652384ff332d4fff0d9f0a2455f6d | []
| no_license | zhaoyanqing624/robot | 3d2417b30625f12842cf55b8f0204477bd1a8804 | cf713b71de5fbf61575ff7423e3fe2e2a40e6b85 | refs/heads/master | 2021-01-22T17:47:47.501771 | 2017-10-28T07:30:40 | 2017-10-28T07:30:40 | 85,032,731 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 349 | java | package org.xjtusicd3.portal.service;
import java.util.List;
import org.xjtusicd3.database.helper.QuestionHelper;
import org.xjtusicd3.database.model.QuestionPersistence;
public class AnswerService {
public static List<QuestionPersistence> getFaq(){
List<QuestionPersistence> list = QuestionHelper.getFaq();
return list;
}
}
| [
"[email protected]"
]
| |
539ab81738b5388f8d015f981453d7659b477f5f | dc5ca5e24c86c01dd97fe3f321cdaff56906d85f | /src/day2/xml/Demo2.java | b31576db3e759f63c07351649ce0b2864729aa69 | []
| no_license | DesiNF/JavaWeb30- | 0103bcba5ae25e175caaeb3c00d2cbf6d4694fba | 8502813586d013b3158845d41af0a2fbeb0d0f45 | refs/heads/master | 2021-01-20T06:07:19.348978 | 2017-04-30T11:14:14 | 2017-04-30T11:14:14 | 89,846,110 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 6,702 | java | package day2.xml;
import java.io.FileOutputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.junit.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
//使用dom方式对xml进行解析
public class Demo2 {
/**
* 1 创建工厂 2 得到dom解析器 3 解析xml文档,得到代表文档的document
*
* @throws Exception
*/
// 读取第一个书名
@Test
public void read1() throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse("src/book.xml");
NodeList list = document.getElementsByTagName("书名");
Node node = list.item(1);
String content = node.getTextContent();
System.out.println(content);
}
// 遍历所有标签的名字
@Test
public void read2() throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse("src/book.xml");
Node root = document.getElementsByTagName("书架").item(0);
list(root);
}
private void list(Node node) {
if (node instanceof Element) {// 只读取标签
System.out.println(node.getNodeName());
}
NodeList list = node.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
Node child = list.item(i);
list(child);
}
}
// <书名 name="xxx">book1</书名> 获取name的属性
@Test
public void read3() throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse("src/book.xml");
Element node = (Element) document.getElementsByTagName("书名").item(0);
System.out.println(node.getAttribute("name"));
}
// 在第一本书增加一个节点
@Test
public void add1() throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse("src/book.xml");
// 创建节点
Element ele = document.createElement("新增");
ele.setTextContent("add");
// 把创建的节点挂到第一本书上
Element book = (Element) document.getElementsByTagName("书").item(0);// Node是Element父类
// 强转
book.appendChild(ele);
// 把更新后内存写回xml
TransformerFactory tffactory = TransformerFactory.newInstance();
Transformer tf = tffactory.newTransformer();
tf.transform(new DOMSource(document), new StreamResult(new FileOutputStream("src/book.xml")));
}
// 在指定位置增加节点
@Test
public void add2() throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse("src/book.xml");
// 创建节点
Element ele = document.createElement("新增");
ele.setTextContent("add");
// 得到参考节点
Element refNode = (Element) document.getElementsByTagName("售价").item(0);
// 得到要挂崽的节点
Element book = (Element) document.getElementsByTagName("书").item(0);// Node是Element父类
// 强转
// 往book节点的指定位置插崽
book.insertBefore(ele, refNode);// 将ele插在refNode前面
// 把更新后内存写回xml
TransformerFactory tffactory = TransformerFactory.newInstance();
Transformer tf = tffactory.newTransformer();
tf.transform(new DOMSource(document), new StreamResult(new FileOutputStream("src/book.xml")));
}
// 向xml文档节点上添加属性
@Test
public void addAttr() throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse("src/book.xml");
Element bookname = (Element) document.getElementsByTagName("书名").item(0);
bookname.setAttribute("name", "xxx");
// 把更新后内存写回xml
TransformerFactory tffactory = TransformerFactory.newInstance();
Transformer tf = tffactory.newTransformer();
tf.transform(new DOMSource(document), new StreamResult(new FileOutputStream("src/book.xml")));
}
@Test
public void delete1() throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse("src/book.xml");
// 得到要删除的节点
Element e = (Element) document.getElementsByTagName("新增").item(0);
// 得到要删除的节点的爸爸
Element book = (Element) document.getElementsByTagName("书").item(0);
book.removeChild(e);
// 把更新后内存写回xml
TransformerFactory tffactory = TransformerFactory.newInstance();
Transformer tf = tffactory.newTransformer();
tf.transform(new DOMSource(document), new StreamResult(new FileOutputStream("src/book.xml")));
}
@Test
public void delete2() throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse("src/book.xml");
// 得到要删除的节点
Element e = (Element) document.getElementsByTagName("新增").item(0);
e.getParentNode().removeChild(e);
// 把更新后内存写回xml
TransformerFactory tffactory = TransformerFactory.newInstance();
Transformer tf = tffactory.newTransformer();
tf.transform(new DOMSource(document), new StreamResult(new FileOutputStream("src/book.xml")));
}
@Test
public void updata() throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse("src/book.xml");
Element e = (Element) document.getElementsByTagName("作者").item(0);
e.setTextContent("更新后");
// 把更新后内存写回xml
TransformerFactory tffactory = TransformerFactory.newInstance();
Transformer tf = tffactory.newTransformer();
tf.transform(new DOMSource(document), new StreamResult(new FileOutputStream("src/book.xml")));
}
}
| [
"[email protected]"
]
| |
89ceb47bef300d4cbd1792d4c5fbcfa5d4f74872 | 35c792b0df52685a991e11d8dacab3a832b977be | /src/main/java/com/example/demo/service/MemberService.java | e298d024fddafb7775e6a05ecee04d83a42b8523 | []
| no_license | gensing/spring-boot | 027a19420913954301204cd5a1d15df43de7bd11 | b4d022cd33bcfb50582d8d888f875e810798c6ab | refs/heads/master | 2023-02-11T18:26:40.272850 | 2021-01-07T09:50:29 | 2021-01-07T09:57:15 | 315,301,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 653 | java | package com.example.demo.service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import com.example.demo.data.dto.MemberDto.MemberRequest;
import com.example.demo.data.dto.MemberDto.MemberResponse;
import com.example.demo.data.dto.MemberDto.MemberUpdateRequest;
import com.example.demo.data.vo.UserVo;
public interface MemberService {
Page<MemberResponse> getList(Pageable pageable);
MemberResponse insert(MemberRequest memberRequest);
MemberResponse getOne(Long id, UserVo user);
void update(Long id, MemberUpdateRequest memberUpdateRequest, UserVo user);
void delete(Long id, UserVo user);
} | [
"[email protected]"
]
| |
f708c8ab9552fc3d274f8ec965bbd0526573457f | 95d219a4dfec04a18bdd639395bee14f412397c5 | /src/main/java/com/kh/dp/side/controller/SideController.java | c65bc143fee4ecd046ad7247381e583a2106af19 | [
"MIT"
]
| permissive | finalDoproject/DoProject- | 5d91ded6ca2817a8feb5cd6e19c3a30d229c7d67 | eeb8751ab8f01172f8cd6d36a2a526163763908b | refs/heads/master | 2020-04-12T12:52:05.869285 | 2019-01-14T05:56:11 | 2019-01-14T05:56:11 | 162,504,897 | 0 | 0 | MIT | 2019-01-16T06:08:22 | 2018-12-20T00:17:17 | Java | UTF-8 | Java | false | false | 2,616 | java | package com.kh.dp.side.controller;
import java.sql.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.kh.dp.side.model.service.SideService;
import com.kh.dp.side.model.vo.Join;
import com.kh.dp.side.model.vo.Matching;
@Controller
public class SideController {
@Autowired
private SideService sideService;
// 스케줄 매칭 요청 완료. DB로 향하는 메소드
@RequestMapping("/project/matching.do")
public ModelAndView matching(@RequestParam String title,
@RequestParam Date startDate,
@RequestParam Date endDate,
@RequestParam String[] mNickname,
@RequestParam int pno,
@RequestParam int mno)
{
ModelAndView mv = new ModelAndView();
Matching matcing = new Matching(title, startDate, endDate);
int result = sideService.insertMatching(matcing);
String loc = "/project/projectPage.do?pno="+pno+"&mno="+mno;
String msg = "스케줄 매칭 요청 완료";
for(int i=0; i<mNickname.length; i++) {
int reulst2 = sideService.insertMember(Integer.parseInt(mNickname[i]));
}
int result3 = sideService.insertMySelf(mno);
mv.addObject("loc", loc).addObject("msg", msg);
mv.setViewName("common/msg");
return mv;
}
// 요일/시간 DB로 향하는 메소드
// @ResponseBody와 HttpMessageConverter 활용하기
@RequestMapping("/project/matchingDT.do")
@ResponseBody
public int matchingDT(@RequestParam int dtNo,
@RequestParam int requestNo,
@RequestParam int mNo ) {
Join join = new Join(mNo, dtNo, requestNo);
int result = sideService.insertMatchingDT(join);
return result;
}
// 요일/시간 DB 불러오는 메소드
// @ResponseBody와 HttpMessageConverter 활용하기
@RequestMapping("/project/browseDT.do")
@ResponseBody
public List<Join> browseDT(
@RequestParam int requestNo,
@RequestParam int mNo) {
List DateTime = sideService.browseDT(mNo, requestNo);
System.out.println(DateTime+", requestNo : " + requestNo + ", mNo : " + mNo);
return DateTime;
}
}
| [
"user1@KH_H"
]
| user1@KH_H |
0aa7e659a776961b56dee092e83da1283fcf5292 | cf4534cdab44bb6977b0a129890dd3c67b05f905 | /src/com/kh/appoproject/advice/faq/model/vo/Faq.java | 473ca1de9963a74cadd2cd7dd497f8bd688d3e1f | []
| no_license | kth4249/AppoProject | 65b4a873af301c3c23fad6ac483c889f7126e0bf | c6c39a3fb6f4839bbdf0dccd9892066efaed5c46 | refs/heads/master | 2022-04-20T22:08:06.584171 | 2020-04-12T09:09:33 | 2020-04-12T09:09:33 | 255,044,684 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,796 | java | package com.kh.appoproject.advice.faq.model.vo;
import java.sql.Date;
public class Faq {
private int faqNo;
private String faqClass;
private String faqTitle;
private String faqContent;
private Date faqCreateDate;
public Faq() {
// TODO Auto-generated constructor stub
}
public Faq(int faqNo, String faqClass, String faqTitle, String faqContent, Date faqCreateDate) {
super();
this.faqNo = faqNo;
this.faqClass = faqClass;
this.faqTitle = faqTitle;
this.faqContent = faqContent;
this.faqCreateDate = faqCreateDate;
}
public Faq(String faqClass, String faqTitle, String faqContent) {
super();
this.faqClass = faqClass;
this.faqTitle = faqTitle;
this.faqContent = faqContent;
}
public Faq(int faqNo, String faqClass, String faqTitle, String faqContent) {
super();
this.faqNo = faqNo;
this.faqClass = faqClass;
this.faqTitle = faqTitle;
this.faqContent = faqContent;
}
public int getFaqNo() {
return faqNo;
}
public void setFaqNo(int faqNo) {
this.faqNo = faqNo;
}
public String getFaqClass() {
return faqClass;
}
public void setFaqClass(String faqClass) {
this.faqClass = faqClass;
}
public String getFaqTitle() {
return faqTitle;
}
public void setFaqTitle(String faqTitle) {
this.faqTitle = faqTitle;
}
public String getFaqContent() {
return faqContent;
}
public void setFaqContent(String faqContent) {
this.faqContent = faqContent;
}
public Date getFaqCreateDate() {
return faqCreateDate;
}
public void setFaqCreateDate(Date faqCreateDate) {
this.faqCreateDate = faqCreateDate;
}
@Override
public String toString() {
return "Faq [faqNo=" + faqNo + ", faqClass=" + faqClass + ", faqTitle=" + faqTitle + ", faqContent="
+ faqContent + ", faqCreateDate=" + faqCreateDate + "]";
}
}
| [
"[email protected]"
]
| |
070546d5a69aa3c0731b5acf943aa18001234522 | ddbefd3db2bbd229c6e655dbd06568944d0137dc | /src/main/java/helpers/ManagedFileResource.java | 2edb7176e81a6c427ad5ad1bb1c7a30e34781e4e | [
"MIT",
"LicenseRef-scancode-proprietary-license"
]
| permissive | alphagov/verify-test-utils | 8fbe3fba431936ff3e40aba656f082719a458db7 | 6df7ea9fdcf836bbdeb34f38a14129fd9bbebe2c | refs/heads/master | 2022-10-22T16:12:31.266853 | 2022-10-17T16:05:13 | 2022-10-17T16:05:13 | 100,490,254 | 0 | 3 | MIT | 2022-10-17T15:57:35 | 2017-08-16T13:06:30 | Java | UTF-8 | Java | false | false | 111 | java | package helpers;
public interface ManagedFileResource {
public void create();
public void delete();
}
| [
"[email protected]"
]
| |
217878a47f20aced995280725d52f8b066406dda | c9418479bd6da8d3b0d710e04f7d2f8f0a73d0ea | /tuotannonohjaus/src/main/java/dicip/domain/WorkPhase.java | a7f4f6607f16e05e08ebd4342000989a47ced8b8 | []
| no_license | Skorp7/ot-harjoitustyo | b3ce6e098915c866a657532db053ada02acdb434 | 9ed022bc27df81dfa86284b284fdf5c1584efcb6 | refs/heads/master | 2021-03-08T05:51:40.484604 | 2020-05-08T07:54:22 | 2020-05-08T07:54:22 | 246,323,181 | 0 | 0 | null | 2020-10-13T20:38:12 | 2020-03-10T14:28:55 | Java | UTF-8 | Java | false | false | 1,102 | java | package dicip.domain;
/**
*
* @author sakorpi
*/
/**
*
* Class represents a single work phase (event)
*/
public class WorkPhase {
private String workphase;
private String orderCode;
private String userName;
private String description;
private String timestamp;
public WorkPhase(String timestamp, String workphase, String code, String name, String description) {
this.workphase = workphase;
this.orderCode = code;
this.userName = name;
this.description = description;
this.timestamp = timestamp;
}
public String getWorkphase() {
return workphase;
}
public String getCode() {
return orderCode;
}
public String getName() {
return userName;
}
public String getDescription() {
return description;
}
public String getTimestamp() {
return timestamp;
}
public void setWorkphase(String workphase) {
this.workphase = workphase;
}
public void setDescription(String description) {
this.description = description;
}
}
| [
"[email protected]"
]
| |
ffffbf1ed400f775ea1d16bd5724c7eb7c0eda4c | d31341a19eb9bf2b27e1a5bcc04417ce4f0bc0db | /src/actionLei/Aaction.java | 000c8061c0d7db90dccac3ef377ea772fedc3246 | []
| no_license | thy123456789/AWeb | 34ff3ad60c2f52d60587d27e8b2e38e903faed19 | 007d5bc1849d18c0aecb6817891da50189a56548 | refs/heads/master | 2021-01-22T02:34:46.334507 | 2017-02-06T01:33:47 | 2017-02-06T01:33:47 | 81,057,693 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 124 | java | package actionLei;
public class Aaction<AService> {
AService aa ;
public String x(){
return "xx";
}
}
| [
"[email protected]"
]
| |
5eeb6ff87ea33cd30d7cf6e0b0ea212e4f8f151b | 7c80de97d652dd90cc1b6d24f39cd8d5f761d2ca | /Parking-Lot.java | ac858c502045810f7e942d17fa6b84045dd8d0de | []
| no_license | Amrindersingh1/Low-Level-Design | fb376555c4766b3e0ba43efed6a97a52bec12b2c | abac00617dfc12dc6592abe8e81e2789edf086f0 | refs/heads/main | 2023-03-05T13:28:23.544974 | 2021-02-19T04:18:52 | 2021-02-19T04:18:52 | 339,595,655 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,281 | java | /* Requirements:
* 1. Parking lot: address, multiple floors
* 2. Entry gate : multiple, issue parking ticket, isfull screen, parking attendant
* 3. Exit gate : multiple, process ticket, payment, parking attendant
* 4. Parking Floor : Parking spots, info screen about available spots
* 5. Parking Attendants : issue ticket, process ticket
* 6. Parking spot: MOTORBIKE, SMALL, LARGE, ELECTRIC, HANDICAP
* 7. Vehicles: 2 wheeler, car, van/truck/bus, electric
* 8. Payment: cash/card, hourly based model
*/
/* Actors:
* 1. Admin : login/logout, add/modify gates, add/modify floors, add/modify spots, add/modify attendant , add/modify rates
* 2. Attendant : login/logout, process ticket, process payment
* 3. Customer : take ticket, payment(cash/credit)
* 4. System : Assign a parking spot, remove vehicle from parking spot, show parking status, show available spots , issue ticket
*/
// Constants
public enum ParkingSpotType {
MOTORBIKE, SMALL, LARGE, ELECTRIC, HANDICAPPED
}
public enum VehicleType {
MOTORBIKE, CAR, VAN, ELECTRIC, HANDICAPPED
}
public class Address {
private String street;
private String city;
private String state;
private String zipcode;
private String country;
}
public class Person {
private String name;
private Address address;
private String email;
private String phone;
}
// Accounts/Admin
public abstract class Account {
private String userName;
private String password;
private AccountStatus status;
private Person person;
public boolean Login();
public boolean Logout();
public boolean resetPassword();
}
public class Admin extends Account{
public bool addEntrance(Entrance entrance);
public bool addExit(Exit exit);
public bool addParkingFloor(ParkingFloor floor);
public bool addParkingSpot(String floorName, ParkingSpot spot);
public bool addParkingDisplayBoard(String floorName, ParkingDisplayBoard displayBoard);
public bool addCustomerInfoPanel(String floorName, CustomerInfoPanel infoPanel);
public bool updateEntrance(Entrance entrance);
public bool updateExit(Exit exit);
public bool updateParkingFloor(ParkingFloor floor);
public bool updateParkingSpot(String floorName, ParkingSpot spot);
public bool updateParkingDisplayBoard(String floorName, ParkingDisplayBoard displayBoard);
public bool updateCustomerInfoPanel(String floorName, CustomerInfoPanel infoPanel);
}
public class ParkingAttendant extends Account{
public boolean processTicket(ParkingTicket ticket);
}
// Vehicles
public abstract class Vehicle {
private String licenseNumber;
private final VehicleType type;
private ParkingTicket ticket;
public Vehicle(VehicleType type) {
this.type = type;
}
}
public class Car extends Vehicle {
public Car() {
super(VehicleType.CAR);
}
}
public class Van extends Vehicle {
public Van() {
super(VehicleType.VAN);
}
}
public class Truck extends Vehicle {
public Truck() {
super(VehicleType.TRUCK);
}
}
// Parking Spot
public abstarct class ParkingSpot {
private String number;
private boolean free;
private Vehicle vehicle;
private final ParkingSpotType type;
public ParkingSpot(ParkingSpotType type) {
this.type = type;
}
public boolean assignVehicle(Vehicle vehicle) {
this.vehicle = vehicle;
free = false;
}
public boolean removeVehicle(Vehicle vehicle) {
this.vehicle = null;
this.free = true;
}
}
public class HandicappedSpot extends ParkingSpot {
public HandicappedSpot() {
super(ParkingSpotType.HANDICAPPED);
}
}
public class SmallSpot extends ParkingSpot {
public SmallSpot() {
super(ParkingSpotType.SMALL);
}
}
public class LargeSpot extends ParkingSpot {
public LargeSpot() {
super(ParkingSpotType.LARGE);
}
}
public class MotorbikeSpot extends ParkingSpot {
public MotorbikeSpot() {
super(ParkingSpotType.MOTORBIKE);
}
}
public class ElectricSpot extends ParkingSpot {
public ElectricSpot() {
super(ParkingSpotType.ELECTRIC);
}
}
// Parking Floor : Parking spots, info screen about available spots
public class ParkingFloor{
private String name;
private List<HandicappedSpot> handicappedSpots;
private List<SmallSpot> smallSpots;
private List<LargeSpot> largeSpots;
private List<MotorbikeSpot> motorbikeSpots;
private List<ElectricSpot> electricSpots;
private ParkingDisplayBoard displayBoard;
public ParkingFloor(String name) {
this.name = name;
}
public void addParkingSpot(ParkingSpot spot) {
switch (spot.getType()) {
case ParkingSpotType.HANDICAPPED:
handicappedSpots.add(spot);
break;
case ParkingSpotType.SMALL:
smallSpots.add(spot);
break;
case ParkingSpotType.LARGE:
largeSpots.add(spot);
break;
case ParkingSpotType.MOTORBIKE:
motorbikeSpots.add(spot);
break;
case ParkingSpotType.ELECTRIC:
electricSpots.add(spot);
break;
default:
print("Wrong parking spot type!");
}
}
public void assignVehicleToSpot(Vehicle vehicle, ParkingSpot spot) {
spot.assignVehicle(vehicle);
displayBoard.updateDisplayBoard(spot);
}
public void freeSpot(ParkingSpot spot) {
spot.removeVehicle();
displayBoard.updateDisplayBoard(spot);
}
}
public class ParkingDisplayBoard {
private String id;
private HandicappedSpot handicappedFreeSpot;
private SmallSpot smallFreeSpot;
private LargeSpot largeFreeSpot;
private MotorbikeSpot motorbikeFreeSpot;
private ElectricSpot electricFreeSpot;
private void updateDisplayBoard(ParkingSpot spot) {
int count = spot.isFree()1:-1;
switch (spot.getType()) {
case ParkingSpotType.HANDICAPPED:
handicappedFreeSpot+=count;
break;
case ParkingSpotType.SMALL:
smallFreeSpot+=count;
break;
case ParkingSpotType.LARGE:
LargeSpot+=count;
break;
case ParkingSpotType.MOTORBIKE:
MotorbikeSpot+=count;
break;
case ParkingSpotType.ELECTRIC:
ElectricSpot+=count;
break;
default:
print("Wrong parking spot type!");
}
}
}
// Parking Lot
public class ParkingLot {
private String name;
private Location address;
private ParkingRate parkingRate;
private int compactSpotCount;
private int largeSpotCount;
private int motorbikeSpotCount;
private int electricSpotCount;
private final int maxCompactCount;
private final int maxLargeCount;
private final int maxMotorbikeCount;
private final int maxElectricCount;
private HashMap<String, EntrancePanel> entrancePanels;
private HashMap<String, ExitPanel> exitPanels;
private HashMap<String, ParkingFloor> parkingFloors;
// all active parking tickets, identified by their ticketNumber
private HashMap<String, ParkingTicket> activeTickets;
// singleton ParkingLot to ensure only one object of ParkingLot in the system,
// all entrance panels will use this object to create new parking ticket: getNewParkingTicket(),
// similarly exit panels will also use this object to close parking tickets
private static ParkingLot parkingLot = null;
// private constructor to restrict for singleton
private ParkingLot() {
// 1. initialize variables: read name, address and parkingRate from database
// 2. initialize parking floors: read the parking floor map from database,
// this map should tell how many parking spots are there on each floor. This
// should also initialize max spot counts too.
// 3. initialize parking spot counts by reading all active tickets from database
// 4. initialize entrance and exit panels: read from database
}
// static method to get the singleton instance of StockExchange
public static ParkingLot getInstance() {
if (parkingLot == null) {
parkingLot = new ParkingLot();
}
return parkingLot;
}
// note that the following method is 'synchronized' to allow multiple entrances
// panels to issue a new parking ticket without interfering with each other
public synchronized ParkingTicket getNewParkingTicket(Vehicle vehicle) throws ParkingFullException {
if (this.isFull(vehicle.getType())) {
throw new ParkingFullException();
}
ParkingTicket ticket = new ParkingTicket();
vehicle.assignTicket(ticket);
ticket.saveInDB();
// if the ticket is successfully saved in the database, we can increment the parking spot count
this.incrementSpotCount(vehicle.getType());
this.activeTickets.put(ticket.getTicketNumber(), ticket);
return ticket;
}
public boolean isFull(VehicleType type) {
// trucks and vans can only be parked in LargeSpot
if (type == VehicleType.Truck || type == VehicleType.Van) {
return largeSpotCount >= maxLargeCount;
}
// motorbikes can only be parked at motorbike spots
if (type == VehicleType.Motorbike) {
return motorbikeSpotCount >= maxMotorbikeCount;
}
// cars can be parked at compact or large spots
if (type == VehicleType.Car) {
return (compactSpotCount + largeSpotCount) >= (maxCompactCount + maxLargeCount);
}
// electric car can be parked at compact, large or electric spots
return (compactSpotCount + largeSpotCount + electricSpotCount) >= (maxCompactCount + maxLargeCount
+ maxElectricCount);
}
// increment the parking spot count based on the vehicle type
private boolean incrementSpotCount(VehicleType type) {
if (type == VehicleType.Truck || type == VehicleType.Van) {
largeSpotCount++;
} else if (type == VehicleType.Motorbike) {
motorbikeSpotCount++;
} else if (type == VehicleType.Car) {
if (compactSpotCount < maxCompactCount) {
compactSpotCount++;
} else {
largeSpotCount++;
}
} else { // electric car
if (electricSpotCount < maxElectricCount) {
electricSpotCount++;
} else if (compactSpotCount < maxCompactCount) {
compactSpotCount++;
} else {
largeSpotCount++;
}
}
}
public boolean isFull() {
for (String key : parkingFloors.keySet()) {
if (!parkingFloors.get(key).isFull()) {
return false;
}
}
return true;
}
public void addParkingFloor(ParkingFloor floor) {
/* store in database */ }
public void addEntrancePanel(EntrancePanel entrancePanel) {
/* store in database */ }
public void addExitPanel(ExitPanel exitPanel) {
/* store in database */ }
}
| [
"[email protected]"
]
| |
58588b3a40d767e4bcc80cd0f68e09fc3e6112c9 | 603b90b829a5c4c8ec37113d8a47d504414c4c4a | /src/main/java/ru/dsoccer1980/auth/Main2.java | 8af3e4d552f7516761ba3796941d3acaac166dd7 | []
| no_license | dsoccer1980/smartid | c6b5a5106cbbb016fb79114a96f1be60a988fff1 | 8ae6c52e4959f14202d6c4aa732dd233a931da69 | refs/heads/master | 2023-01-29T09:30:38.614929 | 2020-12-04T11:24:26 | 2020-12-04T11:24:26 | 318,494,793 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,438 | java | package ru.dsoccer1980.auth;
import com.jcabi.log.Logger;
import ee.sk.smartid.SmartIdClient;
import ee.sk.smartid.VerificationCodeCalculator;
import ee.sk.smartid.digidoc4j.SmartIdSignatureToken;
import ee.sk.smartid.rest.dao.NationalIdentity;
import eu.europa.esig.dss.DSSUtils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.KeyStore;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.digidoc4j.Configuration;
import org.digidoc4j.Container;
import org.digidoc4j.ContainerBuilder;
import org.digidoc4j.DataToSign;
import org.digidoc4j.DigestAlgorithm;
import org.digidoc4j.Signature;
import org.digidoc4j.SignatureBuilder;
import org.digidoc4j.utils.Helper;
import org.springframework.util.ResourceUtils;
public class Main2 {
public static void main(String[] args) throws Exception {
new Main2().get();
}
public void get() throws Exception {
KeyStore keyStore;
File file = ResourceUtils.getFile("D:\\Projects\\java\\my\\smartid\\src\\main\\webapp\\WEB-INF\\classes\\smartid_test_certificates.jks");
try (InputStream is = new FileInputStream(file)) {
keyStore = KeyStore.getInstance("JKS");
keyStore.load(is, "changeit".toCharArray());
} catch (Exception e) {
Logger.error(this, "Error while loading keystore %s", ExceptionUtils.getStackTrace(e));
throw new RuntimeException("Error while loading keystore");
}
SmartIdClient client = new SmartIdClient();
client.setRelyingPartyUUID("00000000-0000-0000-0000-000000000000");
client.setRelyingPartyName("DEMO");
client.setHostUrl("https://sid.demo.sk.ee/smart-id-rp/v1/");
client.loadSslCertificatesFromKeystore(keyStore);
NationalIdentity identity = new NationalIdentity("EE", "10101010005"); // identity of the signer
SmartIdSignatureToken smartIdSignatureToken = new SmartIdSignatureToken(client, identity);
// PROD vs TEST
// Configuration configuration = Configuration.of(Configuration.Mode.PROD);
Configuration configuration = Configuration.of(Configuration.Mode.TEST);
configuration.getTSL().addTSLCertificate(Helper.loadCertificate("d:/xml/TEST_of_EID-SK_2016.der.crt"));
// configuration.setTslLocation("https://open-eid.github.io/test-TL/tl-mp-test-EE.xml");
// To get SK root certificates please refer to https://sk.ee/en/repository/certs/
//Create a container with a text file to be signed
Container container = ContainerBuilder.
aContainer().
withConfiguration(configuration).
withDataFile("d:/xml/2.txt", "text/plain").
build();
// Get the signer's certificate
X509Certificate signingCert = smartIdSignatureToken.getCertificate();
// Get the data to be signed by the user
DataToSign dataToSign = SignatureBuilder.
aSignature(container).
withSigningCertificate(signingCert).
withSignatureDigestAlgorithm(DigestAlgorithm.SHA256).
buildDataToSign();
// Data to sign contains the digest that should be signed
// byte[] digestToSign = dataToSign.getDigestToSign();
// Data to sign contains the digest that should be signed starting digidoc4j version 2.x
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] digestToSign = digest.digest(dataToSign.getDataToSign());
// Calculate the Smart-ID verification code to display on the web page or e-service
String verificationCode = VerificationCodeCalculator.calculate(digestToSign);
// Sign the digest
byte[] signatureValue = smartIdSignatureToken.signDigest(DigestAlgorithm.SHA256, digestToSign);
// Finalize the signature with OCSP response and timestamp (or timemark)
Signature signature = dataToSign.finalize(signatureValue);
// Add signature to the container
container.addSignature(signature);
// save(container);
container.saveAsFile("d:/xml/my3.bdoc");
System.out.println("OK");
}
public void save(Container container) {
try (FileOutputStream outputStream = new FileOutputStream("d:/xml/my3.bdoc")) {
outputStream.write(DSSUtils.toByteArray(container.saveAsStream()));
outputStream.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
]
| |
6216e0a555e2db8cf160a613b56995ecfc0cb741 | d0f7e407f34a730e73aece9adfe5f63d0b624722 | /RealmeParts/src/com/realme/realmeparts/kcal/PresetDialog.java | 04f27be4f40e3fed4c680aff52219bbe0dfab863 | []
| no_license | Recov-Ofrp/ebo_device_realme_RMX1801 | b983f29f3e88290ee3b8751a8ca04f76abc6ee8b | d78d9a1ecf914e052506f95ea180740f732b24e1 | refs/heads/main | 2023-03-29T07:55:18.530034 | 2021-02-18T13:16:43 | 2021-03-30T16:05:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,318 | java | package com.realme.realmeparts.kcal;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.FragmentManager;
import android.content.DialogInterface;
import android.os.Bundle;
import com.realme.realmeparts.R;
public class PresetDialog extends DialogFragment {
private CharSequence[] mEntries;
private CharSequence[] mEntryValues;
private String mValue;
private KCalSettings mKCalSettingsFragment;
private int mClickedDialogEntryIndex;
private final DialogInterface.OnClickListener selectItemListener =
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (mClickedDialogEntryIndex != which) {
mValue = mEntryValues[which].toString();
mKCalSettingsFragment.applyValues(mValue);
mClickedDialogEntryIndex = which;
}
dialog.dismiss();
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mEntries = getResources().getStringArray(R.array.preset_enteries);
mEntryValues = getResources().getStringArray(R.array.preset_values);
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder dialog = new AlertDialog.Builder(getActivity());
dialog.setTitle(getString(R.string.presets_dialog_title));
mClickedDialogEntryIndex = getValueIndex();
dialog.setItems(mEntries, selectItemListener);
return dialog.create();
}
private int getValueIndex() {
return findIndexOfValue(mValue);
}
private int findIndexOfValue(String value) {
if (value != null && mEntryValues != null) {
for (int i = mEntryValues.length - 1; i >= 0; i--) {
if (mEntryValues[i].equals(value)) {
return i;
}
}
}
return -1;
}
public void show(FragmentManager manager, String tag, KCalSettings mKCalSettingsFragment) {
super.show(manager, tag);
this.mKCalSettingsFragment = mKCalSettingsFragment;
}
}
| [
"[email protected]"
]
| |
862655bd78834e080ddde0ceda3660112fd09dc7 | aa56b9a7335ce95cb40483099d500b601a217a0a | /APLesson_06/APLab_06_1_Ex8.java | da2f4b5033ccb983c7cb05328e0aa37aab851986 | []
| no_license | doanj2882/Doan_Jared | d7bae51bc7b8a0bb7348bea6af62ea1de5787054 | 78fc3f8c6f9b03bd61e08ca10b27f33c7c789c19 | refs/heads/master | 2021-01-24T02:16:45.898435 | 2017-05-25T22:39:37 | 2017-05-25T22:39:37 | 67,253,869 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 313 | java | public class APLab_06_1_Ex8
{
public static void main(String[]args)
{
sing("Na", 4);
sing("Na", 4);
sing("Hey", 4);
sing("Goodbye!", 1);
}
public static void sing(String word, int times)
{
for(int i = 1; i <= times; i++)
{
System.out.print(word + " " );
}
System.out.println();
}
} | [
"[email protected]"
]
| |
d20fe05b3799c9f7a1b95c2040b33d155d165560 | 29c3138f8d59804254ef542cb53685d13b8ea9fd | /Project_160/src/method_return_types/Repository.java | 60ab8d494c8775c61ad34ae35439a7cf8782c86d | []
| no_license | sunilreddyg/27th_Feb_10AM_2019 | 209a9cc7ba0d85f06b30c24f1cfc6220640ac736 | 970826ca42800dec30672c3349110c62aa887932 | refs/heads/master | 2020-04-28T03:39:48.475085 | 2019-05-20T07:44:04 | 2019-05-20T07:44:04 | 174,946,103 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 11,478 | java | package method_return_types;
import java.io.File;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.TimeoutException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;
public class Repository
{
public WebDriver driver;
public WebDriverWait wait;
/*
* Keywordname:--> Launch diff browsers [Firefox,Chrome,IE]
* Author:-->
* CreatedOn:-->
* ReviewedBy:-->
* parametersUsed:-->
* LastUpdatedDate:-->
*/
public void LaunchBrowser(String browsername)
{
switch (browsername)
{
case "firefox":
driver=new FirefoxDriver();
break;
case "chrome":
driver=new ChromeDriver();
break;
case "ie":
driver=new InternetExplorerDriver();
break;
default:System.out.println("browser mismatch");
break;
}
}
/*
* Keywordname:--> load webapplication url to browser window
* Author:-->
* CreatedOn:-->
* ReviewedBy:-->
* parametersUsed:-->
* LastUpdatedDate:-->
*/
public void load_webpage(String url)
{
driver.get(url);
driver.manage().window().maximize();
}
/*
* Keywordname:--> set dynamic timeout [Implicit/explicit]
* Author:-->
* CreatedOn:-->
* ReviewedBy:-->
* parametersUsed:-->
* LastUpdatedDate:-->
*/
public void set_timeout(int time_in_seconds)
{
//Implicit wait timeout
driver.manage().timeouts().implicitlyWait(time_in_seconds, TimeUnit.SECONDS);
//Explicit wait timeout
wait=new WebDriverWait(driver, time_in_seconds);
}
/*
* Keywordname:--> Enter text into editbox using xpath locator
* Author:-->
* CreatedOn:-->
* ReviewedBy:-->
* parametersUsed:-->
* LastUpdatedDate:-->
*/
public void Enter_text(String elemnet_Xpath,String inputdata)
{
WebElement Editbox=driver.findElement(By.xpath(elemnet_Xpath));
Editbox.clear();
Editbox.sendKeys(inputdata);
}
/*
* Keywordname:--> Enter text into editbox using WebElement [Pagefactory keyword]
* Author:-->
* CreatedOn:-->
* ReviewedBy:-->
* parametersUsed:-->
* LastUpdatedDate:-->
*/
public void Enter_text(WebElement Element,String inputdata)
{
WebElement Editbox=wait.until(ExpectedConditions.visibilityOf(Element));
Editbox.clear();
Editbox.sendKeys(inputdata);
}
/*
* Keywordname:--> Enter text into editbox using Locator
* Author:-->
* CreatedOn:-->
* ReviewedBy:-->
* parametersUsed:-->
* LastUpdatedDate:-->
*/
public void Enter_text(By locator,String inputdata)
{
WebElement Editbox=wait.until(ExpectedConditions.visibilityOfElementLocated(locator));
Editbox.clear();
Editbox.sendKeys(inputdata);
}
/*
* MethodName:--> Select Dropdown using optioname
* Author:-->
* CreatedON:-->
* ReviewedBy:-->
* Parametersused:-->
* Lasupdated Date:--->
*/
public void Select_dropdown(By locator, String Option_name)
{
WebElement Dropdown=wait.until(ExpectedConditions.visibilityOfElementLocated(locator));
new Select(Dropdown).selectByVisibleText(Option_name);
}
/*
* MethodName:--> Select Dropdown using optioname [For pagefactory]
* Author:-->
* CreatedON:-->
* ReviewedBy:-->
* Parametersused:-->
* Lasupdated Date:--->
*/
public void Select_dropdown(WebElement Element, String Option_name)
{
WebElement Dropdown=wait.until(ExpectedConditions.visibilityOf(Element));
new Select(Dropdown).selectByVisibleText(Option_name);
}
/*
* MethodName:--> Click Element [Radiobutton, checkbox,link,button,list,image...etc]
* Author:-->
* CreatedON:-->
* ReviewedBy:-->
* Parametersused:-->
* Lasupdated Date:--->
*/
public void Click_element(By locator)
{
driver.findElement(locator).click();
}
/*
* MethodName:--> waitandclick [Radiobutton, checkbox,link,button,list,image...etc]
* Author:-->
* CreatedON:-->
* ReviewedBy:-->
* Parametersused:-->
* Lasupdated Date:--->
*/
public void Wait_and_click(By locator)
{
wait.until(ExpectedConditions.elementToBeClickable(locator)).click();
}
/*
* MethodName:--> waitforElementto visisble
* Author:-->
* CreatedON:-->
* ReviewedBy:-->
* Parametersused:-->
* Lasupdated Date:--->
*/
public void wait_for_Element_visible(By locator)
{
wait.until(ExpectedConditions.visibilityOfElementLocated(locator));
}
/*
* MethodName:-->Mouse hover on element
* Author:-->
* CreatedON:-->
* ReviewedBy:-->
* Parametersused:-->
* Lasupdated Date:--->
*/
public void MouseHover(By locator)
{
WebElement Element=wait.until(ExpectedConditions.visibilityOfElementLocated(locator));
new Actions(driver).moveToElement(Element).perform();
}
/*
* MethodName:-->ContextClick
* Author:-->
* CreatedON:-->
* ReviewedBy:-->
* Parametersused:-->
* Lasupdated Date:--->
*/
public void RightClick_OnElement(By locator)
{
WebElement Element=driver.findElement(locator);
new Actions(driver).contextClick(Element).perform();
}
/*
* MethodName:-->switch to window using window title
* Author:-->
* CreatedON:-->
* ReviewedBy:-->
* Parametersused:-->
* Lasupdated Date:--->
*/
public void switchto_window(String window_title)
{
//Get all window dyamic id's
Set<String> allwindows=driver.getWindowHandles();
//Apply foreach loop ot iterate
for (String Eachwindow : allwindows)
{
driver.switchTo().window(Eachwindow);
//Get Current window at runtime
String pagetitle=driver.getTitle();
if(pagetitle.contains(window_title))
{
break; //At what window title break iteration.It keep window controls on same window.
}
}
}
/*
* MethodName:-->Capture Screenshot
* Author:-->
* CreatedON:-->
* ReviewedBy:-->
* Parametersused:-->
* Lasupdated Date:--->
*/
public void Capturescreen(String Imagename)
{
//Java time stamp..
DateFormat df=new SimpleDateFormat("yyyy/MMM/dd/ hh-mm-ss");
//Get System Data
Date d=new Date(); //import java.util;
//Using simple formatter change system data..
String time=df.format(d);
System.out.println(d.toString());
try {
File src1=((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(src1, new File("screens\\"+time+Imagename+".png"));
} catch (Exception e) {
e.printStackTrace();
}
}
//===================User_defined_keywords
/*
* Keywordname:--> Method verify title presented at webpage
* Author:-->
* CreatedON:-->
* ReviewedBy:-->
* Parametersused:-->
* Lasupdated Date:--->
*/
public boolean is_title_presented(String exp_title)
{
try {
boolean flag=wait.until(ExpectedConditions.titleContains(exp_title));
return flag;
} catch (TimeoutException e) {
return false;
}
}
/*
* MethodName:--> Verify url presented at webpage
* Author:-->
* CreatedON:-->
* ReviewedBy:-->
* Parametersused:-->
* Lasupdated Date:--->
*/
public boolean isUrl_Presented(String Exp_Url)
{
try {
boolean flag=wait.until(ExpectedConditions.urlContains(Exp_Url));
return flag;
} catch (TimeoutException e) {
return false;
}
}
/*
* MethodName:--> Method verify text visible at webpage
* Author:-->
* CreatedON:-->
* ReviewedBy:-->
* Parametersused:-->
* Lasupdated Date:--->
*/
public boolean isText_visibleAt_Webpage(String Exp_text)
{
//Identify page
WebElement page=driver.findElement(By.tagName("body"));
//Capture page visible text
String page_visibleText=page.getText();
//Verify expected text visible at webpage
boolean flag=page_visibleText.contains(Exp_text);
return flag;
}
/*
* MethodName:--> Method verify Alert presented at webpage and return boolean value
* Author:-->
* CreatedON:-->
* ReviewedBy:-->
* Parametersused:-->
* Lasupdated Date:--->
*/
public boolean isAlert_presented()
{
try {
driver.switchTo().alert();
return true;
} catch (NoAlertPresentException e) {
e.printStackTrace();
return false;
}
}
/*
* MethodName:--> Accept or dismiss alert window
* Author:-->
* CreatedON:-->
* ReviewedBy:-->
* Parametersused:-->
* Lasupdated Date:--->
*/
public void CloseAlert()
{
if(isAlert_presented())
{
driver.switchTo().alert().accept();
}
}
/*
* MethodName:--> Method return selected row and cell value [From static table]
* Author:-->
* CreatedON:-->
* ReviewedBy:-->
* Parametersused:-->
* Lasupdated Date:--->
*/
public WebElement Get_Static_Webtable_Cell(String TableXpath,int Row, int Cell)
{
//Identify Webtable
WebElement table=driver.findElement(By.xpath(TableXpath));
//Find number of rows available at webtable
List<WebElement> rows=table.findElements(By.tagName("tr"));
//Target Required row
WebElement SelectedRow=rows.get(Row);
//using selected row find list of cells
List<WebElement> cells=SelectedRow.findElements(By.tagName("td"));
//Target Required Cell
WebElement Webtable_cell=cells.get(Cell);
return Webtable_cell;
}
/*
* MethodName:--> Method return selected Record referal cell [From Dynamic table]
* Author:-->
* CreatedON:-->
* ReviewedBy:-->
* Parametersused:-->
* Lasupdated Date:--->
*/
public WebElement Get_Dynaic_Webtable_Cell(String TableXpath, String Recordname,int Cell)
{
//Identify Webtable
WebElement table=driver.findElement(By.xpath(TableXpath));
//Find number of rows available at webtable
List<WebElement> rows=table.findElements(By.tagName("tr"));
boolean flag=false;
WebElement Webtable_Cell = null;
//Iterate for number of rows
for (int i = 1; i < rows.size(); i++)
{
//target Each Dynamic row at table
WebElement DynamicRow=rows.get(i);
//Capture text on Each Row
String RowText=DynamicRow.getText();
//Accept Condition where any record match in dynamic row
if(RowText.contains(Recordname))
{
flag=true;
System.out.println("Row Number is => "+i);
//using Dynamic row find List of Cells
List<WebElement> cells=DynamicRow.findElements(By.tagName("td"));
//Target Required Cell
Webtable_Cell=cells.get(Cell);
break; //stop Iteration
}
}//for
System.out.println("Record avaiable status is => "+flag);
return Webtable_Cell;
}//Method
}
| [
"[email protected]"
]
| |
5a71dbf51946c8fa7d4fe3aa378a2ee4aa5e7424 | 529f8900a637f41f8064005e44feb470d438bd4c | /src/main/java/operations/ScreenShots.java | dfdeb656bc33f4f20ffc6fa1b9ff695fe61447dd | []
| no_license | mayuri68/Framework | 21af9a736ce2e4be763f8c7f721416c32f3b1659 | c4751afbc8d832c60f892412c70a2c5db0444d2b | refs/heads/master | 2023-01-24T01:23:27.443284 | 2020-11-19T17:13:56 | 2020-11-19T17:13:56 | 314,316,439 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 928 | java | package operations;
import java.io.File;
import org.openqa.selenium.OutputType;
import org.apache.commons.io.*;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
public class ScreenShots {
public static void captureScreenShot(WebDriver driver, String ScreenShotName)
{
try {
File screenshot=((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(screenshot,new File("C://Selenium//"+ScreenShotName+".jpg"));
} catch (Exception e)
{
System.out.println(e.getMessage());
e.printStackTrace();
}
}
} | [
"[email protected]"
]
| |
f1b392822ca8b39b4313843e2fcb2e0fcee4096b | a1acdbbf65d6361fb9ea3ef86cfc47d5937c9dff | /app/src/main/java/ru/net/serbis/slideshow/impl/Widget2.java | dea2905a411694c0709d68133cc62d915c7cecd3 | []
| no_license | garbarick/SBSlideshow | e53d58b46a60da9af709fddc1a389dd4c328f471 | 2a7efc090faf322ed0175640251727b282700055 | refs/heads/master | 2023-07-29T01:16:07.726938 | 2023-07-09T18:53:35 | 2023-07-09T18:53:35 | 89,342,396 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 179 | java | package ru.net.serbis.slideshow.impl;
import ru.net.serbis.slideshow.activity.Widget;
/**
* SEBY0408
*/
public class Widget2 extends Widget
{
{
count = 2;
}
}
| [
"[email protected]"
]
| |
7d3805276c916f92ea0e86d51949cca85a87dc37 | 0691d8e0cd3cb42025656fec1eff92d0267f914c | /Trabalho PAA TP1/Dinâmico/tp1.java | e02b8281692b65459759837a903ce1e70033e964 | []
| no_license | adhonay/Projeto-e-Analise-de-Algoritmos-PAA | 649fc329e2e5eb2a3f31f6028afe0ccc2c4fa606 | ef2114175116c99cfb5abbe094aedbc6f0ad686c | refs/heads/master | 2020-06-04T12:15:13.372585 | 2019-06-14T23:49:57 | 2019-06-14T23:49:57 | 192,017,018 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,407 | java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
import java.time.Duration;
import java.time.Instant;
import java.util.Calendar;
import java.util.StringTokenizer;
import java.util.TimeZone;
public class tp1 {
static int NPratos, Orcamento, NDias;
static int[] lucro, custo;
static Prato[][][][] tabela;
static StringBuilder posicaoprato = new StringBuilder();
static final int custoInicial = 1000000000;//iniciar com maior valor possivelpara comparar
// com outro melhor e setar valor correto.
static Prato dinamico(int ultimoPrato, int frequencia, int dia, int custoTotal)
{
if(custoTotal < 0){
return new Prato(0, custoInicial);
}
if(dia == NDias){
return new Prato(0,Orcamento - custoTotal);
}
if(tabela[ultimoPrato][frequencia][dia][custoTotal] != null){
return tabela[ultimoPrato][frequencia][dia][custoTotal];
}
// for (int i = 0; i <= orcamento; i++)
// for (int j = 0; j < numeroDePratos; j++)
// for (int k = 0; k < 2; k++)
// tabela[0, i, j, k] = 0;
//
// for (int i = 1; i < numeroDeDias; i++)
// for (int j = 0; j < numeroDePratos; j++)
// for (int k = 0; k < 2; k++)
// tabela[i, 0, j, k] = -1;
//
// for (int i = 1; i < numeroDeDias; i++)
// for (int j = 1; j <= orcamento; j++)
// for (int k = 0; k < numeroDePratos; k++)
// for (int l = 0; l < 2; l++)
// {
// tabela[i, j, k, l] = -1;
// for (int item = 0; item < numeroDePratos; item++)
// {
Prato melhorPrato = new Prato(0,custoInicial);
for(int i = 1; i <= NPratos; i++){
int freqx;
if(i == ultimoPrato){
freqx = 1;
}
else{
freqx = 0;
}
Prato proximoPrato = dinamico(i, freqx, dia+1, custoTotal-custo[i]);
/* prato recebe = soma sobre todos os itens de tabela[i, frequencia, dia + 1, orcamento atual] */
//enquanto o custo
if(proximoPrato.custo == custoInicial){
continue;
}
double lucroAtual;
if(i == ultimoPrato){
if(frequencia == 0){// Se frequencia й igual ao prato anterior mais repetiu uma vez sу, entгo й metade.
lucroAtual = 0.5*lucro[i];
}
else{
lucroAtual = 0*lucro[i];// Senao se frequencia й igual ao prato anterior e ainda sim repetiu denovo, recebe 0.
}
}
else{
lucroAtual = 1*lucro[i];
}
// double lucroMaxPratoAtual = 0;
//
// if (k == item) // Se k não for o mesmo prato anterior
// {
// if (l == 1) // Se k nao for igual ao prato anterior e ainda sim repetiu denovo, recebe 0.
// lucroMaxPratoAtual = 0;
// else if (l == 0) // Se k nao for igual ao prato anterior mais repetiu uma vez sу, entгo й metade.
// lucroMaxPratoAtual = (0.5 * lucros[item]);
// }
// else // k nao for diferente (prato novo)
// lucroMaxPratoAtual = lucros[item]; // Recebe lucro normalmente.
//
// if (prox + lucroMaxPratoAtual > tabela[i, j, k, l]) // Se o lucro prox mais o lucro do prato atual for maior que o valor da tabela
// tabela[i, j, k, l] = prox + lucroMaxPratoAtual; // então tabela recebe o novo lucro maximo.
// }
if(proximoPrato.lucro + lucroAtual> melhorPrato.lucro || Math.abs(proximoPrato.lucro + lucroAtual - melhorPrato.lucro) <= 10e-5){
//verificando valor absoluto do lucro e menor que um valor grande setadado para subistirir custo melhor prato
// Math.Abs para pegar o valor absoluto.
if(Math.abs(proximoPrato.lucro + lucroAtual - melhorPrato.lucro) <= 10e-9){// Se o lucro prox mais o lucro do prato atual й maior que o valor da tabela
melhorPrato.custo = Math.min(melhorPrato.custo, proximoPrato.custo);
}
else{
melhorPrato.lucro = proximoPrato.lucro + lucroAtual;
melhorPrato.custo = proximoPrato.custo;
}
}
}
return tabela[ultimoPrato][frequencia][dia][custoTotal] = melhorPrato; //entгo tabela recebe o novo lucro maximo.
}
static void printPosicaoPrato(int ultimoPrato, int frequencia, int dia, int custoTotal)
{
if(custoTotal < 0){
return;
}
if(dia == NDias){
return;
}
Prato otimo = dinamico(ultimoPrato, frequencia, dia, custoTotal);
for(int i = 1; i <= NPratos; i++)
{
int freqx;
if(i == ultimoPrato){
freqx = 1;
}
else{
freqx = 0;
}
Prato proximoPrato = dinamico(i, freqx, dia+1, custoTotal-custo[i]);
/* prato recebe = soma sobre todos os itens de tabela[i, frequencia, dia + 1, orcamento atual] */
//enquanto o custo
if(proximoPrato.custo == custoInicial){
continue;
}
double lucroAtual;
if(i == ultimoPrato){
if(frequencia == 0){// Se frequencia й igual ao prato anterior mais repetiu uma vez sу, entгo й metade.
lucroAtual = 0.5*lucro[i];
}
else{
lucroAtual = 0*lucro[i];// Senao se frequencia й igual ao prato anterior e ainda sim repetiu denovo, recebe 0.
}
}
else{
lucroAtual = 1*lucro[i];
}
if(Math.abs(proximoPrato.lucro + lucroAtual - otimo.lucro) <= 10e-9 && otimo.custo == proximoPrato.custo)
{
posicaoprato.append(i).append(dia==NDias-1?"\n":" ");
int ultimo;
if(i == ultimoPrato){
ultimo = 1;
}
else{
ultimo =0;
}
printPosicaoPrato(i,ultimo, dia + 1, custoTotal - custo[i]);
return;
}
}
}
public static void main(String[] args) throws IOException {
// int mb = 1024;
// long memoria_inicial = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())/mb;
// long tempo_inicial = System.currentTimeMillis();
// Instant start = Instant.now();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String ler;
while(true)
{
// ler aquivo
ler = br.readLine();
if(!ler.equals("")){
StringTokenizer st = new StringTokenizer(ler);
NDias = Integer.parseInt(st.nextToken());
if(NDias == 0){
break;
}
else{// atribuir valores de acordo com entrada
NPratos = Integer.parseInt(st.nextToken());
Orcamento = Integer.parseInt(st.nextToken());
custo = new int[NPratos+1];
lucro = new int[NPratos+1];
for(int i = 1; i <= NPratos; i++)
{
st = new StringTokenizer(br.readLine());
custo[i] = Integer.parseInt(st.nextToken());
lucro[i] = Integer.parseInt(st.nextToken());
}
tabela = new Prato[NPratos+1][2][NDias+1][Orcamento+1];
// inicializando algoritimo dinamico com orcamento
Prato prato = dinamico(0,0,0,Orcamento);
if(prato.custo > Orcamento){
posicaoprato.append("0.0\n\n");
}
else
{
posicaoprato.append(new DecimalFormat("0.0").format(prato.lucro).replace(",",".")).append("\n");
printPosicaoPrato(0,0,0,Orcamento);
}
}
}
}
System.out.print(posicaoprato);
// long memoria_final = (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())/mb;
// long tempo_final = System.currentTimeMillis();
// System.out.println("Memoria usada: " + (memoria_final - memoria_inicial) + "kb");
// System.out.println("Tempo gasto: " + ((tempo_final - tempo_inicial) - 1000) + "ms");
// System.out.println("Dias: "+ NDias +"--- Pratos: "+NPratos);
// Instant end = Instant.now();
// System.out.println(Duration.between(start, end));
}
}
// objeto de pratos
class Prato
{
double lucro;
int custo;
int frequencia;
Prato(double x, int y)
{
lucro = x;
custo = y;
}
} | [
"junioradhonay.gmail.com"
]
| junioradhonay.gmail.com |
d59278fb9a02049dc223cf2a8b0383712119b5a7 | 66581176be2d7d091bba97446736d82660063041 | /acceptance-tests/src/test-support/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/perm/PermGetAccountsWhitelistTransaction.java | 9a2ef86fa3dfdb66dfc30105df009827478b9837 | [
"Apache-2.0"
]
| permissive | shemnon/pantheon | ebb3495325eec9fae129689221c1610d756f4928 | 9265b52b0a8295636044c08583738b0a79b17480 | refs/heads/master | 2020-04-02T23:29:01.359009 | 2019-09-13T20:14:07 | 2019-09-13T20:14:07 | 154,869,268 | 1 | 1 | Apache-2.0 | 2019-09-09T14:51:59 | 2018-10-26T17:20:03 | Java | UTF-8 | Java | false | false | 1,472 | java | /*
* Copyright 2018 ConsenSys AG.
*
* 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 tech.pegasys.pantheon.tests.acceptance.dsl.transaction.perm;
import static org.assertj.core.api.Assertions.assertThat;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.NodeRequests;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.Transaction;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.perm.PermissioningJsonRpcRequestFactory.GetAccountsWhitelistResponse;
import java.io.IOException;
import java.util.List;
public class PermGetAccountsWhitelistTransaction implements Transaction<List<String>> {
@Override
public List<String> execute(final NodeRequests node) {
try {
GetAccountsWhitelistResponse response = node.perm().getAccountsWhitelist().send();
assertThat(response.getResult()).isNotNull();
return response.getResult();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
| [
"[email protected]"
]
| |
05f10e4a2fd805ae60189aff2c667b528d1c14e9 | b55d3b2332871cad182ed82e01786780886d1dd0 | /src/medium/AirplaneSeatAssignmentProbability.java | 322fb658ebe3ebcca366788c3520278fe19b455a | []
| no_license | acrush37/leetcode-dp | 58c64735777c523a9627ef2950c8b865f0e33337 | 2fc10059c0151e8ef8dc948e8509be4bc3ad0796 | refs/heads/master | 2022-04-10T18:00:02.187481 | 2020-03-02T06:35:35 | 2020-03-02T06:35:35 | 215,553,677 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 872 | java | package medium;
/*
n passengers board an airplane with exactly n seats.
The first passenger has lost the ticket and picks a seat randomly. But after that, the rest of passengers will:
Take their own seat if it is still available,
Pick other seats randomly when they find their seat occupied
What is the probability that the n-th person can get his own seat?
*/
public class AirplaneSeatAssignmentProbability {
public static void main(String... args) {
AirplaneSeatAssignmentProbability airplaneSeatAssignmentProbability = new AirplaneSeatAssignmentProbability();
System.out.println(airplaneSeatAssignmentProbability.nthPersonGetsNthSeat(1));
System.out.println(airplaneSeatAssignmentProbability.nthPersonGetsNthSeat(2));
}
public double nthPersonGetsNthSeat(int n) {
return n == 1 ? 1 : 0.5;
}
}
| [
"[email protected]"
]
| |
8c21a5251de1360f352993e6c33c0db2d901f6b8 | 8f58f82a8b881df342abeeca58f67b4e7b8622fb | /src/main/java/com/cinema/dao/MovieRepository.java | 16e25aaef963b25e1a8f48d96fefda052f7fff6d | []
| no_license | Jenda456/SemestralniPrace | 286d3c6b54aa16d372b807441417672b14283724 | f3955fe3cc4383412d37250faca3ee9844392d01 | refs/heads/master | 2020-09-13T07:47:53.563077 | 2020-01-11T13:29:08 | 2020-01-11T13:29:08 | 222,700,296 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 249 | java | package com.cinema.dao;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import com.cinema.entity.Movie;
public interface MovieRepository extends JpaRepository<Movie, Integer> {
List<Movie> findAll();
}
| [
"[email protected]"
]
| |
7d3da08c145918769747d1d52086b97f87595a3c | 454eb75d7402c4a0da0e4c30fb91aca4856bbd03 | /o2o/trunk/java/o2o-service/src/main/java/cn/com/dyninfo/o2o/model/DlyTypeModelCriteria.java | b099eefcde06aae897f8d03d3947b585292e1848 | []
| no_license | fengclondy/guanhongshijia | 15a43f6007cdf996f57c4d09f61b25143b117d73 | c710fe725022fe82aefcb552ebe6d86dcb598d75 | refs/heads/master | 2020-04-15T16:43:37.291843 | 2016-09-09T05:44:14 | 2016-09-09T05:44:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 49,926 | java | package cn.com.dyninfo.o2o.model;
import java.util.ArrayList;
import java.util.List;
public class DlyTypeModelCriteria {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
protected int limitStart = -1;
protected int limitEnd = -1;
public DlyTypeModelCriteria() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
public void setLimitStart(int limitStart) {
this.limitStart=limitStart;
}
public int getLimitStart() {
return limitStart;
}
public void setLimitEnd(int limitEnd) {
this.limitEnd=limitEnd;
}
public int getLimitEnd() {
return limitEnd;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("ID is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("ID is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("ID =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("ID <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("ID >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("ID >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("ID <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("ID <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("ID in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("ID not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("ID between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("ID not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andDlynmaeIsNull() {
addCriterion("DLYNMAE is null");
return (Criteria) this;
}
public Criteria andDlynmaeIsNotNull() {
addCriterion("DLYNMAE is not null");
return (Criteria) this;
}
public Criteria andDlynmaeEqualTo(String value) {
addCriterion("DLYNMAE =", value, "dlynmae");
return (Criteria) this;
}
public Criteria andDlynmaeNotEqualTo(String value) {
addCriterion("DLYNMAE <>", value, "dlynmae");
return (Criteria) this;
}
public Criteria andDlynmaeGreaterThan(String value) {
addCriterion("DLYNMAE >", value, "dlynmae");
return (Criteria) this;
}
public Criteria andDlynmaeGreaterThanOrEqualTo(String value) {
addCriterion("DLYNMAE >=", value, "dlynmae");
return (Criteria) this;
}
public Criteria andDlynmaeLessThan(String value) {
addCriterion("DLYNMAE <", value, "dlynmae");
return (Criteria) this;
}
public Criteria andDlynmaeLessThanOrEqualTo(String value) {
addCriterion("DLYNMAE <=", value, "dlynmae");
return (Criteria) this;
}
public Criteria andDlynmaeLike(String value) {
addCriterion("DLYNMAE like", value, "dlynmae");
return (Criteria) this;
}
public Criteria andDlynmaeNotLike(String value) {
addCriterion("DLYNMAE not like", value, "dlynmae");
return (Criteria) this;
}
public Criteria andDlynmaeIn(List<String> values) {
addCriterion("DLYNMAE in", values, "dlynmae");
return (Criteria) this;
}
public Criteria andDlynmaeNotIn(List<String> values) {
addCriterion("DLYNMAE not in", values, "dlynmae");
return (Criteria) this;
}
public Criteria andDlynmaeBetween(String value1, String value2) {
addCriterion("DLYNMAE between", value1, value2, "dlynmae");
return (Criteria) this;
}
public Criteria andDlynmaeNotBetween(String value1, String value2) {
addCriterion("DLYNMAE not between", value1, value2, "dlynmae");
return (Criteria) this;
}
public Criteria andFirstwtIsNull() {
addCriterion("FIRSTWT is null");
return (Criteria) this;
}
public Criteria andFirstwtIsNotNull() {
addCriterion("FIRSTWT is not null");
return (Criteria) this;
}
public Criteria andFirstwtEqualTo(Double value) {
addCriterion("FIRSTWT =", value, "firstwt");
return (Criteria) this;
}
public Criteria andFirstwtNotEqualTo(Double value) {
addCriterion("FIRSTWT <>", value, "firstwt");
return (Criteria) this;
}
public Criteria andFirstwtGreaterThan(Double value) {
addCriterion("FIRSTWT >", value, "firstwt");
return (Criteria) this;
}
public Criteria andFirstwtGreaterThanOrEqualTo(Double value) {
addCriterion("FIRSTWT >=", value, "firstwt");
return (Criteria) this;
}
public Criteria andFirstwtLessThan(Double value) {
addCriterion("FIRSTWT <", value, "firstwt");
return (Criteria) this;
}
public Criteria andFirstwtLessThanOrEqualTo(Double value) {
addCriterion("FIRSTWT <=", value, "firstwt");
return (Criteria) this;
}
public Criteria andFirstwtIn(List<Double> values) {
addCriterion("FIRSTWT in", values, "firstwt");
return (Criteria) this;
}
public Criteria andFirstwtNotIn(List<Double> values) {
addCriterion("FIRSTWT not in", values, "firstwt");
return (Criteria) this;
}
public Criteria andFirstwtBetween(Double value1, Double value2) {
addCriterion("FIRSTWT between", value1, value2, "firstwt");
return (Criteria) this;
}
public Criteria andFirstwtNotBetween(Double value1, Double value2) {
addCriterion("FIRSTWT not between", value1, value2, "firstwt");
return (Criteria) this;
}
public Criteria andAddwtIsNull() {
addCriterion("ADDWT is null");
return (Criteria) this;
}
public Criteria andAddwtIsNotNull() {
addCriterion("ADDWT is not null");
return (Criteria) this;
}
public Criteria andAddwtEqualTo(Double value) {
addCriterion("ADDWT =", value, "addwt");
return (Criteria) this;
}
public Criteria andAddwtNotEqualTo(Double value) {
addCriterion("ADDWT <>", value, "addwt");
return (Criteria) this;
}
public Criteria andAddwtGreaterThan(Double value) {
addCriterion("ADDWT >", value, "addwt");
return (Criteria) this;
}
public Criteria andAddwtGreaterThanOrEqualTo(Double value) {
addCriterion("ADDWT >=", value, "addwt");
return (Criteria) this;
}
public Criteria andAddwtLessThan(Double value) {
addCriterion("ADDWT <", value, "addwt");
return (Criteria) this;
}
public Criteria andAddwtLessThanOrEqualTo(Double value) {
addCriterion("ADDWT <=", value, "addwt");
return (Criteria) this;
}
public Criteria andAddwtIn(List<Double> values) {
addCriterion("ADDWT in", values, "addwt");
return (Criteria) this;
}
public Criteria andAddwtNotIn(List<Double> values) {
addCriterion("ADDWT not in", values, "addwt");
return (Criteria) this;
}
public Criteria andAddwtBetween(Double value1, Double value2) {
addCriterion("ADDWT between", value1, value2, "addwt");
return (Criteria) this;
}
public Criteria andAddwtNotBetween(Double value1, Double value2) {
addCriterion("ADDWT not between", value1, value2, "addwt");
return (Criteria) this;
}
public Criteria andFirstmoneyIsNull() {
addCriterion("FIRSTMONEY is null");
return (Criteria) this;
}
public Criteria andFirstmoneyIsNotNull() {
addCriterion("FIRSTMONEY is not null");
return (Criteria) this;
}
public Criteria andFirstmoneyEqualTo(Double value) {
addCriterion("FIRSTMONEY =", value, "firstmoney");
return (Criteria) this;
}
public Criteria andFirstmoneyNotEqualTo(Double value) {
addCriterion("FIRSTMONEY <>", value, "firstmoney");
return (Criteria) this;
}
public Criteria andFirstmoneyGreaterThan(Double value) {
addCriterion("FIRSTMONEY >", value, "firstmoney");
return (Criteria) this;
}
public Criteria andFirstmoneyGreaterThanOrEqualTo(Double value) {
addCriterion("FIRSTMONEY >=", value, "firstmoney");
return (Criteria) this;
}
public Criteria andFirstmoneyLessThan(Double value) {
addCriterion("FIRSTMONEY <", value, "firstmoney");
return (Criteria) this;
}
public Criteria andFirstmoneyLessThanOrEqualTo(Double value) {
addCriterion("FIRSTMONEY <=", value, "firstmoney");
return (Criteria) this;
}
public Criteria andFirstmoneyIn(List<Double> values) {
addCriterion("FIRSTMONEY in", values, "firstmoney");
return (Criteria) this;
}
public Criteria andFirstmoneyNotIn(List<Double> values) {
addCriterion("FIRSTMONEY not in", values, "firstmoney");
return (Criteria) this;
}
public Criteria andFirstmoneyBetween(Double value1, Double value2) {
addCriterion("FIRSTMONEY between", value1, value2, "firstmoney");
return (Criteria) this;
}
public Criteria andFirstmoneyNotBetween(Double value1, Double value2) {
addCriterion("FIRSTMONEY not between", value1, value2, "firstmoney");
return (Criteria) this;
}
public Criteria andAddwtmoneyIsNull() {
addCriterion("ADDWTMONEY is null");
return (Criteria) this;
}
public Criteria andAddwtmoneyIsNotNull() {
addCriterion("ADDWTMONEY is not null");
return (Criteria) this;
}
public Criteria andAddwtmoneyEqualTo(Double value) {
addCriterion("ADDWTMONEY =", value, "addwtmoney");
return (Criteria) this;
}
public Criteria andAddwtmoneyNotEqualTo(Double value) {
addCriterion("ADDWTMONEY <>", value, "addwtmoney");
return (Criteria) this;
}
public Criteria andAddwtmoneyGreaterThan(Double value) {
addCriterion("ADDWTMONEY >", value, "addwtmoney");
return (Criteria) this;
}
public Criteria andAddwtmoneyGreaterThanOrEqualTo(Double value) {
addCriterion("ADDWTMONEY >=", value, "addwtmoney");
return (Criteria) this;
}
public Criteria andAddwtmoneyLessThan(Double value) {
addCriterion("ADDWTMONEY <", value, "addwtmoney");
return (Criteria) this;
}
public Criteria andAddwtmoneyLessThanOrEqualTo(Double value) {
addCriterion("ADDWTMONEY <=", value, "addwtmoney");
return (Criteria) this;
}
public Criteria andAddwtmoneyIn(List<Double> values) {
addCriterion("ADDWTMONEY in", values, "addwtmoney");
return (Criteria) this;
}
public Criteria andAddwtmoneyNotIn(List<Double> values) {
addCriterion("ADDWTMONEY not in", values, "addwtmoney");
return (Criteria) this;
}
public Criteria andAddwtmoneyBetween(Double value1, Double value2) {
addCriterion("ADDWTMONEY between", value1, value2, "addwtmoney");
return (Criteria) this;
}
public Criteria andAddwtmoneyNotBetween(Double value1, Double value2) {
addCriterion("ADDWTMONEY not between", value1, value2, "addwtmoney");
return (Criteria) this;
}
public Criteria andBjflIsNull() {
addCriterion("BJFL is null");
return (Criteria) this;
}
public Criteria andBjflIsNotNull() {
addCriterion("BJFL is not null");
return (Criteria) this;
}
public Criteria andBjflEqualTo(Double value) {
addCriterion("BJFL =", value, "bjfl");
return (Criteria) this;
}
public Criteria andBjflNotEqualTo(Double value) {
addCriterion("BJFL <>", value, "bjfl");
return (Criteria) this;
}
public Criteria andBjflGreaterThan(Double value) {
addCriterion("BJFL >", value, "bjfl");
return (Criteria) this;
}
public Criteria andBjflGreaterThanOrEqualTo(Double value) {
addCriterion("BJFL >=", value, "bjfl");
return (Criteria) this;
}
public Criteria andBjflLessThan(Double value) {
addCriterion("BJFL <", value, "bjfl");
return (Criteria) this;
}
public Criteria andBjflLessThanOrEqualTo(Double value) {
addCriterion("BJFL <=", value, "bjfl");
return (Criteria) this;
}
public Criteria andBjflIn(List<Double> values) {
addCriterion("BJFL in", values, "bjfl");
return (Criteria) this;
}
public Criteria andBjflNotIn(List<Double> values) {
addCriterion("BJFL not in", values, "bjfl");
return (Criteria) this;
}
public Criteria andBjflBetween(Double value1, Double value2) {
addCriterion("BJFL between", value1, value2, "bjfl");
return (Criteria) this;
}
public Criteria andBjflNotBetween(Double value1, Double value2) {
addCriterion("BJFL not between", value1, value2, "bjfl");
return (Criteria) this;
}
public Criteria andLowestIsNull() {
addCriterion("LOWEST is null");
return (Criteria) this;
}
public Criteria andLowestIsNotNull() {
addCriterion("LOWEST is not null");
return (Criteria) this;
}
public Criteria andLowestEqualTo(Double value) {
addCriterion("LOWEST =", value, "lowest");
return (Criteria) this;
}
public Criteria andLowestNotEqualTo(Double value) {
addCriterion("LOWEST <>", value, "lowest");
return (Criteria) this;
}
public Criteria andLowestGreaterThan(Double value) {
addCriterion("LOWEST >", value, "lowest");
return (Criteria) this;
}
public Criteria andLowestGreaterThanOrEqualTo(Double value) {
addCriterion("LOWEST >=", value, "lowest");
return (Criteria) this;
}
public Criteria andLowestLessThan(Double value) {
addCriterion("LOWEST <", value, "lowest");
return (Criteria) this;
}
public Criteria andLowestLessThanOrEqualTo(Double value) {
addCriterion("LOWEST <=", value, "lowest");
return (Criteria) this;
}
public Criteria andLowestIn(List<Double> values) {
addCriterion("LOWEST in", values, "lowest");
return (Criteria) this;
}
public Criteria andLowestNotIn(List<Double> values) {
addCriterion("LOWEST not in", values, "lowest");
return (Criteria) this;
}
public Criteria andLowestBetween(Double value1, Double value2) {
addCriterion("LOWEST between", value1, value2, "lowest");
return (Criteria) this;
}
public Criteria andLowestNotBetween(Double value1, Double value2) {
addCriterion("LOWEST not between", value1, value2, "lowest");
return (Criteria) this;
}
public Criteria andValuationIsNull() {
addCriterion("VALUATION is null");
return (Criteria) this;
}
public Criteria andValuationIsNotNull() {
addCriterion("VALUATION is not null");
return (Criteria) this;
}
public Criteria andValuationEqualTo(String value) {
addCriterion("VALUATION =", value, "valuation");
return (Criteria) this;
}
public Criteria andValuationNotEqualTo(String value) {
addCriterion("VALUATION <>", value, "valuation");
return (Criteria) this;
}
public Criteria andValuationGreaterThan(String value) {
addCriterion("VALUATION >", value, "valuation");
return (Criteria) this;
}
public Criteria andValuationGreaterThanOrEqualTo(String value) {
addCriterion("VALUATION >=", value, "valuation");
return (Criteria) this;
}
public Criteria andValuationLessThan(String value) {
addCriterion("VALUATION <", value, "valuation");
return (Criteria) this;
}
public Criteria andValuationLessThanOrEqualTo(String value) {
addCriterion("VALUATION <=", value, "valuation");
return (Criteria) this;
}
public Criteria andValuationLike(String value) {
addCriterion("VALUATION like", value, "valuation");
return (Criteria) this;
}
public Criteria andValuationNotLike(String value) {
addCriterion("VALUATION not like", value, "valuation");
return (Criteria) this;
}
public Criteria andValuationIn(List<String> values) {
addCriterion("VALUATION in", values, "valuation");
return (Criteria) this;
}
public Criteria andValuationNotIn(List<String> values) {
addCriterion("VALUATION not in", values, "valuation");
return (Criteria) this;
}
public Criteria andValuationBetween(String value1, String value2) {
addCriterion("VALUATION between", value1, value2, "valuation");
return (Criteria) this;
}
public Criteria andValuationNotBetween(String value1, String value2) {
addCriterion("VALUATION not between", value1, value2, "valuation");
return (Criteria) this;
}
public Criteria andPaytypeIsNull() {
addCriterion("PAYTYPE is null");
return (Criteria) this;
}
public Criteria andPaytypeIsNotNull() {
addCriterion("PAYTYPE is not null");
return (Criteria) this;
}
public Criteria andPaytypeEqualTo(String value) {
addCriterion("PAYTYPE =", value, "paytype");
return (Criteria) this;
}
public Criteria andPaytypeNotEqualTo(String value) {
addCriterion("PAYTYPE <>", value, "paytype");
return (Criteria) this;
}
public Criteria andPaytypeGreaterThan(String value) {
addCriterion("PAYTYPE >", value, "paytype");
return (Criteria) this;
}
public Criteria andPaytypeGreaterThanOrEqualTo(String value) {
addCriterion("PAYTYPE >=", value, "paytype");
return (Criteria) this;
}
public Criteria andPaytypeLessThan(String value) {
addCriterion("PAYTYPE <", value, "paytype");
return (Criteria) this;
}
public Criteria andPaytypeLessThanOrEqualTo(String value) {
addCriterion("PAYTYPE <=", value, "paytype");
return (Criteria) this;
}
public Criteria andPaytypeLike(String value) {
addCriterion("PAYTYPE like", value, "paytype");
return (Criteria) this;
}
public Criteria andPaytypeNotLike(String value) {
addCriterion("PAYTYPE not like", value, "paytype");
return (Criteria) this;
}
public Criteria andPaytypeIn(List<String> values) {
addCriterion("PAYTYPE in", values, "paytype");
return (Criteria) this;
}
public Criteria andPaytypeNotIn(List<String> values) {
addCriterion("PAYTYPE not in", values, "paytype");
return (Criteria) this;
}
public Criteria andPaytypeBetween(String value1, String value2) {
addCriterion("PAYTYPE between", value1, value2, "paytype");
return (Criteria) this;
}
public Criteria andPaytypeNotBetween(String value1, String value2) {
addCriterion("PAYTYPE not between", value1, value2, "paytype");
return (Criteria) this;
}
public Criteria andValuetypeIsNull() {
addCriterion("VALUETYPE is null");
return (Criteria) this;
}
public Criteria andValuetypeIsNotNull() {
addCriterion("VALUETYPE is not null");
return (Criteria) this;
}
public Criteria andValuetypeEqualTo(String value) {
addCriterion("VALUETYPE =", value, "valuetype");
return (Criteria) this;
}
public Criteria andValuetypeNotEqualTo(String value) {
addCriterion("VALUETYPE <>", value, "valuetype");
return (Criteria) this;
}
public Criteria andValuetypeGreaterThan(String value) {
addCriterion("VALUETYPE >", value, "valuetype");
return (Criteria) this;
}
public Criteria andValuetypeGreaterThanOrEqualTo(String value) {
addCriterion("VALUETYPE >=", value, "valuetype");
return (Criteria) this;
}
public Criteria andValuetypeLessThan(String value) {
addCriterion("VALUETYPE <", value, "valuetype");
return (Criteria) this;
}
public Criteria andValuetypeLessThanOrEqualTo(String value) {
addCriterion("VALUETYPE <=", value, "valuetype");
return (Criteria) this;
}
public Criteria andValuetypeLike(String value) {
addCriterion("VALUETYPE like", value, "valuetype");
return (Criteria) this;
}
public Criteria andValuetypeNotLike(String value) {
addCriterion("VALUETYPE not like", value, "valuetype");
return (Criteria) this;
}
public Criteria andValuetypeIn(List<String> values) {
addCriterion("VALUETYPE in", values, "valuetype");
return (Criteria) this;
}
public Criteria andValuetypeNotIn(List<String> values) {
addCriterion("VALUETYPE not in", values, "valuetype");
return (Criteria) this;
}
public Criteria andValuetypeBetween(String value1, String value2) {
addCriterion("VALUETYPE between", value1, value2, "valuetype");
return (Criteria) this;
}
public Criteria andValuetypeNotBetween(String value1, String value2) {
addCriterion("VALUETYPE not between", value1, value2, "valuetype");
return (Criteria) this;
}
public Criteria andStatsIsNull() {
addCriterion("STATS is null");
return (Criteria) this;
}
public Criteria andStatsIsNotNull() {
addCriterion("STATS is not null");
return (Criteria) this;
}
public Criteria andStatsEqualTo(String value) {
addCriterion("STATS =", value, "stats");
return (Criteria) this;
}
public Criteria andStatsNotEqualTo(String value) {
addCriterion("STATS <>", value, "stats");
return (Criteria) this;
}
public Criteria andStatsGreaterThan(String value) {
addCriterion("STATS >", value, "stats");
return (Criteria) this;
}
public Criteria andStatsGreaterThanOrEqualTo(String value) {
addCriterion("STATS >=", value, "stats");
return (Criteria) this;
}
public Criteria andStatsLessThan(String value) {
addCriterion("STATS <", value, "stats");
return (Criteria) this;
}
public Criteria andStatsLessThanOrEqualTo(String value) {
addCriterion("STATS <=", value, "stats");
return (Criteria) this;
}
public Criteria andStatsLike(String value) {
addCriterion("STATS like", value, "stats");
return (Criteria) this;
}
public Criteria andStatsNotLike(String value) {
addCriterion("STATS not like", value, "stats");
return (Criteria) this;
}
public Criteria andStatsIn(List<String> values) {
addCriterion("STATS in", values, "stats");
return (Criteria) this;
}
public Criteria andStatsNotIn(List<String> values) {
addCriterion("STATS not in", values, "stats");
return (Criteria) this;
}
public Criteria andStatsBetween(String value1, String value2) {
addCriterion("STATS between", value1, value2, "stats");
return (Criteria) this;
}
public Criteria andStatsNotBetween(String value1, String value2) {
addCriterion("STATS not between", value1, value2, "stats");
return (Criteria) this;
}
public Criteria andDetailedIsNull() {
addCriterion("DETAILED is null");
return (Criteria) this;
}
public Criteria andDetailedIsNotNull() {
addCriterion("DETAILED is not null");
return (Criteria) this;
}
public Criteria andDetailedEqualTo(String value) {
addCriterion("DETAILED =", value, "detailed");
return (Criteria) this;
}
public Criteria andDetailedNotEqualTo(String value) {
addCriterion("DETAILED <>", value, "detailed");
return (Criteria) this;
}
public Criteria andDetailedGreaterThan(String value) {
addCriterion("DETAILED >", value, "detailed");
return (Criteria) this;
}
public Criteria andDetailedGreaterThanOrEqualTo(String value) {
addCriterion("DETAILED >=", value, "detailed");
return (Criteria) this;
}
public Criteria andDetailedLessThan(String value) {
addCriterion("DETAILED <", value, "detailed");
return (Criteria) this;
}
public Criteria andDetailedLessThanOrEqualTo(String value) {
addCriterion("DETAILED <=", value, "detailed");
return (Criteria) this;
}
public Criteria andDetailedLike(String value) {
addCriterion("DETAILED like", value, "detailed");
return (Criteria) this;
}
public Criteria andDetailedNotLike(String value) {
addCriterion("DETAILED not like", value, "detailed");
return (Criteria) this;
}
public Criteria andDetailedIn(List<String> values) {
addCriterion("DETAILED in", values, "detailed");
return (Criteria) this;
}
public Criteria andDetailedNotIn(List<String> values) {
addCriterion("DETAILED not in", values, "detailed");
return (Criteria) this;
}
public Criteria andDetailedBetween(String value1, String value2) {
addCriterion("DETAILED between", value1, value2, "detailed");
return (Criteria) this;
}
public Criteria andDetailedNotBetween(String value1, String value2) {
addCriterion("DETAILED not between", value1, value2, "detailed");
return (Criteria) this;
}
public Criteria andCountIsNull() {
addCriterion("COUNT is null");
return (Criteria) this;
}
public Criteria andCountIsNotNull() {
addCriterion("COUNT is not null");
return (Criteria) this;
}
public Criteria andCountEqualTo(Integer value) {
addCriterion("COUNT =", value, "count");
return (Criteria) this;
}
public Criteria andCountNotEqualTo(Integer value) {
addCriterion("COUNT <>", value, "count");
return (Criteria) this;
}
public Criteria andCountGreaterThan(Integer value) {
addCriterion("COUNT >", value, "count");
return (Criteria) this;
}
public Criteria andCountGreaterThanOrEqualTo(Integer value) {
addCriterion("COUNT >=", value, "count");
return (Criteria) this;
}
public Criteria andCountLessThan(Integer value) {
addCriterion("COUNT <", value, "count");
return (Criteria) this;
}
public Criteria andCountLessThanOrEqualTo(Integer value) {
addCriterion("COUNT <=", value, "count");
return (Criteria) this;
}
public Criteria andCountIn(List<Integer> values) {
addCriterion("COUNT in", values, "count");
return (Criteria) this;
}
public Criteria andCountNotIn(List<Integer> values) {
addCriterion("COUNT not in", values, "count");
return (Criteria) this;
}
public Criteria andCountBetween(Integer value1, Integer value2) {
addCriterion("COUNT between", value1, value2, "count");
return (Criteria) this;
}
public Criteria andCountNotBetween(Integer value1, Integer value2) {
addCriterion("COUNT not between", value1, value2, "count");
return (Criteria) this;
}
public Criteria andWlcompanyIdIsNull() {
addCriterion("WLCOMPANY_ID is null");
return (Criteria) this;
}
public Criteria andWlcompanyIdIsNotNull() {
addCriterion("WLCOMPANY_ID is not null");
return (Criteria) this;
}
public Criteria andWlcompanyIdEqualTo(Integer value) {
addCriterion("WLCOMPANY_ID =", value, "wlcompanyId");
return (Criteria) this;
}
public Criteria andWlcompanyIdNotEqualTo(Integer value) {
addCriterion("WLCOMPANY_ID <>", value, "wlcompanyId");
return (Criteria) this;
}
public Criteria andWlcompanyIdGreaterThan(Integer value) {
addCriterion("WLCOMPANY_ID >", value, "wlcompanyId");
return (Criteria) this;
}
public Criteria andWlcompanyIdGreaterThanOrEqualTo(Integer value) {
addCriterion("WLCOMPANY_ID >=", value, "wlcompanyId");
return (Criteria) this;
}
public Criteria andWlcompanyIdLessThan(Integer value) {
addCriterion("WLCOMPANY_ID <", value, "wlcompanyId");
return (Criteria) this;
}
public Criteria andWlcompanyIdLessThanOrEqualTo(Integer value) {
addCriterion("WLCOMPANY_ID <=", value, "wlcompanyId");
return (Criteria) this;
}
public Criteria andWlcompanyIdIn(List<Integer> values) {
addCriterion("WLCOMPANY_ID in", values, "wlcompanyId");
return (Criteria) this;
}
public Criteria andWlcompanyIdNotIn(List<Integer> values) {
addCriterion("WLCOMPANY_ID not in", values, "wlcompanyId");
return (Criteria) this;
}
public Criteria andWlcompanyIdBetween(Integer value1, Integer value2) {
addCriterion("WLCOMPANY_ID between", value1, value2, "wlcompanyId");
return (Criteria) this;
}
public Criteria andWlcompanyIdNotBetween(Integer value1, Integer value2) {
addCriterion("WLCOMPANY_ID not between", value1, value2, "wlcompanyId");
return (Criteria) this;
}
public Criteria andMrfrIsNull() {
addCriterion("MRFR is null");
return (Criteria) this;
}
public Criteria andMrfrIsNotNull() {
addCriterion("MRFR is not null");
return (Criteria) this;
}
public Criteria andMrfrEqualTo(String value) {
addCriterion("MRFR =", value, "mrfr");
return (Criteria) this;
}
public Criteria andMrfrNotEqualTo(String value) {
addCriterion("MRFR <>", value, "mrfr");
return (Criteria) this;
}
public Criteria andMrfrGreaterThan(String value) {
addCriterion("MRFR >", value, "mrfr");
return (Criteria) this;
}
public Criteria andMrfrGreaterThanOrEqualTo(String value) {
addCriterion("MRFR >=", value, "mrfr");
return (Criteria) this;
}
public Criteria andMrfrLessThan(String value) {
addCriterion("MRFR <", value, "mrfr");
return (Criteria) this;
}
public Criteria andMrfrLessThanOrEqualTo(String value) {
addCriterion("MRFR <=", value, "mrfr");
return (Criteria) this;
}
public Criteria andMrfrLike(String value) {
addCriterion("MRFR like", value, "mrfr");
return (Criteria) this;
}
public Criteria andMrfrNotLike(String value) {
addCriterion("MRFR not like", value, "mrfr");
return (Criteria) this;
}
public Criteria andMrfrIn(List<String> values) {
addCriterion("MRFR in", values, "mrfr");
return (Criteria) this;
}
public Criteria andMrfrNotIn(List<String> values) {
addCriterion("MRFR not in", values, "mrfr");
return (Criteria) this;
}
public Criteria andMrfrBetween(String value1, String value2) {
addCriterion("MRFR between", value1, value2, "mrfr");
return (Criteria) this;
}
public Criteria andMrfrNotBetween(String value1, String value2) {
addCriterion("MRFR not between", value1, value2, "mrfr");
return (Criteria) this;
}
public Criteria andMrscfrIsNull() {
addCriterion("MRSCFR is null");
return (Criteria) this;
}
public Criteria andMrscfrIsNotNull() {
addCriterion("MRSCFR is not null");
return (Criteria) this;
}
public Criteria andMrscfrEqualTo(Double value) {
addCriterion("MRSCFR =", value, "mrscfr");
return (Criteria) this;
}
public Criteria andMrscfrNotEqualTo(Double value) {
addCriterion("MRSCFR <>", value, "mrscfr");
return (Criteria) this;
}
public Criteria andMrscfrGreaterThan(Double value) {
addCriterion("MRSCFR >", value, "mrscfr");
return (Criteria) this;
}
public Criteria andMrscfrGreaterThanOrEqualTo(Double value) {
addCriterion("MRSCFR >=", value, "mrscfr");
return (Criteria) this;
}
public Criteria andMrscfrLessThan(Double value) {
addCriterion("MRSCFR <", value, "mrscfr");
return (Criteria) this;
}
public Criteria andMrscfrLessThanOrEqualTo(Double value) {
addCriterion("MRSCFR <=", value, "mrscfr");
return (Criteria) this;
}
public Criteria andMrscfrIn(List<Double> values) {
addCriterion("MRSCFR in", values, "mrscfr");
return (Criteria) this;
}
public Criteria andMrscfrNotIn(List<Double> values) {
addCriterion("MRSCFR not in", values, "mrscfr");
return (Criteria) this;
}
public Criteria andMrscfrBetween(Double value1, Double value2) {
addCriterion("MRSCFR between", value1, value2, "mrscfr");
return (Criteria) this;
}
public Criteria andMrscfrNotBetween(Double value1, Double value2) {
addCriterion("MRSCFR not between", value1, value2, "mrscfr");
return (Criteria) this;
}
public Criteria andMrxzfrIsNull() {
addCriterion("MRXZFR is null");
return (Criteria) this;
}
public Criteria andMrxzfrIsNotNull() {
addCriterion("MRXZFR is not null");
return (Criteria) this;
}
public Criteria andMrxzfrEqualTo(Double value) {
addCriterion("MRXZFR =", value, "mrxzfr");
return (Criteria) this;
}
public Criteria andMrxzfrNotEqualTo(Double value) {
addCriterion("MRXZFR <>", value, "mrxzfr");
return (Criteria) this;
}
public Criteria andMrxzfrGreaterThan(Double value) {
addCriterion("MRXZFR >", value, "mrxzfr");
return (Criteria) this;
}
public Criteria andMrxzfrGreaterThanOrEqualTo(Double value) {
addCriterion("MRXZFR >=", value, "mrxzfr");
return (Criteria) this;
}
public Criteria andMrxzfrLessThan(Double value) {
addCriterion("MRXZFR <", value, "mrxzfr");
return (Criteria) this;
}
public Criteria andMrxzfrLessThanOrEqualTo(Double value) {
addCriterion("MRXZFR <=", value, "mrxzfr");
return (Criteria) this;
}
public Criteria andMrxzfrIn(List<Double> values) {
addCriterion("MRXZFR in", values, "mrxzfr");
return (Criteria) this;
}
public Criteria andMrxzfrNotIn(List<Double> values) {
addCriterion("MRXZFR not in", values, "mrxzfr");
return (Criteria) this;
}
public Criteria andMrxzfrBetween(Double value1, Double value2) {
addCriterion("MRXZFR between", value1, value2, "mrxzfr");
return (Criteria) this;
}
public Criteria andMrxzfrNotBetween(Double value1, Double value2) {
addCriterion("MRXZFR not between", value1, value2, "mrxzfr");
return (Criteria) this;
}
public Criteria andStatIsNull() {
addCriterion("STAT is null");
return (Criteria) this;
}
public Criteria andStatIsNotNull() {
addCriterion("STAT is not null");
return (Criteria) this;
}
public Criteria andStatEqualTo(String value) {
addCriterion("STAT =", value, "stat");
return (Criteria) this;
}
public Criteria andStatNotEqualTo(String value) {
addCriterion("STAT <>", value, "stat");
return (Criteria) this;
}
public Criteria andStatGreaterThan(String value) {
addCriterion("STAT >", value, "stat");
return (Criteria) this;
}
public Criteria andStatGreaterThanOrEqualTo(String value) {
addCriterion("STAT >=", value, "stat");
return (Criteria) this;
}
public Criteria andStatLessThan(String value) {
addCriterion("STAT <", value, "stat");
return (Criteria) this;
}
public Criteria andStatLessThanOrEqualTo(String value) {
addCriterion("STAT <=", value, "stat");
return (Criteria) this;
}
public Criteria andStatLike(String value) {
addCriterion("STAT like", value, "stat");
return (Criteria) this;
}
public Criteria andStatNotLike(String value) {
addCriterion("STAT not like", value, "stat");
return (Criteria) this;
}
public Criteria andStatIn(List<String> values) {
addCriterion("STAT in", values, "stat");
return (Criteria) this;
}
public Criteria andStatNotIn(List<String> values) {
addCriterion("STAT not in", values, "stat");
return (Criteria) this;
}
public Criteria andStatBetween(String value1, String value2) {
addCriterion("STAT between", value1, value2, "stat");
return (Criteria) this;
}
public Criteria andStatNotBetween(String value1, String value2) {
addCriterion("STAT not between", value1, value2, "stat");
return (Criteria) this;
}
public Criteria andMarchantsIdIsNull() {
addCriterion("MARCHANTS_ID is null");
return (Criteria) this;
}
public Criteria andMarchantsIdIsNotNull() {
addCriterion("MARCHANTS_ID is not null");
return (Criteria) this;
}
public Criteria andMarchantsIdEqualTo(Integer value) {
addCriterion("MARCHANTS_ID =", value, "marchantsId");
return (Criteria) this;
}
public Criteria andMarchantsIdNotEqualTo(Integer value) {
addCriterion("MARCHANTS_ID <>", value, "marchantsId");
return (Criteria) this;
}
public Criteria andMarchantsIdGreaterThan(Integer value) {
addCriterion("MARCHANTS_ID >", value, "marchantsId");
return (Criteria) this;
}
public Criteria andMarchantsIdGreaterThanOrEqualTo(Integer value) {
addCriterion("MARCHANTS_ID >=", value, "marchantsId");
return (Criteria) this;
}
public Criteria andMarchantsIdLessThan(Integer value) {
addCriterion("MARCHANTS_ID <", value, "marchantsId");
return (Criteria) this;
}
public Criteria andMarchantsIdLessThanOrEqualTo(Integer value) {
addCriterion("MARCHANTS_ID <=", value, "marchantsId");
return (Criteria) this;
}
public Criteria andMarchantsIdIn(List<Integer> values) {
addCriterion("MARCHANTS_ID in", values, "marchantsId");
return (Criteria) this;
}
public Criteria andMarchantsIdNotIn(List<Integer> values) {
addCriterion("MARCHANTS_ID not in", values, "marchantsId");
return (Criteria) this;
}
public Criteria andMarchantsIdBetween(Integer value1, Integer value2) {
addCriterion("MARCHANTS_ID between", value1, value2, "marchantsId");
return (Criteria) this;
}
public Criteria andMarchantsIdNotBetween(Integer value1, Integer value2) {
addCriterion("MARCHANTS_ID not between", value1, value2, "marchantsId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"leo.cai@9c87f486-7f2d-4350-b948-b2028470fdc6"
]
| leo.cai@9c87f486-7f2d-4350-b948-b2028470fdc6 |
403769e9f73cd9b7f0a9b70f2aaed128685cbc0d | 4d6f449339b36b8d4c25d8772212bf6cd339f087 | /netreflected/src/Framework/System.IdentityModel,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089/system/identitymodel/tokens/EncryptedKeyEncryptingCredentials.java | 3af7c6aedf0e6d3d28296ef4b47b34c86bb4b1c1 | [
"MIT"
]
| permissive | lvyitian/JCOReflector | 299a64550394db3e663567efc6e1996754f6946e | 7e420dca504090b817c2fe208e4649804df1c3e1 | refs/heads/master | 2022-12-07T21:13:06.208025 | 2020-08-28T09:49:29 | 2020-08-28T09:49:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,557 | java | /*
* MIT License
*
* Copyright (c) 2020 MASES s.r.l.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/**************************************************************************************
* <auto-generated>
* This code was generated from a template using JCOReflector
*
* Manual changes to this file may cause unexpected behavior in your application.
* Manual changes to this file will be overwritten if the code is regenerated.
* </auto-generated>
*************************************************************************************/
package system.identitymodel.tokens;
import org.mases.jcobridge.*;
import org.mases.jcobridge.netreflection.*;
import java.util.ArrayList;
// Import section
import system.identitymodel.tokens.EncryptingCredentials;
import system.security.cryptography.x509certificates.X509Certificate2;
/**
* The base .NET class managing System.IdentityModel.Tokens.EncryptedKeyEncryptingCredentials, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. Extends {@link NetObject}.
* <p>
*
* See: <a href="https://docs.microsoft.com/en-us/dotnet/api/System.IdentityModel.Tokens.EncryptedKeyEncryptingCredentials" target="_top">https://docs.microsoft.com/en-us/dotnet/api/System.IdentityModel.Tokens.EncryptedKeyEncryptingCredentials</a>
*/
public class EncryptedKeyEncryptingCredentials extends EncryptingCredentials {
/**
* Fully assembly qualified name: System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
*/
public static final String assemblyFullName = "System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
/**
* Assembly name: System.IdentityModel
*/
public static final String assemblyShortName = "System.IdentityModel";
/**
* Qualified class name: System.IdentityModel.Tokens.EncryptedKeyEncryptingCredentials
*/
public static final String className = "System.IdentityModel.Tokens.EncryptedKeyEncryptingCredentials";
static JCOBridge bridge = JCOBridgeInstance.getInstance(assemblyFullName);
/**
* The type managed from JCOBridge. See {@link JCType}
*/
public static JCType classType = createType();
static JCEnum enumInstance = null;
JCObject classInstance = null;
static JCType createType() {
try {
return bridge.GetType(className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName));
} catch (JCException e) {
return null;
}
}
void addReference(String ref) throws Throwable {
try {
bridge.AddReference(ref);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public EncryptedKeyEncryptingCredentials(Object instance) throws Throwable {
super(instance);
if (instance instanceof JCObject) {
classInstance = (JCObject) instance;
} else
throw new Exception("Cannot manage object, it is not a JCObject");
}
public String getJCOAssemblyName() {
return assemblyFullName;
}
public String getJCOClassName() {
return className;
}
public String getJCOObjectName() {
return className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
}
public Object getJCOInstance() {
return classInstance;
}
public void setJCOInstance(JCObject instance) {
classInstance = instance;
super.setJCOInstance(classInstance);
}
public JCType getJCOType() {
return classType;
}
/**
* Try to cast the {@link IJCOBridgeReflected} instance into {@link EncryptedKeyEncryptingCredentials}, a cast assert is made to check if types are compatible.
*/
public static EncryptedKeyEncryptingCredentials cast(IJCOBridgeReflected from) throws Throwable {
NetType.AssertCast(classType, from);
return new EncryptedKeyEncryptingCredentials(from.getJCOInstance());
}
// Constructors section
public EncryptedKeyEncryptingCredentials() throws Throwable {
}
public EncryptedKeyEncryptingCredentials(EncryptingCredentials wrappingCredentials, int keySizeInBits, java.lang.String encryptionAlgorithm) throws Throwable, system.ArgumentException, system.IndexOutOfRangeException, system.ArgumentNullException, system.FormatException, system.resources.MissingManifestResourceException, system.NotImplementedException, system.ObjectDisposedException, system.InvalidOperationException, system.ArgumentOutOfRangeException, system.OverflowException, system.OutOfMemoryException, system.security.cryptography.CryptographicException {
try {
// add reference to assemblyName.dll file
addReference(JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
setJCOInstance((JCObject)classType.NewObject(wrappingCredentials == null ? null : wrappingCredentials.getJCOInstance(), keySizeInBits, encryptionAlgorithm));
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public EncryptedKeyEncryptingCredentials(X509Certificate2 certificate) throws Throwable, system.IndexOutOfRangeException, system.ArgumentOutOfRangeException, system.ArgumentException, system.ArgumentNullException, system.resources.MissingManifestResourceException, system.InvalidOperationException, system.NotImplementedException, system.security.cryptography.CryptographicException {
try {
// add reference to assemblyName.dll file
addReference(JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
setJCOInstance((JCObject)classType.NewObject(certificate == null ? null : certificate.getJCOInstance()));
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
public EncryptedKeyEncryptingCredentials(X509Certificate2 certificate, java.lang.String keyWrappingAlgorithm, int keySizeInBits, java.lang.String encryptionAlgorithm) throws Throwable, system.IndexOutOfRangeException, system.ArgumentOutOfRangeException, system.ArgumentException, system.ArgumentNullException, system.resources.MissingManifestResourceException, system.InvalidOperationException, system.NotImplementedException, system.security.cryptography.CryptographicException {
try {
// add reference to assemblyName.dll file
addReference(JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName);
setJCOInstance((JCObject)classType.NewObject(certificate == null ? null : certificate.getJCOInstance(), keyWrappingAlgorithm, keySizeInBits, encryptionAlgorithm));
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
// Methods section
// Properties section
public EncryptingCredentials getWrappingCredentials() throws Throwable {
if (classInstance == null)
throw new UnsupportedOperationException("classInstance is null.");
try {
JCObject val = (JCObject)classInstance.Get("WrappingCredentials");
return new EncryptingCredentials(val);
} catch (JCNativeException jcne) {
throw translateException(jcne);
}
}
// Instance Events section
} | [
"[email protected]"
]
| |
9cadf3a3b84b988fb842ddbacec72ed1e0c2226a | 4f1d817d4e62fd45027caa92d58cc0f0c535ef48 | /src/com/megateam/oscidroid/usbData.java | 8bc702a46ca490d347fb3e25177be6cc4caa1cc8 | []
| no_license | rexnanet/oscidroid | 8bba52dc7eca137c81e9cf0db764267d1c517708 | 48570b9c7a86e104a736d132776e7ae0ebf90ee9 | refs/heads/master | 2021-01-18T10:48:24.272026 | 2015-10-06T23:06:11 | 2015-10-06T23:06:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 806 | java | package com.megateam.oscidroid;
public class usbData implements sourceIface{
private int numPointsPerChannel;
public usbData(int numPointsPerChannel) {
this.numPointsPerChannel=numPointsPerChannel;
}
@Override
public byte[] getSamples(int channel) {
// TODO Auto-generated method stub
return null;
}
@Override
public float[] getMeasures(int channel) {
// TODO Auto-generated method stub
return null;
}
@Override
public int setTriger(int channel, int type) {
// TODO Auto-generated method stub
return 0;
}
@Override
public void setAttenuation(int channel, int attenuation) {
// TODO Auto-generated method stub
}
@Override
public void setOffset(int channel, int offset) {
// TODO Auto-generated method stub
}
}
| [
"[email protected]"
]
| |
3a564208fb1a75a23b74f15dfeda10e1df672055 | 95f0326aa373b1ee4a29fe4d22740bee9e47b2ea | /app/src/main/java/com/xsd/jx/adapter/JobSearchAdapter.java | 8b59d10e4b0271dc5c5281e80e1e7853cc76aac2 | []
| no_license | soon14/Worker | a3f212def1fae650eec46a3db3fd31aaa571b3b0 | 86b376a5c51b792938e3fe1e7dce991547c0cf9e | refs/heads/master | 2023-01-04T04:14:07.137744 | 2020-11-05T01:48:16 | 2020-11-05T01:48:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 809 | java | package com.xsd.jx.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder;
import com.xsd.jx.R;
import com.xsd.jx.bean.JobSearchBean;
import com.xsd.jx.databinding.ItemJobSearchBinding;
import org.jetbrains.annotations.NotNull;
/**
* Date: 2020/8/18
* author: SmallCake
*/
public class JobSearchAdapter extends BaseQuickAdapter<JobSearchBean, BaseDataBindingHolder<ItemJobSearchBinding>> {
public JobSearchAdapter() {
super(R.layout.item_job_search);
}
@Override
protected void convert(@NotNull BaseDataBindingHolder<ItemJobSearchBinding> holder, JobSearchBean searchJobBean) {
ItemJobSearchBinding dataBinding = holder.getDataBinding();
dataBinding.setItem(searchJobBean);
}
}
| [
"[email protected]"
]
| |
8530dac2ffd495ea03d10f3143d3506ad43d0a5a | 32580df67955c6e9c98946936ae95c8e6dfabdc7 | /src/article/service/DeleteRequest.java | d050dbb39b36ee480843a0cdfec8283a2a85484f | []
| no_license | yongk402/board20200727 | 9e28f1f5d99f50a691f29e04f8f30a982f73af97 | 015bfd22c7f0610f18b66a16ea0515c1157373c5 | refs/heads/master | 2022-11-26T11:14:34.322668 | 2020-07-31T08:44:21 | 2020-07-31T08:44:21 | 282,756,181 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 422 | java | package article.service;
import java.util.Map;
// model
public class DeleteRequest {
private String userId;
private int articleNumber;
public DeleteRequest(String userId, int articleNumber) {
super();
this.userId = userId;
this.articleNumber = articleNumber;
}
public String getUserId() {
return userId; }
public int getArticleNumber() {
return articleNumber; }
}
| [
"[email protected]"
]
| |
e3a539776525714daaed52bdf73b91ecb5da9588 | fa31bc3b859254c98222a79855025ac9f0d4fbd6 | /src/RemoveDuplicatesfromSortedArray.java | 44d53b7dbcf98539a04273960a827d9eee02dff3 | []
| no_license | luoyangylh/MyLeetCodeRepo | 2d36ad2e6036bd2dffefd3094f5661f3a5b03aee | 48613cd6f58eb1d0c545f74f08dbe09bc737ae1a | refs/heads/master | 2020-09-22T12:48:30.290389 | 2014-07-24T04:19:17 | 2014-07-24T04:19:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 334 | java | // Remove Duplicates from Sorted Array
public class RemoveDuplicatesfromSortedArray {
public int removeDuplicates(int[] A) {
if (A.length == 0) return 0;
int index = 0;
for (int i = 1; i < A.length; i++) {
if (A[index] != A[i]) {
A[++index] = A[i];
}
}
return index + 1;
}
} | [
"[email protected]"
]
| |
c6a4e075c7d2e3094c64865513d706f0adcf2715 | ed161b01dd8bb586278bec403ea528c404581ec5 | /java/com/ibm/ecosystem/conext/core/QueryDBPedia.java | 3140632f36351530ad6c33c21d914fcd84a60937 | []
| no_license | lkrishnamurthy/ConExT | 03e9c16adfd9f503e0df50933de178462c50e573 | a554be662fce3c97627168293412a64fdd15eab8 | refs/heads/master | 2020-03-25T05:49:02.502689 | 2018-08-17T15:23:17 | 2018-08-17T15:23:17 | 143,467,110 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,902 | java | package com.ibm.ecosystem.conext.core;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.parser.Parser;
import org.jsoup.select.Elements;
public class QueryDBPedia {
public static Document readDocumentFromUrl(String url) {
Document doc = null;
try {
InputStream is = new URL(url).openStream();
BufferedReader b = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line = "";
try {
while ((line =b.readLine()) != null){
sb.append(line + " \n");
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} doc = Jsoup.parse(sb.toString(), "", Parser.xmlParser());
return doc;
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return doc;
}
public static List<String> getClasses(Document doc) {
List<String> classes = new ArrayList<String>();
for (Element e : doc.select("classes class label")) {
classes.add(e.text());
}
return classes;
}
public static List<String> getCategories(String queryWord) {
Document doc = queryWord(queryWord);
List<String> classes = new ArrayList<String>();
for (Element e : doc.select("categories category label")) {
classes.add(e.text());
}
return classes;
}
public static Map<String, List<String>> getDisambiugatedCategories(String queryWord) {
Document doc = queryWord(queryWord);
Map<String, List<String>> categoriesByClass = new HashMap<String, List<String>>();
Elements senses = doc.select("ArrayOfResult > result");
for (Element sense : senses) {
String label = queryWord + "[" + sense.select("result > label").text() + "]";
List<String> classes = new ArrayList<String>();
for (Element e : sense.select("result > categories > category > label")) {
classes.add(e.text());
}
categoriesByClass.put(label, classes);
}
return categoriesByClass;
}
public static List<String> getCategories(Document doc) {
List<String> classes = new ArrayList<String>();
for (Element e : doc.select("categories category label")) {
classes.add(e.text());
}
return classes;
}
public static Document queryWord(String word) {
return readDocumentFromUrl("http://lookup.dbpedia.org/api/search/KeywordSearch?QueryString=" + URLEncoder.encode(word));
}
public static void printResults(Map<String, Map<String, Integer>> dictMap, String outputFile) {
try {
PrintWriter w = new PrintWriter(new FileWriter(new File(outputFile)));
for (Entry<String, Map<String, Integer>> e : dictMap.entrySet()) {
String dictName = e.getKey();
Map<String, Integer> categories = e.getValue();
w.println("****" + dictName + "****");
for (Entry<String, Integer> topCat : categories.entrySet()) {
w.println("\t" + topCat);
}
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void printResults2(Map<String, Map<String, Integer>> dictMap, String outputFile, Map<String, List<String>> glimpseData) {
try {
PrintWriter w = new PrintWriter(new FileWriter(new File(outputFile)));
for (Entry<String, Map<String, Integer>> e : dictMap.entrySet()) {
String dictName = e.getKey();
Map<String, Integer> categories = e.getValue();
double total = (double) glimpseData.get(dictName).size();
w.println("****" + dictName + " " + total + "****");
int counter = 0;
for (Entry<String, Integer> topCat : categories.entrySet()) {
if (++counter > 5)
break;
double score = (double) topCat.getValue() / total;
if (score > .01)
w.println("\t" + topCat.getKey() + " " + score);
}
}
w.flush();
w.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static List<String> querySPARQL(List<String> articles) {
List<String> categories = new ArrayList<String>();
String baseURL = "http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=";
String query = "select distinct ?category where { \n" + "?category ^(dcterms:subject/(skos:broader{0,1})) \n";
for (int i = 0; i < articles.size(); i++) {
String article = articles.get(i).replaceAll("[^a-zA-Z0-9 ]*","");
query += "\t\t dbpedia:" + article.replaceAll(" ", "_");
if (i + 1 != articles.size())
query += ",\n";
else
query += "\n";
}
query = query + "\n}";
baseURL = baseURL + URLEncoder.encode(query) + "&format=text%2Fhtml&timeout=30000&debug=on";
try {
Document doc = Jsoup.connect(baseURL).get();
Pattern p = Pattern.compile("http://dbpedia.org/resource/Category:([a-zA-Z_]*)");
Matcher m = p.matcher(doc.text());
while (m.find())
categories.add(m.group(1));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return categories;
}
public static List<String> banks = Arrays.asList("jpmorgan chase", "jpmorgan", "jp morgan", "chase", "bank of america", "bofa", "b of a", "citi", "citigroup", "citi group", "wells fargo", "wf", "wellsfargo", "goldman sachs", "morgan stanley", "bancorp", "bank of new york", "hsbc",
"capital one", "pnc", "bank", "state street");
}
| [
"[email protected]"
]
| |
d327d1ceee0110bc171a6b6e7bc9b39df8bdacd2 | ae69e30f8eb4ff2cd47e2336b2a2b31f271a3e5a | /Java/atcoder/beginner_100_199/beginner_190/E.java | 6dac026022eed5f5e65a5fd5bbd336026d37e2f2 | []
| no_license | bdugersuren/CompetitiveProgramming | f35048ef8e5345c5219c992f2be8b84e1f7f1cb8 | cd571222aabe3de952d90d6ddda055aa3b8c08d9 | refs/heads/master | 2023-05-12T00:45:15.065209 | 2021-05-14T13:24:53 | 2021-05-14T13:24:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,993 | java | package atcoder.beginner_100_199.beginner_190;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.StringTokenizer;
public final class E {
public static void main(String[] args) {
final FastScanner fs = new FastScanner();
final int n = fs.nextInt();
final int m = fs.nextInt();
final Map<Integer, List<Integer>> g = new HashMap<>();
for (int i = 0; i < m; i++) {
final int u = fs.nextInt();
final int v = fs.nextInt();
g.computeIfAbsent(u, val -> new ArrayList<>()).add(v);
g.computeIfAbsent(v, val -> new ArrayList<>()).add(u);
}
final int k = fs.nextInt();
final int[] arr = fs.nextIntArray(k);
final int[][] dist = new int[n + 5][k];
for (int[] row : dist) {
Arrays.fill(row, (int) 1e9);
}
for (int i = 0; i < k; i++) {
bfs(i, g, dist, arr);
}
for (int i = 0; i < k; i++) {
if (dist[arr[0]][i] == (int) 1e9) {
System.out.println(-1);
return;
}
}
final int[][] dp = new int[k][1 << k];
for (int[] row : dp) {
Arrays.fill(row, -1);
}
System.out.println(1 + dfs(arr, -1, 0, k, dist, dp));
}
private static int dfs(int[] arr, int prev, int mask, int k, int[][] dist, int[][] dp) {
if (mask == ((1 << k) - 1)) {
return 0;
}
if (prev != -1 && dp[prev][mask] != -1) {
return dp[prev][mask];
}
int res = (int) 1e9;
for (int i = 0; i < k; i++) {
if ((mask & (1 << i)) == 0) {
final int cost = prev == -1 ? 0 : dist[arr[prev]][i];
res = Math.min(res, dfs(arr, i, mask | (1 << i), k, dist, dp) + cost);
}
}
if (prev != -1) {
dp[prev][mask] = res;
}
return res;
}
private static void bfs(int u, Map<Integer, List<Integer>> g, int[][] dist, int[] arr) {
final Deque<Integer> q = new ArrayDeque<>();
q.offerLast(arr[u]);
dist[arr[u]][u] = 0;
while (!q.isEmpty()) {
final int curr = q.removeFirst();
for (int next : g.getOrDefault(curr, Collections.emptyList())) {
if (dist[next][u] == (int) 1e9) {
dist[next][u] = dist[curr][u] + 1;
q.offerLast(next);
}
}
}
}
static final class Utils {
public static void shuffleSort(int[] arr) {
shuffle(arr);
Arrays.sort(arr);
}
public static void shuffleSort(long[] arr) {
shuffle(arr);
Arrays.sort(arr);
}
public static void shuffle(int[] arr) {
final Random r = new Random();
for (int i = 0; i <= arr.length - 2; i++) {
final int j = i + r.nextInt(arr.length - i);
swap(arr, i, j);
}
}
public static void shuffle(long[] arr) {
final Random r = new Random();
for (int i = 0; i <= arr.length - 2; i++) {
final int j = i + r.nextInt(arr.length - i);
swap(arr, i, j);
}
}
public static void swap(int[] arr, int i, int j) {
final int t = arr[i];
arr[i] = arr[j];
arr[j] = t;
}
public static void swap(long[] arr, int i, int j) {
final long t = arr[i];
arr[i] = arr[j];
arr[j] = t;
}
private Utils() {}
}
static class FastScanner {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer("");
private String next() {
while (!st.hasMoreTokens()) {
try {
st = new StringTokenizer(br.readLine());
} catch (IOException e) {
//noinspection CallToPrintStackTrace
e.printStackTrace();
}
}
return st.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
int[] nextIntArray(int n) {
final int[] a = new int[n];
for (int i = 0; i < n; i++) { a[i] = nextInt(); }
return a;
}
long[] nextLongArray(int n) {
final long[] a = new long[n];
for (int i = 0; i < n; i++) { a[i] = nextLong(); }
return a;
}
}
}
| [
"[email protected]"
]
| |
11b8117c9e7fa9dc879eba26dafba2b891800ad9 | 7c05d5558c1c00fcdfff834bfe3197f218c367bd | /server/async-app/src/main/java/de/codedoor/async/workshop/jms/QueueMessageConsumer.java | 64b14d4217635242072ce04f2429e5c5eeaef21b | []
| no_license | waldi5001/asyncWorkshop | cab0b60ebc8b0a476aea1d3fac47797029626a02 | db82521e1bc7308fee640f91c0866f2f7ff2520c | refs/heads/master | 2021-06-24T20:28:51.468598 | 2020-12-05T20:51:06 | 2020-12-05T20:51:06 | 172,742,842 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,625 | java | package de.codedoor.async.workshop.jms;
import javax.annotation.Resource;
import javax.ejb.MessageDriven;
import javax.ejb.MessageDrivenContext;
import javax.jms.ConnectionFactory;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.Topic;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
@MessageDriven(name = "QueueMessageConsumer")
public class QueueMessageConsumer implements MessageListener {
@Resource
private MessageDrivenContext mdcContext;
@Resource(name = "jms/asyncAppConnectionFactory")
private ConnectionFactory asyncAppConnectionFactory;
@Resource(name = "jms/asyncAppTopic")
private Topic topic;
@Override
public void onMessage(Message message) {
System.out.println("QueueMessageConsumer: " + message);
new JmsTemplate(asyncAppConnectionFactory).send(topic, (MessageCreator) session -> message);
// mdcContext.setRollbackOnly();
// Connection con = null;
// try {
// con = topicConnectionFactory.createConnection();
// Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
// MessageProducer producer = session.createProducer(topic);
// if (message instanceof TextMessage) {
// producer.send(session.createTextMessage(((TextMessage) message).getText()));
// } else {
// producer.send(message);
// }
// con.close();
// } catch (Exception e) {
// e.printStackTrace();
// } finally {
// if (con != null) {
// try {
// con.close();
// } catch (JMSException e) {
// e.printStackTrace();
// }
// }
// }
}
}
| [
"[email protected]"
]
| |
0f2eb2c336b6d18a1c3ccbc6f660f349194281dd | 785935d20cf142e2edfdbeda24d52d4e39c96dd0 | /ItemBasedReco/src/main/java/com/naveen/reducer/MatrixProductCombiner.java | 70578b584741237e56859ab535086912aa140d6c | []
| no_license | chetkhatri/BigDataSoftwareProject | 703429bc6bc18a5506e22584d2a360609e8081f7 | 4a81db102cedb8ad3c6c8e90c3dfb57db842adbb | refs/heads/master | 2021-01-20T23:23:31.648077 | 2015-03-16T02:41:56 | 2015-03-16T02:41:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,296 | java | package com.naveen.reducer;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.Reducer.Context;
/*
* This class is used as a combiner for this MapReduce program for improving the performance
* This combiner acts as a mini reducer where the output of the mapper are reduced in great deal before sending it to Reducer
*/
public class MatrixProductCombiner extends Reducer<Text, Text, Text, Text>{
@Override
public void reduce(Text key, Iterable<Text> values, Context context)
{
//System.out.println("In Combiner logic");
Map<String, Integer> itemProduct = new HashMap<String, Integer>();
String [] itemDetail = new String[2];
for(Text value:values){
itemDetail = value.toString().split(":");
//System.out.println("item detail array:" + Arrays.toString(itemDetail));
if (itemProduct.get(itemDetail[0]) ==null){
//System.out.println("Record is not present:" + itemDetail[0]);
//System.out.println("ItemProduct Size in the else clause:" + itemProduct.size());
//if(itemProduct.size() < 11){
itemProduct.put(itemDetail[0], Integer.parseInt(itemDetail[1]));
//}
}
else{
//System.out.println("Record is present:" + itemDetail[0]);
//System.out.println("ItemProduct Size in the if clause:" + itemProduct.size());
//if(itemProduct.size() < 11){
itemProduct.put(itemDetail[0], (Integer.parseInt(itemDetail[1]) + (Integer) itemProduct.get(itemDetail[0])));
/*}
else
continue;*/
}
}
StringBuilder str = new StringBuilder();
for (Map.Entry<String, Integer> entry : itemProduct.entrySet()){
str.append(entry.getKey().toString());
str.append(":");
str.append(entry.getValue().toString());
//System.out.println("Value of the string:" + str.toString());
try {
context.write(key, new Text(str.toString()));
str.setLength(0);
str.trimToSize();
} catch (IOException | InterruptedException e) {
str.setLength(0);
str.trimToSize();
e.printStackTrace();
}
}
}
}
| [
"[email protected]"
]
| |
603e9874d39a074ebe20b5b37e225ad1cb6fe6a7 | 3b4e038ad9bd5e4c3557bfb37165f6c6b24c4459 | /src/waq/hbwl/service/CustomerServiceImpl.java | 691dad319bbee90c8ba46097ad5d7ad517907611 | []
| no_license | Kraty/ssm-integration | 73fc8ff0a1e84812bd4053848fd4f2baf6a07a69 | 8491015e7bc4dd97777e2e26d6a1240b37ac2579 | refs/heads/master | 2022-11-17T18:36:01.724835 | 2020-07-16T09:11:00 | 2020-07-16T09:11:00 | 280,103,498 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 534 | java | package waq.hbwl.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import waq.hbwl.dao.CustomerDao;
import waq.hbwl.po.Customer;
@Service
@Transactional
public class CustomerServiceImpl implements CustomerService {
// 注解注入
@Autowired
private CustomerDao customerDao;
public Customer findCustomerById(Integer id) {
return customerDao.findCustomerById(id);
}
}
| [
"[email protected]"
]
| |
7e611ce7ce085d0192936adfd8b3bd7c446ae148 | 35cf5fc818ecf7107561f4feff6bd2374119633b | /ch6/sec02/SetViews.java | 7fa6b787f317ebbecf7a3df1b03add862d4e7962 | []
| no_license | javamax/java8-horstmann-book | 97a4f5982131e5c9015ae45989d5aae188b87754 | a440ab2eabff0d8d46ca8edc42a037f137750762 | refs/heads/master | 2021-01-23T15:42:43.355435 | 2014-09-29T22:38:09 | 2014-09-29T22:38:09 | 24,486,668 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 362 | java | import java.util.*;
import java.util.concurrent.*;
public class SetViews {
public static void main(String[] args) {
Set<String> words = ConcurrentHashMap.<String>newKeySet();
ConcurrentHashMap<String, Long> map = new ConcurrentHashMap<>();
words = map.keySet(1L);
words.add("Java");
System.out.println(map.get("Java"));
}
}
| [
"[email protected]"
]
| |
0262722afbbe00e1f2bc7467e834843cb39c0a9e | 3edd11e4a5fd6e46c453efefedd4f7e95820dc50 | /src/main/java/com/big/web/b2b_big2/flight/api/kalstar/action/ISqivaAction.java | 6e3c79109c47d24d838c3db2f49b038a80c1c702 | []
| no_license | elkana911/b2b-big2 | 6e6bb74b8ecdfc53a462e04d519044039cb49a6a | bbb411eb0d3f57b91b9a6ae09b045294da5606c1 | refs/heads/master | 2020-12-04T06:05:24.873315 | 2016-08-23T21:46:48 | 2016-08-23T21:46:48 | 66,405,547 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 295 | java | package com.big.web.b2b_big2.flight.api.kalstar.action;
public interface ISqivaAction {
// final String API_KEY = "5EB9FE68-8915-11E0-BEA0-C9892766ECF2";
// final String rootUrl = "http://ws.demo.awan.sqiva.com/?rqid=" + API_KEY + "&airline_code=W2";
Object execute() throws Exception;
}
| [
"[email protected]"
]
| |
b845922d74fac114b6a77fc935c19b09555eb899 | c98bee6b29dd8b62cce8c96dea7b2daeac7f12f9 | /Blogger2/app/src/androidTest/java/com/example/root/blogger2/ApplicationTest.java | da7acf836a35526a7e3dc01d55d5ce1df5b8f7f3 | []
| no_license | Audakel/Android-Dev-Apps | a721574f31e567fb3bd11e587a039c55fc7e785a | 284f62dab1b5d9606c5190d16b10009d9759bc7e | refs/heads/master | 2021-01-01T19:16:21.672778 | 2014-11-07T21:36:01 | 2014-11-07T21:36:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 356 | java | package com.example.root.blogger2;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"[email protected]"
]
| |
a2d7373d5fcf76ade9e8234b1b70b2b424304a48 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/24/24_83ab4d29e88c280ee33f60c5aa1b413489972018/SubstructureTreeNode/24_83ab4d29e88c280ee33f60c5aa1b413489972018_SubstructureTreeNode_s.java | c2534be952c1f8ed765f9fe5b96b95ab462fd7cc | []
| no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 2,730 | java | /*
* Metadata Editor
*
* Metadata Editor - Rich internet application for editing metadata.
* Copyright (C) 2011 Jiri Kremser ([email protected])
* Moravian Library in Brno
*
* 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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*
*/
package cz.mzk.editor.client.view.other;
import com.smartgwt.client.widgets.tree.TreeNode;
import cz.mzk.editor.client.util.Constants;
/**
* @author Jiri Kremser
* @version 7.3.2012
*/
public class SubstructureTreeNode
extends TreeNode {
public static final String ROOT_ID = "1";
public static final String ROOT_OBJECT_ID = "0";
public SubstructureTreeNode(String id,
String parent,
String name,
String pictureOrUuid,
String modelId,
String type,
String dateOrIntPartName,
String noteOrIntSubtitle,
String partNumberOrAlto,
String aditionalInfoOrOcr,
boolean isOpen,
boolean exist) {
setAttribute(Constants.ATTR_ID, id);
setAttribute(Constants.ATTR_PARENT, parent);
setAttribute(Constants.ATTR_NAME, name);
setAttribute(Constants.ATTR_PICTURE_OR_UUID, pictureOrUuid);
setAttribute(Constants.ATTR_MODEL_ID, modelId);
setAttribute(Constants.ATTR_TYPE, type);
setAttribute(Constants.ATTR_DATE_OR_INT_PART_NAME, dateOrIntPartName);
setAttribute(Constants.ATTR_NOTE_OR_INT_SUBTITLE, noteOrIntSubtitle);
setAttribute(Constants.ATTR_PART_NUMBER_OR_ALTO, partNumberOrAlto);
setAttribute(Constants.ATTR_ADITIONAL_INFO_OR_OCR, aditionalInfoOrOcr);
setAttribute("isOpen", isOpen);
setAttribute(Constants.ATTR_EXIST, exist);
setAttribute(Constants.ATTR_CREATE, !exist);
}
}
| [
"[email protected]"
]
| |
829e2f332b210d0055d493023896c02af5c52b7b | 2d620b68268d99ec404036fd615578c536748cd4 | /src/main/java/org/gradoop/demo/server/pojo/enums/VertexDegreeType.java | 49e832b1b44869b24dc8ad649243cb31dcd23c15 | [
"Apache-2.0"
]
| permissive | niklasteichmann/gradoop_demo | baea68b572a2f77aca9e073813c1aa904ce57a04 | c406c7b078edf3e3b131a92dd89399c17341b9c5 | refs/heads/master | 2020-04-09T21:07:39.902178 | 2018-12-10T14:11:11 | 2018-12-10T14:11:11 | 160,592,642 | 0 | 0 | Apache-2.0 | 2018-12-05T23:43:47 | 2018-12-05T23:43:47 | null | UTF-8 | Java | false | false | 703 | java | package org.gradoop.demo.server.pojo.enums;
public class VertexDegreeType {
public enum Type {
IN,
OUT,
BOTH
}
private Type type;
private VertexDegreeType(Type type) {
this.type = type;
}
public static VertexDegreeType fromString(String typeString) {
switch (typeString) {
case "in":
return new VertexDegreeType(Type.IN);
case "out":
return new VertexDegreeType(Type.OUT);
case "both":
return new VertexDegreeType(Type.BOTH);
default:
throw new IllegalArgumentException(
"Vertex degree type '" + typeString + "' was not recognized.");
}
}
public Type getType() {
return this.type;
}
}
| [
"[email protected]"
]
| |
1310d3c1e96cdd5f77172c24acb55aab408ff398 | cd8843d24154202f92eaf7d6986d05a7266dea05 | /saaf-base-5.0/1008_saaf-schedule-model/src/main/java/com/sie/saaf/business/model/inter/server/TtaUserInterfaceServer.java | 0359323a46891d81d7b7ba907bb350e283dd3c01 | []
| no_license | lingxiaoti/tta_system | fbc46c7efc4d408b08b0ebb58b55d2ad1450438f | b475293644bfabba9aeecfc5bd6353a87e8663eb | refs/heads/master | 2023-03-02T04:24:42.081665 | 2021-02-07T06:48:02 | 2021-02-07T06:48:02 | 336,717,227 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,396 | java | package com.sie.saaf.business.model.inter.server;
import com.sie.saaf.business.model.inter.ITtaUserInterface;
import com.sie.saaf.common.model.dao.BaseCommonDAO_HI;
import com.sie.saaf.common.model.inter.server.BaseCommonServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
/**
* @author hmb
* @date 2019/8/15 16:16
*/
@Component("ttaUserInterfaceServer")
public class TtaUserInterfaceServer extends BaseCommonServer<Object> implements ITtaUserInterface {
private static final Logger LOGGER = LoggerFactory.getLogger(TtaUserInterfaceServer.class);
@Autowired
private BaseCommonDAO_HI<Object> ttaUserInterfaceDao;
public TtaUserInterfaceServer() {
super();
}
@Override
public void saveJdbcBatchObject(String tableName, List<Map<String, Object>> list) {
ttaUserInterfaceDao.saveBatchJDBC(tableName,list);
}
@Override
public void updateUserInterfaceInfo() {
}
@Override
public void callProUpdateTtaUserInterface() {
}
/**
* 删除user_interface_in的数据
*/
@Override
public void deleteTtaUserInterface() {
String sql = "delete from user_interface_in";
ttaUserInterfaceDao.executeSqlUpdate(sql);
}
}
| [
"[email protected]"
]
| |
d7d69c5842ff73750fcde8de5c6f477877136ea6 | ed5159d056e98d6715357d0d14a9b3f20b764f89 | /src/irvine/oeis/a220/A220148.java | 7a987589eb4858935b3a6405fffd6b3c2aaf2d38 | []
| no_license | flywind2/joeis | c5753169cf562939b04dd246f8a2958e97f74558 | e5efd6971a0062ac99f4fae21a7c78c9f9e74fea | refs/heads/master | 2020-09-13T18:34:35.080552 | 2019-11-19T05:40:55 | 2019-11-19T05:40:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 711 | java | package irvine.oeis.a220;
// Generated by gen_pattern.pl - DO NOT EDIT here!
import irvine.oeis.GeneratingFunctionSequence;
/**
* A220148 Number of <code>n X 3</code> arrays of the minimum value of corresponding elements and their horizontal or diagonal neighbors in a random, but sorted with lexicographically nondecreasing rows and nonincreasing columns, <code>0..2 n X 3</code> array.
* @author Georg Fischer
*/
public class A220148 extends GeneratingFunctionSequence {
/** Construct the sequence. */
public A220148() {
super(1, new long[] {0, 6, -49, 197, -484, 815, -997, 934, -685, 389, -161, 42, -5},
new long[] {1, -12, 66, -220, 495, -792, 924, -792, 495, -220, 66, -12, 1});
}
}
| [
"[email protected]"
]
| |
0edfd543a73f4ec919aa10118320c78d3015c7ec | 7ed1524ce87bb8a75c22a7df873a70252fcc0ba6 | /src/Dinner.java | e25f60641f2538b37be147a58f41a6188305bfad | []
| no_license | ehavlin/Whats-For-Dinner | eca7c4bb82b96a7d0b463899c56dba336d964794 | c91e05215284037b349cff6d6397a649860d2517 | refs/heads/master | 2020-02-26T15:41:27.974419 | 2016-10-12T22:17:03 | 2016-10-12T22:17:03 | 70,744,462 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 232 | java |
public class Dinner {
private String name;
public Dinner(String NewName) {
name = NewName;
}
public String getName() {
return name;
}
public String getURL() {
return null;
}
}
| [
"[email protected]"
]
| |
e2d2a5f355060cdcdbe7400430d7568a2f3ca60c | a15d4565864d8cecf88f4a9a92139c9c41578c8f | /modules/service/org.jowidgets.invocation.service.common.api/src/main/java/org/jowidgets/invocation/service/common/api/IInterimResponseCallback.java | 60c29b3a1c495f09a2752de59c6dbc78e7f98096 | []
| no_license | jo-source/jo-client-platform | f4800d121df6b982639390f3507da237fc5426c1 | 2f346b26fa956c6d6612fef2d0ef3eedbb390d7a | refs/heads/master | 2021-01-23T10:03:16.067646 | 2019-04-29T11:43:04 | 2019-04-29T11:43:04 | 39,776,103 | 2 | 3 | null | 2016-08-24T13:53:07 | 2015-07-27T13:33:59 | Java | UTF-8 | Java | false | false | 1,734 | java | /*
* Copyright (c) 2011, grossmann
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the jo-widgets.org nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL jo-widgets.org BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
package org.jowidgets.invocation.service.common.api;
public interface IInterimResponseCallback<RESPONSE_TYPE> {
void response(RESPONSE_TYPE response);
}
| [
"[email protected]"
]
| |
fa706cb0f6d73426fe2c432c569ce1a44ce70e45 | e9affefd4e89b3c7e2064fee8833d7838c0e0abc | /aws-java-sdk-managedblockchainquery/src/main/java/com/amazonaws/services/managedblockchainquery/AmazonManagedBlockchainQueryClient.java | 96cf217726c36e1426ab0d92f9d710d26b2bc276 | [
"Apache-2.0"
]
| permissive | aws/aws-sdk-java | 2c6199b12b47345b5d3c50e425dabba56e279190 | bab987ab604575f41a76864f755f49386e3264b4 | refs/heads/master | 2023-08-29T10:49:07.379135 | 2023-08-28T21:05:55 | 2023-08-28T21:05:55 | 574,877 | 3,695 | 3,092 | Apache-2.0 | 2023-09-13T23:35:28 | 2010-03-22T23:34:58 | null | UTF-8 | Java | false | false | 34,475 | java | /*
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.managedblockchainquery;
import org.w3c.dom.*;
import java.net.*;
import java.util.*;
import javax.annotation.Generated;
import org.apache.commons.logging.*;
import com.amazonaws.*;
import com.amazonaws.annotation.SdkInternalApi;
import com.amazonaws.auth.*;
import com.amazonaws.handlers.*;
import com.amazonaws.http.*;
import com.amazonaws.internal.*;
import com.amazonaws.internal.auth.*;
import com.amazonaws.metrics.*;
import com.amazonaws.regions.*;
import com.amazonaws.transform.*;
import com.amazonaws.util.*;
import com.amazonaws.protocol.json.*;
import com.amazonaws.util.AWSRequestMetrics.Field;
import com.amazonaws.annotation.ThreadSafe;
import com.amazonaws.client.AwsSyncClientParams;
import com.amazonaws.client.builder.AdvancedConfig;
import com.amazonaws.services.managedblockchainquery.AmazonManagedBlockchainQueryClientBuilder;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.services.managedblockchainquery.model.*;
import com.amazonaws.services.managedblockchainquery.model.transform.*;
/**
* Client for accessing Amazon Managed Blockchain Query. All service calls made using this client are blocking, and will
* not return until the service call completes.
* <p>
* <p>
* Amazon Managed Blockchain (AMB) Query provides you with convenient access to multi-blockchain network data, which
* makes it easier for you to extract contextual data related to blockchain activity. You can use AMB Query to read data
* from public blockchain networks, such as Bitcoin Mainnet and Ethereum Mainnet. You can also get information such as
* the current and historical balances of addresses, or you can get a list of blockchain transactions for a given time
* period. Additionally, you can get details of a given transaction, such as transaction events, which you can further
* analyze or use in business logic for your applications.
* </p>
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AmazonManagedBlockchainQueryClient extends AmazonWebServiceClient implements AmazonManagedBlockchainQuery {
/** Provider for AWS credentials. */
private final AWSCredentialsProvider awsCredentialsProvider;
private static final Log log = LogFactory.getLog(AmazonManagedBlockchainQuery.class);
/** Default signing name for the service. */
private static final String DEFAULT_SIGNING_NAME = "managedblockchain-query";
/** Client configuration factory providing ClientConfigurations tailored to this client */
protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory();
private final AdvancedConfig advancedConfig;
private static final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory = new com.amazonaws.protocol.json.SdkJsonProtocolFactory(
new JsonClientMetadata()
.withProtocolVersion("1.1")
.withSupportsCbor(false)
.withSupportsIon(false)
.withContentTypeOverride("application/json")
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("AccessDeniedException").withExceptionUnmarshaller(
com.amazonaws.services.managedblockchainquery.model.transform.AccessDeniedExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ValidationException").withExceptionUnmarshaller(
com.amazonaws.services.managedblockchainquery.model.transform.ValidationExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ResourceNotFoundException").withExceptionUnmarshaller(
com.amazonaws.services.managedblockchainquery.model.transform.ResourceNotFoundExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ServiceQuotaExceededException").withExceptionUnmarshaller(
com.amazonaws.services.managedblockchainquery.model.transform.ServiceQuotaExceededExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("InternalServerException").withExceptionUnmarshaller(
com.amazonaws.services.managedblockchainquery.model.transform.InternalServerExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ThrottlingException").withExceptionUnmarshaller(
com.amazonaws.services.managedblockchainquery.model.transform.ThrottlingExceptionUnmarshaller.getInstance()))
.withBaseServiceExceptionClass(com.amazonaws.services.managedblockchainquery.model.AmazonManagedBlockchainQueryException.class));
public static AmazonManagedBlockchainQueryClientBuilder builder() {
return AmazonManagedBlockchainQueryClientBuilder.standard();
}
/**
* Constructs a new client to invoke service methods on Amazon Managed Blockchain Query using the specified
* parameters.
*
* <p>
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AmazonManagedBlockchainQueryClient(AwsSyncClientParams clientParams) {
this(clientParams, false);
}
/**
* Constructs a new client to invoke service methods on Amazon Managed Blockchain Query using the specified
* parameters.
*
* <p>
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AmazonManagedBlockchainQueryClient(AwsSyncClientParams clientParams, boolean endpointDiscoveryEnabled) {
super(clientParams);
this.awsCredentialsProvider = clientParams.getCredentialsProvider();
this.advancedConfig = clientParams.getAdvancedConfig();
init();
}
private void init() {
setServiceNameIntern(DEFAULT_SIGNING_NAME);
setEndpointPrefix(ENDPOINT_PREFIX);
// calling this.setEndPoint(...) will also modify the signer accordingly
setEndpoint("managedblockchain-query.us-east-1.amazonaws.com");
HandlerChainFactory chainFactory = new HandlerChainFactory();
requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/managedblockchainquery/request.handlers"));
requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/managedblockchainquery/request.handler2s"));
requestHandler2s.addAll(chainFactory.getGlobalHandlers());
}
/**
* <p>
* Gets the token balance for a batch of tokens by using the <code>GetTokenBalance</code> action for every token in
* the request.
* </p>
* <note>
* <p>
* Only the native tokens BTC,ETH, and the ERC-20, ERC-721, and ERC 1155 token standards are supported.
* </p>
* </note>
*
* @param batchGetTokenBalanceRequest
* @return Result of the BatchGetTokenBalance operation returned by the service.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is when you create resources that exceed your service limit for this resource
* type. Request a limit increase or delete unused resources, if possible.
* @throws ValidationException
* The resource passed is invalid.
* @throws ResourceNotFoundException
* The resource was not found.
* @throws AccessDeniedException
* The Amazon Web Services account doesn’t have access to this resource.
* @throws InternalServerException
* The request processing has failed because of an internal error in the service.
* @throws ServiceQuotaExceededException
* The service quota has been exceeded for this resource.
* @sample AmazonManagedBlockchainQuery.BatchGetTokenBalance
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/managedblockchain-query-2023-05-04/BatchGetTokenBalance"
* target="_top">AWS API Documentation</a>
*/
@Override
public BatchGetTokenBalanceResult batchGetTokenBalance(BatchGetTokenBalanceRequest request) {
request = beforeClientExecution(request);
return executeBatchGetTokenBalance(request);
}
@SdkInternalApi
final BatchGetTokenBalanceResult executeBatchGetTokenBalance(BatchGetTokenBalanceRequest batchGetTokenBalanceRequest) {
ExecutionContext executionContext = createExecutionContext(batchGetTokenBalanceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<BatchGetTokenBalanceRequest> request = null;
Response<BatchGetTokenBalanceResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new BatchGetTokenBalanceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(batchGetTokenBalanceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ManagedBlockchain Query");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "BatchGetTokenBalance");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<BatchGetTokenBalanceResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new BatchGetTokenBalanceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Gets the balance of a specific token, including native tokens, for a given address (wallet or contract) on the
* blockchain.
* </p>
* <note>
* <p>
* Only the native tokens BTC,ETH, and the ERC-20, ERC-721, and ERC 1155 token standards are supported.
* </p>
* </note>
*
* @param getTokenBalanceRequest
* @return Result of the GetTokenBalance operation returned by the service.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is when you create resources that exceed your service limit for this resource
* type. Request a limit increase or delete unused resources, if possible.
* @throws ValidationException
* The resource passed is invalid.
* @throws ResourceNotFoundException
* The resource was not found.
* @throws AccessDeniedException
* The Amazon Web Services account doesn’t have access to this resource.
* @throws InternalServerException
* The request processing has failed because of an internal error in the service.
* @throws ServiceQuotaExceededException
* The service quota has been exceeded for this resource.
* @sample AmazonManagedBlockchainQuery.GetTokenBalance
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/managedblockchain-query-2023-05-04/GetTokenBalance"
* target="_top">AWS API Documentation</a>
*/
@Override
public GetTokenBalanceResult getTokenBalance(GetTokenBalanceRequest request) {
request = beforeClientExecution(request);
return executeGetTokenBalance(request);
}
@SdkInternalApi
final GetTokenBalanceResult executeGetTokenBalance(GetTokenBalanceRequest getTokenBalanceRequest) {
ExecutionContext executionContext = createExecutionContext(getTokenBalanceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<GetTokenBalanceRequest> request = null;
Response<GetTokenBalanceResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetTokenBalanceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getTokenBalanceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ManagedBlockchain Query");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetTokenBalance");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<GetTokenBalanceResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetTokenBalanceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Get the details of a transaction.
* </p>
*
* @param getTransactionRequest
* @return Result of the GetTransaction operation returned by the service.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is when you create resources that exceed your service limit for this resource
* type. Request a limit increase or delete unused resources, if possible.
* @throws ValidationException
* The resource passed is invalid.
* @throws ResourceNotFoundException
* The resource was not found.
* @throws AccessDeniedException
* The Amazon Web Services account doesn’t have access to this resource.
* @throws InternalServerException
* The request processing has failed because of an internal error in the service.
* @throws ServiceQuotaExceededException
* The service quota has been exceeded for this resource.
* @sample AmazonManagedBlockchainQuery.GetTransaction
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/managedblockchain-query-2023-05-04/GetTransaction"
* target="_top">AWS API Documentation</a>
*/
@Override
public GetTransactionResult getTransaction(GetTransactionRequest request) {
request = beforeClientExecution(request);
return executeGetTransaction(request);
}
@SdkInternalApi
final GetTransactionResult executeGetTransaction(GetTransactionRequest getTransactionRequest) {
ExecutionContext executionContext = createExecutionContext(getTransactionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<GetTransactionRequest> request = null;
Response<GetTransactionResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetTransactionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getTransactionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ManagedBlockchain Query");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetTransaction");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<GetTransactionResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetTransactionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* This action returns the following for a given a blockchain network:
* </p>
* <ul>
* <li>
* <p>
* Lists all token balances owned by an address (either a contact address or a wallet address).
* </p>
* </li>
* <li>
* <p>
* Lists all token balances for all tokens created by a contract.
* </p>
* </li>
* <li>
* <p>
* Lists all token balances for a given token.
* </p>
* </li>
* </ul>
* <note>
* <p>
* You must always specify the network property of the <code>tokenFilter</code> when using this operation.
* </p>
* </note>
*
* @param listTokenBalancesRequest
* @return Result of the ListTokenBalances operation returned by the service.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is when you create resources that exceed your service limit for this resource
* type. Request a limit increase or delete unused resources, if possible.
* @throws ValidationException
* The resource passed is invalid.
* @throws AccessDeniedException
* The Amazon Web Services account doesn’t have access to this resource.
* @throws InternalServerException
* The request processing has failed because of an internal error in the service.
* @throws ServiceQuotaExceededException
* The service quota has been exceeded for this resource.
* @sample AmazonManagedBlockchainQuery.ListTokenBalances
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/managedblockchain-query-2023-05-04/ListTokenBalances"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListTokenBalancesResult listTokenBalances(ListTokenBalancesRequest request) {
request = beforeClientExecution(request);
return executeListTokenBalances(request);
}
@SdkInternalApi
final ListTokenBalancesResult executeListTokenBalances(ListTokenBalancesRequest listTokenBalancesRequest) {
ExecutionContext executionContext = createExecutionContext(listTokenBalancesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListTokenBalancesRequest> request = null;
Response<ListTokenBalancesResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTokenBalancesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTokenBalancesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ManagedBlockchain Query");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTokenBalances");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListTokenBalancesResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListTokenBalancesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* An array of <code>TransactionEvent</code> objects. Each object contains details about the transaction event.
* </p>
*
* @param listTransactionEventsRequest
* @return Result of the ListTransactionEvents operation returned by the service.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is when you create resources that exceed your service limit for this resource
* type. Request a limit increase or delete unused resources, if possible.
* @throws ValidationException
* The resource passed is invalid.
* @throws AccessDeniedException
* The Amazon Web Services account doesn’t have access to this resource.
* @throws InternalServerException
* The request processing has failed because of an internal error in the service.
* @throws ServiceQuotaExceededException
* The service quota has been exceeded for this resource.
* @sample AmazonManagedBlockchainQuery.ListTransactionEvents
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/managedblockchain-query-2023-05-04/ListTransactionEvents"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListTransactionEventsResult listTransactionEvents(ListTransactionEventsRequest request) {
request = beforeClientExecution(request);
return executeListTransactionEvents(request);
}
@SdkInternalApi
final ListTransactionEventsResult executeListTransactionEvents(ListTransactionEventsRequest listTransactionEventsRequest) {
ExecutionContext executionContext = createExecutionContext(listTransactionEventsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListTransactionEventsRequest> request = null;
Response<ListTransactionEventsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTransactionEventsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTransactionEventsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ManagedBlockchain Query");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTransactionEvents");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListTransactionEventsResult>> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListTransactionEventsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* <p>
* Lists all of the transactions on a given wallet address or to a specific contract.
* </p>
*
* @param listTransactionsRequest
* @return Result of the ListTransactions operation returned by the service.
* @throws ThrottlingException
* The request or operation couldn't be performed because a service is throttling requests. The most common
* source of throttling errors is when you create resources that exceed your service limit for this resource
* type. Request a limit increase or delete unused resources, if possible.
* @throws ValidationException
* The resource passed is invalid.
* @throws AccessDeniedException
* The Amazon Web Services account doesn’t have access to this resource.
* @throws InternalServerException
* The request processing has failed because of an internal error in the service.
* @throws ServiceQuotaExceededException
* The service quota has been exceeded for this resource.
* @sample AmazonManagedBlockchainQuery.ListTransactions
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/managedblockchain-query-2023-05-04/ListTransactions"
* target="_top">AWS API Documentation</a>
*/
@Override
public ListTransactionsResult listTransactions(ListTransactionsRequest request) {
request = beforeClientExecution(request);
return executeListTransactions(request);
}
@SdkInternalApi
final ListTransactionsResult executeListTransactions(ListTransactionsRequest listTransactionsRequest) {
ExecutionContext executionContext = createExecutionContext(listTransactionsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request<ListTransactionsRequest> request = null;
Response<ListTransactionsResult> response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTransactionsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTransactionsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "ManagedBlockchain Query");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTransactions");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler<AmazonWebServiceResponse<ListTransactionsResult>> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListTransactionsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Returns additional metadata for a previously executed successful, request, typically used for debugging issues
* where a service isn't acting as expected. This data isn't considered part of the result data returned by an
* operation, so it's available through this separate, diagnostic interface.
* <p>
* Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic
* information for an executed request, you should use this method to retrieve it as soon as possible after
* executing the request.
*
* @param request
* The originally executed request
*
* @return The response metadata for the specified request, or null if none is available.
*/
public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) {
return client.getResponseMetadataForRequest(request);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> invoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
ExecutionContext executionContext) {
return invoke(request, responseHandler, executionContext, null, null);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> invoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
ExecutionContext executionContext, URI cachedEndpoint, URI uriFromEndpointTrait) {
executionContext.setCredentialsProvider(CredentialUtils.getCredentialsProvider(request.getOriginalRequest(), awsCredentialsProvider));
return doInvoke(request, responseHandler, executionContext, cachedEndpoint, uriFromEndpointTrait);
}
/**
* Invoke with no authentication. Credentials are not required and any credentials set on the client or request will
* be ignored for this operation.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> anonymousInvoke(Request<Y> request,
HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler, ExecutionContext executionContext) {
return doInvoke(request, responseHandler, executionContext, null, null);
}
/**
* Invoke the request using the http client. Assumes credentials (or lack thereof) have been configured in the
* ExecutionContext beforehand.
**/
private <X, Y extends AmazonWebServiceRequest> Response<X> doInvoke(Request<Y> request, HttpResponseHandler<AmazonWebServiceResponse<X>> responseHandler,
ExecutionContext executionContext, URI discoveredEndpoint, URI uriFromEndpointTrait) {
if (discoveredEndpoint != null) {
request.setEndpoint(discoveredEndpoint);
request.getOriginalRequest().getRequestClientOptions().appendUserAgent("endpoint-discovery");
} else if (uriFromEndpointTrait != null) {
request.setEndpoint(uriFromEndpointTrait);
} else {
request.setEndpoint(endpoint);
}
request.setTimeOffset(timeOffset);
HttpResponseHandler<AmazonServiceException> errorResponseHandler = protocolFactory.createErrorResponseHandler(new JsonErrorResponseMetadata());
return client.execute(request, responseHandler, errorResponseHandler, executionContext);
}
@com.amazonaws.annotation.SdkInternalApi
static com.amazonaws.protocol.json.SdkJsonProtocolFactory getProtocolFactory() {
return protocolFactory;
}
@Override
public void shutdown() {
super.shutdown();
}
}
| [
""
]
| |
5ac39ea4312cb54b6527c092f41d5e8d1640e025 | 2c1a1cc8f45f64174c4a27d236e57b4e142a419a | /src/com/example/snowball/DynamicStateFragment.java | da58c8e5dad1cb1f2af2846c71c6504a2617d5ce | []
| no_license | qbherve/snowball | 213ec2387ac6a1df92596128ccad822e6c5a2a41 | 8e2fe0259f8cfb90776fb0f7fd0374fb5bc41282 | refs/heads/master | 2020-06-07T21:47:29.729734 | 2015-01-02T16:13:11 | 2015-01-02T16:13:11 | 28,710,098 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 6,481 | java | /*
* Copyright 2013 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 com.example.snowball;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
public class DynamicStateFragment extends Fragment {
public DynamicStateFragment() {
// Empty constructor required for fragment subclasses
}
public DynamicStateFragment(String str) {
// Empty constructor required for fragment subclasses
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.dynamic_state, container,
false);
ListView dynamicstate = (ListView) rootView
.findViewById(R.id.dynamic_state_lv);
MyAdapter mAdapter = new MyAdapter(inflater);
dynamicstate.setAdapter(mAdapter);
mAdapter.notifyDataSetChanged();
return rootView;
}
class MyAdapter extends BaseAdapter {
private LayoutInflater mInflater;
class ViewHolder {
public LinearLayout dynamic_ll;
public ImageView dynamic_iv_picture;
public TextView dynamic_tv_name;
public TextView dynamic_tv_device;
public TextView dynamic_tv_updatetime;
public TextView dynamic_tv_content;
}
public MyAdapter(LayoutInflater inflater) {
this.mInflater = inflater;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return getData().size();
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return getData().get(position);
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = mInflater.inflate(R.layout.dynamic_state_item,
null);
holder.dynamic_ll = (LinearLayout) convertView
.findViewById(R.id.dynamic_state_ll_item);
holder.dynamic_tv_name = (TextView) convertView
.findViewById(R.id.dynamic_state_item_header_tv_name);
holder.dynamic_tv_device = (TextView) convertView
.findViewById(R.id.dynamic_state_item_header_tv_device);
holder.dynamic_tv_updatetime = (TextView) convertView
.findViewById(R.id.dynamic_state_item_header_tv_updatetime);
holder.dynamic_tv_content = (TextView) convertView
.findViewById(R.id.dynamic_state_item_content);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.dynamic_tv_name.setText(getData().get(position).get("name")
.toString());
holder.dynamic_tv_device.setText("来自"
+ getData().get(position).get("device").toString() + "客户端");
holder.dynamic_tv_updatetime.setText(getData().get(position)
.get("updatetime").toString());
holder.dynamic_tv_content.setText(getData().get(position)
.get("content").toString());
holder.dynamic_tv_content.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent=new Intent();
Bundle bundle=new Bundle();
bundle.putString("content", getData().get(position)
.get("content").toString());
intent.setClass(getActivity(), DynamicStateActivity.class);
intent.putExtras(bundle);
getActivity().startActivity(intent);
}
});
return convertView;
}
}
public ArrayList<HashMap<String, Object>> getData() {
ArrayList<HashMap<String, Object>> result = new ArrayList<HashMap<String, Object>>();
for (int i = 0; i < 20; i++) {
HashMap<String, Object> map = new HashMap<String, Object>();
String name = "herve" + i * 10;
String device = "";
String updatetime = "";
String content="";
int remainder = i % 4;
switch (remainder) {
case 0:
device = "android";
content="因连续收出六连阴,阳光电源(17.380, 0.75, 4.51%)成为最近一周跌幅最大的股票,周跌幅为15.42%,同期上证综指则上涨0.41%阳光电源主要产品有光伏逆变器、风能变流器、储能电源等。受到光伏产业遭遇寒冬的影响,公司今年下半年业绩表现不佳。10月14日,公司发布业绩预告显示,今年前三季度公司预计实现净利润1.2亿元~1.3亿元,同比增长约6.42%~15.28%。";
break;
case 1:
device = "mac";
content="每次一坐火车和飞机,要是忘了带午餐或者晚餐,就开始糟心。不管是高铁还是飞机,提供的主食简直就是对中餐的侮辱。无论是饭还是面,几乎就无法吃。配菜部分还过得去。今天出门又没带晚餐,在灰机上实在饿得头晕了,出机场买了个卷饼,立刻就补血了。";
break;
case 2:
device = "iphone";
content="小兄弟 我不想给你建议 $金枫酒业(SH600616)$ 你都看 无语了~";
break;
case 3:
device = "ipad";
content="完美告终";
break;
}
Date current = new Date();
current.setDate(current.getDate() - i);
current.setHours(current.getHours() - i);
SimpleDateFormat sDateFormat = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
String date = sDateFormat.format(current);
updatetime = date.toString().substring(5, 16);
map.put("name", name);
map.put("device", device);
map.put("updatetime", updatetime);
map.put("content", content);
result.add(map);
}
return result;
}
} | [
"[email protected]"
]
| |
2d6b9302f589e36d9ef3de6b0e5dacceb72f240d | 83067a37974c9d453e322dfb64cd88a81a1896cb | /whr/src/main/java/com/example/whr/controller/ConfigController.java | 0a0e158c0a4be598931e5de68c2bfd0e8293afc3 | []
| no_license | Maychunhuang/whr | 6c20673843f78a2b5232a6e6adfc761b0aaa82c0 | df37ac1a739d4df0940304217b6431dca66ded5b | refs/heads/master | 2022-12-12T12:21:28.517705 | 2020-11-15T09:03:18 | 2020-11-15T09:03:18 | 213,328,244 | 0 | 0 | null | 2022-12-11T08:29:19 | 2019-10-07T08:12:40 | JavaScript | UTF-8 | Java | false | false | 869 | java | package com.example.whr.controller;
import com.example.whr.common.HrUtils;
import com.example.whr.bean.Hr;
import com.example.whr.bean.Menu;
import com.example.whr.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author huangchunmei
* @create 2019/9/9 19:33
*/
@RestController
@RequestMapping("/config")
public class ConfigController {
@Autowired
private MenuService menuService;
/**
* 获取登录用户的菜单
*
* @return
*/
@GetMapping("/sysmenu")
public List<Menu> sysmenu() {
return menuService.getMenusByHrId();
}
/**
* 获取当前用户信息
*
* @return
*/
@RequestMapping("/hr")
public Hr currentHr() {
return HrUtils.getCurrentHr();
}
}
| [
"[email protected]"
]
| |
d4db96c0698310b10797675d1090f7eb2a4cd204 | a522fad022f5ddd407822224ca6e9b4936c7535b | /maui/MauiIOJmzTab/src/net/sf/maltcms/chromaui/project/spi/descriptors/mztab/containers/AssayContainer.java | 7ab9dbf4d2e687da9733c4efbd71e60673d71020 | []
| no_license | nilshoffmann/maui | 01154860f02618c50456036fac84f2660f8af0a6 | acf30360b4bbee5a0afb6514bb6693da9bd795e9 | refs/heads/master | 2021-01-22T09:01:12.758407 | 2021-01-15T07:31:43 | 2021-01-15T07:31:43 | 39,154,886 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,193 | java | /*
* Maui, Maltcms User Interface.
* Copyright (C) 2008-2014, The authors of Maui. All rights reserved.
*
* Project website: http://maltcms.sf.net
*
* Maui may be used under the terms of either the
*
* GNU Lesser General Public License (LGPL)
* http://www.gnu.org/licenses/lgpl.html
*
* or the
*
* Eclipse Public License (EPL)
* http://www.eclipse.org/org/documents/epl-v10.php
*
* As a user/recipient of Maui, you may choose which license to receive the code
* under. Certain files or entire directories may not be covered by this
* dual license, but are subject to licenses compatible to both LGPL and EPL.
* License exceptions are explicitly declared in all relevant files or in a
* LICENSE file in the relevant directories.
*
* Maui 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. Please consult the relevant license documentation
* for details.
*/
package net.sf.maltcms.chromaui.project.spi.descriptors.mztab.containers;
import java.util.SortedMap;
import net.sf.maltcms.chromaui.project.spi.descriptors.mztab.AssayDescriptor;
import uk.ac.ebi.pride.jmztab.model.Assay;
import uk.ac.ebi.pride.jmztab.model.Metadata;
/**
*
* @author Nils Hoffmann
*/
public class AssayContainer extends BasicMzTabMetaDataContainer<AssayDescriptor> {
private static final long serialVersionUID = -7058776893889924066L;
/**
*
* @param metadata
* @return
*/
public static AssayContainer create(Metadata metadata) {
AssayContainer c = new AssayContainer();
c.setLevel(2);
c.setName("assays");
c.setDisplayName("Assays");
SortedMap<Integer, Assay> map = metadata.getAssayMap();
for (Integer key : map.keySet()) {
AssayDescriptor d = new AssayDescriptor();
d.setAssay(map.get(key));
c.addMembers(d);
}
return c;
}
// @Override
// public JPanel createEditor() {
// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
// }
}
| [
"[email protected]"
]
| |
f4effe44520a184baa0518f4cec08125f7b3acbf | 7f0a642f55066d62473fc7c6e8e461a573188be1 | /java/main/java/quartz/TestJob.java | 38cfab070ae23fe47be9ddb649ed51353589a620 | []
| no_license | mianghaha/test | ca0b96e4e2294f06d2409dbf12da1869110a9124 | 3db2a4e8cac9668f9f8e82c4ca1a1002a0f76a1e | refs/heads/master | 2022-07-14T01:37:19.559376 | 2020-10-26T03:50:37 | 2020-10-26T03:50:37 | 184,978,975 | 0 | 0 | null | 2022-07-01T17:41:56 | 2019-05-05T04:24:20 | Java | UTF-8 | Java | false | false | 1,032 | java | package quartz;
import java.util.Date;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.JobKey;
import utils.DateUtil;
public class TestJob implements Job{
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
System.out.println(DateUtil.transToString(new Date()) + ",gameId=" + context.getMergedJobDataMap().get("gameId"));
String jobName = (String) context.getMergedJobDataMap().get("repeatJobName");
if(jobName == null) {
JobKey key = context.getJobDetail().getKey();
jobName = key.getName() + "_repeat";
String jobGroup = key.getGroup() + "_repeat";;
String triggerName = jobName + "_trigger";
String triggerGroup = jobGroup + "_trigger";
context.getMergedJobDataMap().put("repeatJobName", jobName);
TaskManager.addTask(jobName, jobGroup, triggerName, triggerGroup, new Date(), 5000L, 3, this.getClass(),
context.getMergedJobDataMap());
}
}
}
| [
"[email protected]"
]
| |
6932f501b50088d59d86468e3be3b85744e55e87 | 44e5a256fef6f99e87b5649527944678091d8bb7 | /main/boofcv-geo/src/test/java/boofcv/alg/geo/robust/TestDistanceSe3SymmetricSq.java | 54b63541dd647123997f32c4c2e5c8eb60a37431 | [
"LicenseRef-scancode-takuya-ooura",
"Apache-2.0"
]
| permissive | lessthanoptimal/BoofCV | 3aa27e99056ce3c42814fddb013d6404bd9bdcad | 24adbeee4fc1371face00b4c5cacb99c0398de55 | refs/heads/SNAPSHOT | 2023-09-01T11:14:56.219779 | 2023-08-31T14:16:30 | 2023-08-31T14:16:30 | 1,635,932 | 955 | 264 | null | 2023-09-10T02:12:28 | 2011-04-19T14:51:10 | Java | UTF-8 | Java | false | false | 8,353 | java | /*
* Copyright (c) 2023, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
* 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 boofcv.alg.geo.robust;
import boofcv.abst.geo.Triangulate2ViewsMetricH;
import boofcv.alg.geo.PerspectiveOps;
import boofcv.factory.geo.ConfigTriangulation;
import boofcv.factory.geo.FactoryMultiView;
import boofcv.struct.calib.CameraPinhole;
import boofcv.struct.geo.AssociatedPair;
import boofcv.testing.BoofStandardJUnit;
import georegression.geometry.GeometryMath_F64;
import georegression.metric.ClosestPoint3D_F64;
import georegression.struct.EulerType;
import georegression.struct.line.LineParametric3D_F64;
import georegression.struct.point.Point3D_F64;
import georegression.struct.point.Point4D_F64;
import georegression.struct.se.Se3_F64;
import georegression.transform.se.SePointOps_F64;
import org.ejml.UtilEjml;
import org.ejml.data.DMatrixRMaj;
import org.ejml.dense.row.CommonOps_DDRM;
import org.junit.jupiter.api.Test;
import static georegression.geometry.ConvertRotation3D_F64.eulerToMatrix;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class TestDistanceSe3SymmetricSq extends BoofStandardJUnit {
Triangulate2ViewsMetricH triangulate = FactoryMultiView.triangulate2ViewMetricH(
new ConfigTriangulation(ConfigTriangulation.Type.GEOMETRIC));
DistanceSe3SymmetricSq alg;
public TestDistanceSe3SymmetricSq() {
alg = new DistanceSe3SymmetricSq(triangulate);
alg.setIntrinsic(0, new CameraPinhole(1, 1, 0, 0, 0, 0, 0));
alg.setIntrinsic(1, new CameraPinhole(1, 1, 0, 0, 0, 0, 0));
}
/**
* Nominal case with an easily computed solution.
*/
@Test void perfect_nominal() {
Se3_F64 keyToCurr = new Se3_F64();
keyToCurr.getR().setTo(eulerToMatrix(EulerType.XYZ, 0.05, -0.03, 0.02, null));
keyToCurr.getT().setTo(0.1, -0.1, 0.01);
Point3D_F64 X = new Point3D_F64(0.1, -0.05, 3);
AssociatedPair obs = new AssociatedPair();
obs.p1.x = X.x/X.z;
obs.p1.y = X.y/X.z;
SePointOps_F64.transform(keyToCurr, X, X);
obs.p2.x = X.x/X.z;
obs.p2.y = X.y/X.z;
alg.setModel(keyToCurr);
assertEquals(0, alg.distance(obs), 1e-8);
}
/**
* Pure rotation with perfect observations. This is undefined. The intersection of the two rays will be at
* the camera's origin.
*/
@Test void pureRotation_perfectObservations() {
Se3_F64 keyToCurr = new Se3_F64();
keyToCurr.getR().setTo(eulerToMatrix(EulerType.XYZ, 0.0, 0.05, 0.00, null));
Point3D_F64 X = new Point3D_F64(0.1, -0.05, 3);
AssociatedPair obs = new AssociatedPair();
obs.p1.x = X.x/X.z;
obs.p1.y = X.y/X.z;
SePointOps_F64.transform(keyToCurr, X, X);
obs.p2.x = X.x/X.z;
obs.p2.y = X.y/X.z;
alg.setModel(keyToCurr);
assertEquals(Double.MAX_VALUE, alg.distance(obs), UtilEjml.TEST_F64);
}
/**
* Translation will be very small here. That should be enough that it doesn't intersect at the origin and
* a pixel value can be found
*/
@Test void nearlyPureRotation() {
Se3_F64 keyToCurr = new Se3_F64();
keyToCurr.getR().setTo(eulerToMatrix(EulerType.XYZ, 0.0, 0.2, 0.00, null));
keyToCurr.getT().setTo(1e-4, 0.0, 0.0);
var X = new Point3D_F64(1e3, -0.05, 1e4);
AssociatedPair obs = new AssociatedPair();
obs.p1.x = X.x/X.z;
obs.p1.y = X.y/X.z;
SePointOps_F64.transform(keyToCurr, X, X);
obs.p2.x = X.x/X.z;
obs.p2.y = X.y/X.z;
alg.setModel(keyToCurr);
assertEquals(0.0, alg.distance(obs), UtilEjml.TEST_F64);
}
@Test void noisy() {
Se3_F64 keyToCurr = new Se3_F64();
keyToCurr.getR().setTo(eulerToMatrix(EulerType.XYZ, 0.05, -0.03, 0.02, null));
keyToCurr.getT().setTo(0.1, -0.1, 0.01);
Point3D_F64 X = new Point3D_F64(0.1, -0.05, 3);
AssociatedPair obs = new AssociatedPair();
obs.p1.x = X.x/X.z;
obs.p1.y = X.y/X.z;
SePointOps_F64.transform(keyToCurr, X, X);
obs.p2.x = X.x/X.z + 1;
obs.p2.y = X.y/X.z + 1;
alg.setModel(keyToCurr);
assertTrue(alg.distance(obs) > 1e-8);
}
@Test void behindCamera() {
Se3_F64 keyToCurr = new Se3_F64();
keyToCurr.getR().setTo(eulerToMatrix(EulerType.XYZ, 0.05, -0.03, 0.02, null));
keyToCurr.getT().setTo(0.1, -0.1, 0.01);
Point3D_F64 X = new Point3D_F64(0.1, -0.05, -3);
AssociatedPair obs = new AssociatedPair();
obs.p1.x = X.x/X.z;
obs.p1.y = X.y/X.z;
SePointOps_F64.transform(keyToCurr, X, X);
obs.p2.x = X.x/X.z;
obs.p2.y = X.y/X.z;
alg.setModel(keyToCurr);
assertEquals(Double.MAX_VALUE, alg.distance(obs));
}
/**
* The point will be very close to infinity but behind the camera
*/
@Test void behind_nearlyPureRotation() {
Se3_F64 keyToCurr = new Se3_F64();
keyToCurr.getR().setTo(eulerToMatrix(EulerType.XYZ, 0.0, 0.05, 0.00, null));
keyToCurr.getT().setTo(1e-4, 0.0, 0.0);
Point3D_F64 X = new Point3D_F64(0.1, -0.05, -1e4);
AssociatedPair obs = new AssociatedPair();
obs.p1.x = X.x/X.z;
obs.p1.y = X.y/X.z;
SePointOps_F64.transform(keyToCurr, X, X);
obs.p2.x = X.x/X.z;
obs.p2.y = X.y/X.z;
alg.setModel(keyToCurr);
assertEquals(Double.MAX_VALUE, alg.distance(obs));
}
/**
* Manually compute the error using a calibration matrix and see if they match
*/
@Test void intrinsicParameters() {
// intrinsic camera calibration matrix
DMatrixRMaj K1 = new DMatrixRMaj(3, 3, true, 100, 0.01, 200, 0, 150, 200, 0, 0, 1);
DMatrixRMaj K2 = new DMatrixRMaj(3, 3, true, 105, 0.021, 180, 0, 155, 210, 0, 0, 1);
DMatrixRMaj K1_inv = new DMatrixRMaj(3, 3);
DMatrixRMaj K2_inv = new DMatrixRMaj(3, 3);
CommonOps_DDRM.invert(K1, K1_inv);
CommonOps_DDRM.invert(K2, K2_inv);
Se3_F64 keyToCurr = new Se3_F64();
keyToCurr.getT().setTo(0.1, -0.1, 0.01);
Point4D_F64 X = new Point4D_F64(0.02, -0.05, 3, 1.0);
AssociatedPair obs = new AssociatedPair();
AssociatedPair obsP = new AssociatedPair();
obs.p1.x = X.x/X.z;
obs.p1.y = X.y/X.z;
SePointOps_F64.transform(keyToCurr, X, X);
obs.p2.x = X.x/X.z;
obs.p2.y = X.y/X.z;
// translate into pixels
GeometryMath_F64.mult(K1, obs.p1, obsP.p1);
GeometryMath_F64.mult(K2, obs.p2, obsP.p2);
// add some noise
obsP.p1.x += 0.25;
obsP.p1.y += 0.25;
obsP.p2.x -= 0.25;
obsP.p2.y -= 0.25;
// convert noisy into normalized coordinates
GeometryMath_F64.mult(K1_inv, obsP.p1, obsP.p1);
GeometryMath_F64.mult(K2_inv, obsP.p2, obsP.p2);
// triangulate the point's position given noisy data
LineParametric3D_F64 rayA = new LineParametric3D_F64();
LineParametric3D_F64 rayB = new LineParametric3D_F64();
rayA.slope.setTo(obsP.p1.x, obsP.p1.y, 1);
rayB.p.setTo(-0.1, 0.1, -0.01);
rayB.slope.setTo(obsP.p2.x, obsP.p2.y, 1);
ClosestPoint3D_F64.closestPoint(rayA, rayB, X);
// compute predicted given noisy triangulation
AssociatedPair ugh = new AssociatedPair();
ugh.p1.x = X.x/X.z;
ugh.p1.y = X.y/X.z;
SePointOps_F64.transform(keyToCurr, X, X);
ugh.p2.x = X.x/X.z;
ugh.p2.y = X.y/X.z;
// convert everything into pixels
GeometryMath_F64.mult(K1, ugh.p1, ugh.p1);
GeometryMath_F64.mult(K2, ugh.p2, ugh.p2);
GeometryMath_F64.mult(K1, obsP.p1, obsP.p1);
GeometryMath_F64.mult(K2, obsP.p2, obsP.p2);
double dx1 = ugh.p1.x - obsP.p1.x;
double dy1 = ugh.p1.y - obsP.p1.y;
double dx2 = ugh.p2.x - obsP.p2.x;
double dy2 = ugh.p2.y - obsP.p2.y;
double error = dx1*dx1 + dy1*dy1 + dx2*dx2 + dy2*dy2;
// convert noisy back into normalized coordinates
GeometryMath_F64.mult(K1_inv, obsP.p1, obsP.p1);
GeometryMath_F64.mult(K2_inv, obsP.p2, obsP.p2);
DistanceSe3SymmetricSq alg = new DistanceSe3SymmetricSq(triangulate);
alg.setIntrinsic(0, PerspectiveOps.matrixToPinhole(K1, 0, 0, null));
alg.setIntrinsic(1, PerspectiveOps.matrixToPinhole(K2, 0, 0, null));
alg.setModel(keyToCurr);
assertEquals(error, alg.distance(obsP), 1e-8);
}
}
| [
"[email protected]"
]
| |
7a376aee2423f351e951a90854b185cbeea6776b | a89b128e594f0f5e1c1af2c9e2357b93ca3c3a02 | /src/applicacao/AplicacaoConsole1.java | f9e8ee5d1d5707f7e3a036c350ffb9e99ce04236 | [
"MIT"
]
| permissive | pauloprojject/JavaProject | 8ad0643ede470cda79951fb6630988363e03edaf | 56e50de9c3b4eeeeba2e9c11f1c0d22bab4bdb0c | refs/heads/main | 2023-05-02T14:54:02.136952 | 2021-05-24T00:02:14 | 2021-05-24T00:02:14 | 368,633,369 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 4,051 | java | package applicacao;
import java.time.LocalDate;
import java.util.ArrayList;
import facade.Fachada;
import classes.Conta;
import classes.ContaEspecial;
import classes.Correntista;
import classes.Lancamento;
public class AplicacaoConsole1 {
public AplicacaoConsole1() {
try {
Conta conta;
ContaEspecial contaesp;
conta = Fachada.criarConta("1", "111.111.001", "9999001", "joao@ifpb", "joao");
conta = Fachada.criarConta("2", "111.111.002", "9999002", "maria@ifpb", "maria");
contaesp = Fachada.criarConta("3", 100.0, "111.111.003", "9999003", "ana@ifpb", "ana");
contaesp = Fachada.criarConta("4", 100.0, "111.111.004", "9999004", "paulo@ifpb", "paulo");
Fachada.creditar("111.111.001", 500);
Fachada.creditar("111.111.002", 500);
Fachada.creditar("111.111.003", 500);
Fachada.creditar("111.111.004", 500);
Fachada.criarChave("111.111.001","cpf");
Fachada.criarChave("111.111.002","telefone");
Fachada.criarChave("111.111.003","email");
Fachada.criarChave("111.111.004","aleatorio");
System.out.println("\n---------listagem geral de contas");
for(Conta c : Fachada.listarContas())
System.out.println(c);
System.out.println("\n---------listagem geral de correntistas");
for(Correntista cor : Fachada.listarCorrentistas())
System.out.println(cor);
System.out.println("\n---------listagem geral de lançamentos");
for(Lancamento lan : Fachada.listarLancamentos())
System.out.println(lan);
String chavealeatorio = Fachada.obterConta("111.111.004").getChavePiks();
Fachada.transferir("111.111.001", "9999002", 100); //joao para maria
Fachada.transferir("111.111.001", "ana@ifpb", 100); //joao para ana
Fachada.transferir("111.111.002", "ana@ifpb", 500); //maria para ana
Fachada.transferir("111.111.003", "111.111.001", 600); //ana para joao
Fachada.transferir("111.111.003", chavealeatorio, 100); //ana para paulo
Conta contatop = Fachada.obterContaTop();
System.out.println("\nconta top="+contatop);
//Fachada.apagarConta("111.111.001");
Fachada.criarChave("111.111.002","aleatorio");
System.out.println("\n---------listagem geral de contas");
for(Conta c : Fachada.listarContas())
System.out.println(c);
System.out.println("\n---------listagem geral de correntistas");
for(Correntista cor : Fachada.listarCorrentistas())
System.out.println(cor);
System.out.println("\n---------listagem geral de lançamentos");
for(Lancamento lan : Fachada.listarLancamentos())
System.out.println(lan);
} catch (Exception e) {
System.out.println("--->"+e.getMessage());
}
//****************
testarExcecoes();
//****************
}
public static void testarExcecoes() {
System.out.println("\n-------TESTE EXCEÇÕES LANÇADAS--------");
try {
Fachada.criarConta("2", "111.111.002", "9999002", "maria@ifpb", "maria");
System.out.println("*************1Nao lançou exceção para: criar conta existente ");
}catch (Exception e) {System.out.println("1ok--->"+e.getMessage());}
try {
Fachada.transferir("111.111.002", "111.111.002", 500);
System.out.println("*************2Nao lançou exceção para: chave inexistente");
}catch (Exception e) {System.out.println("2ok--->"+e.getMessage());}
try {
Fachada.transferir("111.111.002", "9999002", 500);
System.out.println("*************3Nao lançou exceção: conta destino igual a conta origem");
}catch (Exception e) {System.out.println("3ok--->"+e.getMessage());}
try {
Fachada.transferir("111.111.004", "ana@ifpb", 2000);
System.out.println("*************4Nao lançou exceção: sem saldo");
}catch (Exception e) {System.out.println("4ok--->"+e.getMessage());}
try {
Fachada.apagarConta("111.111.004");
System.out.println("*************5Nao lançou exceção: saldo deve ser zero");
}catch (Exception e) {System.out.println("5ok--->"+e.getMessage());}
}
public static void main (String[] args) {
AplicacaoConsole1 aplicacaoConsole1 = new AplicacaoConsole1();
}
}
| [
"[email protected]"
]
| |
338845026b3ee9e7cc4e65235075f5c9d97055b9 | 7fb33561361fa9de8f59a6a936da6b0c61287634 | /trendParentProject/index-data-service/src/main/java/cn/how2j/trend/pojo/IndexData.java | a3369d886b80a3edd031a6f667554e0eb25393fb | []
| no_license | laogui1999/trendParentProject | 711fb1fe2c195468e17dcb969e16ab8a67e1486e | fe44a127f3b5a4c6fc446700cdcef05dce77cb97 | refs/heads/master | 2020-09-08T17:33:13.357099 | 2019-11-13T09:32:56 | 2019-11-13T09:32:56 | 221,197,030 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 462 | java | package cn.how2j.trend.pojo;
/**
* 实体类
* @author laogui1999
*
*/
public class IndexData {
String date;
float closePoint;
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public float getClosePoint() {
return closePoint;
}
public void setClosePoint(float closePoint) {
this.closePoint = closePoint;
}
} | [
"[email protected]"
]
| |
b8b34219cb3b5e0d82d46568d7f4c919d639c4b3 | 5659640e6ce3c808f4eac5ccc7a984ca4d436e35 | /src/main/java/com/allqj/virtual_number_administrate/business/baseService/impl/elasticsearch/VirtualNumberBindingInfoDeleteToEsBaseServiceImpl.java | 87ccfce79b94fa47fa95980579b28f2bf25d00c9 | []
| no_license | ydtong/hello | 04dc8fbde401c3a761c0b736efcdd7905e8ba4cf | aa50de3fb525e2d73daa123c0529e8299134d985 | refs/heads/master | 2022-06-05T23:45:58.092920 | 2019-08-16T03:44:03 | 2019-08-16T03:44:03 | 202,690,993 | 0 | 0 | null | 2022-05-20T21:06:43 | 2019-08-16T08:36:50 | JavaScript | UTF-8 | Java | false | false | 1,543 | java | package com.allqj.virtual_number_administrate.business.baseService.impl.elasticsearch;
import com.allqj.virtual_number_administrate.business.baseService.IModifyBaseService;
import com.allqj.virtual_number_administrate.business.repository.elasticsearch.IVirtualNumberBindingInfoEsRepository;
import com.allqj.virtual_number_administrate.business.repository.elasticsearch.entity.VirtualNumberBindingInfoEsEntity;
import com.allqj.virtual_number_administrate.business.repository.mysql.entity.VirtualNumberBindingInfoMysqlEntity;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
/**
* 取消绑定关系到es
*/
@Service
public class VirtualNumberBindingInfoDeleteToEsBaseServiceImpl implements IModifyBaseService<VirtualNumberBindingInfoMysqlEntity, VirtualNumberBindingInfoEsEntity> {
@Autowired
private IVirtualNumberBindingInfoEsRepository virtualNumberBindingInfoEsRepository;
@Override
@SuppressWarnings("all")
public VirtualNumberBindingInfoEsEntity modify(VirtualNumberBindingInfoMysqlEntity virtualNumberBindingInfoMysqlEntity, Integer virtualNumberType) {
VirtualNumberBindingInfoEsEntity virtualNumberBindingInfoEsEntity = new VirtualNumberBindingInfoEsEntity();
BeanUtils.copyProperties(virtualNumberBindingInfoMysqlEntity, virtualNumberBindingInfoEsEntity);
return virtualNumberBindingInfoEsRepository.save(virtualNumberBindingInfoEsEntity);
}
}
| [
"“[email protected]”"
]
| |
e51fb56af04abbdf37391c3d2ad45ff0e1f1d3a5 | 2312f07ef2524597a00ac84c5537563f950690f7 | /galaxy_wallpaper/src/main/java/com/kinglloy/wallpaper/galaxy_13/ProviderImpl.java | c7bc52c92c28d31dfbac3229d19b04405141fc97 | []
| no_license | jinkg/ETW_Components | 6cd1ed14c334779947f09d9e8609552cf9ecfbdd | b16fb28acd4b3e0c68ffd1dbeeb567b6c0371dbc | refs/heads/master | 2021-05-07T06:29:01.507396 | 2018-09-26T12:44:26 | 2018-09-26T12:44:28 | 111,760,297 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 563 | java | package com.kinglloy.wallpaper.galaxy_13;
import android.content.Context;
import android.service.wallpaper.WallpaperService;
import com.maxelus.galaxypacklivewallpaper.config.GalaxyConfig;
import com.yalin.style.engine.IProvider;
/**
* @author jinyalin
* @since 2017/7/28.
*/
public class ProviderImpl implements IProvider {
@Override
public WallpaperService provideProxy(Context host) {
GalaxyConfig.galaxyType = 13;
GalaxyConfig.galaxyBg = 1;
return new com.maxelus.galaxypacklivewallpaper.WallpaperService(host);
}
}
| [
"[email protected]"
]
| |
d433ac77c21e08eb469bfbe59f99c31664a07080 | 7ba63dcac671954f003e03b43f3048aaa5924e87 | /weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpDepartmentService.java | f981f0352611637273e883c0c8c738741eb93ba0 | [
"Apache-2.0"
]
| permissive | heaiso1985/weixin-java-tools | f125212769c714168ae5810a8692e020baae0328 | 9b29c3bef96346c0200eb14f3cda743dafc75e3c | refs/heads/master | 2021-05-09T01:01:42.191339 | 2018-06-14T08:01:42 | 2018-06-14T08:01:42 | 119,766,827 | 1 | 0 | Apache-2.0 | 2018-06-14T08:01:43 | 2018-02-01T01:39:10 | Java | UTF-8 | Java | false | false | 1,635 | java | package me.chanjar.weixin.cp.api;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.cp.bean.WxCpDepart;
import java.util.List;
/**
* <pre>
* 部门管理接口
* Created by BinaryWang on 2017/6/24.
* </pre>
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
*/
public interface WxCpDepartmentService {
/**
* <pre>
* 部门管理接口 - 创建部门
* 最多支持创建500个部门
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=部门管理接口
* </pre>
*
* @param depart 部门
* @return 部门id
*/
Integer create(WxCpDepart depart) throws WxErrorException;
/**
* <pre>
* 部门管理接口 - 查询部门
* 详情请见: http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E9%83%A8%E9%97%A8#.E8.8E.B7.E5.8F.96.E9.83.A8.E9.97.A8.E5.88.97.E8.A1.A8
* </pre>
* @param id 部门id。获取指定部门及其下的子部门。非必需,可为null
*/
List<WxCpDepart> list(Integer id) throws WxErrorException;
/**
* <pre>
* 部门管理接口 - 修改部门名
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=部门管理接口
* 如果id为0(未部门),1(黑名单),2(星标组),或者不存在的id,微信会返回系统繁忙的错误
* </pre>
*
* @param group 要更新的group,group的id,name必须设置
*/
void update(WxCpDepart group) throws WxErrorException;
/**
* <pre>
* 部门管理接口 - 删除部门
* </pre>
*
* @param departId 部门id
*/
void delete(Integer departId) throws WxErrorException;
}
| [
"[email protected]"
]
| |
0c809ec148c1b088e2e5b8fec7eb7225b6ac9daa | bd681d34c40f5337b212816dda9ab1f7762bf4c1 | /src/cn/edu/jxnu/leetcode/scala/package-info.java | 9e39f2391a44291c1fdbb57b6b4d02e461f84d28 | []
| no_license | fun14512/Java-Learning-Summary | 9c5763b9db22c2b3f36ce8e8137ac4fe679a2515 | 57b195b008a589ec677b9cf2f247ce2c59d367ab | refs/heads/master | 2020-04-26T16:22:06.659832 | 2019-02-26T05:04:42 | 2019-02-26T05:04:42 | 173,675,863 | 1 | 0 | null | 2019-03-04T04:51:17 | 2019-03-04T04:51:16 | null | UTF-8 | Java | false | false | 394 | java | package cn.edu.jxnu.leetcode.scala;
/**
* scala 版 本库的Scala写法不唯一,随性,无标准
*
* 导入的时候可能出现错误,直接在propblems中把errors给delete掉即可,不影响
*
* PS:整个仓库是Java项目+Maven+Scala库环境,出现导入问题很正常
*
* 可以的话考虑单独新建scala项目即可【此时不需要maven编译插件了】
*/ | [
"[email protected]"
]
| |
ad437d6e98d18f4b9b0a93234f9b63d53c82f24e | 2c40f6a2a0bd714eaec17e6df82044e5797d1825 | /src/main/java/com/ztesoft/framework/cipher/digest/CipherDigest.java | 1a00bc6744d09f4750635cab185bf60d225ed6c8 | []
| no_license | xishuai392/info | d56bf2ab7dc8bc14c869b7b8ef0fcea670300d3a | 8df5f015c8aff4d3d79943705b74e03f0c818d4f | refs/heads/master | 2020-05-21T23:33:40.378544 | 2016-12-04T16:01:57 | 2016-12-04T16:01:57 | 39,788,628 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,056 | java | package com.ztesoft.framework.cipher.digest;
import java.security.Key;
import java.security.KeyPair;
import java.util.HashMap;
import java.util.Map;
import com.ztesoft.framework.cipher.arithmetic.Base64It;
import com.ztesoft.framework.cipher.arithmetic.DESIt;
import com.ztesoft.framework.cipher.arithmetic.MD5It;
import com.ztesoft.framework.cipher.arithmetic.RSAIt;
import com.ztesoft.framework.cipher.arithmetic.SHAIt;
import com.ztesoft.framework.cipher.handle.AsymmericEncryptionHandle;
import com.ztesoft.framework.cipher.handle.EncryptionHandle;
import com.ztesoft.framework.cipher.handle.SymmericEncryptionHandle;
import com.ztesoft.framework.log.ZTEsoftLogManager;
/**
* 获取加密、解密Digest
*
* @author wang.zhenying
*
*/
public class CipherDigest implements AsymmericEncryptionHandle,
EncryptionHandle, SymmericEncryptionHandle {
/** 日志对象 */
private static final ZTEsoftLogManager logger = ZTEsoftLogManager.getLogger(CipherDigest.class);
/**
* digestMap
*/
private static Map digestMap = new HashMap();
/**
* 锁
*/
private static byte[] rwLock = new byte[0];
/**
* 是否初始化
*/
private static boolean isInitDigestMap = false;
/**
* 无密钥算法
*/
private EncryptionHandle encryptionHandle = null;
/**
* 有密钥非对称算法处理
*/
private AsymmericEncryptionHandle asymmericEncryptionHandle = null;
/**
* 有密钥对称算法
*/
private SymmericEncryptionHandle symmericEncryptionHandle = null;
/**
* 算法名
*/
private String name = null;
/**
* 构造函数
* @param name 算法名
*/
protected CipherDigest(String name) {
this(name, null, null, null);
}
/**
* 构造函数
* @param name 算法名
* @param encryptionHandle 无密钥算法
*/
protected CipherDigest(String name, EncryptionHandle encryptionHandle) {
this(name, encryptionHandle, null, null);
}
/**
* 构造函数
* @param name 算法名
* @param symmericEncryptionHandle 有密钥对称算法
*/
protected CipherDigest(String name,
SymmericEncryptionHandle symmericEncryptionHandle) {
this(name, null, null, symmericEncryptionHandle);
}
/**
* 构造函数
* @param name 算法名
* @param asymmericEncryptionHandle 有密钥非对称算法
*/
protected CipherDigest(String name,
AsymmericEncryptionHandle asymmericEncryptionHandle) {
this(name, null, asymmericEncryptionHandle, null);
}
/**
* 构造函数
* @param name 算法名
* @param encryptionHandle 无密钥算法
* @param asymmericEncryptionHandle 有密钥非对称算法
* @param symmericEncryptionHandle 有密钥对称算法
*/
protected CipherDigest(String name, EncryptionHandle encryptionHandle,
AsymmericEncryptionHandle asymmericEncryptionHandle,
SymmericEncryptionHandle symmericEncryptionHandle) {
setName(name);
setEncryptionHandle(encryptionHandle);
setAsymmericEncryptionHandle(asymmericEncryptionHandle);
setSymmericEncryptionHandle(symmericEncryptionHandle);
}
/**
* 获取Digest实例
*
* @param cryptDigestName 加密器名
* @return CipherDigest 加密器
*/
public static CipherDigest instance(String cryptDigestName) {
registerAllDigest();
CipherDigest digest = null;
synchronized (rwLock) {
digest = (CipherDigest) digestMap.get(cryptDigestName);
}
return digest;
}
/**
* 注册所有的Digest
*
* @return boolean 是否加载成功
*/
private static boolean registerAllDigest() {
if (!isInitDigestMap) {
//
synchronized (rwLock) {
registerDigest(new CipherDigest("base64Digest", new Base64It()));
registerDigest(new CipherDigest("desDigest", new DESIt()));
registerDigest(new CipherDigest("md5Digest", new MD5It()));
registerDigest(new CipherDigest("rsaDigest", new RSAIt()));
registerDigest(new CipherDigest("shaDigest", new SHAIt()));
}
isInitDigestMap = true;
return true;
}
else {
return false;
}
}
/**
* 注册Digest
*
* @param digestImpl 加密器
* @return boolean 是否注册成功
*/
public static boolean registerDigest(CipherDigest digestImpl) {
if (digestImpl != null) {
String digestName = ((CipherDigest) digestImpl).getName();
digestMap.put(digestName, digestImpl);
return true;
}
else {
return false;
}
}
protected void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public EncryptionHandle getHandle() {
return encryptionHandle;
}
public void setEncryptionHandle(EncryptionHandle encryptionHandle) {
this.encryptionHandle = encryptionHandle;
}
public void setAsymmericEncryptionHandle(
AsymmericEncryptionHandle asymmericEncryptionHandle) {
this.asymmericEncryptionHandle = asymmericEncryptionHandle;
}
public void setSymmericEncryptionHandle(
SymmericEncryptionHandle symmericEncryptionHandle) {
this.symmericEncryptionHandle = symmericEncryptionHandle;
}
public byte[] encrypt(byte[] bInput) {
if (encryptionHandle != null) {
return encryptionHandle.encrypt(bInput);
}
else {
logger.error(getName()
+ " not support this operation! because encryptionHandle is null! by encrypt(byte[] bInput) ");
throw new UnsupportedOperationException(getName()
+ " not support this operation because " + getName()
+ " is not {SHA,MD5,Base64} ! ");
}
}
public byte[] decrypt(byte[] bInput) {
if (encryptionHandle != null) {
return encryptionHandle.decrypt(bInput);
}
else {
logger.error(getName()
+ " not support this operation! because encryptionHandle is null! by decrypt(byte[] bInput) ");
throw new UnsupportedOperationException(getName()
+ " not support this operation because " + getName()
+ " is not {SHA,MD5,Base64} ! ");
}
}
public byte[] encrypt(byte[] sInput, Key encryptKey) {
if (asymmericEncryptionHandle != null) {
return asymmericEncryptionHandle.encrypt(sInput, encryptKey);
}
if (symmericEncryptionHandle != null) {
return symmericEncryptionHandle.encrypt(sInput, encryptKey);
}
else {
logger.error(getName()
+ " not support this operation! because asymmericEncryptionHandle is null and symmericEncryptionHandle is null ! by encrypt(byte[] sInput, Key encryptKey) ");
throw new UnsupportedOperationException(getName()
+ " not support this operation because " + getName()
+ " is not an asymmetric or symmetric algorithm ! ");
}
}
public KeyPair generateAsymmericKey() {
if (asymmericEncryptionHandle != null) {
return asymmericEncryptionHandle.generateAsymmericKey();
}
else {
throw new UnsupportedOperationException(getName()
+ " not support this operation because " + getName()
+ " is not an asymmetric algorithm ! ");
}
}
public byte[] decrypt(byte[] sInput, Key decryptKey) {
if (symmericEncryptionHandle != null) {
return symmericEncryptionHandle.decrypt(sInput, decryptKey);
}
if (asymmericEncryptionHandle != null) {
return asymmericEncryptionHandle.decrypt(sInput, decryptKey);
}
else {
throw new UnsupportedOperationException(getName()
+ " not support this operation because " + getName()
+ " is not an algorithm ! ");
}
}
public Key generateSymmetricKey() {
if (symmericEncryptionHandle != null) {
return symmericEncryptionHandle.generateSymmetricKey();
}
else {
throw new UnsupportedOperationException(getName()
+ " not support this operation because " + getName()
+ " is not an symmetric algorithm ! ");
}
}
}
| [
"[email protected]"
]
| |
65618c13ff4816b6863bed0951af07e5aea34023 | 5818466dde2b62296e3fbab988f8a70938e40fc4 | /Selenium_learning/src/firefox_proj.java | 9ade9a098b10b4c6dabe77f338066ccbf9a36555 | []
| no_license | AmrutaKendre/Hybrid-project | d64b1455c4a90d71f9f4d9ccfbc51b777ecb8904 | 9cb3e082512ac69937cdc8f12c8854983c5d171d | refs/heads/master | 2023-02-04T14:48:57.665305 | 2020-12-24T11:11:59 | 2020-12-24T11:11:59 | 322,491,848 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 298 | java | import org.openqa.selenium.chrome.ChromeDriver;
public class firefox_proj {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "./Drivers/chromedriver.exe");
ChromeDriver driver = new ChromeDriver();
driver.get("http://www.facebook.com");
}
}
| [
"[email protected]"
]
| |
70355097b37cf0fc7765fcb3ef6becb69a926c23 | 3d9723f237c84cb09566e7e469f1dd9f9065a033 | /src/main/java/com/sell/controller/testController.java | 81247a5eaa029e0887177813df7420ce8657f6b0 | []
| no_license | yangyangsmile/sell | 5ec9d9d5fa7205f4c7f7e4e8640cbb27ff78148f | 0aa86d0097ac5eda81401900014379570c90171a | refs/heads/master | 2021-09-08T01:54:15.980183 | 2018-01-01T16:09:53 | 2018-01-01T16:09:53 | 113,253,249 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,040 | java | package com.sell.controller;
import com.sell.dto.User;
import com.sell.dto.UserFrom;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* Created by Administrator on 2017/9/19.
*/
@Controller
public class testController {
@RequestMapping("baseType")
@ResponseBody
public String baseType(int age) {
return "age" + age;
}
@RequestMapping(value="array.do")
@ResponseBody
public String baseType(String[] age) {
StringBuffer stringBuffer = new StringBuffer();
for (String item : age) {
stringBuffer.append(item);
}
return stringBuffer.toString();
}
@RequestMapping(value="object.do")
@ResponseBody
public String baseType(User user) {
return user.toString();
}
@RequestMapping(value="list.do")
@ResponseBody
public String baseType(UserFrom user) {
return user.toString();
}
}
| [
"[email protected]"
]
| |
a59c5b2d20c49089ab563f09a5f824226d7121a5 | f87a15dbd036962c651dd6de36e0f6e812b1d47c | /src/main/java/cn/deal/component/CustomerFilterComponent.java | c4bcd1cb76f237fa4059c9f0a99df31b3f1a7a85 | []
| no_license | kkb-deal/deal-core2-server | 4c63472436c1eab3a8b1136e281535aeb59145b3 | b7f59a03c599c0116a7cbe5797ce090aff009e15 | refs/heads/master | 2023-02-25T06:16:05.447698 | 2021-01-24T03:28:14 | 2021-01-24T03:28:14 | 330,344,491 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,795 | java | package cn.deal.component;
import cn.deal.component.domain.filter.CustomerFilter;
import cn.deal.component.utils.JsonUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import java.io.IOException;
@Component
public class CustomerFilterComponent {
private Logger logger = LoggerFactory.getLogger(CustomerFilterComponent.class);
@Value("${deal.filter.server.inner.url}")
private String dealFilterServerInnerURL;
@Autowired
private RestTemplate restTemplate;
/**
* 根据filterId获取筛选条件
* @param appId
* @param filterId
* @return
* @throws IOException
*/
public CustomerFilter getCustomerFilterByFilterId(String appId, String filterId) throws IOException {
String url = dealFilterServerInnerURL + "api/v1.0/app/" + appId + "/filter/" + filterId;
logger.info("getFilterByFilterIdApiURL:{}", url);
String result = null;
try{
result = restTemplate.getForObject(url, String.class);
logger.info("getFilterByFilterIdResultFailed: {}", result);
} catch (Exception e){
logger.error("getFilterByFilterIdResultFailed: {}", e.getMessage());
throw new RuntimeException("getCustomerFilterByFilterId failed");
}
if (StringUtils.isBlank(result)){
throw new RuntimeException("can't get filter data");
}
CustomerFilter customerFilter = JsonUtil.fromJson(result, CustomerFilter.class);
return customerFilter;
}
}
| [
"[email protected]"
]
| |
b89a8ebfc8f54f2f1a5397937db080dc05f1c7b3 | 718d2f73a646a34b6a7ff982f9287067f4d6bc33 | /src/main/java/com/wangsd/web/dao/RoleMenuMapper.java | 0928ef6731758aef202965cdb0c2b936c52f7bb1 | []
| no_license | wangshuodong/estate | 7223ba805e6058754efe2e5dd6d04811e06282eb | 685758d3b9fec3e6efebb234a15673c3c791816e | refs/heads/master | 2021-08-23T23:30:47.348593 | 2017-12-07T02:46:39 | 2017-12-07T02:46:39 | 109,673,923 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 713 | java | package com.wangsd.web.dao;
import com.wangsd.web.model.RoleMenuExample;
import com.wangsd.web.model.RoleMenu;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface RoleMenuMapper {
int countByExample(RoleMenuExample example);
int deleteByExample(RoleMenuExample example);
int deleteByPrimaryKey(RoleMenu key);
int insert(RoleMenu record);
int insertSelective(RoleMenu record);
List<RoleMenu> selectByExample(RoleMenuExample example);
int updateByExampleSelective(@Param("record") RoleMenu record, @Param("example") RoleMenuExample example);
int updateByExample(@Param("record") RoleMenu record, @Param("example") RoleMenuExample example);
} | [
"[email protected]"
]
| |
e983b515e9b9038354e2ce463fffad762a4d79d1 | 9974a70027d8f7d593301a41cd4ec8ce5e03b16e | /SystDist/.svn/pristine/33/33c5cd0bc969fd59d26aaf7e4f0886dec163d6a9.svn-base | b404631b9df839571b3ce899589c8212fd2e187c | []
| no_license | Ferreyd/Master | 91b14759a1406df5388cd46db7cd42a1f221ae2c | ff5973997c4d7382280411c04c87ed46952e3a99 | refs/heads/master | 2021-01-10T20:52:39.746011 | 2014-08-07T13:43:13 | 2014-08-07T13:43:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,148 | package tp2nicolas;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
/**
* @author Nicolas
* Date : 06/10/13 21:45
*/
public class ClientManager implements Runnable
{
Socket socket;
public ClientManager(Socket socket)
{
this.socket = socket;
}
public void manage() throws IOException
{
BufferedReader br = new BufferedReader(new InputStreamReader(this.socket.getInputStream()));
PrintWriter pw = new PrintWriter(this.socket.getOutputStream());
String line;
// br.readLine blocks until a message is received
while((line = br.readLine()) != null)
{
if(line.equalsIgnoreCase("stop"))
{
break;
}
System.out.println("Server received: " + line);
pw.println(line);
pw.flush();
}
}
public void run()
{
try
{
this.manage();
}
catch(IOException e)
{
e.printStackTrace();
}
}
}
| [
"[email protected]"
]
| ||
c302b30e1056a9dddf50159211d4a043a786cf63 | a0c2e78068e2bdaea3c6f183c15e06b6ec7e0abc | /app/src/main/java/bj/app/wapi/ui/DetailsExploitation.java | 2b3d9681195c64622d62ba02ee597291c8fc6f69 | []
| no_license | kadersaka/wapi | 6f59f34764fd1f14708e3b8b90dccac7ce3e77ec | 91dd48479e53e6ea02e634d5a985e45257df63a1 | refs/heads/master | 2022-12-26T22:29:40.666940 | 2020-10-01T07:39:33 | 2020-10-01T07:39:33 | 257,534,215 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,325 | java | package bj.app.wapi.ui;
import android.os.Bundle;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;
import bj.app.wapi.R;
public class DetailsExploitation extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_details_exploitation);
BottomNavigationView navView = findViewById(R.id.nav_view_details_exploitations);
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
R.id.navigation_saisons, R.id.navigation_employee, R.id.navigation_geo_loc)
.build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment_details_exploitation);
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
NavigationUI.setupWithNavController(navView, navController);
}
}
| [
"[email protected]"
]
| |
8eac2725d6770fe78025b5ecb8ae4c24728ba7d9 | f5c2d839cc57e6f71ca02d9ef39b5c28fce76dc1 | /coronavirus_bootstrap/src/test/java/io/guruinfotech/coronavirustracker/CoronavirusBootstrapApplicationTests.java | 16989b0a6874d7ba2a875a157eb98bb8a755225b | []
| no_license | gurunatha/Spring-Boot | 8ed987aca52a76382b721a79983cd089393fb0ab | 013509f59eccac6dd0efdc0dae2eb7be1f473740 | refs/heads/master | 2022-12-11T00:47:00.005359 | 2020-03-27T05:34:51 | 2020-03-27T05:34:51 | 249,983,675 | 0 | 0 | null | 2022-12-07T05:26:35 | 2020-03-25T13:18:56 | JavaScript | UTF-8 | Java | false | false | 240 | java | package io.guruinfotech.coronavirustracker;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class CoronavirusBootstrapApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
]
| |
5cc340d92c05dd02b2ae7fd1c70fafe66b7a77fd | 1e5b524e6225fe48a92b01996ea6014bc59ed8e8 | /src/main/java/it/tests/pdfmanager/PdfManagerV2.java | e5c41d99b09122e7dafee76120bd21db7be70e8a | []
| no_license | Andrea89dev/pdfManager | ac0cf18ad2ca8df13a014c9670face4584845d31 | f83e8cc4d9cb8dd60d4c89c2222ec0c6eb5def38 | refs/heads/master | 2022-12-27T08:16:22.752068 | 2020-10-09T17:01:55 | 2020-10-09T17:01:55 | 302,702,859 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,414 | java | package it.tests.pdfmanager;
import it.tests.pdfmanager.bean.VehicleServiceBO;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.pdfbox.cos.COSDictionary;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.multipdf.Overlay;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
import org.apache.pdfbox.pdmodel.common.PDRectangle;
import org.apache.pdfbox.pdmodel.font.PDFont;
import org.apache.pdfbox.pdmodel.font.PDType1Font;
import org.vandeseer.easytable.TableDrawer;
import org.vandeseer.easytable.settings.VerticalAlignment;
import org.vandeseer.easytable.structure.Row;
import org.vandeseer.easytable.structure.Table;
import org.vandeseer.easytable.structure.cell.AbstractCell;
import org.vandeseer.easytable.structure.cell.TextCell;
import org.vandeseer.easytable.structure.cell.VerticalTextCell;
import java.io.File;
import java.io.IOException;
import java.text.NumberFormat;
import java.util.*;
public class PdfManagerV2 {
private static final int COLUMNS = 8;
private NumberFormat formatter;
public PdfManagerV2() {
formatter = NumberFormat.getCurrencyInstance();
}
public void createPdf() throws IOException {
PDDocument overlayDoc = new PDDocument();
PDPage overlayPage = new PDPage(PDRectangle.A3);
overlayPage.setRotation(90);
overlayDoc.addPage(overlayPage);
Overlay overlayObj = new Overlay();
//
// PDDocument templateDocument = PDDocument.load(new File(ApplicationConstants.PATH_TMP + "start_contract_it.pdf"));
//
// COSDictionary pageDict = templateDocument.getPages().get(1).getCOSObject();
// COSDictionary newPageDict = new COSDictionary(pageDict);
// newPageDict.removeItem(COSName.ANNOTS);
//
// PDPage newPage = new PDPage(newPageDict);
// newPage.setRotation(90);
// float startY = overlayPage.getMediaBox().getHeight() - 50f;
// overlayPage.setRotation(-90);
Table table = createTable(getVehicleServiceBOList());
// Table table = createTable(transformToMatrix(getVehicleServiceBOList()));
try(final PDPageContentStream contentStream = new PDPageContentStream(overlayDoc, overlayPage)) {
TableDrawer.builder()
.page(overlayPage)
.contentStream(contentStream)
.table(table)
// .startX(overlayPage.getMediaBox().getLowerLeftX()+125)
// .startY(overlayPage.getMediaBox().getUpperRightY()-39)
.startX(overlayPage.getMediaBox().getLowerLeftX()+200)
.startY(overlayPage.getMediaBox().getUpperRightY()-490)
// .endY(50f)
.build()
.draw();
// startY -= (table.getHeight() + 50f);
}
overlayPage.setRotation(-90);
PDDocument originalDoc = PDDocument.load(new File(ApplicationConstants.PATH_TMP + "start_contract_it.pdf"));
overlayObj.setOverlayPosition(Overlay.Position.FOREGROUND);
overlayObj.setInputPDF(originalDoc);
overlayObj.setAllPagesOverlayPDF(overlayDoc);
Map<Integer, String> ovmap = new HashMap<>(); // empty map is a dummy
overlayObj.overlay(ovmap);
originalDoc.save(new File(ApplicationConstants.PATH_RESULTS + System.currentTimeMillis() + ".pdf"));
overlayObj.close();
originalDoc.close();
}
// public Table createTable(Vector<Vector<String>> matrix) {
// System.out.println("Matrix size: " + matrix.size());
// Table.TableBuilder tableBuilder = Table.builder()
//// .addColumnOfWidth(50f)
//// .numberOfColumns(matrix.size())
// .addColumnsOfWidth(50f, 50f, 50f, 50f, 50f, 50f, 50f, 50f)
// .fontSize(8)
// .font(PDType1Font.HELVETICA);
//
// matrix.forEach(x -> {
// System.out.println("--------------------------------");
// Row.RowBuilder rowBuilder = Row.builder();
// x.forEach(y -> {
// System.out.println("-> " + y);
// rowBuilder.add(createVerticalCell(y));
// });
// System.out.println("--------------------------------");
// tableBuilder.addRow(rowBuilder.build());
// });
//
// return tableBuilder.build();
// }
public Table createTable(List<VehicleServiceBO> vehicleServiceBOList) {
Table.TableBuilder tableBuilder = Table.builder()
.addColumnsOfWidth(50f, 50f, 50f, 50f, 50f, 50f, 50f, 50f)
.fontSize(8)
.font(PDType1Font.HELVETICA);
vehicleServiceBOList.forEach(vehicleServiceBO -> {
tableBuilder.addRow(Row.builder()
.add(createCell(vehicleServiceBO.getModel()))
.add(createCell(vehicleServiceBO.getVin()))
.add(createCell(vehicleServiceBO.getPlate()))
.add(createCell(""))
.add(createCell(""))
.add(createCell(""))
.add(createCell(""))
.add(createCurrencyCell(vehicleServiceBO.getPrice()))
.build());
});
return tableBuilder.build();
}
private AbstractCell createVerticalCell(String value) {
return VerticalTextCell.builder().borderWidth(1).text(value).build();
}
private AbstractCell createCell(String value) {
return TextCell.builder().borderWidth(1).text(value).verticalAlignment(VerticalAlignment.MIDDLE).build();
}
private AbstractCell createCurrencyCell(Double value) {
NumberFormat formatter = NumberFormat.getCurrencyInstance();
return TextCell.builder().borderWidth(1).text(formatter.format(value)).verticalAlignment(VerticalAlignment.MIDDLE).build();
}
private AbstractCell createVerticalCurrencyCell(Double value) {
NumberFormat formatter = NumberFormat.getCurrencyInstance();
return VerticalTextCell.builder().borderWidth(1).text(formatter.format(value)).build();
}
private List<VehicleServiceBO> getVehicleServiceBOList() {
List<VehicleServiceBO> vehicleServiceBOList = new ArrayList<>();
for(int i = 0; i < 10; i++) {
VehicleServiceBO vehicleServiceBO = new VehicleServiceBO();
vehicleServiceBO.setModel("Model #" + i);
vehicleServiceBO.setPlate("XX" + StringUtils.leftPad(String.valueOf(i), 3, "0") + "XX");
vehicleServiceBO.setVin("VIN" + StringUtils.leftPad(String.valueOf(i), 7, "0"));
vehicleServiceBO.setDuration("");
vehicleServiceBO.setPrice(RandomUtils.nextDouble(0d, 1999d));
vehicleServiceBOList.add(vehicleServiceBO);
}
return vehicleServiceBOList;
}
public Vector<Vector<String>> transformToMatrix(List<VehicleServiceBO> vehicleServiceBOList) {
Vector<Vector<String>> matrix = new Vector<>();
for(int x = 0; x < vehicleServiceBOList.size(); x++) {
Vector<String> innerM = new Vector<>();
for(int y = 0; y < COLUMNS; y++) {
switch (y) {
case 0:
innerM.add(formatter.format(vehicleServiceBOList.get(x).getPrice()));
break;
case 1:
innerM.add(vehicleServiceBOList.get(x).getDuration());
break;
case 2:
innerM.add("31/12/2020");
break;
case 3:
innerM.add("01/01/2020");
break;
case 4:
innerM.add("Services");
break;
case 5:
innerM.add(vehicleServiceBOList.get(x).getPlate());
break;
case 6:
innerM.add(vehicleServiceBOList.get(x).getVin());
break;
case 7:
innerM.add(vehicleServiceBOList.get(x).getModel());
break;
}
}
matrix.add(innerM);
}
return matrix;
}
}
| [
"[email protected]"
]
| |
e4e21afc1945718ea9c37c749f9ea0adf9141e7f | 76a7c720f8c0c5babd092093708e7323dd941aa4 | /bubing_tools/src/main/java/com/bubing/tools/loading/render/circle/jump/GuardLoadingRenderer.java | 31c44eecf5d5199986fe5f41e8b2e5b2a081c2ea | []
| no_license | General757/BubingTools | 13b2622a65cdba982a8f5ab2b6d6541ce4f1d14a | 550af7395935e3f2e1411a9c80eed6698343a607 | refs/heads/master | 2023-02-23T03:53:10.106504 | 2020-11-02T03:35:04 | 2020-11-02T03:35:04 | 260,145,210 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,963 | java | package com.bubing.tools.loading.render.circle.jump;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PathMeasure;
import android.graphics.Rect;
import android.graphics.RectF;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
import com.bubing.tools.loading.render.LoadingRenderer;
import com.bubing.tools.utils.DensityUtils;
/**
* @ClassName: GuardLoadingRenderer
* @Author: Bubing
* @Date: 2020/8/24 3:44 PM
* @Description: java类作用描述
*/
public class GuardLoadingRenderer extends LoadingRenderer {
private static final Interpolator MATERIAL_INTERPOLATOR = new FastOutSlowInInterpolator();
private static final Interpolator ACCELERATE_INTERPOLATOR = new AccelerateInterpolator();
private static final Interpolator DECELERATE_INTERPOLATOR = new DecelerateInterpolator();
private static final long ANIMATION_DURATION = 5000;
private static final float DEFAULT_STROKE_WIDTH = 1.0f;
private static final float DEFAULT_CENTER_RADIUS = 12.5f;
private static final float DEFAULT_SKIP_BALL_RADIUS = 1.0f;
private static final float START_TRIM_INIT_ROTATION = -0.5f;
private static final float START_TRIM_MAX_ROTATION = -0.25f;
private static final float END_TRIM_INIT_ROTATION = 0.25f;
private static final float END_TRIM_MAX_ROTATION = 0.75f;
private static final float START_TRIM_DURATION_OFFSET = 0.23f;
private static final float WAVE_DURATION_OFFSET = 0.36f;
private static final float BALL_SKIP_DURATION_OFFSET = 0.74f;
private static final float BALL_SCALE_DURATION_OFFSET = 0.82f;
private static final float END_TRIM_DURATION_OFFSET = 1.0f;
private static final int DEFAULT_COLOR = Color.WHITE;
private static final int DEFAULT_BALL_COLOR = Color.RED;
private final Paint mPaint = new Paint();
private final RectF mTempBounds = new RectF();
private final RectF mCurrentBounds = new RectF();
private final float[] mCurrentPosition = new float[2];
private float mStrokeInset;
private float mSkipBallSize;
private float mScale;
private float mEndTrim;
private float mRotation;
private float mStartTrim;
private float mWaveProgress;
private float mStrokeWidth;
private float mCenterRadius;
private int mColor;
private int mBallColor;
private PathMeasure mPathMeasure;
private GuardLoadingRenderer(Context context) {
super(context);
mDuration = ANIMATION_DURATION;
init(context);
setupPaint();
}
private void init(Context context) {
mStrokeWidth = DensityUtils.dip2px(context, DEFAULT_STROKE_WIDTH);
mCenterRadius = DensityUtils.dip2px(context, DEFAULT_CENTER_RADIUS);
mSkipBallSize = DensityUtils.dip2px(context, DEFAULT_SKIP_BALL_RADIUS);
mColor = DEFAULT_COLOR;
mBallColor = DEFAULT_BALL_COLOR;
}
private void setupPaint() {
mPaint.setAntiAlias(true);
mPaint.setStrokeWidth(mStrokeWidth);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeCap(Paint.Cap.ROUND);
setInsets((int) mWidth, (int) mHeight);
}
@Override
protected void draw(Canvas canvas, Rect bounds) {
RectF arcBounds = mTempBounds;
arcBounds.set(bounds);
arcBounds.inset(mStrokeInset, mStrokeInset);
mCurrentBounds.set(arcBounds);
int saveCount = canvas.save();
//draw circle trim
float startAngle = (mStartTrim + mRotation) * 360;
float endAngle = (mEndTrim + mRotation) * 360;
float sweepAngle = endAngle - startAngle;
if (sweepAngle != 0) {
mPaint.setColor(mColor);
mPaint.setStyle(Paint.Style.STROKE);
canvas.drawArc(arcBounds, startAngle, sweepAngle, false, mPaint);
}
//draw water wave
if (mWaveProgress < 1.0f) {
mPaint.setColor(Color.argb((int) (Color.alpha(mColor) * (1.0f - mWaveProgress)),
Color.red(mColor), Color.green(mColor), Color.blue(mColor)));
mPaint.setStyle(Paint.Style.STROKE);
float radius = Math.min(arcBounds.width(), arcBounds.height()) / 2.0f;
canvas.drawCircle(arcBounds.centerX(), arcBounds.centerY(), radius * (1.0f + mWaveProgress), mPaint);
}
//draw ball bounce
if (mPathMeasure != null) {
mPaint.setColor(mBallColor);
mPaint.setStyle(Paint.Style.FILL);
canvas.drawCircle(mCurrentPosition[0], mCurrentPosition[1], mSkipBallSize * mScale, mPaint);
}
canvas.restoreToCount(saveCount);
}
@Override
protected void computeRender(float renderProgress) {
if (renderProgress <= START_TRIM_DURATION_OFFSET) {
final float startTrimProgress = (renderProgress) / START_TRIM_DURATION_OFFSET;
mEndTrim = -MATERIAL_INTERPOLATOR.getInterpolation(startTrimProgress);
mRotation = START_TRIM_INIT_ROTATION + START_TRIM_MAX_ROTATION
* MATERIAL_INTERPOLATOR.getInterpolation(startTrimProgress);
}
if (renderProgress <= WAVE_DURATION_OFFSET && renderProgress > START_TRIM_DURATION_OFFSET) {
final float waveProgress = (renderProgress - START_TRIM_DURATION_OFFSET)
/ (WAVE_DURATION_OFFSET - START_TRIM_DURATION_OFFSET);
mWaveProgress = ACCELERATE_INTERPOLATOR.getInterpolation(waveProgress);
}
if (renderProgress <= BALL_SKIP_DURATION_OFFSET && renderProgress > WAVE_DURATION_OFFSET) {
if (mPathMeasure == null) {
mPathMeasure = new PathMeasure(createSkipBallPath(), false);
}
final float ballSkipProgress = (renderProgress - WAVE_DURATION_OFFSET)
/ (BALL_SKIP_DURATION_OFFSET - WAVE_DURATION_OFFSET);
mPathMeasure.getPosTan(ballSkipProgress * mPathMeasure.getLength(), mCurrentPosition, null);
mWaveProgress = 1.0f;
}
if (renderProgress <= BALL_SCALE_DURATION_OFFSET && renderProgress > BALL_SKIP_DURATION_OFFSET) {
final float ballScaleProgress =
(renderProgress - BALL_SKIP_DURATION_OFFSET)
/ (BALL_SCALE_DURATION_OFFSET - BALL_SKIP_DURATION_OFFSET);
if (ballScaleProgress < 0.5f) {
mScale = 1.0f + DECELERATE_INTERPOLATOR.getInterpolation(ballScaleProgress * 2.0f);
} else {
mScale = 2.0f - ACCELERATE_INTERPOLATOR.getInterpolation((ballScaleProgress - 0.5f) * 2.0f) * 2.0f;
}
}
if (renderProgress >= BALL_SCALE_DURATION_OFFSET) {
final float endTrimProgress =
(renderProgress - BALL_SKIP_DURATION_OFFSET)
/ (END_TRIM_DURATION_OFFSET - BALL_SKIP_DURATION_OFFSET);
mEndTrim = -1 + MATERIAL_INTERPOLATOR.getInterpolation(endTrimProgress);
mRotation = END_TRIM_INIT_ROTATION + END_TRIM_MAX_ROTATION
* MATERIAL_INTERPOLATOR.getInterpolation(endTrimProgress);
mScale = 1.0f;
mPathMeasure = null;
}
}
@Override
protected void setAlpha(int alpha) {
mPaint.setAlpha(alpha);
}
@Override
protected void setColorFilter(ColorFilter cf) {
mPaint.setColorFilter(cf);
}
@Override
protected void reset() {
mScale = 1.0f;
mEndTrim = 0.0f;
mRotation = 0.0f;
mStartTrim = 0.0f;
mWaveProgress = 1.0f;
}
private Path createSkipBallPath() {
float radius = Math.min(mCurrentBounds.width(), mCurrentBounds.height()) / 2.0f;
float radiusPow2 = (float) Math.pow(radius, 2.0f);
float originCoordinateX = mCurrentBounds.centerX();
float originCoordinateY = mCurrentBounds.centerY();
float[] coordinateX = new float[]{0.0f, 0.0f, -0.8f * radius, 0.75f * radius,
-0.45f * radius, 0.9f * radius, -0.5f * radius};
float[] sign = new float[]{1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f};
Path path = new Path();
for (int i = 0; i < coordinateX.length; i++) {
// x^2 + y^2 = radius^2 --> y = sqrt(radius^2 - x^2)
if (i == 0) {
path.moveTo(
originCoordinateX + coordinateX[i],
originCoordinateY + sign[i]
* (float) Math.sqrt(radiusPow2 - Math.pow(coordinateX[i], 2.0f)));
continue;
}
path.lineTo(
originCoordinateX + coordinateX[i],
originCoordinateY + sign[i]
* (float) Math.sqrt(radiusPow2 - Math.pow(coordinateX[i], 2.0f)));
if (i == coordinateX.length - 1) {
path.lineTo(originCoordinateX, originCoordinateY);
}
}
return path;
}
private void setInsets(int width, int height) {
final float minEdge = (float) Math.min(width, height);
float insets;
if (mCenterRadius <= 0 || minEdge < 0) {
insets = (float) Math.ceil(mStrokeWidth / 2.0f);
} else {
insets = minEdge / 2.0f - mCenterRadius;
}
mStrokeInset = insets;
}
public static class Builder {
private Context mContext;
public Builder(Context mContext) {
this.mContext = mContext;
}
public GuardLoadingRenderer build() {
GuardLoadingRenderer loadingRenderer = new GuardLoadingRenderer(mContext);
return loadingRenderer;
}
}
}
| [
"[email protected]"
]
| |
5663d51882abe4df3179412aabdc0ac998c47852 | b67a05358d530bd4f9afd815c7744780a2e76d13 | /java-source/suan-fa/src/main/java/leetcode/array/SummaryRanges.java | 2b5d321ea1ef6b6bde72cb83a6f0f85fcdb76c76 | []
| no_license | fogmeng/self-study | bd5f17accd1e0ca3ddeab32282c72f3467e4dd1e | 3166506fcb13259b5c412637fad21419cfb8fa93 | refs/heads/master | 2020-03-31T12:26:57.883571 | 2019-01-25T12:16:49 | 2019-01-25T12:16:49 | 152,216,272 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 914 | java | package leetcode.array;// Given a sorted integer array without duplicates, return the summary of its ranges.
// For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"].
import java.util.ArrayList;
import java.util.List;
public class SummaryRanges {
public List<String> summaryRanges(int[] nums) {
List<String> result = new ArrayList();
if(nums.length == 1) {
result.add(nums[0] + "");
return result;
}
for(int i = 0; i < nums.length; i++) {
int current = nums[i];
while(i + 1 < nums.length && (nums[i + 1] - nums[i] == 1)) {
i++;
}
if(current != nums[i]) {
result.add(current + "->" + nums[i]);
} else {
result.add(current + "");
}
}
return result;
}
}
| [
"[email protected]"
]
| |
d0cf2041316cdef730366077ba1b59747e766143 | 71d6ea533cfb3f565bafbf17ab6654a0e045f826 | /src/main/java/gymManagement/Mapper/CommonMapper.java | 7de0efb163d31593fb27ca01d4146a23cffb6ae2 | []
| no_license | manmeetitsme1987/Gym-Management | ff922891039eb4b5eddc99a554545400a7c7e2d2 | 9a9d17e826c4b7c26fe8cb42ac3830f067e60464 | refs/heads/master | 2021-01-21T21:00:24.139431 | 2017-06-19T11:42:14 | 2017-06-19T11:42:14 | 94,770,610 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 186 | java | package gymManagement.Mapper;
import gymManagement.model.response.TestResponse;
public interface CommonMapper {
//method to fetch the base
TestResponse getUserInfoById(int id);
}
| [
"[email protected]"
]
| |
4ccf6f742197c8e16c893a33fb7c2347e80197b1 | 9bbecf3cc8aff92ea2342a4a3318ad37eff433af | /src/main/java/com/ifmo/lesson4/Item.java | 4be0ce6c15eb74c0a9183bb58748eac3ec928463 | []
| no_license | lenok0113/itmo | 638d713da4db8b793edd32ef1e28a1942ee46b4f | d4057d2162ec02381040d1d6f396771db766d9b9 | refs/heads/master | 2020-08-24T17:51:35.677833 | 2019-11-28T21:15:48 | 2019-11-28T21:15:48 | 216,875,982 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 777 | java | package com.ifmo.lesson4;
/**
* Элемент связного списка, хранящий ссылку
* на следующий элемент и на значение.
* <p>
* Класс package-private, т.к. используется
* только для LinkedList'a.
* </p>
*/
class Item {
/** Значение элемента. */
Object value;
/** Ссылка на следующий элемент. */
Item next;
/*
* Инициализирует элемент со значением
* {@code value}.
*
* @param value Значение, которое будет сохранено
* в этом элементе.
*/
Item(Object value) {
this.value = value;
}
}
| [
"[email protected]"
]
| |
8c8f60cd7e8a5b9226ceca9729c7af614890c7fb | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/neo4j--neo4j/3a35bb61da8556c67775d389c59294eaf62f27f4/after/LockingStatementOperationsTest.java | 69fb09d00d27bea379797867a1d75987f9ae5925 | []
| no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,515 | java | /*
* Copyright (c) 2002-2015 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j 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 org.neo4j.kernel.impl.api;
import org.junit.Test;
import org.mockito.InOrder;
import java.util.Collections;
import java.util.Iterator;
import org.neo4j.function.Function;
import org.neo4j.kernel.api.constraints.NodePropertyConstraint;
import org.neo4j.kernel.api.constraints.PropertyConstraint;
import org.neo4j.kernel.api.constraints.UniquenessConstraint;
import org.neo4j.kernel.api.exceptions.EntityNotFoundException;
import org.neo4j.kernel.api.index.IndexDescriptor;
import org.neo4j.kernel.api.properties.DefinedProperty;
import org.neo4j.kernel.api.properties.Property;
import org.neo4j.kernel.impl.api.operations.EntityReadOperations;
import org.neo4j.kernel.impl.api.operations.EntityWriteOperations;
import org.neo4j.kernel.impl.api.operations.SchemaReadOperations;
import org.neo4j.kernel.impl.api.operations.SchemaStateOperations;
import org.neo4j.kernel.impl.api.operations.SchemaWriteOperations;
import org.neo4j.kernel.impl.locking.Locks;
import org.neo4j.kernel.impl.locking.ResourceTypes;
import static org.junit.Assert.assertSame;
import static org.mockito.Mockito.inOrder;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.neo4j.function.Functions.constant;
import static org.neo4j.kernel.impl.locking.ResourceTypes.schemaResource;
public class LockingStatementOperationsTest
{
private final LockingStatementOperations lockingOps;
private final EntityReadOperations entityReadOps;
private final EntityWriteOperations entityWriteOps;
private final SchemaReadOperations schemaReadOps;
private final SchemaWriteOperations schemaWriteOps;
private final Locks.Client locks = mock( Locks.Client.class );
private final InOrder order;
private final KernelStatement state = new KernelStatement( null, null, null, null, locks, null,
null );
private final SchemaStateOperations schemaStateOps;
public LockingStatementOperationsTest()
{
entityReadOps = mock( EntityReadOperations.class );
entityWriteOps = mock( EntityWriteOperations.class );
schemaReadOps = mock( SchemaReadOperations.class );
schemaWriteOps = mock( SchemaWriteOperations.class );
schemaStateOps = mock( SchemaStateOperations.class );
order = inOrder( locks, entityWriteOps, schemaReadOps, schemaWriteOps, schemaStateOps );
lockingOps = new LockingStatementOperations(
entityReadOps, entityWriteOps, schemaReadOps, schemaWriteOps, schemaStateOps
);
}
@Test
public void shouldAcquireEntityWriteLockCreatingRelationship() throws Exception
{
// when
lockingOps.relationshipCreate( state, 1, 2, 3 );
// then
order.verify( locks ).acquireExclusive( ResourceTypes.NODE, 2 );
order.verify( locks ).acquireExclusive( ResourceTypes.NODE, 3 );
order.verify( entityWriteOps ).relationshipCreate( state, 1, 2, 3 );
}
@Test
public void shouldAcquireEntityWriteLockBeforeAddingLabelToNode() throws Exception
{
// when
lockingOps.nodeAddLabel( state, 123, 456 );
// then
order.verify( locks ).acquireExclusive( ResourceTypes.NODE, 123 );
order.verify( entityWriteOps ).nodeAddLabel( state, 123, 456 );
}
@Test
public void shouldAcquireSchemaReadLockBeforeAddingLabelToNode() throws Exception
{
// when
lockingOps.nodeAddLabel( state, 123, 456 );
// then
order.verify( locks ).acquireShared( ResourceTypes.SCHEMA, schemaResource() );
order.verify( entityWriteOps ).nodeAddLabel( state, 123, 456 );
}
@Test
public void shouldAcquireEntityWriteLockBeforeSettingPropertyOnNode() throws Exception
{
// given
DefinedProperty property = Property.property( 8, 9 );
// when
lockingOps.nodeSetProperty( state, 123, property );
// then
order.verify( locks ).acquireExclusive( ResourceTypes.NODE, 123 );
order.verify( entityWriteOps ).nodeSetProperty( state, 123, property );
}
@Test
public void shouldAcquireSchemaReadLockBeforeSettingPropertyOnNode() throws Exception
{
// given
DefinedProperty property = Property.property( 8, 9 );
// when
lockingOps.nodeSetProperty( state, 123, property );
// then
order.verify( locks ).acquireShared( ResourceTypes.SCHEMA, schemaResource() );
order.verify( entityWriteOps ).nodeSetProperty( state, 123, property );
}
@Test
public void shouldAcquireEntityWriteLockBeforeDeletingNode() throws EntityNotFoundException
{
// WHEN
lockingOps.nodeDelete( state, 123 );
//THEN
order.verify( locks ).acquireExclusive( ResourceTypes.NODE, 123 );
order.verify( entityWriteOps ).nodeDelete( state, 123 );
}
@Test
public void shouldAcquireSchemaWriteLockBeforeAddingIndexRule() throws Exception
{
// given
IndexDescriptor rule = mock( IndexDescriptor.class );
when( schemaWriteOps.indexCreate( state, 123, 456 ) ).thenReturn( rule );
// when
IndexDescriptor result = lockingOps.indexCreate( state, 123, 456 );
// then
assertSame( rule, result );
order.verify( locks ).acquireExclusive( ResourceTypes.SCHEMA, schemaResource() );
order.verify( schemaWriteOps ).indexCreate( state, 123, 456 );
}
@Test
public void shouldAcquireSchemaWriteLockBeforeRemovingIndexRule() throws Exception
{
// given
IndexDescriptor rule = new IndexDescriptor( 0, 0 );
// when
lockingOps.indexDrop( state, rule );
// then
order.verify( locks ).acquireExclusive( ResourceTypes.SCHEMA, schemaResource() );
order.verify( schemaWriteOps ).indexDrop( state, rule );
}
@Test
public void shouldAcquireSchemaReadLockBeforeGettingIndexRules() throws Exception
{
// given
Iterator<IndexDescriptor> rules = Collections.emptyIterator();
when( schemaReadOps.indexesGetAll( state ) ).thenReturn( rules );
// when
Iterator<IndexDescriptor> result = lockingOps.indexesGetAll( state );
// then
assertSame( rules, result );
order.verify( locks ).acquireShared( ResourceTypes.SCHEMA, schemaResource() );
order.verify( schemaReadOps ).indexesGetAll( state );
}
@Test
public void shouldAcquireSchemaWriteLockBeforeCreatingUniquenessConstraint() throws Exception
{
// given
UniquenessConstraint constraint = new UniquenessConstraint( 0, 0 );
when( schemaWriteOps.uniquePropertyConstraintCreate( state, 123, 456 ) ).thenReturn( constraint );
// when
PropertyConstraint result = lockingOps.uniquePropertyConstraintCreate( state, 123, 456 );
// then
assertSame( constraint, result );
order.verify( locks ).acquireExclusive( ResourceTypes.SCHEMA, schemaResource() );
order.verify( schemaWriteOps ).uniquePropertyConstraintCreate( state, 123, 456 );
}
@Test
public void shouldAcquireSchemaWriteLockBeforeDroppingConstraint() throws Exception
{
// given
UniquenessConstraint constraint = new UniquenessConstraint( 1, 2 );
// when
lockingOps.constraintDrop( state, constraint );
// then
order.verify( locks ).acquireExclusive( ResourceTypes.SCHEMA, schemaResource() );
order.verify( schemaWriteOps ).constraintDrop( state, constraint );
}
@Test
public void shouldAcquireSchemaReadLockBeforeGettingConstraintsByLabelAndProperty() throws Exception
{
// given
Iterator<NodePropertyConstraint> constraints = Collections.emptyIterator();
when( schemaReadOps.constraintsGetForLabelAndPropertyKey( state, 123, 456 ) ).thenReturn( constraints );
// when
Iterator<NodePropertyConstraint> result = lockingOps.constraintsGetForLabelAndPropertyKey( state, 123, 456 );
// then
assertSame( constraints, result );
order.verify( locks ).acquireShared( ResourceTypes.SCHEMA, schemaResource() );
order.verify( schemaReadOps ).constraintsGetForLabelAndPropertyKey( state, 123, 456 );
}
@Test
public void shouldAcquireSchemaReadLockBeforeGettingConstraintsByLabel() throws Exception
{
// given
Iterator<NodePropertyConstraint> constraints = Collections.emptyIterator();
when( schemaReadOps.constraintsGetForLabel( state, 123 ) ).thenReturn( constraints );
// when
Iterator<NodePropertyConstraint> result = lockingOps.constraintsGetForLabel( state, 123 );
// then
assertSame( constraints, result );
order.verify( locks ).acquireShared( ResourceTypes.SCHEMA, schemaResource() );
order.verify( schemaReadOps ).constraintsGetForLabel( state, 123 );
}
@Test
public void shouldAcquireSchemaReadLockBeforeGettingAllConstraints() throws Exception
{
// given
Iterator<PropertyConstraint> constraints = Collections.emptyIterator();
when( schemaReadOps.constraintsGetAll( state ) ).thenReturn( constraints );
// when
Iterator<PropertyConstraint> result = lockingOps.constraintsGetAll( state );
// then
assertSame( constraints, result );
order.verify( locks ).acquireShared( ResourceTypes.SCHEMA, schemaResource() );
order.verify( schemaReadOps ).constraintsGetAll( state );
}
@Test
public void shouldAcquireSchemaReadLockBeforeUpdatingSchemaState() throws Exception
{
// given
Function<Object, Object> creator = constant( null );
// when
lockingOps.schemaStateGetOrCreate( state, null, creator );
// then
order.verify( locks ).acquireShared( ResourceTypes.SCHEMA, schemaResource() );
order.verify( schemaStateOps ).schemaStateGetOrCreate( state, null, creator );
}
@Test
public void shouldAcquireSchemaReadLockBeforeCheckingSchemaState() throws Exception
{
// when
lockingOps.schemaStateContains( state, null );
// then
order.verify( locks ).acquireShared( ResourceTypes.SCHEMA, schemaResource() );
order.verify( schemaStateOps ).schemaStateContains( state, null );
}
@Test
public void shouldAcquireSchemaReadLockBeforeFlushingSchemaState() throws Exception
{
// when
lockingOps.schemaStateFlush( state );
// then
order.verify( locks ).acquireShared( ResourceTypes.SCHEMA, schemaResource() );
order.verify( schemaStateOps ).schemaStateFlush( state );
}
} | [
"[email protected]"
]
| |
938d38278c7f7c37969a305f54c8beeaaae040db | dbcaac616f23a53943e0e9b7684be0f3aa09b8b1 | /src/main/java/testsmell/smell/EagerTest.java | 07a0e4d6d1e0d5be906e31315da30d38a0222d04 | []
| no_license | vgarousi/tsDetectExtended | e5384801e08f6f520d3b04ac7375b6da022c9bac | 9f00ec3f254a840d7de21bb6e84c2950587f2712 | refs/heads/master | 2022-06-13T13:07:04.288520 | 2020-05-08T14:29:44 | 2020-05-08T14:29:44 | 262,340,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,093 | java | package testsmell.smell;
import com.github.javaparser.ast.CompilationUnit;
import com.github.javaparser.ast.Modifier;
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration;
import com.github.javaparser.ast.body.EnumDeclaration;
import com.github.javaparser.ast.body.MethodDeclaration;
import com.github.javaparser.ast.body.VariableDeclarator;
import com.github.javaparser.ast.expr.MethodCallExpr;
import com.github.javaparser.ast.expr.NameExpr;
import com.github.javaparser.ast.expr.VariableDeclarationExpr;
import com.github.javaparser.ast.visitor.VoidVisitorAdapter;
import testsmell.*;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class EagerTest extends AbstractSmell {
private static final String TEST_FILE = "Test";
private static final String PRODUCTION_FILE = "Production";
private String productionClassName;
private List<SmellyElement> smellyElementList;
private List<MethodDeclaration> productionMethods;
public EagerTest() {
productionMethods = new ArrayList<>();
smellyElementList = new ArrayList<>();
}
/**
* Checks of 'Eager Test' smell
*/
@Override
public String getSmellName() {
return "Eager Test";
}
/**
* Returns true if any of the elements has a smell
*/
@Override
public boolean getHasSmell() {
return smellyElementList.stream().filter(x -> x.getHasSmell()).count() >= 1;
}
/**
* Analyze the test file for test methods that exhibit the 'Eager Test' smell
*/
@Override
public void runAnalysis(CompilationUnit testFileCompilationUnit, CompilationUnit productionFileCompilationUnit, String testFileName, String productionFileName) throws FileNotFoundException {
if (productionFileCompilationUnit == null)
throw new FileNotFoundException();
EagerTest.ClassVisitor classVisitor;
classVisitor = new EagerTest.ClassVisitor(PRODUCTION_FILE);
classVisitor.visit(productionFileCompilationUnit, null);
classVisitor = new EagerTest.ClassVisitor(TEST_FILE);
classVisitor.visit(testFileCompilationUnit, null);
}
/**
* Returns the set of analyzed elements (i.e. test methods)
*/
@Override
public List<SmellyElement> getSmellyElements() {
return smellyElementList;
}
/**
* Visitor class
*/
private class ClassVisitor extends VoidVisitorAdapter<Void> {
private MethodDeclaration currentMethod = null;
TestMethod testMethod;
private int eagerCount = 0;
private List<String> productionVariables = new ArrayList<>();
private List<String> calledMethods = new ArrayList<>();
private String fileType;
public ClassVisitor(String type) {
fileType = type;
}
@Override
public void visit(ClassOrInterfaceDeclaration n, Void arg) {
if (Objects.equals(fileType, PRODUCTION_FILE)) {
productionClassName = n.getNameAsString();
}
super.visit(n, arg);
}
@Override
public void visit(EnumDeclaration n, Void arg) {
if (Objects.equals(fileType, PRODUCTION_FILE)) {
productionClassName = n.getNameAsString();
}
super.visit(n, arg);
}
/**
* The purpose of this method is to 'visit' all test methods.
*/
@Override
public void visit(MethodDeclaration n, Void arg) {
// ensure that this method is only executed for the test file
if (Objects.equals(fileType, TEST_FILE)) {
if (Util.isTestMethod(n)) {
currentMethod = n;
testMethod = new TestMethod(currentMethod.getNameAsString());
testMethod.setHasSmell(false); //default value is false (i.e. no smell)
super.visit(n, arg);
testMethod.setHasSmell(eagerCount > 1); //the method has a smell if there is more than 1 call to production methods
smellyElementList.add(testMethod);
//reset values for next method
currentMethod = null;
eagerCount = 0;
productionVariables = new ArrayList<>();
calledMethods = new ArrayList<>();
}
} else { //collect a list of all public/protected members of the production class
for (Modifier modifier : n.getModifiers()) {
if (modifier.name().toLowerCase().equals("public") || modifier.name().toLowerCase().equals("protected")) {
productionMethods.add(n);
}
}
}
}
/**
* The purpose of this method is to identify the production class methods that are called from the test method
* When the parser encounters a method call:
* 1) the method is contained in the productionMethods list
* or
* 2) the code will check the 'scope' of the called method
* A match is made if the scope is either:
* equal to the name of the production class (as in the case of a static method) or
* if the scope is a variable that has been declared to be of type of the production class (i.e. contained in the 'productionVariables' list).
*/
@Override
public void visit(MethodCallExpr n, Void arg) {
NameExpr nameExpr = null;
if (currentMethod != null) {
if (productionMethods.stream().anyMatch(i -> i.getNameAsString().equals(n.getNameAsString()) &&
i.getParameters().size() == n.getArguments().size())) {
eagerCount++;
calledMethods.add(n.getNameAsString());
} else {
if (n.getScope().isPresent()) {
//this if statement checks if the method is chained and gets the final scope
if ((n.getScope().get() instanceof MethodCallExpr)) {
getFinalScope(n);
nameExpr = tempNameExpr;
}
if (n.getScope().get() instanceof NameExpr) {
nameExpr = (NameExpr) n.getScope().get();
}
if (nameExpr != null) {
//checks if the scope of the method being called is either of production class (e.g. static method)
//or
///if the scope matches a variable which, in turn, is of type of the production class
if (nameExpr.getNameAsString().equals(productionClassName) ||
productionVariables.contains(nameExpr.getNameAsString())) {
if (!calledMethods.contains(n.getNameAsString())) {
eagerCount++;
calledMethods.add(n.getNameAsString());
}
}
}
}
}
}
super.visit(n, arg);
}
private NameExpr tempNameExpr;
/**
* This method is utilized to obtain the scope of a chained method statement
*/
private void getFinalScope(MethodCallExpr n) {
if (n.getScope().isPresent()) {
if ((n.getScope().get() instanceof MethodCallExpr)) {
getFinalScope((MethodCallExpr) n.getScope().get());
} else if ((n.getScope().get() instanceof NameExpr)) {
tempNameExpr = ((NameExpr) n.getScope().get());
}
}
}
// /**
// * The purpose of this method is to capture the names of all variables, declared in the method body, that are of type of the production class.
// * The variable is captured as and when the code statement is parsed/evaluated by the parser
// */
// @Override
// public void visit(VariableDeclarationExpr n, Void arg) {
// if (currentMethod != null) {
// for (int i = 0; i < n.getVariables().size(); i++) {
// if (productionClassName.equals(n.getVariable(i).getType().asString())) {
// productionVariables.add(n.getVariable(i).getNameAsString());
// }
// }
// }
// super.visit(n, arg);
// }
@Override
public void visit(VariableDeclarator n, Void arg) {
if (Objects.equals(fileType, TEST_FILE)) {
if (productionClassName.equals(n.getType().asString())) {
productionVariables.add(n.getNameAsString());
}
}
super.visit(n, arg);
}
}
} | [
"[email protected]"
]
| |
c3ee7ce991d626b821bf19b28115150d36bd8d86 | 2ed7c4c05df3e2bdcb88caa0a993033e047fb29a | /common/com.raytheon.uf.common.wxmath/src/com/raytheon/uf/common/wxmath/ZToPsa.java | a6deabbe03c4d8486dae51eee475dbedd1bf81e9 | []
| no_license | Unidata/awips2-core | d378a50c78994f85a27b481e6f77c792d1fe0684 | ab00755b9e158ce66821b6fc05dee5d902421ab8 | refs/heads/unidata_18.2.1 | 2023-07-22T12:41:05.308429 | 2023-02-13T20:02:40 | 2023-02-13T20:02:40 | 34,124,839 | 3 | 7 | null | 2023-07-06T15:40:45 | 2015-04-17T15:39:56 | Java | UTF-8 | Java | false | false | 2,141 | java | /**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.wxmath;
/**
* Converts a height in meters into a pressure in a standard atmosphere in
* milibars.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 13, 2013 #2262 dgilling Ported from ztopsa.f.
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
public class ZToPsa {
private static final double Flg = 1e10;
// Never allow this class to be directly instantiated
private ZToPsa() {
throw new AssertionError();
}
/**
* This routine converts a height in meters into a pressure in a standard
* atmosphere in milibars.
*
* @param height
* Height (in m)
* @return Pressure (in mb)
*/
public static float ztopsa(float height) {
float ZtoPsa;
if (height > Flg) {
ZtoPsa = Float.NaN;
} else if (height < Constants.z11) {
ZtoPsa = (float) (Constants.p0 * Math.pow(
((Constants.T0 - Constants.gamma * height) / Constants.T0),
Constants.HGT_PRES_c1));
} else {
ZtoPsa = (float) (Constants.p11 * Math.pow(10,
((Constants.z11 - height) / Constants.HGT_PRES_c2)));
}
return ZtoPsa;
}
}
| [
"[email protected]"
]
| |
0faf2b98fcc8e91bf0a2f89e1c0a94bb7de8b0bf | 23102771bb4e3400588e9111867fae97a40016c6 | /src/main/java/com/serverMonitor/service/implementations/SchedulerService.java | 8579bb02bcfe07bb2a28b29317513c72950ec34f | []
| no_license | Mariesnlk/Monitoring-Servers | 5c6552d1880bbe89d82847da35710bcc609a694a | 8bc5f4a2fb9a7103177a65e91506c9a6ecc82477 | refs/heads/master | 2023-07-13T03:16:46.435886 | 2021-08-25T16:18:36 | 2021-08-25T16:18:36 | 399,882,297 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,793 | java | package com.serverMonitor.service.implementations;
import com.serverMonitor.database.enteties.monitoring.Monitoring;
import com.serverMonitor.database.enteties.command.TypeCommand;
import com.serverMonitor.database.enteties.monitoring.TypeMonitoring;
import com.serverMonitor.database.enteties.server.ServerInfo;
import com.serverMonitor.database.enteties.server.ServerStatus;
import com.serverMonitor.database.repository.command.CommandCrudRepository;
import com.serverMonitor.database.repository.monitoring.MonitoringCrudRepository;
import com.serverMonitor.service.implementations.service.MonitoringService;
import com.serverMonitor.service.implementations.service.RunScenarioService;
import com.serverMonitor.service.implementations.service.ServerService;
import com.serverMonitor.service.implementations.service.StatisticsService;
import com.serverMonitor.service.implementations.telegramModule.ChatBotService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@EnableScheduling
@Component
@Service
@RequiredArgsConstructor
@Slf4j
public class SchedulerService {
private final MonitoringService monitoringService;
private final MonitoringCrudRepository monitoringCrudRepository;
private final ServerService serverService;
private final StatisticsService statisticsService;
private final ChatBotService chatBotService;
private final RunScenarioService runScenarioService;
public static List<Monitoring> monitoringList = new ArrayList<>();
public static List<ServerInfo> serverInfoList = new ArrayList<>();
@Scheduled(initialDelay = 120_000, fixedDelay = 60_000)
public void checkServersForPinging() {
long currentTime = new Date().getTime();
monitoringList = monitoringCrudRepository.findAll();
ExecutorService executorService = Executors.newFixedThreadPool(monitoringList.size());
monitoringList.forEach(
monitoringServer -> {
ServerInfo serverInfo = serverService.getServerInfoById(monitoringServer.getServerId());
if (!(serverInfo.getStatus() == ServerStatus.PAUSE_MONITORING)) {
executorService.submit(() -> {
if (currentTime >= monitoringServer.getPingTime()) {
if (monitoringServer.getTypeMonitoring().equals(TypeMonitoring.RUN_COMMAND)) {
monitoringService.checkExpectedResponse(monitoringServer);
} else if (monitoringServer.getTypeMonitoring().equals(TypeMonitoring.RUN_REQUEST)) {
monitoringService.pingServer(monitoringServer);
}
}
});
}
});
}
@Scheduled(cron = "0 0 5 * * ?")
public void rebuildServersOnceADay() {
serverInfoList = serverService.getAllServers();
ExecutorService executorService = Executors.newFixedThreadPool(serverInfoList.size());
serverInfoList.forEach(
server ->
executorService.submit(() -> {
runScenarioService.runRebuildOnceADay(server.getId(), TypeCommand.REBUILD, ServerStatus.REBUILDING);
statisticsService.addActivitiesStatistics(server.getId(), "rebuild once a day");
}));
}
@Scheduled(cron = "0 3 5 * * ?")
public void setStatusRebuildServersOnceADay() {
serverInfoList = serverService.getAllServers();
ExecutorService executorService = Executors.newFixedThreadPool(serverInfoList.size());
serverInfoList.forEach(
server ->
executorService.submit(() -> {
if (server.getStatus() == ServerStatus.REBUILDING) {
if (monitoringCrudRepository.existsByServerId(server.getId())) {
serverService.activeMonitoring(server.getId());
} else {
serverService.disableMonitoring(server.getId());
}
chatBotService.broadcast("\uD83D\uDFE2The server " + server.getTitle() + " is success rebuilding");
}
}));
}
} | [
"[email protected]"
]
| |
66a53a0d5cdfc01e8b2666b736a9a2622326deaf | 9bc270e8a8f71750424ef2cbf8b12c6cb39ee138 | /Assignment3/src/Answers/StackTest.java | e4347e278be8812302035830efcd523f29f0e488 | []
| no_license | Sitabja/Data_Structure_Algorithm | 66788cd7df98a1b37ab98a1133c8a9360c693f3a | 8ecd7013b9ba158ad78aeec5c2440f6b706bc902 | refs/heads/master | 2021-09-06T05:13:03.060810 | 2018-02-02T16:49:12 | 2018-02-02T16:49:12 | 109,490,356 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 331 | java | package Answers;
public class StackTest {
/**
* @param args
*/
public static void main(String[] args) {
@SuppressWarnings("rawtypes")
ArrayStack s = new ArrayStack();
System.out.println(s);
s.push("A");
System.out.println(s);
s.push("B");
System.out.println(s);
s.push("C");
System.out.println(s);
}
}
| [
"[email protected]"
]
| |
3a096351e02bc3643036e046ea6cafa45dab2020 | 34f7c4794469bc26918913a5ee59d88a39dc4521 | /src/LIFE/C/LIFEC003Servlet.java | a786f5608b699e31a38482c2ea985505697c553d | []
| no_license | zlchanger/LifeInsurance-System | cb1cc783dec2729a0a933f37cf1faf5abe7ad074 | 31667c59b75d3eed9634b915568cf496d8e6b5c0 | refs/heads/master | 2020-12-02T19:49:36.300556 | 2017-07-06T06:50:32 | 2017-07-06T06:50:32 | 96,394,380 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,777 | java | package LIFE.C;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import LIFE.UTIL.NwCommonForm;
import LIFE.UTIL.NwCommonServlet;
import LIFE.UTIL.NwException;
/**
* Servlet implementation class LIFEC003Servlet
*/
@WebServlet("/LIFEC003Servlet")
public class LIFEC003Servlet extends NwCommonServlet {
private static final long serialVersionUID = 1L;
private String nextJsp = "LIFEC004";
private String errJsp = "LIFEC003";
/**
* @see HttpServlet#HttpServlet()
*/
public LIFEC003Servlet() {
super();
// TODO Auto-generated constructor stub
}
@Override
public String performTask(HttpServletRequest req, HttpServletResponse res, NwCommonForm formBean, String actionName)
throws NwException {
// TODO Auto-generated method stub
String[] Msg = {"","",""};
LIFEC001Form lifec001 = (LIFEC001Form)formBean;
String uktkno = (String)req.getParameter("reUktkno");
req.setAttribute("reUktkno", uktkno);
String namflg = (String)req.getParameter("namflg");
lifec001.setnameflg(namflg);
String birflg = (String)req.getParameter("birflg");
lifec001.setbirthflg(birflg);
String telflg = (String)req.getParameter("telflg");
lifec001.setteleflg(telflg);
String sexflg = (String)req.getParameter("sexflg");
lifec001.setsexflg(sexflg);
String wheflg = (String)req.getParameter("wheflg");
lifec001.setwheflg(wheflg);
String othflg = (String)req.getParameter("othflg");
lifec001.setothflg(othflg);
req.setAttribute("nextform", lifec001);
req.setAttribute("ErrMsg", Msg[0]);
req.setAttribute("WarMsg", Msg[1]);
req.setAttribute("NorMsg", Msg[2]);
return nextJsp;
}
}
| [
"[email protected]"
]
| |
2fecc2d7289f2154db48a7631700cf30f457e3af | 538e8de90299fa89cd6aa79dd3f84e909916f150 | /src/com/example/servercommunication/PostActivity.java | 0c4df49eb83fb979e1febbb6f712b614664d7727 | []
| no_license | martol01/ShazamTask | 7519ead0264d013e9bd72a8c5e929977c99c56b6 | 7de19fa7f041d79add3338cb80a58e2bf5388b4b | refs/heads/master | 2020-05-21T11:57:18.029882 | 2014-03-07T22:56:32 | 2014-03-07T22:56:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,906 | java | package com.example.servercommunication;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONObject;
import android.app.Activity;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class PostActivity extends Activity implements OnClickListener{
TextView tvIsConnected;
EditText etArtist,etTitle,etUrl;
Button btnPost;
Song song;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.post_request);
tvIsConnected = (TextView) findViewById(R.id.tvIsConnected);
etArtist = (EditText) findViewById(R.id.etArtist);
etTitle = (EditText) findViewById(R.id.etTitle);
etUrl = (EditText) findViewById(R.id.etUrl);
btnPost = (Button) findViewById(R.id.btnPost);
// check if you are connected or not
if(isConnected()){
tvIsConnected.setBackgroundColor(0xFF00CC00);
tvIsConnected.setText("You are conncted");
}
else{
tvIsConnected.setText("You are NOT conncted");
}
btnPost.setOnClickListener(this);
}
public static String POST(String url, Song song){
InputStream inputStream = null;
String result = "";
try {
// 1. create HttpClient
HttpClient httpclient = new DefaultHttpClient();
// 2. make POST request to the given URL
HttpPost httpPost = new HttpPost(url);
String json = "";
// 3. build jsonObject
JSONObject jsonObject = new JSONObject();
jsonObject.accumulate("artist", song.getArtist());
jsonObject.accumulate("title", song.getTitle());
jsonObject.accumulate("url", song.getUrl());
// 4. convert JSONObject to JSON to String
json = jsonObject.toString();
// ** Alternative way to convert Person object to JSON string usin Jackson Lib
// ObjectMapper mapper = new ObjectMapper();
// json = mapper.writeValueAsString(person);
// 5. set json to StringEntity
StringEntity se = new StringEntity(json);
// 6. set httpPost Entity
httpPost.setEntity(se);
// 7. Set some headers to inform server about the type of the content
httpPost.setHeader("Accept", "application/json");
httpPost.setHeader("Content-type", "application/json");
// 8. Execute POST request to the given URL
HttpResponse httpResponse = httpclient.execute(httpPost);
// 9. receive response as inputStream
inputStream = httpResponse.getEntity().getContent();
// 10. convert inputstream to string
if(inputStream != null)
result = convertInputStreamToString(inputStream);
else
result = "Did not work!";
} catch (Exception e) {
Log.d("InputStream", e.getLocalizedMessage());
}
// 11. return result
return result;
}
public boolean isConnected(){
ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Activity.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
if (networkInfo != null && networkInfo.isConnected())
return true;
else
return false;
}
@Override
public void onClick(View v) {
switch(v.getId()){
case R.id.btnPost:
if(!validate())
Toast.makeText(getBaseContext(), "Enter some data!", Toast.LENGTH_LONG).show();
// call AsynTask to perform network operation on separate thread
new HttpAsyncTask().execute("http://zasham.herokuapp.com/api/v1/songs");
break;
}
}///DO GIT CLONE OF THE APP ON HEROKU - MUSIC GAME AND TEST THIS
private class HttpAsyncTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... urls) {
song = new Song();
song.setArtist(etArtist.getText().toString());
song.setTitle(etTitle.getText().toString());
song.setUrl(etUrl.getText().toString());
return POST(urls[0],song);
}
// onPostExecute displays the results of the AsyncTask.
@Override
protected void onPostExecute(String result) {
Toast.makeText(getBaseContext(), "Data Sent!", Toast.LENGTH_LONG).show();
}
}
private boolean validate(){
if(etArtist.getText().toString().trim().equals(""))
return false;
else if(etTitle.getText().toString().trim().equals(""))
return false;
else if(etUrl.getText().toString().trim().equals(""))
return false;
else
return true;
}
private static String convertInputStreamToString(InputStream inputStream) throws IOException{
BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(inputStream));
String line = "";
String result = "";
while((line = bufferedReader.readLine()) != null)
result += line;
inputStream.close();
return result;
}
}
| [
"[email protected]"
]
| |
f5802ec823b26cdb56118c6c22e6d6b5a92fe4b9 | 6ec82d53504d6d60fdd9ba2c77627b8ce28fcf89 | /app/src/main/java/com/uni/cloud/chat/xunfei_tts/TtsSettings.java | e2888ad12cbe66a6d8ba23a389c600b06fea22cb | []
| no_license | patlihh/spos_chat | 14bf3ee06bb4ab8948314e9c3f4722969783c6f7 | fa7d99a0fa8e4bf890fb84ba46380c3cce6b1bef | refs/heads/master | 2020-04-11T07:17:47.840462 | 2018-12-29T06:53:36 | 2018-12-29T06:53:36 | 161,606,431 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,703 | java | package com.uni.cloud.chat.xunfei_tts;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceActivity;
import android.view.Window;
import com.uni.cloud.chat.R;
/**
* 合成设置界面
*/
public class TtsSettings extends PreferenceActivity implements OnPreferenceChangeListener {
public static final String PREFER_NAME = "com.iflytek.setting";
private EditTextPreference mSpeedPreference;
private EditTextPreference mPitchPreference;
private EditTextPreference mVolumePreference;
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
// 指定保存文件名字
getPreferenceManager().setSharedPreferencesName(PREFER_NAME);
addPreferencesFromResource(R.xml.tts_setting);
mSpeedPreference = (EditTextPreference)findPreference("speed_preference");
mSpeedPreference.getEditText().addTextChangedListener(new SettingTextWatcher(TtsSettings.this,mSpeedPreference,0,200));
mPitchPreference = (EditTextPreference)findPreference("pitch_preference");
mPitchPreference.getEditText().addTextChangedListener(new SettingTextWatcher(TtsSettings.this,mPitchPreference,0,100));
mVolumePreference = (EditTextPreference)findPreference("volume_preference");
mVolumePreference.getEditText().addTextChangedListener(new SettingTextWatcher(TtsSettings.this,mVolumePreference,0,100));
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
return true;
}
} | [
"[email protected]"
]
| |
3648e072428eba7f7064024ea3aa2e647186fda3 | 7e29076262cc6b0947ed4c9169f9290d8e4a0544 | /app/src/main/java/com/jerry_mar/mvc/view/AutomaticLayout.java | 73886bd17541e2275e766754f3d8fd1947a99594 | []
| no_license | jerry-mar/mvc | 402dc7708bb9a56fca52ddc87bdac49c49192150 | 5f6eaf30511e78e224a0e7e34a4b5acb33838212 | refs/heads/master | 2021-09-15T17:51:29.702694 | 2018-06-07T16:20:39 | 2018-06-07T16:20:39 | 125,164,404 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,050 | java | package com.jerry_mar.mvc.view;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import com.jerry_mar.mvc.R;
import java.util.ArrayList;
public class AutomaticLayout extends ViewGroup {
public static final int HORIZONTAL = 0;
public static final int VERTICAL = 1;
private int orientation;
private int column;
private ArrayList<ArrayList<View>> children = new ArrayList<>();
public AutomaticLayout(Context context) {
this(context, null);
}
public AutomaticLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public AutomaticLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView(context, attrs);
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public AutomaticLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
initView(context, attrs);
}
private void initView(Context context, AttributeSet attrs) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AutomaticLayout);
orientation = a.getInt(R.styleable.AutomaticLayout_orientation, HORIZONTAL);
column = a.getInt(R.styleable.AutomaticLayout_column, 0);
a.recycle();
}
public void setOrientation(int orientation) {
if (this.orientation != orientation) {
this.orientation = orientation;
requestLayout();
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
children.clear();
if (orientation == HORIZONTAL) {
measureHorizontal(widthMeasureSpec, heightMeasureSpec);
} else {
// measureVertical(widthMeasureSpec, heightMeasureSpec);
}
}
private void measureHorizontal(int widthMeasureSpec, int heightMeasureSpec) {
int mode = MeasureSpec.getMode(widthMeasureSpec);
int size = MeasureSpec.getSize(widthMeasureSpec);
int width = 0, lineWidth = 0, lineHeight = 0;
int height = getPaddingBottom() + getPaddingTop();
int max = size - getPaddingLeft() - getPaddingRight();
int item = column > 0 ? max / column : 0;
int count = getChildCount();
ArrayList<View> line = new ArrayList<>();
for(int i = 0; i < count; i++) {
View child = getChildAt(i);
if (child.getVisibility() == GONE) continue;
MarginLayoutParams params = (MarginLayoutParams) child.getLayoutParams();
int childMeasureSpec = widthMeasureSpec;
if (item > 0) {
int w = item - params.leftMargin - params.rightMargin;
params.width = w;
childMeasureSpec = MeasureSpec.makeMeasureSpec(w, MeasureSpec.EXACTLY);
}
measureChild(child, childMeasureSpec, heightMeasureSpec);
int childWidth = params.leftMargin + params.rightMargin + child.getMeasuredWidth();
int childHeight = params.topMargin + params.bottomMargin + child.getMeasuredHeight();
lineWidth += childWidth;
if(lineWidth > max) {
height += lineHeight;
width = Math.max(width, lineWidth - childWidth);
lineWidth = childWidth;
lineHeight = childHeight;
children.add(line);
line = new ArrayList<>();
} else {
lineHeight = Math.max(lineHeight, childHeight);
}
line.add(child);
if(i == count - 1) {
height += lineHeight;
}
}
if(line.size() > 0) children.add(line);
if(mode == MeasureSpec.EXACTLY)
width = size;
widthMeasureSpec = MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY);
heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
setMeasuredDimension(getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec),
getDefaultSize(getSuggestedMinimumHeight(), heightMeasureSpec));
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
if (orientation == HORIZONTAL) {
layoutHorizontal();
} else {
// layoutVertical();
}
}
private void layoutHorizontal() {
int rowCount = children.size();
int paddingLeft = getPaddingLeft();
int childTop = getPaddingTop();
for(int r = 0; r < rowCount; r++) {
ArrayList<View> row = children.get(r);
int columnCount = row.size();
int childLeft = paddingLeft;
int lineHeight = 0;
for(int c = 0; c < columnCount; c++) {
View child = row.get(c);
MarginLayoutParams params = (MarginLayoutParams) child.getLayoutParams();
child.layout(childLeft + params.leftMargin, childTop + params.topMargin,
childLeft + params.leftMargin + child.getMeasuredWidth(),
childTop + params.topMargin + child.getMeasuredHeight());
childLeft += params.leftMargin + child.getMeasuredWidth() + params.rightMargin;
lineHeight = Math.max(lineHeight, params.topMargin + params.bottomMargin + child.getMeasuredHeight());
}
childTop += lineHeight;
}
}
@Override
public LayoutParams generateLayoutParams(AttributeSet attrs) {
LayoutParams params = new MarginLayoutParams(getContext(), attrs);
return params;
}
@Override
protected LayoutParams generateDefaultLayoutParams() {
return new MarginLayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
}
}
| [
"[email protected]"
]
| |
a018cb8ec1f16b40e6ab3b879c3d0f33ada0222a | 9660baa89cb3217cf359cab47794af3918072f91 | /20181221_03/app/src/main/java/com/example/a10_g/a20181221_03/MainActivity.java | c80447bf2c1274cfb7ef36caf20dec3e70a1a8aa | []
| no_license | vincenttang1227/Android-Studio | 8a776e38bb00fba427106a0c16535cdf2df20c74 | cd4eca7a8c721870d0610c64fd9c8a65da02ab37 | refs/heads/master | 2020-04-09T07:39:43.201702 | 2018-12-27T09:14:45 | 2018-12-27T09:14:45 | 160,165,131 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,218 | java | package com.example.a10_g.a20181221_03;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
private EditText tvMain;
private Button btn1,btn2,btn3;
private Button btn4,btn5,btn6;
private Button btn7,btn8,btn9;
private Button btnCls, btn0, btnOk,btnEnd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tvMain = findViewById(R.id.tv_main);
btn1 = findViewById(R.id.btn_1);
btn2 = findViewById(R.id.btn_2);
btn3 = findViewById(R.id.btn_3);
btn4 = findViewById(R.id.btn_4);
btn5 = findViewById(R.id.btn_5);
btn6 = findViewById(R.id.btn_6);
btn7 = findViewById(R.id.btn_7);
btn8 = findViewById(R.id.btn_8);
btn9 = findViewById(R.id.btn_9);
btn0 = findViewById(R.id.btn_0);
btnCls = findViewById(R.id.btn_cls);
btnOk = findViewById(R.id.btn_ok);
btnEnd = findViewById(R.id.btn_end);
btn1.setOnClickListener(listener);
btn2.setOnClickListener(listener);
btn3.setOnClickListener(listener);
btn4.setOnClickListener(listener);
btn5.setOnClickListener(listener);
btn6.setOnClickListener(listener);
btn7.setOnClickListener(listener);
btn8.setOnClickListener(listener);
btn9.setOnClickListener(listener);
btn0.setOnClickListener(listener);
btnCls.setOnClickListener(listener);
btnOk.setOnClickListener(listener);
btnEnd.setOnClickListener(listener);
}
private Button.OnClickListener listener = new Button.OnClickListener() {
@Override
public void onClick(View v) {
switch(v.getId()) {
case R.id.btn_1:
displayATM("1");
break;
case R.id.btn_2:
displayATM("2");
break;
case R.id.btn_3:
displayATM("3");
break;
case R.id.btn_4:
displayATM("4");
break;
case R.id.btn_5:
displayATM("5");
break;
case R.id.btn_6:
displayATM("6");
break;
case R.id.btn_7:
displayATM("7");
break;
case R.id.btn_8:
displayATM("8");
break;
case R.id.btn_9:
displayATM("9");
break;
case R.id.btn_0:
displayATM("0");
break;
case R.id.btn_cls:
String str = tvMain.getText().toString();
if(str.length()>0){
str = str.substring(0,str.length()-1);
tvMain.setText(str);
}
break;
case R.id.btn_ok:
str = tvMain.getText().toString();
if(str.equals("123456")) {
Toast toast = Toast.makeText(MainActivity.this,"密碼正確,歡迎使用提款功能!",Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER,0,0);
toast.show();
}
else {
Toast toast = Toast.makeText(MainActivity.this,"密碼錯誤,請重新輸入!",Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER,0,50);
toast.show();
tvMain.setText("");
}
break;
case R.id.btn_end:
new AlertDialog.Builder(MainActivity.this)
.setTitle("確認視窗")
.setIcon(R.mipmap.ic_launcher)
.setMessage("確定要結束應用程式嗎?")
.setPositiveButton("確定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
})
.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})
.show();
break;
}
}
};
private void displayATM(String s) {
String str = tvMain.getText().toString();
tvMain.setText(str + s);
}
}
| [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.