blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 7
332
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
50
| license_type
stringclasses 2
values | repo_name
stringlengths 7
115
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 557
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
684M
⌀ | star_events_count
int64 0
77.7k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 17
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 82
values | src_encoding
stringclasses 28
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 7
5.41M
| extension
stringclasses 11
values | content
stringlengths 7
5.41M
| authors
listlengths 1
1
| author
stringlengths 0
161
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6ded49f3a984aec3fce9f5c315d5853521969f7d | 0d023b4ba193bef390473e9004ff9c75a142a50f | /myapplication/src/test/java/com/example/ru/mirea/boyko/myapplication/ExampleUnitTest.java | 7a4a8847262469b6ce83dd4e2bb37a986ba0e567 | []
| no_license | BoykoAlexe/PMob1 | 5bb58e0e2ba3f3254d487f7e01df56c68b6a5827 | 672a3c858f441b7f05283a6d417eb735d0873dad | refs/heads/main | 2023-03-11T05:46:07.843204 | 2021-02-28T17:35:27 | 2021-02-28T17:35:27 | 343,170,149 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package com.example.ru.mirea.boyko.myapplication;
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() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
]
| |
fe3c9b4b24093e6a05c10ce1232c74319e9cce64 | f5aa28626cdc71f8073c80c546f6994497413b43 | /Java/LeetCode/subarrays/MaximumSubarraySumFlippingSignsAtMostKElements.java | b228e6c93ab2a356e89d50775564ca7c6b6a68f7 | []
| no_license | nupuragrawal3/DataStructureAlgo | e1fdcb76d80bc4ff3c94bdab5b436c2b51eb97a7 | 39d70082acd8b2211386a28fcfcf35723b43db99 | refs/heads/master | 2020-09-11T21:16:06.696316 | 2019-11-10T15:17:29 | 2019-11-10T15:17:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,245 | java | package Java.LeetCode.subarrays;
import java.util.Arrays;
/**
* Author: Nitin Gupta([email protected])
* Date: 2019-07-25
* Description: https://www.geeksforgeeks.org/maximum-subarray-sum-by-flipping-signs-of-at-most-k-array-elements/
* Given an array arr[] of N integers and an integer K. The task is to find the maximum sub-array sum by flipping signs of at most K array elements.
* <p>
* Examples:
* <p>
* Input: arr[] = {-6, 2, -1, -1000, 2}, k = 2
* Output: 1009
* We can flip the signs of -6 and -1000, to get maximum subarray sum as 1009
* <p>
* Input: arr[] = {-1, -2, -100, -10}, k = 1
* Output: 100
* We can only flip the sign of -100 to get 100
* <p>
* Input: {1, 2, 100, 10}, k = 1
* Output: 113
* We do not need to flip any elements
*/
public class MaximumSubarraySumFlippingSignsAtMostKElements {
public static void main(String[] args) {
System.out.println(maxSumByFlipping(new int[]{-6, 2, -1, -1000, 2}, 2));
System.out.println(maxSumByFlipping(new int[]{-1, -2, -100, -10}, 1));
System.out.println(maxSumByFlipping(new int[]{1, 2, 100, 10}, 1));
}
/**
* Explanation:
* <p>
* Brute force: Since we allowed to do only at most K Flips (0 ... k) and we need to find "sub-array" has maximum sum.
* We can build all the sub-array of different size that take O(n^2) and for each sub-array of having at most n element
* we can try all the flips from 0 to K. Each element will have choice to get flip or not. O(nk).
* To compute the sum of sub-array we can use commutative sum array
* Complexity: O(k*n^3)
* <p>
* <p>
* Dynamic programming:
* If you see above, we are keep flipping a number and keep calculating what would be the state of final. This gives you overlapping
* and current sub-array sum is can be used by previous sub-array sum that give sub-problems
* <p>
* <p>
* Derivation
* Each element has only two choice,
* 1. either we flip this number and find the sub-array sum from next number with flips-1
* 2. Or we don't flip this number and find the sub-array sum from next number with flips
* <p>
* In case number become zero then we'll take 0
* And take max of above.
* <p>
* flips(i, k ) = Max {
* * Max { 0, nums[i] + flips(i+1, k) ) ; if we don't flip the current number
* * Max { 0, -nums[i] + flips (i+1, k-1} ; if we flip this current number
* * }
* <p>
* Let
* Dp[i][k] defines the maximum sum sub-array from i we get by k flips
* <p>
* Since our dp says from i then we need to try every i in order to find the sub-array.
*
* @param nums
* @param k
* @return
*/
private static int maxSumByFlipping(int[] nums, int k) {
if (null == nums || nums.length == 0)
return 0;
int max = 0;
int dp[][] = new int[nums.length][k + 1];
for (int i = 0; i < nums.length; i++)
Arrays.fill(dp[i], Integer.MIN_VALUE);
for (int i = 0; i < nums.length; i++)
max = Math.max(max, maxSumByFlipping(nums, k, i, dp));
return max;
}
/**
* Our choices
* Either flip this number or not at index nums[i]
* <p>
* Our constraints
* 1. Has we cover all numbers ( i>=n)
* 2. Has number of flips ends (k == 0)
* <p>
* Our goal
* Max sum
*
* @param nums
* @param i
* @return
*/
private static int maxSumByFlipping(int[] nums, int flips, int i, int dp[][]) {
//if this flip is not allowed
if (flips < 0)
return (int) (-1e9);
//no more element left
if (i == nums.length)
return 0;
//If we have solve this already
if (dp[i][flips] != Integer.MIN_VALUE)
return dp[i][flips];
int max;
int withoutFlip = nums[i] + maxSumByFlipping(nums, flips, i + 1, dp);
max = Math.max(0, withoutFlip);
int withFlip = -nums[i] + maxSumByFlipping(nums, flips - 1, i + 1, dp);
max = Math.max(max, withFlip);
return dp[i][flips] = max;
}
}
| [
"[email protected]"
]
| |
26fd16ccdc6c5bf3acbf276280317fb24fca46f8 | 1baf1a67629de41e5cbdb763204e2e8a112832dc | /src/test/java/com/cq/springbootjpademo/TopicTest.java | 10e5a61439280b06a3bb8150cc820645c337f3ed | []
| no_license | Arthur-Cao/spring-boot-jpa-demo | 602e87f5fb187ab6afb92c19e199bfd4ba59a476 | 77fba45f317ce99426096bf654baf458a9b36570 | refs/heads/master | 2020-04-05T06:40:23.601407 | 2018-11-08T03:41:25 | 2018-11-08T03:41:25 | 156,646,063 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 856 | java | package com.cq.springbootjpademo;
import com.cq.springbootjpademo.domin.Topic;
import com.cq.springbootjpademo.repository.TopicService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import javax.transaction.Transactional;
@RunWith(SpringRunner.class)
@SpringBootTest
public class TopicTest {
@Autowired
private TopicService topicService;
@Test
public void saveTopic(){
Topic topic = new Topic();
topic.setName("Art");
topicService.save(topic);
}
@Test
public void updateTopic(){
Topic topic = topicService.find(11l);
topic.setName("艺术");
topicService.update(topic);
}
}
| [
"[email protected]"
]
| |
da376341368b129ccb666cac839415bd98844645 | 7bae27cbbc4af0f26c7f2c00deb2849b1780dbca | /skeleton/src/main/java/cn/sinjinsong/skeleton/security/token/impl/TokenManagerImpl.java | 0c34b1466868ecf7233caf21b6454bd753dcbdc2 | []
| no_license | yeshaohuagg/JavaWebSkeleton | 4244adc626e7046472a4b4c9c0c1a775da08e2ce | 20ca13263f09744011da23147b62c24668fe77c6 | refs/heads/master | 2021-09-19T09:10:27.835484 | 2018-07-26T06:34:20 | 2018-07-26T06:34:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,770 | java | package cn.sinjinsong.skeleton.security.token.impl;
import cn.sinjinsong.common.cache.CacheManager;
import cn.sinjinsong.skeleton.exception.token.TokenStateInvalidException;
import cn.sinjinsong.skeleton.properties.AuthenticationProperties;
import cn.sinjinsong.skeleton.security.domain.TokenCheckResult;
import cn.sinjinsong.skeleton.security.token.TokenManager;
import cn.sinjinsong.skeleton.security.token.TokenState;
import io.jsonwebtoken.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.crypto.spec.SecretKeySpec;
import javax.xml.bind.DatatypeConverter;
import java.security.Key;
import java.util.Date;
/**
* Created by SinjinSong on 2017/4/27.
*/
@Component
@Slf4j
public class TokenManagerImpl implements TokenManager {
@Autowired
private CacheManager cacheManager;
@Autowired
private AuthenticationProperties authenticationProperties;
/**
* 一个JWT实际上就是一个字符串,它由三部分组成,头部、载荷与签名。
* iss: 该JWT的签发者,是否使用是可选的;
* sub: 该JWT所面向的用户,是否使用是可选的;
* aud: 接收该JWT的一方,是否使用是可选的;
* exp(expires): 什么时候过期,这里是一个Unix时间戳,是否使用是可选的;
* iat(issued at): 在什么时候签发的(UNIX时间),是否使用是可选的;
* 其他还有:
* nbf (Not Before):如果当前时间在nbf里的时间之前,则Token不被接受;一般都会留一些余地,比如几分钟;,是否使用是可选的;
* <p>
* JWT还需要一个头部,头部用于描述关于该JWT的最基本的信息,例如其类型以及签名所用的算法等。这也可以被表示成一个JSON对象。
* {
* "typ": "JWT",
* "alg": "HS256"
* }
*
* @param username 用户名
* @return
*/
@Override
public String createToken(String username) {
//获取加密算法
SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256;
//生成签名密钥
byte[] apiKeySecretBytes = DatatypeConverter.parseBase64Binary(authenticationProperties.getSecretKey());
Key signingKey = new SecretKeySpec(apiKeySecretBytes, signatureAlgorithm.getJcaName());
long nowMillis = System.currentTimeMillis();
Date now = new Date(nowMillis);
//添加构成JWT的参数
JwtBuilder builder = Jwts.builder().setHeaderParam("typ", "JWT")
.setId(username)
.setIssuedAt(now)
.signWith(signatureAlgorithm, signingKey);
//添加Token过期时间
long expireTime = System.currentTimeMillis() + authenticationProperties.getExpireTime() * 1000;
Date expireDateTime = new Date(expireTime);
builder.setExpiration(expireDateTime);
//生成JWT
String token = builder.compact();
//放入缓存
cacheManager.putWithExpireTime(String.valueOf(username.hashCode()), token, authenticationProperties.getExpireTime());
return token;
}
@Override
public TokenCheckResult checkToken(String token) {
if (token == null) {
return new TokenCheckResult.TokenCheckResultBuilder().inValid().exception(new TokenStateInvalidException(TokenState.NOT_FOUND.toString())).build();
}
Claims claims;
try {
claims = Jwts.parser()
.setSigningKey(DatatypeConverter.parseBase64Binary(authenticationProperties.getSecretKey()))
.parseClaimsJws(token).getBody();
} catch (ExpiredJwtException e) {
log.info("Token过期 {}",token);
return new TokenCheckResult.TokenCheckResultBuilder().inValid().exception(new TokenStateInvalidException(TokenState.EXPIRED.toString())).build();
} catch (Exception e) {
return new TokenCheckResult.TokenCheckResultBuilder().inValid().exception(new TokenStateInvalidException(TokenState.INVALID.toString())).build();
}
String username = claims.getId();
String cachedToken = cacheManager.get(String.valueOf(username.hashCode()), String.class);
if (cachedToken == null || !cachedToken.equals(token)) {
return new TokenCheckResult.TokenCheckResultBuilder().inValid().exception(new TokenStateInvalidException(TokenState.INVALID.toString())).build();
}
return new TokenCheckResult.TokenCheckResultBuilder().valid().username(username).build();
}
@Override
public void deleteToken(String username) {
cacheManager.delete(String.valueOf(username.hashCode()));
}
}
| [
"[email protected]"
]
| |
edaf8294a4caf0d49bb428e136b9961107d91c5d | 7659ff66a50bc4795a4639e189205ce47b418c2b | /app/src/main/java/com/example/linda/databasewithlistexample/MainActivity.java | 5b32bb65ba55d3ab6b9b66e3da9d31e25d12fbc6 | []
| no_license | QuinicAcid/DatabaseWithListExample | 40dc224d31a10c3bfa2f00031114593c144acf68 | 1f47eedb837a1be10bde6c30d19db72691e943e8 | refs/heads/master | 2020-03-22T19:08:38.141376 | 2018-07-13T04:13:42 | 2018-07-13T04:13:42 | 140,508,617 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,221 | java | package com.example.linda.databasewithlistexample;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.FilterQueryProvider;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
public class MainActivity extends Activity {
private CountriesDbAdapter dbHelper;
private SimpleCursorAdapter dataAdapter;
private EditText name;
private EditText countryCode;
private EditText uri;
String strCountry = "";
String strCode = "";
String strCont = "";
String strRegion = "";
final static Integer flag = 0;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
setContentView(R.layout.main);
Button addButton = (Button) this.findViewById(R.id.btnAdd);
Button delButton = (Button) this.findViewById(R.id.btnDelete);
addButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(MainActivity.this, AddNewCountry.class));
}
});
delButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(MainActivity.this, DeleteCountry.class));
}
});
dbHelper = new CountriesDbAdapter(this);
dbHelper.open();
// Clean all data
// dbHelper.deleteAllCountries();
// Add some data
// dbHelper.insertSomeCountries();
// Generate ListView from SQLite Database
DisplayTheList();
}
private void DisplayTheList() {
Cursor cursor = dbHelper.fetchAllCountries();
// The desired columns to be bound
String[] columns = new String[]{
CountriesDbAdapter.KEY_CODE,
CountriesDbAdapter.KEY_NAME,
CountriesDbAdapter.KEY_URI,
};
// the XML defined views which the data will be bound to
int[] to = new int[]{
R.id.code,
R.id.name,
R.id.uri,
};
// create the adapter using the cursor pointing to the desired data
//as well as the layout information
dataAdapter = new SimpleCursorAdapter(
this, R.layout.country_info,
cursor,
columns,
to,
0);
final ListView listView = (ListView) findViewById(R.id.listView1);
// Assign adapter to ListView
listView.setAdapter(dataAdapter);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> listView, View view,
int position, long id) {
/*
// Get the cursor, positioned to the corresponding row in the result set
Cursor cursor = (Cursor) listView.getItemAtPosition(position);
// Get the state's capital from this row in the database.
String code = cursor.getString(cursor.getColumnIndexOrThrow("code"));
//Toast.makeText(getApplicationContext(), code, Toast.LENGTH_SHORT).show();
*/
Cursor cursor = (Cursor) listView.getItemAtPosition(position);
// Get the state's capital from this row in the database.
String code = cursor.getString(cursor.getColumnIndexOrThrow("code"));
String name = cursor.getString(cursor.getColumnIndexOrThrow("name"));
String uri = cursor.getString(cursor.getColumnIndexOrThrow("uri"));
Intent intent = new Intent(MainActivity.this, SingleView.class);
intent.putExtra("code", code);
intent.putExtra("name", name);
intent.putExtra("uri", uri);
startActivity(intent);
}
});
EditText myFilter = (EditText) findViewById(R.id.myFilter);
myFilter.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
dataAdapter.getFilter().filter(s.toString());
}
});
dataAdapter.setFilterQueryProvider(new FilterQueryProvider() {
public Cursor runQuery(CharSequence constraint) {
return dbHelper.fetchCountriesByName(constraint.toString());
}
});
}
}
| [
"[email protected]"
]
| |
40ce1b18d566578c665308257c7a4388898d3afa | 995f73d30450a6dce6bc7145d89344b4ad6e0622 | /P40_HarmonyOS_2.0.0_Developer_Beta1/src/main/java/android/freeform/adapter/FloatItemAdapter.java | 73ec8a9600be1dde7c81e406543d45af99805438 | []
| no_license | morningblu/HWFramework | 0ceb02cbe42585d0169d9b6c4964a41b436039f5 | 672bb34094b8780806a10ba9b1d21036fd808b8e | refs/heads/master | 2023-07-29T05:26:14.603817 | 2021-09-03T05:23:34 | 2021-09-03T05:23:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,564 | java | package android.freeform.adapter;
import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.util.Flog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.hwext.internal.R;
import com.huawei.android.statistical.StatisticalConstant;
import java.util.ArrayList;
import java.util.List;
public class FloatItemAdapter extends BaseAdapter implements View.OnClickListener {
private static final int COLLECTION_CAPACITY_SHORT = 16;
private static final int DEVICE_DEFALUT_DENSITY = 160;
private static final float LCD_DENSITY = ((float) SystemProperties.getInt("ro.sf.lcd_density", 0));
private static final float REAL_LCD_DENSITY = ((float) SystemProperties.getInt("ro.sf.real_lcd_density", SystemProperties.getInt("ro.sf.lcd_density", 0)));
private Context mContext;
private float mDeviceDefalutDensity = 0.0f;
private float mDisplayDpi = 0.0f;
private List<FloatItem> mFloatItemList = new ArrayList(16);
public FloatItemAdapter(List<FloatItem> data, Context context) {
this.mContext = context;
this.mFloatItemList = data;
this.mDisplayDpi = (float) SystemProperties.getInt("persist.sys.dpi", 0);
this.mDeviceDefalutDensity = LCD_DENSITY / 160.0f;
}
private static class ViewHolder {
private ImageView image;
private Intent intent;
private TextView title;
private int userId;
private ViewHolder() {
}
}
@Override // android.view.View.OnClickListener
public void onClick(View view) {
ViewHolder vh;
if ((view.getTag() instanceof ViewHolder) && (vh = (ViewHolder) view.getTag()) != null && vh.intent != null) {
ActivityOptions opts = ActivityOptions.makeBasic();
ActivityManager.RunningTaskInfo runningTaskInfo = getRunningTaskInfo();
if (!(runningTaskInfo == null || runningTaskInfo.topActivity == null || runningTaskInfo.configuration.windowConfiguration.getWindowingMode() != 1)) {
String currentPkg = runningTaskInfo.topActivity.getPackageName();
Flog.bdReport((int) StatisticalConstant.TYPE_FREEFROM_START_FROM_TRIPLE_FINGERS_COUNT, "{pkg1:" + currentPkg + ",pkg2:" + vh.intent.getPackage() + "}");
}
opts.setLaunchWindowingMode(5);
this.mContext.startActivityAsUser(vh.intent.addFlags(268435456), opts.toBundle(), new UserHandle(vh.userId));
}
}
@Override // android.widget.Adapter
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder = null;
if (convertView == null) {
convertView = LayoutInflater.from(this.mContext).inflate(R.layout.hw_floatlist_item_layout, (ViewGroup) null);
viewHolder = new ViewHolder();
ImageView iv = (ImageView) convertView.findViewById(R.id.hw_floatlist_item_image);
ViewGroup.LayoutParams ivlp = iv.getLayoutParams();
ivlp.width = (int) ((((float) ivlp.width) * this.mDeviceDefalutDensity) / getDisplayDensity());
ivlp.height = (int) ((((float) ivlp.height) * this.mDeviceDefalutDensity) / getDisplayDensity());
viewHolder.image = iv;
TextView tv = (TextView) convertView.findViewById(R.id.hw_floatlist_item_title);
tv.setTextSize(0, (tv.getTextSize() * this.mDeviceDefalutDensity) / getDisplayDensity());
viewHolder.title = tv;
convertView.setTag(viewHolder);
} else if (convertView.getTag() instanceof ViewHolder) {
viewHolder = (ViewHolder) convertView.getTag();
}
FloatItem item = this.mFloatItemList.get(position);
if (!(viewHolder == null || item == null)) {
viewHolder.title.setText(item.getLabel());
viewHolder.image.setImageDrawable(item.getIcon());
viewHolder.intent = item.getIntent();
viewHolder.userId = item.getUserId();
}
convertView.setOnClickListener(this);
return convertView;
}
@Override // android.widget.Adapter
public int getCount() {
List<FloatItem> list = this.mFloatItemList;
if (list != null) {
return list.size();
}
return 0;
}
@Override // android.widget.Adapter
public Object getItem(int position) {
return this.mFloatItemList.get(position);
}
@Override // android.widget.Adapter
public long getItemId(int position) {
return (long) position;
}
public float getDisplayDensity() {
float f = this.mDisplayDpi;
if (f == 0.0f) {
return this.mDeviceDefalutDensity;
}
return ((LCD_DENSITY * f) / REAL_LCD_DENSITY) / 160.0f;
}
public float getDeviceDefalutDensity() {
return this.mDeviceDefalutDensity;
}
private ActivityManager.RunningTaskInfo getRunningTaskInfo() {
ActivityManager am = (ActivityManager) this.mContext.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningTaskInfo> tasks = null;
if (am != null) {
tasks = am.getRunningTasks(1);
}
if (tasks == null || tasks.isEmpty()) {
return null;
}
return tasks.get(0);
}
}
| [
"[email protected]"
]
| |
ee04417cb89dc96df8ee1589e2d48c9701fac866 | dd17413f728080d88077d335acc7174828f029a4 | /src/APT201/Tourney.java | 3936e0656e34fe67e490155b63a2b233276fe88f | []
| no_license | yubotian/ICPC_practice | 732677e5e22eb6b081bfe7aea6f58d8efb80b0aa | cb89b44d839b36c6d9697aedbbda692841a1b917 | refs/heads/master | 2020-04-01T07:00:30.355329 | 2015-11-06T17:04:52 | 2015-11-06T17:04:52 | 25,493,909 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,031 | java | package APT201;
public class Tourney {
public String winner(String[] bracket, String results) {
if (bracket.length == 1)
return bracket[0];
String[] nextbracket = new String[(bracket.length) / 2];
String ref = "LH";
for (int i = 0; i<bracket.length; i++){
if (bracket[i].equals("bye")){
results = results.substring(0,i/2) + ref.charAt(i%2) + results.substring(i/2);
}
}
for (int i = 0; i < bracket.length; i = i + 2) {
if (results.charAt(i/2) == 'H') {
nextbracket[i / 2] = bracket[i];
}
if (results.charAt(i/2) == 'L')
nextbracket[i / 2] = bracket[i + 1];
}
String nextresults = results.substring((bracket.length)/2);
return winner(nextbracket, nextresults);
}
public static void main(String[] args) {
Tourney T = new Tourney();
String[] Bracket = { "A", "B", "A", "C", "X", "bye", "bye", "D", "E",
"F", "G", "H", "I", "J", "K", "L" };
String results = "LHHLLHHLHLLLH";
String TT = T.winner(Bracket, results);
System.out.println(TT);
}
}
| [
"[email protected]"
]
| |
97cfa2e7955ea5217dc9896c430f670ecab4672f | d6b6abe73a0c82656b04875135b4888c644d2557 | /sources/com/google/common/collect/gw.java | 4ceb4c311aecdc6dea82f2ff5efaf0884fd9aeb0 | []
| no_license | chanyaz/and_unimed | 4344d1a8ce8cb13b6880ca86199de674d770304b | fb74c460f8c536c16cca4900da561c78c7035972 | refs/heads/master | 2020-03-29T09:07:09.224595 | 2018-08-30T06:29:32 | 2018-08-30T06:29:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 804 | java | package com.google.common.collect;
import com.google.common.base.o;
import com.google.common.collect.Multiset.Entry;
import javax.annotation.Nullable;
abstract class gw<E> implements Entry<E> {
gw() {
}
public boolean equals(@Nullable Object obj) {
if (!(obj instanceof Entry)) {
return false;
}
Entry entry = (Entry) obj;
return getCount() == entry.getCount() && o.a(getElement(), entry.getElement());
}
public int hashCode() {
Object element = getElement();
return (element == null ? 0 : element.hashCode()) ^ getCount();
}
public String toString() {
String valueOf = String.valueOf(getElement());
int count = getCount();
return count == 1 ? valueOf : valueOf + " x " + count;
}
}
| [
"[email protected]"
]
| |
8b8ac54fb072741cb9da20cc0abb14a38844c16f | c8df2b2ffb6eae760d5f1a7cd71e5b4becf23a3b | /app/src/main/java/com/ampme/challenge/utils/Utils.java | 0cac6dc5d4fc908d8771865afeb08793a8c26682 | []
| no_license | ldev6/challenge | 756dc8894637bdc0fe2f03172ea2e422740f6305 | 237c2c6ff75a572383f5e1da3e817ada63aa4f70 | refs/heads/master | 2021-01-17T23:35:43.124913 | 2017-03-07T18:51:48 | 2017-03-07T18:51:48 | 84,229,377 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 896 | java | package com.ampme.challenge.utils;
import android.app.Activity;
import android.app.FragmentManager;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
public class Utils {
/**
* To change fragment
*
* @param activity
* @param idView
* @param fragment
*/
public static void changeFragment(FragmentActivity activity, int idView, Fragment fragment) {
if (!fragment.isAdded()) {
activity.getSupportFragmentManager().beginTransaction().replace(idView, fragment).commit();
}
}
public static void changeFragment(Activity activity, int idView, android.app.Fragment fragment) {
if (!fragment.isAdded()) {
FragmentManager fragmentManager = activity.getFragmentManager();
fragmentManager.beginTransaction().replace(idView, fragment).commit();
}
}
}
| [
"[email protected]"
]
| |
99e308c2a2b2abc2db51c010e4f25a34a8433ca0 | 7400115347e23e5da7e467360c248f72e572d628 | /gomint-api/src/main/java/io/gomint/world/block/BlockLightWeightedPressurePlate.java | 83c4f8dad532ff1b463ad0ecde86f5a702ef017f | [
"BSD-3-Clause"
]
| permissive | hanbule/GoMint | 44eaf0ec20ff0eeaaf757de9d6540de786deead9 | a5a5b937d145598e59febdb2cca0fe2eb58dd1ee | refs/heads/master | 2022-12-15T14:35:23.310316 | 2020-08-22T13:40:46 | 2020-08-22T13:40:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 305 | java | /*
* Copyright (c) 2018 Gomint team
*
* This code is licensed under the BSD license found in the
* LICENSE file in the root directory of this source tree.
*/
package io.gomint.world.block;
/**
* @author geNAZt
* @version 1.0
*/
public interface BlockLightWeightedPressurePlate extends Block {
}
| [
"[email protected]"
]
| |
1881858e6652546120f0118ab91572514bfaada7 | a3b38e9ba0bca17541c26bf03f7a7f18a9862282 | /service/src/main/java/com/jino/server/spark/utils/IssueEventUsersUtil.java | 061ee79fdbb45b2ee57416c8b7819f6f91b5aa5a | []
| no_license | aravinty/jino | 04e10661d197157271e8ff2d63e38d753dfb86b2 | afc90fc65249557032802161f102fad1e6532719 | refs/heads/master | 2021-08-10T22:28:27.842087 | 2017-11-13T01:32:15 | 2017-11-13T01:32:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,446 | java | package com.jino.server.spark.utils;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.jino.common.Issue;
import com.jino.common.IssueEvent;
import com.jino.common.User;
import java.util.HashSet;
import java.util.Set;
import java.util.logging.Logger;
public class IssueEventUsersUtil {
private static final Logger logger = Logger.getLogger(IssueEventUsersUtil.class.getName());
private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
public static Set<String> getTargetEmails(IssueEvent issueEvent) {
Set<String> emails = new HashSet<>();
Issue issue = issueEvent.getIssue();
logger.info("creator : " + gson.toJson(issue.getFields().getCreator()));
logger.info("reporter : " + gson.toJson(issue.getFields().getReporter()));
logger.info("assignee : " + gson.toJson(issue.getFields().getAssignee()));
//creator
emails.add(getEmail(issue.getFields().getCreator()));
//reporter
emails.add(getEmail(issue.getFields().getReporter()));
//assignee
emails.add(getEmail(issue.getFields().getAssignee()));
//TODO: Add mentions
//TODO: Add watchers.
return emails;
}
private static String getEmail(User user) {
if(user == null || !user.isActive()) {
return null;
} else {
return user.getEmailAddress();
}
}
}
| [
"[email protected]"
]
| |
b7c4f0bab9359084d99240e90ce179d2227c0e04 | a084e5a116fbe9fdb4bbcf899ebe1bbef2de6a8a | /Spring/src/main/java/com/kosta/myapp/HaEunController.java | 4124e43ace637846b063d011b300980c13ae4f45 | []
| no_license | ball4716/kosta130 | cb082cbe6e8a22735789efa8c0f25235661d8b1b | 35253a183b529d76c7e404af7a451baf62ed6fdf | refs/heads/master | 2020-02-26T17:27:12.538435 | 2016-11-08T06:47:07 | 2016-11-08T06:47:07 | 71,738,465 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 4,946 | java | package com.kosta.myapp;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.kosta.s1107.LoginProcess;
import com.kosta.s1107.User;
import com.kosta.s1107.UserInfo;
@Controller
//@RequestMapping("/game")
public class HaEunController{
private static final Logger logger = LoggerFactory.getLogger(SampleControllerTest.class);
//메소드를 통해 사용자 요청을 정의!!
@RequestMapping("/kosta130/haeun")
//사용자 URL요청 정의, struts-config.xml <action path="">역할
public String m1(){//단순 JSP 포워딩
/*
SpringFramework는
XML파일(servlet-context.xml)내의 InternalResourceViewResolver클래스를 통해
View객체를 생성!!
prefix: "/WEB-INF/views/"
suffix: ".jsp"
====> "/WEB-INF/views/" + 개발자가 전달하는 문자열 + ".jsp"
====> "/WEB-INF/views/" + "1107/hello" + ".jsp"
====> "/WEB-INF/views/1107/hello.jsp"
*/
return "1107/hello";
}
@RequestMapping("/1107/hello2")
public void m2(){
//만약 리턴문자열이 없다면 요청URL을 뷰객체 만드는데 사용!!
}
@RequestMapping("/form")
public String m3(){
logger.info("로그인폼 요청~~");
return "1107/form";
}
@RequestMapping("/login")
public String login(HttpServletRequest req){
String id = req.getParameter("id");
String pass = req.getParameter("pass");
System.out.println("아이디: "+id+", 비번: "+pass);
//모델 검사
LoginProcess lp = new LoginProcess();
UserInfo user = lp.login(id,pass);
/*if(user==null){
return "success";
}else if(user != null){
return "fail";
}*/
//뷰와 공유할 데이터 저장!!
req.setAttribute("user", user);
return "1107/result";
}//login
@RequestMapping("login2")
public String login2(String id, String pass,
//HttpServletRequest request) {
Model m){
//HTML폼내의 name속성과 일치하는
// TODO Auto-generated method stub
System.out.println("login2 ID: "+id);
LoginProcess lp = new LoginProcess();
UserInfo user = lp.login(id,pass);
//영역저장!!
//Model은 데이터를 저장하는 객체!!
//Model의 영역은 request영역과 같다~!!
m.addAttribute("user", user);
return "1107/result";
}
@RequestMapping("/result")
public String result(){
return "1107/result.jsp";
}
@RequestMapping("/login3")
public String login3(String id, String pass, HttpSession req) {
LoginProcess lp = new LoginProcess();
UserInfo user = lp.login(id,pass);
req.setAttribute("user", user);
return "redirect:result";
}
@RequestMapping("login4")
public ModelAndView login4(User user){
System.out.println("user.getId():"+user.getId());
LoginProcess lp = new LoginProcess();
UserInfo info = lp.login(user.getId(), user.getPass());
ModelAndView mav = new ModelAndView();//모델과 뷰에 대한 정보를 담는 클래스
//mav.setViewName(String viewName);
mav.setViewName("1107/result");
//mav.addObject(String key, Object value);
mav.addObject("user",info);
mav.addObject("msg", "안녕Spring~!!");
return mav;
}//옛날방식
/****************************************************
* 뷰(jsp) 없이 데이터 전달 : Ajax요청시 사용 *
***************************************************/
@RequestMapping("/getData")
public String getData(){
return "1107/getData";
}//jsp 페이지 만들고 하기
@RequestMapping("/getData2")
public @ResponseBody String getData2(HttpServletResponse resp){
//resp.setCharacterEncoding("UTF-8");
return "잘가, SpringMVC~!!";
}//jsp 페이지 안만들고 하기
//---> 한글 문자열 처리: servlet-context.xml의
@RequestMapping("/doJson")
public @ResponseBody User doJson() {
return new User("gildong","1234","너길동","가산디지털");
}
/* @RequestMapping("doC")
public String doC(String str,Model m){
m.addAttribute("msg",str);
return "1107/result";
}
public String doC(String str)
----> String str = request.getParameter("str");
public String doC(@ModelAttribute("msg") String str)
----> String str = request.getParameter("msg");
----> model.addObject("msg",str);
*/
@RequestMapping("/doC")
public String doC(@ModelAttribute("msg") String str){
System.out.println("STR:"+str);
return "1107/result";
}
}
| [
"Hyunyoung@DESKTOP-Q7FRSEG"
]
| Hyunyoung@DESKTOP-Q7FRSEG |
bb3f28365de6bab287adf01a68e44b42e50f0790 | 1fde81b733f242bbea5518e3e891263199664d80 | /src/test/java/uk/gov/hmcts/cmc/claimstore/services/ccd/callbacks/caseworker/ResetAndSendNewPinCallbackHandlerTest.java | 93a7dfdab961d2c3e08dc262fc052142adff30bc | [
"MIT"
]
| permissive | ManishParyani/cmc-claim-store | d27232fa918b4a4ff3d5dfde4842654e71dfa864 | 4b96a674dd27c54f8491d587576ad26b38159bb9 | refs/heads/master | 2023-07-07T06:42:59.716377 | 2021-08-10T16:27:15 | 2021-08-10T16:27:15 | 376,942,826 | 0 | 0 | MIT | 2021-06-14T20:05:16 | 2021-06-14T20:05:15 | null | UTF-8 | Java | false | false | 7,726 | java | package uk.gov.hmcts.cmc.claimstore.services.ccd.callbacks.caseworker;
import com.google.common.collect.ImmutableMap;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import uk.gov.hmcts.cmc.ccd.domain.CCDAddress;
import uk.gov.hmcts.cmc.ccd.domain.CCDCase;
import uk.gov.hmcts.cmc.ccd.domain.CCDCollectionElement;
import uk.gov.hmcts.cmc.ccd.domain.CCDParty;
import uk.gov.hmcts.cmc.ccd.domain.CaseEvent;
import uk.gov.hmcts.cmc.ccd.domain.defendant.CCDRespondent;
import uk.gov.hmcts.cmc.claimstore.config.properties.notifications.EmailTemplates;
import uk.gov.hmcts.cmc.claimstore.config.properties.notifications.NotificationTemplates;
import uk.gov.hmcts.cmc.claimstore.config.properties.notifications.NotificationsProperties;
import uk.gov.hmcts.cmc.claimstore.idam.models.GeneratePinResponse;
import uk.gov.hmcts.cmc.claimstore.services.UserService;
import uk.gov.hmcts.cmc.claimstore.services.ccd.CCDCreateCaseService;
import uk.gov.hmcts.cmc.claimstore.services.ccd.callbacks.CallbackParams;
import uk.gov.hmcts.cmc.claimstore.services.ccd.callbacks.CallbackType;
import uk.gov.hmcts.cmc.claimstore.services.notifications.ClaimIssuedNotificationService;
import uk.gov.hmcts.cmc.claimstore.utils.CaseDetailsConverter;
import uk.gov.hmcts.cmc.domain.models.Claim;
import uk.gov.hmcts.cmc.domain.models.sampledata.SampleClaim;
import uk.gov.hmcts.cmc.domain.models.sampledata.SampleTheirDetails;
import uk.gov.hmcts.reform.ccd.client.model.AboutToStartOrSubmitCallbackResponse;
import uk.gov.hmcts.reform.ccd.client.model.CallbackRequest;
import uk.gov.hmcts.reform.ccd.client.model.CaseDetails;
import java.util.Collections;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class ResetAndSendNewPinCallbackHandlerTest {
@Mock
private CaseDetailsConverter caseDetailsConverter;
@Mock
private UserService userService;
@Mock
private ClaimIssuedNotificationService claimIssuedNotificationService;
@Mock
private NotificationsProperties notificationsProperties;
@Mock
private CCDCreateCaseService ccdCreateCaseService;
@Mock
private NotificationTemplates templates;
@Mock
private EmailTemplates emailTemplates;
private ResetAndSendNewPinCallbackHandler resetAndSendNewPinCallbackHandler;
private CallbackParams callbackParams;
private static final String AUTHORISATION = "Bearer: aaaa";
private static final String DEFENDANT_EMAIL_TEMPLATE = "Defendant Email PrintableTemplate";
private static final String PIN = "PIN";
private static final String EXTERNAL_ID = "external id";
private static final String CASE_NAME = "case name";
private static final String REFERENCE = "reference";
private static final String DEFENDANT_NAME = "Sue";
private static final Long ID = 1L;
private CallbackRequest callbackRequest;
private Claim sampleClaimWithDefendantEmail =
SampleClaim.getDefaultWithoutResponse(SampleTheirDetails.DEFENDANT_EMAIL);
private Claim sampleClaimWithoutDefendantEmail = SampleClaim.getDefaultWithoutResponse(null);
private Claim sampleLinkedClaim = SampleClaim.getClaimWithFullDefenceAlreadyPaid();
@Before
public void setUp() throws Exception {
resetAndSendNewPinCallbackHandler = new ResetAndSendNewPinCallbackHandler(
caseDetailsConverter,
userService,
claimIssuedNotificationService,
notificationsProperties,
ccdCreateCaseService
);
callbackRequest = CallbackRequest
.builder()
.caseDetails(CaseDetails.builder().data(Collections.emptyMap()).build())
.eventId(CaseEvent.RESET_PIN.getValue())
.build();
callbackParams = CallbackParams.builder()
.type(CallbackType.ABOUT_TO_SUBMIT)
.request(callbackRequest)
.params(ImmutableMap.of(CallbackParams.Params.BEARER_TOKEN, AUTHORISATION))
.build();
}
@Test
public void shouldReturnErrorWhenClaimIsAlreadyLinkedToDefendant() {
when(caseDetailsConverter.extractClaim(any(CaseDetails.class))).thenReturn(sampleLinkedClaim);
AboutToStartOrSubmitCallbackResponse response
= (AboutToStartOrSubmitCallbackResponse) resetAndSendNewPinCallbackHandler.handle(callbackParams);
assertThat(response.getErrors())
.contains("Claim has already been linked to defendant - cannot send notification");
}
@Test
public void shouldReturnErrorWhenDefendantHasNoEmailAddressInClaim() {
when(caseDetailsConverter.extractClaim(any(CaseDetails.class))).thenReturn(sampleClaimWithoutDefendantEmail);
AboutToStartOrSubmitCallbackResponse response
= (AboutToStartOrSubmitCallbackResponse) resetAndSendNewPinCallbackHandler.handle(callbackParams);
assertThat(response.getErrors())
.contains("Claim doesn't have defendant email address - cannot send notification");
}
@Test
public void shouldSendNewPinNotificationToDefendant() {
when(caseDetailsConverter.extractClaim(any(CaseDetails.class))).thenReturn(sampleClaimWithDefendantEmail);
when(notificationsProperties.getTemplates()).thenReturn(templates);
when(templates.getEmail()).thenReturn(emailTemplates);
when(emailTemplates.getDefendantClaimIssued()).thenReturn(DEFENDANT_EMAIL_TEMPLATE);
String letterHolderId = "333";
GeneratePinResponse pinResponse = new GeneratePinResponse(PIN, letterHolderId);
when(userService.generatePin(anyString(), eq(AUTHORISATION))).thenReturn(pinResponse);
when(caseDetailsConverter.extractCCDCase(any(CaseDetails.class))).thenReturn(getCcdCase());
resetAndSendNewPinCallbackHandler.handle(callbackParams);
verify(claimIssuedNotificationService).sendMail(
eq(sampleClaimWithDefendantEmail),
eq(sampleClaimWithDefendantEmail.getClaimData().getDefendant().getEmail().orElse(null)),
eq(PIN),
eq(DEFENDANT_EMAIL_TEMPLATE),
eq("defendant-issue-notification-" + sampleClaimWithDefendantEmail.getReferenceNumber()),
eq(sampleClaimWithDefendantEmail.getClaimData().getDefendant().getName())
);
}
private CCDCase getCcdCase() {
return CCDCase.builder()
.externalId(EXTERNAL_ID)
.previousServiceCaseReference(REFERENCE)
.caseName(CASE_NAME)
.respondents(List.of(CCDCollectionElement.<CCDRespondent>builder()
.value(CCDRespondent.builder()
.partyName(DEFENDANT_NAME)
.claimantProvidedPartyName(DEFENDANT_NAME)
.partyDetail(CCDParty.builder()
.primaryAddress(CCDAddress.builder().addressLine1("NEW ADDRESS1")
.addressLine2("NEW ADDRESS2")
.postCode("NEW POSTCODE").build())
.build())
.claimantProvidedDetail(CCDParty.builder()
.primaryAddress(CCDAddress.builder().addressLine1("OLD ADDRESS1")
.addressLine2("OLD ADDRESS2")
.postCode("OLD POSTCODE").build())
.build())
.build())
.build()))
.id(ID)
.build();
}
}
| [
"[email protected]"
]
| |
f68722121938602f7030b46111f2d1337826d0b0 | 664a561924559cfee47f8a1a3c5f6f623871e919 | /备份/new-gateway/src/main/java/com/bgy/gateway/service/impl/DataModelServiceImpl.java | e4a4979a97f18dcb3c3b73606e5356e4e26673ff | []
| no_license | beanxxy/code | 1a213d7d31a8edfbe5e4dc1bf993ca8fec29b078 | e53fdab5b5e0394f1274e9292325d7d9e97070ce | refs/heads/master | 2022-12-24T15:57:12.091431 | 2021-01-06T02:16:09 | 2021-01-06T02:16:09 | 212,816,407 | 0 | 0 | null | 2022-12-14T20:50:24 | 2019-10-04T13:02:35 | CSS | UTF-8 | Java | false | false | 1,601 | java | package com.bgy.gateway.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bgy.gateway.dao.mapper.DataModelMapper;
import com.bgy.gateway.model.dto.DataModelInfo;
import com.bgy.gateway.model.entity.DataModelEntity;
import com.bgy.gateway.model.vo.DataModelVO;
import com.bgy.gateway.model.vo.EventVO;
import com.bgy.gateway.service.DataModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author caijunwei
* date 2020/11/26 9:34
*/
@Service
public class DataModelServiceImpl extends ServiceImpl<DataModelMapper, DataModelEntity> implements DataModelService {
@Autowired
DataModelMapper dataModelMapper;
@Override
public DataModelEntity getDataModelEntity(Long componentId) {
return dataModelMapper.selectOne(new QueryWrapper<DataModelEntity>().eq("component_id", componentId));
}
@Override
public List<DataModelVO> listDataModelEntity(Long dataModelId) {
return dataModelMapper.listDataModelEntity(dataModelId);
}
@Override
public List<EventVO> listMonitorModel(Long componentId) {
return dataModelMapper.listMonitorModel(componentId);
}
@Override
public boolean saveBatch(List<DataModelInfo> modelInfoList) {
return this.saveBatch(modelInfoList);
}
@Override
public int delete(List<DataModelInfo> modelInfoList) {
return dataModelMapper.deleteDataModelEntity();
}
}
| [
"[email protected]"
]
| |
b21f7dbb4ce0255e3aac4730e43e3abc41b4c5b8 | d37c00442da6b99d5ef3df7c4d9d8606fe3859cd | /src/main/java/com/wavemaker/salesforce/ApiConfig.java | fa711085339982e4b0ff2413f240af63c667e8de | []
| no_license | amitanjani/SalesForceAPI | 77e0a1d7f3bb8992cd7f79257c2817456f99be87 | c136fe00b04772a7258a1e8c7bf0068abe755017 | refs/heads/master | 2021-01-15T11:40:49.033213 | 2014-06-04T10:44:27 | 2014-06-04T10:44:27 | 20,479,684 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,430 | java | package com.wavemaker.salesforce;
import java.net.URI;
import java.net.URLDecoder;
public class ApiConfig {
ApiVersion apiVersion = ApiVersion.DEFAULT_VERSION;
String username;
String password;
String loginEndpoint = "https://login.salesforce.com";
String clientId;
String clientSecret;
String redirectURI;
public ApiConfig clone() {
return new ApiConfig()
.setApiVersion(apiVersion)
.setUsername(username)
.setPassword(password)
.setLoginEndpoint(loginEndpoint)
.setClientId(clientId)
.setClientSecret(clientSecret)
.setRedirectURI(redirectURI);
}
public ApiConfig setForceURL(String url) {
try {
URI uri = new URI(url);
loginEndpoint = "https://"+uri.getHost()+(uri.getPort()>0 ? ":"+uri.getPort() : "");
String[] params = uri.getQuery().split("&");
for(String param : params) {
String[] kv = param.split("=");
if(kv[0].equals("user")) {
username = URLDecoder.decode(kv[1],"UTF-8");
} else if(kv[0].equals("password")) {
password = URLDecoder.decode(kv[1],"UTF-8");
} else if(kv[0].equals("oauth_key")) {
clientId = URLDecoder.decode(kv[1],"UTF-8");
} else if(kv[0].equals("oauth_secret")) {
clientSecret = URLDecoder.decode(kv[1],"UTF-8");
}
}
} catch (Exception e) {
throw new IllegalArgumentException("Couldn't parse URL: "+url,e);
}
return this;
}
public ApiConfig setRedirectURI(String redirectURI) {
this.redirectURI = redirectURI;
return this;
}
public ApiConfig setApiVersion(ApiVersion value) {
apiVersion = value;
return this;
}
public ApiConfig setUsername(String value) {
username = value;
return this;
}
public ApiConfig setPassword(String value) {
password = value;
return this;
}
public ApiConfig setLoginEndpoint(String value) {
loginEndpoint = value;
return this;
}
public ApiConfig setClientId(String value) {
clientId = value;
return this;
}
public ApiConfig setClientSecret(String value) {
clientSecret = value;
return this;
}
public String getUsername() {
return username;
}
public String getPassword() {
return password;
}
public String getLoginEndpoint() {
return loginEndpoint;
}
public String getClientId() {
return clientId;
}
public String getClientSecret() {
return clientSecret;
}
public String getRedirectURI() {
return redirectURI;
}
public ApiVersion getApiVersion() {
return apiVersion;
}
}
| [
"[email protected]"
]
| |
8aeb3bf6f98b073349833de828815e60f019b021 | 17c60c10fcaf8eb5d256d3af248560f3b1731e66 | /Calculus/src/main/java/si/vajnartech/calculus/R2Float.java | ef12aa4e35089a88c33976910e53969d43149504 | []
| no_license | vajnar7/VajnarGlobe | 57c214b95cb9db85f2bda38f86d78ee7a650212b | 96c34f1e660d484845fefd4194f17bfaef68a774 | refs/heads/master | 2023-05-26T07:55:57.745499 | 2023-05-15T07:44:51 | 2023-05-15T07:44:51 | 170,904,715 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 158 | java | package si.vajnartech.calculus;
public class R2Float extends RnFloat
{
public R2Float(Float x1, Float x2)
{
super(2);
add(x1);
add(x2);
}
} | [
"[email protected]"
]
| |
2bbeccd4b054a74811742150a3d21e7e09372e8c | fa2b22c169bfc0eea2bdc527146bdba5f36fdcea | /app/src/main/java/is/hello/puppet/PuppetApplication.java | 251b69434d5bbb37ba510c750d0ca5ff3cceda66 | []
| no_license | hello/android-puppet | b277146ee97614259bfc0bd9f8e13373d2926bd4 | 21021fc1142881001581eb33d552656084ae52ba | refs/heads/master | 2021-03-16T10:23:52.960339 | 2016-11-10T01:18:41 | 2016-11-10T01:18:41 | 41,821,060 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 574 | java | package is.hello.puppet;
import android.app.Application;
import android.content.Intent;
import is.hello.puppet.runner.SensePeripheralService;
public class PuppetApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
final Intent intent = new Intent(this, SensePeripheralService.class);
startService(intent);
}
@Override
public void onTerminate() {
super.onTerminate();
final Intent intent = new Intent(this, SensePeripheralService.class);
stopService(intent);
}
}
| [
"[email protected]"
]
| |
fb2bc4cea647da3795e67dfa590580ae174bc40b | 17f76f8c471673af9eae153c44e5d9776c82d995 | /mamesrc/src/sound/disc_wav.c | 32b76ac63b4bbeea12471e64ef0df6b14f4623d4 | []
| no_license | javaemus/arcadeflex-067 | ef1e47f8518cf214acc5eb246b1fde0d6cbc0028 | 1ea6e5c6a73cf8bca5d234b26d2b5b6312df3931 | refs/heads/main | 2023-02-25T09:25:56.492074 | 2021-02-05T11:40:36 | 2021-02-05T11:40:36 | 330,649,950 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,296 | c | /************************************************************************/
/* */
/* MAME - Discrete sound system emulation library */
/* */
/* Written by Keith Wilkins ([email protected]) */
/* */
/* (c) K.Wilkins 2000 */
/* */
/************************************************************************/
/* */
/* DSS_SINEWAVE - Sinewave generator source code */
/* DSS_SQUAREWAVE - Squarewave generator source code */
/* DSS_TRIANGLEWAVE - Triangle waveform generator */
/* DSS_SAWTOOTHWAVE - Sawtooth waveform generator */
/* DSS_NOISE - Noise Source - Random source */
/* DSS_LFSR_NOISE - Linear Feedback Shift Register Noise */
/* */
/************************************************************************/
struct dss_sinewave_context
{
double phase;
};
struct dss_noise_context
{
double phase;
};
struct dss_lfsr_context
{
double phase;
int lfsr_reg;
};
struct dss_squarewave_context
{
double phase;
double trigger;
};
struct dss_trianglewave_context
{
double phase;
};
struct dss_sawtoothwave_context
{
double phase;
int type;
};
/************************************************************************/
/* */
/* DSS_SINWAVE - Usage of node_description values for step function */
/* */
/* input0 - Enable input value */
/* input1 - Frequency input value */
/* input2 - Amplitde input value */
/* input3 - DC Bias */
/* input4 - Starting phase */
/* input5 - NOT USED */
/* */
/************************************************************************/
int dss_sinewave_step(struct node_description *node)
{
struct dss_sinewave_context *context=(struct dss_sinewave_context*)node->context;
double newphase;
/* Work out the phase step based on phase/freq & sample rate */
/* The enable input only curtails output, phase rotation */
/* still occurs */
/* phase step = 2Pi/(output period/sample period) */
/* boils out to */
/* phase step = (2Pi*output freq)/sample freq) */
newphase=context->phase+((2.0*PI*node->input1)/Machine->sample_rate);
/* Keep the new phasor in thw 2Pi range.*/
context->phase=fmod(newphase,2.0*PI);
if(node->input0)
{
node->output=(node->input2/2.0) * sin(newphase);
/* Add DC Bias component */
node->output=node->output+node->input3;
}
else
{
/* Just output DC Bias */
node->output=node->input3;
}
return 0;
}
int dss_sinewave_reset(struct node_description *node)
{
struct dss_sinewave_context *context;
double start;
context=(struct dss_sinewave_context*)node->context;
/* Establish starting phase, convert from degrees to radians */
start=(node->input4/360.0)*(2.0*PI);
/* Make sure its always mod 2Pi */
context->phase=fmod(start,2.0*PI);
return 0;
}
int dss_sinewave_init(struct node_description *node)
{
discrete_log("dss_sinewave_init() - Creating node %d.",node->node-NODE_00);
/* Allocate memory for the context array and the node execution order array */
if((node->context=malloc(sizeof(struct dss_sinewave_context)))==NULL)
{
discrete_log("dss_sinewave_init() - Failed to allocate local context memory.");
return 1;
}
else
{
/* Initialise memory */
memset(node->context,0,sizeof(struct dss_sinewave_context));
}
/* Initialise the object */
dss_sinewave_reset(node);
return 0;
}
int dss_sinewave_kill(struct node_description *node)
{
free(node->context);
node->context=NULL;
return 0;
}
/************************************************************************/
/* */
/* DSS_SQUAREWAVE - Usage of node_description values for step function */
/* */
/* input0 - Enable input value */
/* input1 - Frequency input value */
/* input2 - Amplitude input value */
/* input3 - Duty Cycle */
/* input4 - DC Bias level */
/* input5 - Start Phase */
/* */
/************************************************************************/
int dss_squarewave_step(struct node_description *node)
{
struct dss_squarewave_context *context=(struct dss_squarewave_context*)node->context;
double newphase;
/* Establish trigger phase from duty */
context->trigger=((100-node->input3)/100)*(2.0*PI);
/* Work out the phase step based on phase/freq & sample rate */
/* The enable input only curtails output, phase rotation */
/* still occurs */
/* phase step = 2Pi/(output period/sample period) */
/* boils out to */
/* phase step = (2Pi*output freq)/sample freq) */
newphase=context->phase+((2.0*PI*node->input1)/Machine->sample_rate);
/* Keep the new phasor in thw 2Pi range.*/
context->phase=fmod(newphase,2.0*PI);
if(node->input0)
{
if(context->phase>context->trigger)
node->output=(node->input2/2.0);
else
node->output=-(node->input2/2.0);
/* Add DC Bias component */
node->output=node->output+node->input4;
}
else
{
/* Just output DC Bias */
node->output=node->input4;
}
return 0;
}
int dss_squarewave_reset(struct node_description *node)
{
struct dss_squarewave_context *context;
double start;
context=(struct dss_squarewave_context*)node->context;
/* Establish starting phase, convert from degrees to radians */
start=(node->input5/360.0)*(2.0*PI);
/* Make sure its always mod 2Pi */
context->phase=fmod(start,2.0*PI);
return 0;
}
int dss_squarewave_init(struct node_description *node)
{
discrete_log("dss_squarewave_init() - Creating node %d.",node->node-NODE_00);
/* Allocate memory for the context array and the node execution order array */
if((node->context=malloc(sizeof(struct dss_squarewave_context)))==NULL)
{
discrete_log("dss_squarewave_init() - Failed to allocate local context memory.");
return 1;
}
else
{
/* Initialise memory */
memset(node->context,0,sizeof(struct dss_squarewave_context));
}
/* Initialise the object */
dss_squarewave_reset(node);
return 0;
}
int dss_squarewave_kill(struct node_description *node)
{
free(node->context);
node->context=NULL;
return 0;
}
/************************************************************************/
/* */
/* DSS_TRIANGLEWAVE - Usage of node_description values for step function*/
/* */
/* input0 - Enable input value */
/* input1 - Frequency input value */
/* input2 - Amplitde input value */
/* input3 - DC Bias value */
/* input4 - Initial Phase */
/* input5 - NOT USED */
/* */
/************************************************************************/
int dss_trianglewave_step(struct node_description *node)
{
struct dss_trianglewave_context *context=(struct dss_trianglewave_context*)node->context;
double newphase;
/* Work out the phase step based on phase/freq & sample rate */
/* The enable input only curtails output, phase rotation */
/* still occurs */
/* phase step = 2Pi/(output period/sample period) */
/* boils out to */
/* phase step = (2Pi*output freq)/sample freq) */
newphase=context->phase+((2.0*PI*node->input1)/Machine->sample_rate);
/* Keep the new phasor in thw 2Pi range.*/
newphase=fmod(newphase,2.0*PI);
context->phase=newphase;
if(node->input0)
{
node->output=newphase < PI ? (node->input2 * (newphase / (PI/2.0) - 1.0))/2.0 :
(node->input2 * (3.0 - newphase / (PI/2.0)))/2.0 ;
/* Add DC Bias component */
node->output=node->output+node->input3;
}
else
{
/* Just output DC Bias */
node->output=node->input3;
}
return 0;
}
int dss_trianglewave_reset(struct node_description *node)
{
struct dss_trianglewave_context *context;
double start;
context=(struct dss_trianglewave_context*)node->context;
/* Establish starting phase, convert from degrees to radians */
start=(node->input4/360.0)*(2.0*PI);
/* Make sure its always mod 2Pi */
context->phase=fmod(start,2.0*PI);
return 0;
}
int dss_trianglewave_init(struct node_description *node)
{
discrete_log("dss_trianglewave_init() - Creating node %d.",node->node-NODE_00);
/* Allocate memory for the context array and the node execution order array */
if((node->context=malloc(sizeof(struct dss_trianglewave_context)))==NULL)
{
discrete_log("dss_trianglewave_init() - Failed to allocate local context memory.");
return 1;
}
else
{
/* Initialise memory */
memset(node->context,0,sizeof(struct dss_trianglewave_context));
}
/* Initialise the object */
dss_trianglewave_reset(node);
return 0;
}
int dss_trianglewave_kill(struct node_description *node)
{
free(node->context);
node->context=NULL;
return 0;
}
/************************************************************************/
/* */
/* DSS_SAWTOOTHWAVE - Usage of node_description values for step function*/
/* */
/* input0 - Enable input value */
/* input1 - Frequency input value */
/* input2 - Amplitde input value */
/* input3 - DC Bias Value */
/* input4 - Gradient */
/* input5 - Initial Phase */
/* */
/************************************************************************/
int dss_sawtoothwave_step(struct node_description *node)
{
struct dss_sawtoothwave_context *context=(struct dss_sawtoothwave_context*)node->context;
double newphase;
/* Work out the phase step based on phase/freq & sample rate */
/* The enable input only curtails output, phase rotation */
/* still occurs */
/* phase step = 2Pi/(output period/sample period) */
/* boils out to */
/* phase step = (2Pi*output freq)/sample freq) */
newphase=context->phase+((2.0*PI*node->input1)/Machine->sample_rate);
/* Keep the new phasor in thw 2Pi range.*/
newphase=fmod(newphase,2.0*PI);
context->phase=newphase;
if(node->input0)
{
node->output=(context->type==0)?newphase*(node->input2/(2.0*PI)):node->input2-(newphase*(node->input2/(2.0*PI)));
node->output-=node->input2/2.0;
/* Add DC Bias component */
node->output=node->output+node->input3;
}
else
{
/* Just output DC Bias */
node->output=node->input3;
}
return 0;
}
int dss_sawtoothwave_reset(struct node_description *node)
{
struct dss_sawtoothwave_context *context;
double start;
context=(struct dss_sawtoothwave_context*)node->context;
/* Establish starting phase, convert from degrees to radians */
start=(node->input5/360.0)*(2.0*PI);
/* Make sure its always mod 2Pi */
context->phase=fmod(start,2.0*PI);
/* Invert gradient depending on sawtooth type /|/|/|/|/| or |\|\|\|\|\ */
context->type=(node->input4)?1:0;
return 0;
}
int dss_sawtoothwave_init(struct node_description *node)
{
discrete_log("dss_trianglewave_init() - Creating node %d.",node->node-NODE_00);
/* Allocate memory for the context array and the node execution order array */
if((node->context=malloc(sizeof(struct dss_sawtoothwave_context)))==NULL)
{
discrete_log("dss_sawtoothwave_init() - Failed to allocate local context memory.");
return 1;
}
else
{
/* Initialise memory */
memset(node->context,0,sizeof(struct dss_sawtoothwave_context));
}
/* Initialise the object */
dss_sawtoothwave_reset(node);
return 0;
}
int dss_sawtoothwave_kill(struct node_description *node)
{
free(node->context);
node->context=NULL;
return 0;
}
/************************************************************************/
/* */
/* DSS_NOISE - Usage of node_description values for white nose generator*/
/* */
/* input0 - Enable input value */
/* input1 - Noise sample frequency */
/* input2 - Amplitude input value */
/* input3 - DC Bias value */
/* input4 - NOT USED */
/* input5 - NOT USED */
/* */
/************************************************************************/
int dss_noise_step(struct node_description *node)
{
struct dss_noise_context *context;
double newphase;
context=(struct dss_noise_context*)node->context;
newphase=context->phase+((2.0*PI*node->input1)/Machine->sample_rate);
/* Keep the new phasor in thw 2Pi range.*/
context->phase=fmod(newphase,2.0*PI);
if(node->input0)
{
/* Only sample noise on rollover to next cycle */
if(newphase>(2.0*PI))
{
int newval=rand() & 0x7fff;
node->output=node->input2*(1-(newval/16384.0));
/* Add DC Bias component */
node->output=node->output+node->input3;
}
}
else
{
/* Just output DC Bias */
node->output=node->input3;
}
return 0;
}
int dss_noise_reset(struct node_description *node)
{
struct dss_noise_context *context=(struct dss_noise_context*)node->context;
context->phase=0;
return 0;
}
int dss_noise_init(struct node_description *node)
{
discrete_log("dss_noise_init() - Creating node %d.",node->node-NODE_00);
/* Allocate memory for the context array and the node execution order array */
if((node->context=malloc(sizeof(struct dss_noise_context)))==NULL)
{
discrete_log("dss_noise_init() - Failed to allocate local context memory.");
return 1;
}
else
{
/* Initialise memory */
memset(node->context,0,sizeof(struct dss_noise_context));
}
/* Initialise the object */
dss_noise_reset(node);
return 0;
}
int dss_noise_kill(struct node_description *node)
{
free(node->context);
node->context=NULL;
return 0;
}
/************************************************************************/
/* */
/* DSS_LFSR_NOISE - Usage of node_description values for LFSR noise gen */
/* */
/* input0 - Enable input value */
/* input1 - Register reset */
/* input2 - Noise sample frequency */
/* input3 - Amplitude input value */
/* input4 - Input feed bit */
/* input5 - Bias */
/* */
/************************************************************************/
int dss_lfsr_function(int myfunc,int in0,int in1,int bitmask)
{
int retval;
in0&=bitmask;
in1&=bitmask;
switch(myfunc)
{
case DISC_LFSR_XOR:
retval=in0^in1;
break;
case DISC_LFSR_OR:
retval=in0|in1;
break;
case DISC_LFSR_AND:
retval=in0&in1;
break;
case DISC_LFSR_XNOR:
retval=in0^in1;
retval=retval^bitmask; /* Invert output */
break;
case DISC_LFSR_NOR:
retval=in0|in1;
retval=retval^bitmask; /* Invert output */
break;
case DISC_LFSR_NAND:
retval=in0&in1;
retval=retval^bitmask; /* Invert output */
break;
case DISC_LFSR_IN0:
retval=in0;
break;
case DISC_LFSR_IN1:
retval=in1;
break;
case DISC_LFSR_NOT_IN0:
retval=in0^bitmask;
break;
case DISC_LFSR_NOT_IN1:
retval=in1^bitmask;
break;
case DISC_LFSR_REPLACE:
retval=in0&~in1;
retval=in0|in1;
break;
default:
discrete_log("dss_lfsr_function - Invalid function type passed");
retval=0;
break;
}
return retval;
}
/* reset prototype so that it can be used in init function */
int dss_lfsr_reset(struct node_description *node);
int dss_lfsr_step(struct node_description *node)
{
struct dss_lfsr_context *context;
double newphase;
context=(struct dss_lfsr_context*)node->context;
newphase=context->phase+((2.0*PI*node->input2)/Machine->sample_rate);
/* Keep the new phasor in thw 2Pi range.*/
context->phase=fmod(newphase,2.0*PI);
/* Reset everything if necessary */
if(node->input1)
{
dss_lfsr_reset(node);
}
/* Only sample noise on rollover to next cycle */
if(newphase>(2.0*PI))
{
int fb0,fb1,fbresult;
struct discrete_lfsr_desc *lfsr_desc;
/* Fetch the LFSR descriptor structure in a local for quick ref */
lfsr_desc=(struct discrete_lfsr_desc*)(node->custom);
/* Now clock the LFSR by 1 cycle and output */
discrete_log("dss_lfsr_step: Shift register at begining %#10X.\n",(context->lfsr_reg));
/* Fetch the last feedback result */
fbresult=((context->lfsr_reg)>>(lfsr_desc->bitlength))&0x01;
discrete_log("dss_lfsr_step: Last feedback = %d.\n",fbresult);
/* Stage 2 feedback combine fbresultNew with infeed bit */
fbresult=dss_lfsr_function(lfsr_desc->feedback_function1,fbresult,((node->input4)?0x01:0x00),0x01);
discrete_log("dss_lfsr_step: With food added = %d.\n",fbresult);
/* Stage 3 first we setup where the bit is going to be shifted into */
fbresult=fbresult*lfsr_desc->feedback_function2_mask;
discrete_log("dss_lfsr_step: Where its going = %#X.\n",fbresult);
/* Then we left shift the register, */
discrete_log("dss_lfsr_step: Shift register before shift %#10X.\n",(context->lfsr_reg));
context->lfsr_reg=(context->lfsr_reg)<<1;
discrete_log("dss_lfsr_step: Shift register after shift %#10X.\n",(context->lfsr_reg));
/* Now move the fbresult into the shift register and mask it to the bitlength */
context->lfsr_reg=dss_lfsr_function(lfsr_desc->feedback_function2,fbresult, (context->lfsr_reg), ((1<<(lfsr_desc->bitlength))-1));
discrete_log("dss_lfsr_step: Shift register with fb %#10X.\n",(context->lfsr_reg));
/* Now get and store the new feedback result */
/* Fetch the feedback bits */
fb0=((context->lfsr_reg)>>(lfsr_desc->feedback_bitsel0))&0x01;
fb1=((context->lfsr_reg)>>(lfsr_desc->feedback_bitsel1))&0x01;
discrete_log("dss_lfsr_step: XOR Bit0 = %d, Bit1 = %d. ",fb0,fb1);
/* Now do the combo on them */
fbresult=dss_lfsr_function(lfsr_desc->feedback_function0,fb0,fb1,0x01);
discrete_log("dss_lfsr_step: Output = %d.\n",fbresult);
context->lfsr_reg=dss_lfsr_function(DISC_LFSR_REPLACE,(context->lfsr_reg), fbresult<<(lfsr_desc->bitlength), ((2<<(lfsr_desc->bitlength))-1));
discrete_log("dss_lfsr_step: Shift register final %#10X.\n",(context->lfsr_reg));
/* Now select the output bit */
node->output=((context->lfsr_reg)>>(lfsr_desc->output_bit))&0x01;
/* Final inversion if required */
discrete_log("dss_lfsr_step: Before possible inversion %f.\n",(node->output));
if(lfsr_desc->output_invert) node->output=(node->output)?0.0:1.0;
discrete_log("dss_lfsr_step: FINAL Node Ouput before gain = %f.\n\n",(node->output));
/* Gain stage */
node->output=(node->output)?(node->input3)/2:-(node->input3)/2;
/* Bias input as required */
node->output=node->output+node->input5;
}
/* If disabled then clamp the output to DC Bias */
if(!node->input0)
{
node->output=node->input5;
}
return 0;
}
int dss_lfsr_reset(struct node_description *node)
{
struct dss_lfsr_context *context;
struct discrete_lfsr_desc *lfsr_desc;
context=(struct dss_lfsr_context*)node->context;
lfsr_desc=(struct discrete_lfsr_desc*)(node->custom);
context->lfsr_reg=((struct discrete_lfsr_desc*)(node->custom))->reset_value;
discrete_log("dss_lfsr_reset - Shift register INITialized");
context->lfsr_reg=dss_lfsr_function(DISC_LFSR_REPLACE,0, (dss_lfsr_function(lfsr_desc->feedback_function0,0,0,0x01))<<(lfsr_desc->bitlength),((2<<(lfsr_desc->bitlength))-1));
discrete_log("Shift register RESET to %#10X.\n",(context->lfsr_reg));
/* Now select and setup the output bit */
node->output=((context->lfsr_reg)>>(lfsr_desc->output_bit))&0x01;
/* Final inversion if required */
if(lfsr_desc->output_invert) node->output=(node->output)?0.0:1.0;
/* Gain stage */
node->output=(node->output)?(node->input3)/2:-(node->input3)/2;
/* Bias input as required */
node->output=node->output+node->input5;
discrete_log("Output Node RESET to %f.\n\n",(node->output));
discrete_log("dss_lfsr_reset - Shift register stepped once to setup output");
return 0;
}
int dss_lfsr_init(struct node_description *node)
{
discrete_log("dss_lfsr_init() - Creating node %d.",node->node-NODE_00);
/* Allocate memory for the context array and the node execution order array */
if((node->context=malloc(sizeof(struct dss_lfsr_context)))==NULL)
{
discrete_log("dss_lfsr_init() - Failed to allocate local context memory.");
return 1;
}
else
{
/* Initialise memory */
memset(node->context,0,sizeof(struct dss_lfsr_context));
}
/* Initialise the object */
dss_lfsr_reset(node);
((struct dss_lfsr_context*)node->context)->phase=0.0;
return 0;
}
int dss_lfsr_kill(struct node_description *node)
{
free(node->context);
node->context=NULL;
return 0;
}
| [
"[email protected]"
]
| |
1243ecdd1db4d40a76e67bed79c799a9d6f1310f | 477b6f46ad076141ccfb45aef01bfe23b7cbdb0e | /Lesson4/src/Bridge/PrintedMatter/Magazine.java | 0c92f82f2dec2c525ebaa7b5269dc01ec015cf52 | []
| no_license | InsaneDan/Patterns | d87e4ec03edb49796c9824bac72bf6024309dea2 | fc04e349aedd7c6e96461332c37ee0f0ed46895b | refs/heads/main | 2023-06-16T11:53:52.601206 | 2021-07-12T06:38:16 | 2021-07-12T06:53:15 | 381,409,210 | 0 | 0 | null | 2021-07-02T10:51:10 | 2021-06-29T15:15:52 | null | UTF-8 | Java | false | false | 330 | java | package Bridge.PrintedMatter;
public class Magazine extends PrintedMatter {
@Override
public void manufacture() {
System.out.println("Producing Magazine ~~>");
workFlows.stream().forEach(workFlow -> workFlow.work(this));
System.out.println("~~> completed");
System.out.println();
}
}
| [
"[email protected]"
]
| |
3cca4440604d453ea73370fc0cff029ee1285063 | 85b871379da25085a3e50a3d250becc46b235abd | /src/gui/Controller.java | 97f6ce324ab80336ec3e0f04e092a20e75ebc4c3 | []
| no_license | terredeciels/NCorpsV2GUI | e2766345bf64575da66b2cadfd07a2602a9f97bf | f89697e386ce23a561858c17a582a4b9efc27204 | refs/heads/master | 2021-08-31T09:32:08.932717 | 2017-12-20T22:36:30 | 2017-12-20T22:36:30 | 114,937,491 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 110 | java | package gui;
import javafx.scene.layout.BorderPane;
public class Controller {
public BorderPane root;
}
| [
"[email protected]"
]
| |
5e37dae6374c2cf7485dba107be6c7071df9ab8b | 10389038d6934947221d47d2092b98fd8154b607 | /gubikes/src/main/java/util/UsuarioSessaoConveniencia24hMB.java | 74b514fa2be70efac74aa4e3067d8de7dac4b939 | []
| no_license | adriel1010/sistemadbm | 94bd657e5c79cef6fe134968089ba95635d429e4 | 658aafb2083608f07333872efa32fe3533186e7c | refs/heads/master | 2020-04-12T00:28:09.017440 | 2018-12-17T21:17:24 | 2018-12-17T21:17:24 | 162,200,953 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,773 | java | package util;
import dao.UsuarioDAO;
import modeloConveniencia24horas.UsuarioConveniencia24Horas;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.faces.bean.ManagedBean;
import javax.inject.Inject;
import javax.inject.Named;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;
@SessionScoped
@Named("usuarioSessaoConveniencia24hMB")
public class UsuarioSessaoConveniencia24hMB implements Serializable {
private static final long serialVersionUID = 1L;
private UsuarioConveniencia24Horas usuario;
@Inject
private UsuarioDAO daoUsuario;
public UsuarioSessaoConveniencia24hMB() {
System.out.println("no usuario");
usuario = new UsuarioConveniencia24Horas();
SecurityContext context = SecurityContextHolder.getContext();
if (context instanceof SecurityContext) {
Authentication authentication = context.getAuthentication();
if (authentication instanceof Authentication) {
usuario.setNomeUsuario(((User) authentication.getPrincipal()).getUsername());
}
}
}
public UsuarioConveniencia24Horas getUsuario() {
return usuario;
}
public void setUsuario(UsuarioConveniencia24Horas usuario) {
this.usuario = usuario;
}
public UsuarioConveniencia24Horas recuperarUsuario() {
try {
usuario = (UsuarioConveniencia24Horas) daoUsuario.retornarLogado(UsuarioConveniencia24Horas.class, usuario.getNomeUsuario()).get(0);
} catch (Exception e) {
e.printStackTrace();
}
return usuario;
}
}
| [
"[email protected]"
]
| |
bd013da606f91f3c9035c97fa0d800163349b018 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/9/9_dff37f41c6308e618ecaa31abff364da385a2d6b/SatinObject/9_dff37f41c6308e618ecaa31abff364da385a2d6b_SatinObject_t.java | 3d9407a5f3d75bcc8a396702629ef34ecc88b35e | []
| 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,123 | java | package ibis.satin;
import ibis.satin.impl.Satin;
/**
* This is the magic class that should be extended by objects that invoke
* spawnable methods. When the program is not rewritten by the Satin frontend,
* the methods described here are basically no-ops, and the program will run
* sequentially. When the program is rewritten by the Satin frontend, calls to
* spawnable methods, and calls to {@link #sync()}and {@link #abort()}will be
* rewritten.
*/
public class SatinObject {
/** Waits until all spawned methods in the current method are finished. */
public void sync() {
}
/**
* Recursively aborts all methods that were spawned by the current method
* and all methods spawned by the aborted methods.
*/
public void abort() {
}
/**
* Pauses Satin operation. This method can optionally be called before a
* large sequential part in a program. This will temporarily pause Satin's
* internal load distribution strategies to avoid communication overhead
* during sequential code.
*/
public static void pause() {
Satin.pause();
}
/**
* Resumes Satin operation. This method can optionally be called after a
* large sequential part in a program.
*/
public static void resume() {
Satin.resume();
}
/**
* Returns whether it might be useful to spawn more Satin jobs. If there is
* enough work in the system to keep all processors busy, this method
* returns false.
*
* @return <code>true</code> if it might be useful to spawn more
* invocations, false if there is enough work in the system.
*/
public static boolean needMoreJobs() {
return Satin.needMoreJobs();
}
/**
* Returns whether the current Satin job was generated by the machine
* it is running on. Satin jobs can be distributed to remote machines by
* the Satin runtime system, in which case this method returns false.
*
* @return <code>true</code> if the current invocation is not stolen from
* another processor.
*/
public static boolean localJob() {
return Satin.localJob();
}
}
| [
"[email protected]"
]
| |
50b56aa5a0a3797854088cbfca15a490b2431b05 | 2b1eeaa3998b0d0042e869c6f669ecbde0328d63 | /src/day9/tugas1/Manager.java | e42eebc17e37bff9846847bda6342e262f33ac96 | []
| no_license | rezafd23/shifted | ee8eb38e5ff12f7016231f754d902e6554f81077 | b4419a7a1f469980b0651451ec179cbddd1e34b6 | refs/heads/master | 2023-01-18T18:03:06.646574 | 2020-11-19T10:24:46 | 2020-11-19T10:24:46 | 314,155,748 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,452 | java | package day9.tugas1;
import java.util.ArrayList;
public class Manager extends Worker {
private int tunjanganTransport;
private int tunjanganEntertaiment;
private ArrayList<String> telepon;
public Manager() {
}
public ArrayList<String> getTelepon() {
return telepon;
}
public void setTelepon(ArrayList<String> telepon) {
this.telepon = telepon;
}
public int getTunjanganTransport() {
return tunjanganTransport;
}
public void setTunjanganTransport(int tunjanganTransport) {
this.tunjanganTransport = tunjanganTransport;
}
public int getTunjanganEntertaiment() {
return tunjanganEntertaiment;
}
public void setTunjanganEntertaiment(int tunjanganEntertaiment) {
this.tunjanganEntertaiment = tunjanganEntertaiment;
}
public int hitungTunjTransport(){
int tunjangan=this.absensi*50000;
return tunjangan;
}
public int hitungTunjEntertaiment(int amount){
int tunjangan=amount*500000;
return tunjangan;
}
@Override
public String getIdKaryawan() {
return this.idKaryawan;
}
@Override
public void setIdKaryawan(String idKaryawan) {
this.idKaryawan=idKaryawan;
}
@Override
public String getNama() {
return this.nama;
}
@Override
public void setNama(String nama) {
this.nama=nama;
}
@Override
public int getTunjanganPulsa() {
return this.tunjanganPulsa;
}
@Override
public void setTunjanganPulsa(int tunjanganPulsa) {
this.tunjanganPulsa=tunjanganPulsa;
}
@Override
public int getGajiPokok() {
return this.gajiPokok;
}
@Override
public void setGajiPokok(int gajiPokok) {
this.gajiPokok=gajiPokok;
}
@Override
public int getAbsensi() {
return this.absensi;
}
@Override
public void setAbsensi(int absensi) {
this.absensi=absensi;
}
@Override
public int hitungAbsensi() {
return this.absensi+1;
}
@Override
public int hitungGaji() {
int gaji = this.gajiPokok+this.tunjanganPulsa+this.tunjanganTransport+this.tunjanganEntertaiment;
return gaji;
}
@Override
public int getGajiTotal() {
return this.gajiTotal;
}
@Override
public void setGajiTotal(int gajiTotal) {
this.gajiTotal=gajiTotal;
}
} | [
"[email protected]"
]
| |
1b895e0d361c97b7c1e5078b4629866db213062c | 8a7286bd35e3b1d380480c69cfe97d673c2d4625 | /src/main/java/com/homework/websocket/WebSocketApplication.java | 485ed4b8550b7bbf8bcc754f8bccb4e41ccd162b | []
| no_license | Dmytro-Skorniakov/websocket-interface | da7f47cf1c544f9c63ec0c18a602ed5b1de006f0 | 1cf104eea90798f385df65cf4a625a08eda43719 | refs/heads/master | 2020-12-11T04:30:45.017062 | 2020-01-14T07:22:31 | 2020-01-14T07:22:31 | 233,777,851 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 321 | java | package com.homework.websocket;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class WebSocketApplication {
public static void main(String[] args) {
SpringApplication.run(WebSocketApplication.class, args);
}
}
| [
"[email protected]"
]
| |
47d517b1d4ad885fb5409e7ebcac1a91d2e567a3 | 8e12ed5e1baeb10501b6be1c3dcae2e709a11b41 | /lec2-war/src/main/java/ru/vyrostkoolga/j2eelec2/lec5/serviceModel/model/WarehouseWeb.java | ea93abcdf051f00e3d8d6409f93a1f2241331e69 | []
| no_license | VyrostkoOlga/j2eeLec2 | 83e331260e4bdf7cf064fef0407b48531b21cfd6 | c5c819524483ea1a6ba42c6d3b1faf652d0294b7 | refs/heads/master | 2021-01-17T05:44:54.766426 | 2015-02-26T06:24:12 | 2015-02-26T06:24:12 | 30,644,507 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,294 | java | package ru.vyrostkoolga.j2eelec2.lec5.serviceModel.model;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import ru.vyrostkoolga.j2eelec2.lec4.entities.Category;
import ru.vyrostkoolga.j2eelec2.lec4.entities.Product;
import ru.vyrostkoolga.j2eelec2.lec4.entities.Warehouse;
public class WarehouseWeb
{
private Integer id;
private String name;
private float capacity;
private List<ProductWeb> products;
//private List<CategoryWeb> categories;
public WarehouseWeb()
{
products = new ArrayList<ProductWeb>();
//categories = new ArrayList<CategoryWeb>();
}
public WarehouseWeb(Warehouse wh)
{
id = wh.getId();
name = wh.getName();
capacity = wh.getCapacity();
products = new ArrayList<ProductWeb>();
for (Product one: wh.getItems())
{
products.add(new ProductWeb(one));
}
/*
categories = new ArrayList<CategoryWeb>();
for (Category item: wh.getCategories())
{
categories.add(new CategoryWeb(item));
}
*/
}
public Integer getId() {return id;}
public void setId(Integer id) {this.id = id;}
public String getName() {return name;}
public void setName(String name) {this.name = name;}
public float getCapacity() {return this.capacity;}
public void setCapacity(float capacity) {this.capacity = capacity;}
public void setProducts(List<ProductWeb> items) {this.products = items;}
public List<ProductWeb> getProducts() {return this.products;}
//public void setCategories(List<CategoryWeb> items) {this.categories = items;}
//public List<CategoryWeb> getCategories() {return this.categories;}
public Warehouse toWarehouse()
{
Warehouse warehouse = new Warehouse();
warehouse.setCapacity(capacity);
warehouse.setId(id);
warehouse.setName(name);
for (ProductWeb item: products)
{
Warehouse.connect(warehouse, item.toProduct());
}
/*
for (CategoryWeb category: categories)
{
Warehouse.connectCategory(warehouse, category.toCategory());
Category.connectWarehouse(category.toCategory(), warehouse);
}
*/
return warehouse;
}
} | [
"[email protected]"
]
| |
eebae85e57a47105346e04513af432a2c249748a | 37050a591a3f8a21729175f8271583878b7c4b98 | /src/test/java/org/fasttrack/pages/CheckoutPage.java | 433b71e1e9e12b650448e6bbd721fde03a8f191f | []
| no_license | grliviu/ProiectAcreditare | 18fdfc4e15362a19d2dbbde5f98d489dffefac9b | 5900cd7a22a48ad5eb5da12b60b65679bb31e303 | refs/heads/master | 2023-01-24T23:54:23.284044 | 2020-12-06T20:58:01 | 2020-12-06T20:58:01 | 309,308,034 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,666 | java | package org.fasttrack.pages;
import net.serenitybdd.core.annotations.findby.FindBy;
import net.serenitybdd.core.pages.PageObject;
import net.serenitybdd.core.pages.WebElementFacade;
import net.thucydides.core.annotations.DefaultUrl;
@DefaultUrl("http://qa2.fasttrackit.org:8008/")
public class CheckoutPage extends PageObject {
@FindBy(css = "#post-5 > div > div > div > div > div > a")
private WebElementFacade proceedToCheckoutButton;
@FindBy(id = "billing_first_name")
private WebElementFacade firstNameField;
@FindBy(id = "billing_last_name")
private WebElementFacade lastNameField;
@FindBy(id = "billing_company")
private WebElementFacade companyField;
@FindBy(id = "select2-billing_country-container")
private WebElementFacade countryLink;
@FindBy(css = "body > span > span > span.select2-search.select2-search--dropdown > input")
private WebElementFacade countryField;
@FindBy (id = "billing_address_1")
private WebElementFacade numberStreetField;
@FindBy (id = "billing_address_2")
private WebElementFacade houseInfoField;
@FindBy(id = "billing_city")
private WebElementFacade cityField;
@FindBy(id = "select2-billing_state-container")
private WebElementFacade countyLink;
@FindBy(css = "body > span > span > span.select2-search.select2-search--dropdown > input")
private WebElementFacade countyField;
@FindBy(css = "#billing_postcode")
private WebElementFacade postCode;
@FindBy(id = "billing_phone")
private WebElementFacade phoneField;
@FindBy(id = "billing_email")
private WebElementFacade emailField;
@FindBy(id = "place_order")
private WebElementFacade placeOrderButton;
@FindBy(css = "#post-5 > div > div > p.cart-empty")
private WebElementFacade verifyCheckoutCartIsEmpty;
@FindBy(css = "#post-6 > header > h1")
private WebElementFacade verifyReceivedOrder;
@FindBy (css = "#post-6 > div > div > form.checkout.woocommerce-checkout > div.woocommerce-NoticeGroup." +
"woocommerce-NoticeGroup-checkout > ul > li")
private WebElementFacade verifyEmptyField;
public void clickCheckoutButton(){clickOn(proceedToCheckoutButton);}
public void setFirstNameField(String firstName){typeInto(firstNameField, firstName);}
public void setLastNameField(String lastName){typeInto(lastNameField, lastName);}
public void setCompanyField(String companyName){typeInto(companyField, companyName);}
public void clickCountryLink(){clickOn(countryLink);}
public void setCountryField(String countryName){countryField.typeAndEnter(countryName) ;}
public void setNumberStreetField(String streetAndNumber){typeInto(numberStreetField, streetAndNumber);}
public void setHouseInfoField(String houseInfo){typeInto(houseInfoField, houseInfo);}
public void setCityField(String city){typeInto(cityField,city);}
public void clickCountyLink(){clickOn(countyLink);}
public void setCountyField(String county){countyField.typeAndEnter(county);}
public void setPostCode(String post){typeInto(postCode, post);}
public void setPhoneField(String phone){typeInto(phoneField, phone);}
public void setEmailField(String email){typeInto(emailField, email);}
public void clickPlaceOrderButton(){clickOn(placeOrderButton);}
public void verifyCheckoutCartIsEmpty(){verifyCheckoutCartIsEmpty.shouldContainOnlyText
("Your cart is currently empty.");}
public void verifyReceivedOrder(){verifyReceivedOrder.shouldContainText("Order received");}
public void setVerifyEmptyField(){verifyEmptyField.shouldContainText("is a required field");}
} | [
"[email protected]"
]
| |
d09e00820c8c9f289ac5c55f53f2fca6f153341a | d98b3952d7c9102adfd02d6dc7d11f5c483c15d4 | /learningms/src/com/learningms/system/dao/TestDao.java | cd046da7d8471aa19155be8580a08e828619101a | []
| no_license | jiansp/learning | 9d517ebd7c440ac81057874a7879a98ab1a2a018 | 9e050356980e58987c6009af1eeb9c5a66090e4d | refs/heads/master | 2021-01-23T04:28:23.286916 | 2017-10-10T08:10:25 | 2017-10-10T08:10:25 | 102,446,427 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 199 | java | package com.learningms.system.dao;
import java.util.List;
import com.learningms.system.model.ParamConfig;
public interface TestDao {
public List<ParamConfig> getParamConfigList();
}
| [
"[email protected]"
]
| |
fe09e9619a5d797aec3561fc21aff8868da29bdd | 119ab87d890cda80451138714c455e5893122a45 | /dygraphs-gwt/src/main/java/com/github/timeu/dygraphsgwt/client/callbacks/AnnotationMouseOutHandler.java | 1b646f0776af025dce017271dc2837c18fc0f8a2 | [
"MIT"
]
| permissive | timeu/dygraphs-gwt | 12f8a02fd39da0aa6294925b22d4e93621ed2cbc | 568f7222a801a82a909c73b467e956b0d7f4c531 | refs/heads/master | 2023-01-12T03:15:29.848635 | 2020-02-26T09:19:55 | 2020-02-26T09:19:55 | 12,268,432 | 4 | 2 | MIT | 2023-01-04T21:46:03 | 2013-08-21T11:28:07 | JavaScript | UTF-8 | Java | false | false | 672 | java | package com.github.timeu.dygraphsgwt.client.callbacks;
import com.github.timeu.dygraphsgwt.client.DygraphsJs;
import com.google.gwt.event.dom.client.MouseEvent;
import jsinterop.annotations.JsFunction;
/**
* Created by uemit.seren on 7/29/15.
*/
@FunctionalInterface
@JsFunction
public interface AnnotationMouseOutHandler {
/**
* Called when the user moves the mouse over an annotation.
*
* @param annotation {@link Annotation}
* @param point {@link Point}
* @param dygraphjs {@link DygraphsJs}
* @param event {@link MouseEvent}
*/
void onMouseOut(Annotation annotation,Point point,DygraphsJs dygraphjs,MouseEvent event);
}
| [
"[email protected]"
]
| |
333b63d4017e3d23407cebad4c2fe778e980eea3 | 70768c5204114d20d5d94241b215652ec4aec66c | /DU03/JankaB/Corona.java | f2a079d600ef22477583d13e173a5fe9f9fd33c4 | []
| no_license | Xengaroo/Riesenia2020 | fe7f09d6194ee3f01afe0bd94784bd2864132150 | c2d3a75007c1033d47569e4ad90c35159844dbb2 | refs/heads/master | 2022-04-25T16:07:47.837975 | 2020-04-30T19:16:06 | 2020-04-30T19:16:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,958 | java | public class Corona {
public static int kolkoPrezijeme(String[] veci, int[] pocty, String[][][] obchod) {
int velkost = veci.length;
int[] inventura = new int[velkost];
if (obchod == null) return 0;
for (int i = 0; i < obchod.length; i++) {
if (obchod[i] == null) continue;////
for (int j = 0; j < obchod[i].length; j++) {
if (obchod[i][j] == null) continue;
for (int k = 0; k < obchod[i][j].length; k++) {
if (obchod[i][j][k] == null) continue;
for (int v = 0; v < velkost; v++) {
if (obchod[i][j][k].equals(veci[v])) inventura[v] += 1; ///
}
}
}
}
int mininum = Integer.MAX_VALUE;
for (int i = 0; i < velkost; i++) {
int pocet = inventura[i] / pocty[i];
if (pocet < mininum) mininum = pocet;
}
return mininum;
}
public static void main(String[] args) {
String[] veci = {"konzerva", "inzulin"};
int[] pocty = {5, 1};
String[][][] obchod = {
{
{null , "konzerva", "konzerva", null , "vino", "konzerva"},
{"konzerva", "konzerva", "konzerva", "konzerva", null , "vino", "konzerva"},
{"konzerva", null , null , "konzerva", "vino"}
},
null,
{
null,
{"vino", "konzerva", "konzerva", null , "konzerva", "konzerva", null},
{null , "vino" , "olej" , "olej", null , "vino" , null , null},
{"olej", null , "vino" , null , "konzerva", null , "vino", "olej"}
},
{}
};
System.out.println(kolkoPrezijeme(veci, pocty, obchod));
}
}
| [
"[email protected]"
]
| |
1fadd7188ba292b95db3c7049c096bdc3b81f58f | f821553a865c45d57dc066fbbeb49f2a1739191c | /ADS-1 assignments/M24 (exam 4)/1/SeparateChainingHashST.java | 4b1fd4a208294678fc403bb0fdaee8145b520ac4 | []
| no_license | swapnika-20186045/20186045_ADS-1 | 199e70e952076a59e7df2dca5b067af7b3257456 | db20f474281b465de432e353fa06054be7aa353d | refs/heads/master | 2020-03-29T15:21:24.454449 | 2018-10-29T11:25:48 | 2018-10-29T11:25:48 | 150,059,083 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,130 | java | import java.util.Iterator;
import java.util.NoSuchElementException;
class SeparateChainingHashST<Key, Value> {
private static final int INIT_CAPACITY = 4;
private int n; // number of key-value pairs
private int m; // hash table size
private SequentialSearchST<Key, Value>[] st; // array of linked-list symbol tables
/**
* Initializes an empty symbol table.
*/
public SeparateChainingHashST() {
this(INIT_CAPACITY);
}
/**
* Initializes an empty symbol table with {@code m} chains.
* @param m the initial number of chains
*/
public SeparateChainingHashST(int m) {
this.m = m;
st = (SequentialSearchST<Key, Value>[]) new SequentialSearchST[m];
for (int i = 0; i < m; i++)
st[i] = new SequentialSearchST<Key, Value>();
}
// resize the hash table to have the given number of chains,
// rehashing all of the keys
private void resize(int chains) {
SeparateChainingHashST<Key, Value> temp = new SeparateChainingHashST<Key, Value>(chains);
for (int i = 0; i < m; i++) {
for (Key key : st[i].keys()) {
temp.put(key, st[i].get(key));
}
}
this.m = temp.m;
this.n = temp.n;
this.st = temp.st;
}
// hash value between 0 and m-1
private int hash(Key key) {
return (key.hashCode() & 0x7fffffff) % m;
}
/**
* Returns the number of key-value pairs in this symbol table.
*
* @return the number of key-value pairs in this symbol table
*/
public int size() {
return n;
}
/**
* Returns true if this symbol table is empty.
*
* @return {@code true} if this symbol table is empty;
* {@code false} otherwise
*/
public boolean isEmpty() {
return size() == 0;
}
/**
* Returns true if this symbol table contains the specified key.
*
* @param key the key
* @return {@code true} if this symbol table contains {@code key};
* {@code false} otherwise
* @throws IllegalArgumentException if {@code key} is {@code null}
*/
public boolean contains(Key key) {
if (key == null) throw new IllegalArgumentException("argument to contains() is null");
return get(key) != null;
}
/**
* Returns the value associated with the specified key in this symbol table.
*
* @param key the key
* @return the value associated with {@code key} in the symbol table;
* {@code null} if no such value
* @throws IllegalArgumentException if {@code key} is {@code null}
*/
public Value get(Key key) {
if (key == null) throw new IllegalArgumentException("argument to get() is null");
int i = hash(key);
return st[i].get(key);
}
/**
* Inserts the specified key-value pair into the symbol table, overwriting the old
* value with the new value if the symbol table already contains the specified key.
* Deletes the specified key (and its associated value) from this symbol table
* if the specified value is {@code null}.
*
* @param key the key
* @param val the value
* @throws IllegalArgumentException if {@code key} is {@code null}
*/
public void put(Key key, Value val) {
if (key == null) throw new IllegalArgumentException("first argument to put() is null");
if (val == null) {
delete(key);
return;
}
// double table size if average length of list >= 10
if (n >= 10 * m) resize(2 * m);
int i = hash(key);
if (!st[i].contains(key)) n++;
st[i].put(key, val);
}
/**
* Removes the specified key and its associated value from this symbol table
* (if the key is in this symbol table).
*
* @param key the key
* @throws IllegalArgumentException if {@code key} is {@code null}
*/
public void delete(Key key) {
if (key == null) throw new IllegalArgumentException("argument to delete() is null");
int i = hash(key);
if (st[i].contains(key)) n--;
st[i].delete(key);
// halve table size if average length of list <= 2
if (m > INIT_CAPACITY && n <= 2 * m) resize(m / 2);
}
// return keys in symbol table as an Iterable
public Iterable<Key> keys() {
Queue<Key> queue = new Queue<Key>();
for (int i = 0; i < m; i++) {
for (Key key : st[i].keys())
queue.enqueue(key);
}
return queue;
}
}
| [
"[email protected]"
]
| |
ac403760ea5bdc8c5bc908bf437c5f41729715df | ac486af8c184b39d5f1644e66178de617d7fb3da | /src/test/java/com/hiberus/checkout/bill/BillApplicationTests.java | caa2882c251bc474558f4ad4bd6615b10f23d56e | []
| no_license | lcarlosrincon/hiberus-bill-be | 692b100214184e4967c8255ea918b6e1d8ebff70 | 5a266461eab4ba2ecc4215f48bc5ab3b01eb6b69 | refs/heads/master | 2022-11-08T21:36:59.415441 | 2020-06-29T19:00:21 | 2020-06-29T19:00:21 | 275,207,983 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 215 | java | package com.hiberus.checkout.bill;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class BillApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
]
| |
1a6405f09ec2c0ed05f5f7deaf87be80cd8d45b7 | 8288b6a70fdbee951102b19013d5a0bc55753e07 | /app/src/main/java/com/returntrader/view/fragment/BaseDialogFragment.java | d03f98efcebf58c5813540a91363d26518e85e2c | []
| no_license | Thaniatdoodleblue/Ruturn-Trading-Android | 7c7f4b8320e9f197cb55b0f57ee8f849ebbf05f2 | 8515e4c918f6d7a1ae37c903915705d43ac79d01 | refs/heads/master | 2020-03-26T23:46:13.497726 | 2018-08-21T13:19:08 | 2018-08-21T13:19:08 | 145,565,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,347 | java | package com.returntrader.view.fragment;
import android.app.Dialog;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v4.app.DialogFragment;
import android.support.v4.content.ContextCompat;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.returntrader.R;
import com.returntrader.common.Constants;
import com.returntrader.common.ExceptionTracker;
import com.returntrader.library.CustomException;
import com.returntrader.presenter.ipresenter.IPresenter;
import com.returntrader.sync.SyncAccountDetailService;
import com.returntrader.utils.CodeSnippet;
import com.returntrader.view.iview.IView;
import com.returntrader.view.widget.CustomProgressbar;
import java.io.File;
/**
* Created by nirmal on 7/31/2017.
*/
public abstract class BaseDialogFragment extends DialogFragment implements IView {
protected View mParentView;
protected CodeSnippet mCodeSnippet;
private IPresenter iPresenter;
private CustomProgressbar mCustomProgressbar;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
return super.onCreateDialog(savedInstanceState);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
mParentView = View.inflate(getContext(), getLayoutId(), null);
return mParentView;
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
protected abstract int getLayoutId();
@Override
public void onStart() {
super.onStart();
if (iPresenter != null) iPresenter.onStartPresenter();
}
@Override
public void onResume() {
super.onResume();
if (iPresenter != null) iPresenter.onResumePresenter();
}
@Override
public void onPause() {
super.onPause();
if (iPresenter != null) iPresenter.onPausePresenter();
}
@Override
public void onStop() {
super.onStop();
if (iPresenter != null) iPresenter.onStopPresenter();
}
@Override
public void onDestroy() {
super.onDestroy();
if (iPresenter != null) iPresenter.onDestroyPresenter();
}
@Override
public void showMessage(String message) {
Toast.makeText(getActivity(), message, Toast.LENGTH_SHORT).show();
}
@Override
public void showMessage(int resId) {
showMessage(getString(resId));
}
@Override
public void showMessage(CustomException e) {
if (e != null) {
showMessage(e.getException());
}
}
@Override
public void showProgressbar() {
// TODO have to menu_view_question_preference the custom progressbar
getProgressBar().show();
}
@Override
public void dismissProgressbar() {
// TODO dismiss the progressbar
getActivity().runOnUiThread(() -> {
try {
getProgressBar().dismissProgress();
} catch (Exception e) {
ExceptionTracker.track(e);
}
});
}
@Override
public void showSnackBar(String message) {
if (mParentView != null) {
Snackbar snackbar = Snackbar.make(mParentView, message, Snackbar.LENGTH_LONG);
snackbar.setActionTextColor(Color.RED);
snackbar.show();
}
}
@Override
public void showSnackBar(@NonNull View view, String message) {
Snackbar snackbar = Snackbar.make(view, message, Snackbar.LENGTH_LONG);
snackbar.setActionTextColor(Color.RED);
snackbar.show();
}
@Override
public void showNetworkMessage() {
getCodeSnippet().showNetworkSettings();
}
public void bindPresenter(IPresenter iPresenter) {
this.iPresenter = iPresenter;
}
@Override
public CodeSnippet getCodeSnippet() {
if (mCodeSnippet == null) {
mCodeSnippet = new CodeSnippet(getActivity());
return mCodeSnippet;
}
return mCodeSnippet;
}
private CustomProgressbar getProgressBar() {
if (mCustomProgressbar == null) {
mCustomProgressbar = new CustomProgressbar(getActivity());
}
return mCustomProgressbar;
}
@Nullable
@Override
public View getView() {
return mParentView;
}
@Override
synchronized public void syncAccount(int syncType) {
Intent updatePriceService = new Intent(getActivity(), SyncAccountDetailService.class);
Bundle bundle = new Bundle();
bundle.putInt(Constants.AccountSync.BUNDLE_SYNC_TYPE, syncType);
updatePriceService.putExtras(bundle);
if (getActivity() != null){
getActivity().startService(updatePriceService);
}
}
}
| [
"[email protected]"
]
| |
5541abfe5b5f9d331d12d5f661e18720b5d4b6b6 | e6953a8d9cb48d680df3ca8d11bdff7d952abbd6 | /src/GUI/LoginController.java | 4e713de22a14dedf02f8e2ee42887d75f19b289b | []
| no_license | wadie123/PIJava | 1d21ff234498b693f6f5e6b58580d07f2921d217 | 95e8292ba942a87bfda3c9e1a9916f79fffa9143 | refs/heads/master | 2020-03-10T04:02:06.191806 | 2018-04-12T03:46:01 | 2018-04-12T03:46:01 | 129,181,606 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,863 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package GUI;
import animations.FadeInLeftTransition1;
import java.io.IOException;
import java.net.URL;
import java.sql.SQLException;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.PasswordField;
import javafx.scene.control.TextField;
import javafx.scene.image.ImageView;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Region;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javax.swing.JOptionPane;
import animations.FadeInRightTransition;
import pidev.Zanimaux.Services.ClientDAO;
import pidev.Zanimaux.entities.Client;
/**
* FXML Controller class
*
* @author abdelaziz
*/
public class LoginController implements Initializable {
@FXML
private ImageView img1;
@FXML
private TextField txtUsername;
@FXML
private PasswordField txtPassword;
@FXML
private Text lblUserLogin;
@FXML
private Text lblPassword;
@FXML
private Button btnLogin;
@FXML
private Button insrire;
static int usernid;
static int patid;
@FXML
private Label lblClose;
Stage stage;
@FXML
private ComboBox<String> combobox = new ComboBox<>();
@FXML
private Text aslabel;
@FXML
private Text lblUsername;
@FXML
private Text labC;
private void msgbox(String s) {
JOptionPane.showMessageDialog(null, s);
}
/**
* Initializes the controller class.
*/
@Override
public void initialize(URL url, ResourceBundle rb) {
// anv.setVisible(false);
Platform.runLater(() -> {
txtUsername.setPromptText("entrer le login");
txtPassword.setPromptText("entrer le mot de passe");
new FadeInRightTransition(lblUserLogin).play();
new FadeInLeftTransition1(lblPassword).play();
new FadeInLeftTransition1(lblUsername).play();
new FadeInLeftTransition1(txtUsername).play();
new FadeInLeftTransition1(txtPassword).play();
new FadeInRightTransition(btnLogin).play();
new FadeInRightTransition(aslabel).play();
combobox.getItems().addAll("Administrateur", "Client");
new FadeInRightTransition(combobox).play();
new FadeInRightTransition(lblClose).play();
new FadeInLeftTransition1(insrire).play();
new FadeInRightTransition(labC).play();
lblClose.setOnMouseClicked((MouseEvent event) -> {
Platform.exit();
System.exit(0);
});
});
insrire.setOnAction(event -> {
try {
Stage st = new Stage();
FXMLLoader loader = new FXMLLoader(getClass().getResource("ajouterC.fxml"));
Region root = (Region) loader.load();
AjouterCController ac1 = loader.<AjouterCController>getController();
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
stage.hide();
Scene scene = new Scene(root);
st.setScene(scene);
st.show();
} catch (IOException ex) {
Logger.getLogger(AccueilAdminController.class.getName()).log(Level.SEVERE, null, ex);
}
});
// TODO
}
@FXML
private void aksiLogin(ActionEvent event) throws SQLException, IOException {
String user = txtUsername.getText();
String pswd = txtPassword.getText();
ClientDAO ctDao = new ClientDAO();
String val = combobox.getValue();
switch (val) {
case"":
msgbox("choisir utilisateur");
break;
case "Administrateur":
if ((user.equals("admin")) && (pswd.equals("admin"))) {
// config2 config = new config2();
//config.newStage2(stage, btnLogin, "Evenement.fxml", "Sample Apps", true, StageStyle.UNDECORATED, false);
Stage st = new Stage();
FXMLLoader loader = new FXMLLoader(getClass().getResource("accueilAdmin.fxml"));
Region root = (Region) loader.load();
AccueilAdminController ac1 = loader.<AccueilAdminController>getController();
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
stage.hide();
Scene scene = new Scene(root);
//st.setMaximized(true);
//st.initStyle(StageStyle.UNDECORATED);
st.setScene(scene);
st.show();
} //Control saisi
else {
msgbox("Données invalides , Verifier les champs !");
txtUsername.setText("");
txtPassword.setText("");
}
break;
case "Client":
if ((user.length() > 0) && (pswd.length() > 0)) {
Client p1;
p1 = ctDao.findByLogin(user);
System.out.println(p1);
if (p1 == null) {
msgbox(" Veuillez vous inscrire !");
} else{
if (user.equals(p1.getLogin()) && pswd.equals(p1.getMdp()) && p1.getEtat() == 1) {
try {
Stage st = new Stage();
FXMLLoader loader = new FXMLLoader(getClass().getResource("accueil.fxml"));
Region root = (Region) loader.load();
AccueilController ac1 = loader.<AccueilController>getController();
usernid = p1.getId();
ac1.setUC(usernid);
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
stage.hide();
Scene scene = new Scene(root);
//st.setMaximized(true);
//st.initStyle(StageStyle.UNDECORATED);
st.setScene(scene);
st.show();
} catch (IOException ex) {
Logger.getLogger(LoginController.class.getName()).log(Level.SEVERE, null, ex);
}
} else if (user.equals(p1.getLogin()) && pswd.equals(p1.getMdp()) && p1.getEtat() == 0) {
msgbox(" Compte blocké !");
} else if (!(user.equals(p1.getLogin()) && pswd.equals(p1.getMdp()))) {
msgbox(" Login ou mot de passe erroné !");
}
} }
else {
msgbox("Données invalides, Verifier les champs !");
txtUsername.setText("");
txtPassword.setText("");
}
break;
}
}
public void setLabC(String labC) {
this.labC.setText(labC);
}
}
| [
"[email protected]"
]
| |
577e30588a2891fe9e77fa3620fc9bf4f5c0de2f | 65709ce81bc401200c7815155e528240c6de86e8 | /src/cn/online/shop/web/model/Role.java | ca396c184296755ec76c7448db408a5403dcd419 | []
| no_license | GlodenOcean/manager | 24e0808191bd2eaa895dde796c85c7ec5c1926e3 | 3a70cfa1df02bca035cb6c70bddbc80f097e094d | refs/heads/master | 2020-05-30T03:06:52.215866 | 2019-06-10T05:50:21 | 2019-06-10T05:50:21 | 114,335,072 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,527 | java | package cn.online.shop.web.model;
import java.util.List;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Page;
import cn.es.common.ESSearchCondition;
import cn.es.utils.ESSQLHelper;
import cn.online.shop.web.model.base.BaseRole;
/**
* 角色
* @author ocean
* by 2019年6月6日
*/
public class Role extends BaseRole<Role>{
private static final long serialVersionUID = 1L;
/**
* 非线程安全,只供查询使用
*/
public static Role dao = new Role();
/**
* 分页查询
* @param sc
* @return
*/
public Page<Role> search(ESSearchCondition sc){
int index = sc.page.getIndex();
int pageSize = sc.page.getSize();
ESSQLHelper sql = new ESSQLHelper("FROM sys_role WHERE 1 = 1");
sql.equals("roleName", sc.getString("roleName"));
sql.orderBy(sc,"updateDatetime","desc");
return super.paginate(index, pageSize, "select *", sql.toString(),sql.getParams());
}
/**
* 查询所有
* @return
*/
public List<Role> searchAll(){
ESSQLHelper sql = new ESSQLHelper("SELECT * FROM sys_role WHERE 1 = 1");
return super.find(sql.toString(),sql.getParams());
}
/**
* 根据角色名查询
* @param name
* @return
*/
public Role searchByName(String name){
return super.findFirst("select * from sys_role where roleName = ?", name);
}
public boolean batchDeleteByIds(Object... ids){
ESSQLHelper sql = new ESSQLHelper("DELETE FROM sys_role WHERE 1 = 1");
sql.in("id", ids);
return Db.update(sql.toString(), sql.getParams()) > 0;
}
}
| [
"[email protected]"
]
| |
73e93c6d98068a49b7964719c4899f16f2caac84 | 9e048428ca10f604c557784f4b28c68ce9b5cccb | /bitcamp-java-basic/src/step25/ex061/Exam01_3.java | e1f313753776522ab6d2785998529b30af7b4dad | []
| no_license | donhee/bitcamp | 6c90ec687e00de07315f647bdb1fda0e277c3937 | 860aa16d86cbd6faeb56b1f5c70b5ea5d297aef0 | refs/heads/master | 2021-01-24T11:44:48.812897 | 2019-02-20T00:06:07 | 2019-02-20T00:06:07 | 123,054,172 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,678 | java | // Mybatis - select 컬럼과 프로퍼티
package step25.ex061;
import java.io.InputStream;
import java.util.List;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
public class Exam01_3 {
public static void main(String[] args) throws Exception {
InputStream inputStream = Resources.getResourceAsStream(
"step25/ex061/mybatis-config03.xml");
SqlSessionFactory factory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = factory.openSession(); // openSession() : 객체를 생성해주는 메서드 : factory 패턴 적용
List<Board> list = sqlSession.selectList("BoardMapper.selectBoard");
for (Board board : list) {
System.out.printf("%d, %s, %s, %s\n",
board.getNo(),
board.getTitle(),
board.getContent(),
board.getRegisteredDate());
}
// 실행 오류 발생! 이유는?
// => mybatis에서 결과 값을 Board 객체에 담지 못했기 때문이다.
//
// 왜 결과 값을 Board에 담지 못했는가?
// => mybatis에서 결과의 컬럼 값을 자바 객체에 담을 때
// 컬럼 이름과 같은 이름을 가진 프로퍼티(셋터 메서드)를 찾는다.
// => 그런데 Board 클래스에는 컬럼 이름과 일치하는 프로퍼티가 없다.
sqlSession.close();
}
}
| [
"[email protected]"
]
| |
1024052fbcb91c411347bb0bf786c01f162a17b7 | f29dd700f5e7df394710b89d9f67ec185d85a04b | /code/zijingwang/src/main/java/com/xd/zijing/entity/Version.java | f599b653c9168b281863e0c1e55d460fa2cfbb80 | []
| no_license | ArchibaldOS/FilmAndTelevisionBusiness | 3d984e4a5154d6b811ba8c212a8a5bc7c5019f81 | a5a619a3807806b23a6940d3cf644506e02674d8 | refs/heads/master | 2021-01-01T19:51:01.642780 | 2017-09-04T02:42:48 | 2017-09-04T02:42:48 | 98,705,168 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 687 | java | package com.xd.zijing.entity;
/**
* Created by lenovo on 2017/8/21.
*/
public class Version {
private int versionId;
private String versionName;
public int getVersionId() {
return versionId;
}
public void setVersionId(int versionId) {
this.versionId = versionId;
}
public String getVersionName() {
return versionName;
}
public void setVersionName(String versionName) {
this.versionName = versionName;
}
@Override
public String toString() {
return "Version{" +
"versionId=" + versionId +
", versionName='" + versionName + '\'' +
'}';
}
}
| [
"[email protected]"
]
| |
a1539a8596e7fbc3f1002263a0db11436f46c4af | f840bec88c93bb062403764e0880a27c374aebc9 | /app/src/main/java/app/adventure/com/adventuremockretrofit/MainResponse.java | 332ed4c18e909d4f1fe4f6ede1e17c72a799ad2b | []
| no_license | conquerex/Adventure_Mock_Retrofit | a80a4b76cbcd2e22eaca69b88728bdeeb696d057 | 65080009cafb1b898cae28ab5a123f776bd02495 | refs/heads/master | 2020-03-21T20:16:06.071746 | 2018-06-29T10:16:44 | 2018-06-29T10:16:44 | 138,997,135 | 0 | 0 | null | 2018-06-29T10:16:45 | 2018-06-28T09:30:45 | Kotlin | UTF-8 | Java | false | false | 103 | java | package app.adventure.com.adventuremockretrofit;
public class MainResponse {
public int length;
}
| [
"[email protected]"
]
| |
c5e9ee6abcab22516ba664bfd11d4db00aeebe58 | 56dd209e9aedf896d9cb88ee440c981040dedc3f | /src/main/java/org/fantasy/bean/proxy/ProxyNameGeneratorStrategy.java | 5b9829035143339b27aae310418073d8d8ff8ee6 | []
| no_license | zhangyu84848245/butterfly | 6c417c6298b2ba47db62e4140fb8f392537d05eb | 3d4b8bc6616169897db7113bb1df709941642cf7 | refs/heads/master | 2016-09-13T09:35:39.950978 | 2016-05-13T07:44:26 | 2016-05-13T07:44:26 | 57,972,583 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,465 | java | package org.fantasy.bean.proxy;
import java.util.concurrent.atomic.AtomicLong;
import org.fantasy.util.Constant;
public class ProxyNameGeneratorStrategy implements NameGeneratorStrategy {
private static final AtomicLong NEXT = new AtomicLong(0);
public String getClassName(String fullName) {
String name = fullName.substring(fullName.lastIndexOf(".") + 1);
return Constant.PROXY_PACKAGE_NAME + Constant.DOLLAR + name + NEXT.getAndIncrement();
}
public String getMethodProxyName(String name) {
return name + Constant.PROXY_STR;
}
/**
* $$_methodName_METHOD_$$position
*/
public String getFieldName(String name, int position) {
StringBuilder builder = new StringBuilder();
builder.append(Constant.DOLLAR)
.append(Constant.UNDERLINE)
.append(name.toUpperCase())
.append(Constant.UNDERLINE)
.append(Constant.METHOD_STR )
.append(Constant.UNDERLINE)
.append(Constant.DOLLAR)
.append(position);
return builder.toString();
}
/**
* $$_methodName_METHOD_PROXY_$$position
*/
public String getFieldProxyName(String name, int position) {
StringBuilder builder = new StringBuilder();
builder.append(Constant.DOLLAR)
.append(Constant.UNDERLINE)
.append(name.toUpperCase())
.append(Constant.UNDERLINE)
.append(Constant.METHOD_PROXY_STR)
.append(Constant.UNDERLINE)
.append(Constant.DOLLAR)
.append(position);
return builder.toString();
}
} | [
"[email protected]"
]
| |
2a87461c1fd3d06b7d964fea0e11ed59e3c8f447 | 76f8ce9b7550d2a0df55975448b918ca456fd528 | /src/test/java/br/com/piloto/web/rest/errors/ExceptionTranslatorIntTest.java | 976a2fbfad4f8766040845ee2fbc0f59ab20b64e | []
| no_license | allanmoreira8/piloto | 61f3624a87722b458b0e38979e8ac03e4bc79de6 | 58bce3f1584a1fa16fd16b794a71201916ad195a | refs/heads/master | 2020-06-14T02:46:14.582867 | 2018-05-15T03:56:25 | 2018-05-15T03:56:25 | 75,514,864 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,483 | java | package br.com.piloto.web.rest.errors;
import br.com.piloto.PilotoApp;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.zalando.problem.spring.web.advice.MediaTypes;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* Test class for the ExceptionTranslator controller advice.
*
* @see ExceptionTranslator
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = PilotoApp.class)
public class ExceptionTranslatorIntTest {
@Autowired
private ExceptionTranslatorTestController controller;
@Autowired
private ExceptionTranslator exceptionTranslator;
@Autowired
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
private MockMvc mockMvc;
@Before
public void setup() {
mockMvc = MockMvcBuilders.standaloneSetup(controller)
.setControllerAdvice(exceptionTranslator)
.setMessageConverters(jacksonMessageConverter)
.build();
}
@Test
public void testConcurrencyFailure() throws Exception {
mockMvc.perform(get("/test/concurrency-failure"))
.andExpect(status().isConflict())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value(ErrorConstants.ERR_CONCURRENCY_FAILURE));
}
@Test
public void testMethodArgumentNotValid() throws Exception {
mockMvc.perform(post("/test/method-argument").content("{}").contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value(ErrorConstants.ERR_VALIDATION))
.andExpect(jsonPath("$.fieldErrors.[0].objectName").value("testDTO"))
.andExpect(jsonPath("$.fieldErrors.[0].field").value("test"))
.andExpect(jsonPath("$.fieldErrors.[0].message").value("NotNull"));
}
@Test
public void testParameterizedError() throws Exception {
mockMvc.perform(get("/test/parameterized-error"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("test parameterized error"))
.andExpect(jsonPath("$.params.param0").value("param0_value"))
.andExpect(jsonPath("$.params.param1").value("param1_value"));
}
@Test
public void testParameterizedError2() throws Exception {
mockMvc.perform(get("/test/parameterized-error2"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("test parameterized error"))
.andExpect(jsonPath("$.params.foo").value("foo_value"))
.andExpect(jsonPath("$.params.bar").value("bar_value"));
}
@Test
public void testMissingServletRequestPartException() throws Exception {
mockMvc.perform(get("/test/missing-servlet-request-part"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.400"));
}
@Test
public void testMissingServletRequestParameterException() throws Exception {
mockMvc.perform(get("/test/missing-servlet-request-parameter"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.400"));
}
@Test
public void testAccessDenied() throws Exception {
mockMvc.perform(get("/test/access-denied"))
.andExpect(status().isForbidden())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.403"))
.andExpect(jsonPath("$.detail").value("test access denied!"));
}
@Test
public void testUnauthorized() throws Exception {
mockMvc.perform(get("/test/unauthorized"))
.andExpect(status().isUnauthorized())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.401"))
.andExpect(jsonPath("$.path").value("/test/unauthorized"))
.andExpect(jsonPath("$.detail").value("test authentication failed!"));
}
@Test
public void testMethodNotSupported() throws Exception {
mockMvc.perform(post("/test/access-denied"))
.andExpect(status().isMethodNotAllowed())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.405"))
.andExpect(jsonPath("$.detail").value("Request method 'POST' not supported"));
}
@Test
public void testExceptionWithResponseStatus() throws Exception {
mockMvc.perform(get("/test/response-status"))
.andExpect(status().isBadRequest())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.400"))
.andExpect(jsonPath("$.title").value("test response status"));
}
@Test
public void testInternalServerError() throws Exception {
mockMvc.perform(get("/test/internal-server-error"))
.andExpect(status().isInternalServerError())
.andExpect(content().contentType(MediaTypes.PROBLEM))
.andExpect(jsonPath("$.message").value("error.http.500"))
.andExpect(jsonPath("$.title").value("Internal Server Error"));
}
}
| [
"[email protected]"
]
| |
806e01f823a94cb1c59b70f72edacc6db8b48b14 | 9734afdda5cd955161472e4451b2c268f3d8c555 | /UI/src/WordBlackList.java | 5ca95d1ea024206930db16230e903a399f00d2ef | []
| no_license | ded6114/IT114002 | 37d0c3e91aaef96c10171a411681ef54b7f8484f | b62bda998804c52c6b7d749ae2e280e4efc5455d | refs/heads/master | 2020-12-19T07:20:14.051868 | 2020-05-12T03:48:52 | 2020-05-12T03:48:52 | 235,661,765 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 20,721 | java | import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.regex.Pattern;
public class WordBlackList {
public static Collection<String> blacklist = new ArrayList<String>(Arrays.asList(
"2 girls 1 cup"," 2g1c"," 4r5e"," 5h1t"," 5hit"," a$$"," a$$hole"," a_s_s"," a2m"," a54"," a55"," a55hole"," acrotomophilia"," aeolus"," ahole"," alabama hot pocket"," alaskan pipeline"," anal"," anal impaler"," anal leakage"," analprobe"," anilingus"," anus"," apeshit"," ar5e"," areola"," areole"," arian"," arrse"," arse"," arsehole"," aryan"," ass"," ass fuck"," ass fuck"," ass hole"," assbag"," assbandit"," assbang"," assbanged"," assbanger"," assbangs"," assbite"," assclown"," asscock"," asscracker"," asses"," assface"," assfaces"," assfuck"," assfucker"," ass-fucker"," assfukka"," assgoblin"," assh0le"," asshat"," ass-hat"," asshead"," assho1e"," asshole"," assholes"," asshopper"," ass-jabber"," assjacker"," asslick"," asslicker"," assmaster"," assmonkey"," assmucus"," assmucus"," assmunch"," assmuncher"," assnigger"," asspirate"," ass-pirate"," assshit"," assshole"," asssucker"," asswad"," asswhole"," asswipe"," asswipes"," auto erotic"," autoerotic"," axwound"," azazel"," azz"," b!tch"," b00bs"," b17ch"," b1tch"," babeland"," baby batter"," baby juice"," ball gag"," ball gravy"," ball kicking"," ball licking"," ball sack"," ball sucking"," ballbag"," balls"," ballsack"," bampot"," bang (one's) box"," bangbros"," bareback"," barely legal"," barenaked"," barf"," bastard"," bastardo"," bastards"," bastinado"," batty boy"," bawdy"," bbw"," bdsm"," beaner"," beaners"," beardedclam"," beastial"," beastiality"," beatch"," beaver"," beaver cleaver"," beaver lips"," beef curtain"," beef curtain"," beef curtains"," beeyotch"," bellend"," bender"," beotch"," bescumber"," bestial"," bestiality"," bi+ch"," biatch"," big black"," big breasts"," big knockers"," big tits"," bigtits"," bimbo"," bimbos"," bint"," birdlock"," bitch"," bitch tit"," bitch tit"," bitchass"," bitched"," bitcher"," bitchers"," bitches"," bitchin"," bitching"," bitchtits"," bitchy"," black cock"," blonde action"," blonde on blonde action"," bloodclaat"," bloody"," bloody hell"," blow job"," blow me"," blow mud"," blow your load"," blowjob"," blowjobs"," blue waffle"," blue waffle"," blumpkin"," blumpkin"," bod"," bodily"," boink"," boiolas"," bollock"," bollocks"," bollok"," bollox"," bondage"," boned"," boner"," boners"," bong"," boob"," boobies"," boobs"," booby"," booger"," bookie"," boong"," booobs"," boooobs"," booooobs"," booooooobs"," bootee"," bootie"," booty"," booty call"," booze"," boozer"," boozy"," bosom"," bosomy"," breasts"," Breeder"," brotherfucker"," brown showers"," brunette action"," buceta"," bugger"," bukkake"," bull shit"," bulldyke"," bullet vibe"," bullshit"," bullshits"," bullshitted"," bullturds"," bum"," bum boy"," bumblefuck"," bumclat"," bummer"," buncombe"," bung"," bung hole"," bunghole"," bunny fucker"," bust a load"," bust a load"," busty"," butt"," butt fuck"," butt fuck"," butt plug"," buttcheeks"," buttfuck"," buttfucka"," buttfucker"," butthole"," buttmuch"," buttmunch"," butt-pirate"," buttplug"," c.0.c.k"," c.o.c.k."," c.u.n.t"," c0ck"," c-0-c-k"," c0cksucker"," caca"," cacafuego"," cahone"," camel toe"," cameltoe"," camgirl"," camslut"," camwhore"," carpet muncher"," carpetmuncher"," cawk"," cervix"," chesticle"," chi-chi man"," chick with a dick"," child-fucker"," chinc"," chincs"," chink"," chinky"," choad"," choade"," choade"," choc ice"," chocolate rosebuds"," chode"," chodes"," chota bags"," chota bags"," cipa"," circlejerk"," cl1t"," cleveland steamer"," climax"," clit"," clit licker"," clit licker"," clitface"," clitfuck"," clitoris"," clitorus"," clits"," clitty"," clitty litter"," clitty litter"," clover clamps"," clunge"," clusterfuck"," cnut"," cocain"," cocaine"," coccydynia"," cock"," c-o-c-k"," cock pocket"," cock pocket"," cock snot"," cock snot"," cock sucker"," cockass"," cockbite"," cockblock"," cockburger"," cockeye"," cockface"," cockfucker"," cockhead"," cockholster"," cockjockey"," cockknocker"," cockknoker"," Cocklump"," cockmaster"," cockmongler"," cockmongruel"," cockmonkey"," cockmunch"," cockmuncher"," cocknose"," cocknugget"," cocks"," cockshit"," cocksmith"," cocksmoke"," cocksmoker"," cocksniffer"," cocksuck"," cocksuck"," cocksucked"," cocksucked"," cocksucker"," cock-sucker"," cocksuckers"," cocksucking"," cocksucks"," cocksucks"," cocksuka"," cocksukka"," cockwaffle"," coffin dodger"," coital"," cok"," cokmuncher"," coksucka"," commie"," condom"," coochie"," coochy"," coon"," coonnass"," coons"," cooter"," cop some wood"," cop some wood"," coprolagnia"," coprophilia"," corksucker"," cornhole"," cornhole"," corp whore"," corp whore"," corpulent"," cox"," crabs"," crack"," cracker"," crackwhore"," crap"," crappy"," creampie"," cretin"," crikey"," cripple"," crotte"," cum"," cum chugger"," cum chugger"," cum dumpster"," cum dumpster"," cum freak"," cum freak"," cum guzzler"," cum guzzler"," cumbubble"," cumdump"," cumdump"," cumdumpster"," cumguzzler"," cumjockey"," cummer"," cummin"," cumming"," cums"," cumshot"," cumshots"," cumslut"," cumstain"," cumtart"," cunilingus"," cunillingus"," cunnie"," cunnilingus"," cunny"," cunt"," c-u-n-t"," cunt hair"," cunt hair"," cuntass"," cuntbag"," cuntbag"," cuntface"," cunthole"," cunthunter"," cuntlick"," cuntlick"," cuntlicker"," cuntlicker"," cuntlicking"," cuntlicking"," cuntrag"," cunts"," cuntsicle"," cuntsicle"," cuntslut"," cunt-struck"," cunt-struck"," cus"," cut rope"," cut rope"," cyalis"," cyberfuc"," cyberfuck"," cyberfuck"," cyberfucked"," cyberfucked"," cyberfucker"," cyberfuckers"," cyberfucking"," cyberfucking"," d0ng"," d0uch3"," d0uche"," d1ck"," d1ld0"," d1ldo"," dago"," dagos"," dammit"," damn"," damned"," damnit"," darkie"," darn"," date rape"," daterape"," dawgie-style"," deep throat"," deepthroat"," deggo"," dendrophilia"," dick"," dick head"," dick hole"," dick hole"," dick shy"," dick shy"," dickbag"," dickbeaters"," dickdipper"," dickface"," dickflipper"," dickfuck"," dickfucker"," dickhead"," dickheads"," dickhole"," dickish"," dick-ish"," dickjuice"," dickmilk"," dickmonger"," dickripper"," dicks"," dicksipper"," dickslap"," dick-sneeze"," dicksucker"," dicksucking"," dicktickler"," dickwad"," dickweasel"," dickweed"," dickwhipper"," dickwod"," dickzipper"," diddle"," dike"," dildo"," dildos"," diligaf"," dillweed"," dimwit"," dingle"," dingleberries"," dingleberry"," dink"," dinks"," dipship"," dipshit"," dirsa"," dirty"," dirty pillows"," dirty sanchez"," dirty Sanchez"," div"," dlck"," dog style"," dog-fucker"," doggie style"," doggiestyle"," doggie-style"," doggin"," dogging"," doggy style"," doggystyle"," doggy-style"," dolcett"," domination"," dominatrix"," dommes"," dong"," donkey punch"," donkeypunch"," donkeyribber"," doochbag"," doofus"," dookie"," doosh"," dopey"," double dong"," double penetration"," Doublelift"," douch3"," douche"," douchebag"," douchebags"," douche-fag"," douchewaffle"," douchey"," dp action"," drunk"," dry hump"," duche"," dumass"," dumb ass"," dumbass"," dumbasses"," Dumbcunt"," dumbfuck"," dumbshit"," dummy"," dumshit"," dvda"," dyke"," dykes"," eat a dick"," eat a dick"," eat hair pie"," eat hair pie"," eat my ass"," ecchi"," ejaculate"," ejaculated"," ejaculates"," ejaculates"," ejaculating"," ejaculating"," ejaculatings"," ejaculation"," ejakulate"," erect"," erection"," erotic"," erotism"," escort"," essohbee"," eunuch"," extacy"," extasy"," f u c k"," f u c k e r"," f.u.c.k"," f_u_c_k"," f4nny"," facial"," fack"," fag"," fagbag"," fagfucker"," fagg"," fagged"," fagging"," faggit"," faggitt"," faggot"," faggotcock"," faggots"," faggs"," fagot"," fagots"," fags"," fagtard"," faig"," faigt"," fanny"," fannybandit"," fannyflaps"," fannyfucker"," fanyy"," fart"," fartknocker"," fatass"," fcuk"," fcuker"," fcuking"," fecal"," feck"," fecker"," feist"," felch"," felcher"," felching"," fellate"," fellatio"," feltch"," feltcher"," female squirting"," femdom"," fenian"," fice"," figging"," fingerbang"," fingerfuck"," fingerfuck"," fingerfucked"," fingerfucked"," fingerfucker"," fingerfucker"," fingerfuckers"," fingerfucking"," fingerfucking"," fingerfucks"," fingerfucks"," fingering"," fist fuck"," fist fuck"," fisted"," fistfuck"," fistfucked"," fistfucked"," fistfucker"," fistfucker"," fistfuckers"," fistfuckers"," fistfucking"," fistfucking"," fistfuckings"," fistfuckings"," fistfucks"," fistfucks"," fisting"," fisty"," flamer"," flange"," flaps"," fleshflute"," flog the log"," flog the log"," floozy"," foad"," foah"," fondle"," foobar"," fook"," fooker"," foot fetish"," footjob"," foreskin"," freex"," frenchify"," frigg"," frigga"," frotting"," fubar"," fuc"," fuck"," fuck"," f-u-c-k"," fuck buttons"," fuck hole"," fuck hole"," Fuck off"," fuck puppet"," fuck puppet"," fuck trophy"," fuck trophy"," fuck yo mama"," fuck yo mama"," fuck you"," fucka"," fuckass"," fuck-ass"," fuck-ass"," fuckbag"," fuck-bitch"," fuck-bitch"," fuckboy"," fuckbrain"," fuckbutt"," fuckbutter"," fucked"," fuckedup"," fucker"," fuckers"," fuckersucker"," fuckface"," fuckhead"," fuckheads"," fuckhole"," fuckin"," fucking"," fuckings"," fuckingshitmotherfucker"," fuckme"," fuckme"," fuckmeat"," fuckmeat"," fucknugget"," fucknut"," fucknutt"," fuckoff"," fucks"," fuckstick"," fucktard"," fuck-tard"," fucktards"," fucktart"," fucktoy"," fucktoy"," fucktwat"," fuckup"," fuckwad"," fuckwhit"," fuckwit"," fuckwitt"," fudge packer"," fudgepacker"," fudge-packer"," fuk"," fuker"," fukker"," fukkers"," fukkin"," fuks"," fukwhit"," fukwit"," fuq"," futanari"," fux"," fux0r"," fvck"," fxck"," gae"," gai"," gang bang"," gangbang"," gang-bang"," gang-bang"," gangbanged"," gangbangs"," ganja"," gash"," gassy ass"," gassy ass"," gay"," gay sex"," gayass"," gaybob"," gaydo"," gayfuck"," gayfuckist"," gaylord"," gays"," gaysex"," gaytard"," gaywad"," gender bender"," genitals"," gey"," gfy"," ghay"," ghey"," giant cock"," gigolo"," ginger"," gippo"," girl on"," girl on top"," girls gone wild"," git"," glans"," goatcx"," goatse"," god"," god damn"," godamn"," godamnit"," goddam"," god-dam"," goddammit"," goddamn"," goddamned"," god-damned"," goddamnit"," godsdamn"," gokkun"," golden shower"," goldenshower"," golliwog"," gonad"," gonads"," goo girl"," gooch"," goodpoop"," gook"," gooks"," goregasm"," gringo"," grope"," group sex"," gspot"," g-spot"," gtfo"," guido"," guro"," h0m0"," h0mo"," ham flap"," ham flap"," hand job"," handjob"," hard core"," hard on"," hardcore"," hardcoresex"," he11"," hebe"," heeb"," hell"," hemp"," hentai"," heroin"," herp"," herpes"," herpy"," heshe"," he-she"," hircismus"," hitler"," hiv"," ho"," hoar"," hoare"," hobag"," hoe"," hoer"," holy shit"," hom0"," homey"," homo"," homodumbshit"," homoerotic"," homoey"," honkey"," honky"," hooch"," hookah"," hooker"," hoor"," hootch"," hooter"," hooters"," hore"," horniest"," horny"," hot carl"," hot chick"," hotsex"," how to kill"," how to murdep"," how to murder"," huge fat"," hump"," humped"," humping"," hun"," hussy"," hymen"," iap"," iberian slap"," inbred"," incest"," injun"," intercourse"," jack off"," jackass"," jackasses"," jackhole"," jackoff"," jack-off"," jaggi"," jagoff"," jail bait"," jailbait"," jap"," japs"," jelly donut"," jerk"," jerk off"," jerk0ff"," jerkass"," jerked"," jerkoff"," jerk-off"," jigaboo"," jiggaboo"," jiggerboo"," jism"," jiz"," jiz"," jizm"," jizm"," jizz"," jizzed"," jock"," juggs"," jungle bunny"," junglebunny"," junkie"," junky"," kafir"," kawk"," kike"," kikes"," kill"," kinbaku"," kinkster"," kinky"," klan"," knob"," knob end"," knobbing"," knobead"," knobed"," knobend"," knobhead"," knobjocky"," knobjokey"," kock"," kondum"," kondums"," kooch"," kooches"," kootch"," kraut"," kum"," kummer"," kumming"," kums"," kunilingus"," kunja"," kunt"," kwif"," kwif"," kyke"," l3i+ch"," l3itch"," labia"," lameass"," lardass"," leather restraint"," leather straight jacket"," lech"," lemon party"," LEN"," leper"," lesbian"," lesbians"," lesbo"," lesbos"," lez"," lezza/lesbo"," lezzie"," lmao"," lmfao"," loin"," loins"," lolita"," looney"," lovemaking"," lube"," lust"," lusting"," lusty"," m0f0"," m0fo"," m45terbate"," ma5terb8"," ma5terbate"," mafugly"," mafugly"," make me come"," male squirting"," mams"," masochist"," massa"," masterb8"," masterbat*"," masterbat3"," masterbate"," master-bate"," master-bate"," masterbating"," masterbation"," masterbations"," masturbate"," masturbating"," masturbation"," maxi"," mcfagget"," menage a trois"," menses"," menstruate"," menstruation"," meth"," m-fucking"," mick"," microphallus"," middle finger"," midget"," milf"," minge"," minger"," missionary position"," mof0"," mofo"," mo-fo"," molest"," mong"," moo moo foo foo"," moolie"," moron"," mothafuck"," mothafucka"," mothafuckas"," mothafuckaz"," mothafucked"," mothafucked"," mothafucker"," mothafuckers"," mothafuckin"," mothafucking"," mothafucking"," mothafuckings"," mothafucks"," mother fucker"," mother fucker"," motherfuck"," motherfucka"," motherfucked"," motherfucker"," motherfuckers"," motherfuckin"," motherfucking"," motherfuckings"," motherfuckka"," motherfucks"," mound of venus"," mr hands"," muff"," muff diver"," muff puff"," muff puff"," muffdiver"," muffdiving"," munging"," munter"," murder"," mutha"," muthafecker"," muthafuckker"," muther"," mutherfucker"," n1gga"," n1gger"," naked"," nambla"," napalm"," nappy"," nawashi"," nazi"," nazism"," need the dick"," need the dick"," negro"," neonazi"," nig nog"," nigaboo"," nigg3r"," nigg4h"," nigga"," niggah"," niggas"," niggaz"," nigger"," niggers"," niggle"," niglet"," nig-nog"," nimphomania"," nimrod"," ninny"," ninnyhammer"," nipple"," nipples"," nob"," nob jokey"," nobhead"," nobjocky"," nobjokey"," nonce"," nsfw images"," nude"," nudity"," numbnuts"," nut butter"," nut butter"," nut sack"," nutsack"," nutter"," nympho"," nymphomania"," octopussy"," old bag"," omg"," omorashi"," one cup two girls"," one guy one jar"," opiate"," opium"," orally"," organ"," orgasim"," orgasims"," orgasm"," orgasmic"," orgasms"," orgies"," orgy"," ovary"," ovum"," ovums"," p.u.s.s.y."," p0rn"," paedophile"," paki"," panooch"," pansy"," pantie"," panties"," panty"," pawn"," pcp"," pecker"," peckerhead"," pedo"," pedobear"," pedophile"," pedophilia"," pedophiliac"," pee"," peepee"," pegging"," penetrate"," penetration"," penial"," penile"," penis"," penisbanger"," penisfucker"," penispuffer"," perversion"," phallic"," phone sex"," phonesex"," phuck"," phuk"," phuked"," phuking"," phukked"," phukking"," phuks"," phuq"," piece of shit"," pigfucker"," pikey"," pillowbiter"," pimp"," pimpis"," pinko"," piss"," piss off"," piss pig"," pissed"," pissed off"," pisser"," pissers"," pisses"," pisses"," pissflaps"," pissin"," pissin"," pissing"," pissoff"," pissoff"," piss-off"," pisspig"," playboy"," pleasure chest"," pms"," polack"," pole smoker"," polesmoker"," pollock"," ponyplay"," poof"," poon"," poonani"," poonany"," poontang"," poop"," poop chute"," poopchute"," Poopuncher"," porch monkey"," porchmonkey"," porn"," porno"," pornography"," pornos"," pot"," potty"," prick"," pricks"," prickteaser"," prig"," prince albert piercing"," prod"," pron"," prostitute"," prude"," psycho"," pthc"," pube"," pubes"," pubic"," pubis"," punani"," punanny"," punany"," punkass"," punky"," punta"," puss"," pusse"," pussi"," pussies"," pussy"," pussy fart"," pussy fart"," pussy palace"," pussy palace"," pussylicking"," pussypounder"," pussys"," pust"," puto"," queaf"," queaf"," queef"," queer"," queerbait"," queerhole"," queero"," queers"," quicky"," quim"," racy"," raghead"," raging boner"," rape"," raped"," raper"," rapey"," raping"," rapist"," raunch"," rectal"," rectum"," rectus"," reefer"," reetard"," reich"," renob"," retard"," retarded"," reverse cowgirl"," revue"," rimjaw"," rimjob"," rimming"," ritard"," rosy palm"," rosy palm and her 5 sisters"," rtard"," r-tard"," rubbish"," rum"," rump"," rumprammer"," ruski"," rusty trombone"," s hit"," s&m"," s.h.i.t."," s.o.b."," s_h_i_t"," s0b"," sadism"," sadist"," sambo"," sand nigger"," sandbar"," sandbar"," Sandler"," sandnigger"," sanger"," santorum"," sausage queen"," sausage queen"," scag"," scantily"," scat"," schizo"," schlong"," scissoring"," screw"," screwed"," screwing"," scroat"," scrog"," scrot"," scrote"," scrotum"," scrud"," scum"," seaman"," seamen"," seduce"," seks"," semen"," sex"," sexo"," sexual"," sexy"," sh!+"," sh!t"," sh1t"," s-h-1-t"," shag"," shagger"," shaggin"," shagging"," shamedame"," shaved beaver"," shaved pussy"," shemale"," shi+"," shibari"," shirt lifter"," shit"," s-h-i-t"," shit ass"," shit fucker"," shit fucker"," shitass"," shitbag"," shitbagger"," shitblimp"," shitbrains"," shitbreath"," shitcanned"," shitcunt"," shitdick"," shite"," shiteater"," shited"," shitey"," shitface"," shitfaced"," shitfuck"," shitfull"," shithead"," shitheads"," shithole"," shithouse"," shiting"," shitings"," shits"," shitspitter"," shitstain"," shitt"," shitted"," shitter"," shitters"," shitters"," shittier"," shittiest"," shitting"," shittings"," shitty"," shiz"," shiznit"," shota"," shrimping"," sissy"," skag"," skank"," skeet"," skullfuck"," slag"," slanteye"," slave"," sleaze"," sleazy"," slope"," slope"," slut"," slut bucket"," slut bucket"," slutbag"," slutdumper"," slutkiss"," sluts"," smartass"," smartasses"," smeg"," smegma"," smut"," smutty"," snatch"," sniper"," snowballing"," snuff"," s-o-b"," sod off"," sodom"," sodomize"," sodomy"," son of a bitch"," son of a motherless goat"," son of a whore"," son-of-a-bitch"," souse"," soused"," spac"," spade"," sperm"," spic"," spick"," spik"," spiks"," splooge"," splooge moose"," spooge"," spook"," spread legs"," spunk"," stfu"," stiffy"," stoned"," strap on"," strapon"," strappado"," strip"," strip club"," stroke"," stupid"," style doggy"," suck"," suckass"," sucked"," sucking"," sucks"," suicide girls"," sultry women"," sumofabiatch"," swastika"," swinger"," t1t"," t1tt1e5"," t1tties"," taff"," taig"," tainted love"," taking the piss"," tampon"," tard"," tart"," taste my"," tawdry"," tea bagging"," teabagging"," teat"," teets"," teez"," teste"," testee"," testes"," testical"," testicle"," testis"," threesome"," throating"," thrust"," thug"," thundercunt"," tied up"," tight white"," tinkle"," tit"," tit wank"," tit wank"," titfuck"," titi"," tities"," tits"," titt"," tittie5"," tittiefucker"," titties"," titty"," tittyfuck"," tittyfucker"," tittywank"," titwank"," toke"," tongue in a"," toots"," topless"," tosser"," towelhead"," tramp"," tranny"," transsexual"," trashy"," tribadism"," trumped"," tub girl"," tubgirl"," turd"," tush"," tushy"," tw4t"," twat"," twathead"," twatlips"," twats"," twatty"," twatwaffle"," twink"," twinkie"," two fingers"," two fingers with tongue"," two girls one cup"," twunt"," twunter"," ugly"," unclefucker"," undies"," undressing"," unwed"," upskirt"," urethra play"," urinal"," urine"," urophilia"," uterus"," uzi"," v14gra"," v1gra"," vag"," vagina"," vajayjay"," va-j-j"," valium"," venus mound"," veqtable"," viagra"," vibrator"," violet wand"," virgin"," vixen"," vjayjay"," vodka"," vomit"," vorarephilia"," voyeur"," vulgar"," vulva"," w00se"," wad"," wang"," wank"," wanker"," wankjob"," wanky"," wazoo"," wedgie"," weed"," weenie"," weewee"," weiner"," weirdo"," wench"," wet dream"," wetback"," wh0re"," wh0reface"," white power"," whiz"," whoar"," whoralicious"," whore"," whorealicious"," whorebag"," whored"," whoreface"," whorehopper"," whorehouse"," whores"," whoring"," wigger"," willies"," willy"," window licker"," wiseass"," wiseasses"," wog"," womb"," wop"," wrapping men"," wrinkled starfish"," wtf"," xrated"," x-rated"," xx"," xxx"," yaoi"," yeasty"," yellow showers"," yid"," yiffy"," yobbo"," zibbi"," zoophilia"," zubb"
));
static List<String> silly = new ArrayList<String>(Arrays.asList(
"pickles","sprinkles","cake","cookies","gobble gobble","oops","potato","haha","cool","magic","I'm funny","eh?","What you egg?"
));
public static String filter(String str) {
str = str.toLowerCase();
Iterator<String> it = blacklist.iterator();
Random rand = new Random();
while(it.hasNext()) {
String i = it.next().trim();
if(str.contains(i)) {
System.out.println("Replacing " + i);
String original = "";
//replace with random silly word
do {
original = str;
str = str.replaceFirst("(?<!\\w)" + Pattern.quote(i) + "(?!\\w)", silly.get(rand.nextInt(silly.size())));
}
while(!original.equals(str));
}
}
return str;
}
} | [
"[email protected]"
]
| |
a32b0032726b4eda6062d71f8680b86dc476704e | b770b8799b43ca5ffe2fea9b293fb37d929c80cc | /JavaExamples/src/examples/HashExamples.java | 616cd18304bfa4b15fbe425f3cd282c4e5416cdf | []
| no_license | Malifter/Examples | 868a2714a962782343524cde64d15f2a46cfe5fd | 16ab6ef818dd370ae10e0405b2bcd8b1735f3c8c | refs/heads/master | 2021-01-10T17:03:55.661693 | 2016-01-09T01:45:34 | 2016-01-09T01:45:34 | 46,088,244 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,403 | java | package examples;
import java.util.Arrays;
import hashstructures.HashTableSeparateChaining;
public class HashExamples {
public static void main(String [] args) {
HashTableSeparateChaining<String, Integer> htsc = new HashTableSeparateChaining<String, Integer>();
// before inserting
System.out.println("Before Inserting");
System.out.println(Arrays.toString(htsc.keySet().toArray()));
System.out.println(htsc.toFullString());
htsc.put("a", 0);
htsc.put("b", 1);
htsc.put("c", 2);
htsc.put("d", 3);
htsc.put("e", 2);
htsc.put("f", 1);
htsc.put("g", 0);
htsc.put("h", 4);
htsc.put("h", 5);
htsc.put("i", 6);
htsc.put("j", 7);
htsc.put("k", 8);
htsc.put("l", 9);
// before grow resize
System.out.println("Before Grow");
System.out.println(Arrays.toString(htsc.keySet().toArray()));
System.out.println(htsc.toFullString());
htsc.put("m", 20);
// after grow resize
System.out.println("After Grow");
System.out.println(Arrays.toString(htsc.keySet().toArray()));
System.out.println(htsc.toFullString());
htsc.put("n", 15);
htsc.put("a", 11);
htsc.put("b", 12);
htsc.put("c", 13);
htsc.put("d", 14);
htsc.put("p", 16);
htsc.put("q", 17);
htsc.put("r", 18);
htsc.put("s", 19);
htsc.put("o", 21);
// finished inserting
System.out.println("Finished Inserting & Before Removing");
System.out.println(Arrays.toString(htsc.keySet().toArray()));
System.out.println(htsc.toFullString());
htsc.remove("b");
htsc.remove("d");
htsc.remove("f");
htsc.remove("h");
htsc.remove("j");
htsc.remove("l");
htsc.remove("n");
htsc.remove("p");
htsc.remove("r");
htsc.remove("k");
htsc.remove("o");
// before shrink resize
System.out.println("Before Shrink");
System.out.println(Arrays.toString(htsc.keySet().toArray()));
System.out.println(htsc.toFullString());
htsc.remove("e");
// after shrink resize
System.out.println("After Shrink");
System.out.println(Arrays.toString(htsc.keySet().toArray()));
System.out.println(htsc.toFullString());
htsc.clear();
// finished removing
System.out.println("Finished Removing");
System.out.println(Arrays.toString(htsc.keySet().toArray()));
System.out.println(htsc.toFullString());
// TODO: Use the p022_names file to do a massive insert and remove in random order.
}
}
| [
"[email protected]"
]
| |
7d37a4873c7990563d92109f03f4adc0a9c2cc2c | 759eb01b8fa47c9d4b29643e2e807a05a639d265 | /src/HM2/Interval.java | dcfb88e1778682e9d5a0845fd6be29b65f450c9c | []
| no_license | dn040192tsg/privatBank | 15b999527a6904716a04ad05c125923fe15e7ccd | ad3948bbc2866b8b0075e0ee6b1c47465a0f8e43 | refs/heads/master | 2020-03-26T22:33:43.862464 | 2018-11-19T00:48:59 | 2018-11-19T00:48:59 | 145,469,291 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,103 | java | package HM2;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Interval {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.println("введите свое число");
int number = Integer.parseInt(reader.readLine());
System.out.println(check(number));
}
public static String check (int a) {
String res = "";
if (a >= 0 && a <= 14) {
res = "промежуток [0 -14]";
}else if (a >= 15 && a <= 35) {
res = "промежуток [15 - 35]";
}else if (a >= 36 && a <= 50) {
res = "промежуток [36 - 50]";
}else if (a >= 50 && a <= 100) {
res = "промежуток [50 - 100]";
}else {
res = "число, не входящее ни в один из имеющихся числовых промежутков";
}
return res;
}
}
| [
"[email protected]"
]
| |
506f91f34f69469663e3e7006016105c1370ca80 | 458005adc3c465af3264da930e2b6e4c8aafdadb | /app/libs/jaunt/examples_extra/Example6.java | f0e6868544f7f1ee7e2ce0fdcd4c6e334f8131b0 | [
"Apache-2.0"
]
| permissive | Roshan23699/Keep-Chegging | 661625d8a40864381afcf873f4cf0d5e569795cb | 86d522e08b7c935ef2ba27e8cd18b951ffef0b15 | refs/heads/master | 2023-07-08T03:59:51.527331 | 2021-08-10T18:14:35 | 2021-08-10T18:14:35 | 382,295,860 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,378 | java | import com.jaunt.*;
import com.jaunt.util.*;
public class Example6{
public static void main(String[] args){
try{
//create UserAgent and content handlers.
UserAgent userAgent = new UserAgent();
HandlerForText handlerForText = new HandlerForText();
HandlerForBinary handlerForBinary = new HandlerForBinary();
//register each handler with a specific content-type
userAgent.setHandler("text/css", handlerForText);
userAgent.setHandler("text/javascript", handlerForText);
userAgent.setHandler("application/x-javascript", handlerForText);
userAgent.setHandler("image/gif", handlerForBinary);
userAgent.setHandler("image/jpeg", handlerForBinary);
//retrieve CSS content as String
userAgent.visit("http://jaunt-api.com/syntaxhighlighter/styles/shCore.css");
System.out.println(handlerForText.getContent());
//retrieve JS content as String
userAgent.visit("http://jaunt-api.com/syntaxhighlighter/scripts/shCore.js");
System.out.println(handlerForText.getContent());
//retrieve GIF content as byte[], and print its length
userAgent.visit("http://jaunt-api.com/background.gif");
System.out.println(handlerForBinary.getContent().length);
}
catch(JauntException j){
System.err.println(j);
}
}
} | [
"="
]
| = |
7bb872bfd8465c6627e15767b460ea2fdd319e7a | 8c7881b6ccec51f921d475c35dd7a6b516bbabb0 | /backend/springboot-stomp-websocket/src/main/java/net/javaguides/springboot/websocket/controller/UsersController.java | c3b1bdcd694e074b22fac57c3dd25380c04b42c7 | []
| no_license | jalmassi/WebSocket-SockJS-Chat | 9c0f16e63354b6840788aebc6ac2d698d4e58857 | 8df58fede160c25f715cd2035c4af811caaa6dfd | refs/heads/master | 2023-01-18T23:42:13.407012 | 2020-11-25T04:15:48 | 2020-11-25T04:15:48 | 315,756,717 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,087 | java | package net.javaguides.springboot.websocket.controller;
import net.javaguides.springboot.websocket.storage.UserStorage;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import java.util.Set;
@RestController
@CrossOrigin
public class UsersController {
@GetMapping("/registration/{userName}")
public ResponseEntity<Void> register(@PathVariable String userName){
System.out.println("handling register user request: " + userName);
try {
UserStorage.getInstance().setUser(userName);
} catch (Exception e) {
// TODO Auto-generated catch block
return ResponseEntity.badRequest().build();
}
return ResponseEntity.ok().build();
}
@GetMapping("/fetchAllUsers")
public Set<String> fetchAll(){
return UserStorage.getInstance().getUsers();
}
}
| [
"[email protected]"
]
| |
9bd28db625edb3264f87f276ac73abc9d27fcdbf | d2a1e54e7c60692905475f92cf54e6a71dd34ba6 | /waterfall/src/main/java/me/maxwin/view/XListViewFooter.java | 5e1a94993e11e98c77f4ac79e600ca47b1400c25 | []
| no_license | zuweie/showfm | adca50af2303dc3a09a2a55183f10b70c9c2418d | fe58a5f8098e5a08e25aa1d61cdbacd755b818fd | refs/heads/master | 2021-01-10T18:26:25.800039 | 2015-05-15T06:59:44 | 2015-05-15T06:59:44 | 27,910,782 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,417 | java | /**
* @file XFooterView.java
* @create Mar 31, 2012 9:33:43 PM
* @author Maxwin
* @description XListView's footer
*/
package me.maxwin.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.huewu.pla.waterfall.R;
public class XListViewFooter extends LinearLayout {
public final static int STATE_NORMAL = 0;
public final static int STATE_READY = 1;
public final static int STATE_LOADING = 2;
private Context mContext;
private View mContentView;
private View mProgressBar;
private TextView mHintView;
public XListViewFooter(Context context) {
super(context);
initView(context);
}
public XListViewFooter(Context context, AttributeSet attrs) {
super(context, attrs);
initView(context);
}
public void setState(int state) {
mHintView.setVisibility(View.INVISIBLE);
mProgressBar.setVisibility(View.INVISIBLE);
mHintView.setVisibility(View.INVISIBLE);
if (state == STATE_READY) {
mHintView.setVisibility(View.VISIBLE);
mHintView.setText(R.string.xlistview_footer_hint_ready);
} else if (state == STATE_LOADING) {
mProgressBar.setVisibility(View.VISIBLE);
} else {
mHintView.setVisibility(View.VISIBLE);
mHintView.setText(R.string.xlistview_footer_hint_normal);
}
}
public void setBottomMargin(int height) {
if (height < 0)
return;
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContentView.getLayoutParams();
lp.bottomMargin = height;
mContentView.setLayoutParams(lp);
}
public int getBottomMargin() {
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContentView.getLayoutParams();
return lp.bottomMargin;
}
/**
* normal status
*/
public void normal() {
mHintView.setVisibility(View.VISIBLE);
mProgressBar.setVisibility(View.GONE);
}
/**
* loading status
*/
public void loading() {
mHintView.setVisibility(View.GONE);
mProgressBar.setVisibility(View.VISIBLE);
}
/**
* hide footer when disable pull load more
*/
public void hide() {
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContentView.getLayoutParams();
lp.height = 0;
mContentView.setLayoutParams(lp);
}
/**
* show footer
*/
public void show() {
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContentView.getLayoutParams();
lp.height = LayoutParams.WRAP_CONTENT;
mContentView.setLayoutParams(lp);
}
private void initView(Context context) {
mContext = context;
LinearLayout moreView = (LinearLayout) LayoutInflater.from(mContext).inflate(R.layout.xlistview_footer, null);
addView(moreView);
moreView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
mContentView = moreView.findViewById(R.id.xlistview_footer_content);
mProgressBar = moreView.findViewById(R.id.xlistview_footer_progressbar);
mHintView = (TextView) moreView.findViewById(R.id.xlistview_footer_hint_textview);
}
}
| [
"zuweie@zuweie-HP-Pavilion-g4-Notebook-PC.(none)"
]
| zuweie@zuweie-HP-Pavilion-g4-Notebook-PC.(none) |
b234f5843b75cd08f62f8bb0b12fed8451ca22b3 | 93dafc690950f66adc591d5a699316273b78e39c | /_/B05064_05/BookDrawer/app/src/androidTest/java/com/jwhh/bookdrawer/ApplicationTest.java | f8868281aa961f2689543918ae0bd540bc71f186 | [
"Apache-2.0"
]
| permissive | paullewallencom/android-978-1-7858-8959-2 | 92f4a5682d5b15fdb47ccf68c2e42385353d3449 | b42dc30a9b700ee29472d16a8a48b4e27ffe7e68 | refs/heads/main | 2023-02-05T22:28:14.449339 | 2020-12-30T07:37:15 | 2020-12-30T07:37:15 | 319,461,155 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 362 | java | package com.jwhh.bookdrawer;
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]"
]
| |
f1d9240d3c1a3aabb96b8de11e1b6b419fca4967 | eb86b8addbf670c5c200dc4377dc5ad1df52bc11 | /src/main/java/com/diploma/demo/archive/owner/repository/OwnerArchiveRepository.java | 6213716ee50f9350d9a4c255d7064e264ee1abf3 | []
| no_license | DiplomBSUIR2021/Diplom2021 | f2be2326703c46576a1f42195b63c1095c43feba | 61f7b228041f13d3c91dab7351916c4e00285a6e | refs/heads/master | 2023-06-02T14:35:48.682410 | 2021-06-19T22:54:36 | 2021-06-19T22:54:36 | 345,015,231 | 0 | 3 | null | 2021-06-19T22:54:36 | 2021-03-06T05:37:59 | Java | UTF-8 | Java | false | false | 394 | java | package com.diploma.demo.archive.owner.repository;
import com.diploma.demo.archive.abstraction.CommonRepository;
import com.diploma.demo.archive.owner.OwnerArchive;
import org.springframework.data.relational.core.mapping.Table;
import org.springframework.stereotype.Repository;
@Repository
@Table("owner_aud")
public interface OwnerArchiveRepository extends CommonRepository<OwnerArchive> {}
| [
"[email protected]"
]
| |
75f63ab9c834c119b6b6f11a9aa9701d077d837e | 64f65f3e74ee77139c2ddbaa529ac525aab9964e | /train-schedule-rest/src/main/java/com/trainschedule/springboot/controller/TrainController.java | bd3a818f82105d9c7e8481fba5115d4b2a3f9bc0 | []
| no_license | manisha2412/train-app | ae96b3966d66e98ee98379157cb6478d795cc028 | f0884f25379673d23451868ff8dad6e911531356 | refs/heads/master | 2023-01-31T12:36:36.689234 | 2020-12-14T12:41:49 | 2020-12-14T12:41:49 | 321,328,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,535 | java | package com.trainschedule.springboot.controller;
import java.text.ParseException;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import com.trainschedule.springboot.model.Train;
import com.trainschedule.springboot.service.TrainService;
@RestController
@CrossOrigin(origins = "http://localhost:3000")
public class TrainController {
@Autowired
private TrainService trainService;
@GetMapping("/trains")
public ResponseEntity<List<Train>> getAllTrain() {
return ResponseEntity.ok().body(trainService.getAllTrain());
}
@GetMapping("/trains/{id}")
public ResponseEntity<Train> getTrainById(@PathVariable long id) {
return ResponseEntity.ok().body(trainService.getTrainById(id));
}
@PostMapping("/trains")
public ResponseEntity<Train> createTrain(@RequestBody Train train) {
return ResponseEntity.ok().body(this.trainService.createTrain(train));
}
@PutMapping("/trains/{id}")
public ResponseEntity<Train> updateTrain(@PathVariable long id, @RequestBody Train train) throws ParseException {
train.setId(id);
return ResponseEntity.ok().body(this.trainService.updateTrain(train));
}
@DeleteMapping("/trains/{id}")
public HttpStatus deleteTrain(@PathVariable long id) {
this.trainService.deleteTrain(id);
return HttpStatus.OK;
}
}
| [
"[email protected]"
]
| |
c9a398626a5f0b065584e7b56035d7cf97e30af4 | 557b5caa874377d62f0f6c69c8f34d51b2ed23ea | /AMX-PAB/AMX-PAB-persistence/src/main/java/com/aeromexico/pab/entity/ContactoProveedorEstacion.java | e394ba1a1a6a1280803723b4cc75d15d270c043b | []
| no_license | amxsabsystem/Servicios_a_Bordo | 0637588b69f51100587b32b0b8e402096a7fabe3 | ff1b809bf9e1d40fcbfc69b22ffd6883c38feb22 | refs/heads/master | 2021-01-25T11:55:18.156033 | 2018-03-01T14:16:25 | 2018-03-01T14:16:25 | 123,440,854 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,587 | java | package com.aeromexico.pab.entity;
import java.util.List;
import java.util.Objects;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Embeddable;
import javax.persistence.Embeddable;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.EmbeddedId;
import javax.persistence.FetchType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.JoinTable;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
* Class for mapping JPA Entity of Table contacto_proveedor_estacion.
*
* @author Tracktopell::jpa-builder @see https://github.com/tracktopell/jpa-builder
*/
@Entity
@Table(name = "contacto_proveedor_estacion")
@NamedQueries({
@NamedQuery(name = "ContactoProveedorEstacion.findAll", query = "SELECT c FROM ContactoProveedorEstacion c")
, @NamedQuery(name = "ContactoProveedorEstacion.countAll", query = "SELECT COUNT(c) FROM ContactoProveedorEstacion c")
, @NamedQuery(name = "ContactoProveedorEstacion.findByIdContactoProveedorEstacion", query = "SELECT c FROM ContactoProveedorEstacion c WHERE c.idContactoProveedorEstacion = :idContactoProveedorEstacion")
, @NamedQuery(name = "ContactoProveedorEstacion.findByusuario", query = "SELECT c FROM ContactoProveedorEstacion c WHERE c.usuario = :usuario")
, @NamedQuery(name = "ContactoProveedorEstacion.findByNombre", query = "SELECT c FROM ContactoProveedorEstacion c WHERE c.nombre = :nombre")
, @NamedQuery(name = "ContactoProveedorEstacion.findByApellidoPaterno", query = "SELECT c FROM ContactoProveedorEstacion c WHERE c.apellidoPaterno = :apellidoPaterno")
, @NamedQuery(name = "ContactoProveedorEstacion.findByApellidoMaterno", query = "SELECT c FROM ContactoProveedorEstacion c WHERE c.apellidoMaterno = :apellidoMaterno")
, @NamedQuery(name = "ContactoProveedorEstacion.findByproveedor", query = "SELECT c FROM ContactoProveedorEstacion c WHERE c.proveedor = :proveedor")
, @NamedQuery(name = "ContactoProveedorEstacion.findByestacion", query = "SELECT c FROM ContactoProveedorEstacion c WHERE c.estacion = :estacion")
, @NamedQuery(name = "ContactoProveedorEstacion.findByproveedorEstacion", query = "SELECT c FROM ContactoProveedorEstacion c WHERE c.proveedorEstacion = :proveedorEstacion")
, @NamedQuery(name = "ContactoProveedorEstacion.findByTelefono", query = "SELECT c FROM ContactoProveedorEstacion c WHERE c.telefono = :telefono")
, @NamedQuery(name = "ContactoProveedorEstacion.findByExtension", query = "SELECT c FROM ContactoProveedorEstacion c WHERE c.extension = :extension")
, @NamedQuery(name = "ContactoProveedorEstacion.findByPuestoAreaEn", query = "SELECT c FROM ContactoProveedorEstacion c WHERE c.puestoAreaEn = :puestoAreaEn")
, @NamedQuery(name = "ContactoProveedorEstacion.findByPuestoAreaEs", query = "SELECT c FROM ContactoProveedorEstacion c WHERE c.puestoAreaEs = :puestoAreaEs")
, @NamedQuery(name = "ContactoProveedorEstacion.findByDirectorioPab", query = "SELECT c FROM ContactoProveedorEstacion c WHERE c.directorioPab = :directorioPab")
, @NamedQuery(name = "ContactoProveedorEstacion.findByStatus", query = "SELECT c FROM ContactoProveedorEstacion c WHERE c.status = :status")
, @NamedQuery(name = "ContactoProveedorEstacion.findByUsuarioCreo", query = "SELECT c FROM ContactoProveedorEstacion c WHERE c.usuarioCreo = :usuarioCreo")
, @NamedQuery(name = "ContactoProveedorEstacion.findByFechaCreo", query = "SELECT c FROM ContactoProveedorEstacion c WHERE c.fechaCreo = :fechaCreo")
, @NamedQuery(name = "ContactoProveedorEstacion.findByUsuarioModifico", query = "SELECT c FROM ContactoProveedorEstacion c WHERE c.usuarioModifico = :usuarioModifico")
, @NamedQuery(name = "ContactoProveedorEstacion.findByFechaModifico", query = "SELECT c FROM ContactoProveedorEstacion c WHERE c.fechaModifico = :fechaModifico")
})
public class ContactoProveedorEstacion
implements java.io.Serializable
, AuditableEntity
{
private static final long serialVersionUID = -760166127;
/**
* The 'id contacto proveedor estacion' Maps to COLUMN 'id_contacto_proveedor_estacion'
*/
@Id
@Column(name = "ID_CONTACTO_PROVEEDOR_ESTACION" , nullable=false )
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer idContactoProveedorEstacion;
/**
* The 'email usuario' Maps to COLUMN 'email_usuario'
*/
@JoinColumn(name = "EMAIL_USUARIO" , referencedColumnName = "EMAIL_USUARIO")
@ManyToOne(optional = true )
private Usuario usuario;
/**
* The 'nombre' Maps to COLUMN 'nombre'
*/
@Basic(optional = false)
@Column(name = "NOMBRE" , length=50, nullable=false)
private String nombre;
/**
* The 'apellido paterno' Maps to COLUMN 'apellido_paterno'
*/
@Basic(optional = false)
@Column(name = "APELLIDO_PATERNO" , length=50, nullable=false)
private String apellidoPaterno;
/**
* The 'apellido materno' Maps to COLUMN 'apellido_materno'
*/
@Basic(optional = false)
@Column(name = "APELLIDO_MATERNO" , length=50, nullable=false)
private String apellidoMaterno;
/**
* The 'clave proveedor' Maps to COLUMN 'clave_proveedor'
*/
@JoinColumn(name = "CLAVE_PROVEEDOR" , referencedColumnName = "CLAVE_PROVEEDOR")
@ManyToOne(optional = false )
private Proveedor proveedor;
/**
* The 'id estacion' Maps to COLUMN 'id_estacion'
*/
@JoinColumn(name = "ID_ESTACION" , referencedColumnName = "ID_ESTACION")
@ManyToOne(optional = false )
private Estacion estacion;
/**
* The 'id proveedor estacion' Maps to COLUMN 'id_proveedor_estacion'
*/
@JoinColumn(name = "ID_PROVEEDOR_ESTACION" , referencedColumnName = "ID_PROVEEDOR_ESTACION")
@ManyToOne(optional = false )
private ProveedorEstacion proveedorEstacion;
/**
* The 'telefono' Maps to COLUMN 'telefono'
*/
@Basic(optional = true)
@Column(name = "TELEFONO" , length=15, nullable=true)
private String telefono;
/**
* The 'extension' Maps to COLUMN 'extension'
*/
@Basic(optional = true)
@Column(name = "EXTENSION" , length=5, nullable=true)
private String extension;
/**
* The 'puesto area en' Maps to COLUMN 'puesto_area_en'
*/
@Basic(optional = true)
@Column(name = "PUESTO_AREA_EN" , length=150, nullable=true)
private String puestoAreaEn;
/**
* The 'puesto area es' Maps to COLUMN 'puesto_area_es'
*/
@Basic(optional = true)
@Column(name = "PUESTO_AREA_ES" , length=150, nullable=true)
private String puestoAreaEs;
/**
* The 'directorio pab' Maps to COLUMN 'directorio_pab'
*/
@Basic(optional = false)
@Column(name = "DIRECTORIO_PAB" , nullable=false)
private Short directorioPab;
/**
* The 'status' Maps to COLUMN 'status'
*/
@Basic(optional = false)
@Column(name = "STATUS" , nullable=false)
private Short status;
/**
* The 'usuario creo' Maps to COLUMN 'usuario_creo'
*/
@Basic(optional = false)
@Column(name = "USUARIO_CREO" , length=100, nullable=false)
private String usuarioCreo;
/**
* The 'fecha creo' Maps to COLUMN 'fecha_creo'
*/
@Basic(optional = false)
@Column(name = "FECHA_CREO" , nullable=false)
private java.sql.Timestamp fechaCreo;
/**
* The 'usuario modifico' Maps to COLUMN 'usuario_modifico'
*/
@Basic(optional = false)
@Column(name = "USUARIO_MODIFICO" , length=100, nullable=false)
private String usuarioModifico;
/**
* The 'fecha modifico' Maps to COLUMN 'fecha_modifico'
*/
@Basic(optional = false)
@Column(name = "FECHA_MODIFICO" , nullable=false)
private java.sql.Timestamp fechaModifico;
/**
* Map the relation to bitacora_comunicado table where has id_contacto_proveedor_estacion object mapped column of for this class.
*/
@OneToMany(cascade = CascadeType.ALL, mappedBy = "contactoProveedorEstacion")
private List<BitacoraComunicado> bitacoraComunicadoHasContactoProveedorEstacionList;
/**
* Map the relation to seguimiento table where has id_contacto_proveedor_estacion object mapped column of for this class.
*/
@OneToMany(cascade = CascadeType.ALL, mappedBy = "contactoProveedorEstacion")
private List<Seguimiento> seguimientoHasContactoProveedorEstacionList;
// =========================================================================
// =========================================================================
/**
* Default Constructor
*/
public ContactoProveedorEstacion() {
}
/**
* Getters and Setters
*/
public Integer getIdContactoProveedorEstacion() { return this.idContactoProveedorEstacion;}
public void setIdContactoProveedorEstacion(Integer v) { this.idContactoProveedorEstacion = v; }
public Usuario getUsuario(){ return this.usuario ; }
public void setUsuario(Usuario x){ this.usuario = x; }
public String getNombre() { return this.nombre;}
public void setNombre(String v) { this.nombre = v; }
public String getApellidoPaterno() { return this.apellidoPaterno;}
public void setApellidoPaterno(String v) { this.apellidoPaterno = v; }
public String getApellidoMaterno() { return this.apellidoMaterno;}
public void setApellidoMaterno(String v) { this.apellidoMaterno = v; }
public Proveedor getProveedor(){ return this.proveedor ; }
public void setProveedor(Proveedor x){ this.proveedor = x; }
public Estacion getEstacion(){ return this.estacion ; }
public void setEstacion(Estacion x){ this.estacion = x; }
public ProveedorEstacion getProveedorEstacion(){ return this.proveedorEstacion ; }
public void setProveedorEstacion(ProveedorEstacion x){ this.proveedorEstacion = x; }
public String getTelefono() { return this.telefono;}
public void setTelefono(String v) { this.telefono = v; }
public String getExtension() { return this.extension;}
public void setExtension(String v) { this.extension = v; }
public String getPuestoAreaEn() { return this.puestoAreaEn;}
public void setPuestoAreaEn(String v) { this.puestoAreaEn = v; }
public String getPuestoAreaEs() { return this.puestoAreaEs;}
public void setPuestoAreaEs(String v) { this.puestoAreaEs = v; }
public Short getDirectorioPab() { return this.directorioPab;}
public void setDirectorioPab(Short v) { this.directorioPab = v; }
public Short getStatus() { return this.status;}
public void setStatus(Short v) { this.status = v; }
public String getUsuarioCreo() { return this.usuarioCreo;}
public void setUsuarioCreo(String v) { this.usuarioCreo = v; }
public java.sql.Timestamp getFechaCreo() { return this.fechaCreo;}
public void setFechaCreo(java.sql.Timestamp v) { this.fechaCreo = v; }
public String getUsuarioModifico() { return this.usuarioModifico;}
public void setUsuarioModifico(String v) { this.usuarioModifico = v; }
public java.sql.Timestamp getFechaModifico() { return this.fechaModifico;}
public void setFechaModifico(java.sql.Timestamp v) { this.fechaModifico = v; }
// O2M <*>
public List<BitacoraComunicado> getBitacoraComunicadoHasContactoProveedorEstacionList(){ return this.bitacoraComunicadoHasContactoProveedorEstacionList; }
public void setBitacoraComunicadoHasContactoProveedorEstacionList(List<BitacoraComunicado> v){ this.bitacoraComunicadoHasContactoProveedorEstacionList = v; }
public List<Seguimiento> getSeguimientoHasContactoProveedorEstacionList(){ return this.seguimientoHasContactoProveedorEstacionList; }
public void setSeguimientoHasContactoProveedorEstacionList(List<Seguimiento> v){ this.seguimientoHasContactoProveedorEstacionList = v; }
// M2M <*>
@Override
public int hashCode() {
int hash = 0;
hash += String.valueOf(idContactoProveedorEstacion).hashCode();
hash += String.valueOf(usuario).hashCode();
hash += String.valueOf(nombre).hashCode();
hash += String.valueOf(apellidoPaterno).hashCode();
hash += String.valueOf(apellidoMaterno).hashCode();
hash += String.valueOf(proveedor).hashCode();
hash += String.valueOf(estacion).hashCode();
hash += String.valueOf(proveedorEstacion).hashCode();
hash += String.valueOf(telefono).hashCode();
hash += String.valueOf(extension).hashCode();
hash += String.valueOf(puestoAreaEn).hashCode();
hash += String.valueOf(puestoAreaEs).hashCode();
hash += String.valueOf(directorioPab).hashCode();
hash += String.valueOf(status).hashCode();
hash += String.valueOf(usuarioCreo).hashCode();
hash += String.valueOf(fechaCreo).hashCode();
hash += String.valueOf(usuarioModifico).hashCode();
hash += String.valueOf(fechaModifico).hashCode();
return hash;
}
@Override
public boolean equals(Object o){
if (this == o) {
return true;
}
if (o == null) {
return false;
}
if (getClass() != o.getClass()) {
return false;
}
if (!(o instanceof ContactoProveedorEstacion)) {
return false;
}
ContactoProveedorEstacion other = (ContactoProveedorEstacion ) o;
if (!Objects.equals(this.idContactoProveedorEstacion, other.idContactoProveedorEstacion)) { return false; }
if (!Objects.equals(this.usuario, other.usuario)) { return false; }
if (!Objects.equals(this.nombre, other.nombre)) { return false; }
if (!Objects.equals(this.apellidoPaterno, other.apellidoPaterno)) { return false; }
if (!Objects.equals(this.apellidoMaterno, other.apellidoMaterno)) { return false; }
if (!Objects.equals(this.proveedor, other.proveedor)) { return false; }
if (!Objects.equals(this.estacion, other.estacion)) { return false; }
if (!Objects.equals(this.proveedorEstacion, other.proveedorEstacion)) { return false; }
if (!Objects.equals(this.telefono, other.telefono)) { return false; }
if (!Objects.equals(this.extension, other.extension)) { return false; }
if (!Objects.equals(this.puestoAreaEn, other.puestoAreaEn)) { return false; }
if (!Objects.equals(this.puestoAreaEs, other.puestoAreaEs)) { return false; }
if (!Objects.equals(this.directorioPab, other.directorioPab)) { return false; }
if (!Objects.equals(this.status, other.status)) { return false; }
if (!Objects.equals(this.usuarioCreo, other.usuarioCreo)) { return false; }
if (!Objects.equals(this.fechaCreo, other.fechaCreo)) { return false; }
if (!Objects.equals(this.usuarioModifico, other.usuarioModifico)) { return false; }
if (!Objects.equals(this.fechaModifico, other.fechaModifico)) { return false; }
return true;
}
/**
* to-do override using commons
*/
public String toLargeString() {
StringBuilder sb=new StringBuilder();
sb.append("ContactoProveedorEstacion{");
sb.append("idContactoProveedorEstacion" ).append("=").append(idContactoProveedorEstacion).append("|");
sb.append("usuario" ).append("=").append(usuario).append("|");
sb.append("nombre" ).append("=").append(nombre).append("|");
sb.append("apellidoPaterno" ).append("=").append(apellidoPaterno).append("|");
sb.append("apellidoMaterno" ).append("=").append(apellidoMaterno).append("|");
sb.append("proveedor" ).append("=").append(proveedor).append("|");
sb.append("estacion" ).append("=").append(estacion).append("|");
sb.append("proveedorEstacion" ).append("=").append(proveedorEstacion).append("|");
sb.append("telefono" ).append("=").append(telefono).append("|");
sb.append("extension" ).append("=").append(extension).append("|");
sb.append("puestoAreaEn" ).append("=").append(puestoAreaEn).append("|");
sb.append("puestoAreaEs" ).append("=").append(puestoAreaEs).append("|");
sb.append("directorioPab" ).append("=").append(directorioPab).append("|");
sb.append("status" ).append("=").append(status).append("|");
sb.append("usuarioCreo" ).append("=").append(usuarioCreo).append("|");
sb.append("fechaCreo" ).append("=").append(fechaCreo).append("|");
sb.append("usuarioModifico" ).append("=").append(usuarioModifico).append("|");
sb.append("fechaModifico" ).append("=").append(fechaModifico).append("|");
//sb.append("serialVersionUID=").append(serialVersionUID).append("}");
sb.append("}");
return sb.toString();
}
@Override
public String toString() {
StringBuilder sb=new StringBuilder();
sb.append(" ").append(idContactoProveedorEstacion).append(" ");
return sb.toString().trim();
}
}
| [
"[email protected]"
]
| |
493d61c8437982d229e2de8d4c9e038f250d072e | 3037e75a1dccecf9dfc1901bddd0ffb764612121 | /app/src/main/java/com/project/searchproducts/presentation/favorite/FavoriteProductActivity.java | 2aec86ec29ee2e79fe8d533ca2379d038b5f8c30 | []
| no_license | gulbahorsangova/SearchProducts | 25d3ec4d05938fd87b8e3b9d7881427e0c2f9698 | 772f36849d0d10a748c2d66523647c8378c2c706 | refs/heads/main | 2023-06-12T16:19:59.218600 | 2021-07-05T09:43:17 | 2021-07-05T09:43:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,880 | java | package com.project.searchproducts.presentation.favorite;
import android.content.Intent;
import android.graphics.Rect;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.narify.netdetect.NetDetect;
import com.project.searchproducts.R;
import com.project.searchproducts.presentation.home.IOnClickListener;
import com.project.searchproducts.databinding.ActivityFavoriteProductBinding;
import com.project.searchproducts.domain.models.Product;
import com.project.searchproducts.domain.models.ProductFavorite;
import com.project.searchproducts.presentation.details.DetailsActivity;
import com.project.searchproducts.utils.Constants;
import com.project.searchproducts.utils.JSONUtils;
import java.util.List;
import dagger.hilt.android.AndroidEntryPoint;
import static com.project.searchproducts.utils.Helper.makeSnackBar;
@AndroidEntryPoint
public class FavoriteProductActivity extends AppCompatActivity implements
IOnCheckedFavorite,
IOnClickListener {
private ActivityFavoriteProductBinding binding;
private FavoriteProductAdapter adapter;
private FavoriteProductViewModel viewModel;
private List<ProductFavorite> productFavorites;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_favorite_product);
binding.setLifecycleOwner(this);
viewModel = new ViewModelProvider(this).get(FavoriteProductViewModel.class);
NetDetect.init(this);
initRecyclerView();
adapter.setOnCheckedFavorite(this);
adapter.setOnClickListener(this);
viewModel.getFavouriteProducts().observe(this, list -> {
productFavorites = list;
adapter.setProducts(list);
});
}
private void initRecyclerView() {
adapter = new FavoriteProductAdapter();
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
binding.recyclerViewFavorite.setLayoutManager(linearLayoutManager);
binding.recyclerViewFavorite.addItemDecoration(new RecyclerView.ItemDecoration() {
@Override
public void getItemOffsets(@NonNull Rect outRect,
@NonNull View view,
@NonNull RecyclerView parent,
@NonNull RecyclerView.State state) {
super.getItemOffsets(outRect, view, parent, state);
if (parent.getChildAdapterPosition(view) > 0) {
outRect.top = 30;
}
}
});
binding.recyclerViewFavorite.setAdapter(adapter);
}
@Override
public void onChecked(boolean isFavoriteMovie, int position) {
viewModel.deleteFavouriteProduct(productFavorites.get(position));
}
@Override
public void onClick(Product product) {
}
@Override
public void onClick(Product product, View view) {
NetDetect.check((isConnected -> {
if (!isConnected) {
makeSnackBar(view);
} else {
Intent intent = new Intent(FavoriteProductActivity.this, DetailsActivity.class);
String productJsonString = JSONUtils.getGsonParser().toJson(product);
intent.putExtra(Constants.INTENT_KEY, productJsonString);
startActivity(intent);
}
}));
}
} | [
"[email protected]"
]
| |
5fbcf7ba9b76f5c7499177b1cd2cd494a2a6ce3b | fef40dde950723cf6fc96f8aec64ed88d9c2a749 | /articles/app/src/main/java/com/example/articleActivity.java | 0fdad4fd12c94c7117d8f76046894e5cc823ed9b | []
| no_license | gyy1225/article | 730f81baf56a0d03fb716eac75e4f6ac37ecdf39 | 882e93d42432128f0d0d5860613c32db7d2fc054 | refs/heads/master | 2021-04-15T08:59:14.839942 | 2018-04-01T04:09:57 | 2018-04-01T04:09:57 | 126,618,665 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,439 | java | package com.example;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
public class articleActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_article);
Toolbar toolbar2 = (Toolbar) findViewById(R.id.toolbar2);
setSupportActionBar(toolbar2);
FloatingActionButton random = (FloatingActionButton) findViewById(R.id.random);
random.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
public boolean onCreateOptionsMenu(Menu menu){
getMenuInflater().inflate(R.menu.toolbar2,menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Toast.makeText(this,"成功下载文章到本地",Toast.LENGTH_SHORT).show();
return true;
}
}
| [
"[email protected]"
]
| |
caf050ceb5ef7316981b0bd14d0f87da1f3a930c | d68f00f53e3a23056d92e0d3156008160a3616a0 | /src/main/java/com/offcn/mail/TestHtmlMail.java | 710e8718ac63b0dde72247b0f268cbc6530b39a6 | []
| no_license | Aaronkan369/java5_01 | 9727d4abdc9a6d11a7cf38d92c81ae875e99e26a | 1d1e75af4d9e21ba5e1d5bb9f4b61fb93de0c57d | refs/heads/master | 2021-09-02T14:30:42.047940 | 2018-01-03T07:18:36 | 2018-01-03T07:18:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,613 | java | package com.offcn.mail;
import javax.mail.internet.MimeMessage;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.mail.javamail.MimeMessageHelper;
import com.offcn.utils.StringUtil;
public class TestHtmlMail {
@SuppressWarnings("resource")
public static void main(String[] args) {
//初始化Spring环境
ApplicationContext context = new ClassPathXmlApplicationContext("classpath:config/spring-mail.xml");
//获取mailSender邮件发送类
JavaMailSenderImpl mailSender = (JavaMailSenderImpl) context.getBean("mailSender");
MimeMessage message = mailSender.createMimeMessage();
try {
MimeMessageHelper helper = new MimeMessageHelper(message, true, "UTF-8");
helper.setFrom("[email protected]");
helper.setTo("[email protected]");
helper.setSubject("圣诞快乐");
String text = StringUtil.getStrByHtml("D:/JavaWebSoftWare/chart/new_file.html");
helper.setText(text,true);
ClassPathResource resource = new ClassPathResource("/1.png");
helper.addInline("Coupon", resource);
helper.addAttachment("1.png", resource);
mailSender.send(message);
System.out.println("带附件的Html邮件发送OK");
} catch (Exception e) {
System.out.println(e.getMessage());
System.out.println("带附件的Html邮件发送失败");
}
}
}
| [
"Administrator@8SZOSGKRF345UYD"
]
| Administrator@8SZOSGKRF345UYD |
71b8a09d92895d1ebcc15c7c6dd49703a61a9118 | 3f750d1e7d029ba972b9542f79ce102602f8354e | /SpringTx_anno/src/main/java/com/cn/dao/impl/AccountDaoImpl.java | 916d328872d6c3e8918a549dff153c2e25af700a | []
| no_license | StarPeng-lab/JavaPractice | 9cfee521a56ed04575cec4fe7d621cb6589e25a6 | a4cdd88d85ecebab8b7559aeb372fe9b57d73e12 | refs/heads/master | 2023-03-24T08:46:46.710783 | 2021-03-24T14:56:27 | 2021-03-24T14:56:27 | 305,132,449 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 658 | java | package com.cn.dao.impl;
import com.cn.dao.AccountDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
@Component("accountDao")
public class AccountDaoImpl implements AccountDao {
@Autowired
private JdbcTemplate template;
@Override
public void in(String inman, int money) {
template.update("update u set money = money + ? where name = ?",money,inman);
}
@Override
public void out(String outman, int money) {
template.update("update u set money = money - ? where name = ?",money,outman);
}
}
| [
"[email protected]"
]
| |
5c222093b4901928929f500273ab727e388e43ba | 194acb8bdb42ac8c472374a79904d0efb844f8a7 | /groot-galaxy/src/main/java/com/galaxy/groot/starter/HelloServiceImpl.java | 72f76307affb3c35550c522891f54766ecb17770 | []
| no_license | Robust20171222/spring-boot-galaxy | ba8ce61ce29b3c8e4efa73cd14312c6342856bd9 | 1e2499fb5a199e90edc06ff414949d4dfa65a938 | refs/heads/master | 2021-01-25T23:24:01.575946 | 2020-02-18T10:20:58 | 2020-02-18T10:20:58 | 243,224,943 | 1 | 1 | null | 2020-02-26T09:38:18 | 2020-02-26T09:38:17 | null | UTF-8 | Java | false | false | 134 | java | package com.galaxy.groot.starter;
/**
* Created by wangpeng
* Date: 2018/6/11
* Time: 10:26
*/
public class HelloServiceImpl {
}
| [
"[email protected]"
]
| |
be102fbb29354a4bb747f2f4a117bea56fd8ccab | 939bc9b579671de84fb6b5bd047db57b3d186aca | /jdk.internal.vm.compiler/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/asm/CompilationResultBuilder.java | b2c31b679ec8332c66c40fefb2bebb6555b00cde | []
| no_license | lc274534565/jdk11-rm | 509702ceacfe54deca4f688b389d836eb5021a17 | 1658e7d9e173f34313d2e5766f4f7feef67736e8 | refs/heads/main | 2023-01-24T07:11:16.084577 | 2020-11-16T14:21:37 | 2020-11-16T14:21:37 | 313,315,578 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 21,162 | java | /*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package org.graalvm.compiler.lir.asm;
import static jdk.vm.ci.code.ValueUtil.asStackSlot;
import static jdk.vm.ci.code.ValueUtil.isStackSlot;
import static org.graalvm.compiler.lir.LIRValueUtil.asJavaConstant;
import static org.graalvm.compiler.lir.LIRValueUtil.isJavaConstant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;
import jdk.internal.vm.compiler.collections.EconomicMap;
import jdk.internal.vm.compiler.collections.Equivalence;
import org.graalvm.compiler.asm.AbstractAddress;
import org.graalvm.compiler.asm.Assembler;
import org.graalvm.compiler.code.CompilationResult;
import org.graalvm.compiler.code.CompilationResult.CodeAnnotation;
import org.graalvm.compiler.code.DataSection.Data;
import org.graalvm.compiler.code.DataSection.RawData;
import org.graalvm.compiler.core.common.NumUtil;
import org.graalvm.compiler.core.common.cfg.AbstractBlockBase;
import org.graalvm.compiler.core.common.spi.ForeignCallsProvider;
import org.graalvm.compiler.core.common.type.DataPointerConstant;
import org.graalvm.compiler.debug.Assertions;
import org.graalvm.compiler.debug.DebugContext;
import org.graalvm.compiler.debug.GraalError;
import org.graalvm.compiler.graph.NodeSourcePosition;
import org.graalvm.compiler.lir.LIR;
import org.graalvm.compiler.lir.LIRFrameState;
import org.graalvm.compiler.lir.LIRInstruction;
import org.graalvm.compiler.lir.LabelRef;
import org.graalvm.compiler.lir.framemap.FrameMap;
import org.graalvm.compiler.options.Option;
import org.graalvm.compiler.options.OptionKey;
import org.graalvm.compiler.options.OptionType;
import org.graalvm.compiler.options.OptionValues;
import jdk.vm.ci.code.CodeCacheProvider;
import jdk.vm.ci.code.DebugInfo;
import jdk.vm.ci.code.Register;
import jdk.vm.ci.code.StackSlot;
import jdk.vm.ci.code.TargetDescription;
import jdk.vm.ci.code.site.ConstantReference;
import jdk.vm.ci.code.site.DataSectionReference;
import jdk.vm.ci.code.site.InfopointReason;
import jdk.vm.ci.code.site.Mark;
import jdk.vm.ci.meta.Constant;
import jdk.vm.ci.meta.InvokeTarget;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.VMConstant;
import jdk.vm.ci.meta.Value;
/**
* Fills in a {@link CompilationResult} as its code is being assembled.
*
* @see CompilationResultBuilderFactory
*/
public class CompilationResultBuilder {
public static class Options {
@Option(help = "Include the LIR as comments with the final assembly.", type = OptionType.Debug) //
public static final OptionKey<Boolean> PrintLIRWithAssembly = new OptionKey<>(false);
}
private static class ExceptionInfo {
public final int codeOffset;
public final LabelRef exceptionEdge;
ExceptionInfo(int pcOffset, LabelRef exceptionEdge) {
this.codeOffset = pcOffset;
this.exceptionEdge = exceptionEdge;
}
}
/**
* Wrapper for a code annotation that was produced by the {@link Assembler}.
*/
public static final class AssemblerAnnotation extends CodeAnnotation {
public final Assembler.CodeAnnotation assemblerCodeAnnotation;
public AssemblerAnnotation(Assembler.CodeAnnotation assemblerCodeAnnotation) {
super(assemblerCodeAnnotation.instructionPosition);
this.assemblerCodeAnnotation = assemblerCodeAnnotation;
}
@Override
public boolean equals(Object obj) {
return this == obj;
}
@Override
public String toString() {
return assemblerCodeAnnotation.toString();
}
}
public final Assembler asm;
public final DataBuilder dataBuilder;
public final CompilationResult compilationResult;
public final Register nullRegister;
public final TargetDescription target;
public final CodeCacheProvider codeCache;
public final ForeignCallsProvider foreignCalls;
public final FrameMap frameMap;
/**
* The LIR for which code is being generated.
*/
protected LIR lir;
/**
* The index of the block currently being emitted.
*/
protected int currentBlockIndex;
/**
* The object that emits code for managing a method's frame.
*/
public final FrameContext frameContext;
private List<ExceptionInfo> exceptionInfoList;
private final OptionValues options;
private final DebugContext debug;
private final EconomicMap<Constant, Data> dataCache;
private Consumer<LIRInstruction> beforeOp;
private Consumer<LIRInstruction> afterOp;
public final boolean mustReplaceWithNullRegister(JavaConstant nullConstant) {
return !nullRegister.equals(Register.None) && JavaConstant.NULL_POINTER.equals(nullConstant);
}
public CompilationResultBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, DataBuilder dataBuilder, FrameContext frameContext,
OptionValues options, DebugContext debug, CompilationResult compilationResult, Register nullRegister) {
this(codeCache, foreignCalls, frameMap, asm, dataBuilder, frameContext, options, debug, compilationResult, nullRegister, EconomicMap.create(Equivalence.DEFAULT));
}
public CompilationResultBuilder(CodeCacheProvider codeCache, ForeignCallsProvider foreignCalls, FrameMap frameMap, Assembler asm, DataBuilder dataBuilder, FrameContext frameContext,
OptionValues options, DebugContext debug, CompilationResult compilationResult, Register nullRegister, EconomicMap<Constant, Data> dataCache) {
this.target = codeCache.getTarget();
this.codeCache = codeCache;
this.foreignCalls = foreignCalls;
this.frameMap = frameMap;
this.asm = asm;
this.dataBuilder = dataBuilder;
this.compilationResult = compilationResult;
this.nullRegister = nullRegister;
this.frameContext = frameContext;
this.options = options;
this.debug = debug;
assert frameContext != null;
this.dataCache = dataCache;
if (dataBuilder.needDetailedPatchingInformation() || Assertions.assertionsEnabled()) {
/*
* Always enabled in debug mode, even when the VM does not request detailed information,
* to increase test coverage.
*/
asm.setCodePatchingAnnotationConsumer(assemblerCodeAnnotation -> compilationResult.addAnnotation(new AssemblerAnnotation(assemblerCodeAnnotation)));
}
}
public void setTotalFrameSize(int frameSize) {
compilationResult.setTotalFrameSize(frameSize);
}
public void setMaxInterpreterFrameSize(int maxInterpreterFrameSize) {
compilationResult.setMaxInterpreterFrameSize(maxInterpreterFrameSize);
}
public Mark recordMark(Object id) {
return compilationResult.recordMark(asm.position(), id);
}
public void blockComment(String s) {
compilationResult.addAnnotation(new CompilationResult.CodeComment(asm.position(), s));
}
/**
* Sets the {@linkplain CompilationResult#setTargetCode(byte[], int) code} and
* {@linkplain CompilationResult#recordExceptionHandler(int, int) exception handler} fields of
* the compilation result and then {@linkplain #closeCompilationResult() closes} it.
*/
public void finish() {
int position = asm.position();
compilationResult.setTargetCode(asm.close(false), position);
// Record exception handlers if they exist
if (exceptionInfoList != null) {
for (ExceptionInfo ei : exceptionInfoList) {
int codeOffset = ei.codeOffset;
compilationResult.recordExceptionHandler(codeOffset, ei.exceptionEdge.label().position());
}
}
closeCompilationResult();
}
/**
* Calls {@link CompilationResult#close()} on {@link #compilationResult}.
*/
protected void closeCompilationResult() {
compilationResult.close();
}
public void recordExceptionHandlers(int pcOffset, LIRFrameState info) {
if (info != null) {
if (info.exceptionEdge != null) {
if (exceptionInfoList == null) {
exceptionInfoList = new ArrayList<>(4);
}
exceptionInfoList.add(new ExceptionInfo(pcOffset, info.exceptionEdge));
}
}
}
public void recordImplicitException(int pcOffset, LIRFrameState info) {
compilationResult.recordInfopoint(pcOffset, info.debugInfo(), InfopointReason.IMPLICIT_EXCEPTION);
assert info.exceptionEdge == null;
}
public void recordDirectCall(int posBefore, int posAfter, InvokeTarget callTarget, LIRFrameState info) {
DebugInfo debugInfo = info != null ? info.debugInfo() : null;
compilationResult.recordCall(posBefore, posAfter - posBefore, callTarget, debugInfo, true);
}
public void recordIndirectCall(int posBefore, int posAfter, InvokeTarget callTarget, LIRFrameState info) {
DebugInfo debugInfo = info != null ? info.debugInfo() : null;
compilationResult.recordCall(posBefore, posAfter - posBefore, callTarget, debugInfo, false);
}
public void recordInfopoint(int pos, LIRFrameState info, InfopointReason reason) {
// infopoints always need debug info
DebugInfo debugInfo = info.debugInfo();
recordInfopoint(pos, debugInfo, reason);
}
public void recordInfopoint(int pos, DebugInfo debugInfo, InfopointReason reason) {
compilationResult.recordInfopoint(pos, debugInfo, reason);
}
public void recordSourceMapping(int pcOffset, int endPcOffset, NodeSourcePosition sourcePosition) {
compilationResult.recordSourceMapping(pcOffset, endPcOffset, sourcePosition);
}
public void recordInlineDataInCode(Constant data) {
assert data != null;
int pos = asm.position();
debug.log("Inline data in code: pos = %d, data = %s", pos, data);
if (data instanceof VMConstant) {
compilationResult.recordDataPatch(pos, new ConstantReference((VMConstant) data));
}
}
public void recordInlineDataInCodeWithNote(Constant data, Object note) {
assert data != null;
int pos = asm.position();
debug.log("Inline data in code: pos = %d, data = %s, note = %s", pos, data, note);
if (data instanceof VMConstant) {
compilationResult.recordDataPatchWithNote(pos, new ConstantReference((VMConstant) data), note);
}
}
public AbstractAddress recordDataSectionReference(Data data) {
assert data != null;
DataSectionReference reference = compilationResult.getDataSection().insertData(data);
int instructionStart = asm.position();
compilationResult.recordDataPatch(instructionStart, reference);
return asm.getPlaceholder(instructionStart);
}
public AbstractAddress recordDataReferenceInCode(DataPointerConstant constant) {
return recordDataReferenceInCode(constant, constant.getAlignment());
}
public AbstractAddress recordDataReferenceInCode(Constant constant, int alignment) {
assert constant != null;
debug.log("Constant reference in code: pos = %d, data = %s", asm.position(), constant);
Data data = createDataItem(constant);
data.updateAlignment(alignment);
return recordDataSectionReference(data);
}
public AbstractAddress recordDataReferenceInCode(Data data, int alignment) {
assert data != null;
data.updateAlignment(alignment);
return recordDataSectionReference(data);
}
public Data createDataItem(Constant constant) {
Data data = dataCache.get(constant);
if (data == null) {
data = dataBuilder.createDataItem(constant);
dataCache.put(constant, data);
}
return data;
}
public AbstractAddress recordDataReferenceInCode(byte[] data, int alignment) {
assert data != null;
if (debug.isLogEnabled()) {
debug.log("Data reference in code: pos = %d, data = %s", asm.position(), Arrays.toString(data));
}
return recordDataSectionReference(new RawData(data, alignment));
}
/**
* Notifies this object of a branch instruction at offset {@code pcOffset} in the code.
*
* @param isNegated negation status of the branch's condition.
*/
@SuppressWarnings("unused")
public void recordBranch(int pcOffset, boolean isNegated) {
}
/**
* Notifies this object of a call instruction belonging to an INVOKEVIRTUAL or INVOKEINTERFACE
* at offset {@code pcOffset} in the code.
*
* @param nodeSourcePosition source position of the corresponding invoke.
*/
@SuppressWarnings("unused")
public void recordInvokeVirtualOrInterfaceCallOp(int pcOffset, NodeSourcePosition nodeSourcePosition) {
}
/**
* Notifies this object of a call instruction belonging to an INLINE_INVOKE at offset
* {@code pcOffset} in the code.
*
* @param nodeSourcePosition source position of the corresponding invoke.
*/
@SuppressWarnings("unused")
public void recordInlineInvokeCallOp(int pcOffset, NodeSourcePosition nodeSourcePosition) {
}
/**
* Returns the integer value of any constant that can be represented by a 32-bit integer value,
* including long constants that fit into the 32-bit range.
*/
public int asIntConst(Value value) {
assert isJavaConstant(value) && asJavaConstant(value).getJavaKind().isNumericInteger();
JavaConstant constant = asJavaConstant(value);
long c = constant.asLong();
if (!NumUtil.isInt(c)) {
throw GraalError.shouldNotReachHere();
}
return (int) c;
}
/**
* Returns the float value of any constant that can be represented by a 32-bit float value.
*/
public float asFloatConst(Value value) {
assert isJavaConstant(value) && asJavaConstant(value).getJavaKind() == JavaKind.Float;
JavaConstant constant = asJavaConstant(value);
return constant.asFloat();
}
/**
* Returns the long value of any constant that can be represented by a 64-bit long value.
*/
public long asLongConst(Value value) {
assert isJavaConstant(value) && asJavaConstant(value).getJavaKind() == JavaKind.Long;
JavaConstant constant = asJavaConstant(value);
return constant.asLong();
}
/**
* Returns the double value of any constant that can be represented by a 64-bit float value.
*/
public double asDoubleConst(Value value) {
assert isJavaConstant(value) && asJavaConstant(value).getJavaKind() == JavaKind.Double;
JavaConstant constant = asJavaConstant(value);
return constant.asDouble();
}
/**
* Returns the address of a float constant that is embedded as a data reference into the code.
*/
public AbstractAddress asFloatConstRef(JavaConstant value) {
return asFloatConstRef(value, 4);
}
public AbstractAddress asFloatConstRef(JavaConstant value, int alignment) {
assert value.getJavaKind() == JavaKind.Float;
return recordDataReferenceInCode(value, alignment);
}
/**
* Returns the address of a double constant that is embedded as a data reference into the code.
*/
public AbstractAddress asDoubleConstRef(JavaConstant value) {
return asDoubleConstRef(value, 8);
}
public AbstractAddress asDoubleConstRef(JavaConstant value, int alignment) {
assert value.getJavaKind() == JavaKind.Double;
return recordDataReferenceInCode(value, alignment);
}
/**
* Returns the address of a long constant that is embedded as a data reference into the code.
*/
public AbstractAddress asLongConstRef(JavaConstant value) {
assert value.getJavaKind() == JavaKind.Long;
return recordDataReferenceInCode(value, 8);
}
/**
* Returns the address of an object constant that is embedded as a data reference into the code.
*/
public AbstractAddress asObjectConstRef(JavaConstant value) {
assert value.getJavaKind() == JavaKind.Object;
return recordDataReferenceInCode(value, 8);
}
public AbstractAddress asByteAddr(Value value) {
assert value.getPlatformKind().getSizeInBytes() >= JavaKind.Byte.getByteCount();
return asAddress(value);
}
public AbstractAddress asShortAddr(Value value) {
assert value.getPlatformKind().getSizeInBytes() >= JavaKind.Short.getByteCount();
return asAddress(value);
}
public AbstractAddress asIntAddr(Value value) {
assert value.getPlatformKind().getSizeInBytes() >= JavaKind.Int.getByteCount();
return asAddress(value);
}
public AbstractAddress asLongAddr(Value value) {
assert value.getPlatformKind().getSizeInBytes() >= JavaKind.Long.getByteCount();
return asAddress(value);
}
public AbstractAddress asFloatAddr(Value value) {
assert value.getPlatformKind().getSizeInBytes() >= JavaKind.Float.getByteCount();
return asAddress(value);
}
public AbstractAddress asDoubleAddr(Value value) {
assert value.getPlatformKind().getSizeInBytes() >= JavaKind.Double.getByteCount();
return asAddress(value);
}
public AbstractAddress asAddress(Value value) {
assert isStackSlot(value);
StackSlot slot = asStackSlot(value);
return asm.makeAddress(frameMap.getRegisterConfig().getFrameRegister(), frameMap.offsetForStackSlot(slot));
}
/**
* Determines if a given edge from the block currently being emitted goes to its lexical
* successor.
*/
public boolean isSuccessorEdge(LabelRef edge) {
assert lir != null;
AbstractBlockBase<?>[] order = lir.codeEmittingOrder();
assert order[currentBlockIndex] == edge.getSourceBlock();
AbstractBlockBase<?> nextBlock = LIR.getNextBlock(order, currentBlockIndex);
return nextBlock == edge.getTargetBlock();
}
/**
* Emits code for {@code lir} in its {@linkplain LIR#codeEmittingOrder() code emitting order}.
*/
public void emit(@SuppressWarnings("hiding") LIR lir) {
assert this.lir == null;
assert currentBlockIndex == 0;
this.lir = lir;
this.currentBlockIndex = 0;
frameContext.enter(this);
for (AbstractBlockBase<?> b : lir.codeEmittingOrder()) {
assert (b == null && lir.codeEmittingOrder()[currentBlockIndex] == null) || lir.codeEmittingOrder()[currentBlockIndex].equals(b);
emitBlock(b);
currentBlockIndex++;
}
this.lir = null;
this.currentBlockIndex = 0;
}
private void emitBlock(AbstractBlockBase<?> block) {
if (block == null) {
return;
}
boolean emitComment = debug.isDumpEnabled(DebugContext.BASIC_LEVEL) || Options.PrintLIRWithAssembly.getValue(getOptions());
if (emitComment) {
blockComment(String.format("block B%d %s", block.getId(), block.getLoop()));
}
for (LIRInstruction op : lir.getLIRforBlock(block)) {
if (emitComment) {
blockComment(String.format("%d %s", op.id(), op));
}
try {
if (beforeOp != null) {
beforeOp.accept(op);
}
emitOp(this, op);
if (afterOp != null) {
afterOp.accept(op);
}
} catch (GraalError e) {
throw e.addContext("lir instruction", block + "@" + op.id() + " " + op.getClass().getName() + " " + op + "\n" + Arrays.toString(lir.codeEmittingOrder()));
}
}
}
private static void emitOp(CompilationResultBuilder crb, LIRInstruction op) {
try {
int start = crb.asm.position();
op.emitCode(crb);
if (op.getPosition() != null) {
crb.recordSourceMapping(start, crb.asm.position(), op.getPosition());
}
} catch (AssertionError t) {
throw new GraalError(t);
} catch (RuntimeException t) {
throw new GraalError(t);
}
}
public void resetForEmittingCode() {
asm.reset();
compilationResult.resetForEmittingCode();
if (exceptionInfoList != null) {
exceptionInfoList.clear();
}
if (dataCache != null) {
dataCache.clear();
}
}
public void setOpCallback(Consumer<LIRInstruction> beforeOp, Consumer<LIRInstruction> afterOp) {
this.beforeOp = beforeOp;
this.afterOp = afterOp;
}
public OptionValues getOptions() {
return options;
}
}
| [
"[email protected]"
]
| |
e69ea8d793e4c3306aa87936ae6dd1139c61b0c2 | fb15dd9ee95f023da375eb04217dcd6683eb009e | /src/leetcode/No151.java | a0a0e5f64c41f2483f4c17f2c0c81c447e370724 | []
| no_license | wxcchdStar/arithmetic_primary | a1196d8f790baea1c7868be770221035567e06df | 261391f58cd57600ff6ea9207229b15eda9c2ce3 | refs/heads/master | 2021-01-10T01:54:12.734340 | 2020-05-08T04:39:48 | 2020-05-08T04:39:48 | 36,914,847 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 667 | java | package leetcode;
/**
* 翻转字符串
*/
public class No151 {
public static void main(String[] args) {
System.out.println(reverseWords("the sky is blue"));
System.out.println(reverseWords(" hello world! "));
}
public static String reverseWords(String s) {
StringBuilder result = new StringBuilder();
int j = s.length();
for (int i = s.length() - 1; i >= 0; i--) {
if (s.charAt(i) == ' ') {
j = i;
} else if (i == 0 || s.charAt(i - 1) == ' ') {
if (result.length() != 0) {
result.append(" ");
}
result.append(s.substring(i, j));
}
}
return result.toString();
}
}
| [
"[email protected]"
]
| |
1f262f6fd1b0cbe0f1432c1d87e2cdb78db05491 | 3f4b80eb20d47a8fe3e303bd715dfcf32953cdf9 | /src/main/java/orb/rmi_corba/idl/DatabaseHelper.java | 8075ff5fac593066c06f3877b2cb8dfa8c76fe98 | []
| no_license | olya-chuchuk/DBMS | 97dfafe24dd892eae76ba8c3c084ad37e5caf952 | 1ebf0cca0f7d827ae35ea49ff8d1d45b9022c2c5 | refs/heads/master | 2021-07-22T21:07:16.522608 | 2017-10-31T12:32:17 | 2017-10-31T12:32:17 | 103,455,020 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,271 | java | package orb.rmi_corba.idl;
/**
* orb/rmi_corba/DatabaseHelper.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from orb/rmi_corba/Database.idl
* Monday, October 30, 2017 at 7:14:54 PM Eastern European Standard Time
*/
abstract public class DatabaseHelper
{
private static String _id = "RMI:orb.rmi_corba.Database:0000000000000000";
public static void insert (org.omg.CORBA.Any a, Database that)
{
org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
a.type (type ());
write (out, that);
a.read_value (out.create_input_stream (), type ());
}
public static Database extract (org.omg.CORBA.Any a)
{
return read (a.create_input_stream ());
}
private static org.omg.CORBA.TypeCode __typeCode = null;
synchronized public static org.omg.CORBA.TypeCode type ()
{
if (__typeCode == null)
{
__typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (DatabaseHelper.id (), "Database");
}
return __typeCode;
}
public static String id ()
{
return _id;
}
public static Database read (org.omg.CORBA.portable.InputStream istream)
{
return narrow (istream.read_Object (_DatabaseStub.class));
}
public static void write (org.omg.CORBA.portable.OutputStream ostream, Database value)
{
ostream.write_Object ((org.omg.CORBA.Object) value);
}
public static Database narrow (org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
else if (obj instanceof Database)
return (Database)obj;
else if (!obj._is_a (id ()))
throw new org.omg.CORBA.BAD_PARAM ();
else
{
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
_DatabaseStub stub = new _DatabaseStub();
stub._set_delegate(delegate);
return stub;
}
}
public static Database unchecked_narrow (org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
else if (obj instanceof Database)
return (Database)obj;
else
{
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
_DatabaseStub stub = new _DatabaseStub();
stub._set_delegate(delegate);
return stub;
}
}
}
| [
"[email protected]"
]
| |
d06a96620309dacede294c4271be3ef46326f236 | 981f7ae13c9ffbc79f240a926e745f9f47a671b7 | /src/main/java/me/study/jpa/chap11/Member.java | 52b8e19ee48063a1649a8105b911c5ca9a338f1c | []
| no_license | jsyang-dev/study-jpa | 367229fbdabd2dff513b8670fad831bdab9954ab | 9cc82573044484585336a3c0e4ffcd61af744a1c | refs/heads/master | 2023-07-27T04:16:08.761169 | 2022-01-22T08:25:13 | 2022-01-22T08:25:13 | 248,248,065 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 746 | java | package me.study.jpa.chap11;
import javax.persistence.*;
//@Entity
public class Member extends BaseEntity {
@Id
@GeneratedValue
@Column(name = "MEMBER_ID")
private Long id;
@Column(name = "USERNAME")
private String username;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "TEAM_ID")
private Team team;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public Team getTeam() {
return team;
}
public void setTeam(Team team) {
this.team = team;
}
}
| [
"[email protected]"
]
| |
fcc6b52629539a23aef0920eca1d495bd73fc286 | e2f1b18cd6ca38adc2e286354e01cbe4d4423fd9 | /src/com/javarush/test/level24/lesson02/home01/UnsupportedInterfaceMarkerException.java | 4deb3ab16ade7c67512015c67cc347b1e857db64 | []
| no_license | Polurival/JRHW | 092ab6d034d6e46dd99d57b67910ca4a7749f602 | 6f08a005d5b444f6ad00df80aa0eac645b662831 | refs/heads/master | 2020-04-10T10:12:38.467016 | 2016-05-09T11:47:33 | 2016-05-09T11:47:33 | 50,867,434 | 7 | 14 | null | null | null | null | UTF-8 | Java | false | false | 173 | java | package com.javarush.test.level24.lesson02.home01;
/**
* Created by jpolshchikov on 22.09.2015.
*/
public class UnsupportedInterfaceMarkerException extends Exception
{
}
| [
"[email protected]"
]
| |
ce8b00efb19cbf2eab412fa7a51e775560804862 | d60e287543a95a20350c2caeabafbec517cabe75 | /LACCPlus/Hadoop/2782_1.java | 0bbd07be6b67b0b6b518abbab2a78688764ccec9 | [
"MIT"
]
| permissive | sgholamian/log-aware-clone-detection | 242067df2db6fd056f8d917cfbc143615c558b2c | 9993cb081c420413c231d1807bfff342c39aa69a | refs/heads/main | 2023-07-20T09:32:19.757643 | 2021-08-27T15:02:50 | 2021-08-27T15:02:50 | 337,837,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 861 | java | //,temp,FsVolumeList.java,406,422,temp,FsVolumeList.java,196,213
//,3
public class xxx {
public void run() {
try (FsVolumeReference ref = v.obtainReference()) {
FsDatasetImpl.LOG.info("Scanning block pool " + bpid +
" on volume " + v + "...");
long startTime = Time.monotonicNow();
v.addBlockPool(bpid, conf);
long timeTaken = Time.monotonicNow() - startTime;
FsDatasetImpl.LOG.info("Time taken to scan block pool " + bpid +
" on " + v + ": " + timeTaken + "ms");
} catch (ClosedChannelException e) {
// ignore.
} catch (IOException ioe) {
FsDatasetImpl.LOG.info("Caught exception while scanning " + v +
". Will throw later.", ioe);
exceptions.add(ioe);
}
}
}; | [
"[email protected]"
]
| |
577725c492334bffa85573503e9a85398f3539a0 | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/MATH-58b-6-12-MOEAD-WeightedSum:TestLen:CallDiversity/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizer_ESTest_scaffolding.java | ab38ef59a83a1d7df910ef29a512a43f7cb9fa0d | []
| no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 476 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Wed Apr 08 09:33:07 UTC 2020
*/
package org.apache.commons.math.optimization.general;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class LevenbergMarquardtOptimizer_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"[email protected]"
]
| |
946d8bcc7096a9134bf27c3c33a6d7d25981b6c7 | 5712ce120a179b7ece14d95c71a53b78aab02ca6 | /modelo/alumno.java | 26f168b61a633917d40cbec522b5f671cd843f35 | []
| no_license | Jaminito/RepasoJava | ce6e597e8832ba362e8dc7fdbaf187014a54e113 | 185663b5a083392c833772bb21ebb53a9786c990 | refs/heads/master | 2022-11-16T21:30:53.446817 | 2020-07-16T15:59:12 | 2020-07-16T15:59:12 | 280,198,319 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,434 | java | package com.company.modelo;
import java.util.Calendar;
import java.util.Date;
public class alumno {
private String nombre;
private String apellidos;
private Date nacimiento;
private String dni;
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getApellidos() {
return apellidos;
}
public void setApellidos(String apellidos) {
this.apellidos = apellidos;
}
public Date getNacimiento() {
return nacimiento;
}
public void setNacimiento(Date nacimiento) {
this.nacimiento = nacimiento;
}
public String getDni() {
return dni;
}
public void setDni(String dni) {
this.dni = dni;
}
public alumno(String nombre, String apellidos, Date nacimiento, String dni) {
this.nombre = nombre;
this.apellidos = apellidos;
this.nacimiento = nacimiento;
this.dni = dni;
}
@Override
public String toString() {
return "alumno{" +
"nombre='" + nombre + '\'' +
", apellidos='" + apellidos + '\'' +
", nacimiento=" + nacimiento +
", dni='" + dni + '\'' +
'}';
}
public int getEdad() {
Calendar calendar = Calendar.getInstance();
calendar.setTime(this.nacimiento);
Date actual = new Date();
Calendar calenActu = Calendar.getInstance();
calenActu.setTime(actual);
if ((calendar.get(Calendar.MONTH)) > calenActu.get(Calendar.MONTH) ) /*No ha cumplido */{
int edad = calenActu.get(Calendar.YEAR) - (calendar.get(Calendar.YEAR)) -1 ;
return edad;
} else if(calenActu.get(Calendar.MONTH) == (calendar.get(Calendar.MONTH)))/*No se sabe */{
if (calenActu.get(Calendar.DAY_OF_MONTH) > (calendar.get(Calendar.DAY_OF_MONTH)))/*No ha cumplido */ {
int edad = calenActu.get(Calendar.YEAR) - (calendar.get(Calendar.YEAR)) - 1;
return edad;
}else {
int edad = calenActu.get(Calendar.YEAR) - (calendar.get(Calendar.YEAR))/*Si cumplió */;
return edad;
}
}else {
int edad = calenActu.get(Calendar.YEAR) - (calendar.get(Calendar.YEAR)) /* Si cumplió*/;
return edad;
}
}
}
| [
"[email protected]"
]
| |
3d2fc64efc9b52b41f820da41e7c1e027851f0a0 | 7cd23dd5477c6e971ec6071a70daea5e9b4732be | /src/main/java/com/hry/enums/EnvEnum.java | 0690b5ba4848735630a6845a6d37ede0397ea1ba | []
| no_license | lishanghan/easyAutoTesting | e1f90f086b981a4bb03d4192524039768626c959 | fc61f9ffe187010c24e918ec85975349e7da0681 | refs/heads/master | 2022-06-29T11:35:24.730097 | 2020-11-06T02:41:36 | 2020-11-06T02:41:36 | 174,494,793 | 1 | 1 | null | 2022-06-21T00:58:39 | 2019-03-08T08:05:23 | JavaScript | UTF-8 | Java | false | false | 1,362 | java | package com.hry.enums;
/**
* 测试环境枚举
*/
public enum EnvEnum {
/*ENV_CS1(1, "CS1", "测试1环境"),//测试1
ENV_CS2(2, "CS2", "测试2环境"),//测试2
ENV_CS3(3, "CS3", "测试3环境"),//测试3
ENV_CS4(4, "CS4", "测试4环境"),//测试4
ENV_ZSC(5, "ZSC", "准生产环境");//准生产
private int id;
private String value;
private String desc;
EnvEnum(int id, String value, String desc) {
this.id = id;
this.value = value;
this.desc = desc;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public static String getValue(int id) {
for (EnvEnum e : EnvEnum.values()) {
if (e.getId() == id) {
return e.getValue();
}
}
return null;
}
public static Integer getId(String value) {
for (EnvEnum e : EnvEnum.values()) {
if (e.getValue().equalsIgnoreCase(value)) {
return e.getId();
}
}
return null;
}*/
}
| [
"[email protected]"
]
| |
c56ff68f8f9af0c299abc0725032810922890b1e | 82b5c729c517b07bac5dd852584274f269cb9998 | /task 1/seleniumq/src/main/java/seleniumq/automation/core/runtime/helper/logger/SummaryLogger.java | d5edfad4ecde0d9916cdd7c73ef783b8bdcca62b | []
| no_license | s1n7ax/voiceiq-assignment | 9b029b8f156b9576d691d81fe746033aa4e653aa | 8fa7a31db53c8e6bc0bf3ed4afd5aadfc3fa13c7 | refs/heads/master | 2022-12-16T00:59:59.513794 | 2020-08-27T23:20:05 | 2020-08-27T23:20:05 | 290,873,000 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 120 | java | package seleniumq.automation.core.runtime.helper.logger;
public interface SummaryLogger {
public void printTable();
}
| [
"[email protected]"
]
| |
6492649caaaeb30866fef9e16cd3ef9256ef8cca | eb330cdbb8f7e10fa900529e5079080447a73461 | /cascading-hadoop3-tez/src/main/java/cascading/flow/tez/planner/rule/partitioner/StreamedOnlySourcesNodeRePartitioner.java | 61ab9bedb3c8d8b7915fe931ed25565151974ff0 | [
"Apache-2.0"
]
| permissive | cwensel/cascading | 20cdf1259db5b3cd8d7f7cb524ba0eba29cad5fb | f2785118ce7be0abd4fe102e94a0f20fb97aa4f0 | refs/heads/4.5 | 2023-08-23T23:51:22.326915 | 2023-07-31T02:47:07 | 2023-07-31T02:47:07 | 121,672 | 165 | 71 | NOASSERTION | 2023-07-20T22:43:13 | 2009-02-04T17:52:06 | Java | UTF-8 | Java | false | false | 1,600 | java | /*
* Copyright (c) 2007-2022 The Cascading Authors. All Rights Reserved.
*
* Project and contact information: https://cascading.wensel.net/
*
* This file is part of the Cascading 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 cascading.flow.tez.planner.rule.partitioner;
import cascading.flow.planner.rule.RuleExpression;
import cascading.flow.planner.rule.expressiongraph.NoGroupJoinMergeBoundaryTapExpressionGraph;
import cascading.flow.planner.rule.partitioner.ExpressionRulePartitioner;
import cascading.flow.tez.planner.rule.expressiongraph.StreamedOnlySourcesExpressionGraph;
import static cascading.flow.planner.rule.PlanPhase.PartitionNodes;
/**
*
*/
public class StreamedOnlySourcesNodeRePartitioner extends ExpressionRulePartitioner
{
public StreamedOnlySourcesNodeRePartitioner()
{
super(
PartitionNodes,
PartitionSource.PartitionCurrent, // force repartitioning
new RuleExpression(
new NoGroupJoinMergeBoundaryTapExpressionGraph(),
new StreamedOnlySourcesExpressionGraph()
)
);
}
}
| [
"[email protected]"
]
| |
528bc662684de1a026294256da839ff2ba8ad695 | 51a36e38c2defce7874ec593bfd1c67d90e3246c | /workoutApp/AndroidFrontend/app/src/main/java/com/example/meghnapai/workoutapp/Homepage.java | e58084e8dcdf8ca3b7e03d683c1457801c5ddcdd | []
| no_license | DAJCOCHRAN/Workit | 1c539a3a3d51838b5d6c47b89bd53a504204ecf5 | f342cbd9b1662e640faaaafb922802be29cd3106 | refs/heads/master | 2020-03-18T04:41:51.973830 | 2018-05-25T15:13:12 | 2018-05-25T15:13:12 | 134,301,118 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,945 | java | package com.example.meghnapai.workoutapp;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;
import android.widget.FrameLayout;
import android.widget.Toast;
import com.ChatStuff.ChatMainActivity;
import java.util.Calendar;
public class Homepage extends AppCompatActivity {
private BottomNavigationView mMainNav;
private FrameLayout mMainFrame;
private HomeFragment homeFragment;
private LogFragment logFragment;
private ChatFragment chatFragment;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_homepage);
final Session session = new Session(this);
Toast.makeText(this,session.getUsername(),Toast.LENGTH_LONG).show();
mMainFrame = (FrameLayout) findViewById(R.id.main_Frame);
mMainNav = (BottomNavigationView) findViewById(R.id.bottomNav);
mMainNav.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.nav_home:
mMainNav.setItemBackgroundResource(R.color.colorPrimaryDark);
// homeFragment = new HomeFragment();
// setFragment(homeFragment);
Intent SignInIntent1 = new Intent(Homepage.this, CalendarActivity.class);
Homepage.this.startActivity(SignInIntent1);
return true;
case R.id.nav_log:
mMainNav.setItemBackgroundResource(R.color.colorAccent);
logFragment = new LogFragment(session);
setFragment(logFragment);
return true;
case R.id.nav_account:
mMainNav.setItemBackgroundResource(R.color.pink);
// chatFragment = new ChatFragment();
// setFragment(chatFragment);
Intent SignInIntent = new Intent(Homepage.this, ChatMainActivity.class);
Homepage.this.startActivity(SignInIntent);
return true;
default:
return false;
}
}
});
}
private void setFragment(android.support.v4.app.Fragment fragment) {
android.support.v4.app.FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.main_Frame, fragment);
fragmentTransaction.commit();
}
}
| [
"[email protected]"
]
| |
2f7de27ddc4edb7e9393316aca15692dde115091 | 0674cd45ac866e6395836113e243d9d1e1c1dc17 | /src/test/java/org/logstash/javaapi/JavaInputExampleTest.java | 7bfa9eed10f0d711314f31468e3d0c19a846a875 | [
"Apache-2.0"
]
| permissive | karenzone/logstash-input-java_input_example | fa1793031b11be24c2fd4ab55363bb310c7c6c1e | 6541645bbd531a7c44a19e14b24299904122fcea | refs/heads/master | 2020-04-28T23:54:08.057712 | 2019-02-15T22:44:45 | 2019-02-15T22:44:45 | 175,673,462 | 0 | 0 | null | 2019-03-14T17:57:23 | 2019-03-14T17:57:22 | null | UTF-8 | Java | false | false | 1,620 | java | package org.logstash.javaapi;
import co.elastic.logstash.api.Configuration;
import org.apache.commons.lang3.StringUtils;
import org.junit.Assert;
import org.junit.Test;
import org.logstash.execution.queue.QueueWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class JavaInputExampleTest {
@Test
public void testJavaInputExample() {
String prefix = "This is message";
long eventCount = 5;
Map<String, Object> configValues = new HashMap<>();
configValues.put(JavaInputExample.PREFIX_CONFIG.name(), prefix);
configValues.put(JavaInputExample.EVENT_COUNT_CONFIG.name(), eventCount);
Configuration config = new Configuration(configValues);
JavaInputExample input = new JavaInputExample(config, null);
TestQueueWriter testQueueWriter = new TestQueueWriter();
input.start(testQueueWriter);
List<Map<String, Object>> events = testQueueWriter.getEvents();
Assert.assertEquals(eventCount, events.size());
for (int k = 1; k <= events.size(); k++) {
Assert.assertEquals(prefix + " " + StringUtils.center(k + " of " + eventCount, 20),
events.get(k - 1).get("message"));
}
}
}
class TestQueueWriter implements QueueWriter {
private List<Map<String, Object>> events = new ArrayList<>();
@Override
public void push(Map<String, Object> event) {
synchronized (this) {
events.add(event);
}
}
public List<Map<String, Object>> getEvents() {
return events;
}
}
| [
"[email protected]"
]
| |
6ad111a0b42947f9382ed89f9e54a16518dc4638 | b81e466ecd12fcc643726682ae8ab9659f1902bd | /src/main/java/com/tools/extract2kafka/common/util/FastJsonUtils.java | 250a22e00a7bed667a8611343987c2d6d54a22bd | []
| no_license | zjg2524/rlsbbj | ff290c3b58cd2ae72fff9860176e5100ddae611f | 43412080217b232ed6364ba825b0b9003aba94dd | refs/heads/master | 2022-07-15T11:44:57.814345 | 2019-10-08T06:28:15 | 2019-10-08T06:28:15 | 213,544,947 | 0 | 0 | null | 2022-07-01T21:24:58 | 2019-10-08T03:55:24 | Java | UTF-8 | Java | false | false | 2,910 | java | package com.tools.extract2kafka.common.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.JSONLibDataFormatSerializer;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;
import java.util.List;
public class FastJsonUtils {
private static final SerializeConfig config;
static {
config = new SerializeConfig();
config.put(java.util.Date.class, new JSONLibDataFormatSerializer()); // 使用和json-lib兼容的日期输出格式
config.put(java.sql.Date.class, new JSONLibDataFormatSerializer()); // 使用和json-lib兼容的日期输出格式
}
private static final SerializerFeature[] features = {SerializerFeature.WriteMapNullValue, // 输出空置字段
SerializerFeature.WriteNullListAsEmpty, // list字段如果为null,输出为[],而不是null
SerializerFeature.WriteNullNumberAsZero, // 数值字段如果为null,输出为0,而不是null
SerializerFeature.WriteNullBooleanAsFalse, // Boolean字段如果为null,输出为false,而不是null
SerializerFeature.WriteNullStringAsEmpty, // 字符类型字段如果为null,输出为"",而不是null
SerializerFeature.DisableCircularReferenceDetect
};
public static String convertObjectToJSON(Object object) {
return JSON.toJSONString(object, config, features);
}
public static String toJSONNoFeatures(Object object) {
return JSON.toJSONString(object, config);
}
public static Object toBean(String text) {
return JSON.parse(text);
}
public static <T> T toBean(String text, Class<T> clazz) {
return JSON.parseObject(text, clazz);
}
/**
* 转换为数组
* @param text
* @return
*/
public static <T> Object[] toArray(String text) {
return toArray(text, null);
}
/**
* 转换为数组
* @param text
* @param clazz
* @return
*/
public static <T> Object[] toArray(String text, Class<T> clazz) {
return JSON.parseArray(text, clazz).toArray();
}
/**
* 转换为List
* @param text
* @param clazz
* @return
*/
public static <T> List<T> toList(String text, Class<T> clazz) {
return JSON.parseArray(text, clazz);
}
/**
* 将string转化为序列化的json字符串
* @param keyvalue
* @return
*/
public static Object textToJson(String text) {
Object objectJson = JSON.parse(text);
return objectJson;
}
/**
* 转换JSON字符串为对象
* @param jsonData
* @param clazz
* @return
*/
public static Object convertJsonToObject(String jsonData, Class<?> clazz) {
return JSONObject.parseObject(jsonData, clazz);
}
}
| [
"[email protected]"
]
| |
629a95ca5573763e67e426d286a166de506d546d | a992f84bf63e1938365580f395a16e623208533f | /LandscapeExample/app/src/main/java/com/example/landscapeexample/MainActivity.java | da0a7703ef145996853525ea117ba4b06a022229 | []
| no_license | carolinafalves/Android | 33aa0a05de7fa57f77ce5d2491a32d5eaa081c88 | f46b3b8d12c5d628105dc5d15a8b1581f698bed3 | refs/heads/master | 2022-08-02T11:52:11.783044 | 2020-06-01T17:54:26 | 2020-06-01T17:54:26 | 259,294,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package com.example.landscapeexample;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"[email protected]"
]
| |
d2015503b6a5f1216a4c6481e21f70f03b38177a | 9bddba23fe0200bdabbf532f878a9055ebabb773 | /app/src/main/java/com/church/com/model/EventData.java | a5c453b0ad1947c2be632cb7570824d2fb768982 | []
| no_license | sohijain/Church | d6a88c45f2678e3394f7e6ddc0e780a7dc2782d3 | c0fee609ddce4960d1f1bb3b377c3dcb9fda9794 | refs/heads/master | 2022-12-20T03:40:48.815583 | 2020-10-13T13:38:12 | 2020-10-13T13:38:12 | 297,123,858 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,460 | java | package com.church.com.model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class EventData {
@SerializedName("id")
@Expose
private String id;
@SerializedName("title")
@Expose
private String title;
@SerializedName("image")
@Expose
private String image;
@SerializedName("date")
@Expose
private String date;
@SerializedName("time")
@Expose
private String time;
@SerializedName("website")
@Expose
private String website;
@SerializedName("email")
@Expose
private String email;
@SerializedName("contact")
@Expose
private String contact;
@SerializedName("description")
@Expose
private String description;
@SerializedName("status")
@Expose
private String status;
@SerializedName("date_time")
@Expose
private String dateTime;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public String getWebsite() {
return website;
}
public void setWebsite(String website) {
this.website = website;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getContact() {
return contact;
}
public void setContact(String contact) {
this.contact = contact;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getDateTime() {
return dateTime;
}
public void setDateTime(String dateTime) {
this.dateTime = dateTime;
}
}
| [
"[email protected]"
]
| |
ef12dd35b079c832b9065a0f748de17b83639f31 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/29/29_8df6db38c495dcca2a886695fb12f57ba10579a2/ATPermissionsFileHandler/29_8df6db38c495dcca2a886695fb12f57ba10579a2_ATPermissionsFileHandler_s.java | 739dca9b781b30424b624e2ec44030143ef2d123 | []
| 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 | 5,851 | java | package com.andoutay.admintime;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import org.bukkit.GameMode;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChangedWorldEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.server.PluginDisableEvent;
import ru.tehkode.permissions.PermissionManager;
import com.earth2me.essentials.Essentials;
public class ATPermissionsFileHandler implements Listener
{
private AdminTime plugin;
private File permFile;
private YamlConfiguration perms;
private Logger log = Logger.getLogger("Minecraft");
private final String adMode = "adminMode";
private final String regMode = "regMode";
private boolean disabled;
ATPermissionsFileHandler(AdminTime plugin)
{
permFile = new File(plugin.getDataFolder(), "permissions.yml");
perms = YamlConfiguration.loadConfiguration(permFile);
this.plugin = plugin;
}
public void onEnable()
{
disabled = false;
List<World> worlds = plugin.getServer().getWorlds();
for (World w : worlds)
{
ArrayList<String> list = new ArrayList<String>(), list2 = new ArrayList<String>();
list.add("permission.for." + w.getName() + ".for.admin.mode");
list2.add("permission.for." + w.getName() + ".for.normal.mode");
perms.addDefault(adMode + "." + w.getName(), list);
perms.addDefault(regMode + "." + w.getName(), list2);
}
ArrayList<String> allList = new ArrayList<String>(), allList2 = new ArrayList<String>();
allList.add("permission.for.all.worlds.in.admin.mode");
allList2.add("permission.for.all.worlds.in.normal.mode");
perms.addDefault(adMode + ".allWorlds", allList);
perms.addDefault(regMode + ".allWorlds", allList2);
perms.options().copyDefaults(true);
try {
perms.save(permFile);
} catch (IOException e) {
log.severe(AdminTime.logPref + "Could not save permissions file");
}
}
public void enterAdminMode(Player p, String worldName)
{
swapPermSets(adMode, regMode, p, worldName);
setGodAndFly(p, true);
}
public void exitAdminMode(Player p, String worldName)
{
swapPermSets(regMode, adMode, p, worldName);
setGodAndFly(p, false);
}
private void swapPermSets(String set1, String set2, Player p, String worldName)
{
if (!(worldName == null || worldName.equalsIgnoreCase("")))
{
setPermSet(set2, p, worldName, false);
setPermSet(set1, p, worldName, true);
}
setPermSet(set2, p, "allWorlds", false);
setPermSet(set1, p, "allWorlds", true);
}
private void setPermSet(String set, Player p, String worldName, boolean tf)
{
List<String> ps = perms.getStringList(set + "." + worldName);
setPerms(ps, p, tf);
}
private void setPerms(List<String> permsToMod, Player p, boolean tf)
{
PermissionManager pm = null;
try {
pm = ATClassManager.getPexManager(plugin);
} catch (ClassNotFoundException e) {
pm = null;
} catch (NoClassDefFoundError e) {
pm = null;
}
for (String perm : permsToMod)
{
if (pm != null && ATConfig.usePex)
{
if (tf)
pm.getUser(p).addPermission(perm);
else
pm.getUser(p).removePermission(perm);
}
else
p.addAttachment(plugin, perm, tf);
}
p.recalculatePermissions();
}
public void reload()
{
perms = YamlConfiguration.loadConfiguration(permFile);
for (Player p : AdminTime.inAdminMode.keySet())
{
if (AdminTime.inAdminMode.get(p))
enterAdminMode(p, p.getWorld().getName());
else
exitAdminMode(p, p.getWorld().getName());
}
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent evt)
{
exitAdminMode(evt.getPlayer(), evt.getPlayer().getWorld().getName());
if (evt.getPlayer().hasPermission("admintime.loginlist"))
plugin.showListToSender((CommandSender)evt.getPlayer(), 1);
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent evt)
{
Player p = evt.getPlayer();
if (AdminTime.inAdminMode.containsKey(p) && AdminTime.inAdminMode.get(p))
{
plugin.tellAll(p, "left", "", "");
exitAdminMode(p, p.getWorld().getName());
p.teleport(AdminTime.lastLocs.get(p));
AdminTime.inAdminMode.remove(p);
AdminTime.lastLocs.remove(p);
}
}
@EventHandler(priority = EventPriority.LOW)
public void onPlayerChangeWorld(PlayerChangedWorldEvent evt)
{
Player p = evt.getPlayer();
if (AdminTime.inAdminMode.containsKey(p) && AdminTime.inAdminMode.get(p))
{
setPermSet(adMode, p, evt.getFrom().getName(), false);
setPermSet(adMode, p, p.getWorld().getName(), true);
}
else
{
setPermSet(regMode, p, evt.getFrom().getName(), false);
setPermSet(regMode, p, p.getWorld().getName(), true);
}
}
@EventHandler
private void onDisable(PluginDisableEvent evt)
{
if (!disabled)
{
for (Player p: AdminTime.inAdminMode.keySet())
exitAdminMode(p, p.getWorld().getName());
disabled = true;
}
}
private void setGodAndFly(Player p, boolean tf)
{
if (ATConfig.useGod || ATConfig.useFly)
{
Essentials ess = null;
ess = ATClassManager.getEssentials(plugin);
if (ess == null) return;
if (ATConfig.useGod) ess.getUser(p).setGodModeEnabled(tf);
if (ATConfig.useFly)
{
if (p.getGameMode() == GameMode.CREATIVE) tf = true;
ess.getUser(p).setAllowFlight(tf);
if (!ess.getUser(p).getAllowFlight())
ess.getUser(p).setFlying(false);
}
}
}
}
| [
"[email protected]"
]
| |
62f6ba5ddfdc849c23306db9cd8b273bbe835bbd | 23a2ec1346d427cce5eeb1014c209a1756fdadd7 | /HaksaProject/src/MainProcess.java | 2f4258a952c718c6930bd6592a513e90a4086a4c | []
| no_license | mans122/TIS-Java | 5c838fcf1597045a98995b208b2d05426506e132 | c2a12ffdfc44c735c004a72bb1f5cc9bdee7126b | refs/heads/master | 2021-07-12T20:24:29.611886 | 2019-12-17T08:51:47 | 2019-12-17T08:51:47 | 209,219,707 | 0 | 0 | null | 2020-10-13T16:46:15 | 2019-09-18T04:48:08 | Java | UTF-8 | Java | false | false | 1,671 | java | import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JFrame;
public class MainProcess {
public static Login login;
public static Haksa haksa;
static MainProcess main;
public static void main(String[] args) {
DBManager db = new DBManager();
db.Connection();
main = new MainProcess();
MainProcess.login = new Login();
MainProcess.login.setMain(main);
MainProcess.login.setTitle("학사관리 로그인");
MainProcess.login.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
MainProcess.login.setSize(500, 300);
Dimension frameSize = MainProcess.login.getSize();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
MainProcess.login.setLocation((screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
MainProcess.login.setResizable(false);
MainProcess.login.setVisible(true);
}
public void showFrameTest() {
login.dispose();
MainProcess.haksa = new Haksa();
MainProcess.haksa.setMain(main);
}
public void showFrameLogin() {
MainProcess.haksa.dispose();
MainProcess.login = new Login();
MainProcess.login.setMain(main);
MainProcess.login.setTitle("학사관리 로그인");
MainProcess.login.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
MainProcess.login.setSize(500, 300);
Dimension frameSize = MainProcess.login.getSize();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
MainProcess.login.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
MainProcess.login.setResizable(false);
MainProcess.login.setVisible(true);
}
}
| [
"[email protected]"
]
| |
30c7c50b121d8cd0d6ee557871722ab7c46354cb | de6e2ddaee1cfe5170f7210d88bca63447f98289 | /LoadBuffer.java | 9b9085e6dbb0e9f54a50037172151c215d9b822c | []
| no_license | aafgt/TomasuloAlgorithm-Simulation | 068976720397174b21cf5216b4608cac1ce2a6e9 | b5d369ed0e8581f0e7bd017938673c57c04ad828 | refs/heads/master | 2023-02-18T08:49:08.674063 | 2021-01-22T18:32:47 | 2021-01-22T18:32:47 | 332,031,689 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 321 | java |
public class LoadBuffer {
LoadR L1 = new LoadR("L1");
LoadR L2 = new LoadR("L2");
public LoadBuffer() {
}
public boolean canIssue() {
if(L1.busy && L2.busy)
return false;
else
return true;
}
public void print() {
L1.print();
System.out.println();
L2.print();
System.out.println();
}
}
| [
"[email protected]"
]
| |
9485fd1756c3ce03c9e9b42129eaeae48090d273 | f5b524748dc6d764e69f1c54295cd72bd82f4e0a | /BasicServlet/src/com/kitri/basic/LifeCycleTest.java | 936f0f5e6bcbd469c326bbe4a22a6b87c3418a45 | []
| no_license | GHJaewoonLee/HTMLStudy | 9122575989a711adceb00e7fc11391c799245fe9 | e1bf99f8e208e66d21faccaaab4a446651ab8bb3 | refs/heads/master | 2020-05-16T14:47:49.155381 | 2019-07-16T04:22:22 | 2019-07-16T04:22:22 | 183,112,875 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,212 | java | package com.kitri.basic;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
// WAS : 소켓/쓰레드 관리를 해주고 있음
// 객체는 1개 이지만 client마다 쓰레드가 1개씩 생성
// 생성자 -> init -> do... 클라이언트 요청에 따라 반복 -> destroy
@SuppressWarnings("serial")
@WebServlet("/life")
public class LifeCycleTest extends HttpServlet {
public LifeCycleTest() {
System.out.println("생성자 메소드 호출");
}
// Servlet은 init() 함수에서 객체를 초기화
@Override
public void init() throws ServletException {
System.out.println("init 메소드 호출");
}
// 주로 서비스 영역 부분
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
System.out.println("service 메소드 호출");
}
// 서비스가 종료되는 시점에서 호출
@Override
public void destroy() {
System.out.println("destroy 메소드 호출");
}
}
| [
"[email protected]"
]
| |
0f1b04db0e5a918bbf2f0413675a02b84749e3f5 | 498dd2daff74247c83a698135e4fe728de93585a | /clients/google-api-services-integrations/v1alpha/2.0.0/com/google/api/services/integrations/v1alpha/model/EnterpriseCrmEventbusProtoTeardownTaskConfig.java | 72f0a572f44394a88aa662d64287448151d32988 | [
"Apache-2.0"
]
| permissive | googleapis/google-api-java-client-services | 0e2d474988d9b692c2404d444c248ea57b1f453d | eb359dd2ad555431c5bc7deaeafca11af08eee43 | refs/heads/main | 2023-08-23T00:17:30.601626 | 2023-08-20T02:16:12 | 2023-08-20T02:16:12 | 147,399,159 | 545 | 390 | Apache-2.0 | 2023-09-14T02:14:14 | 2018-09-04T19:11:33 | null | UTF-8 | Java | false | false | 5,900 | java | /*
* 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.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.integrations.v1alpha.model;
/**
* Model definition for EnterpriseCrmEventbusProtoTeardownTaskConfig.
*
* <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the Application Integration API. For a detailed
* explanation see:
* <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
* </p>
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class EnterpriseCrmEventbusProtoTeardownTaskConfig extends com.google.api.client.json.GenericJson {
/**
* The creator's email address.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String creatorEmail;
/**
* Required. Unique identifier of the teardown task within this Config. We use this field as the
* identifier to find next teardown tasks.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String name;
/**
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private EnterpriseCrmEventbusProtoNextTeardownTask nextTeardownTask;
/**
* The parameters the user can pass to this task.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private EnterpriseCrmEventbusProtoEventParameters parameters;
/**
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private EnterpriseCrmEventbusProtoEventBusProperties properties;
/**
* Required. Implementation class name.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String teardownTaskImplementationClassName;
/**
* The creator's email address.
* @return value or {@code null} for none
*/
public java.lang.String getCreatorEmail() {
return creatorEmail;
}
/**
* The creator's email address.
* @param creatorEmail creatorEmail or {@code null} for none
*/
public EnterpriseCrmEventbusProtoTeardownTaskConfig setCreatorEmail(java.lang.String creatorEmail) {
this.creatorEmail = creatorEmail;
return this;
}
/**
* Required. Unique identifier of the teardown task within this Config. We use this field as the
* identifier to find next teardown tasks.
* @return value or {@code null} for none
*/
public java.lang.String getName() {
return name;
}
/**
* Required. Unique identifier of the teardown task within this Config. We use this field as the
* identifier to find next teardown tasks.
* @param name name or {@code null} for none
*/
public EnterpriseCrmEventbusProtoTeardownTaskConfig setName(java.lang.String name) {
this.name = name;
return this;
}
/**
* @return value or {@code null} for none
*/
public EnterpriseCrmEventbusProtoNextTeardownTask getNextTeardownTask() {
return nextTeardownTask;
}
/**
* @param nextTeardownTask nextTeardownTask or {@code null} for none
*/
public EnterpriseCrmEventbusProtoTeardownTaskConfig setNextTeardownTask(EnterpriseCrmEventbusProtoNextTeardownTask nextTeardownTask) {
this.nextTeardownTask = nextTeardownTask;
return this;
}
/**
* The parameters the user can pass to this task.
* @return value or {@code null} for none
*/
public EnterpriseCrmEventbusProtoEventParameters getParameters() {
return parameters;
}
/**
* The parameters the user can pass to this task.
* @param parameters parameters or {@code null} for none
*/
public EnterpriseCrmEventbusProtoTeardownTaskConfig setParameters(EnterpriseCrmEventbusProtoEventParameters parameters) {
this.parameters = parameters;
return this;
}
/**
* @return value or {@code null} for none
*/
public EnterpriseCrmEventbusProtoEventBusProperties getProperties() {
return properties;
}
/**
* @param properties properties or {@code null} for none
*/
public EnterpriseCrmEventbusProtoTeardownTaskConfig setProperties(EnterpriseCrmEventbusProtoEventBusProperties properties) {
this.properties = properties;
return this;
}
/**
* Required. Implementation class name.
* @return value or {@code null} for none
*/
public java.lang.String getTeardownTaskImplementationClassName() {
return teardownTaskImplementationClassName;
}
/**
* Required. Implementation class name.
* @param teardownTaskImplementationClassName teardownTaskImplementationClassName or {@code null} for none
*/
public EnterpriseCrmEventbusProtoTeardownTaskConfig setTeardownTaskImplementationClassName(java.lang.String teardownTaskImplementationClassName) {
this.teardownTaskImplementationClassName = teardownTaskImplementationClassName;
return this;
}
@Override
public EnterpriseCrmEventbusProtoTeardownTaskConfig set(String fieldName, Object value) {
return (EnterpriseCrmEventbusProtoTeardownTaskConfig) super.set(fieldName, value);
}
@Override
public EnterpriseCrmEventbusProtoTeardownTaskConfig clone() {
return (EnterpriseCrmEventbusProtoTeardownTaskConfig) super.clone();
}
}
| [
"[email protected]"
]
| |
afc82177c1b851d70b802645474f991fc8ca1fe2 | ce9de9cdc9ea29ed22d8e3cf01da2ec539c4b6ef | /src/main/java/com/nemesismate/piksel/trial/entity/vo/Viewings.java | 7d9ccbd7d8f2da23c7cafc6a75540db43ab117b6 | [
"Apache-2.0"
]
| permissive | NemesisMate/pikseltrial | 7b026115d8fe1231f9b647649c3d7514960913ec | 4fb64c640efd547fca0f900c99bc89577487a13c | refs/heads/master | 2020-03-30T04:49:30.482509 | 2018-10-12T16:32:58 | 2018-10-12T16:32:58 | 150,764,062 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 462 | java | package com.nemesismate.piksel.trial.entity.vo;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Wither;
import javax.persistence.Column;
import javax.persistence.Embeddable;
@Getter
@AllArgsConstructor
@NoArgsConstructor
@Wither
@Embeddable
@EqualsAndHashCode
@ToString
public class Viewings {
@Column
private int amount;
}
| [
"[email protected]"
]
| |
0a8828d188663faa677732266340bfe0d2f59b42 | b0d2612a3924ba225a60d237bb162b22e7d5f486 | /task_1/coins/src/main/java/com/epam/traning/coins/exceptions/ExpressionCoinsException.java | ef1f66494231250a4bd4069fe7d13364eeb28b97 | []
| no_license | kets911/aut-java-lab-2018-pavel-katsuba | 91003b27937659a40767c3bbbdcf3403927cc79c | 6ed53ccf3c601fff81b4d9795b6f76f12c7ae680 | refs/heads/master | 2020-05-17T23:45:00.997419 | 2019-04-29T12:06:27 | 2019-04-29T12:06:27 | 184,040,929 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 473 | java | package com.epam.traning.coins.exceptions;
public class ExpressionCoinsException extends RuntimeException {
public ExpressionCoinsException(String message) {
super(message);
}
public ExpressionCoinsException(String message, Throwable cause) {
super(message, cause);
}
public ExpressionCoinsException(Throwable cause) {
super(cause);
}
@Override
public String toString() {
return super.toString();
}
}
| [
"[email protected]"
]
| |
31bdd6816224f779dbabd57cbd66c1a8e3e75543 | d8a40e6da81cbcf8035656c4abb93b67725a3e27 | /Semantico/src/miniTREC/Concept.java | 9f103d6f0f4f7b7b67b9afa16f4293ef110b89d9 | []
| no_license | Rubenbros/semantico | fae58b45e8324d46a6d30fbe99ffd00b373d7059 | 97e68a1cd6cfe7024744e1e740bf85b8da9965b2 | refs/heads/master | 2020-04-17T09:17:42.739279 | 2019-01-23T19:14:31 | 2019-01-23T19:14:31 | 166,452,324 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,531 | java | package miniTREC;
import java.util.ArrayList;
import java.util.List;
public class Concept {
private List<Concept> broader=new ArrayList<Concept>();
private List<Concept> narrower=new ArrayList<Concept>();
private List<String> prefLabel=new ArrayList<String>();
private List<String> altLabel=new ArrayList<String>();
private String base;
public Concept(String base) {
this.base=base;
}
public String isRelated(String concept) {
for(Concept i : broader)
if(i.equals(concept)) {
return i.getBase();
}
for(Concept i : narrower)
if(i.equals(concept)) {
return i.getBase();
}
if(prefLabel.contains(concept))return base;
else if(altLabel.contains(concept))return base;
else if(base == concept)return base;
else return "";
}
public String getBase() {
return base;
}
public void addBroader(Concept concept) {
broader.add(concept);
}
public void addNarrower(Concept concept) {
narrower.add(concept);
}
public void addPrefLabel(String concept) {
prefLabel.add(concept);
}
public void addAltLabel(String concept) {
altLabel.add(concept);
}
public List<Concept> getBroader() {
return broader;
}
public List<Concept> getNarrower() {
return narrower;
}
public List<String> getPrefLabel() {
return prefLabel;
}
public List<String> getAltLabel() {
return altLabel;
}
@Override
public boolean equals(Object concept) {
String cmp = (String) concept;
return this.base.equals(cmp);
}
}
| [
"[email protected]"
]
| |
03e619b593259e034a7af795fa70453b8ae18a4d | 1fe04d4b757adcb2b8551fcb30156ce956f1e87a | /src/Achieve/achieveBox.java | 815618bbcbbb3f513c8bf0928c039b5de0c9a0ca | []
| no_license | stanly481025/AFSS | 8fed117da91c961c4b17f2f71ed131148d380882 | e37b3efa2e4edd1017db005c029f57e165015f60 | refs/heads/master | 2021-05-12T02:18:51.987300 | 2019-07-15T14:14:44 | 2019-07-15T14:14:44 | 117,583,429 | 0 | 1 | null | null | null | null | WINDOWS-1252 | Java | false | false | 414 | java | package Achieve;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class achieveBox extends JFrame{
private String statement;
public achieveBox(String input)
{
this.statement = input;
JOptionPane.showMessageDialog(this,input,"¸ÑÂꦨ´N",JOptionPane.INFORMATION_MESSAGE);
}
}
| [
"[email protected]"
]
| |
19882f09bfc2f744abb768dfd09727637214545f | 322aaf8d0b54a28bc626c37d481c0ae26e5aeb12 | /app/src/main/java/shui/liu/com/mysend/MainActivity.java | 2673c2fa7786227b1b9f2454e49423f3c57c6634 | []
| no_license | liushuiping/MYsend | ba21eb48dbf91584a93d296c492f685782fd11c9 | 55c05aee1cdc15b15a6e03643aa29725ed3015fc | refs/heads/master | 2020-03-09T01:10:37.538830 | 2018-04-11T16:35:40 | 2018-04-11T16:35:40 | 128,507,154 | 0 | 0 | null | 2018-04-07T15:26:07 | 2018-04-07T07:41:43 | Java | UTF-8 | Java | false | false | 339 | java | package shui.liu.com.mysend;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"[email protected]"
]
| |
1217bcff0624e2044c94d812d3c1b6b970cc6061 | 7715391a5d7311c6b369bba78d696bdf9fc431cc | /M11_Floristeria/src/model/Flor.java | 890a6fb961e4006de2c2bf80487a22330993e3d2 | []
| no_license | valeriavlgc/itacademy-m11Floristeria | a30a8cd12f304d4d37253899e49fd028d86d9dfb | 8e35e5eb627b7342e147c5f41fd2ba644e0ce76b | refs/heads/master | 2023-09-04T23:39:34.300969 | 2021-10-20T11:38:05 | 2021-10-20T11:38:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 379 | java | package model;
import controller.CampoVacio;
public class Flor extends Producto{
public Flor(String name, String color, double price) throws CampoVacio {
super(name, price);
this.color = color;
}
@Override
public String toString() {
return "Id= " + getId() + "Name:" + getName() + ", Color:" + color + ", Precio:" + getPrice();
}
private String color;
}
| [
"[email protected]"
]
| |
28a9c27908a1bde04b071e3f125e749bcaafbd16 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/29/29_a4cb073f8ca4c67177ada38f7ad7f3d72a4d6bb8/GroupEditProducer/29_a4cb073f8ca4c67177ada38f7ad7f3d72a4d6bb8_GroupEditProducer_s.java | ec06f254991360a1733ee65a5f4079511153f34d | []
| 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 | 8,720 | java | package org.sakaiproject.site.tool.helper.managegroup.rsf;
import java.util.Collection;
import java.util.Iterator;
import java.util.Vector;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.sakaiproject.authz.api.Member;
import org.sakaiproject.site.api.Group;
import org.sakaiproject.site.api.SiteService;
import org.sakaiproject.site.tool.helper.managegroup.impl.SiteManageGroupHandler;
import org.sakaiproject.site.util.Participant;
import org.sakaiproject.site.util.SiteComparator;
import org.sakaiproject.site.util.SiteConstants;
import org.sakaiproject.user.api.User;
import org.sakaiproject.user.api.UserDirectoryService;
import org.sakaiproject.util.SortedIterator;
import uk.ac.cam.caret.sakai.rsf.producers.FrameAdjustingProducer;
import uk.org.ponder.messageutil.MessageLocator;
import uk.org.ponder.messageutil.TargettedMessageList;
import uk.org.ponder.rsf.components.UIBranchContainer;
import uk.org.ponder.rsf.components.UICommand;
import uk.org.ponder.rsf.components.UIContainer;
import uk.org.ponder.rsf.components.UIForm;
import uk.org.ponder.rsf.components.UIInput;
import uk.org.ponder.rsf.components.UIMessage;
import uk.org.ponder.rsf.components.UIOutput;
import uk.org.ponder.rsf.components.UISelect;
import uk.org.ponder.rsf.components.decorators.UILabelTargetDecorator;
import uk.org.ponder.rsf.evolvers.TextInputEvolver;
import uk.org.ponder.rsf.flow.ARIResult;
import uk.org.ponder.rsf.flow.ActionResultInterceptor;
import uk.org.ponder.rsf.view.ComponentChecker;
import uk.org.ponder.rsf.view.ViewComponentProducer;
import uk.org.ponder.rsf.viewstate.SimpleViewParameters;
import uk.org.ponder.rsf.viewstate.ViewParameters;
import uk.org.ponder.rsf.viewstate.ViewParamsReporter;
/**
*
* @author Dr. WHO?
*
*/
public class GroupEditProducer implements ViewComponentProducer, ActionResultInterceptor, ViewParamsReporter {
/** Our log (commons). */
private static Log M_log = LogFactory.getLog(GroupEditProducer.class);
public SiteManageGroupHandler handler;
public static final String VIEW_ID = "GroupEdit";
public MessageLocator messageLocator;
public FrameAdjustingProducer frameAdjustingProducer;
public SiteService siteService = null;
private TextInputEvolver richTextEvolver;
public void setRichTextEvolver(TextInputEvolver richTextEvolver) {
this.richTextEvolver = richTextEvolver;
}
public String getViewID() {
return VIEW_ID;
}
private TargettedMessageList tml;
public void setTargettedMessageList(TargettedMessageList tml) {
this.tml = tml;
}
public UserDirectoryService userDirectoryService;
public void setUserDiretoryService(UserDirectoryService userDirectoryService)
{
this.userDirectoryService = userDirectoryService;
}
public void fillComponents(UIContainer arg0, ViewParameters arg1, ComponentChecker arg2) {
String state="";
// id for group
String groupId = null;
// title for group
String groupTitle = null;
// description for group
String groupDescription = null;
// member list for group
Collection<Member> groupMembers = new Vector<Member>();
UIForm groupForm = UIForm.make(arg0, "groups-form");
String id = ((GroupEditViewParameters) arg1).id;
if (id != null)
{
try
{
Group g = siteService.findGroup(id);
groupId = g.getId();
groupTitle = g.getTitle();
groupDescription = g.getDescription();
groupMembers = g.getMembers();
}
catch (Exception e)
{
M_log.debug(this + "fillComponents: cannot get group id=" + id);
}
}
else
{
handler.resetParams();
}
UIOutput.make(groupForm, "prompt", messageLocator.getMessage("group.newgroup"));
UIOutput.make(groupForm, "instructions", messageLocator.getMessage("editgroup.instruction"));
UIOutput.make(groupForm, "group_title_label", messageLocator.getMessage("group.title"));
UIInput titleTextIn = UIInput.make(groupForm, "group_title", "#{SiteManageGroupHandler.title}",groupTitle);
UIMessage groupDescrLabel = UIMessage.make(arg0, "group_description_label", "group.description");
UIInput groupDescr = UIInput.make(groupForm, "group_description:", "#{SiteManageGroupHandler.description}", groupDescription);
richTextEvolver.evolveTextInput(groupDescr);
UILabelTargetDecorator.targetLabel(groupDescrLabel, groupDescr);
UIOutput.make(groupForm, "membership_label", messageLocator.getMessage("editgroup.membership"));
UIOutput.make(groupForm, "membership_site_label", messageLocator.getMessage("editgroup.generallist"));
UIOutput.make(groupForm, "membership_group_label", messageLocator.getMessage("editgroup.grouplist"));
// for the site members list
Collection siteMembers= handler.getSiteParticipant();
String[] siteMemberLabels = new String[siteMembers.size()];
String[] siteMemberValues = new String[siteMembers.size()];
UISelect siteMember = UISelect.makeMultiple(groupForm,"siteMembers",siteMemberValues,siteMemberLabels,"#{SiteManageGroupHandler.selectedSiteMembers}", new String[] {});
int i =0;
Iterator<Participant> sIterator = new SortedIterator(siteMembers.iterator(), new SiteComparator(SiteConstants.SORTED_BY_PARTICIPANT_NAME, Boolean.TRUE.toString()));
for (; sIterator.hasNext();i++){
Participant p = (Participant) sIterator.next();
siteMemberLabels[i] = p.getName();
siteMemberValues[i] = p.getUniqname();
}
// for the group members list
String[] groupMemberLabels = new String[groupMembers.size()];
String[] groupMemberValues = new String[groupMembers.size()];
UISelect groupMember = UISelect.make(groupForm,"groupMembers",groupMemberValues,groupMemberLabels,null);
i =0;
Iterator<Member> gIterator = new SortedIterator(groupMembers.iterator(), new SiteComparator(SiteConstants.SORTED_BY_PARTICIPANT_NAME, Boolean.TRUE.toString()));
for (; gIterator.hasNext();i++){
Member p = (Member) gIterator.next();
String userId = p.getUserId();
try
{
User u = userDirectoryService.getUser(userId);
groupMemberLabels[i] = u.getSortName();
}
catch (Exception e)
{
M_log.warn(this + ":fillComponents: cannot find user " + userId);
}
groupMemberValues[i] = userId;
}
UICommand.make(groupForm, "save", id != null?messageLocator.getMessage("editgroup.update"):messageLocator.getMessage("editgroup.new"), "#{SiteManageGroupHandler.processAddGroup}");
UICommand.make(groupForm, "cancel", messageLocator.getMessage("editgroup.cancel"), "#{SiteManageGroupHandler.processBack}");
UIInput.make(groupForm, "newRight", "#{SiteManageGroupHandler.memberList}", state);
// hidden field for group id
UIInput.make(groupForm, "groupId", "#{SiteManageGroupHandler.id}", groupId);
//process any messages
if (tml.size() > 0) {
for (i = 0; i < tml.size(); i ++ ) {
UIBranchContainer errorRow = UIBranchContainer.make(arg0,"error-row:", new Integer(i).toString());
if (tml.messageAt(i).args != null ) {
UIMessage.make(errorRow,"error",tml.messageAt(i).acquireMessageCode(),(String[])tml.messageAt(i).args[0]);
} else {
UIMessage.make(errorRow,"error",tml.messageAt(i).acquireMessageCode());
}
}
}
frameAdjustingProducer.fillComponents(arg0, "resize", "resetFrame");
}
public ViewParameters getViewParameters() {
GroupEditViewParameters params = new GroupEditViewParameters();
params.id = null;
return params;
}
// old and busted
// public List reportNavigationCases() {
// List togo = new ArrayList();
// togo.add(new NavigationCase("success", new SimpleViewParameters(GroupListProducer.VIEW_ID)));
// togo.add(new NavigationCase("cancel", new SimpleViewParameters(GroupListProducer.VIEW_ID)));
// return togo;
// }
// new hotness
public void interceptActionResult(ARIResult result, ViewParameters incoming, Object actionReturn) {
if ("success".equals(actionReturn) || "cancel".equals(actionReturn)) {
result.resultingView = new SimpleViewParameters(GroupListProducer.VIEW_ID);
}
}
}
| [
"[email protected]"
]
| |
7a64fb5fe7d78328023af06238ffc34837beed47 | ed1007f1c54707972ae7dc4eb60609209052afd6 | /SpringMongoApp/SpringMongoApp/src/main/java/com/freshers/trainingApp/model/users.java | 30b7619367ea9c7939ba76cabb9cd585ce62bd96 | []
| no_license | prathvi-shetty/mongo | c2c12061de9d364d99713047db633ccc05496f00 | 5ead573b6886b98bffffb1b108cff6527ae60156 | refs/heads/master | 2020-07-08T05:57:36.302820 | 2019-08-21T13:07:15 | 2019-08-21T13:07:15 | 203,585,802 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,162 | java | package com.freshers.trainingApp.model;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import java.math.BigInteger;
@Document(collection = "tusers")
public class users {
@Id
private String id;
private String username;
private String password;
private String emailId;
private BigInteger contactNumber;
public users(String username, String password, String emailId) {
this.username = username;
this.password = password;
this.emailId = emailId;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmailId() {
return emailId;
}
public void setEmailId(String emailId) {
this.emailId = emailId;
}
}
| [
"[email protected]"
]
| |
54ba825eea6e42ac24e5f8ec16d9937ae7f1c5b9 | 15d062655f62d4040b322924d2e8451864f286bc | /java/com/soecode/lyf/dao/BookDao.java | 959f6fa460db8e12bebe7c9a11fa40ae7354520f | []
| no_license | YingJC/FirstSSM | 331cf97bee4aa326a5d6843f8d7a46dbd2f8d885 | c868ae56d3e501d35409dce09ddbaf5dbe55f2f1 | refs/heads/master | 2023-06-09T07:23:37.654170 | 2021-07-02T02:15:34 | 2021-07-02T02:15:34 | 382,195,868 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 665 | java | package com.soecode.lyf.dao;
import com.soecode.lyf.entity.Book;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface BookDao {
/*
通过ID查询单本图书
@param id
@return
*/
Book queryById(long id);
/*
查询所有图书
@param offset 查询起始位置
@param limit 查询条数
@return
*/
List<Book> queryAll(@Param("offset") int offset,@Param("limit") int limit);
/*
减少馆藏数量
@param bookID
@return 如果影响行数等于>1,表示更新的记录行数
*/
int reduceNumber(long bookID);
}
| [
"[[email protected]]"
]
| |
44504cd4ce459cb5946a5d3acbf1c979f4808168 | 4f9f8836e5bafeeb821961f41c0246a52ccbc601 | /app/src/main/java/android/support/annotation/DrawableRes.java | aefecc7acd4cd61fc6a81e99704e3ea8fd87d899 | []
| no_license | pyp163/BlueTooth | aeb7fd186b6d25baf4306dce9057b073402b991c | 740e2ad00e3099d1297eee22c31570a8afc99f88 | refs/heads/master | 2021-01-09T12:03:25.376757 | 2020-02-22T06:58:49 | 2020-02-22T06:58:49 | 242,290,730 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 501 | java | package android.support.annotation;
import java.lang.annotation.Annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Documented
@Retention(RetentionPolicy.CLASS)
@Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.LOCAL_VARIABLE})
public @interface DrawableRes
{
} | [
"[email protected]"
]
| |
500eb2519054491ab99ace139ed300d1ced2dcc4 | 8905c775b4ea2bec37123291bf299a75ddd38fcf | /src/main/java/com/company/YandexTranslatorAPI.java | 2f4e64f2f7623553ebca2a5cf668653bb0807602 | []
| no_license | abrahamyanarman/Yandex_Translate_In_PC | 274be8ae756d4d2cb8c7bf0f46c97b7ea49f92f5 | 0ced5a065f49fffdbdc4e4cfbb1d82de2f05f8cd | refs/heads/master | 2020-04-09T08:04:39.656782 | 2018-12-04T07:16:42 | 2018-12-04T07:16:42 | 160,181,429 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,990 | java | package com.company;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
/**
* Makes the generic Yandex API calls. Different service classes can then
* extend this to make the specific service calls.
*/
public abstract class YandexTranslatorAPI {
//Encoding type
protected static final String ENCODING = "UTF-8";
protected static String apiKey;
private static String referrer;
protected static final String PARAM_API_KEY = "key=",
PARAM_LANG_PAIR = "&lang=",
PARAM_TEXT = "&text=";
public static void setKey(final String pKey) {
apiKey = pKey;
}
public static void setReferrer(final String pReferrer) {
referrer = pReferrer;
}
private static String retrieveResponse(final URL url) throws Exception {
final HttpsURLConnection uc = (HttpsURLConnection) url.openConnection();
if(referrer!=null)
uc.setRequestProperty("referer", referrer);
uc.setRequestProperty("Content-Type","text/plain; charset=" + ENCODING);
uc.setRequestProperty("Accept-Charset",ENCODING);
uc.setRequestMethod("GET");
try {
final int responseCode = uc.getResponseCode();
final String result = inputStreamToString(uc.getInputStream());
if(responseCode!=200) {
throw new Exception("Error from Yandex API: " + result);
}
return result;
} finally {
if(uc!=null) {
uc.disconnect();
}
}
}
/**
* Forms a request, sends it using the GET method and returns the value with the given label from the
* resulting JSON response.
*/
protected static String retrievePropString(final URL url, final String jsonValProperty) throws Exception {
final String response = retrieveResponse(url);
JSONObject jsonObj = (JSONObject)JSONValue.parse(response);
return jsonObj.get(jsonValProperty).toString();
}
/**
* Forms a request, sends it using the GET method and returns the contents of the array of strings
* with the given label, with multiple strings concatenated.
*/
protected static String retrievePropArrString(final URL url, final String jsonValProperty) throws Exception {
final String response = retrieveResponse(url);
String[] translationArr = jsonObjValToStringArr(response, jsonValProperty);
String combinedTranslations = "";
for (String s : translationArr) {
combinedTranslations += s;
}
return combinedTranslations.trim();
}
// Helper method to parse a JSONObject containing an array of Strings with the given label.
private static String[] jsonObjValToStringArr(final String inputString, final String subObjPropertyName) throws Exception {
JSONObject jsonObj = (JSONObject)JSONValue.parse(inputString);
JSONArray jsonArr = (JSONArray) jsonObj.get(subObjPropertyName);
return jsonArrToStringArr(jsonArr.toJSONString(), null);
}
// Helper method to parse a JSONArray. Reads an array of JSONObjects and returns a String Array
// containing the toString() of the desired property. If propertyName is null, just return the String value.
private static String[] jsonArrToStringArr(final String inputString, final String propertyName) throws Exception {
final JSONArray jsonArr = (JSONArray)JSONValue.parse(inputString);
String[] values = new String[jsonArr.size()];
int i = 0;
for(Object obj : jsonArr) {
if(propertyName!=null&&propertyName.length()!=0) {
final JSONObject json = (JSONObject)obj;
if(json.containsKey(propertyName)) {
values[i] = json.get(propertyName).toString();
}
} else {
values[i] = obj.toString();
}
i++;
}
return values;
}
private static String inputStreamToString(final InputStream inputStream) throws Exception {
final StringBuilder outputBuilder = new StringBuilder();
try {
String string;
if (inputStream != null) {
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, ENCODING));
while (null != (string = reader.readLine())) {
// TODO Can we remove this?
// Need to strip the Unicode Zero-width Non-breaking Space. For some reason, the Microsoft AJAX
// services prepend this to every response
outputBuilder.append(string.replaceAll("\uFEFF", ""));
}
}
} catch (Exception ex) {
throw new Exception("[yandex-translator-api] Error reading translation stream.", ex);
}
return outputBuilder.toString();
}
//Check if ready to make request, if not, throw a RuntimeException
protected static void validateServiceState() throws Exception {
if(apiKey==null||apiKey.length()<27) {
throw new RuntimeException("INVALID_API_KEY - Please set the API Key with your Yandex API Key");
}
}
}
| [
"[email protected]"
]
| |
2c87b8fc8e328f7f061970716bd5b5724820bac2 | b66a7c78b11766e4a35ab2a4277c30a7406e4cd6 | /src/main/java/com/xiaomi/stonelion/jmx/HelloMBean.java | a240b109b45a263fec2fa6d28cb630f381660e7a | []
| no_license | jibaro/stonelion | 3fae10760b346360649fce3db59a0b206e0189cb | 492e26f73fe66c4dc8df9cf3c5cdbef22752eb82 | refs/heads/master | 2021-01-17T23:30:55.983391 | 2014-08-26T08:00:20 | 2014-08-26T08:00:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 239 | java |
package com.xiaomi.stonelion.jmx;
public interface HelloMBean {
public void sayHello();
public int add(int x, int y);
public String getName();
public int getCacheSize();
public void setCacheSize(int cacheSize);
}
| [
"[email protected]"
]
| |
a82ce38f19d5ab95597939356ef54b9c12112911 | 840a9424eaca9d25a90bce601f3b8149e3a44acc | /Yucai/src/main/java/com/hyg/yucai/service/TABService.java | 615a0d2cadd8a2eaf49e0268d6d20fdbc27b9ab7 | []
| no_license | YucaiTeam/Yucai | f0de355f02d58c6f4936ef5e135c3090fa3e1d17 | 70eec622de5bb095e1ec556b6482536617132b7c | refs/heads/master | 2020-03-27T23:51:50.442221 | 2018-09-04T14:45:58 | 2018-09-04T14:45:58 | 144,923,224 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 639 | java | package com.hyg.yucai.service;
import java.util.List;
import com.hyg.yucai.model.TArea;
import com.hyg.yucai.model.TAreaCustom;
import com.hyg.yucai.model.TAreaExample;
import com.hyg.yucai.model.TBank;
import com.hyg.yucai.model.TBankExample;
public interface TABService {
//获取所有地区以及该地区银行
public List<TAreaCustom> getAreaAndBank();
//获取所有地区
public List<TArea> getAllArea(TAreaExample example);
//获取所有银行
public List<TBank> getAllBank(TBankExample example);
//根据地区号获得对应银行
public List<TBank> getBankByAreano(String areano);
}
| [
"[email protected]"
]
| |
db69b3878c9a54613d4cce754d98e6acc9c25e26 | d8b83711a84c83730ee3fe50f5ebfa929bfbed10 | /1.JavaSyntax/src/com/javarush/task/task05/task0531/Solution.java | cd2064d588ae11abc27827225a43ffe6b6f1cb88 | []
| no_license | dleliuhin/JavaRushTasks | 22f24dbd12aaa333cdd9ad4cd094573b57489ffd | 0ebcb967ee56287907ea0cf36b132a680fe1f26a | refs/heads/master | 2020-03-22T04:35:51.335769 | 2018-07-29T23:25:59 | 2018-07-29T23:25:59 | 139,506,403 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 917 | java | package com.javarush.task.task05.task0531;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/*
Совершенствуем функциональность
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int a = Integer.parseInt(reader.readLine());
int b = Integer.parseInt(reader.readLine());
int c = Integer.parseInt(reader.readLine());
int d = Integer.parseInt(reader.readLine());
int e = Integer.parseInt(reader.readLine());
int minimum = min(a, b, c, d, e);
System.out.println("Minimum = " + minimum);
}
public static int min(int a, int b, int c, int d, int e) {
return min(a,min(b,min(c,min(d,e))));
}
public static int min(int a, int b) {
return a < b ? a : b;
}
}
| [
"[email protected]"
]
| |
0f27fb13d3959aca0b7611e3043b7c8dd8f4690a | 4300e5564c6d4892985be91ac250edfff18cd1af | /atlasdb-client/src/main/java/com/palantir/atlasdb/schema/generated/SweepableCellsTable.java | cc855ab0113822fd76152f5410eb1ac9418a0bce | [
"BSD-3-Clause"
]
| permissive | stefank-palantir/atlasdb | b2ed0fa079c5b0b5808cc52ea5d0bc11b81c4b84 | a61eb4b2896c7bfadd0ccf789521928340b094ec | refs/heads/develop | 2021-01-22T23:07:18.514111 | 2018-09-11T16:58:03 | 2018-09-11T17:00:19 | 85,610,987 | 0 | 0 | null | 2017-03-20T18:18:41 | 2017-03-20T18:18:40 | null | UTF-8 | Java | false | false | 34,134 | java | package com.palantir.atlasdb.schema.generated;
import java.util.Arrays;
import java.util.Collection;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Set;
import java.util.SortedMap;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import java.util.function.BiFunction;
import java.util.stream.Stream;
import javax.annotation.Generated;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.base.Supplier;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Collections2;
import com.google.common.collect.ComparisonChain;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
import com.google.common.collect.Sets;
import com.google.common.hash.Hashing;
import com.google.common.primitives.Bytes;
import com.google.common.primitives.UnsignedBytes;
import com.google.protobuf.InvalidProtocolBufferException;
import com.palantir.atlasdb.compress.CompressionUtils;
import com.palantir.atlasdb.encoding.PtBytes;
import com.palantir.atlasdb.keyvalue.api.BatchColumnRangeSelection;
import com.palantir.atlasdb.keyvalue.api.Cell;
import com.palantir.atlasdb.keyvalue.api.ColumnRangeSelection;
import com.palantir.atlasdb.keyvalue.api.ColumnRangeSelections;
import com.palantir.atlasdb.keyvalue.api.ColumnSelection;
import com.palantir.atlasdb.keyvalue.api.Namespace;
import com.palantir.atlasdb.keyvalue.api.Prefix;
import com.palantir.atlasdb.keyvalue.api.RangeRequest;
import com.palantir.atlasdb.keyvalue.api.RowResult;
import com.palantir.atlasdb.keyvalue.api.TableReference;
import com.palantir.atlasdb.keyvalue.impl.Cells;
import com.palantir.atlasdb.ptobject.EncodingUtils;
import com.palantir.atlasdb.table.api.AtlasDbDynamicMutablePersistentTable;
import com.palantir.atlasdb.table.api.AtlasDbMutablePersistentTable;
import com.palantir.atlasdb.table.api.AtlasDbNamedMutableTable;
import com.palantir.atlasdb.table.api.AtlasDbNamedPersistentSet;
import com.palantir.atlasdb.table.api.ColumnValue;
import com.palantir.atlasdb.table.api.TypedRowResult;
import com.palantir.atlasdb.table.description.ColumnValueDescription.Compression;
import com.palantir.atlasdb.table.description.ValueType;
import com.palantir.atlasdb.table.generation.ColumnValues;
import com.palantir.atlasdb.table.generation.Descending;
import com.palantir.atlasdb.table.generation.NamedColumnValue;
import com.palantir.atlasdb.transaction.api.AtlasDbConstraintCheckingMode;
import com.palantir.atlasdb.transaction.api.ConstraintCheckingTransaction;
import com.palantir.atlasdb.transaction.api.Transaction;
import com.palantir.common.base.AbortingVisitor;
import com.palantir.common.base.AbortingVisitors;
import com.palantir.common.base.BatchingVisitable;
import com.palantir.common.base.BatchingVisitableView;
import com.palantir.common.base.BatchingVisitables;
import com.palantir.common.base.Throwables;
import com.palantir.common.collect.IterableView;
import com.palantir.common.persist.Persistable;
import com.palantir.common.persist.Persistable.Hydrator;
import com.palantir.common.persist.Persistables;
import com.palantir.util.AssertUtils;
import com.palantir.util.crypto.Sha256Hash;
@Generated("com.palantir.atlasdb.table.description.render.TableRenderer")
@SuppressWarnings("all")
public final class SweepableCellsTable implements
AtlasDbDynamicMutablePersistentTable<SweepableCellsTable.SweepableCellsRow,
SweepableCellsTable.SweepableCellsColumn,
SweepableCellsTable.SweepableCellsColumnValue,
SweepableCellsTable.SweepableCellsRowResult> {
private final Transaction t;
private final List<SweepableCellsTrigger> triggers;
private final static String rawTableName = "sweepableCells";
private final TableReference tableRef;
private final static ColumnSelection allColumns = ColumnSelection.all();
static SweepableCellsTable of(Transaction t, Namespace namespace) {
return new SweepableCellsTable(t, namespace, ImmutableList.<SweepableCellsTrigger>of());
}
static SweepableCellsTable of(Transaction t, Namespace namespace, SweepableCellsTrigger trigger, SweepableCellsTrigger... triggers) {
return new SweepableCellsTable(t, namespace, ImmutableList.<SweepableCellsTrigger>builder().add(trigger).add(triggers).build());
}
static SweepableCellsTable of(Transaction t, Namespace namespace, List<SweepableCellsTrigger> triggers) {
return new SweepableCellsTable(t, namespace, triggers);
}
private SweepableCellsTable(Transaction t, Namespace namespace, List<SweepableCellsTrigger> triggers) {
this.t = t;
this.tableRef = TableReference.create(namespace, rawTableName);
this.triggers = triggers;
}
public static String getRawTableName() {
return rawTableName;
}
public TableReference getTableRef() {
return tableRef;
}
public String getTableName() {
return tableRef.getQualifiedName();
}
public Namespace getNamespace() {
return tableRef.getNamespace();
}
/**
* <pre>
* SweepableCellsRow {
* {@literal Long hashOfRowComponents};
* {@literal Long timestampPartition};
* {@literal byte[] metadata};
* }
* </pre>
*/
public static final class SweepableCellsRow implements Persistable, Comparable<SweepableCellsRow> {
private final long hashOfRowComponents;
private final long timestampPartition;
private final byte[] metadata;
public static SweepableCellsRow of(long timestampPartition, byte[] metadata) {
long hashOfRowComponents = computeHashFirstComponents(timestampPartition, metadata);
return new SweepableCellsRow(hashOfRowComponents, timestampPartition, metadata);
}
private SweepableCellsRow(long hashOfRowComponents, long timestampPartition, byte[] metadata) {
this.hashOfRowComponents = hashOfRowComponents;
this.timestampPartition = timestampPartition;
this.metadata = metadata;
}
public long getTimestampPartition() {
return timestampPartition;
}
public byte[] getMetadata() {
return metadata;
}
public static Function<SweepableCellsRow, Long> getTimestampPartitionFun() {
return new Function<SweepableCellsRow, Long>() {
@Override
public Long apply(SweepableCellsRow row) {
return row.timestampPartition;
}
};
}
public static Function<SweepableCellsRow, byte[]> getMetadataFun() {
return new Function<SweepableCellsRow, byte[]>() {
@Override
public byte[] apply(SweepableCellsRow row) {
return row.metadata;
}
};
}
@Override
public byte[] persistToBytes() {
byte[] hashOfRowComponentsBytes = PtBytes.toBytes(Long.MIN_VALUE ^ hashOfRowComponents);
byte[] timestampPartitionBytes = EncodingUtils.encodeUnsignedVarLong(timestampPartition);
byte[] metadataBytes = metadata;
return EncodingUtils.add(hashOfRowComponentsBytes, timestampPartitionBytes, metadataBytes);
}
public static final Hydrator<SweepableCellsRow> BYTES_HYDRATOR = new Hydrator<SweepableCellsRow>() {
@Override
public SweepableCellsRow hydrateFromBytes(byte[] __input) {
int __index = 0;
Long hashOfRowComponents = Long.MIN_VALUE ^ PtBytes.toLong(__input, __index);
__index += 8;
Long timestampPartition = EncodingUtils.decodeUnsignedVarLong(__input, __index);
__index += EncodingUtils.sizeOfUnsignedVarLong(timestampPartition);
byte[] metadata = EncodingUtils.getBytesFromOffsetToEnd(__input, __index);
__index += 0;
return new SweepableCellsRow(hashOfRowComponents, timestampPartition, metadata);
}
};
public static long computeHashFirstComponents(long timestampPartition, byte[] metadata) {
byte[] timestampPartitionBytes = EncodingUtils.encodeUnsignedVarLong(timestampPartition);
byte[] metadataBytes = metadata;
return Hashing.murmur3_128().hashBytes(EncodingUtils.add(timestampPartitionBytes, metadataBytes)).asLong();
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass().getSimpleName())
.add("hashOfRowComponents", hashOfRowComponents)
.add("timestampPartition", timestampPartition)
.add("metadata", metadata)
.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
SweepableCellsRow other = (SweepableCellsRow) obj;
return Objects.equal(hashOfRowComponents, other.hashOfRowComponents) && Objects.equal(timestampPartition, other.timestampPartition) && Arrays.equals(metadata, other.metadata);
}
@SuppressWarnings("ArrayHashCode")
@Override
public int hashCode() {
return Arrays.deepHashCode(new Object[]{ hashOfRowComponents, timestampPartition, metadata });
}
@Override
public int compareTo(SweepableCellsRow o) {
return ComparisonChain.start()
.compare(this.hashOfRowComponents, o.hashOfRowComponents)
.compare(this.timestampPartition, o.timestampPartition)
.compare(this.metadata, o.metadata, UnsignedBytes.lexicographicalComparator())
.result();
}
}
/**
* <pre>
* SweepableCellsColumn {
* {@literal Long timestampModulus};
* {@literal Long writeIndex};
* }
* </pre>
*/
public static final class SweepableCellsColumn implements Persistable, Comparable<SweepableCellsColumn> {
private final long timestampModulus;
private final long writeIndex;
public static SweepableCellsColumn of(long timestampModulus, long writeIndex) {
return new SweepableCellsColumn(timestampModulus, writeIndex);
}
private SweepableCellsColumn(long timestampModulus, long writeIndex) {
this.timestampModulus = timestampModulus;
this.writeIndex = writeIndex;
}
public long getTimestampModulus() {
return timestampModulus;
}
public long getWriteIndex() {
return writeIndex;
}
public static Function<SweepableCellsColumn, Long> getTimestampModulusFun() {
return new Function<SweepableCellsColumn, Long>() {
@Override
public Long apply(SweepableCellsColumn row) {
return row.timestampModulus;
}
};
}
public static Function<SweepableCellsColumn, Long> getWriteIndexFun() {
return new Function<SweepableCellsColumn, Long>() {
@Override
public Long apply(SweepableCellsColumn row) {
return row.writeIndex;
}
};
}
@Override
public byte[] persistToBytes() {
byte[] timestampModulusBytes = EncodingUtils.encodeUnsignedVarLong(timestampModulus);
byte[] writeIndexBytes = EncodingUtils.encodeSignedVarLong(writeIndex);
return EncodingUtils.add(timestampModulusBytes, writeIndexBytes);
}
public static final Hydrator<SweepableCellsColumn> BYTES_HYDRATOR = new Hydrator<SweepableCellsColumn>() {
@Override
public SweepableCellsColumn hydrateFromBytes(byte[] __input) {
int __index = 0;
Long timestampModulus = EncodingUtils.decodeUnsignedVarLong(__input, __index);
__index += EncodingUtils.sizeOfUnsignedVarLong(timestampModulus);
Long writeIndex = EncodingUtils.decodeSignedVarLong(__input, __index);
__index += EncodingUtils.sizeOfSignedVarLong(writeIndex);
return new SweepableCellsColumn(timestampModulus, writeIndex);
}
};
public static BatchColumnRangeSelection createPrefixRange(long timestampModulus, int batchSize) {
byte[] timestampModulusBytes = EncodingUtils.encodeUnsignedVarLong(timestampModulus);
return ColumnRangeSelections.createPrefixRange(EncodingUtils.add(timestampModulusBytes), batchSize);
}
public static Prefix prefix(long timestampModulus) {
byte[] timestampModulusBytes = EncodingUtils.encodeUnsignedVarLong(timestampModulus);
return new Prefix(EncodingUtils.add(timestampModulusBytes));
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass().getSimpleName())
.add("timestampModulus", timestampModulus)
.add("writeIndex", writeIndex)
.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
SweepableCellsColumn other = (SweepableCellsColumn) obj;
return Objects.equal(timestampModulus, other.timestampModulus) && Objects.equal(writeIndex, other.writeIndex);
}
@SuppressWarnings("ArrayHashCode")
@Override
public int hashCode() {
return Arrays.deepHashCode(new Object[]{ timestampModulus, writeIndex });
}
@Override
public int compareTo(SweepableCellsColumn o) {
return ComparisonChain.start()
.compare(this.timestampModulus, o.timestampModulus)
.compare(this.writeIndex, o.writeIndex)
.result();
}
}
public interface SweepableCellsTrigger {
public void putSweepableCells(Multimap<SweepableCellsRow, ? extends SweepableCellsColumnValue> newRows);
}
/**
* <pre>
* Column name description {
* {@literal Long timestampModulus};
* {@literal Long writeIndex};
* }
* Column value description {
* type: com.palantir.atlasdb.keyvalue.api.WriteReference;
* }
* </pre>
*/
public static final class SweepableCellsColumnValue implements ColumnValue<com.palantir.atlasdb.keyvalue.api.WriteReference> {
private final SweepableCellsColumn columnName;
private final com.palantir.atlasdb.keyvalue.api.WriteReference value;
public static SweepableCellsColumnValue of(SweepableCellsColumn columnName, com.palantir.atlasdb.keyvalue.api.WriteReference value) {
return new SweepableCellsColumnValue(columnName, value);
}
private SweepableCellsColumnValue(SweepableCellsColumn columnName, com.palantir.atlasdb.keyvalue.api.WriteReference value) {
this.columnName = columnName;
this.value = value;
}
public SweepableCellsColumn getColumnName() {
return columnName;
}
@Override
public com.palantir.atlasdb.keyvalue.api.WriteReference getValue() {
return value;
}
@Override
public byte[] persistColumnName() {
return columnName.persistToBytes();
}
@Override
public byte[] persistValue() {
byte[] bytes = value.persistToBytes();
return CompressionUtils.compress(bytes, Compression.NONE);
}
public static com.palantir.atlasdb.keyvalue.api.WriteReference hydrateValue(byte[] bytes) {
bytes = CompressionUtils.decompress(bytes, Compression.NONE);
return com.palantir.atlasdb.keyvalue.api.WriteReference.BYTES_HYDRATOR.hydrateFromBytes(bytes);
}
public static Function<SweepableCellsColumnValue, SweepableCellsColumn> getColumnNameFun() {
return new Function<SweepableCellsColumnValue, SweepableCellsColumn>() {
@Override
public SweepableCellsColumn apply(SweepableCellsColumnValue columnValue) {
return columnValue.getColumnName();
}
};
}
public static Function<SweepableCellsColumnValue, com.palantir.atlasdb.keyvalue.api.WriteReference> getValueFun() {
return new Function<SweepableCellsColumnValue, com.palantir.atlasdb.keyvalue.api.WriteReference>() {
@Override
public com.palantir.atlasdb.keyvalue.api.WriteReference apply(SweepableCellsColumnValue columnValue) {
return columnValue.getValue();
}
};
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass().getSimpleName())
.add("ColumnName", this.columnName)
.add("Value", this.value)
.toString();
}
}
public static final class SweepableCellsRowResult implements TypedRowResult {
private final SweepableCellsRow rowName;
private final ImmutableSet<SweepableCellsColumnValue> columnValues;
public static SweepableCellsRowResult of(RowResult<byte[]> rowResult) {
SweepableCellsRow rowName = SweepableCellsRow.BYTES_HYDRATOR.hydrateFromBytes(rowResult.getRowName());
Set<SweepableCellsColumnValue> columnValues = Sets.newHashSetWithExpectedSize(rowResult.getColumns().size());
for (Entry<byte[], byte[]> e : rowResult.getColumns().entrySet()) {
SweepableCellsColumn col = SweepableCellsColumn.BYTES_HYDRATOR.hydrateFromBytes(e.getKey());
com.palantir.atlasdb.keyvalue.api.WriteReference value = SweepableCellsColumnValue.hydrateValue(e.getValue());
columnValues.add(SweepableCellsColumnValue.of(col, value));
}
return new SweepableCellsRowResult(rowName, ImmutableSet.copyOf(columnValues));
}
private SweepableCellsRowResult(SweepableCellsRow rowName, ImmutableSet<SweepableCellsColumnValue> columnValues) {
this.rowName = rowName;
this.columnValues = columnValues;
}
@Override
public SweepableCellsRow getRowName() {
return rowName;
}
public Set<SweepableCellsColumnValue> getColumnValues() {
return columnValues;
}
public static Function<SweepableCellsRowResult, SweepableCellsRow> getRowNameFun() {
return new Function<SweepableCellsRowResult, SweepableCellsRow>() {
@Override
public SweepableCellsRow apply(SweepableCellsRowResult rowResult) {
return rowResult.rowName;
}
};
}
public static Function<SweepableCellsRowResult, ImmutableSet<SweepableCellsColumnValue>> getColumnValuesFun() {
return new Function<SweepableCellsRowResult, ImmutableSet<SweepableCellsColumnValue>>() {
@Override
public ImmutableSet<SweepableCellsColumnValue> apply(SweepableCellsRowResult rowResult) {
return rowResult.columnValues;
}
};
}
@Override
public String toString() {
return MoreObjects.toStringHelper(getClass().getSimpleName())
.add("RowName", getRowName())
.add("ColumnValues", getColumnValues())
.toString();
}
}
@Override
public void delete(SweepableCellsRow row, SweepableCellsColumn column) {
delete(ImmutableMultimap.of(row, column));
}
@Override
public void delete(Iterable<SweepableCellsRow> rows) {
Multimap<SweepableCellsRow, SweepableCellsColumn> toRemove = HashMultimap.create();
Multimap<SweepableCellsRow, SweepableCellsColumnValue> result = getRowsMultimap(rows);
for (Entry<SweepableCellsRow, SweepableCellsColumnValue> e : result.entries()) {
toRemove.put(e.getKey(), e.getValue().getColumnName());
}
delete(toRemove);
}
@Override
public void delete(Multimap<SweepableCellsRow, SweepableCellsColumn> values) {
t.delete(tableRef, ColumnValues.toCells(values));
}
@Override
public void put(SweepableCellsRow rowName, Iterable<SweepableCellsColumnValue> values) {
put(ImmutableMultimap.<SweepableCellsRow, SweepableCellsColumnValue>builder().putAll(rowName, values).build());
}
@Override
public void put(SweepableCellsRow rowName, SweepableCellsColumnValue... values) {
put(ImmutableMultimap.<SweepableCellsRow, SweepableCellsColumnValue>builder().putAll(rowName, values).build());
}
@Override
public void put(Multimap<SweepableCellsRow, ? extends SweepableCellsColumnValue> values) {
t.useTable(tableRef, this);
t.put(tableRef, ColumnValues.toCellValues(values));
for (SweepableCellsTrigger trigger : triggers) {
trigger.putSweepableCells(values);
}
}
/** @deprecated Use separate read and write in a single transaction instead. */
@Deprecated
public void putUnlessExists(SweepableCellsRow rowName, Iterable<SweepableCellsColumnValue> values) {
putUnlessExists(ImmutableMultimap.<SweepableCellsRow, SweepableCellsColumnValue>builder().putAll(rowName, values).build());
}
/** @deprecated Use separate read and write in a single transaction instead. */
@Deprecated
public void putUnlessExists(SweepableCellsRow rowName, SweepableCellsColumnValue... values) {
putUnlessExists(ImmutableMultimap.<SweepableCellsRow, SweepableCellsColumnValue>builder().putAll(rowName, values).build());
}
/** @deprecated Use separate read and write in a single transaction instead. */
@Deprecated
public void putUnlessExists(Multimap<SweepableCellsRow, ? extends SweepableCellsColumnValue> rows) {
Multimap<SweepableCellsRow, SweepableCellsColumn> toGet = Multimaps.transformValues(rows, SweepableCellsColumnValue.getColumnNameFun());
Multimap<SweepableCellsRow, SweepableCellsColumnValue> existing = get(toGet);
Multimap<SweepableCellsRow, SweepableCellsColumnValue> toPut = HashMultimap.create();
for (Entry<SweepableCellsRow, ? extends SweepableCellsColumnValue> entry : rows.entries()) {
if (!existing.containsEntry(entry.getKey(), entry.getValue())) {
toPut.put(entry.getKey(), entry.getValue());
}
}
put(toPut);
}
@Override
public void touch(Multimap<SweepableCellsRow, SweepableCellsColumn> values) {
Multimap<SweepableCellsRow, SweepableCellsColumnValue> currentValues = get(values);
put(currentValues);
Multimap<SweepableCellsRow, SweepableCellsColumn> toDelete = HashMultimap.create(values);
for (Map.Entry<SweepableCellsRow, SweepableCellsColumnValue> e : currentValues.entries()) {
toDelete.remove(e.getKey(), e.getValue().getColumnName());
}
delete(toDelete);
}
public static ColumnSelection getColumnSelection(Collection<SweepableCellsColumn> cols) {
return ColumnSelection.create(Collections2.transform(cols, Persistables.persistToBytesFunction()));
}
public static ColumnSelection getColumnSelection(SweepableCellsColumn... cols) {
return getColumnSelection(Arrays.asList(cols));
}
@Override
public Multimap<SweepableCellsRow, SweepableCellsColumnValue> get(Multimap<SweepableCellsRow, SweepableCellsColumn> cells) {
Set<Cell> rawCells = ColumnValues.toCells(cells);
Map<Cell, byte[]> rawResults = t.get(tableRef, rawCells);
Multimap<SweepableCellsRow, SweepableCellsColumnValue> rowMap = HashMultimap.create();
for (Entry<Cell, byte[]> e : rawResults.entrySet()) {
if (e.getValue().length > 0) {
SweepableCellsRow row = SweepableCellsRow.BYTES_HYDRATOR.hydrateFromBytes(e.getKey().getRowName());
SweepableCellsColumn col = SweepableCellsColumn.BYTES_HYDRATOR.hydrateFromBytes(e.getKey().getColumnName());
com.palantir.atlasdb.keyvalue.api.WriteReference val = SweepableCellsColumnValue.hydrateValue(e.getValue());
rowMap.put(row, SweepableCellsColumnValue.of(col, val));
}
}
return rowMap;
}
@Override
public List<SweepableCellsColumnValue> getRowColumns(SweepableCellsRow row) {
return getRowColumns(row, allColumns);
}
@Override
public List<SweepableCellsColumnValue> getRowColumns(SweepableCellsRow row, ColumnSelection columns) {
byte[] bytes = row.persistToBytes();
RowResult<byte[]> rowResult = t.getRows(tableRef, ImmutableSet.of(bytes), columns).get(bytes);
if (rowResult == null) {
return ImmutableList.of();
} else {
List<SweepableCellsColumnValue> ret = Lists.newArrayListWithCapacity(rowResult.getColumns().size());
for (Entry<byte[], byte[]> e : rowResult.getColumns().entrySet()) {
SweepableCellsColumn col = SweepableCellsColumn.BYTES_HYDRATOR.hydrateFromBytes(e.getKey());
com.palantir.atlasdb.keyvalue.api.WriteReference val = SweepableCellsColumnValue.hydrateValue(e.getValue());
ret.add(SweepableCellsColumnValue.of(col, val));
}
return ret;
}
}
@Override
public Multimap<SweepableCellsRow, SweepableCellsColumnValue> getRowsMultimap(Iterable<SweepableCellsRow> rows) {
return getRowsMultimapInternal(rows, allColumns);
}
@Override
public Multimap<SweepableCellsRow, SweepableCellsColumnValue> getRowsMultimap(Iterable<SweepableCellsRow> rows, ColumnSelection columns) {
return getRowsMultimapInternal(rows, columns);
}
private Multimap<SweepableCellsRow, SweepableCellsColumnValue> getRowsMultimapInternal(Iterable<SweepableCellsRow> rows, ColumnSelection columns) {
SortedMap<byte[], RowResult<byte[]>> results = t.getRows(tableRef, Persistables.persistAll(rows), columns);
return getRowMapFromRowResults(results.values());
}
private static Multimap<SweepableCellsRow, SweepableCellsColumnValue> getRowMapFromRowResults(Collection<RowResult<byte[]>> rowResults) {
Multimap<SweepableCellsRow, SweepableCellsColumnValue> rowMap = HashMultimap.create();
for (RowResult<byte[]> result : rowResults) {
SweepableCellsRow row = SweepableCellsRow.BYTES_HYDRATOR.hydrateFromBytes(result.getRowName());
for (Entry<byte[], byte[]> e : result.getColumns().entrySet()) {
SweepableCellsColumn col = SweepableCellsColumn.BYTES_HYDRATOR.hydrateFromBytes(e.getKey());
com.palantir.atlasdb.keyvalue.api.WriteReference val = SweepableCellsColumnValue.hydrateValue(e.getValue());
rowMap.put(row, SweepableCellsColumnValue.of(col, val));
}
}
return rowMap;
}
@Override
public Map<SweepableCellsRow, BatchingVisitable<SweepableCellsColumnValue>> getRowsColumnRange(Iterable<SweepableCellsRow> rows, BatchColumnRangeSelection columnRangeSelection) {
Map<byte[], BatchingVisitable<Map.Entry<Cell, byte[]>>> results = t.getRowsColumnRange(tableRef, Persistables.persistAll(rows), columnRangeSelection);
Map<SweepableCellsRow, BatchingVisitable<SweepableCellsColumnValue>> transformed = Maps.newHashMapWithExpectedSize(results.size());
for (Entry<byte[], BatchingVisitable<Map.Entry<Cell, byte[]>>> e : results.entrySet()) {
SweepableCellsRow row = SweepableCellsRow.BYTES_HYDRATOR.hydrateFromBytes(e.getKey());
BatchingVisitable<SweepableCellsColumnValue> bv = BatchingVisitables.transform(e.getValue(), result -> {
SweepableCellsColumn col = SweepableCellsColumn.BYTES_HYDRATOR.hydrateFromBytes(result.getKey().getColumnName());
com.palantir.atlasdb.keyvalue.api.WriteReference val = SweepableCellsColumnValue.hydrateValue(result.getValue());
return SweepableCellsColumnValue.of(col, val);
});
transformed.put(row, bv);
}
return transformed;
}
@Override
public Iterator<Map.Entry<SweepableCellsRow, SweepableCellsColumnValue>> getRowsColumnRange(Iterable<SweepableCellsRow> rows, ColumnRangeSelection columnRangeSelection, int batchHint) {
Iterator<Map.Entry<Cell, byte[]>> results = t.getRowsColumnRange(getTableRef(), Persistables.persistAll(rows), columnRangeSelection, batchHint);
return Iterators.transform(results, e -> {
SweepableCellsRow row = SweepableCellsRow.BYTES_HYDRATOR.hydrateFromBytes(e.getKey().getRowName());
SweepableCellsColumn col = SweepableCellsColumn.BYTES_HYDRATOR.hydrateFromBytes(e.getKey().getColumnName());
com.palantir.atlasdb.keyvalue.api.WriteReference val = SweepableCellsColumnValue.hydrateValue(e.getValue());
SweepableCellsColumnValue colValue = SweepableCellsColumnValue.of(col, val);
return Maps.immutableEntry(row, colValue);
});
}
public BatchingVisitableView<SweepableCellsRowResult> getAllRowsUnordered() {
return getAllRowsUnordered(allColumns);
}
public BatchingVisitableView<SweepableCellsRowResult> getAllRowsUnordered(ColumnSelection columns) {
return BatchingVisitables.transform(t.getRange(tableRef, RangeRequest.builder().retainColumns(columns).build()),
new Function<RowResult<byte[]>, SweepableCellsRowResult>() {
@Override
public SweepableCellsRowResult apply(RowResult<byte[]> input) {
return SweepableCellsRowResult.of(input);
}
});
}
@Override
public List<String> findConstraintFailures(Map<Cell, byte[]> writes,
ConstraintCheckingTransaction transaction,
AtlasDbConstraintCheckingMode constraintCheckingMode) {
return ImmutableList.of();
}
@Override
public List<String> findConstraintFailuresNoRead(Map<Cell, byte[]> writes,
AtlasDbConstraintCheckingMode constraintCheckingMode) {
return ImmutableList.of();
}
/**
* This exists to avoid unused import warnings
* {@link AbortingVisitor}
* {@link AbortingVisitors}
* {@link ArrayListMultimap}
* {@link Arrays}
* {@link AssertUtils}
* {@link AtlasDbConstraintCheckingMode}
* {@link AtlasDbDynamicMutablePersistentTable}
* {@link AtlasDbMutablePersistentTable}
* {@link AtlasDbNamedMutableTable}
* {@link AtlasDbNamedPersistentSet}
* {@link BatchColumnRangeSelection}
* {@link BatchingVisitable}
* {@link BatchingVisitableView}
* {@link BatchingVisitables}
* {@link BiFunction}
* {@link Bytes}
* {@link Callable}
* {@link Cell}
* {@link Cells}
* {@link Collection}
* {@link Collections2}
* {@link ColumnRangeSelection}
* {@link ColumnRangeSelections}
* {@link ColumnSelection}
* {@link ColumnValue}
* {@link ColumnValues}
* {@link ComparisonChain}
* {@link Compression}
* {@link CompressionUtils}
* {@link ConstraintCheckingTransaction}
* {@link Descending}
* {@link EncodingUtils}
* {@link Entry}
* {@link EnumSet}
* {@link Function}
* {@link Generated}
* {@link HashMultimap}
* {@link HashSet}
* {@link Hashing}
* {@link Hydrator}
* {@link ImmutableList}
* {@link ImmutableMap}
* {@link ImmutableMultimap}
* {@link ImmutableSet}
* {@link InvalidProtocolBufferException}
* {@link IterableView}
* {@link Iterables}
* {@link Iterator}
* {@link Iterators}
* {@link Joiner}
* {@link List}
* {@link Lists}
* {@link Map}
* {@link Maps}
* {@link MoreObjects}
* {@link Multimap}
* {@link Multimaps}
* {@link NamedColumnValue}
* {@link Namespace}
* {@link Objects}
* {@link Optional}
* {@link Persistable}
* {@link Persistables}
* {@link Prefix}
* {@link PtBytes}
* {@link RangeRequest}
* {@link RowResult}
* {@link Set}
* {@link Sets}
* {@link Sha256Hash}
* {@link SortedMap}
* {@link Stream}
* {@link Supplier}
* {@link TableReference}
* {@link Throwables}
* {@link TimeUnit}
* {@link Transaction}
* {@link TypedRowResult}
* {@link UUID}
* {@link UnsignedBytes}
* {@link ValueType}
*/
static String __CLASS_HASH = "FRzatgmfV4F4++k+S8syLQ==";
}
| [
"[email protected]"
]
| |
d51d2161e6089f59ef82ad0351c5ed75053743f8 | 7b733d7be68f0fa4df79359b57e814f5253fc72d | /projects/sitemanage/src/main/java/com/percussion/assetmanagement/data/PSOrphanedAssetSummary.java | c7f8f8d11715db6db6764b046c2bf013a7093098 | [
"LicenseRef-scancode-dco-1.1",
"Apache-2.0",
"OFL-1.1",
"LGPL-2.0-or-later"
]
| permissive | percussion/percussioncms | 318ac0ef62dce12eb96acf65fc658775d15d95ad | c8527de53c626097d589dc28dba4a4b5d6e4dd2b | refs/heads/development | 2023-08-31T14:34:09.593627 | 2023-08-31T14:04:23 | 2023-08-31T14:04:23 | 331,373,975 | 18 | 6 | Apache-2.0 | 2023-09-14T21:29:25 | 2021-01-20T17:03:38 | Java | UTF-8 | Java | false | false | 2,123 | java | /*
* Copyright 1999-2023 Percussion Software, Inc.
*
* 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.percussion.assetmanagement.data;
import com.percussion.share.data.PSDataItemSummary;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Class to use internally to use attributes from orphan assets.
*
* @author Santiago M. Murchio
*
*/
@XmlRootElement
public class PSOrphanedAssetSummary extends PSDataItemSummary
{
private static final long serialVersionUID = 1L;
/**
* Represents the SLOT_ID field from a {@link PSRelationship} object.
*/
private String slotId;
/**
* Represents the WIDGET_NAME field from a {@link PSRelationship} object.
*/
private String widgetName;
private int relationshipId;
public PSOrphanedAssetSummary()
{
super();
}
public PSOrphanedAssetSummary(String assetId, String slotId, String widgetName, int relationshipId)
{
setId(assetId);
this.slotId = slotId;
this.widgetName = widgetName;
this.relationshipId = relationshipId;
}
public String getSlotId()
{
return slotId;
}
public void setSlotId(String slotId)
{
this.slotId = slotId;
}
public String getWidgetName()
{
return widgetName;
}
public void setWidgetName(String widgetName)
{
this.widgetName = widgetName;
}
public int getRelationshipId()
{
return relationshipId;
}
public void setRelationshipId(int id)
{
relationshipId = id;
}
}
| [
"[email protected]"
]
| |
66225b6018082523ad3b1d917f08e3d3db19dff8 | 7b74ac50a997b0fc30726b619f29fc29e1fa6ac6 | /app/src/main/java/octavianionel/it/obtainlocationpermissionsandtransformlocationtoaddress/GPSTracker.java | 7d9c4676f1e5a97d198432b2f07ceb74937ca299 | [
"Apache-2.0"
]
| permissive | morristech/AndroidObtainLocationPermissionsAndTransformLocationToAddress | c199b1f1d2db01bca0496419d64a8ab0f2b79c1b | 191132e7c73dc0f6b4809bcc64c2d5a6f6e91e26 | refs/heads/master | 2020-05-31T14:01:05.957421 | 2018-04-12T14:32:15 | 2018-04-12T14:32:15 | 190,319,279 | 1 | 0 | null | 2019-06-05T03:25:19 | 2019-06-05T03:25:19 | null | UTF-8 | Java | false | false | 6,264 | java | package octavianionel.it.obtainlocationpermissionsandtransformlocationtoaddress;
import android.Manifest;
import android.app.Activity;
import android.app.Service;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.IBinder;
import android.support.v4.app.ActivityCompat;
import android.util.Log;
/**
* Created by Reply on 02/03/2018.
*/
public class GPSTracker extends Service implements LocationListener, LoginActivity.UnregisterFromLocationListener {
private final Activity mActivity;
// flag for GPS status
boolean isGPSEnabled = false;
// flag for network status
boolean isNetworkEnabled = false;
// flag for GPS status
boolean canGetLocation = false;
Location location; // location
double latitude; // latitude
double longitude; // longitude
// The minimum distance to change Updates in meters
private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters
// The minimum time between updates in milliseconds
private static final long MIN_TIME_BW_UPDATES = 1000 * 60 * 1; // 1 minute
// Declaring a Location Manager
protected LocationManager locationManager;
public GPSTracker(Activity activity) {
this.mActivity = activity;
getLocation();
}
public Location getLocation() {
if (ActivityCompat.checkSelfPermission(mActivity, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(mActivity, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return null;
}
try {
locationManager = (LocationManager) mActivity.getSystemService(LOCATION_SERVICE);
// getting GPS status
isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
// getting network status
isNetworkEnabled = locationManager
.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
if (!isGPSEnabled && !isNetworkEnabled) {
// no network provider is enabled
} else {
this.canGetLocation = true;
// First get location from Network Provider
if (isNetworkEnabled) {
locationManager.requestLocationUpdates(
LocationManager.NETWORK_PROVIDER,
MIN_TIME_BW_UPDATES,
MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
Log.d("Network", "Network");
if (locationManager != null) {
location = locationManager
.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
if (location != null) {
latitude = location.getLatitude();
longitude = location.getLongitude();
}
}
}
// if GPS Enabled get lat/long using GPS Services
if (isGPSEnabled) {
if (location == null) {
locationManager.requestLocationUpdates(
LocationManager.GPS_PROVIDER,
MIN_TIME_BW_UPDATES,
MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
Log.d("GPS Enabled", "GPS Enabled");
if (locationManager != null) {
location = locationManager
.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if (location != null) {
latitude = location.getLatitude();
longitude = location.getLongitude();
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return location;
}
/**
* Stop using GPS listener
* Calling this function will stop using GPS in your app
* */
public void stopUsingGPS(){
if(locationManager != null){
locationManager.removeUpdates(GPSTracker.this);
}
}
/**
* Function to get latitude
* */
public double getLatitude(){
if(location != null){
latitude = location.getLatitude();
}
// return latitude
return latitude;
}
/**
* Function to get longitude
* */
public double getLongitude(){
if(location != null){
longitude = location.getLongitude();
}
// return longitude
return longitude;
}
/**
* Function to check GPS/wifi enabled
* @return boolean
* */
public boolean canGetLocation() {
return this.canGetLocation;
}
@Override
public void onLocationChanged(Location location) {
if (location != null) {
latitude = location.getLatitude();
longitude = location.getLongitude();
}
}
@Override
public void onProviderDisabled(String provider) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public IBinder onBind(Intent arg0) {
return null;
}
@Override
public void unregisterListener() {
stopUsingGPS();
}
}
| [
"[email protected]"
]
| |
f0033697ed42f3f780d59a37d1e9dd11a301a67a | 85ff7407da7836d47b60688accde3396301cdcc6 | /app/src/main/java/com/fenxiangditu/sharemap/ui/IListDataView.java | 90286dffb408e4aa424e688f6bd7ebee4409a59b | [
"MIT"
]
| permissive | jiantao88/shareMap | b1a5f128c5bc61513b92fd5749160fae3e5c9252 | d5c488d8c5385bd705ba9780fd2eb928351af9d4 | refs/heads/master | 2020-03-10T11:45:10.057776 | 2018-06-29T10:31:19 | 2018-06-29T10:31:19 | 129,362,634 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 391 | java | package com.fenxiangditu.sharemap.ui;
import java.util.List;
/**
* date: 2018/3/7
*/
public interface IListDataView<T> extends IView {
int getPage();
void setData(List<T> data);
List<T> getData();
void showContent(); //显示内容
void autoLoadMore();//自动加载
void clearListData();//清空所有数据
void showNoMore();//没有更多数据
}
| [
"[email protected]"
]
| |
7bd33735d6a3f93e6efce8491fe1fee7fbe47f71 | c41e17043e01f7d1a0cf28091aee3189da6e3301 | /src/main/java/com/power/spring/proxy/ProxyScanner.java | d3d5aafef05a2a924982c1fec15364227d7550b5 | []
| no_license | power9li/spring-lesson4-2 | b80033e5f64b6fa69099f72f2fb1e742df294022 | 990c8e73063a0dfe1b66c8b5a4fab3fe3b48567b | refs/heads/master | 2021-05-02T01:03:28.060022 | 2017-01-16T17:56:55 | 2017-01-16T17:56:55 | 78,707,879 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,524 | java | package com.power.spring.proxy;
import com.power.spring.annotations.MethodProxy;
import com.power.spring.utils.PackageScanner;
import com.power.spring.utils.PropUtils;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* Created by shenli on 2017/1/3.
*/
public class ProxyScanner {
public static class ProxyItem{
private Class clazz;
private String methodName;
private Proxy proxy;
public ProxyItem(Class clazz, String methodName, Proxy proxy) {
this.clazz = clazz;
this.methodName = methodName;
this.proxy = proxy;
}
public Class getClazz() {
return clazz;
}
public String getMethodName() {
return methodName;
}
public Proxy getProxy() {
return proxy;
}
}
private static Map<String, ProxyItem> proxyItemHashMap = new HashMap<>();
public static void init(){
System.out.println("ProxyScanner.init");
String scanPkg = PropUtils.getProp("proxy.scan.package");
// System.out.println(" scanPkg = " + scanPkg);
Set<Class<?>> allclasses = PackageScanner.findFileClass(scanPkg);
for (Class clazz: allclasses) {
// System.out.println(" .. scan clazz = " + clazz);
if(Proxy.class.isAssignableFrom(clazz)){
MethodProxy proxy = (MethodProxy)clazz.getAnnotation(MethodProxy.class);
if(proxy != null) {
Class clz = proxy.clazz();
String methodName = proxy.methodName();
System.out.println(" .. ADD -> clazz = " + clz + ",methodName=" + methodName);
try {
Object instance = clazz.newInstance();
String key = clz.getName() + "-" + methodName;
System.out.println("key input = " + key);
proxyItemHashMap.put(key, new ProxyItem(clz, methodName, (Proxy) instance));
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
public static ProxyItem getByClzMethod(Class clazz, String methodName) {
System.out.println("ProxyScanner.getByClzMethod(clazz="+clazz+",methodName="+methodName+")");
String key = clazz.getName() + "-" + methodName;
System.out.println("key get = " + key);
return proxyItemHashMap.get(key);
}
}
| [
"[email protected]"
]
| |
1983da4b47e33cba50640697887231c6f8ef102b | 13bc3251819c70f4aa602c51235a469850043072 | /src/Testsample/arraystack1.java | 49ae93ce78187b1282c3967956500b19ea95b35f | []
| no_license | gs-nyarlagadda/Test1 | c47d384f0354879a3a60f88856d2bf61aa96d58f | fba92d048ac2435289292f0e1478f2b5e1415ae6 | refs/heads/master | 2021-01-23T12:19:05.626576 | 2015-01-19T08:57:08 | 2015-01-19T08:57:08 | 28,437,818 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 851 | java | package Testsample;
import java.util.Scanner;
public class arraystack1 {
public static void main(String args[]){
Scanner input = new Scanner(System.in);
String[] answer = new String[4];
String[] exam = new String[4];
int result=0;
int total=0;
for(int i=0; i<=3; i++){
System.out.println("Enter markskey: ");
answer[i] = input.next();
}
for(int i=0; i<=3; i++){
System.out.println("Enter examkeys: ");
exam[i] = input.next();
}
input.close();
for(int i=0;i<=3;i++){
if(exam[i].equalsIgnoreCase("?")){
result = 0;
}
else{
if(answer[i].equals(exam[i])){
result = 4;
}
else{
result = -1;
}
}
total = result+total;
}
System.out.println("Total Marks = "+ total);
}
}
| [
"[email protected]"
]
| |
5b75a57ae820587c8fac3a4c0b5e9be5a1264e86 | d86f7a782da456a1e44f77c95f00c64cc4f8af0d | /account-service/src/main/java/com/doer/accountservice/AccountServiceApplication.java | 1932a7f09b75539f89c1c4a9bf97673e372567c0 | []
| no_license | doer20/Neteasework | 465f784a814eaab7d6ec5736db8ebc828bb16f2b | 524401d7a8966958843239e01f09c5f25fb6d267 | refs/heads/master | 2020-05-01T00:52:32.143232 | 2019-03-27T07:27:47 | 2019-03-27T07:27:47 | 177,180,303 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,817 | java | package com.doer.accountservice;
import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.security.Principal;
@EnableCircuitBreaker
@EnableDiscoveryClient
@SpringBootApplication
@EnableResourceServer
@RestController
@MapperScan("com.doer.accountservice.Mapper")
public class AccountServiceApplication {
public static void main(String[] args) {
SpringApplication.run(AccountServiceApplication.class, args);
}
@RequestMapping("/oauth/user")
public Principal user(Principal user) {
return user;
}
/*
* A bean used to monitor (turbine,hystrix dashboard)
*/
@Bean
public ServletRegistrationBean getServlet(){
HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
ServletRegistrationBean registrationBean = new ServletRegistrationBean(streamServlet);
registrationBean.setLoadOnStartup(1); //系统启动时加载顺序
registrationBean.addUrlMappings("/actuator/hystrix.stream");//路径
registrationBean.setName("HystrixMetricsStreamServlet");
return registrationBean;
}
}
| [
"[email protected]"
]
| |
2658535a7789039682cc2f67ea41893f10d09d19 | 90f00088244b59b80c9ef5f555a23dd30e086fda | /app/src/main/java/com/tesu/manicurehouse/adapter/VideoLableAdapter.java | 4ae23f405ec5110a36fd238bf5ea929579847465 | []
| no_license | liuminert/manicure_android1 | 0cd26dab9a5dab4de22ab6112d9e0c8a65bc3381 | 94945f85e41f0eb79be7f6cb9c87ec0ec9cf246c | refs/heads/master | 2021-06-27T18:16:15.956913 | 2017-09-11T08:24:14 | 2017-09-11T08:24:14 | 103,111,829 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,394 | java | package com.tesu.manicurehouse.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.tesu.manicurehouse.R;
import com.tesu.manicurehouse.bean.VideoLableBean;
import com.tesu.manicurehouse.support.PercentRelativeLayout;
import java.util.List;
/**
* 类描述:
* 创建人:许明达
* 创建时间:2016/04/14 10:49
* 修改备注:
*/
public class VideoLableAdapter extends BaseAdapter{
private String TAG="ClientListAdapter";
private List<VideoLableBean> lableResponseList;
private Context mContext;
private CommentImageAdapter commentImageAdapter;
public VideoLableAdapter(Context context, List<VideoLableBean> lableResponseList){
mContext=context;
this.lableResponseList=lableResponseList;
}
@Override
public Object getItem(int arg0) {
// TODO Auto-generated method stub
return lableResponseList.get(arg0);
}
@Override
public long getItemId(int arg0) {
// TODO Auto-generated method stub
return 0;
}
@Override
public View getView(int pos, View view, ViewGroup parent) {
// TODO Auto-generated method stub
ViewHolder vh;
if(view==null){
view= LayoutInflater.from(mContext).inflate(R.layout.video_lable_item, parent,false);
vh=new ViewHolder();
vh.tv_lable = (TextView) view.findViewById(R.id.tv_lable);
view.setTag(vh);
}else{
vh=(ViewHolder)view.getTag();
}
VideoLableBean videoLableBean = lableResponseList.get(pos);
vh.tv_lable.setText(videoLableBean.getTag_name());
// if(videoLableBean.ischecked()){
// vh.tv_lable.setBackgroundResource(R.drawable.bt_bg_editor);
// vh.tv_lable.setTextColor(mContext.getResources().getColor(R.color.white));
// }else{
// vh.tv_lable.setBackgroundResource(R.drawable.bg_label);
// vh.tv_lable.setTextColor(mContext.getResources().getColor(R.color.text_color_black));
// }
return view;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return lableResponseList.size();
}
class ViewHolder{
TextView tv_lable;
}
}
| [
"[email protected]"
]
| |
63bea173c207d8c927366d10699174ef5c4013f7 | 502cd885b2f25d650de0f228d22247e0a170c700 | /Source Code/AdministratorPresentationLayer/src/view/states/MainMenuState.java | bd241efc7b3f8559e3d72732b3cdfe47ed422f9c | []
| no_license | senker/CarRental | 0edd4314daeba3a898a5490b9764d96eedd4b343 | 697399f05b07f6be76bdb7fb4d36b0776ad5dd33 | refs/heads/master | 2020-06-24T01:35:07.124195 | 2019-08-15T22:26:27 | 2019-08-15T22:26:27 | 198,809,716 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 570 | java | package view.states;
public class MainMenuState extends MenuState {
@Override
public String handle(String input) {
switch (input){
case "1":
currentState = states.get(1);
return "";
case "2":
currentState = states.get(5);
return "";
default: return "no such option is available";
}
}
@Override
public String init() {
return "-------------" + "\n" + "1. CARS" + "\n" + "2. REQUESTS" + "\n" + "-------------";
}
}
| [
"[email protected]"
]
| |
79881201eaa0f3bacfa6bc5da9d8c40098a0dcb2 | ae585c5462c7139604917e9ed0b3519961400d05 | /src/main/java/pl/coderslab/charity/config/SecurityConfig.java | bf76b0e926905beffd830dbed9ae3393d8918574 | []
| no_license | oskarharenda/charity | aee7dc3749dd026517172e57c063c8274e94070b | 9d893f36f5eed15bcbb54459e2f6936a2e8af383 | refs/heads/master | 2021-05-20T00:34:58.363619 | 2020-04-10T06:17:50 | 2020-04-10T06:17:50 | 252,109,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,757 | java | package pl.coderslab.charity.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
import org.springframework.security.crypto.password.PasswordEncoder;
import pl.coderslab.charity.services.SpringDataUserDetailsService;
import javax.sql.DataSource;
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
private final DataSource dataSource;
public SecurityConfig(DataSource dataSource) {
this.dataSource = dataSource;
}
@Bean
public PasswordEncoder passwordEncoder() {
return PasswordEncoderFactories.createDelegatingPasswordEncoder();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.jdbcAuthentication()
.dataSource(dataSource)
.passwordEncoder(passwordEncoder())
.usersByUsernameQuery("SELECT username, password, active FROM users WHERE username = ?")
.authoritiesByUsernameQuery("SELECT username, 'ROLE_USER' FROM users WHERE username = ?");
}
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring()
.antMatchers("/h2-console","/h2-console/**");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/login").permitAll()
.antMatchers("/register").permitAll()
.antMatchers("/test").permitAll()
.antMatchers("/").permitAll()
.antMatchers("/donation").permitAll()
.antMatchers("/resources/css/style.css").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.usernameParameter("username")
.passwordParameter("password")
.defaultSuccessUrl("/")
.and()
.logout()
.logoutUrl("/logout")
.logoutSuccessUrl("/")
.and()
.csrf();
}
@Bean
public SpringDataUserDetailsService customUserDetailsService() {
return new SpringDataUserDetailsService();
}
}
| [
"[email protected]"
]
| |
670f2fd3dcb0d5a07c1b59b2b3922787c52c6bb8 | bacc25e29ab480359bd8003b019e4ad7af3d8796 | /src/main/java/com/example/springboot20200107/ServletInitializer.java | 78d88cda12ee3bb8555b83c8ac09501ca23f6068 | []
| no_license | 18161825600/springboot20200107 | 71916183b9a608b4b6f193a9016e7c5a0a4930c7 | 5ea89a16c4b8ffdf75b691f6e87c62b4d182cd99 | refs/heads/master | 2020-12-09T05:38:19.698236 | 2020-01-11T09:45:24 | 2020-01-11T09:45:24 | 232,509,022 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 447 | java | package com.example.springboot20200107;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Springboot20200107Application.class);
}
}
| [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.