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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fc4d75472d275a227c8df5082aed2d0fa10f0899 | 4f79706b720ae5d7d17008ca1a83f561a935f1cb | /NoIdea/src/com/stringbitking/noidea/models/User.java | 8c9e5a3b82bae52210365a32f54748c26c477bd2 | [] | no_license | stringbitking/NoIdeaApp | d768fdd70d23a625fd0411009f390e067d7074c5 | 1b7143b362d14b3880ffed7000bdeacaa957fb69 | refs/heads/master | 2021-01-15T20:29:20.694238 | 2013-11-17T20:20:07 | 2013-11-17T20:20:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 919 | java | package com.stringbitking.noidea.models;
public class User {
private static String id;
private static String facebookId;
private static String name;
private static int points;
private static Boolean isUserLoggedIn = false;
public static int getPoints() {
return points;
}
public static void setPoints(int points) {
User.points = points;
}
public static String getId() {
return id;
}
public static void setId(String id) {
User.id = id;
}
public static String getName() {
return name;
}
public static void setName(String name) {
User.name = name;
}
public static Boolean getIsUserLoggedIn() {
return isUserLoggedIn;
}
public static void setIsUserLoggedIn(Boolean isUserLoggedIn) {
User.isUserLoggedIn = isUserLoggedIn;
}
public static String getFacebookId() {
return facebookId;
}
public static void setFacebookId(String facebookId) {
User.facebookId = facebookId;
}
}
| [
"victor.tsenkov@gmail.com"
] | victor.tsenkov@gmail.com |
3adfe59893094e150c88d9c4e559d391882af2f4 | 01fadc22e5bc58df8b27be9c7e293b4804289c45 | /app/src/main/java/com/zzmetro/suppliesfault/activity/MaintainListActivity.java | 43119a7cae233d8f6b50a21f43b139d388af91cf | [] | no_license | gon56956/SuppliesFault-noneGuide | 1ec834914bf10ab135d8ad7b519eff253cdd84cb | 0df9b76fd52fa268f5ea580722570070a4f7a15c | refs/heads/master | 2021-07-12T22:27:42.571450 | 2016-10-18T03:27:35 | 2016-10-18T03:27:35 | 71,207,478 | 0 | 1 | null | 2021-06-25T06:10:11 | 2016-10-18T04:01:04 | Java | UTF-8 | Java | false | false | 9,772 | java | package com.zzmetro.suppliesfault.activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import com.zzmetro.suppliesfault.model.SpinnerArea;
import com.zzmetro.suppliesfault.util.Util;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.List;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
/**
* 项目名称: 故障采集 包: com.zzmetro.suppliesfault.activity 类名称: MaintainListActivity
* 类描述: 维护记录
* 创建人: mayunpeng 创建时间: 2016/04/21 版本: [v1.0]
*/
public class MaintainListActivity extends BaseActivity {
private ArrayAdapter<SpinnerArea> maintainListAdapter = null;
private List<SpinnerArea> maintainList = new ArrayList<SpinnerArea>();
private String result = "";
private String str = "";
private int newTicket = 0;
private int oldTicket = 0;
private ProgressDialog pd;
private Handler handler;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maintain_list);
maintainListAdapter = new ArrayAdapter<SpinnerArea>(this, android.R.layout.simple_list_item_1, maintainList);
ListView listView = (ListView)findViewById(R.id.maintainList);
listView.setAdapter(maintainListAdapter);
//初始化故障单数据
// 显示ProgressDialog
pd = ProgressDialog.show(MaintainListActivity.this, "维修记录", "数据加载中,请稍候!!!");
// 开启一个新线程,在新线程里执行耗时的方法
new Thread(new Runnable() {
public void run() {
result = xPathParseUploadTroubleTicketsXml();
handler.sendEmptyMessage(0);
}
}).start();
handler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
pd.dismiss();
maintainListAdapter.notifyDataSetChanged();
if ("1".equals(result)) {
Util.showToast(MaintainListActivity.this, "数据加载成功");
} else if ("没有维修记录".equals(result)){
Util.showToast(MaintainListActivity.this, "***没有维修记录***");
} else {
Util.showToast(MaintainListActivity.this, "数据加载失败");
}
}
};
//ListView点击事件
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
String solutionFaultID = maintainList.get(position).getDomaincode();
MaintainFaultActivity.actionStart(MaintainListActivity.this, solutionFaultID);
finish();
}
});
Log.d("MyFaultListActivity", "维护记录");
}
/**
* 获取我的维修记录信息
*/
private String xPathParseUploadTroubleTicketsXml() {
XPathFactory xPathFactory = XPathFactory.newInstance();
XPath xPath = xPathFactory.newXPath();
try {
if (!Util.checkFile(getResources().getString(R.string.uploadTroubleTicketsPath))) {
InputSource inputSourceNew = new InputSource(new FileInputStream(getResources().getString(R.string.uploadTroubleTicketsPath)));
NodeList newTicketList = (NodeList)xPath.evaluate("/root/NewTicket/Ticket", inputSourceNew, XPathConstants.NODESET);
if (newTicketList != null && newTicketList.getLength() > 0) {
maintainList.clear();
for (int i = 0; i < newTicketList.getLength(); i++) {
Element element = (Element)newTicketList.item(i);
if ("5".equals(element.getAttribute("Status"))) {
String key = element.getAttribute("Downtime");
// 故障地址
String value = xPathequipmentInfoXml(element.getAttribute("Equipment"));
// 故障类型
String value1 = xPathProblemClassInfoXml(element.getAttribute("Problem"));
maintainList.add(new SpinnerArea(key, value + "★" + value1));
newTicket++;
}
}
}
InputSource inputSourceOld = new InputSource(new FileInputStream(getResources().getString(R.string.uploadTroubleTicketsPath)));
NodeList oldicketList = (NodeList)xPath.evaluate("/root/OldTicket/Ticket", inputSourceOld, XPathConstants.NODESET);
if (oldicketList != null && oldicketList.getLength() > 0) {
for (int i = 0; i < oldicketList.getLength(); i++) {
Element element = (Element)oldicketList.item(i);
String key = element.getAttribute("ID");
String value = xPathTicketInfoXml(element.getAttribute("ID"));
maintainList.add(new SpinnerArea(key, value));
oldTicket++;
}
}
}
} catch (Exception e) {
e.printStackTrace();
return "error";
}
// 判断有无记录
if (newTicket > 0 || oldTicket > 0) {
str = "1";
} else {
str = "没有维修记录";
}
return str;
}
/**
* 获取设备名称
*
* @param equipmentCode 设备code
*/
private String xPathequipmentInfoXml(String equipmentCode) {
String value = "";
XPathFactory xPathFactory = XPathFactory.newInstance();
XPath xPath = xPathFactory.newXPath();
try {
InputSource inputSourceType = new InputSource(new FileInputStream(getResources().getString(R.string.equipmentPath)));
// 获取故障地点
NodeList equipmentList = (NodeList)xPath.evaluate("/root/EquipmentType/Equipment[@Code='" + equipmentCode + "']", inputSourceType, XPathConstants.NODESET);
if (equipmentList != null && equipmentList.getLength() > 0) {
for (int i = 0; i < equipmentList.getLength(); i++) {
Element element = (Element)equipmentList.item(i);
// 故障地点
value = element.getAttribute("Location");
}
}
} catch (Exception e) {
e.printStackTrace();
}
return value;
}
/**
* 获取故障类型
*
* @param problemCode 故障描述code
* @return value 故障类型
*/
private String xPathProblemClassInfoXml(String problemCode) {
String value = "";
XPathFactory xPathFactory = XPathFactory.newInstance();
XPath xPath = xPathFactory.newXPath();
try {
InputSource inputSourceType = new InputSource(new FileInputStream(getResources().getString(R.string.problemClassPath)));
// 获取故障类型
NodeList problemClassList = (NodeList)xPath.evaluate("/root/EquipmentType/ProblemClass[@ID='" + problemCode.substring(0,4) + "']", inputSourceType, XPathConstants.NODESET);
if (problemClassList != null && problemClassList.getLength() > 0) {
for (int i = 0; i < problemClassList.getLength(); i++) {
Element element = (Element)problemClassList.item(i);
// 故障类型
value = element.getAttribute("Name");
}
}
} catch (Exception e) {
e.printStackTrace();
}
return value;
}
/**
* 获取设备名称
*
* @param equipmentID 故障单号
*/
private String xPathTicketInfoXml(String equipmentID) {
String value = "";
XPathFactory xPathFactory = XPathFactory.newInstance();
XPath xPath = xPathFactory.newXPath();
try {
InputSource inputSourceTicket = new InputSource(new FileInputStream(getResources().getString(R.string.ticketPath)));
NodeList oldTicketList = (NodeList)xPath.evaluate("/root/Ticket", inputSourceTicket, XPathConstants.NODESET);
if (oldTicketList != null && oldTicketList.getLength() > 0) {
for (int i = 0; i < oldTicketList.getLength(); i++) {
Element element = (Element)oldTicketList.item(i);
// 转接故障单
if (equipmentID.equals(element.getAttribute("ID"))) {
// 故障地址
String value1 = xPathequipmentInfoXml(element.getAttribute("Equipment"));
// 故障类型
String value2 = xPathProblemClassInfoXml(element.getAttribute("Problem"));
value = value1 + "★" + value2;
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return value;
}
} | [
"mayunpeng@MacBook-Pro.local"
] | mayunpeng@MacBook-Pro.local |
2aeab13e84e26631ca3356b64a2adee72a3e1c9a | c49ef3dcf2195bf3c9ccee8fc5ef306e64f3e78f | /src/main/java/com/swk/wechat/third/util/RandomUtils.java | b1c7471c1be8d8b897ed4779867923aed5adc0ff | [] | no_license | javalxs/wechat_third_party | f6d18deb6986e511a45edab6f70d936d56ef698e | cf8e52af16696833ba59afdb6100e60786af9d32 | refs/heads/master | 2021-06-20T22:56:57.577086 | 2017-07-26T10:32:49 | 2017-07-26T10:32:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 479 | java | package com.swk.wechat.third.util;
public class RandomUtils {
private static final String RANDOM_STR = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
private static final java.util.Random RANDOM = new java.util.Random();
public static String getRandomStr() {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 16; i++) {
sb.append(RANDOM_STR.charAt(RANDOM.nextInt(RANDOM_STR.length())));
}
return sb.toString();
}
}
| [
"183407401@qq.com"
] | 183407401@qq.com |
faec05b137b86b38a5c821b9e07a7dda6cbe5325 | 45ebcace0e194a57c960335b505457507ae9dffc | /app/src/main/java/com/example/mydota/Data/Model/NotificationFirebase.java | ca71483847e76f89df88d1225fb6e4aa1946741c | [] | no_license | joelh273/MyDota | 785f73f3d58cb6617b0506ef90c4d0d6a21eca42 | cab300cb97682348101fb0d263955dde0a4a7532 | refs/heads/master | 2022-10-09T18:51:04.863580 | 2020-06-14T20:07:37 | 2020-06-14T20:07:37 | 272,274,966 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,396 | java | package com.example.mydota.Data.Model;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.media.RingtoneManager;
import android.net.Uri;
import androidx.core.app.NotificationCompat;
import com.example.mydota.R;
import com.example.mydota.UI.Views.Activities.MainActivity;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
public class NotificationFirebase extends FirebaseMessagingService {
public static final String NOTIFICATION_CHANNEL_ID = "10001";
private final static String default_notification_channel_id = "default";
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
sendNotification(remoteMessage.getNotification().getBody(),remoteMessage.getNotification().getTitle());
}
private void sendNotification(String messageBody,String title) {
NotificationManager mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getApplicationContext(), default_notification_channel_id);
mBuilder.setContentTitle(title);
mBuilder.setContentText(messageBody);
mBuilder.setStyle(new NotificationCompat.BigTextStyle());
mBuilder.setSmallIcon(R.drawable.ic_launcher_foreground);
mBuilder.setAutoCancel(true);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
new Intent(this, MainActivity.class), PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(contentIntent);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
int importance = NotificationManager.IMPORTANCE_HIGH;
NotificationChannel notificationChannel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, "NOTIFICATION_CHANNEL_NAME", importance);
mBuilder.setChannelId(NOTIFICATION_CHANNEL_ID);
assert mNotificationManager != null;
mNotificationManager.createNotificationChannel(notificationChannel);
}
assert mNotificationManager != null;
mNotificationManager.notify((int) System.currentTimeMillis(), mBuilder.build());
}
}
| [
"45686194+joelh273@users.noreply.github.com"
] | 45686194+joelh273@users.noreply.github.com |
1be1e52595cb3a023d974611cdcf1feab1fc2e47 | 4abafebee0c140e46853b70ed4b1277dbdd365ed | /aula74/src/entities/Product.java | fb7b6b8ddc8004a93f991ff5a8cda0e33f490d22 | [] | no_license | rodrigoqueriqueli/improving_java | 4c5f2cc0ffafb3b8eed97e59928eef5707e96c9f | ab6a3e8df1c46872170b8cd62a0820c31ce1ee44 | refs/heads/master | 2021-05-23T12:51:06.778862 | 2020-04-28T21:40:50 | 2020-04-28T21:40:50 | 253,294,638 | 1 | 0 | null | 2020-04-28T21:40:51 | 2020-04-05T17:40:31 | Java | ISO-8859-1 | Java | false | false | 1,089 | java | package entities;
public class Product {
public String name;
public double price;
public int quantity;
public Product() {
}
public Product(String name, double price, int quantity) {
this.name = name; //pegar o name que veio de parametro e atribuir para o name do objeto
this.price = price; //pegar o price que veio de parametro e atribuir para o preço do objeto
this.quantity = quantity; //pegar a qtde que veio de parametro e atribuir pra qtde do objeto
}
//exemplo de sobrecarga, outro método construtor porém com entradas de parametros diferentes
public Product(String name, double price) {
this.name = name;
this.price = price;
}
public double totalValueInStock() {
return price * quantity;
}
public void addProducts(int quantity) {
this.quantity += quantity;
}
public void removeProducts(int quantity) {
this.quantity -= quantity;
}
public String toString() {
return name
+ ", $ "
+ String.format("%.2f", price)
+ ", "
+ quantity
+ " units, Total: $"
+ String.format("%.2f", totalValueInStock()) ;
}
}
| [
"rdqueriqueli@gmail.com"
] | rdqueriqueli@gmail.com |
fc7d18eeb46bd3a845b4d5526886f22e08d67226 | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /eclipsejdt_cluster/47169/src_1.java | e39bc29d5d235971b828aa1acd6113f76c57dcff | [] | no_license | martinezmatias/GenPat-data-C3 | 63cfe27efee2946831139747e6c20cf952f1d6f6 | b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4 | refs/heads/master | 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 55,877 | java | /*******************************************************************************
* Copyright (c) 2000, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.core.tests.model;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.tests.util.Util;
import org.eclipse.jdt.internal.codeassist.RelevanceConstants;
import org.eclipse.jdt.internal.core.JavaModelManager;
import junit.framework.*;
public class CompletionTests2 extends ModifyingResourceTests implements RelevanceConstants {
public static class CompletionContainerInitializer implements ContainerInitializer.ITestInitializer {
public static class DefaultContainer implements IClasspathContainer {
char[][] libPaths;
boolean[] areExported;
public DefaultContainer(char[][] libPaths, boolean[] areExported) {
this.libPaths = libPaths;
this.areExported = areExported;
}
public IClasspathEntry[] getClasspathEntries() {
int length = this.libPaths.length;
IClasspathEntry[] entries = new IClasspathEntry[length];
for (int j = 0; j < length; j++) {
IPath path = new Path(new String(this.libPaths[j]));
boolean isExported = this.areExported[j];
if (path.segmentCount() == 1) {
entries[j] = JavaCore.newProjectEntry(path, isExported);
} else {
entries[j] = JavaCore.newLibraryEntry(path, null, null, isExported);
}
}
return entries;
}
public String getDescription() {
return "Test container";
}
public int getKind() {
return IClasspathContainer.K_APPLICATION;
}
public IPath getPath() {
return new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER");
}
}
Map containerValues;
CoreException exception;
/*
* values is [<project name>, <lib path>[,<lib path>]* ]*
*/
public CompletionContainerInitializer(String projectName, String[] libPaths, boolean[] areExported) {
containerValues = new HashMap();
int libPathsLength = libPaths.length;
char[][] charLibPaths = new char[libPathsLength][];
for (int i = 0; i < libPathsLength; i++) {
charLibPaths[i] = libPaths[i].toCharArray();
}
containerValues.put(
projectName,
newContainer(charLibPaths, areExported)
);
}
protected DefaultContainer newContainer(final char[][] libPaths, final boolean[] areExperted) {
return new DefaultContainer(libPaths, areExperted);
}
public void initialize(IPath containerPath, IJavaProject project) throws CoreException {
if (containerValues == null) return;
try {
JavaCore.setClasspathContainer(
containerPath,
new IJavaProject[] {project},
new IClasspathContainer[] {(IClasspathContainer)containerValues.get(project.getElementName())},
null);
} catch (CoreException e) {
this.exception = e;
throw e;
}
}
}
public CompletionTests2(String name) {
super(name);
}
public void setUpSuite() throws Exception {
super.setUpSuite();
setUpJavaProject("Completion");
}
public void tearDownSuite() throws Exception {
deleteProject("Completion");
super.tearDownSuite();
}
protected static void assertResults(String expected, String actual) {
try {
assertEquals(expected, actual);
} catch(ComparisonFailure c) {
System.out.println(actual);
System.out.println();
throw c;
}
}
public static Test suite() {
TestSuite suite = new Suite(CompletionTests2.class.getName());
suite.addTest(new CompletionTests2("testBug29832"));
suite.addTest(new CompletionTests2("testBug33560"));
suite.addTest(new CompletionTests2("testBug79288"));
suite.addTest(new CompletionTests2("testBug91772"));
suite.addTest(new CompletionTests2("testAccessRestriction1"));
suite.addTest(new CompletionTests2("testAccessRestriction2"));
suite.addTest(new CompletionTests2("testAccessRestriction3"));
suite.addTest(new CompletionTests2("testAccessRestriction4"));
suite.addTest(new CompletionTests2("testAccessRestriction5"));
suite.addTest(new CompletionTests2("testAccessRestriction6"));
suite.addTest(new CompletionTests2("testAccessRestriction7"));
suite.addTest(new CompletionTests2("testAccessRestriction8"));
suite.addTest(new CompletionTests2("testAccessRestriction9"));
suite.addTest(new CompletionTests2("testAccessRestriction10"));
suite.addTest(new CompletionTests2("testAccessRestriction11"));
suite.addTest(new CompletionTests2("testAccessRestriction12"));
suite.addTest(new CompletionTests2("testAccessRestriction13"));
suite.addTest(new CompletionTests2("testAccessRestriction14"));
return suite;
}
File createFile(File parent, String name, String content) throws IOException {
File file = new File(parent, name);
FileOutputStream out = new FileOutputStream(file);
out.write(content.getBytes());
out.close();
return file;
}
File createDirectory(File parent, String name) {
File dir = new File(parent, name);
dir.mkdirs();
return dir;
}
/**
* Test for bug 29832
*/
public void testBug29832() throws Exception {
try {
// create variable
JavaCore.setClasspathVariables(
new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
null);
// create P1
IFile f = getFile("/Completion/lib.jar");
IJavaProject p = this.createJavaProject(
"P1",
new String[]{},
Util.getJavaClassLibs(),
"");
this.createFile("/P1/lib.jar", f.getContents());
this.addLibraryEntry(p, "/P1/lib.jar", true);
// create P2
this.createJavaProject(
"P2",
new String[]{"src"},
Util.getJavaClassLibs(),
new String[]{"/P1"},
"bin");
this.createFile(
"/P2/src/X.java",
"public class X {\n"+
" ZZZ z;\n"+
"}");
// do completion
CompletionTestsRequestor requestor = new CompletionTestsRequestor();
ICompilationUnit cu= getCompilationUnit("P2", "src", "", "X.java");
String str = cu.getSource();
String completeBehind = "ZZZ";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
cu.codeComplete(cursorLocation, requestor);
assertEquals(
"element:ZZZ completion:pz.ZZZ relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED),
requestor.getResults());
// delete P1
p.getProject().delete(true, false, null);
// create P1
File dest = getWorkspaceRoot().getLocation().toFile();
File pro = this.createDirectory(dest, "P1");
this.createFile(pro, ".classpath", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<classpath>\n" +
" <classpathentry kind=\"src\" path=\"src\"/>\n" +
" <classpathentry kind=\"var\" path=\"JCL_LIB\" sourcepath=\"JCL_SRC\" rootpath=\"JCL_SRCROOT\"/>\n" +
" <classpathentry kind=\"output\" path=\"bin\"/>\n" +
"</classpath>");
this.createFile(pro, ".project",
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<projectDescription>\n" +
" <name>org.eclipse.jdt.core</name>\n" +
" <comment></comment>\n" +
" <projects>\n" +
" </projects>\n" +
" <buildSpec>\n" +
" <buildCommand>\n" +
" <name>org.eclipse.jdt.core.javabuilder</name>\n" +
" <arguments>\n" +
" </arguments>\n" +
" </buildCommand>\n" +
" </buildSpec>\n" +
" <natures>\n" +
" <nature>org.eclipse.jdt.core.javanature</nature>\n" +
" </natures>\n" +
"</projectDescription>");
File src = this.createDirectory(pro, "src");
File pz = this.createDirectory(src, "pz");
this.createFile(pz, "ZZZ.java",
"package pz;\n" +
"public class ZZZ {\n" +
"}");
final IProject project = getWorkspaceRoot().getProject("P1");
IWorkspaceRunnable populate = new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
project.create(null);
project.open(null);
}
};
getWorkspace().run(populate, null);
JavaCore.create(project);
// do completion
requestor = new CompletionTestsRequestor();
cu.codeComplete(cursorLocation, requestor);
assertEquals(
"element:ZZZ completion:pz.ZZZ relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED),
requestor.getResults());
} finally {
this.deleteProject("P1");
this.deleteProject("P2");
}
}
/**
* Test for bug 33560
*/
public void testBug33560() throws Exception {
try {
// create variable
JavaCore.setClasspathVariables(
new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
null);
// create P1
IFile f = getFile("/Completion/lib.jar");
IJavaProject p = this.createJavaProject(
"P1",
new String[]{},
Util.getJavaClassLibs(),
"");
this.createFile("/P1/lib.jar", f.getContents());
this.addLibraryEntry(p, "/P1/lib.jar", true);
// create P2
this.createJavaProject(
"P2",
new String[]{"src"},
Util.getJavaClassLibs(),
new String[]{"/P1"},
new boolean[]{true},
"bin");
// create P3
this.createJavaProject(
"P3",
new String[]{"src"},
Util.getJavaClassLibs(),
new String[]{"/P2"},
"bin");
this.createFile(
"/P3/src/X.java",
"public class X {\n"+
" ZZZ z;\n"+
"}");
// do completion
CompletionTestsRequestor requestor = new CompletionTestsRequestor();
ICompilationUnit cu= getCompilationUnit("P3", "src", "", "X.java");
String str = cu.getSource();
String completeBehind = "ZZZ";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
cu.codeComplete(cursorLocation, requestor);
assertEquals(
"element:ZZZ completion:pz.ZZZ relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED),
requestor.getResults());
// delete P1
p.getProject().delete(true, false, null);
// create P1
File dest = getWorkspaceRoot().getLocation().toFile();
File pro = this.createDirectory(dest, "P1");
this.createFile(pro, ".classpath", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<classpath>\n" +
" <classpathentry kind=\"src\" path=\"src\"/>\n" +
" <classpathentry kind=\"var\" path=\"JCL_LIB\" sourcepath=\"JCL_SRC\" rootpath=\"JCL_SRCROOT\"/>\n" +
" <classpathentry kind=\"output\" path=\"bin\"/>\n" +
"</classpath>");
this.createFile(pro, ".project",
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<projectDescription>\n" +
" <name>org.eclipse.jdt.core</name>\n" +
" <comment></comment>\n" +
" <projects>\n" +
" </projects>\n" +
" <buildSpec>\n" +
" <buildCommand>\n" +
" <name>org.eclipse.jdt.core.javabuilder</name>\n" +
" <arguments>\n" +
" </arguments>\n" +
" </buildCommand>\n" +
" </buildSpec>\n" +
" <natures>\n" +
" <nature>org.eclipse.jdt.core.javanature</nature>\n" +
" </natures>\n" +
"</projectDescription>");
File src = this.createDirectory(pro, "src");
File pz = this.createDirectory(src, "pz");
this.createFile(pz, "ZZZ.java",
"package pz;\n" +
"public class ZZZ {\n" +
"}");
final IProject project = getWorkspaceRoot().getProject("P1");
IWorkspaceRunnable populate = new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
project.create(null);
project.open(null);
}
};
getWorkspace().run(populate, null);
JavaCore.create(project);
// do completion
requestor = new CompletionTestsRequestor();
cu.codeComplete(cursorLocation, requestor);
assertEquals(
"element:ZZZ completion:pz.ZZZ relevance:"+(R_DEFAULT + R_INTERESTING + R_CASE + R_EXACT_NAME + R_NON_RESTRICTED),
requestor.getResults());
} finally {
this.deleteProject("P1");
this.deleteProject("P2");
this.deleteProject("P3");
}
}
public void testBug79288() throws Exception {
try {
// create variable
JavaCore.setClasspathVariables(
new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
null);
// create P1
this.createJavaProject(
"P1",
new String[]{"src"},
Util.getJavaClassLibs(),
"bin");
this.createFolder("/P1/src/a");
this.createFile(
"/P1/src/a/XX1.java",
"package a;\n"+
"public class XX1 {\n"+
"}");
// create P2
this.createJavaProject(
"P2",
new String[]{"src"},
Util.getJavaClassLibs(),
new String[]{"/P1"},
"bin");
this.createFolder("/P2/src/b");
this.createFile(
"/P2/src/b/XX2.java",
"package b;\n"+
"public class XX2 {\n"+
"}");
// create P3
this.createJavaProject(
"P3",
new String[]{"src"},
Util.getJavaClassLibs(),
new String[]{"/P2"},
"bin");
this.createFile(
"/P3/src/YY.java",
"public class YY {\n"+
" vois foo(){\n"+
" XX\n"+
" }\n"+
"}");
waitUntilIndexesReady();
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
ICompilationUnit cu= getCompilationUnit("P3", "src", "", "YY.java");
String str = cu.getSource();
String completeBehind = "XX";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
cu.codeComplete(cursorLocation, requestor);
assertResults(
"XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
requestor.getResults());
} finally {
this.deleteProject("P1");
this.deleteProject("P2");
this.deleteProject("P3");
}
}
public void testBug91772() throws Exception {
try {
// create variable
JavaCore.setClasspathVariables(
new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
null);
// create P1
this.createJavaProject(
"P1",
new String[]{"src"},
Util.getJavaClassLibs(),
"bin");
this.createFolder("/P1/src/a");
this.createFile(
"/P1/src/a/XX1.java",
"package a;\n"+
"public class XX1 {\n"+
"}");
// create P2
ContainerInitializer.setInitializer(new CompletionContainerInitializer("P2", new String[] {"/P1"}, new boolean[] {true}));
String[] classLib = Util.getJavaClassLibs();
int classLibLength = classLib.length;
String[] lib = new String[classLibLength + 1];
System.arraycopy(classLib, 0, lib, 0, classLibLength);
lib[classLibLength] = "org.eclipse.jdt.core.tests.model.TEST_CONTAINER";
this.createJavaProject(
"P2",
new String[]{"src"},
lib,
"bin");
this.createFolder("/P2/src/b");
this.createFile(
"/P2/src/b/XX2.java",
"package b;\n"+
"public class XX2 {\n"+
"}");
// create P3
this.createJavaProject(
"P3",
new String[]{"src"},
Util.getJavaClassLibs(),
new String[]{"/P2"},
"bin");
this.createFile(
"/P3/src/YY.java",
"public class YY {\n"+
" vois foo(){\n"+
" XX\n"+
" }\n"+
"}");
waitUntilIndexesReady();
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
ICompilationUnit cu= getCompilationUnit("P3", "src", "", "YY.java");
String str = cu.getSource();
String completeBehind = "XX";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
cu.codeComplete(cursorLocation, requestor);
assertResults(
"XX1[TYPE_REF]{a.XX1, a, La.XX1;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
"XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
requestor.getResults());
} finally {
this.deleteProject("P1");
this.deleteProject("P2");
this.deleteProject("P3");
// Cleanup caches
JavaModelManager manager = JavaModelManager.getJavaModelManager();
manager.containers = new HashMap(5);
manager.variables = new HashMap(5);
}
}
public void testAccessRestriction1() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaCore.IGNORE);
options.put(JavaCore.COMPILER_PB_DISCOURAGED_REFERENCE, JavaCore.IGNORE);
options.put(JavaCore.CODEASSIST_HIDE_RESTRICTED_REFERENCES, JavaCore.NEVER);
JavaCore.setOptions(options);
// create variable
JavaCore.setClasspathVariables(
new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
null);
// create P1
this.createJavaProject(
"P1",
new String[]{"src"},
Util.getJavaClassLibs(),
"bin");
this.createFolder("/P1/src/a");
this.createFile(
"/P1/src/a/XX1.java",
"package a;\n"+
"public class XX1 {\n"+
"}");
this.createFolder("/P1/src/b");
this.createFile(
"/P1/src/b/XX2.java",
"package b;\n"+
"public class XX2 {\n"+
"}");
// create P2
this.createJavaProject(
"P2",
new String[]{"src"},
Util.getJavaClassLibs(),
new String[]{"/P1"},
"bin");
this.createFile(
"/P2/src/YY.java",
"public class YY {\n"+
" void foo() {\n"+
" XX\n"+
" }\n"+
"}");
waitUntilIndexesReady();
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
ICompilationUnit cu= getCompilationUnit("P2", "src", "", "YY.java");
String str = cu.getSource();
String completeBehind = "XX";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
cu.codeComplete(cursorLocation, requestor);
assertResults(
"XX1[TYPE_REF]{a.XX1, a, La.XX1;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
"XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
requestor.getResults());
} finally {
this.deleteProject("P1");
this.deleteProject("P2");
JavaCore.setOptions(oldOptions);
}
}
public void testAccessRestriction2() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaCore.IGNORE);
options.put(JavaCore.COMPILER_PB_DISCOURAGED_REFERENCE, JavaCore.IGNORE);
options.put(JavaCore.CODEASSIST_HIDE_RESTRICTED_REFERENCES, JavaCore.NEVER);
JavaCore.setOptions(options);
// create variable
JavaCore.setClasspathVariables(
new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
null);
// create P1
this.createJavaProject(
"P1",
new String[]{"src"},
Util.getJavaClassLibs(),
"bin");
this.createFolder("/P1/src/a");
this.createFile(
"/P1/src/a/XX1.java",
"package a;\n"+
"public class XX1 {\n"+
"}");
this.createFolder("/P1/src/b");
this.createFile(
"/P1/src/b/XX2.java",
"package b;\n"+
"public class XX2 {\n"+
"}");
// create P2
this.createJavaProject(
"P2",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P1"},
new String[][]{{}},
new String[][]{{"a/*"}},
new boolean[]{false},
"bin",
null,
null,
null,
"1.4");
this.createFile(
"/P2/src/YY.java",
"public class YY {\n"+
" void foo() {\n"+
" XX\n"+
" }\n"+
"}");
waitUntilIndexesReady();
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
ICompilationUnit cu= getCompilationUnit("P2", "src", "", "YY.java");
String str = cu.getSource();
String completeBehind = "XX";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
cu.codeComplete(cursorLocation, requestor);
assertResults(
"XX1[TYPE_REF]{a.XX1, a, La.XX1;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
"XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
requestor.getResults());
} finally {
this.deleteProject("P1");
this.deleteProject("P2");
JavaCore.setOptions(oldOptions);
}
}
public void testAccessRestriction3() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaCore.ERROR);
options.put(JavaCore.CODEASSIST_HIDE_RESTRICTED_REFERENCES, JavaCore.NEVER);
JavaCore.setOptions(options);
// create variable
JavaCore.setClasspathVariables(
new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
null);
// create P1
this.createJavaProject(
"P1",
new String[]{"src"},
Util.getJavaClassLibs(),
"bin");
this.createFolder("/P1/src/a");
this.createFile(
"/P1/src/a/XX1.java",
"package a;\n"+
"public class XX1 {\n"+
"}");
this.createFolder("/P1/src/b");
this.createFile(
"/P1/src/b/XX2.java",
"package b;\n"+
"public class XX2 {\n"+
"}");
// create P2
this.createJavaProject(
"P2",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P1"},
new String[][]{{}},
new String[][]{{"a/*"}},
new boolean[]{false},
"bin",
null,
null,
null,
"1.4");
this.createFile(
"/P2/src/YY.java",
"public class YY {\n"+
" void foo() {\n"+
" XX\n"+
" }\n"+
"}");
waitUntilIndexesReady();
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
ICompilationUnit cu= getCompilationUnit("P2", "src", "", "YY.java");
String str = cu.getSource();
String completeBehind = "XX";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
cu.codeComplete(cursorLocation, requestor);
assertResults(
"XX1[TYPE_REF]{a.XX1, a, La.XX1;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE) + "}\n" +
"XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
requestor.getResults());
} finally {
this.deleteProject("P1");
this.deleteProject("P2");
JavaCore.setOptions(oldOptions);
}
}
public void testAccessRestriction4() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaCore.IGNORE);
options.put(JavaCore.COMPILER_PB_DISCOURAGED_REFERENCE, JavaCore.IGNORE);
options.put(JavaCore.CODEASSIST_HIDE_RESTRICTED_REFERENCES, JavaCore.ERROR);
JavaCore.setOptions(options);
// create variable
JavaCore.setClasspathVariables(
new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
null);
// create P1
this.createJavaProject(
"P1",
new String[]{"src"},
Util.getJavaClassLibs(),
"bin");
this.createFolder("/P1/src/a");
this.createFile(
"/P1/src/a/XX1.java",
"package a;\n"+
"public class XX1 {\n"+
"}");
this.createFolder("/P1/src/b");
this.createFile(
"/P1/src/b/XX2.java",
"package b;\n"+
"public class XX2 {\n"+
"}");
// create P2
this.createJavaProject(
"P2",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P1"},
new String[][]{{}},
new String[][]{{"a/*"}},
new boolean[]{false},
"bin",
null,
null,
null,
"1.4");
this.createFile(
"/P2/src/YY.java",
"public class YY {\n"+
" void foo() {\n"+
" XX\n"+
" }\n"+
"}");
waitUntilIndexesReady();
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
ICompilationUnit cu= getCompilationUnit("P2", "src", "", "YY.java");
String str = cu.getSource();
String completeBehind = "XX";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
cu.codeComplete(cursorLocation, requestor);
assertResults(
"XX1[TYPE_REF]{a.XX1, a, La.XX1;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
"XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
requestor.getResults());
} finally {
this.deleteProject("P1");
this.deleteProject("P2");
JavaCore.setOptions(oldOptions);
}
}
public void testAccessRestriction5() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaCore.ERROR);
options.put(JavaCore.CODEASSIST_HIDE_RESTRICTED_REFERENCES, JavaCore.ERROR);
JavaCore.setOptions(options);
// create variable
JavaCore.setClasspathVariables(
new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
null);
// create P1
this.createJavaProject(
"P1",
new String[]{"src"},
Util.getJavaClassLibs(),
"bin");
this.createFolder("/P1/src/a");
this.createFile(
"/P1/src/a/XX1.java",
"package a;\n"+
"public class XX1 {\n"+
"}");
this.createFolder("/P1/src/b");
this.createFile(
"/P1/src/b/XX2.java",
"package b;\n"+
"public class XX2 {\n"+
"}");
// create P2
this.createJavaProject(
"P2",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P1"},
new String[][]{{}},
new String[][]{{"a/*"}},
new boolean[]{false},
"bin",
null,
null,
null,
"1.4");
this.createFile(
"/P2/src/YY.java",
"public class YY {\n"+
" void foo() {\n"+
" XX\n"+
" }\n"+
"}");
waitUntilIndexesReady();
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
ICompilationUnit cu= getCompilationUnit("P2", "src", "", "YY.java");
String str = cu.getSource();
String completeBehind = "XX";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
cu.codeComplete(cursorLocation, requestor);
assertResults(
"XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
requestor.getResults());
} finally {
this.deleteProject("P1");
this.deleteProject("P2");
JavaCore.setOptions(oldOptions);
}
}
public void testAccessRestriction6() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaCore.ERROR);
options.put(JavaCore.CODEASSIST_HIDE_RESTRICTED_REFERENCES, JavaCore.ERROR);
JavaCore.setOptions(options);
// create variable
JavaCore.setClasspathVariables(
new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
null);
// create P1
this.createJavaProject(
"P1",
new String[]{"src"},
Util.getJavaClassLibs(),
"bin");
this.createFolder("/P1/src/a");
this.createFile(
"/P1/src/a/XX1.java",
"package a;\n"+
"public class XX1 {\n"+
"}");
this.createFolder("/P1/src/b");
this.createFile(
"/P1/src/b/XX2.java",
"package b;\n"+
"public class XX2 {\n"+
"}");
this.createFolder("/P1/src/c");
this.createFile(
"/P1/src/c/XX3.java",
"package c;\n"+
"public class XX3 {\n"+
"}");
// create P2
this.createJavaProject(
"P2",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P1"},
new String[][]{{}},
new String[][]{{"a/*"}},
new boolean[]{true},
"bin",
null,
null,
null,
"1.4");
// create P3
this.createJavaProject(
"P3",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P2"},
new String[][]{{}},
new String[][]{{"b/*"}},
new boolean[]{false},
"bin",
null,
null,
null,
"1.4");
this.createFile(
"/P3/src/YY.java",
"public class YY {\n"+
" void foo() {\n"+
" XX\n"+
" }\n"+
"}");
waitUntilIndexesReady();
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
ICompilationUnit cu= getCompilationUnit("P3", "src", "", "YY.java");
String str = cu.getSource();
String completeBehind = "XX";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
cu.codeComplete(cursorLocation, requestor);
assertResults(
"XX3[TYPE_REF]{c.XX3, c, Lc.XX3;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
requestor.getResults());
} finally {
this.deleteProject("P1");
this.deleteProject("P2");
this.deleteProject("P3");
JavaCore.setOptions(oldOptions);
}
}
public void testAccessRestriction7() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaCore.ERROR);
options.put(JavaCore.CODEASSIST_HIDE_RESTRICTED_REFERENCES, JavaCore.ERROR);
JavaCore.setOptions(options);
// create variable
JavaCore.setClasspathVariables(
new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
null);
// create P1
this.createJavaProject(
"P1",
new String[]{"src"},
Util.getJavaClassLibs(),
"bin");
this.createFolder("/P1/src/a");
this.createFile(
"/P1/src/a/XX1.java",
"package a;\n"+
"public class XX1 {\n"+
"}");
this.createFolder("/P1/src/b");
this.createFile(
"/P1/src/b/XX2.java",
"package b;\n"+
"public class XX2 {\n"+
"}");
// create P2
this.createJavaProject(
"P2",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P1", "/P3"},
new String[][]{{}, {}},
new String[][]{{"a/*"}, {}},
new boolean[]{false, false},
"bin",
null,
null,
null,
"1.4");
this.createFile(
"/P2/src/YY.java",
"public class YY {\n"+
" void foo() {\n"+
" XX\n"+
" }\n"+
"}");
// create P3
this.createJavaProject(
"P3",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P1"},
new String[][]{{}},
new String[][]{{}},
new boolean[]{true},
"bin",
null,
null,
null,
"1.4");
waitUntilIndexesReady();
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
ICompilationUnit cu= getCompilationUnit("P2", "src", "", "YY.java");
String str = cu.getSource();
String completeBehind = "XX";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
cu.codeComplete(cursorLocation, requestor);
assertResults(
"XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
requestor.getResults());
} finally {
this.deleteProject("P1");
this.deleteProject("P2");
this.deleteProject("P3");
JavaCore.setOptions(oldOptions);
}
}
public void testAccessRestriction8() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaCore.ERROR);
options.put(JavaCore.CODEASSIST_HIDE_RESTRICTED_REFERENCES, JavaCore.ERROR);
JavaCore.setOptions(options);
// create variable
JavaCore.setClasspathVariables(
new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
null);
// create P1
this.createJavaProject(
"P1",
new String[]{"src"},
Util.getJavaClassLibs(),
"bin");
this.createFolder("/P1/src/a");
this.createFile(
"/P1/src/a/XX1.java",
"package a;\n"+
"public class XX1 {\n"+
"}");
this.createFolder("/P1/src/b");
this.createFile(
"/P1/src/b/XX2.java",
"package b;\n"+
"public class XX2 {\n"+
"}");
// create P2
this.createJavaProject(
"P2",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P3", "/P1"},
new String[][]{{}, {}},
new String[][]{{}, {"a/*"}},
new boolean[]{false, false},
"bin",
null,
null,
null,
"1.4");
this.createFile(
"/P2/src/YY.java",
"public class YY {\n"+
" void foo() {\n"+
" XX\n"+
" }\n"+
"}");
// create P3
this.createJavaProject(
"P3",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P1"},
new String[][]{{}},
new String[][]{{}},
new boolean[]{true},
"bin",
null,
null,
null,
"1.4");
waitUntilIndexesReady();
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
ICompilationUnit cu= getCompilationUnit("P2", "src", "", "YY.java");
String str = cu.getSource();
String completeBehind = "XX";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
cu.codeComplete(cursorLocation, requestor);
assertResults(
"XX1[TYPE_REF]{a.XX1, a, La.XX1;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
"XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
requestor.getResults());
} finally {
this.deleteProject("P1");
this.deleteProject("P2");
this.deleteProject("P3");
JavaCore.setOptions(oldOptions);
}
}
public void testAccessRestriction9() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaCore.ERROR);
options.put(JavaCore.CODEASSIST_HIDE_RESTRICTED_REFERENCES, JavaCore.ERROR);
JavaCore.setOptions(options);
// create variable
JavaCore.setClasspathVariables(
new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
null);
// create P1
this.createJavaProject(
"P1",
new String[]{"src"},
Util.getJavaClassLibs(),
"bin");
this.createFolder("/P1/src/p11");
this.createFile(
"/P1/src/p11/XX11.java",
"package p11;\n"+
"public class XX11 {\n"+
"}");
this.createFolder("/P1/src/p12");
this.createFile(
"/P1/src/p12/XX12.java",
"package p12;\n"+
"public class XX12 {\n"+
"}");
// create P2
this.createJavaProject(
"P2",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P1", "/P3"},
new String[][]{{}, {}},
new String[][]{{"p11/*"}, {"p31/*"}},
new boolean[]{true, true},
"bin",
null,
null,
null,
"1.4");
this.createFolder("/P2/src/p21");
this.createFile(
"/P2/src/p21/XX21.java",
"package p21;\n"+
"public class XX21 {\n"+
"}");
this.createFolder("/P2/src/p22");
this.createFile(
"/P2/src/p22/XX22.java",
"package p22;\n"+
"public class XX22 {\n"+
"}");
// create P3
this.createJavaProject(
"P3",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P1"},
new String[][]{{}},
new String[][]{{"p12/*"}},
new boolean[]{true},
"bin",
null,
null,
null,
"1.4");
this.createFolder("/P3/src/p31");
this.createFile(
"/P3/src/p31/XX31.java",
"package p31;\n"+
"public class XX31 {\n"+
"}");
this.createFolder("/P3/src/p32");
this.createFile(
"/P3/src/p32/XX32.java",
"package p32;\n"+
"public class XX32 {\n"+
"}");
// create PX
this.createJavaProject(
"PX",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P2"},
null,
null,
new boolean[]{false},
"bin",
null,
null,
null,
"1.4");
this.createFile(
"/PX/src/X.java",
"public class X {\n"+
" void foo() {\n"+
" XX\n"+
" }\n"+
"}");
waitUntilIndexesReady();
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
ICompilationUnit cu= getCompilationUnit("PX", "src", "", "X.java");
String str = cu.getSource();
String completeBehind = "XX";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
cu.codeComplete(cursorLocation, requestor);
assertResults(
"XX12[TYPE_REF]{p12.XX12, p12, Lp12.XX12;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
"XX21[TYPE_REF]{p21.XX21, p21, Lp21.XX21;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
"XX22[TYPE_REF]{p22.XX22, p22, Lp22.XX22;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
"XX32[TYPE_REF]{p32.XX32, p32, Lp32.XX32;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
requestor.getResults());
} finally {
this.deleteProject("P1");
this.deleteProject("P2");
this.deleteProject("P3");
this.deleteProject("PX");
JavaCore.setOptions(oldOptions);
}
}
public void testAccessRestriction10() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaCore.ERROR);
options.put(JavaCore.CODEASSIST_HIDE_RESTRICTED_REFERENCES, JavaCore.NEVER);
JavaCore.setOptions(options);
// create variable
JavaCore.setClasspathVariables(
new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
null);
// create P1
this.createJavaProject(
"P1",
new String[]{"src"},
Util.getJavaClassLibs(),
"bin");
this.createFolder("/P1/src/p11");
this.createFile(
"/P1/src/p11/XX11.java",
"package p11;\n"+
"public class XX11 {\n"+
"}");
this.createFolder("/P1/src/p12");
this.createFile(
"/P1/src/p12/XX12.java",
"package p12;\n"+
"public class XX12 {\n"+
"}");
// create P2
this.createJavaProject(
"P2",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P1", "/P3"},
new String[][]{{}, {}},
new String[][]{{"p11/*"}, {"p31/*"}},
new boolean[]{true, true},
"bin",
null,
null,
null,
"1.4");
this.createFolder("/P2/src/p21");
this.createFile(
"/P2/src/p21/XX21.java",
"package p21;\n"+
"public class XX21 {\n"+
"}");
this.createFolder("/P2/src/p22");
this.createFile(
"/P2/src/p22/XX22.java",
"package p22;\n"+
"public class XX22 {\n"+
"}");
// create P3
this.createJavaProject(
"P3",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P1"},
new String[][]{{}},
new String[][]{{"p12/*"}},
new boolean[]{true},
"bin",
null,
null,
null,
"1.4");
this.createFolder("/P3/src/p31");
this.createFile(
"/P3/src/p31/XX31.java",
"package p31;\n"+
"public class XX31 {\n"+
"}");
this.createFolder("/P3/src/p32");
this.createFile(
"/P3/src/p32/XX32.java",
"package p32;\n"+
"public class XX32 {\n"+
"}");
// create PX
this.createJavaProject(
"PX",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P2"},
null,
null,
new boolean[]{false},
"bin",
null,
null,
null,
"1.4");
this.createFile(
"/PX/src/X.java",
"public class X {\n"+
" void foo() {\n"+
" XX\n"+
" }\n"+
"}");
waitUntilIndexesReady();
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
ICompilationUnit cu= getCompilationUnit("PX", "src", "", "X.java");
String str = cu.getSource();
String completeBehind = "XX";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
cu.codeComplete(cursorLocation, requestor);
assertResults(
"XX11[TYPE_REF]{p11.XX11, p11, Lp11.XX11;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE) + "}\n" +
"XX31[TYPE_REF]{p31.XX31, p31, Lp31.XX31;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE) + "}\n" +
"XX12[TYPE_REF]{p12.XX12, p12, Lp12.XX12;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
"XX21[TYPE_REF]{p21.XX21, p21, Lp21.XX21;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
"XX22[TYPE_REF]{p22.XX22, p22, Lp22.XX22;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
"XX32[TYPE_REF]{p32.XX32, p32, Lp32.XX32;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
requestor.getResults());
} finally {
this.deleteProject("P1");
this.deleteProject("P2");
this.deleteProject("P3");
this.deleteProject("PX");
JavaCore.setOptions(oldOptions);
}
}
public void testAccessRestriction11() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaCore.ERROR);
options.put(JavaCore.CODEASSIST_HIDE_RESTRICTED_REFERENCES, JavaCore.ERROR);
JavaCore.setOptions(options);
// create variable
JavaCore.setClasspathVariables(
new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
null);
// create P1
this.createJavaProject(
"P1",
new String[]{"src"},
Util.getJavaClassLibs(),
"bin");
this.createFolder("/P1/src/x/y/z/p11");
this.createFile(
"/P1/src/x/y/z/p11/XX11.java",
"package x.y.z.p11;\n"+
"public class XX11 {\n"+
"}");
this.createFolder("/P1/src/x/y/z/p12");
this.createFile(
"/P1/src/x/y/z/p12/XX12.java",
"package x.y.z.p12;\n"+
"public class XX12 {\n"+
"}");
// create P2
this.createJavaProject(
"P2",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P3", "/P1"},
new String[][]{{}, {}},
new String[][]{{"x/y/z/p31/*"}, {"x/y/z/p11/*"}},
new boolean[]{true, true},
"bin",
null,
null,
null,
"1.4");
this.createFolder("/P2/src/x/y/z/p21");
this.createFile(
"/P2/src/x/y/z/p21/XX21.java",
"package x.y.z.p21;\n"+
"public class XX21 {\n"+
"}");
this.createFolder("/P2/src/x/y/z/p22");
this.createFile(
"/P2/src/x/y/z/p22/XX22.java",
"package x.y.z.p22;\n"+
"public class XX22 {\n"+
"}");
// create P3
this.createJavaProject(
"P3",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P1"},
new String[][]{{}},
new String[][]{{"x/y/z/p12/*"}},
new boolean[]{true},
"bin",
null,
null,
null,
"1.4");
this.createFolder("/P3/src/x/y/z/p31");
this.createFile(
"/P3/src/x/y/z/p31/XX31.java",
"package x.y.z.p31;\n"+
"public class XX31 {\n"+
"}");
this.createFolder("/P3/src/x/y/z/p32");
this.createFile(
"/P3/src/x/y/z/p32/XX32.java",
"package x.y.z.p32;\n"+
"public class XX32 {\n"+
"}");
// create PX
this.createJavaProject(
"PX",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P2"},
null,
null,
new boolean[]{false},
"bin",
null,
null,
null,
"1.4");
this.createFile(
"/PX/src/X.java",
"public class X {\n"+
" void foo() {\n"+
" XX\n"+
" }\n"+
"}");
waitUntilIndexesReady();
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
ICompilationUnit cu= getCompilationUnit("PX", "src", "", "X.java");
String str = cu.getSource();
String completeBehind = "XX";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
cu.codeComplete(cursorLocation, requestor);
assertResults(
"XX11[TYPE_REF]{x.y.z.p11.XX11, x.y.z.p11, Lx.y.z.p11.XX11;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
"XX21[TYPE_REF]{x.y.z.p21.XX21, x.y.z.p21, Lx.y.z.p21.XX21;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
"XX22[TYPE_REF]{x.y.z.p22.XX22, x.y.z.p22, Lx.y.z.p22.XX22;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
"XX32[TYPE_REF]{x.y.z.p32.XX32, x.y.z.p32, Lx.y.z.p32.XX32;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
requestor.getResults());
} finally {
this.deleteProject("P1");
this.deleteProject("P2");
this.deleteProject("P3");
this.deleteProject("PX");
JavaCore.setOptions(oldOptions);
}
}
public void testAccessRestriction12() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaCore.ERROR);
options.put(JavaCore.CODEASSIST_HIDE_RESTRICTED_REFERENCES, JavaCore.NEVER);
JavaCore.setOptions(options);
// create variable
JavaCore.setClasspathVariables(
new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
null);
// create P1
this.createJavaProject(
"P1",
new String[]{"src"},
Util.getJavaClassLibs(),
"bin");
this.createFolder("/P1/src/p11");
this.createFile(
"/P1/src/p11/XX11.java",
"package p11;\n"+
"public class XX11 {\n"+
"}");
this.createFolder("/P1/src/p12");
this.createFile(
"/P1/src/p12/XX12.java",
"package p12;\n"+
"public class XX12 {\n"+
"}");
// create P2
this.createJavaProject(
"P2",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P3", "/P1"},
new String[][]{{}, {}},
new String[][]{{"p31/*"}, {"p11/*"}},
new boolean[]{true, true},
"bin",
null,
null,
null,
"1.4");
this.createFolder("/P2/src/p21");
this.createFile(
"/P2/src/p21/XX21.java",
"package p21;\n"+
"public class XX21 {\n"+
"}");
this.createFolder("/P2/src/p22");
this.createFile(
"/P2/src/p22/XX22.java",
"package p22;\n"+
"public class XX22 {\n"+
"}");
// create P3
this.createJavaProject(
"P3",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P1"},
new String[][]{{}},
new String[][]{{"p12/*"}},
new boolean[]{true},
"bin",
null,
null,
null,
"1.4");
this.createFolder("/P3/src/p31");
this.createFile(
"/P3/src/p31/XX31.java",
"package p31;\n"+
"public class XX31 {\n"+
"}");
this.createFolder("/P3/src/p32");
this.createFile(
"/P3/src/p32/XX32.java",
"package p32;\n"+
"public class XX32 {\n"+
"}");
// create PX
this.createJavaProject(
"PX",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P2"},
null,
null,
new boolean[]{false},
"bin",
null,
null,
null,
"1.4");
this.createFile(
"/PX/src/X.java",
"public class X {\n"+
" void foo() {\n"+
" XX\n"+
" }\n"+
"}");
waitUntilIndexesReady();
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
ICompilationUnit cu= getCompilationUnit("PX", "src", "", "X.java");
String str = cu.getSource();
String completeBehind = "XX";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
cu.codeComplete(cursorLocation, requestor);
assertResults(
"XX12[TYPE_REF]{p12.XX12, p12, Lp12.XX12;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE) + "}\n" +
"XX31[TYPE_REF]{p31.XX31, p31, Lp31.XX31;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE) + "}\n" +
"XX11[TYPE_REF]{p11.XX11, p11, Lp11.XX11;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
"XX21[TYPE_REF]{p21.XX21, p21, Lp21.XX21;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
"XX22[TYPE_REF]{p22.XX22, p22, Lp22.XX22;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" +
"XX32[TYPE_REF]{p32.XX32, p32, Lp32.XX32;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
requestor.getResults());
} finally {
this.deleteProject("P1");
this.deleteProject("P2");
this.deleteProject("P3");
this.deleteProject("PX");
JavaCore.setOptions(oldOptions);
}
}
public void testAccessRestriction13() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaCore.WARNING);
options.put(JavaCore.CODEASSIST_HIDE_RESTRICTED_REFERENCES, JavaCore.ERROR);
JavaCore.setOptions(options);
// create variable
JavaCore.setClasspathVariables(
new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
null);
// create P1
this.createJavaProject(
"P1",
new String[]{"src"},
Util.getJavaClassLibs(),
"bin");
this.createFolder("/P1/src/a");
this.createFile(
"/P1/src/a/XX1.java",
"package a;\n"+
"public class XX1 {\n"+
"}");
this.createFolder("/P1/src/b");
this.createFile(
"/P1/src/b/XX2.java",
"package b;\n"+
"public class XX2 {\n"+
"}");
// create P2
this.createJavaProject(
"P2",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P1"},
new String[][]{{}},
new String[][]{{"a/*"}},
new boolean[]{false},
"bin",
null,
null,
null,
"1.4");
this.createFile(
"/P2/src/YY.java",
"public class YY {\n"+
" void foo() {\n"+
" XX\n"+
" }\n"+
"}");
waitUntilIndexesReady();
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
ICompilationUnit cu= getCompilationUnit("P2", "src", "", "YY.java");
String str = cu.getSource();
String completeBehind = "XX";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
cu.codeComplete(cursorLocation, requestor);
assertResults(
"XX1[TYPE_REF]{a.XX1, a, La.XX1;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE) + "}\n" +
"XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
requestor.getResults());
} finally {
this.deleteProject("P1");
this.deleteProject("P2");
JavaCore.setOptions(oldOptions);
}
}
public void testAccessRestriction14() throws Exception {
Hashtable oldOptions = JavaCore.getOptions();
try {
Hashtable options = new Hashtable(oldOptions);
options.put(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaCore.WARNING);
options.put(JavaCore.CODEASSIST_HIDE_RESTRICTED_REFERENCES, JavaCore.WARNING);
JavaCore.setOptions(options);
// create variable
JavaCore.setClasspathVariables(
new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
null);
// create P1
this.createJavaProject(
"P1",
new String[]{"src"},
Util.getJavaClassLibs(),
"bin");
this.createFolder("/P1/src/a");
this.createFile(
"/P1/src/a/XX1.java",
"package a;\n"+
"public class XX1 {\n"+
"}");
this.createFolder("/P1/src/b");
this.createFile(
"/P1/src/b/XX2.java",
"package b;\n"+
"public class XX2 {\n"+
"}");
// create P2
this.createJavaProject(
"P2",
new String[]{"src"},
Util.getJavaClassLibs(),
null,
null,
new String[]{"/P1"},
new String[][]{{}},
new String[][]{{"a/*"}},
new boolean[]{false},
"bin",
null,
null,
null,
"1.4");
this.createFile(
"/P2/src/YY.java",
"public class YY {\n"+
" void foo() {\n"+
" XX\n"+
" }\n"+
"}");
waitUntilIndexesReady();
// do completion
CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
ICompilationUnit cu= getCompilationUnit("P2", "src", "", "YY.java");
String str = cu.getSource();
String completeBehind = "XX";
int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
cu.codeComplete(cursorLocation, requestor);
assertResults(
"XX2[TYPE_REF]{b.XX2, b, Lb.XX2;, null, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}",
requestor.getResults());
} finally {
this.deleteProject("P1");
this.deleteProject("P2");
JavaCore.setOptions(oldOptions);
}
}
//public void testAccessRestrictionX() throws Exception {
// Hashtable oldOptions = JavaCore.getOptions();
// try {
// Hashtable options = new Hashtable(oldOptions);
// options.put(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, JavaCore.ERROR);
// options.put(JavaCore.CODEASSIST_RESTRICTIONS_CHECK, JavaCore.DISABLED);
// JavaCore.setOptions(options);
//
// // create variable
// JavaCore.setClasspathVariables(
// new String[] {"JCL_LIB", "JCL_SRC", "JCL_SRCROOT"},
// new IPath[] {getExternalJCLPath(), getExternalJCLSourcePath(), getExternalJCLRootSourcePath()},
// null);
//
// // create P1
// this.createJavaProject(
// "P1",
// new String[]{"src"},
// Util.getJavaClassLibs(),
// "bin");
//
// this.createFolder("/P1/src/a");
// this.createFile(
// "/P1/src/a/XX1.java",
// "package a;\n"+
// "public class XX1 {\n"+
// " public void foo() {\n"+
// " }\n"+
// "}");
//
// // create P2
// this.createJavaProject(
// "P2",
// new String[]{"src"},
// Util.getJavaClassLibs(),
// null,
// null,
// new String[]{"/P1"},
// new String[][]{{}},
// new String[][]{{"a/*"}},
// new boolean[]{false},
// "bin",
// null,
// null,
// null,
// "1.4");
// this.createFile(
// "/P2/src/YY.java",
// "public class YY {\n"+
// " void foo() {\n"+
// " a.XX1 x;\n"+
// " x.fo\n"+
// " }\n"+
// "}");
//
// waitUntilIndexesReady();
//
// // do completion
// CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2();
// ICompilationUnit cu= getCompilationUnit("P2", "src", "", "YY.java");
//
// String str = cu.getSource();
// String completeBehind = "x.fo";
// int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
// cu.codeComplete(cursorLocation, requestor);
//
// assertResults(
// "foo[METHOD_REF]{foo(), La.XX1;, ()V, foo, "+(R_DEFAULT + R_INTERESTING + R_CASE + R_NON_STATIC) + "}",
// requestor.getResults());
// } finally {
// this.deleteProject("P1");
// this.deleteProject("P2");
// JavaCore.setOptions(oldOptions);
// }
//}
}
| [
"375833274@qq.com"
] | 375833274@qq.com |
0b8597ef7eb6f59dd75b26f4126be42e77afbd38 | ba18e1cae94fc0438d63a36419488c34c124067b | /src/main/java/com/example/demo/config/DBConfig.java | 5d7796d139df9a8ae5703ae9a16345657d2c62ae | [] | no_license | youjeong2/ChueokTree | 8f1f5ed7f590ba4d85be7711be5c76d534ba9dda | be7bc694d0724affd03e1fcf0fb188d926254c09 | refs/heads/master | 2022-12-22T09:22:00.534088 | 2020-09-25T10:43:33 | 2020-09-25T10:43:33 | 290,638,604 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,258 | java | package com.example.demo.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import javax.sql.DataSource;
// 게시판 만들 때 DB연동할 때 쓰는 DBConfig
// Configuration은 설정파일임을 명시하는 부분이다.
// 몇몇 특정 지정된 키워드들을 제외한 사용자 커스텀 클래스의 경우엔
// 설정 파일임을 명시해 줄 필요성이 있다.
@Configuration
public class DBConfig {
// Spring 프레임워크에서 관리하는 객체를 Bean이라고 한다.
@Bean
public DataSource dataSource() {
// JPA 하이버네이트트 사용하기 위한 목적으로 설정하는 것들
// MySQL의 사용자 비번 구동 드라이버 위치등을 지정하면 된다.
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl(
"jdbc:mysql://localhost:3306/blueberrydb?serverTimezone=UTC&useSSL=false"
);
dataSource.setUsername("bitai");
dataSource.setPassword("456123");
return dataSource;
}
}
| [
"feb_green@naver.com"
] | feb_green@naver.com |
1048c52a69fb22a0ea87ae4f52b7cbeeda95fe63 | 86bca7eb4691f789b0eb852a28b8235dcb5535d7 | /RISE-V2G-Shared/src/main/java/com/v2gclarity/risev2g/shared/v2gMessages/msgDef/PaymentDetailsReqType.java | 146d504f365b6f821e5505ba8f542993b6b4b287 | [
"MIT"
] | permissive | mesru/rise-v2g | 3e6e208a724e8644b64b11a50d837b7bb342d192 | f532aa3b5d8f48e14df3d3199c7cb00f4251f213 | refs/heads/master | 2022-02-28T04:15:07.467536 | 2019-10-31T22:56:27 | 2019-10-31T22:56:27 | 218,875,140 | 0 | 1 | MIT | 2022-01-27T16:20:33 | 2019-10-31T23:00:22 | Java | UTF-8 | Java | false | false | 4,173 | java | /*******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2015 - 2019 Dr. Marc Mültin (V2G Clarity)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*******************************************************************************/
//
// Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 generiert
// Siehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Änderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren.
// Generiert: 2014.10.07 um 04:55:05 PM CEST
//
package com.v2gclarity.risev2g.shared.v2gMessages.msgDef;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java-Klasse für PaymentDetailsReqType complex type.
*
* <p>Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
*
* <pre>
* <complexType name="PaymentDetailsReqType">
* <complexContent>
* <extension base="{urn:iso:15118:2:2013:MsgBody}BodyBaseType">
* <sequence>
* <element name="eMAID" type="{urn:iso:15118:2:2013:MsgDataTypes}eMAIDType"/>
* <element name="ContractSignatureCertChain" type="{urn:iso:15118:2:2013:MsgDataTypes}CertificateChainType"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "PaymentDetailsReqType", namespace = "urn:iso:15118:2:2013:MsgBody", propOrder = {
"emaid",
"contractSignatureCertChain"
})
public class PaymentDetailsReqType
extends BodyBaseType
{
@XmlElement(name = "eMAID", required = true)
protected String emaid;
@XmlElement(name = "ContractSignatureCertChain", required = true)
protected CertificateChainType contractSignatureCertChain;
/**
* Ruft den Wert der emaid-Eigenschaft ab.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEMAID() {
return emaid;
}
/**
* Legt den Wert der emaid-Eigenschaft fest.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEMAID(String value) {
this.emaid = value;
}
/**
* Ruft den Wert der contractSignatureCertChain-Eigenschaft ab.
*
* @return
* possible object is
* {@link CertificateChainType }
*
*/
public CertificateChainType getContractSignatureCertChain() {
return contractSignatureCertChain;
}
/**
* Legt den Wert der contractSignatureCertChain-Eigenschaft fest.
*
* @param value
* allowed object is
* {@link CertificateChainType }
*
*/
public void setContractSignatureCertChain(CertificateChainType value) {
this.contractSignatureCertChain = value;
}
}
| [
"mesru.koprulu@trustonic.com"
] | mesru.koprulu@trustonic.com |
6dc5515e8e2452e36eed8ea065c8595bb2d05590 | 7e1511cdceeec0c0aad2b9b916431fc39bc71d9b | /flakiness-predicter/input_data/original_tests/qos-ch-logback/nonFlakyMethods/ch.qos.logback.core.util.TimeUtilTest-testHour.java | e32a742e6edb8bb41cf5641cf679b9e85d3ef183 | [
"BSD-3-Clause"
] | permissive | Taher-Ghaleb/FlakeFlagger | 6fd7c95d2710632fd093346ce787fd70923a1435 | 45f3d4bc5b790a80daeb4d28ec84f5e46433e060 | refs/heads/main | 2023-07-14T16:57:24.507743 | 2021-08-26T14:50:16 | 2021-08-26T14:50:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 320 | java | @Test public void testHour(){
long now=1164045917522L;
now=correctBasedOnTimeZone(now);
long expected=1164049200000L;
expected=correctBasedOnTimeZone(expected);
long computed=TimeUtil.computeStartOfNextHour(now);
assertEquals(expected - now,1000 * (42 + 60 * 54) + 478);
assertEquals(expected,computed);
}
| [
"aalsha2@masonlive.gmu.edu"
] | aalsha2@masonlive.gmu.edu |
04304800ce974318a84e2998a0736c538f55f217 | 57c4edf89e59ff8cc8bcb8637ae423a58aedc14b | /src/main/java/com/agile/supermarket/entities/enums/Role.java | 8fe3fece888cf821db556f78ab9189ac81b2e33f | [] | no_license | joaoaraujo-agile/supermarket | f1f13c2861521c029a911b05fb402b10f39c8a9b | a23ad88e06a7086ce840e5e5ad4998412062cd54 | refs/heads/master | 2023-05-05T07:29:03.806819 | 2021-05-21T15:10:44 | 2021-05-21T15:10:44 | 368,612,138 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 696 | java | package com.agile.supermarket.entities.enums;
public enum Role {
ADMIN(1, "ROLE_ADMIN"), CASHIER(2, "ROLE_CASHIER");
private int code;
private String description;
private Role(int code, String description) {
this.code = code;
this.description = description;
}
public int getCode() {
return code;
}
public String getDescription() {
return description;
}
public static Role valueOf(Integer code) {
if (code == null) {
return null;
}
for (Role x : Role.values()) {
if (code.equals(x.getCode())) {
return x;
}
}
throw new IllegalArgumentException("Invalid AppointmentType code " + code);
}
public void setCode(int code) {
this.code = code;
}
}
| [
"joao.araujo@agilesolutions.com"
] | joao.araujo@agilesolutions.com |
7ff671ece7bb4afd40c67732733720f7a256bf1d | bc78a8dee0c7cddf4c0d0ef7fd0ddea2bded926d | /src/test/java/Tests.java | ab51019d84efbc82dc4eae3c6d2b1efad75c5cfb | [] | no_license | igorzip228/TestApiProvectus | fe4b0f5c57cce13161834b805a55ddb33676868a | 30c33ee9555e43aefc958bd7031456c15872da7c | refs/heads/master | 2020-04-23T21:48:01.975628 | 2019-02-19T13:56:05 | 2019-02-19T13:56:05 | 171,481,369 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,122 | java | import com.jayway.jsonpath.JsonPath;
import com.jayway.jsonpath.ReadContext;
import io.restassured.RestAssured;
import org.testng.annotations.Test;
public class Tests {
int userId;
@Test
public void getRequest() {
String response =
RestAssured.given()
.baseUri("https://jsonplaceholder.typicode.com")
.basePath("/posts/100")
.header("Content-Type", "application/json")
.when().get()
.then()
.statusCode(200)
.extract()
.response()
.prettyPrint();
ReadContext context = JsonPath.parse(response);
int userId = context.read("$.userId");
this.userId = userId;
int id = context.read("$.id");
String title = context.read("$.title");
String body = context.read("$.body");
}
@Test
public void postRequest() {
String postResponse =
RestAssured.given()
.baseUri("https://jsonplaceholder.typicode.com")
.basePath("/posts")
.header("Content-Type", "application/json")
.body("{\n" +
"\"title\": \"foor_your_test_data\",\n" +
"\"body\": \"bary_your_test_data\",\n" +
"\"userId\": \"" + this.userId + "\"\n" +
"}\n")
.when().post()
.then()
.statusCode(201)
.extract()
.response()
.prettyPrint();
System.err.println(postResponse);
ReadContext contextPost = JsonPath.parse(postResponse);
String titlePost = contextPost.read("$.title");
String bodyPost = contextPost.read("$.body");
String userIdPost = contextPost.read("$.userId");
int idPost = contextPost.read("$.id");
}
}
| [
"igorzip228@gmail.com"
] | igorzip228@gmail.com |
f1ce4f5d15c2d1f0726596352ae212144ebb3ee1 | b7e52ec619ad6f104f6e38ec782d37b31d129df8 | /src/main/java/com/offer/domain/AirPort.java | 2a727d3ece7b94d325eb47c29661904842f0fdd1 | [
"Apache-2.0"
] | permissive | gethub102/flight-booking-system | 48d414fcf10751d48c4fdc01bd4acda7cdf11987 | 9f32797f09f6b232678bc0fc1617651d8524fcc8 | refs/heads/master | 2020-03-17T22:51:23.834211 | 2018-05-26T06:22:58 | 2018-05-26T06:22:58 | 134,020,779 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 230 | java | package main.java.com.offer.domain;
import java.util.ArrayList;
import java.util.List;
public class AirPort {
public static final List<SeatsOfFlight> SEATS_OF_FLIGHTS = new ArrayList<>();
public AirPort() {
}
}
| [
"sunetwli102@gmail.com"
] | sunetwli102@gmail.com |
0731b113cd06b4aded16a9a405aec5e7d9e4405b | b5818033491e2353707a9b6ce3c31f8be734ee16 | /src/com/yiyi/test/Thread/Ticket.java | 689671590fc48dae87c6ea6fc03dfbe80fab3155 | [] | no_license | yiyisf/unit01 | 1a9692c146be1e5b18eab6ba1a8a1cd791035f1f | 46bdc3fc96f67a536aedda4eccef0663a18fe0f2 | refs/heads/master | 2021-01-11T02:29:22.020773 | 2016-11-01T13:58:40 | 2016-11-01T13:58:40 | 70,962,534 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 541 | java | package com.yiyi.test.Thread;
/**
* Created by liuzhe on 2016/7/4.
*/
public class Ticket {
private static Ticket ourInstance = new Ticket();
private static Integer total = 1000;
public static Ticket getInstance() {
return ourInstance;
}
private Ticket() {
}
// private static int total = 1000;
public Boolean getTicket(){
synchronized(this) {
if (total > 0) {
total--;
return true;
}
return false;
}
}
}
| [
"yiyi119120@gmail.com"
] | yiyi119120@gmail.com |
97d8d8d691e8ed22ca4faea9a13ef717497946b0 | 9ba8afade44acb5d429e0cff30a7d3533f8b403c | /src/com/opengamma/analytics/financial/model/finitedifference/ExplicitFiniteDifference2D.java | 7be8e4d88d15d68492921a4234037146519adc37 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0",
"LicenseRef-scancode-red-hat-attribution"
] | permissive | ColumbiaDataScienceCorporation/idylfin | 3ae8a176d5b89cdba37df3fd058bdc04185cc326 | 0e45efbe524a0f7a92049d4904407ed4eef4222a | refs/heads/master | 2020-12-15T18:56:37.883173 | 2014-02-03T20:05:11 | 2014-02-03T20:05:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,685 | java | /**
* Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.analytics.financial.model.finitedifference;
import org.apache.commons.lang.Validate;
import com.opengamma.analytics.math.cube.Cube;
/**
* <b>Note</b> this is for testing purposes and is not recommended for actual use
*/
public class ExplicitFiniteDifference2D implements ConvectionDiffusionPDESolver2D {
@Override
public double[][] solve(ConvectionDiffusion2DPDEDataBundle pdeData, int tSteps, int xSteps, int ySteps, double tMax, BoundaryCondition2D xLowerBoundary, BoundaryCondition2D xUpperBoundary,
BoundaryCondition2D yLowerBoundary, BoundaryCondition2D yUpperBoundary) {
return solve(pdeData, tSteps, xSteps, ySteps, tMax, xLowerBoundary, xUpperBoundary, yLowerBoundary, yUpperBoundary, null);
}
@Override
public double[][] solve(ConvectionDiffusion2DPDEDataBundle pdeData, final int tSteps, final int xSteps, final int ySteps, final double tMax, BoundaryCondition2D xLowerBoundary,
BoundaryCondition2D xUpperBoundary, BoundaryCondition2D yLowerBoundary, BoundaryCondition2D yUpperBoundary, final Cube<Double, Double, Double, Double> freeBoundary) {
double dt = tMax / (tSteps);
double dx = (xUpperBoundary.getLevel() - xLowerBoundary.getLevel()) / (xSteps);
double dy = (yUpperBoundary.getLevel() - yLowerBoundary.getLevel()) / (ySteps);
double dtdx2 = dt / dx / dx;
double dtdx = dt / dx;
double dtdy2 = dt / dy / dy;
double dtdy = dt / dy;
double dtdxdy = dt / dy / dx;
double[][] v = new double[xSteps + 1][ySteps + 1];
double[] x = new double[xSteps + 1];
double[] y = new double[ySteps + 1];
double currentX = 0;
double currentY = 0;
for (int j = 0; j <= ySteps; j++) {
currentY = yLowerBoundary.getLevel() + j * dy;
y[j] = currentY;
}
for (int i = 0; i <= xSteps; i++) {
currentX = xLowerBoundary.getLevel() + i * dx;
x[i] = currentX;
for (int j = 0; j <= ySteps; j++) {
v[i][j] = pdeData.getInitialValue(x[i], y[j]);
}
}
double sum;
double t = 0.0;
for (int k = 0; k < tSteps; k++) {
double[][] vNew = new double[xSteps + 1][ySteps + 1];
for (int i = 1; i < xSteps; i++) {
for (int j = 1; j < ySteps; j++) {
double a = pdeData.getA(t, x[i], y[j]);
double b = pdeData.getB(t, x[i], y[j]);
double c = pdeData.getC(t, x[i], y[j]);
double d = pdeData.getD(t, x[i], y[j]);
double e = pdeData.getE(t, x[i], y[j]);
double f = pdeData.getF(t, x[i], y[j]);
sum = v[i][j];
sum -= a * dtdx2 * (v[i + 1][j] - 2 * v[i][j] + v[i - 1][j]);
sum -= b * dtdx / 2 * (v[i + 1][j] - v[i - 1][j]);
sum -= c * dt * v[i][j];
sum -= d * dtdy2 * (v[i][j + 1] - 2 * v[i][j] + v[i][j - 1]);
sum -= e * dtdxdy / 4 * (v[i + 1][j + 1] + v[i - 1][j - 1] - v[i + 1][j - 1] - v[i - 1][j + 1]);
sum -= f * dtdy / 2 * (v[i][j + 1] - v[i][j - 1]);
vNew[i][j] = sum;
}
}
// The y = ymin and y = ymax boundaries
for (int i = 1; i < xSteps; i++) {
double[] temp = yLowerBoundary.getRightMatrixCondition(pdeData, t, x[i]);
sum = 0;
for (int n = 0; n < temp.length; n++) {
sum += temp[n] * v[i][n];
}
double q = sum + yLowerBoundary.getConstant(pdeData, t, x[i], dy);
sum = 0;
temp = yLowerBoundary.getLeftMatrixCondition(pdeData, x[i], t);
Validate.isTrue(temp[0] != 0.0);
for (int k1 = 1; k1 < temp.length; k1++) {
sum += temp[k1] * vNew[i][k1];
}
vNew[i][0] = (q - sum) / temp[0];
temp = yUpperBoundary.getRightMatrixCondition(pdeData, t, x[i]);
sum = 0;
for (int n = 0; n < temp.length; n++) {
sum += temp[n] * v[i][ySteps + n + 1 - temp.length];
}
q = sum + yUpperBoundary.getConstant(pdeData, t, x[i], dy);
sum = 0;
temp = yUpperBoundary.getLeftMatrixCondition(pdeData, t, x[i]);
for (int k1 = 0; k1 < temp.length - 1; k1++) {
sum += temp[k1] * vNew[i][ySteps + k1 + 1 - temp.length];
}
vNew[i][ySteps] = (q - sum) / temp[temp.length - 1];
}
// The x = xmin and x = xmax boundaries
for (int j = 0; j <= ySteps; j++) {
double[] temp = xLowerBoundary.getRightMatrixCondition(pdeData, y[j], t);
sum = 0;
for (int n = 0; n < temp.length; n++) {
sum += temp[n] * v[n][j];
}
double q = sum + xLowerBoundary.getConstant(pdeData, t, y[j], dx);
sum = 0;
temp = xLowerBoundary.getLeftMatrixCondition(pdeData, t, y[j]);
for (int k1 = 1; k1 < temp.length; k1++) {
sum += temp[k1] * vNew[k1][j];
}
vNew[0][j] = (q - sum) / temp[0];
temp = xUpperBoundary.getRightMatrixCondition(pdeData, t, y[j]);
sum = 0;
for (int n = 0; n < temp.length; n++) {
sum += temp[n] * v[xSteps + n + 1 - temp.length][j];
}
q = sum + xUpperBoundary.getConstant(pdeData, t, y[j], dx);
sum = 0;
temp = xUpperBoundary.getLeftMatrixCondition(pdeData, t, y[j]);
for (int k1 = 0; k1 < temp.length - 1; k1++) {
sum += temp[k1] * vNew[xSteps + k1 + 1 - temp.length][j];
}
vNew[xSteps][j] = (q - sum) / temp[temp.length - 1];
}
// //average to find corners
// vNew[0][0] = (vNew[0][1]+vNew[1][0])/2;
// TODO American payoff
t += dt;
v = vNew;
}
return v;
}
}
| [
"cooper.charles.m@gmail.com"
] | cooper.charles.m@gmail.com |
58f49a7783185e8d92e46573eb33e92f70be1834 | 3536e7a637f852f2bc8630bcc9fb32eddc15a224 | /src/test/java/com/github/perscholas/personrepository/FindAllTest.java | 2ab5c88c581c08cb3f5f8c59476fe20fbfc47311 | [] | no_license | FulChr3356/exercise.jpa-mvc_convert-from-jdbc | 36cc072c67bfa1a324d11e7bd2cc86039cb9ce7a | 6b313ef163b338d153809f054a41f50d9b11c921 | refs/heads/master | 2022-12-05T13:36:47.136413 | 2020-08-18T00:00:34 | 2020-08-18T00:00:34 | 288,264,661 | 0 | 0 | null | 2020-08-17T19:08:30 | 2020-08-17T19:08:29 | null | UTF-8 | Java | false | false | 1,175 | java | package com.github.perscholas.personrepository;
import com.github.perscholas.DatabaseConnection;
import com.github.perscholas.JdbcConfigurator;
import com.github.perscholas.dao.PersonRepository;
import com.github.perscholas.model.Person;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import java.util.List;
/**
* Created by leon on 8/14/2020.
*/
public class FindAllTest {
private DatabaseConnection databaseConnection;
@Before
public void setup() {
// given
this.databaseConnection = DatabaseConnection.TESTING_DATABASE;
JdbcConfigurator configurator = new JdbcConfigurator(databaseConnection);
configurator.appendSqlScript("testing.person_create-table.sql");
configurator.appendSqlScript("testing.person_populate-table.sql");
configurator.initialize();
}
@Test
public void test() {
// given
PersonRepository repository = new PersonRepository(databaseConnection);
// when
List<Person> personList = repository.findAll();
// then
Assert.assertFalse(personList.isEmpty());
}
}
| [
"xleonhunter@gmail.com"
] | xleonhunter@gmail.com |
edf2c68775880919885c15a4f2ea97a2208e0115 | a107d5785c4d0b58a8158308ad0a65513a448fdc | /midterm1/src/midterm1/Student.java | 37e50a8063b53261ac9cb3a19753a28c86a092c9 | [] | no_license | wenbinli96/midterm | dce62674a7236ba3994bc75f6f1d4e0b7cef09c5 | 7d747410231700a44c8b4375c8e1c63e5b1cae17 | refs/heads/master | 2020-05-19T22:59:17.033754 | 2015-03-17T20:31:08 | 2015-03-17T20:31:08 | 32,418,509 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 534 | java | package midterm1;
public class Student extends People{
private String GradeLevel;
public String getGradeLevel(int Level){
String GradeLevel= "";
switch(Level){
case 1: GradeLevel = "Freshmen";
break;
case 2: GradeLevel = "Sophomore";
break;
case 3: GradeLevel = "Junior";
break;
case 4: GradeLevel = "Senior";
break;
}
return GradeLevel;
}
public String setGradeLevel(String GradeLevel){
return this.GradeLevel;
}
public String toString(){
return this.getName();
}
}
| [
"Bin@128.4.156.240"
] | Bin@128.4.156.240 |
ff6907387b6994129e178508142076e7487bd57d | b5cede23839767b12c933bfd4fa57d780506f92f | /src/main/java/hello/MyJLabel.java | 28670e68f0d2af63c57f3757e499202e18494187 | [] | no_license | VinV5/AddressBook | c51a0d3491026df46db567d044ac4f5229bc0bac | f9c86ee5b7b2590695b75dba55c82c839878dada | refs/heads/master | 2021-01-22T03:43:53.357539 | 2017-02-09T17:17:51 | 2017-02-09T17:17:51 | 81,452,788 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 252 | java | package hello;/**
* Created by vincentvu on 1/26/2017.
*/
import org.springframework.stereotype.*;
import javax.swing.JLabel;
import java.awt.*;
public class MyJLabel extends JLabel{
public MyJLabel(String name){
setText(name);
}
}
| [
"vincentvu@CB5109-09.labs.sce.carleton.ca"
] | vincentvu@CB5109-09.labs.sce.carleton.ca |
3985c55872035921495f904440c9b6cc52d2f530 | da916cb0517ccb7e9e581086a32dbaffdeb67082 | /src/com/agiletec/aps/system/common/entity/model/attribute/ListAttribute.java | 30279b3232579ce15075777440122f84f22e46ab | [] | no_license | zendasi/PortalExample | 4cfb24415bb191f1926d7023bdc614fdc6df8607 | 40a195c9fe1aadc2e1a9e3325b022421414754c7 | refs/heads/master | 2022-11-30T09:23:41.105250 | 2012-03-25T16:50:00 | 2012-03-25T16:50:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,604 | java | /*
*
* Copyright 2005 AgileTec s.r.l. (http://www.agiletec.it) All rights reserved.
*
* This file is part of jAPS software.
* jAPS is a free software;
* you can redistribute it and/or modify it
* under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation; version 2.
*
* See the file License for the specific language governing permissions
* and limitations under the License
*
*
*
* Copyright 2005 AgileTec s.r.l. (http://www.agiletec.it) All rights reserved.
*
*/
package com.agiletec.aps.system.common.entity.model.attribute;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.jdom.Element;
/**
* This class represents the Attribute of type "Multi-language List", composed by several
* homogeneous attributes; there is a list for every language in the system.
* @author M.Diana
*/
public class ListAttribute extends AbstractListAttribute {
/**
* Initialize the data structure.
*/
public ListAttribute() {
this._listMap = new HashMap<String, List<AttributeInterface>>();
}
/**
* Add a new empty attribute to the list in the specified language.
* @param langCode The code of the language.
* @return The attribute added to the list, ready to be populated with
* the data.
*/
public AttributeInterface addAttribute(String langCode) {
AttributeInterface newAttr = (AttributeInterface) this.getNestedAttributeType().getAttributePrototype();
newAttr.setDefaultLangCode(this.getDefaultLangCode());
newAttr.setParentEntity(this.getParentEntity());
List<AttributeInterface> attrList = this.getAttributeList(langCode);
attrList.add(newAttr);
return newAttr;
}
/**
* Return the list of attributes of the desired language.
* @param langCode The language code.
* @return A list of homogeneous attributes.
*/
public List<AttributeInterface> getAttributeList(String langCode) {
List<AttributeInterface> attrList = (List<AttributeInterface>) _listMap.get(langCode);
if (attrList == null) {
attrList = new ArrayList<AttributeInterface>();
this._listMap.put(langCode, attrList);
}
return attrList;
}
/**Return the list of attributes in the current rendering language.
* @return A list of homogeneous attributes.
*/
@Override
public Object getRenderingAttributes() {
List<AttributeInterface> attrList = this.getAttributeList(this.getRenderingLang());
return attrList;
}
/**
* Remove from the list one of the attributes of the given language.
* @param langCode The code of the language of the list where to delete the attribute from.
* @param index The index of the attribute in the list.
*/
public void removeAttribute(String langCode, int index) {
List<AttributeInterface> attrList = this.getAttributeList(langCode);
attrList.remove(index);
if (attrList.isEmpty()) {
this._listMap.remove(langCode);
}
}
/**
* @see com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface#setDefaultLangCode(java.lang.String)
*/
@Override
public void setDefaultLangCode(String langCode){
super.setDefaultLangCode(langCode);
Iterator<List<AttributeInterface>> values = this._listMap.values().iterator();
while (values.hasNext()) {
List<AttributeInterface> elementList = values.next();
Iterator<AttributeInterface> attributes = elementList.iterator();
while (attributes.hasNext()) {
AttributeInterface attribute = attributes.next();
attribute.setDefaultLangCode(langCode);
}
}
}
/**
* @see com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface#getJDOMElement()
*/
@Override
public Element getJDOMElement() {
Element listElement = new Element("list");
listElement.setAttribute("attributetype", this.getType());
listElement.setAttribute("name", this.getName());
listElement.setAttribute("nestedtype",this.getNestedAttributeTypeCode());
Iterator<String> langIter = _listMap.keySet().iterator();
while (langIter.hasNext()) {
String langCode = langIter.next();
Element listLangElement = new Element("listlang");
if (null != langCode) {
listLangElement.setAttribute("lang", langCode);
List<AttributeInterface> attributeList = this.getAttributeList(langCode);
Iterator<AttributeInterface> attributeListIter = attributeList.iterator();
while (attributeListIter.hasNext()) {
AttributeInterface attribute = attributeListIter.next();
Element attributeElement = attribute.getJDOMElement();
listLangElement.addContent(attributeElement);
}
listElement.addContent(listLangElement);
}
}
return listElement;
}
/**
* Return a Map containing all the localized versions of the associated list.
* @return A map indexed by the language code.
*/
public Map<String, List<AttributeInterface>> getAttributeListMap() {
return _listMap;
}
@Override
public List<AttributeInterface> getAttributes() {
List<AttributeInterface> attributes = new ArrayList<AttributeInterface>();
Iterator<List<AttributeInterface>> values = this.getAttributeListMap().values().iterator();
while (values.hasNext()) {
attributes.addAll(values.next());
}
return attributes;
}
@Override
public Object getValue() {
return this.getAttributeListMap();
}
/**
* @uml.property name="_listMap"
* @uml.associationEnd multiplicity="(0 -1)" ordering="true" elementType="com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface" qualifier="langCode:java.lang.String java.util.List"
*/
private Map<String, List<AttributeInterface>> _listMap;
}
| [
"joel2.718@gmail.com"
] | joel2.718@gmail.com |
e135d006cd9cfeaf8a7e16aa1ddcf470a3d121e6 | 5fd23165ba49448646eb231f0ce1528b472cf441 | /src/main/java/ng/upperlink/nibss/cmms/event/AuditEvent.java | 1024c06460e3c5941b2c4c8155e547a3ae04d826 | [] | no_license | jtobiora/cmms_nibss_module | b61570140fb3b4f66ccb55a75aee1f28de8915b4 | d5f0506d5c4ba871461a5ddb054c67d9a96f9d5e | refs/heads/master | 2020-05-05T03:35:13.940744 | 2019-04-05T12:40:18 | 2019-04-05T12:40:18 | 179,678,670 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 292 | java | package ng.upperlink.nibss.cmms.event;
import lombok.Data;
import ng.upperlink.nibss.cmms.model.WebAppAuditEntry;
@Data
public class AuditEvent {
private WebAppAuditEntry auditEntry;
public AuditEvent(WebAppAuditEntry auditEntry) {
this.auditEntry = auditEntry;
}
}
| [
"jtobiora@gmail.com"
] | jtobiora@gmail.com |
642c2e269f4d82b648f427b946da5a54b3170d72 | e6bedf8362645e8a4a36fe2f380066ea9a5431fe | /deet/src/deet/overlay/GameDetailsDisplay.java | 59f85eae0227d21e1f263c73477f4ee12face22e | [] | no_license | tmackgit/GameDev | 7059e57003700abded41e95cc8f3b397784225ec | 4d866831653c3d62cdd72bc54daa5450c016c6b9 | refs/heads/master | 2020-04-04T19:41:35.965535 | 2011-12-28T14:17:47 | 2011-12-28T14:18:16 | 2,161,486 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,568 | java | package deet.overlay;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import deet.graphics3D.Overlay;
import deet.math3D.ViewWindow;
import deet.object.actor.Player;
public class GameDetailsDisplay implements Overlay {
// increase health display by 20 points per second
private static final float DISPLAY_INC_RATE = 0.04f;
private Player player;
private float displayedHealth;
private Font font;
public GameDetailsDisplay(Player player) {
this.player = player;
displayedHealth = 0;
}
public void update(long elapsedTime) {
// increase or descrease displayedHealth a small amount
// at a time, instead of just setting it to the player's
// health.
float actualHealth = player.getHealth();
if (actualHealth > displayedHealth) {
displayedHealth = Math.min(actualHealth,
displayedHealth + elapsedTime * DISPLAY_INC_RATE);
}
else if (actualHealth < displayedHealth) {
displayedHealth = Math.max(actualHealth,
displayedHealth - elapsedTime * DISPLAY_INC_RATE);
}
}
public void draw(Graphics2D g, ViewWindow window) {
// set the font (scaled for this view window)
int fontHeight = Math.max(9, window.getHeight() / 20);
int spacing = fontHeight / 5;
if (font == null || fontHeight != font.getSize()) {
font = new Font("Dialog", Font.PLAIN, fontHeight);
}
g.setFont(font);
g.translate(window.getLeftOffset(), window.getTopOffset());
// draw health value (number)
String str = Integer.toString(Math.round(displayedHealth));
Rectangle2D strBounds = font.getStringBounds(str,
g.getFontRenderContext());
g.setColor(Color.WHITE);
g.drawString(str, spacing, (int)strBounds.getHeight());
// draw health bar
Rectangle bar = new Rectangle(
(int)strBounds.getWidth() + spacing * 2,
(int)strBounds.getHeight() / 2,
window.getWidth() / 4,
window.getHeight() / 60);
g.setColor(Color.GRAY);
g.fill(bar);
// draw highlighted part of health bar
bar.width = Math.round(bar.width *
displayedHealth / player.getMaxHealth());
g.setColor(Color.WHITE);
g.fill(bar);
}
public boolean isEnabled() {
return (player != null &&
(player.isAlive() || displayedHealth > 0));
}
}
| [
"tony.mack@gmail.com"
] | tony.mack@gmail.com |
ffa764773b4d0679b941af8421ed9fa4400cc134 | 1ab19c121edff1a478ade11e658bbbc7737c319f | /src/main/java/com/taskagile/domain/application/UserService.java | 26c2eb5cd02a8f4f197abc2bb8cb188d28be34e6 | [] | no_license | Marioans42/trello.spring.vue | e4cefa17695939d52dba2c60bb28c0f51c3c8bff | e5828a9c4e783fb858d8604d8f98c4cdfbc4ff76 | refs/heads/master | 2021-07-09T01:04:36.894437 | 2020-03-17T13:39:53 | 2020-03-17T13:39:53 | 243,208,734 | 1 | 0 | null | 2021-04-26T20:01:26 | 2020-02-26T08:24:59 | Java | UTF-8 | Java | false | false | 535 | java | package com.taskagile.domain.application;
import com.taskagile.domain.application.commands.RegistrationCommand;
import com.taskagile.domain.model.user.RegistrationException;
import com.taskagile.domain.model.user.User;
import com.taskagile.domain.model.user.UserId;
import org.springframework.security.core.userdetails.UserDetailsService;
/**
* UserService
*/
public interface UserService extends UserDetailsService{
User findById(UserId userId);
void register(RegistrationCommand command) throws RegistrationException;
} | [
"marioans42@gmail.com"
] | marioans42@gmail.com |
fd5a4f00002cb9821cafcf789270f801bfa90405 | 2d62b13e616e18518c596b83165bbf09b0dec047 | /java-solution/src/com/zhp/leetcode/linked/TwoSum.java | fd6ae5a0ade2e5ae609b3c02652c2a9cef3a3dc5 | [] | no_license | sbduxingxia/leetcode | ecc22a34285cad2b6bd9a33450cf113bb92d140e | cd06742bb14e30e644995ccd6c770f110f079e9b | refs/heads/master | 2021-08-23T13:20:24.867599 | 2017-12-05T02:02:43 | 2017-12-05T02:02:43 | 109,209,415 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,996 | java | package com.zhp.leetcode.linked;
import java.util.HashMap;
/**
* @author zhp.dts
* @date 2017/11/2.
* @info 获取数组中和为目标值的两个值的位置
*/
public class TwoSum {
public static int[] solution(int [] list,int target){
HashMap<Integer,Integer> value2Index = new HashMap<Integer,Integer>();
for(int i=0;i<list.length;i++){
if(value2Index.containsKey(list[i])){
return new int[]{value2Index.get(list[i]),i};
}
int foundKey = target - list[i];//少一次运算
value2Index.put(foundKey,i);
}
throw new IllegalArgumentException("没有找到答案");
}
public static int[] solution2(int [] list,int target){
int[] result = new int[2];
HashMap<Integer,Integer> value2Index = new HashMap<Integer,Integer>();
for(int i=0;i<list.length;i++){
int foundKey = target - list[i];
if(value2Index.containsKey(foundKey)){
result[0] = value2Index.get(foundKey);
result[1] = i;
break;
}
value2Index.put(list[i],i);
}
return result;
}
/*public static int[] solution3(int [] list,int target){
int[] result = new int[2];
if(list.length<2) {
return result;
}
HashMap<Integer,Integer> value2Index = new HashMap<Integer,Integer>();
for(int i=0;i<list.length;i++){
if(value2Index.containsKey(list[i])){
result[0] = value2Index.get(list[i]);
result[1] = i;
break;
}
if(list[i]+list[list.length-i-1]==target){
result[0] = list.length-i-1;
result[1] = i;
break;
}
int foundKey = target - list[i];//少一次运算
value2Index.put(foundKey,i);
foundKey = target - list[list.length-1-i];
value2Index.put(foundKey,list.length-1-i);
}
return result;
}*/
public static void main(String [] args){
int [] list = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,23};
int target = 24;
int [] result = new int[2];
long nanoTime = System.nanoTime(),nextTime=System.nanoTime();
nanoTime = (System.nanoTime());
int [] result1 = solution(list,target);
nextTime =(System.nanoTime());
System.out.println(nextTime-nanoTime);
System.out.println(result1[0]+","+result1[1]);
/*nanoTime = (System.nanoTime());
int [] result2 = solution(list,target);
nextTime =(System.nanoTime());
System.out.println(nextTime-nanoTime);
System.out.println(result2[0]+","+result2[1]);*/
/*System.out.println(System.currentTimeMillis());
result = solution3(list,target);
System.out.println(System.currentTimeMillis());
System.out.println(result[0]+","+result[1]);*/
}
}
| [
"11111111"
] | 11111111 |
dd37d56433de2e67143d75a7b6ff0c8e2a58e3d7 | 3baf897040088b378ea620fad4f6f35859eb6607 | /EvolvingNet/src/main/java/com/codingcoderscode/evolving/net/util/CCIOUtils.java | 592422254418425d03f17b8817ea01ea40973c77 | [
"Apache-2.0"
] | permissive | msdgwzhy6/EvolvingNetLib | 5ae84a2305933094d7e4743eee505c05b29f4a10 | 26dcafc4437400a2274dfb839076420dab080550 | refs/heads/master | 2021-07-25T09:20:18.206394 | 2017-11-06T07:56:07 | 2017-11-06T07:56:07 | 109,932,216 | 1 | 0 | null | 2017-11-08T05:35:54 | 2017-11-08T05:35:53 | null | UTF-8 | Java | false | false | 17,499 | java | package com.codingcoderscode.evolving.net.util;
import android.os.Build;
import android.os.StatFs;
import android.text.TextUtils;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.CharArrayWriter;
import java.io.Closeable;
import java.io.File;
import java.io.Flushable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
/**
* Created by ghc on 2017/10/27.
*/
public class CCIOUtils {
public static void closeQuietly(Closeable closeable) {
if (closeable == null) return;
try {
closeable.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void flushQuietly(Flushable flushable) {
if (flushable == null) return;
try {
flushable.flush();
} catch (Exception e) {
e.printStackTrace();
}
}
public static InputStream toInputStream(CharSequence input) {
return new ByteArrayInputStream(input.toString().getBytes());
}
public static InputStream toInputStream(CharSequence input, String encoding) throws UnsupportedEncodingException {
byte[] bytes = input.toString().getBytes(encoding);
return new ByteArrayInputStream(bytes);
}
public static BufferedInputStream toBufferedInputStream(InputStream inputStream) {
return inputStream instanceof BufferedInputStream ? (BufferedInputStream) inputStream : new BufferedInputStream(inputStream);
}
public static BufferedOutputStream toBufferedOutputStream(OutputStream outputStream) {
return outputStream instanceof BufferedOutputStream ? (BufferedOutputStream) outputStream : new BufferedOutputStream(outputStream);
}
public static BufferedReader toBufferedReader(Reader reader) {
return reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader);
}
public static BufferedWriter toBufferedWriter(Writer writer) {
return writer instanceof BufferedWriter ? (BufferedWriter) writer : new BufferedWriter(writer);
}
public static String toString(InputStream input) throws IOException {
return new String(toByteArray(input));
}
public static String toString(InputStream input, String encoding) throws IOException {
return new String(toByteArray(input), encoding);
}
public static String toString(Reader input) throws IOException {
return new String(toByteArray(input));
}
public static String toString(Reader input, String encoding) throws IOException {
return new String(toByteArray(input), encoding);
}
public static String toString(byte[] byteArray) {
return new String(byteArray);
}
public static String toString(byte[] byteArray, String encoding) {
try {
return new String(byteArray, encoding);
} catch (UnsupportedEncodingException e) {
return new String(byteArray);
}
}
public static byte[] toByteArray(Object input) {
ByteArrayOutputStream baos = null;
ObjectOutputStream oos = null;
try {
baos = new ByteArrayOutputStream();
oos = new ObjectOutputStream(baos);
oos.writeObject(input);
oos.flush();
return baos.toByteArray();
} catch (IOException e) {
e.printStackTrace();
} finally {
closeQuietly(oos);
closeQuietly(baos);
}
return null;
}
public static Object toObject(byte[] input) {
if (input == null) return null;
ByteArrayInputStream bais = null;
ObjectInputStream ois = null;
try {
bais = new ByteArrayInputStream(input);
ois = new ObjectInputStream(bais);
return ois.readObject();
} catch (Exception e) {
e.printStackTrace();
} finally {
closeQuietly(ois);
closeQuietly(bais);
}
return null;
}
public static byte[] toByteArray(CharSequence input) {
if (input == null) return new byte[0];
return input.toString().getBytes();
}
public static byte[] toByteArray(CharSequence input, String encoding) throws UnsupportedEncodingException {
if (input == null) return new byte[0];
else return input.toString().getBytes(encoding);
}
public static byte[] toByteArray(InputStream input) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
write(input, output);
output.close();
return output.toByteArray();
}
public static byte[] toByteArray(Reader input) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
write(input, output);
output.close();
return output.toByteArray();
}
public static byte[] toByteArray(Reader input, String encoding) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
write(input, output, encoding);
output.close();
return output.toByteArray();
}
public static char[] toCharArray(CharSequence input) throws IOException {
CharArrayWriter output = new CharArrayWriter();
write(input, output);
return output.toCharArray();
}
public static char[] toCharArray(InputStream input) throws IOException {
CharArrayWriter output = new CharArrayWriter();
write(input, output);
return output.toCharArray();
}
public static char[] toCharArray(InputStream input, String encoding) throws IOException {
CharArrayWriter output = new CharArrayWriter();
write(input, output, encoding);
return output.toCharArray();
}
public static char[] toCharArray(Reader input) throws IOException {
CharArrayWriter output = new CharArrayWriter();
write(input, output);
return output.toCharArray();
}
public static List<String> readLines(InputStream input, String encoding) throws IOException {
Reader reader = new InputStreamReader(input, encoding);
return readLines(reader);
}
public static List<String> readLines(InputStream input) throws IOException {
Reader reader = new InputStreamReader(input);
return readLines(reader);
}
public static List<String> readLines(Reader input) throws IOException {
BufferedReader reader = toBufferedReader(input);
List<String> list = new ArrayList<String>();
String line = reader.readLine();
while (line != null) {
list.add(line);
line = reader.readLine();
}
return list;
}
public static void write(byte[] data, OutputStream output) throws IOException {
if (data != null) output.write(data);
}
public static void write(byte[] data, Writer output) throws IOException {
if (data != null) output.write(new String(data));
}
public static void write(byte[] data, Writer output, String encoding) throws IOException {
if (data != null) output.write(new String(data, encoding));
}
public static void write(char[] data, Writer output) throws IOException {
if (data != null) output.write(data);
}
public static void write(char[] data, OutputStream output) throws IOException {
if (data != null) output.write(new String(data).getBytes());
}
public static void write(char[] data, OutputStream output, String encoding) throws IOException {
if (data != null) output.write(new String(data).getBytes(encoding));
}
public static void write(CharSequence data, Writer output) throws IOException {
if (data != null) output.write(data.toString());
}
public static void write(CharSequence data, OutputStream output) throws IOException {
if (data != null) output.write(data.toString().getBytes());
}
public static void write(CharSequence data, OutputStream output, String encoding) throws IOException {
if (data != null) output.write(data.toString().getBytes(encoding));
}
public static void write(InputStream inputStream, OutputStream outputStream) throws IOException {
int len;
byte[] buffer = new byte[4096];
while ((len = inputStream.read(buffer)) != -1) outputStream.write(buffer, 0, len);
}
public static void write(Reader input, OutputStream output) throws IOException {
Writer out = new OutputStreamWriter(output);
write(input, out);
out.flush();
}
public static void write(InputStream input, Writer output) throws IOException {
Reader in = new InputStreamReader(input);
write(in, output);
}
public static void write(Reader input, OutputStream output, String encoding) throws IOException {
Writer out = new OutputStreamWriter(output, encoding);
write(input, out);
out.flush();
}
public static void write(InputStream input, OutputStream output, String encoding) throws IOException {
Reader in = new InputStreamReader(input, encoding);
write(in, output);
}
public static void write(InputStream input, Writer output, String encoding) throws IOException {
Reader in = new InputStreamReader(input, encoding);
write(in, output);
}
public static void write(Reader input, Writer output) throws IOException {
int len;
char[] buffer = new char[4096];
while (-1 != (len = input.read(buffer))) output.write(buffer, 0, len);
}
public static boolean contentEquals(InputStream input1, InputStream input2) throws IOException {
input1 = toBufferedInputStream(input1);
input2 = toBufferedInputStream(input2);
int ch = input1.read();
while (-1 != ch) {
int ch2 = input2.read();
if (ch != ch2) {
return false;
}
ch = input1.read();
}
int ch2 = input2.read();
return ch2 == -1;
}
public static boolean contentEquals(Reader input1, Reader input2) throws IOException {
input1 = toBufferedReader(input1);
input2 = toBufferedReader(input2);
int ch = input1.read();
while (-1 != ch) {
int ch2 = input2.read();
if (ch != ch2) {
return false;
}
ch = input1.read();
}
int ch2 = input2.read();
return ch2 == -1;
}
public static boolean contentEqualsIgnoreEOL(Reader input1, Reader input2) throws IOException {
BufferedReader br1 = toBufferedReader(input1);
BufferedReader br2 = toBufferedReader(input2);
String line1 = br1.readLine();
String line2 = br2.readLine();
while ((line1 != null) && (line2 != null) && (line1.equals(line2))) {
line1 = br1.readLine();
line2 = br2.readLine();
}
return line1 != null && (line2 == null || line1.equals(line2));
}
/**
* Access to a directory available size.
*
* @param path path.
* @return space size.
*/
public static long getDirSize(String path) {
StatFs stat;
try {
stat = new StatFs(path);
} catch (Exception e) {
e.printStackTrace();
return 0;
}
if (Build.VERSION.SDK_INT >= 18) return getStatFsSize(stat, "getBlockSizeLong", "getAvailableBlocksLong");
else return getStatFsSize(stat, "getBlockSize", "getAvailableBlocks");
}
private static long getStatFsSize(StatFs statFs, String blockSizeMethod, String availableBlocksMethod) {
try {
Method getBlockSizeMethod = statFs.getClass().getMethod(blockSizeMethod);
getBlockSizeMethod.setAccessible(true);
Method getAvailableBlocksMethod = statFs.getClass().getMethod(availableBlocksMethod);
getAvailableBlocksMethod.setAccessible(true);
long blockSize = (Long) getBlockSizeMethod.invoke(statFs);
long availableBlocks = (Long) getAvailableBlocksMethod.invoke(statFs);
return blockSize * availableBlocks;
} catch (Throwable e) {
e.printStackTrace();
}
return 0;
}
/**
* If the folder can be written.
*
* @param path path.
* @return True: success, or false: failure.
*/
public static boolean canWrite(String path) {
return new File(path).canWrite();
}
/**
* If the folder can be read.
*
* @param path path.
* @return True: success, or false: failure.
*/
public static boolean canRead(String path) {
return new File(path).canRead();
}
/**
* Create a folder, If the folder exists is not created.
*
* @param folderPath folder path.
* @return True: success, or false: failure.
*/
public static boolean createFolder(String folderPath) {
if (!TextUtils.isEmpty(folderPath)) {
File folder = new File(folderPath);
return createFolder(folder);
}
return false;
}
/**
* Create a folder, If the folder exists is not created.
*
* @param targetFolder folder path.
* @return True: success, or false: failure.
*/
public static boolean createFolder(File targetFolder) {
if (targetFolder.exists()) {
if (targetFolder.isDirectory()) return true;
//noinspection ResultOfMethodCallIgnored
targetFolder.delete();
}
return targetFolder.mkdirs();
}
/**
* Create a folder, If the folder exists is not created.
*
* @param folderPath folder path.
* @return True: success, or false: failure.
*/
public static boolean createNewFolder(String folderPath) {
return delFileOrFolder(folderPath) && createFolder(folderPath);
}
/**
* Create a folder, If the folder exists is not created.
*
* @param targetFolder folder path.
* @return True: success, or false: failure.
*/
public static boolean createNewFolder(File targetFolder) {
return delFileOrFolder(targetFolder) && createFolder(targetFolder);
}
/**
* Create a file, If the file exists is not created.
*
* @param filePath file path.
* @return True: success, or false: failure.
*/
public static boolean createFile(String filePath) {
if (!TextUtils.isEmpty(filePath)) {
File file = new File(filePath);
return createFile(file);
}
return false;
}
/**
* Create a file, If the file exists is not created.
*
* @param targetFile file.
* @return True: success, or false: failure.
*/
public static boolean createFile(File targetFile) {
if (targetFile.exists()) {
if (targetFile.isFile()) return true;
delFileOrFolder(targetFile);
}
try {
return targetFile.createNewFile();
} catch (IOException e) {
return false;
}
}
/**
* Create a new file, if the file exists, delete and create again.
*
* @param filePath file path.
* @return True: success, or false: failure.
*/
public static boolean createNewFile(String filePath) {
if (!TextUtils.isEmpty(filePath)) {
File file = new File(filePath);
return createNewFile(file);
}
return false;
}
/**
* Create a new file, if the file exists, delete and create again.
*
* @param targetFile file.
* @return True: success, or false: failure.
*/
public static boolean createNewFile(File targetFile) {
if (targetFile.exists()) delFileOrFolder(targetFile);
try {
return targetFile.createNewFile();
} catch (IOException e) {
return false;
}
}
/**
* Delete file or folder.
*
* @param path path.
* @return is succeed.
* @see #delFileOrFolder(File)
*/
public static boolean delFileOrFolder(String path) {
if (TextUtils.isEmpty(path)) return false;
return delFileOrFolder(new File(path));
}
/**
* Delete file or folder.
*
* @param file file.
* @return is succeed.
* @see #delFileOrFolder(String)
*/
@SuppressWarnings("ResultOfMethodCallIgnored")
public static boolean delFileOrFolder(File file) {
if (file == null || !file.exists()) {
// do nothing
} else if (file.isFile()) {
file.delete();
} else if (file.isDirectory()) {
File[] files = file.listFiles();
if (files != null) {
for (File sonFile : files) {
delFileOrFolder(sonFile);
}
}
file.delete();
}
return true;
}
}
| [
"guhaicheng@ccbtrust.com.cn"
] | guhaicheng@ccbtrust.com.cn |
816d27fe2a5149917824c8a8e4e40d9af751deb3 | e65b7beb5fa88dc37b10b4d8c5b8897e51ef97f1 | /longlian-live/src/main/java/com/longlian/live/service/BankCardService.java | 900b929e7570f74193e22cc055750c66ab30e178 | [] | no_license | zhaozhikang157/suanzao-live | ca5dd2e7dadcf0d8d2c665414f5740ee065da7b2 | 1d82b7af0adcbbd84e47974d0fef3c87eb893518 | refs/heads/master | 2020-04-13T18:04:54.302831 | 2018-12-28T04:17:14 | 2018-12-28T04:17:14 | 163,364,085 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 471 | java | package com.longlian.live.service;
import com.longlian.dto.ActResultDto;
import com.longlian.model.BankCard;
/**
* Created by admin on 2017/2/25.
*/
public interface BankCardService {
ActResultDto getMyBank(long appId);
ActResultDto insertBankCard(BankCard bankCard);
ActResultDto findBankCardInfo(Long id);
ActResultDto delBankCardById(Long id,Long appId);
ActResultDto getAllBank();
ActResultDto findBankCardByCardNo(String cardNo);
}
| [
"1063698024@qq.com"
] | 1063698024@qq.com |
19d7d8f885ed8858418671da7833dc68091cdce6 | a49c2c617b5ea3c68f077667dfe96aff7cf5f8b7 | /Server/src/main/java/network/Channel.java | f04e1bfdf99839f8e27211be82718c867aa665a4 | [] | no_license | mariusz1389/Better-Slack1 | d6f185a5d7a604ce10d7e82714ce12717f28fa01 | 5f8a0d10f965366b24240c9bd6b17ec8b07ed5c5 | refs/heads/master | 2022-02-05T08:49:51.757246 | 2019-03-24T11:08:36 | 2019-03-24T11:08:36 | 173,429,487 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 799 | java | package network;
import java.util.Objects;
public abstract class Channel {
protected String name;
public abstract void join(ChatClient client);
public abstract void broadcast(ChatClient sender, String message);
public abstract void leave (ChatClient client);
public Channel(String name) {
this.name = name;
}
public void changeName(String name) {
this.name = name;
}
public String getName() {
return name;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Channel)) return false;
Channel channel = (Channel) o;
return Objects.equals(name, channel.name);
}
@Override
public int hashCode() {
return Objects.hash(name);
}
} | [
"o.mariusz89@gmail.com"
] | o.mariusz89@gmail.com |
4d355e11134647b8ca4198ee94c3c882668ce09d | 77cc6511714e1263163ee8f2e4f61560c44873da | /src/NewClass.java | 1e15875f32a2b582307241d93096d19b710edc45 | [] | no_license | kramanthony/java111new | 1a7ebcd98f8c9abdb2209b8e82b9724e1e0fb90a | 3849cbab76777c8344ecd6126713e505016c386c | refs/heads/master | 2020-08-17T02:47:19.090156 | 2019-11-20T16:42:40 | 2019-11-20T16:42:40 | 215,594,847 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 251 | 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.
*/
/**
*
* @author mark.evans2358
*/
public class Donut {
}
| [
"mark.evans2358@ccac.org"
] | mark.evans2358@ccac.org |
57edac01bfbb5b621f1ce65e083ea5c1089373f6 | 543ff43ca64efd2e9910f1532b5787daeb7a7936 | /src/modelo/HiloJuego.java | 9a72ac7545b0818ebf994342b98a36c52881cc57 | [] | no_license | Camr1410/Juego01 | f12da5c70d0a680f9b3e75dd677565ef82865116 | b0a05b59e26f2d786fa30ed5fd50508f2d1960e5 | refs/heads/master | 2021-01-17T17:17:20.873546 | 2016-06-14T03:24:25 | 2016-06-14T03:24:25 | 61,088,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,351 | 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 modelo;
import vista.FRM_VentanaJuego;
/**
*
* @author Carlos
*/
public class HiloJuego extends Thread {
FRM_VentanaJuego ventanaJuego;
public HiloJuego(FRM_VentanaJuego ventanaJuego) {
this.ventanaJuego = ventanaJuego;
}
public void run() {
while(true)
{
try
{
sleep(100);
ventanaJuego.moverFondo();
comprobarPersonaje();
ventanaJuego.comprobarColision();
ventanaJuego.tiempo();
}
catch(Exception e)
{
System.err.println("Hubo un error en el hilo de ejecucion"+e);
}
}
}
public void comprobarPersonaje() {
if(ventanaJuego.estado.equals("Subiendo")) {
ventanaJuego.subirPersonaje();
}
if(ventanaJuego.estado.equals("Bajando")) {
ventanaJuego.bajarPersonaje();
}
if(ventanaJuego.jl_Personaje.getY()<0) {
ventanaJuego.estado="Bajando";
}
}
}
| [
"Carlos@Carlos-Muñoz"
] | Carlos@Carlos-Muñoz |
91d0992728b0fd2785d630179a394fe8e4cc2483 | 4e69438d502ca384caec860c1ff6fe0200bf4dea | /src/main/java/com/dfggweb/entity/Attachment.java | e64e49acd67e700f6654e138d97eda76e1ac4168 | [] | no_license | JackEasons/GithubRepository | 9276d4983fa1179a75d611d56e9c99c6828e8a01 | 0191acbd7f9572b3526e49660788c92301ed0003 | refs/heads/master | 2023-01-09T09:12:15.098155 | 2017-11-28T02:44:37 | 2017-11-28T02:44:37 | 83,630,919 | 0 | 0 | null | 2020-11-03T04:39:46 | 2017-03-02T03:38:52 | Java | UTF-8 | Java | false | false | 2,243 | java | package com.dfggweb.entity;
import javax.persistence.*;
import java.sql.Timestamp;
/**
* Created by jinyingfei on 2017/10/24.
*/
@Entity
@IdClass(AttachmentPK.class)
public class Attachment {
private int id;
private int articleId;
private String name;
private String filePath;
private Timestamp createTime;
@Id
@Column(name = "id")
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Id
@Column(name = "article_id")
public int getArticleId() {
return articleId;
}
public void setArticleId(int articleId) {
this.articleId = articleId;
}
@Basic
@Column(name = "name")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Basic
@Column(name = "file_path")
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
@Basic
@Column(name = "create_time")
public Timestamp getCreateTime() {
return createTime;
}
public void setCreateTime(Timestamp createTime) {
this.createTime = createTime;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Attachment that = (Attachment) o;
if (id != that.id) return false;
if (articleId != that.articleId) return false;
if (name != null ? !name.equals(that.name) : that.name != null) return false;
if (filePath != null ? !filePath.equals(that.filePath) : that.filePath != null) return false;
if (createTime != null ? !createTime.equals(that.createTime) : that.createTime != null) return false;
return true;
}
@Override
public int hashCode() {
int result = id;
result = 31 * result + articleId;
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (filePath != null ? filePath.hashCode() : 0);
result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
return result;
}
}
| [
"835317619@qq.com"
] | 835317619@qq.com |
9ab9ed63a99c370864d36f5ec58a14319d454e46 | 9220a7189de051337b05e23d8c60752223482ace | /java210208/src/book/ch5/PrideSimulation.java | 14b7981e79cb47a914748d14b40d10dde63eb984 | [] | no_license | kanggiwu/java210208 | 9c0e95de2d19ab1b6164ade4de29febd749f3c91 | 13a8a5e3d5cb9605b9fa29460601836b05b3ffd3 | refs/heads/main | 2023-03-21T11:11:00.546521 | 2021-03-09T09:18:30 | 2021-03-09T09:18:30 | 336,936,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,028 | java | package book.ch5;
public class PrideSimulation {
public static void main(String[] args) {
/*
* private으로 안했을 경우 인캡슐레이션이 적용되는 것이다
* 생성자를 선언할 때 private으로 선언했으므로 디폴트 생성자를 활용하고 싶다면 싱글톤패턴으로 정의하여 사용해야 한다.
* pride myCar = new Pride();
*/
Pride herCar = new Pride(10);
Pride himCar = new Pride(100,40);
himCar.wheelNum = 4;
herCar.wheelNum = 14;
Pride.wheelNum = 5;//전역변수로 선언한 변수는 이렇게 접근하자!!!!!!!
himCar.speed = 10;
herCar.speed = 50;
System.out.println("himCar.wheelNum : "+himCar.wheelNum);
System.out.println("himCar.wheelNum : "+herCar.wheelNum);
//클래스변수를 사용할 떄는 아래처럼 클래스를 통해 전역변수에 접근하자!!!
System.out.println("himCar.wheelNum : "+Pride.wheelNum);
System.out.println("himCar.wheelNum : "+himCar.speed);
System.out.println("himCar.wheelNum : "+herCar.speed);
}
}
| [
"wu10604@gmail.com"
] | wu10604@gmail.com |
503b45e54cda58ab9c1a4a7affd82e46e6233849 | a0aa5edaf8952bf74ed3cb2afdf280c5eb23e952 | /src/algorithm/Action.java | e64fd222f88081298c033949d657337ad758bceb | [] | no_license | itamariuser/stripsLib | 92eab61c2fe81dab9f8eaea1fc59f82e060c56bb | de3e4391903d7869125b42a8950d28f02031a5fc | refs/heads/master | 2021-01-25T05:02:21.463036 | 2017-06-10T14:43:47 | 2017-06-10T14:43:47 | 93,504,702 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 959 | java | package algorithm;
public class Action<T> extends Predicate<T> {
protected AndPredicate<T> preconditions;
protected AndPredicate<T> effects;
public AndPredicate<T> getPreconditions() {
return preconditions;
}
public void setPreconditions(AndPredicate<T> preconditions) {
this.preconditions = preconditions;
}
public AndPredicate<T> getEffects() {
return effects;
}
public void setEffects(AndPredicate<T> effects) {
this.effects = effects;
}
public Action(String name) {
super(name);
}
@Override
public String toString() {
return "Type: "+this.getClass().getSimpleName()+"\nName: "+this.name+"\n Preconditions: "+this.preconditions.toString()+"\n Effects: "+this.effects.toString();
}
public Action(String name,AndPredicate<T> preconditions,AndPredicate<T> effects) {
super("DEFAULT");
this.preconditions=preconditions;
this.effects=effects;
this.name=name;
}
}
| [
"itama@DESKTOP-9USF134"
] | itama@DESKTOP-9USF134 |
73ca448e6cc63f4241843965d787d67b4f744779 | 7413ee2013929645994ac7955d369b9132247e56 | /gen/net/abarchar/androidftp/BuildConfig.java | 0a8a100d4bb27456e67349a9b31b19aab1805640 | [] | no_license | vudunguit/AndroidFandTandPand | 594329e1acba37ba65db6c76687aaf7e9f280069 | f41eff40ae55a04a0d564aa3dc7a480a2a5d767a | refs/heads/master | 2021-05-27T01:18:01.102395 | 2014-03-25T10:45:45 | 2014-03-25T10:45:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 165 | java | /** Automatically generated file. DO NOT MODIFY */
package net.abarchar.androidftp;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"loithe_1325@yahoo.com"
] | loithe_1325@yahoo.com |
0c80a5198876b0d3cd5cc32cd4ecab2917c19ea0 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/13/13_6fdba67879c18519cb60a5e7acfe562617b2be01/ColoredSigns/13_6fdba67879c18519cb60a5e7acfe562617b2be01_ColoredSigns_t.java | 89fee433d13f788a212b110636133fb9e953248d | [] | 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 | 519 | java | package de.philworld.bukkit.magicsigns.coloredsigns;
import de.philworld.bukkit.magicsigns.MagicSigns;
public class ColoredSigns {
public static final String COLOR_SIGNS_PERMISSION = "magicsigns.color";
private ColoredSignsListener listener;
public ColoredSigns(MagicSigns plugin) {
this.listener = new ColoredSignsListener();
plugin.getServer().getPluginManager().registerEvents(listener, plugin);
}
public ColoredSignsListener getListener() {
return listener;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
41ea142db03d4ca982fb6f0d081aa5e110774561 | ceeacb5157b67b43d40615daf5f017ae345816db | /generated/sdk/consumption/azure-resourcemanager-consumption-generated/src/main/java/com/azure/resourcemanager/consumption/generated/fluent/AggregatedCostsClient.java | 5ba46a6fe5975fcf7d29747cb4028705eb452f62 | [
"LicenseRef-scancode-generic-cla"
] | no_license | ChenTanyi/autorest.java | 1dd9418566d6b932a407bf8db34b755fe536ed72 | 175f41c76955759ed42b1599241ecd876b87851f | refs/heads/ci | 2021-12-25T20:39:30.473917 | 2021-11-07T17:23:04 | 2021-11-07T17:23:04 | 218,717,967 | 0 | 0 | null | 2020-11-18T14:14:34 | 2019-10-31T08:24:24 | Java | UTF-8 | Java | false | false | 4,252 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.consumption.generated.fluent;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
import com.azure.resourcemanager.consumption.generated.fluent.models.ManagementGroupAggregatedCostResultInner;
/** An instance of this class provides access to all the operations defined in AggregatedCostsClient. */
public interface AggregatedCostsClient {
/**
* Provides the aggregate cost of a management group and all child management groups by current billing period.
*
* @param managementGroupId Azure Management Group ID.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a management group aggregated cost resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
ManagementGroupAggregatedCostResultInner getByManagementGroup(String managementGroupId);
/**
* Provides the aggregate cost of a management group and all child management groups by current billing period.
*
* @param managementGroupId Azure Management Group ID.
* @param filter May be used to filter aggregated cost by properties/usageStart (Utc time), properties/usageEnd (Utc
* time). The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or',
* or 'not'. Tag filter is a key value pair string where key and value is separated by a colon (:).
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a management group aggregated cost resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<ManagementGroupAggregatedCostResultInner> getByManagementGroupWithResponse(
String managementGroupId, String filter, Context context);
/**
* Provides the aggregate cost of a management group and all child management groups by specified billing period.
*
* @param managementGroupId Azure Management Group ID.
* @param billingPeriodName Billing Period Name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a management group aggregated cost resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
ManagementGroupAggregatedCostResultInner getForBillingPeriodByManagementGroup(
String managementGroupId, String billingPeriodName);
/**
* Provides the aggregate cost of a management group and all child management groups by specified billing period.
*
* @param managementGroupId Azure Management Group ID.
* @param billingPeriodName Billing Period Name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a management group aggregated cost resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Response<ManagementGroupAggregatedCostResultInner> getForBillingPeriodByManagementGroupWithResponse(
String managementGroupId, String billingPeriodName, Context context);
}
| [
"actions@github.com"
] | actions@github.com |
1aaaeb8ebc1a43954f53cd1d1303f0263da3ae8a | 975bb97bb3ef51a53f2850b633fc0ab6efa27707 | /src/main/java/net/kear/recipeorganizer/enums/ApprovalStatusFormatter.java | 799cea5153598cc794c009db4a101184d093982f | [] | no_license | lwkear/recipeorganizer | 3fa06cca5a64125b80792cea2d4829296ea2f25e | c7e28dc7a70d482f4b86b1b396786b690f562b99 | refs/heads/master | 2020-04-05T13:15:27.455233 | 2018-11-19T15:12:50 | 2018-11-19T15:12:50 | 154,981,796 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 816 | java | package net.kear.recipeorganizer.enums;
import java.text.ParseException;
import java.util.Locale;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.format.Formatter;
import org.springframework.stereotype.Component;
@Component
public class ApprovalStatusFormatter implements Formatter<ApprovalStatus> {
@Autowired
private MessageSource messages;
public ApprovalStatusFormatter() {}
@Override
public String print(ApprovalStatus object, Locale locale) {
return messages.getMessage("approvalstatus." + object.name().toLowerCase(), null, "", locale);
}
@Override
public ApprovalStatus parse(String text, Locale locale) throws ParseException {
return ApprovalStatus.parse(text);
}
}
| [
"kear.larry@gmail.com"
] | kear.larry@gmail.com |
8f84f5d419f2d0075d3092ab391a348525eec9fb | d823354f70c1535fdaf97beacd45d198a4241276 | /src/main/java/com/techarha/java/collections/graph/CustomGraph.java | b2ebf6465f40c0b4ce66e5996b2b22fd03752155 | [] | no_license | kambojankit/custom-collection | cc141343528af6e41d4ee39ca8693d7101d430c3 | c8613218f9fd35f184a07e4dee9e18ce263e8e09 | refs/heads/master | 2021-07-16T08:13:10.599780 | 2020-09-24T19:51:05 | 2020-09-24T19:51:05 | 210,402,031 | 0 | 0 | null | 2020-10-13T16:14:47 | 2019-09-23T16:26:11 | Java | UTF-8 | Java | false | false | 206 | java | package com.techarha.java.collections.graph;
public interface CustomGraph<T> {
void insertVertex(T vertex) ;
void insertEdge(T startVertex, T endVertex);
String printAdjacentNode(T vertex) ;
}
| [
"connect@ankitkamboj.com"
] | connect@ankitkamboj.com |
a2bb24a162203c044e9becb33c90b4dab84c9d40 | 5f79cada0986856ea165068a433757fc03725ce5 | /src/main/java/org/bouncycastle2/asn1/cmp/CertConfirmContent.java | 281da259cf5dd8e931f4110b5b728fdb9e6cbc74 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | votingsystem/votingsystem-android-bouncycastle | 4ab973bf873580ea67f6d891c70b0a4ac11be20d | e50d48400893e2d9847e75ed3bcecb8fe416f0d4 | refs/heads/master | 2020-12-10T21:26:57.110743 | 2016-09-10T18:14:08 | 2016-09-10T18:14:08 | 34,624,496 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,248 | java | package org.bouncycastle2.asn1.cmp;
import org.bouncycastle2.asn1.ASN1Encodable;
import org.bouncycastle2.asn1.ASN1Sequence;
import org.bouncycastle2.asn1.DERObject;
public class CertConfirmContent
extends ASN1Encodable
{
private ASN1Sequence content;
private CertConfirmContent(ASN1Sequence seq)
{
content = seq;
}
public static CertConfirmContent getInstance(Object o)
{
if (o instanceof CertConfirmContent)
{
return (CertConfirmContent)o;
}
if (o instanceof ASN1Sequence)
{
return new CertConfirmContent((ASN1Sequence)o);
}
throw new IllegalArgumentException("Invalid object: " + o.getClass().getName());
}
public CertStatus[] toCertStatusArray()
{
CertStatus[] result = new CertStatus[content.size()];
for (int i = 0; i != result.length; i++)
{
result[i] = CertStatus.getInstance(content.getObjectAt(i));
}
return result;
}
/**
* <pre>
* CertConfirmContent ::= SEQUENCE OF CertStatus
* </pre>
* @return a basic ASN.1 object representation.
*/
public DERObject toASN1Object()
{
return content;
}
}
| [
"jgzornoza@gmail.com"
] | jgzornoza@gmail.com |
ba61efc2c40bbb875e9a5ec2eb9563dbbb792a85 | 0497f0c1d45dbdc229ddadf343a2af6d1e8735ea | /src/main/java/service/UserService.java | 94539077463ad4ee7331fbd0c3388655c4d31d76 | [] | no_license | chenglinjava68/SharedCampus | 4b73aca6deebed0dbfaa325e8fbf6b7bce2fdad1 | 8080d4fa23dce85ad53ff9eeb6357448b68df1e1 | refs/heads/master | 2021-05-06T22:39:18.928636 | 2017-11-27T07:49:18 | 2017-11-27T07:49:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 806 | java | package service;
import po.User;
import java.util.Date;
public interface UserService {
int insertUser(User user);
boolean isExistsUserName(String userName);
boolean isPassCorrect(String userName, String userPass);
User getUserByUserName(String userName);
int selectRowCount();
int deleteUser(String userName, String userPass);
int changePass(String userName, String userPass);
int updateUser(String userName, String realname, Integer gender, String phone, String email, String alipay, String iconimg, String info);
int updateUser1(String userName, String userPass, String realname, Integer gender, String phone, String email,
String alipay, String iconimg, String info, Date createdTime, Date lastLogin, Integer honesty, Double balance);
}
| [
"patrickyateschn@gmail.com"
] | patrickyateschn@gmail.com |
e488c6455922440680f8294b7c1f34446be252f6 | 54e03d9bd927ed32f3b179ad55ac28aa77a30125 | /SonarMavenRepo1/src/main/java/sandip/SonarMavenRepo1/App.java | 726e72e81c14127f4cb747a30d06e8dcdcb93182 | [] | no_license | ssandip/SonarMavenRepo1 | 72645cb861ae8b5b330c23cb3774d997130b5069 | 3126385c1a70ce2a6d7db3adef96c9b8679440c8 | refs/heads/master | 2021-09-04T03:27:27.193567 | 2018-01-15T09:29:59 | 2018-01-15T09:29:59 | 117,376,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 198 | java | package sandip.SonarMavenRepo1;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"ssandipkumarsharma@gmail.com"
] | ssandipkumarsharma@gmail.com |
934c83f7074c15181a2006b6fe51121aff2fe3a4 | 3f3fa7df16f146bcdf9e0536996da991883fdbcd | /src/main/java/com/edu/spoc/service/UserService.java | b9065d715a30088721f32d62c40420b1fce20d3f | [] | no_license | johnsonop/spoc | a5e60e54fcfec2073bbd1adfe54eeba1cfb83897 | cec1ff2362904137fe07c5d4dc29db43d9386b76 | refs/heads/master | 2021-10-18T23:26:09.929217 | 2019-02-15T09:15:01 | 2019-02-15T09:15:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 645 | java | package com.edu.spoc.service;
import com.edu.spoc.vo.LoginVo;
import com.edu.spoc.model.SysUser;
/**
* 用户查询service
* @author wjc
*/
public interface UserService {
/**
* 验证用户登录信息是否正确
* @param loginVo loginInfo
* @return
* 1 为 验证成功
* 0 为 验证失败
*/
SysUser verifyUser(LoginVo loginVo);
/**
* 新增用户
*
* @param sysUser sysUser
* @return
*/
SysUser addUser(SysUser sysUser);
/**
* 修改用户
*
* @param sysUser sysUser
* @return
*/
SysUser updateUser(SysUser sysUser);
}
| [
"924235514@qq.com"
] | 924235514@qq.com |
2bcaa43cdd69e049e6444e50708ddbbefe36a537 | e3b4e0dad07b627388c66cc8e4b797fc402a8dd9 | /src/main/java/br/com/caelum/ingresso/model/TipoDeIngresso.java | 384d3c84ce1ee72f7ad53f3421fd37b48051ab03 | [] | no_license | DiegoVialle/fj22-ingressos | 5adcc2c8e083a693e6e240e63ab6e0202a6118f0 | 55614c422d4acf3218f842d2009f4b32da4d36d9 | refs/heads/master | 2021-02-11T14:03:36.807779 | 2020-03-13T01:03:16 | 2020-03-13T01:03:16 | 244,497,891 | 0 | 0 | null | 2020-03-02T23:30:37 | 2020-03-02T23:30:36 | null | UTF-8 | Java | false | false | 742 | java | package br.com.caelum.ingresso.model;
import java.math.BigDecimal;
import br.com.caelum.ingresso.model.descontos.Desconto;
import br.com.caelum.ingresso.model.descontos.DescontoParaBancos;
import br.com.caelum.ingresso.model.descontos.DescontoParaEstudantes;
import br.com.caelum.ingresso.model.descontos.SemDesconto;
public enum TipoDeIngresso {
INTEIRO(new SemDesconto()),
ESTUDANTE(new DescontoParaEstudantes()),
BANCO(new DescontoParaBancos());
private final Desconto desconto;
TipoDeIngresso(Desconto desconto) {
this.desconto = desconto;
}
public BigDecimal aplicaDesconto(BigDecimal valor){
return desconto.aplicarDescontoSobre(valor);
}
public String getDescricao(){
return desconto.getDescricao();
}
}
| [
"diegoflieger@hotmail.com"
] | diegoflieger@hotmail.com |
12fbdbdf3afb4d183c38116e6c574b709bb1196a | 750c4cd6368b00cf27b842466b5931617c36bc4e | /app/src/main/java/com/jgkj/grb/ui/activity/ConventionCentreRecordActivity.java | b2ce8e375522312459a43220ffd714827a051766 | [] | no_license | HG0517/android_grb2 | 63601f9364d05c73fdfa6f46e84e5f90a7b12851 | f7cbd9331287ed79794c041a321865ac19a5b27f | refs/heads/master | 2021-05-17T06:53:59.022286 | 2020-03-28T00:51:46 | 2020-03-28T00:51:46 | 250,683,739 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,967 | java | package com.jgkj.grb.ui.activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import com.jgkj.grb.R;
import com.jgkj.grb.base.BaseActivity;
import com.jgkj.grb.eventbus.RefreshUserInfo;
import com.jgkj.grb.itemdecoration.SpaceItemDecoration;
import com.jgkj.grb.retrofit.ApiCallback;
import com.jgkj.grb.retrofit.ApiStores;
import com.jgkj.grb.ui.adapter.ConventionCentreRecordAdapter;
import com.jgkj.grb.ui.bean.CentreRecordModel;
import com.jgkj.grb.ui.dialog.MeetingPaymentDialog;
import com.jgkj.grb.ui.dialog.PaymentNowDialog;
import com.jgkj.utils.token.GetTokenUtils;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.xgr.easypay.callback.IPayCallback;
import org.greenrobot.eventbus.EventBus;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
/**
* 会议中心:报名记录
*/
public class ConventionCentreRecordActivity extends BaseActivity {
public static void start(Context context) {
Intent intent = new Intent(context, ConventionCentreRecordActivity.class);
context.startActivity(intent);
}
@BindView(R.id.smart_refresh_layout)
SmartRefreshLayout mSmartRefreshLayout;
@BindView(R.id.recycler_view)
RecyclerView mRecyclerView;
ConventionCentreRecordAdapter mAdapter;
List<CentreRecordModel.DataBean> mList = new ArrayList<>();
int page = 1;
int size = 10;
int mPaymentIndex = -1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_convention_centre_record);
Toolbar toolbar = initToolBar(getString(R.string.activity_title_convention_centre_record));
initSmartRefreshLayout();
initRecyclerView();
onLazyLoad();
}
private void initSmartRefreshLayout() {
mSmartRefreshLayout.setEnableRefresh(true);
mSmartRefreshLayout.setEnableLoadMore(false);
mSmartRefreshLayout.setEnableAutoLoadMore(false);
mSmartRefreshLayout.setOnRefreshListener(refreshLayout -> {
// 刷新数据
refreshLayout.setEnableLoadMore(false);
mList.clear();
page = 1;
onLazyLoad();
});
mSmartRefreshLayout.setOnLoadMoreListener(refreshLayout -> {
// 加载数据
onLazyLoad();
});
}
private void initRecyclerView() {
mRecyclerView.setLayoutManager(new LinearLayoutManager(mActivity));
mRecyclerView.addItemDecoration(new SpaceItemDecoration(dp2px(10)));
mAdapter = new ConventionCentreRecordAdapter(mActivity, mList);
mRecyclerView.setAdapter(mAdapter);
mAdapter.setOnItemClickListener((view, position) -> {
mPaymentIndex = position;
showMeetingPaymentDialog(mList.get(position));
});
}
/**
* 报名支付:支付方式
*/
private void showMeetingPaymentDialog(CentreRecordModel.DataBean dataBean) {
MeetingPaymentDialog dialog = new MeetingPaymentDialog(this);
dialog.setCanceledOnTouchOutside(false);
dialog.show();
dialog.setPaymentBalanceEnabled(dataBean.getCash() == 1);
dialog.setPaymentGRBEnabled(dataBean.getGrb() == 1);
dialog.setDialogTitle1(String.format(getString(R.string.total_top_text), dataBean.getFee()));
dialog.setOnActionClickListener(new MeetingPaymentDialog.OnActionClickListener() {
@Override
public void onCancel() {
}
@Override
public void onSure(ArrayList<Object> paymentType) {
showPaymentNowDialog(dataBean.getId(), paymentType);
}
});
}
/**
* 报名支付:支付密码
*/
private void showPaymentNowDialog(String id, ArrayList<Object> paymentType) {
PaymentNowDialog dialog = new PaymentNowDialog(mActivity);
dialog.setCancelable(false);
dialog.show();
dialog.setOnFinishListener(new PaymentNowDialog.OnActionClickListener() {
@Override
public void onClose() {
}
@Override
public void onInputFinish(String password) {
indexMeetingPayFee(id, paymentType, password);
}
});
}
private void indexMeetingPayFee(String id, ArrayList<Object> paymentType, String password) {
showProgressDialog();
String token = GetTokenUtils.getToken(mActivity, ApiStores.API_SERVER_MEETING_PAYFEE);
addSubscription(apiStores().indexMeetingPayFee(token, id, paymentType, password), new ApiCallback<String>() {
@Override
public void onSuccess(String model) {
try {
JSONObject result = new JSONObject(model);
if (result.optInt("code", 0) == 1) {
JSONObject data = result.optJSONObject("data");
int paytype = data.optInt("paytype", 0);
if (paytype == 0) { // 支付完成
toastShow(result.optString("msg", ""));
mList.get(mPaymentIndex).setStatus(1);
mAdapter.notifyDataSetChanged();
EventBus.getDefault().post(new RefreshUserInfo(true));
} else if (paytype == 4) { // 微信支付
JSONObject wechat = data.optJSONObject("wechat");
wxpay(wechat, payCallback);
} else if (paytype == 3) { // 支付宝支付
alipay(data.optString("alipay", ""), payCallback);
} else if (paytype == 5) { // 云闪付支付
JSONObject flash = data.optJSONObject("flash");
unionpay(flash, payCallback);
}
} else if (result.optInt("code", 0) == 3) {
showPaymentNowDialog(id, paymentType);
toastShow(result.optString("msg", ""));
} else {
toastShow(result.optString("msg", ""));
}
} catch (JSONException e) {
}
}
@Override
public void onFailure(String msg) {
toastShow(msg);
}
@Override
public void onFinish() {
dismissProgressDialog();
}
});
}
/**
* 支付回调
*/
private IPayCallback payCallback = new IPayCallback() {
@Override
public void success() {
showPayResult("支付成功");
mList.get(mPaymentIndex).setStatus(1);
mAdapter.notifyDataSetChanged();
}
@Override
public void failed(int code, String message) {
showPayResult("支付失败");
}
@Override
public void cancel() {
showPayResult("支付取消");
}
};
protected void showPayResult(String msg) {
runOnUiThread(() -> {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(false);
builder.setTitle("支付结果通知");
builder.setMessage(msg);
builder.setNegativeButton("确定", (dialog, which) -> {
EventBus.getDefault().post(new RefreshUserInfo(true));
dialog.cancel();
}
);
builder.create().show();
});
}
private void onLazyLoad() {
showProgressDialog();
String token = GetTokenUtils.getToken(this, ApiStores.API_SERVER_MEETING_MYMEETING);
addSubscription(apiStores().userMeeting(token), new ApiCallback<CentreRecordModel>() {
@Override
public void onSuccess(CentreRecordModel model) {
if (model.getCode() == 1) {
if (page == 1)
mList.clear();
mList.addAll(model.getData());
mAdapter.notifyDataSetChanged();
} else {
toastShow(model.getMsg());
}
}
@Override
public void onFailure(String msg) {
toastShow(msg);
}
@Override
public void onFinish() {
dismissProgressDialog();
mSmartRefreshLayout.finishRefresh(true);
mSmartRefreshLayout.finishLoadMore(true);
}
});
}
}
| [
"18237727931@163.com"
] | 18237727931@163.com |
87ae716353bdfb24ef7ec09315275f3bedf518f1 | 792aee01e73ffb4ab3170b594f8d40557705559c | /app/src/main/java/com/hapoalimtest/MainActivity.java | 289a88eeed874563ef3e8c80eefdae27b26c8ccc | [] | no_license | Steelrat2/HapoalimTest | f10411b713fc0d531b420a700c1b8a5bef12721b | 567a3a3fb24f1a7f940daca1d6395d35ca1190a2 | refs/heads/master | 2020-06-14T04:25:20.353806 | 2019-07-02T16:26:23 | 2019-07-02T16:26:23 | 194,898,418 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,667 | java | package com.hapoalimtest;
import android.content.Intent;
import android.os.Bundle;
import com.hapoalimtest.model.Movie;
import com.hapoalimtest.ui.DialogProgressManagement;
import com.hapoalimtest.ui.LikedMoviesActivity;
import com.hapoalimtest.ui.MainFragment;
import com.hapoalimtest.viewmodels.MainViewModel;
import com.hapoalimtest.ui.MovieFragment;
import com.hapoalimtest.ui.ProgressDialogFragment;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.ViewModelProviders;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends AppCompatActivity implements DialogProgressManagement, MainFragment.OnFragmentListener {
private ProgressDialogFragment mProgressDialog = new ProgressDialogFragment();
private MainViewModel mViewModel;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mViewModel = ViewModelProviders.of(this).get(MainViewModel.class);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle(R.string.top_movies_2019);
if(savedInstanceState==null) {
replaceFragment(MainFragment.newInstance());
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_liked_movies) {
Intent intent = new Intent(getApplicationContext(), LikedMoviesActivity.class);
//intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(intent);
return true;
}
return super.onOptionsItemSelected(item);
}
protected void replaceFragment(@NonNull Fragment fragment) {
FragmentManager fm = getSupportFragmentManager();
if(fm != null) {
fm.beginTransaction().replace(R.id.mount_point, fragment, fragment.getClass().getSimpleName()).commitAllowingStateLoss();
}
}
protected void addFragment(@NonNull Fragment fragment) {
FragmentManager fm = getSupportFragmentManager();
if(fm != null) {
fm.beginTransaction().add(R.id.mount_point, fragment, fragment.getClass().getSimpleName()).addToBackStack(fragment.getClass().getName()).commitAllowingStateLoss();
}
}
@Override
public void showDialogProgress() {
if(!mProgressDialog.isAdded()) {
mProgressDialog.show(getFragmentManager(), "progressDialog");
}
}
@Override
public boolean isShowingDialogProgress() {
return mProgressDialog.isAdded();
}
@Override
public void dismissDialogProgress() {
mProgressDialog.dismissAllowingStateLoss();
}
@Override
public void onOpenMovieFragment(Movie movie) {
mViewModel.setMovie(movie);
addFragment(MovieFragment.newInstance(movie));
}
}
| [
"antonov_d@mail.tel-aviv.gov.il"
] | antonov_d@mail.tel-aviv.gov.il |
2c9b39754d04449d58c408dbdf56fd5c535fbd73 | e47d8106cbc3da3c7a252ab467c12229c61ff9ed | /backend-service/src/main/java/com/javamultiplex/mapper/BloodRecipientObjectMapper.java | bb21601bcf2f73ec3ac8bd288f4da20b8133ab75 | [] | no_license | immutable-dev/online-blood-donation-system | c8ad4404af15766dc378effa14bc2a374f7fb20c | 01cc50f7cecb613a21220724200ee1177425138e | refs/heads/master | 2023-04-16T10:24:17.604169 | 2020-09-03T18:00:41 | 2020-09-03T18:00:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,529 | java | package com.javamultiplex.mapper;
import com.javamultiplex.entity.BloodRecipient;
import com.javamultiplex.enums.BloodRecipientStatus;
import com.javamultiplex.model.BloodRecipientDTO;
import org.springframework.stereotype.Component;
/**
* @author Rohit Agarwal on 17/05/20 8:18 pm
* @copyright www.javamultiplex.com
*/
@Component
public class BloodRecipientObjectMapper {
/**
*
* @param bloodRecipientDTO
* @return
*/
public BloodRecipient map(BloodRecipientDTO bloodRecipientDTO) {
BloodRecipient bloodRecipient=new BloodRecipient();
bloodRecipient.setPatientName(bloodRecipientDTO.getPatientName());
bloodRecipient.setGender(bloodRecipientDTO.getGender());
bloodRecipient.setCity(bloodRecipientDTO.getCity());
bloodRecipient.setBloodUnit(bloodRecipientDTO.getBloodUnit());
bloodRecipient.setContactName(bloodRecipientDTO.getContactName());
bloodRecipient.setDate(bloodRecipientDTO.getDate());
bloodRecipient.setEmailId(bloodRecipientDTO.getEmailId());
bloodRecipient.setHospitalName(bloodRecipientDTO.getHospitalName());
bloodRecipient.setRequiredBloodGroup(bloodRecipientDTO.getRequiredBloodGroup());
bloodRecipient.setPhoneNumber(bloodRecipientDTO.getPhoneNumber());
bloodRecipient.setPincode(bloodRecipientDTO.getPincode());
bloodRecipient.setReason(bloodRecipientDTO.getReason());
bloodRecipient.setStatus(BloodRecipientStatus.PENDING);
return bloodRecipient;
}
}
| [
"programmingwithrohit@gmail.com"
] | programmingwithrohit@gmail.com |
2f4ab1ef0cae6a50822344c6779de3cb2499e27b | a96f4e8c2084412bb78506c839787f4930f8efcf | /servicetalk-grpc-netty/src/main/java/io/servicetalk/grpc/netty/package-info.java | bb72b9f9bfebe4a4361981e250cb8c58e23896c8 | [
"Apache-2.0"
] | permissive | apple/servicetalk | cf29968c749cbaf5cdf040cb18a8e95b26fb0097 | 670cc9350b84bc24499b7bcea2d15dfeda996d16 | refs/heads/main | 2023-08-31T00:47:44.427125 | 2023-08-30T20:57:45 | 2023-08-30T20:57:45 | 147,747,963 | 918 | 168 | Apache-2.0 | 2023-09-14T18:27:09 | 2018-09-07T00:14:48 | Java | UTF-8 | Java | false | false | 759 | java | /*
* Copyright © 2019 Apple Inc. and the ServiceTalk project authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@ElementsAreNonnullByDefault
package io.servicetalk.grpc.netty;
import io.servicetalk.annotations.ElementsAreNonnullByDefault;
| [
"nitesh_kant@apple.com"
] | nitesh_kant@apple.com |
ffa786aebbd8d587658850cf8cdca6a41f3c0293 | 17b4fb3f52be2d2a4fbe456206424d2818d4635a | /SPR-13367/src/main/java/org/springframework/issues/config/WebSecurityConfig.java | 58d0dbe1a4f34b9b511b57a1ffc31ee283d21393 | [] | no_license | spring-attic/spring-framework-issues | df31398556c2f6963c5c92a89b91e471083c3dca | 554e4875ea0e4f15d0c7a5238f25feb5c91db6f0 | refs/heads/master | 2022-03-09T18:18:39.093534 | 2019-04-29T21:11:13 | 2019-04-30T15:26:59 | 1,933,490 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,637 | java | /*
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.issues.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@EnableGlobalMethodSecurity(prePostEnabled = true)
@Configuration
public class WebSecurityConfig {
@Autowired
public void registerGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication()
.withUser("user").password("password").roles("USER").and()
.withUser("admin").password("password").roles("USER", "ADMIN");
}
} | [
"rstoyanchev@pivotal.io"
] | rstoyanchev@pivotal.io |
e75d9a688722e69ac09242b0ba2227e208c85d0e | ef3a0d6f8d9fa8ca16d1772370a636743b7a2039 | /src/me/RockinChaos/itemjoin/utils/CustomFilter.java | d81f9d84f54ea44d0158d2639c3e7aa9f65bd08b | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | jamesxsc/ItemJoin | c4a70715025fe8c5609929a91fab7440c7c2f914 | 83718f963395d3756801bd139ee94bd912e27282 | refs/heads/master | 2020-03-21T10:47:02.952322 | 2018-06-24T01:00:08 | 2018-06-24T01:00:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,400 | java | package me.RockinChaos.itemjoin.utils;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Marker;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.core.filter.AbstractFilter;
import org.apache.logging.log4j.message.Message;
import me.RockinChaos.itemjoin.handlers.CommandHandler;
public class CustomFilter extends AbstractFilter {
private Result handle(String message) {
if(message == null) {
return Result.NEUTRAL;
}
for(String word : CommandHandler.filteredCommands.get("commands-list")) {
if(message.toLowerCase().contains(word.toLowerCase())) {
return Result.DENY;
}
}
return Result.NEUTRAL;
}
@Override
public Result filter(LogEvent event) {
return handle(event.getMessage().getFormattedMessage());
}
@Override
public Result filter(Logger logger, Level level, Marker marker, Message msg, Throwable t) {
return handle(msg.getFormattedMessage());
}
@Override
public Result filter(Logger logger, Level level, Marker marker, Object msg, Throwable t) {
return handle(msg.toString());
}
@Override
public Result filter(Logger logger, Level level, Marker marker, String msg, Object... params) {
return handle(msg);
}
} | [
"JacobGaming@CraftationGaming.com"
] | JacobGaming@CraftationGaming.com |
60e712ef482ad7101b40de5debbc9b65d5bf7afc | ed42866c7b2237b59e3e2ebb799d7a67e6207cef | /src/testcasegenerator/DrawLine2D.java | e4db19da28e6e84be50d8f01e4ec516beda22e92 | [] | no_license | mehdimkz/TestCase-generator | 00e383e1d072c4a69c1b8e8be3b2b7d2fdeecfea | 83007cc0db35c80c80b25f62964a6fc50c43ed55 | refs/heads/master | 2020-09-14T03:57:39.069777 | 2017-06-15T18:29:49 | 2017-06-15T18:29:49 | 94,467,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,387 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package testcasegenerator;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.geom.Line2D;
import javax.sound.sampled.Line;
import javax.swing.JApplet;
import javax.swing.JPanel;
/**
*
* @author Mehdi
*/
public class DrawLine2D extends JPanel {
int x,y,x1,y1,j,z,z1,max_y=0;
int array[][]; // declare array named array
String ProjectName="";
public void init(int c[][],int d,int m,String s) {
array = new int[ 50 ][4];
z=d;
z1=m;// m is numbers of
ProjectName=s;
setBackground(Color.white);
setForeground(Color.white);
for (int i=0;i<z;i++)
for (int j=0;j<4;j++){
array[i][j]=c[i][j];
// System.out.println(z);
}
}
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.setStroke(new BasicStroke(2));
g2.setPaint(Color.GREEN);
//System.out.println("n="+Grf.n);
for (int i=0;i<z-z1;i++)
{
j=0;
x=array[i][j];
y=array[i][j+1];
x1=array[i][j+2];
y1=array[i][j+3];
if (y>max_y) // find maximum Y
max_y=y;
g2.draw(new Line2D.Double(x, y, x1, y1));
}
// g2.setPaint( Color.GREEN );
// g2.draw( new Line2D.Double( 395, 30, 320, 150 ) );
g2.setPaint( Color.ORANGE );
g2.drawString("Cause Effect Graph For: ", 150, max_y+90);
g2.setPaint( Color.LIGHT_GRAY );
g2.drawString(ProjectName,300 , max_y+90);
//Draw Constrain with dash line
for (int i=z-z1;i<z;i++)
{
j=0;
x=array[i][j];
y=array[i][j+1];
x1=array[i][j+2];
y1=array[i][j+3];
float dashes[] = { 5 };
g2.setPaint( Color.RED );
g2.setStroke( new BasicStroke( 4, BasicStroke.CAP_ROUND,
BasicStroke.JOIN_ROUND, 10, dashes, 0 ) );
g2.draw(new Line2D.Double(x, y, x1, y1));
g2.setPaint( Color.RED );
g2.draw(new Line2D.Double(40, max_y+50, 75, max_y+50));// draw dash line for decleration
g2.setPaint( Color.magenta );
g2.drawString(":Constrain", 83, max_y+50);
}
}
} | [
"noreply@github.com"
] | noreply@github.com |
284d09611c43af6cbb0e9e96c1a243a04d4c430e | e8599ad2c47bb98df7499e234711d69011d2fbd4 | /app/src/main/java/com/example/grocerymart/AboutActivity.java | b6001db5d810ca9de04b40330a1a0686c9cbc6b3 | [] | no_license | muraribabupatel/grocery-store | 17acb7904561770e9903168ef8bc986fcc8cdef6 | 18c42fd9a5492251e06d91e48fab04210913c93a | refs/heads/main | 2023-08-30T16:48:51.106640 | 2021-10-28T10:12:35 | 2021-10-28T10:12:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,489 | java | package com.example.grocerymart;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Build;
import android.os.Bundle;
import android.text.Html;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
public class AboutActivity extends AppCompatActivity {
private ImageView imageButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
TextView textA = findViewById(R.id.textA);
TextView textB = findViewById(R.id.textB);
TextView textC = findViewById(R.id.textC);
TextView textD = findViewById(R.id.textD);
TextView textE = findViewById(R.id.textE);
ImageView backBtn = findViewById(R.id.backBtn);
backBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
textA.setText(Html.fromHtml("<b>GM –</b> \"Grocery Mart\" is a application based your own traditional sabji wala who brings to your door step high-quality fresh fruits and\n" +
" vegetables in wholesale rate. Now you can order your daily essential vegetables & fruits at convince of your house. ", Html.FROM_HTML_MODE_COMPACT));
} else {
textA.setText(Html.fromHtml("<b>GM –</b> \"Grocery Mart\" is a application based your own traditional sabji wala who brings to your door step high-quality fresh fruits and\n" +
" vegetables in wholesale rate. Now you can order your daily essential vegetables & fruits at convince of your house. "));
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
textE.setText(Html.fromHtml("<b>Awiskar Tech Team </b>", Html.FROM_HTML_MODE_COMPACT));
} else {
textE.setText(Html.fromHtml("<b>Awiskar Tech Team</b>"));
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
textB.setText(Html.fromHtml("<b>Mohit Vishal - </b> A thought leader & an innovator. He is a highly experienced professional and strategist from Vishakhapatnam who dare to leave his high paying job in Agriculture Tractor Finance Market & start his own dream venture. He is presently the Partner of NSB – Grocery Mart. ", Html.FROM_HTML_MODE_COMPACT));
} else {
textB.setText(Html.fromHtml("<b>Rohit Vishal - </b> A thought leader & an innovator. He is a highly experienced professional and strategist from Vishakhapatnam who dare to leave his high paying job in Agriculture Tractor Finance Market & start his own dream venture. He is presently the Partner of NSB – Grocery Mart. "));
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
textC.setText(Html.fromHtml("<b>A- </b> An age old Vegetable Vender, who is providing vegetables supply services in 3 Star & 5 star hotels of Vishakhapatnam. He wants to extend the service to common household & bridge the gap of price differentiation. He is presently the Partner of NSB – Grocery Mart.", Html.FROM_HTML_MODE_COMPACT));
} else {
textC.setText(Html.fromHtml("<b>B- </b> An age old Vegetable Vender, who is providing vegetables supply services in 3 Star & 5 star hotels of Vishakhapatnam. He wants to extend the service to common household & bridge the gap of price differentiation. He is presently the Partner of NSB – Grocery Mart."));
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
textD.setText(Html.fromHtml("<b>C-</b> A big Wholesale Vegetable Vender in Mandor Mandi. He has a lecacy of supplying fresh vegetables with zero tolerance to bad quality. He is presently the Partner of Awiskar tech– Grocery Mart.", Html.FROM_HTML_MODE_COMPACT));
} else {
textD.setText(Html.fromHtml("<b>D-</b> A big Wholesale Vegetable Vender in Mandor Mandi. He has a lecacy of supplying fresh vegetables with zero tolerance to bad quality. He is presently the Partner of Awiskar tech – Grocery Mart."));
}
imageButton=findViewById(R.id.backBtn);
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
}
} | [
"muraribabupatel7781@gmail.com"
] | muraribabupatel7781@gmail.com |
b20f2003df7f50ceb3b0b074ccb405c8897db173 | a0ae9fa3513b569eac0d2c28f92756f528582997 | /bin/platform/bootstrap/gensrc/de/hybris/platform/variants/model/VariantAttributeDescriptorModel.java | bcdf9cf13f018c7a86089b225e48797a7a53be43 | [] | no_license | jo721bit/workspace | d715d6efe1bd8a1584df83932d8e238639d37f7d | f9921b9c992df82f85e3732eed550829e36b2300 | refs/heads/master | 2020-04-01T00:36:44.495300 | 2018-10-10T08:28:14 | 2018-10-10T08:28:14 | 152,704,705 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,537 | java | /*
* ----------------------------------------------------------------
* --- WARNING: THIS FILE IS GENERATED AND WILL BE OVERWRITTEN! ---
* --- Generated at 10.10.2018 08:59:36 ---
* ----------------------------------------------------------------
*
* [y] hybris Platform
*
* Copyright (c) 2000-2016 SAP SE
* All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* Hybris ("Confidential Information"). You shall not disclose such
* Confidential Information and shall use it only in accordance with the
* terms of the license agreement you entered into with SAP Hybris.
*
*/
package de.hybris.platform.variants.model;
import de.hybris.bootstrap.annotations.Accessor;
import de.hybris.platform.core.model.ItemModel;
import de.hybris.platform.core.model.type.AttributeDescriptorModel;
import de.hybris.platform.core.model.type.ComposedTypeModel;
import de.hybris.platform.core.model.type.TypeModel;
import de.hybris.platform.servicelayer.model.ItemModelContext;
import de.hybris.platform.variants.model.VariantTypeModel;
/**
* Generated model class for type VariantAttributeDescriptor first defined at extension catalog.
*/
@SuppressWarnings("all")
public class VariantAttributeDescriptorModel extends AttributeDescriptorModel
{
/**<i>Generated model type code constant.</i>*/
public final static String _TYPECODE = "VariantAttributeDescriptor";
/** <i>Generated constant</i> - Attribute key of <code>VariantAttributeDescriptor.position</code> attribute defined at extension <code>catalog</code>. */
public static final String POSITION = "position";
/**
* <i>Generated constructor</i> - Default constructor for generic creation.
*/
public VariantAttributeDescriptorModel()
{
super();
}
/**
* <i>Generated constructor</i> - Default constructor for creation with existing context
* @param ctx the model context to be injected, must not be null
*/
public VariantAttributeDescriptorModel(final ItemModelContext ctx)
{
super(ctx);
}
/**
* <i>Generated constructor</i> - Constructor with all mandatory attributes.
* @deprecated Since 4.1.1 Please use the default constructor without parameters
* @param _attributeType initial attribute declared by type <code>Descriptor</code> at extension <code>core</code>
* @param _enclosingType initial attribute declared by type <code>VariantAttributeDescriptor</code> at extension <code>catalog</code>
* @param _generate initial attribute declared by type <code>TypeManagerManaged</code> at extension <code>core</code>
* @param _partOf initial attribute declared by type <code>AttributeDescriptor</code> at extension <code>core</code>
* @param _qualifier initial attribute declared by type <code>Descriptor</code> at extension <code>core</code>
*/
@Deprecated
public VariantAttributeDescriptorModel(final TypeModel _attributeType, final VariantTypeModel _enclosingType, final Boolean _generate, final Boolean _partOf, final String _qualifier)
{
super();
setAttributeType(_attributeType);
setEnclosingType(_enclosingType);
setGenerate(_generate);
setPartOf(_partOf);
setQualifier(_qualifier);
}
/**
* <i>Generated constructor</i> - for all mandatory and initial attributes.
* @deprecated Since 4.1.1 Please use the default constructor without parameters
* @param _attributeType initial attribute declared by type <code>Descriptor</code> at extension <code>core</code>
* @param _enclosingType initial attribute declared by type <code>VariantAttributeDescriptor</code> at extension <code>catalog</code>
* @param _generate initial attribute declared by type <code>TypeManagerManaged</code> at extension <code>core</code>
* @param _owner initial attribute declared by type <code>Item</code> at extension <code>core</code>
* @param _partOf initial attribute declared by type <code>AttributeDescriptor</code> at extension <code>core</code>
* @param _qualifier initial attribute declared by type <code>Descriptor</code> at extension <code>core</code>
*/
@Deprecated
public VariantAttributeDescriptorModel(final TypeModel _attributeType, final VariantTypeModel _enclosingType, final Boolean _generate, final ItemModel _owner, final Boolean _partOf, final String _qualifier)
{
super();
setAttributeType(_attributeType);
setEnclosingType(_enclosingType);
setGenerate(_generate);
setOwner(_owner);
setPartOf(_partOf);
setQualifier(_qualifier);
}
/**
* <i>Generated method</i> - Getter of the <code>AttributeDescriptor.enclosingType</code> attribute defined at extension <code>core</code> and redeclared at extension <code>catalog</code>.
* @return the enclosingType
*/
@Override
@Accessor(qualifier = "enclosingType", type = Accessor.Type.GETTER)
public VariantTypeModel getEnclosingType()
{
return (VariantTypeModel) super.getEnclosingType();
}
/**
* <i>Generated method</i> - Getter of the <code>VariantAttributeDescriptor.position</code> attribute defined at extension <code>catalog</code>.
* @return the position
*/
@Accessor(qualifier = "position", type = Accessor.Type.GETTER)
public Integer getPosition()
{
return getPersistenceContext().getPropertyValue(POSITION);
}
/**
* <i>Generated method</i> - Initial setter of <code>AttributeDescriptor.enclosingType</code> attribute defined at extension <code>core</code> and redeclared at extension <code>catalog</code>. Can only be used at creation of model - before first save. Will only accept values of type {@link de.hybris.platform.variants.model.VariantTypeModel}.
*
* @param value the enclosingType
*/
@Override
@Accessor(qualifier = "enclosingType", type = Accessor.Type.SETTER)
public void setEnclosingType(final ComposedTypeModel value)
{
if( value == null || value instanceof VariantTypeModel)
{
super.setEnclosingType(value);
}
else
{
throw new IllegalArgumentException("Given value is not instance of de.hybris.platform.variants.model.VariantTypeModel");
}
}
/**
* <i>Generated method</i> - Setter of <code>VariantAttributeDescriptor.position</code> attribute defined at extension <code>catalog</code>.
*
* @param value the position
*/
@Accessor(qualifier = "position", type = Accessor.Type.SETTER)
public void setPosition(final Integer value)
{
getPersistenceContext().setPropertyValue(POSITION, value);
}
}
| [
"jonas.bittenbinder@htwg-konstanz.de"
] | jonas.bittenbinder@htwg-konstanz.de |
2cf33e59288d7a9831fd97fb80e18b08a6f2bff8 | 9f4ee9a7e4a3942864ea52b45fde1085df9751d7 | /src/main/java/com/khmt/myapp/web/rest/AccountResource.java | 8fad4cba0a99b0741d9c7c1153103710b946c5cc | [] | no_license | kakahaha6193/jhipster-library-application | ff3247a73d30739f16bc62adf05085d38c4110d5 | 2e580af93b6ab91729b07931fe68a56353731e11 | refs/heads/main | 2023-03-26T22:40:32.536898 | 2021-03-30T14:17:03 | 2021-03-30T14:17:03 | 353,026,557 | 0 | 0 | null | 2021-03-30T14:36:44 | 2021-03-30T14:16:44 | Java | UTF-8 | Java | false | false | 7,783 | java | package com.khmt.myapp.web.rest;
import com.khmt.myapp.domain.User;
import com.khmt.myapp.repository.UserRepository;
import com.khmt.myapp.security.SecurityUtils;
import com.khmt.myapp.service.MailService;
import com.khmt.myapp.service.UserService;
import com.khmt.myapp.service.dto.AdminUserDTO;
import com.khmt.myapp.service.dto.PasswordChangeDTO;
import com.khmt.myapp.service.dto.UserDTO;
import com.khmt.myapp.web.rest.errors.*;
import com.khmt.myapp.web.rest.vm.KeyAndPasswordVM;
import com.khmt.myapp.web.rest.vm.ManagedUserVM;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
/**
* REST controller for managing the current user's account.
*/
@RestController
@RequestMapping("/api")
public class AccountResource {
private static class AccountResourceException extends RuntimeException {
private AccountResourceException(String message) {
super(message);
}
}
private final Logger log = LoggerFactory.getLogger(AccountResource.class);
private final UserRepository userRepository;
private final UserService userService;
private final MailService mailService;
public AccountResource(UserRepository userRepository, UserService userService, MailService mailService) {
this.userRepository = userRepository;
this.userService = userService;
this.mailService = mailService;
}
/**
* {@code POST /register} : register the user.
*
* @param managedUserVM the managed user View Model.
* @throws InvalidPasswordException {@code 400 (Bad Request)} if the password is incorrect.
* @throws EmailAlreadyUsedException {@code 400 (Bad Request)} if the email is already used.
* @throws LoginAlreadyUsedException {@code 400 (Bad Request)} if the login is already used.
*/
@PostMapping("/register")
@ResponseStatus(HttpStatus.CREATED)
public void registerAccount(@Valid @RequestBody ManagedUserVM managedUserVM) {
if (isPasswordLengthInvalid(managedUserVM.getPassword())) {
throw new InvalidPasswordException();
}
User user = userService.registerUser(managedUserVM, managedUserVM.getPassword());
mailService.sendActivationEmail(user);
}
/**
* {@code GET /activate} : activate the registered user.
*
* @param key the activation key.
* @throws RuntimeException {@code 500 (Internal Server Error)} if the user couldn't be activated.
*/
@GetMapping("/activate")
public void activateAccount(@RequestParam(value = "key") String key) {
Optional<User> user = userService.activateRegistration(key);
if (!user.isPresent()) {
throw new AccountResourceException("No user was found for this activation key");
}
}
/**
* {@code GET /authenticate} : check if the user is authenticated, and return its login.
*
* @param request the HTTP request.
* @return the login if the user is authenticated.
*/
@GetMapping("/authenticate")
public String isAuthenticated(HttpServletRequest request) {
log.debug("REST request to check if the current user is authenticated");
return request.getRemoteUser();
}
/**
* {@code GET /account} : get the current user.
*
* @return the current user.
* @throws RuntimeException {@code 500 (Internal Server Error)} if the user couldn't be returned.
*/
@GetMapping("/account")
public AdminUserDTO getAccount() {
return userService
.getUserWithAuthorities()
.map(AdminUserDTO::new)
.orElseThrow(() -> new AccountResourceException("User could not be found"));
}
/**
* {@code POST /account} : update the current user information.
*
* @param userDTO the current user information.
* @throws EmailAlreadyUsedException {@code 400 (Bad Request)} if the email is already used.
* @throws RuntimeException {@code 500 (Internal Server Error)} if the user login wasn't found.
*/
@PostMapping("/account")
public void saveAccount(@Valid @RequestBody AdminUserDTO userDTO) {
String userLogin = SecurityUtils
.getCurrentUserLogin()
.orElseThrow(() -> new AccountResourceException("Current user login not found"));
Optional<User> existingUser = userRepository.findOneByEmailIgnoreCase(userDTO.getEmail());
if (existingUser.isPresent() && (!existingUser.get().getLogin().equalsIgnoreCase(userLogin))) {
throw new EmailAlreadyUsedException();
}
Optional<User> user = userRepository.findOneByLogin(userLogin);
if (!user.isPresent()) {
throw new AccountResourceException("User could not be found");
}
userService.updateUser(
userDTO.getFirstName(),
userDTO.getLastName(),
userDTO.getEmail(),
userDTO.getLangKey(),
userDTO.getImageUrl()
);
}
/**
* {@code POST /account/change-password} : changes the current user's password.
*
* @param passwordChangeDto current and new password.
* @throws InvalidPasswordException {@code 400 (Bad Request)} if the new password is incorrect.
*/
@PostMapping(path = "/account/change-password")
public void changePassword(@RequestBody PasswordChangeDTO passwordChangeDto) {
if (isPasswordLengthInvalid(passwordChangeDto.getNewPassword())) {
throw new InvalidPasswordException();
}
userService.changePassword(passwordChangeDto.getCurrentPassword(), passwordChangeDto.getNewPassword());
}
/**
* {@code POST /account/reset-password/init} : Send an email to reset the password of the user.
*
* @param mail the mail of the user.
*/
@PostMapping(path = "/account/reset-password/init")
public void requestPasswordReset(@RequestBody String mail) {
Optional<User> user = userService.requestPasswordReset(mail);
if (user.isPresent()) {
mailService.sendPasswordResetMail(user.get());
} else {
// Pretend the request has been successful to prevent checking which emails really exist
// but log that an invalid attempt has been made
log.warn("Password reset requested for non existing mail");
}
}
/**
* {@code POST /account/reset-password/finish} : Finish to reset the password of the user.
*
* @param keyAndPassword the generated key and the new password.
* @throws InvalidPasswordException {@code 400 (Bad Request)} if the password is incorrect.
* @throws RuntimeException {@code 500 (Internal Server Error)} if the password could not be reset.
*/
@PostMapping(path = "/account/reset-password/finish")
public void finishPasswordReset(@RequestBody KeyAndPasswordVM keyAndPassword) {
if (isPasswordLengthInvalid(keyAndPassword.getNewPassword())) {
throw new InvalidPasswordException();
}
Optional<User> user = userService.completePasswordReset(keyAndPassword.getNewPassword(), keyAndPassword.getKey());
if (!user.isPresent()) {
throw new AccountResourceException("No user was found for this reset key");
}
}
private static boolean isPasswordLengthInvalid(String password) {
return (
StringUtils.isEmpty(password) ||
password.length() < ManagedUserVM.PASSWORD_MIN_LENGTH ||
password.length() > ManagedUserVM.PASSWORD_MAX_LENGTH
);
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
ae65e94c3700630e5f0b3c7d951b9ffd1c13b816 | 2e7aae415774519ed3064c1d952c47cf32635e68 | /zyb_mall/src/main/java/com/zyb/mini/mall/service/background/impl/BackgroundServiceImpl.java | 787d741426e22bb1d790dd0ea402e2fda8f93caf | [] | no_license | Starlight-tanxin/codebase | 4571af9b14b59a072d4c06c75f706041fe20ed1c | 280a4adc62c17f07dc9b1dee4bce06880d0cd61f | refs/heads/master | 2022-06-28T12:50:28.086580 | 2021-04-14T06:20:25 | 2021-04-14T06:20:25 | 161,034,393 | 0 | 1 | null | 2022-06-17T03:30:38 | 2018-12-09T11:57:56 | Java | UTF-8 | Java | false | false | 13,403 | java | package com.zyb.mini.mall.service.background.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.base.Strings;
import com.zyb.mini.mall.constant.MaintainState;
import com.zyb.mini.mall.core.R;
import com.zyb.mini.mall.core.Status;
import com.zyb.mini.mall.dao.*;
import com.zyb.mini.mall.pojo.entity.*;
import com.zyb.mini.mall.pojo.param.background.*;
import com.zyb.mini.mall.pojo.param.identify.IdentifyListParam;
import com.zyb.mini.mall.pojo.param.identify.MaintainListParam;
import com.zyb.mini.mall.pojo.param.identify.MaintainMessageParam;
import com.zyb.mini.mall.pojo.param.identify.MaintainMessageTwoParam;
import com.zyb.mini.mall.pojo.param.order.QueryOrderListParam;
import com.zyb.mini.mall.pojo.vo.Order.IdentifyOrderListVo;
import com.zyb.mini.mall.pojo.vo.Order.MinttainOrderListVo;
import com.zyb.mini.mall.pojo.vo.Order.OrderListVo;
import com.zyb.mini.mall.service.background.BackgroundService;
import com.zyb.mini.mall.utils.DateUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author JPPing
* @Date 2019/11/1
*/
@Service
public class BackgroundServiceImpl extends ServiceImpl<GoodsBookMapper, GoodsBook> implements BackgroundService {
@Resource
GoodsBookMapper goodsBookMapper;
@Resource
BookImgMapper bookImgMapper;
@Resource
UserProMapper userProMapper;
@Resource
MaintainProMapper maintainProMapper;
@Resource
ShopOrderMapper shopOrderMapper;
@Resource
MaintainCompanyImgMapper maintainCompanyImgMapper;
@Resource
MaintainMapper maintainMapper;
@Resource
MaintainMsgMapper maintainMsgMapper;
@Resource
IdentifyMapper identifyMapper;
@Resource
UserMapper userMapper;
@Resource
ShopOrderDetailMapper shopOrderDetailMapper;
@Override
@Transactional
public R addBook(AddBookParam addBookParam) {
GoodsBook goodsBook = new GoodsBook();
BeanUtil.copyProperties(addBookParam, goodsBook);
goodsBook.setCreatedTime(LocalDateTime.now());
goodsBookMapper.insert(goodsBook);
if (goodsBook.getImgList() != null) {
for (int i = 0; i < goodsBook.getImgList().size(); i++) {
goodsBook.getImgList().get(i).setGoodsBookId(goodsBook.getId());
goodsBook.getImgList().get(i).setId(null);
bookImgMapper.insert(goodsBook.getImgList().get(i));
}
}
return R.success();
}
@Override
@Transactional
public R updateBook(UpdateBookParam updateBookParam) {
if (goodsBookMapper.selectById(updateBookParam.getId()) == null) {
return null;
}
GoodsBook goodsBook = new GoodsBook();
BeanUtil.copyProperties(updateBookParam, goodsBook);
goodsBookMapper.updateById(goodsBook);
if (goodsBook.getImgList() != null) {
if (goodsBook.getImgList().size() > 0) {
bookImgMapper.delete(new QueryWrapper<BookImg>().lambda().eq(BookImg::getGoodsBookId, goodsBook.getId()));
}
for (int i = 0; i < goodsBook.getImgList().size(); i++) {
goodsBook.getImgList().get(i).setId(null);
goodsBook.getImgList().get(i).setGoodsBookId(goodsBook.getId());
bookImgMapper.insert(goodsBook.getImgList().get(i));
}
}
return R.success();
}
@Override
public R putawayBook(ByIdParam param) {
GoodsBook goodsBook = goodsBookMapper.selectById(param.getId());
if (goodsBook == null) {
return null;
}
if (goodsBook.getIsUp()) {
return R.success("图书已上架!");
} else {
goodsBook.setIsUp(true);
goodsBookMapper.updateById(goodsBook);
}
return R.success();
}
@Override
public R soldOutBook(ByIdParam param) {
GoodsBook goodsBook = goodsBookMapper.selectById(param.getId());
if (goodsBook == null) {
return null;
}
if (goodsBook.getIsUp()) {
goodsBook.setIsUp(false);
goodsBookMapper.updateById(goodsBook);
} else {
return R.success("图书已下架!");
}
return R.success();
}
@Override
@Transactional
public R deleteBook(ByIdParam param) {
GoodsBook goodsBook = goodsBookMapper.selectById(param.getId());
if (goodsBook == null) {
return null;
}
bookImgMapper.delete(new QueryWrapper<BookImg>().lambda().eq(BookImg::getGoodsBookId, goodsBook.getId()));
goodsBookMapper.deleteById(param.getId());
return R.success();
}
@Override
public R<List<OrderListVo>> queryShopOrder(QueryOrderListParam param) {
List<ShopOrder> shopOrderList = shopOrderMapper.queryShopOrder(new Page<>(param.getPage(), param.getPageSize()), param);
if (shopOrderList == null) {
return null;
}
List<Long> ids = shopOrderList.stream().map(ShopOrder::getId).collect(Collectors.toList());
List<Long> userIds = shopOrderList.stream().map(ShopOrder::getUserId).collect(Collectors.toList());
List<User> users = userMapper.queryUserName(userIds);
List<ShopOrderDetail> detailList = shopOrderDetailMapper.selectAllByOrderIds(ids);
List<OrderListVo> orderListVos = shopOrderList.stream().map(shopOrder -> {
OrderListVo orderListVo = new OrderListVo();
BeanUtil.copyProperties(shopOrder, orderListVo);
orderListVo.setAmount(shopOrder.getOrderPrice());
return orderListVo;
}).collect(Collectors.toList());
for (OrderListVo vo : orderListVos) {
for (User user : users) {
String nickname = vo.getNickName();
if (Strings.isNullOrEmpty(nickname)) {
if (user.getId().equals(vo.getUserId())) {
vo.setNickName(user.getNickname());
break;
}
} else {
break;
}
}
}
for (OrderListVo vo : orderListVos) {
for (ShopOrderDetail detail : detailList) {
String mainImg = vo.getMainImg();
if (Strings.isNullOrEmpty(mainImg)) {
if (detail.getShopOrderId().equals(vo.getId())) {
vo.setMainImg(detail.getMainImg());
break;
}
} else {
break;
}
}
}
return R.success(orderListVos);
}
@Override
public R addIdentifySpecialist(AddUserProParam addUserProParam) {
UserPro userPro = new UserPro();
BeanUtil.copyProperties(addUserProParam, userPro);
userPro.setCreatedTime(DateUtils.getLocalDateTime());
userProMapper.insert(userPro);
return R.success();
}
@Override
public R updateIdentifySpecialist(UpdateUserProParam updateUserProParam) {
if (userProMapper.selectById(updateUserProParam.getId()) == null) {
return null;
}
UserPro userPro = new UserPro();
BeanUtil.copyProperties(updateUserProParam, userPro);
userProMapper.updateById(userPro);
return R.success();
}
@Override
public R deleteIdentifySpecialist(ByIdParam param) {
if (userProMapper.selectById(param.getId()) == null) {
return null;
}
userProMapper.deleteById(param.getId());
return R.success();
}
@Override
@Transactional
public R AddPlatformMessage(MaintainMessageParam param) {
Maintain maintain = maintainMapper.selectById(param.getId());
if (maintain == null) {
return null;
}
maintain.setCmMaintainAmount(param.getCmMaintainAmount());
maintain.setCmMaintainDay(param.getCmMaintainDay());
maintain.setCmName("湘阅图书");
maintain.setCmAddress("湖南省长沙市芙蓉区韭菜园街道文艺路16号融都公寓1幢A单元16层16018");
maintain.setCmMobile("0731-84121691");
maintain.setMaintainState(MaintainState.CM_EVALUATE);
maintainMapper.updateById(maintain);
MaintainMsg maintainMsg = new MaintainMsg();
maintainMsg.setCmMaintainMsg(param.getCmMaintainMsg());
maintainMsg.setMaintainId(maintain.getId());
maintainMsg.setCreatedTime(LocalDateTime.now());
maintainMsg.setIsFixed(true);
maintainMsgMapper.insert(maintainMsg);
if (param.getMaintainCompanyImgs() != null) {
for (MaintainCompanyImg maintainCompanyImg : param.getMaintainCompanyImgs()) {
maintainCompanyImg.setMaintainMsgId(maintainMsg.getId());
maintainCompanyImgMapper.insert(maintainCompanyImg);
}
}
return R.success();
}
@Override
@Transactional
public R AddMaintainMsg(MaintainMessageTwoParam param) {
Maintain maintain = maintainMapper.selectById(param.getId());
if (maintain == null) {
return null;
}
if (!maintain.getMaintainState().equals(MaintainState.FIRST_PAYING)) {
return R.error(Status.ORDER_ERROR_STATE);
}
MaintainMsg maintainMsg = new MaintainMsg();
maintainMsg.setCmMaintainMsg(param.getCmMaintainMsg());
maintainMsg.setMaintainId(maintain.getId());
maintainMsg.setCreatedTime(LocalDateTime.now());
maintainMsg.setIsFixed(false);
maintainMsgMapper.insert(maintainMsg);
if (param.getMaintainCompanyImgs() != null) {
for (MaintainCompanyImg maintainCompanyImg : param.getMaintainCompanyImgs()) {
maintainCompanyImg.setMaintainMsgId(maintainMsg.getId());
maintainCompanyImgMapper.insert(maintainCompanyImg);
}
}
// 改变状态
maintain.setMaintainState(MaintainState.COMPLETE);
maintain.setFixedEndTime(LocalDateTime.now());
maintainMapper.updateById(maintain);
return R.success();
}
@Override
public R AddReachTime(ByIdParam param) {
Maintain maintain = maintainMapper.selectById(param.getId());
if (maintain == null) {
return null;
}
maintain.setCmDate(LocalDateTime.now());
maintain.setFixedStartTime(LocalDateTime.now());
maintainMapper.updateById(maintain);
return R.success();
}
@Override
public R<List<IdentifyOrderListVo>> queryIdentifyOrder(IdentifyListParam param) {
List<Identify> identifies = identifyMapper.queryIdentifyOrder(new Page<>(param.getPage(), param.getPageSize()), param);
if (identifies == null) {
return null;
}
List<IdentifyOrderListVo> identifyOrderListVos = identifies.stream().map(identify -> {
IdentifyOrderListVo identifyOrderListVo = new IdentifyOrderListVo();
BeanUtil.copyProperties(identify, identifyOrderListVo);
return identifyOrderListVo;
}).collect(Collectors.toList());
return R.success(identifyOrderListVos);
}
@Override
public R<List<MinttainOrderListVo>> queryMaintainOrder(MaintainListParam param) {
List<Maintain> maintains = maintainMapper.queryMaintainOrder(new Page<>(param.getPage(), param.getPageSize()), param);
if (maintains == null) {
return null;
}
List<MinttainOrderListVo> minttainOrderListVos = maintains.stream().map(minttain -> {
MinttainOrderListVo minttainOrderListVo = new MinttainOrderListVo();
BeanUtil.copyProperties(minttain, minttainOrderListVo);
return minttainOrderListVo;
}).collect(Collectors.toList());
return R.success(minttainOrderListVos);
}
@Override
@Transactional
public R addMaintainSpecialist(AddMaintainProParam addMaintainProParam) {
MaintainPro maintainPro = new MaintainPro();
BeanUtil.copyProperties(addMaintainProParam, maintainPro);
maintainPro.setCreatedTime(LocalDateTime.now());
maintainProMapper.insert(maintainPro);
return R.success();
}
@Override
@Transactional
public R updateMaintainSpecialist(UpdateMaintainProParam updateMaintainProParam) {
if (updateMaintainProParam.getId() == null) {
return null;
}
MaintainPro maintainPro = new MaintainPro();
BeanUtil.copyProperties(updateMaintainProParam, maintainPro);
maintainProMapper.updateById(maintainPro);
return R.success();
}
@Override
@Transactional
public R deleteMaintainSpecialist(ByIdParam param) {
MaintainPro maintainPro = maintainProMapper.selectById(param.getId());
if (maintainPro == null) {
return null;
}
maintainProMapper.deleteById(param.getId());
return R.success();
}
}
| [
"1148841682@qq.com"
] | 1148841682@qq.com |
d7e7ea76b3e4cee458a76dc40b932c5e6ff8b4f0 | 01031837ffdb3c45c2823cdf72e5d21d4c31acda | /Android_app/CipChat/app/src/main/java/com/stevecavallin/cipchat/AuthenticatorService.java | 74642232543a5445431e4ddccddb96e7d3868d89 | [] | no_license | alexpro93/CipChat | 8e64406075a567d6928a94be1fca2b4946b69f71 | a419a8f0a757aa6a984fc5627d04c81d0be26334 | refs/heads/master | 2021-01-10T14:28:50.312670 | 2020-06-11T09:07:19 | 2020-06-11T09:07:19 | 44,096,647 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,305 | java | package com.stevecavallin.cipchat;
import android.accounts.Account;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;
/**
* Created by Steve on 29/07/14.
*/
public class AuthenticatorService extends Service {
private static final String TAG = "GenericAccountService";
public static final String ACCOUNT_NAME = "CipChat";
private Authenticator mAuthenticator;
/**
* Obtain a handle to the {@link android.accounts.Account} used for sync in this application.
*
* <p>It is important that the accountType specified here matches the value in your sync adapter
* configuration XML file for android.accounts.AccountAuthenticator (often saved in
* res/xml/syncadapter.xml). If this is not set correctly, you'll receive an error indicating
* that "caller uid XXXXX is different than the authenticator's uid".
*
* @param accountType AccountType defined in the configuration XML file for
* android.accounts.AccountAuthenticator (e.g. res/xml/syncadapter.xml).
* @return Handle to application's account (not guaranteed to resolve unless CreateSyncAccount()
* has been called)
*/
public static Account GetAccount(String accountType) {
// Note: Normally the account name is set to the user's identity (username or email
// address). However, since we aren't actually using any user accounts, it makes more sense
// to use a generic string in this case.
//
// This string should *not* be localized. If the user switches locale, we would not be
// able to locate the old account, and may erroneously register multiple accounts.
final String accountName = ACCOUNT_NAME;
return new Account(accountName, accountType);
}
@Override
public void onCreate() {
Log.i(TAG, "Service created");
mAuthenticator = new Authenticator(this);
}
@Override
public void onDestroy() {
Log.i(TAG, "Service destroyed");
}
/*
* When the system binds to this Service to make the RPC call
* return the authenticator's IBinder.
*/
@Override
public IBinder onBind(Intent intent) {
return mAuthenticator.getIBinder();
}
}
| [
"alex.cavallin@gmail.com"
] | alex.cavallin@gmail.com |
0c2a18363d585903f725145d22d558cb31a827bf | 1c53d5257ea7be9450919e6b9e0491944a93ba80 | /merge-scenarios/elasticsearch/6556186d9a8-server-src-test-java-org-elasticsearch-indices-recovery-IndexRecoveryIT/base.java | 5c05c817a716411ecccebca472f3281a7397ec02 | [] | no_license | anonyFVer/mastery-material | 89062928807a1f859e9e8b9a113b2d2d123dc3f1 | db76ee571b84be5db2d245f3b593b29ebfaaf458 | refs/heads/master | 2023-03-16T13:13:49.798374 | 2021-02-26T04:19:19 | 2021-02-26T04:19:19 | 342,556,129 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 37,601 | java | package org.elasticsearch.indices.recovery;
import org.elasticsearch.Version;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.node.stats.NodeStats;
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.cluster.action.shard.ShardStateAction;
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.cluster.routing.RecoverySource;
import org.elasticsearch.cluster.routing.RecoverySource.PeerRecoverySource;
import org.elasticsearch.cluster.routing.RecoverySource.SnapshotRecoverySource;
import org.elasticsearch.cluster.routing.RecoverySource.StoreRecoverySource;
import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationCommand;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.ByteSizeUnit;
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.recovery.RecoveryStats;
import org.elasticsearch.index.store.Store;
import org.elasticsearch.indices.IndicesService;
import org.elasticsearch.indices.recovery.RecoveryState.Stage;
import org.elasticsearch.node.RecoverySettingsChunkSizePlugin;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.snapshots.Snapshot;
import org.elasticsearch.snapshots.SnapshotState;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
import org.elasticsearch.test.ESIntegTestCase.Scope;
import org.elasticsearch.test.InternalTestCluster;
import org.elasticsearch.test.junit.annotations.TestLogging;
import org.elasticsearch.test.store.MockFSDirectoryService;
import org.elasticsearch.test.store.MockFSIndexStore;
import org.elasticsearch.test.transport.MockTransportService;
import org.elasticsearch.transport.ConnectTransportException;
import org.elasticsearch.transport.Transport;
import org.elasticsearch.transport.TransportRequest;
import org.elasticsearch.transport.TransportRequestOptions;
import org.elasticsearch.transport.TransportService;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
import static org.elasticsearch.node.RecoverySettingsChunkSizePlugin.CHUNK_SIZE_SETTING;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.lessThanOrEqualTo;
import static org.hamcrest.Matchers.not;
@ClusterScope(scope = Scope.TEST, numDataNodes = 0)
public class IndexRecoveryIT extends ESIntegTestCase {
private static final String INDEX_NAME = "test-idx-1";
private static final String INDEX_TYPE = "test-type-1";
private static final String REPO_NAME = "test-repo-1";
private static final String SNAP_NAME = "test-snap-1";
private static final int MIN_DOC_COUNT = 500;
private static final int MAX_DOC_COUNT = 1000;
private static final int SHARD_COUNT = 1;
private static final int REPLICA_COUNT = 0;
@Override
protected Collection<Class<? extends Plugin>> nodePlugins() {
return Arrays.asList(MockTransportService.TestPlugin.class, MockFSIndexStore.TestPlugin.class, RecoverySettingsChunkSizePlugin.class);
}
private void assertRecoveryStateWithoutStage(RecoveryState state, int shardId, RecoverySource recoverySource, boolean primary, String sourceNode, String targetNode) {
assertThat(state.getShardId().getId(), equalTo(shardId));
assertThat(state.getRecoverySource(), equalTo(recoverySource));
assertThat(state.getPrimary(), equalTo(primary));
if (sourceNode == null) {
assertNull(state.getSourceNode());
} else {
assertNotNull(state.getSourceNode());
assertThat(state.getSourceNode().getName(), equalTo(sourceNode));
}
if (targetNode == null) {
assertNull(state.getTargetNode());
} else {
assertNotNull(state.getTargetNode());
assertThat(state.getTargetNode().getName(), equalTo(targetNode));
}
}
private void assertRecoveryState(RecoveryState state, int shardId, RecoverySource type, boolean primary, Stage stage, String sourceNode, String targetNode) {
assertRecoveryStateWithoutStage(state, shardId, type, primary, sourceNode, targetNode);
assertThat(state.getStage(), equalTo(stage));
}
private void assertOnGoingRecoveryState(RecoveryState state, int shardId, RecoverySource type, boolean primary, String sourceNode, String targetNode) {
assertRecoveryStateWithoutStage(state, shardId, type, primary, sourceNode, targetNode);
assertThat(state.getStage(), not(equalTo(Stage.DONE)));
}
private void slowDownRecovery(ByteSizeValue shardSize) {
long chunkSize = Math.max(1, shardSize.getBytes() / 10);
assertTrue(client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder().put(RecoverySettings.INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey(), chunkSize, ByteSizeUnit.BYTES).put(CHUNK_SIZE_SETTING.getKey(), new ByteSizeValue(chunkSize, ByteSizeUnit.BYTES))).get().isAcknowledged());
}
private void restoreRecoverySpeed() {
assertTrue(client().admin().cluster().prepareUpdateSettings().setTransientSettings(Settings.builder().put(RecoverySettings.INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey(), "20mb").put(CHUNK_SIZE_SETTING.getKey(), RecoverySettings.DEFAULT_CHUNK_SIZE)).get().isAcknowledged());
}
public void testGatewayRecovery() throws Exception {
logger.info("--> start nodes");
String node = internalCluster().startNode();
createAndPopulateIndex(INDEX_NAME, 1, SHARD_COUNT, REPLICA_COUNT);
logger.info("--> restarting cluster");
internalCluster().fullRestart();
ensureGreen();
logger.info("--> request recoveries");
RecoveryResponse response = client().admin().indices().prepareRecoveries(INDEX_NAME).execute().actionGet();
assertThat(response.shardRecoveryStates().size(), equalTo(SHARD_COUNT));
assertThat(response.shardRecoveryStates().get(INDEX_NAME).size(), equalTo(1));
List<RecoveryState> recoveryStates = response.shardRecoveryStates().get(INDEX_NAME);
assertThat(recoveryStates.size(), equalTo(1));
RecoveryState recoveryState = recoveryStates.get(0);
assertRecoveryState(recoveryState, 0, StoreRecoverySource.EXISTING_STORE_INSTANCE, true, Stage.DONE, null, node);
validateIndexRecoveryState(recoveryState.getIndex());
}
public void testGatewayRecoveryTestActiveOnly() throws Exception {
logger.info("--> start nodes");
internalCluster().startNode();
createAndPopulateIndex(INDEX_NAME, 1, SHARD_COUNT, REPLICA_COUNT);
logger.info("--> restarting cluster");
internalCluster().fullRestart();
ensureGreen();
logger.info("--> request recoveries");
RecoveryResponse response = client().admin().indices().prepareRecoveries(INDEX_NAME).setActiveOnly(true).execute().actionGet();
List<RecoveryState> recoveryStates = response.shardRecoveryStates().get(INDEX_NAME);
assertThat(recoveryStates.size(), equalTo(0));
}
public void testReplicaRecovery() throws Exception {
logger.info("--> start node A");
String nodeA = internalCluster().startNode();
logger.info("--> create index on node: {}", nodeA);
createAndPopulateIndex(INDEX_NAME, 1, SHARD_COUNT, REPLICA_COUNT);
logger.info("--> start node B");
String nodeB = internalCluster().startNode();
ensureGreen();
logger.info("--> bump replica count");
client().admin().indices().prepareUpdateSettings(INDEX_NAME).setSettings(Settings.builder().put("number_of_replicas", 1)).execute().actionGet();
ensureGreen();
logger.info("--> request recoveries");
RecoveryResponse response = client().admin().indices().prepareRecoveries(INDEX_NAME).execute().actionGet();
List<RecoveryState> recoveryStates = response.shardRecoveryStates().get(INDEX_NAME);
assertThat(recoveryStates.size(), equalTo(2));
List<RecoveryState> nodeAResponses = findRecoveriesForTargetNode(nodeA, recoveryStates);
assertThat(nodeAResponses.size(), equalTo(1));
List<RecoveryState> nodeBResponses = findRecoveriesForTargetNode(nodeB, recoveryStates);
assertThat(nodeBResponses.size(), equalTo(1));
RecoveryState nodeARecoveryState = nodeAResponses.get(0);
assertRecoveryState(nodeARecoveryState, 0, StoreRecoverySource.EMPTY_STORE_INSTANCE, true, Stage.DONE, null, nodeA);
validateIndexRecoveryState(nodeARecoveryState.getIndex());
RecoveryState nodeBRecoveryState = nodeBResponses.get(0);
assertRecoveryState(nodeBRecoveryState, 0, PeerRecoverySource.INSTANCE, false, Stage.DONE, nodeA, nodeB);
validateIndexRecoveryState(nodeBRecoveryState.getIndex());
}
@TestLogging("_root:DEBUG," + "org.elasticsearch.cluster.service:TRACE," + "org.elasticsearch.indices.cluster:TRACE," + "org.elasticsearch.indices.recovery:TRACE," + "org.elasticsearch.index.shard:TRACE")
public void testRerouteRecovery() throws Exception {
logger.info("--> start node A");
final String nodeA = internalCluster().startNode();
logger.info("--> create index on node: {}", nodeA);
ByteSizeValue shardSize = createAndPopulateIndex(INDEX_NAME, 1, SHARD_COUNT, REPLICA_COUNT).getShards()[0].getStats().getStore().size();
logger.info("--> start node B");
final String nodeB = internalCluster().startNode();
ensureGreen();
logger.info("--> slowing down recoveries");
slowDownRecovery(shardSize);
logger.info("--> move shard from: {} to: {}", nodeA, nodeB);
client().admin().cluster().prepareReroute().add(new MoveAllocationCommand(INDEX_NAME, 0, nodeA, nodeB)).execute().actionGet().getState();
logger.info("--> waiting for recovery to start both on source and target");
final Index index = resolveIndex(INDEX_NAME);
assertBusy(() -> {
IndicesService indicesService = internalCluster().getInstance(IndicesService.class, nodeA);
assertThat(indicesService.indexServiceSafe(index).getShard(0).recoveryStats().currentAsSource(), equalTo(1));
indicesService = internalCluster().getInstance(IndicesService.class, nodeB);
assertThat(indicesService.indexServiceSafe(index).getShard(0).recoveryStats().currentAsTarget(), equalTo(1));
});
logger.info("--> request recoveries");
RecoveryResponse response = client().admin().indices().prepareRecoveries(INDEX_NAME).execute().actionGet();
List<RecoveryState> recoveryStates = response.shardRecoveryStates().get(INDEX_NAME);
List<RecoveryState> nodeARecoveryStates = findRecoveriesForTargetNode(nodeA, recoveryStates);
assertThat(nodeARecoveryStates.size(), equalTo(1));
List<RecoveryState> nodeBRecoveryStates = findRecoveriesForTargetNode(nodeB, recoveryStates);
assertThat(nodeBRecoveryStates.size(), equalTo(1));
assertRecoveryState(nodeARecoveryStates.get(0), 0, StoreRecoverySource.EMPTY_STORE_INSTANCE, true, Stage.DONE, null, nodeA);
validateIndexRecoveryState(nodeARecoveryStates.get(0).getIndex());
assertOnGoingRecoveryState(nodeBRecoveryStates.get(0), 0, PeerRecoverySource.INSTANCE, true, nodeA, nodeB);
validateIndexRecoveryState(nodeBRecoveryStates.get(0).getIndex());
logger.info("--> request node recovery stats");
NodesStatsResponse statsResponse = client().admin().cluster().prepareNodesStats().clear().setIndices(new CommonStatsFlags(CommonStatsFlags.Flag.Recovery)).get();
long nodeAThrottling = Long.MAX_VALUE;
long nodeBThrottling = Long.MAX_VALUE;
for (NodeStats nodeStats : statsResponse.getNodes()) {
final RecoveryStats recoveryStats = nodeStats.getIndices().getRecoveryStats();
if (nodeStats.getNode().getName().equals(nodeA)) {
assertThat("node A should have ongoing recovery as source", recoveryStats.currentAsSource(), equalTo(1));
assertThat("node A should not have ongoing recovery as target", recoveryStats.currentAsTarget(), equalTo(0));
nodeAThrottling = recoveryStats.throttleTime().millis();
}
if (nodeStats.getNode().getName().equals(nodeB)) {
assertThat("node B should not have ongoing recovery as source", recoveryStats.currentAsSource(), equalTo(0));
assertThat("node B should have ongoing recovery as target", recoveryStats.currentAsTarget(), equalTo(1));
nodeBThrottling = recoveryStats.throttleTime().millis();
}
}
logger.info("--> checking throttling increases");
final long finalNodeAThrottling = nodeAThrottling;
final long finalNodeBThrottling = nodeBThrottling;
assertBusy(() -> {
NodesStatsResponse statsResponse1 = client().admin().cluster().prepareNodesStats().clear().setIndices(new CommonStatsFlags(CommonStatsFlags.Flag.Recovery)).get();
assertThat(statsResponse1.getNodes(), hasSize(2));
for (NodeStats nodeStats : statsResponse1.getNodes()) {
final RecoveryStats recoveryStats = nodeStats.getIndices().getRecoveryStats();
if (nodeStats.getNode().getName().equals(nodeA)) {
assertThat("node A throttling should increase", recoveryStats.throttleTime().millis(), greaterThan(finalNodeAThrottling));
}
if (nodeStats.getNode().getName().equals(nodeB)) {
assertThat("node B throttling should increase", recoveryStats.throttleTime().millis(), greaterThan(finalNodeBThrottling));
}
}
});
logger.info("--> speeding up recoveries");
restoreRecoverySpeed();
ensureGreen();
response = client().admin().indices().prepareRecoveries(INDEX_NAME).execute().actionGet();
recoveryStates = response.shardRecoveryStates().get(INDEX_NAME);
assertThat(recoveryStates.size(), equalTo(1));
assertRecoveryState(recoveryStates.get(0), 0, PeerRecoverySource.INSTANCE, true, Stage.DONE, nodeA, nodeB);
validateIndexRecoveryState(recoveryStates.get(0).getIndex());
Consumer<String> assertNodeHasThrottleTimeAndNoRecoveries = nodeName -> {
NodesStatsResponse nodesStatsResponse = client().admin().cluster().prepareNodesStats().setNodesIds(nodeName).clear().setIndices(new CommonStatsFlags(CommonStatsFlags.Flag.Recovery)).get();
assertThat(nodesStatsResponse.getNodes(), hasSize(1));
NodeStats nodeStats = nodesStatsResponse.getNodes().get(0);
final RecoveryStats recoveryStats = nodeStats.getIndices().getRecoveryStats();
assertThat(recoveryStats.currentAsSource(), equalTo(0));
assertThat(recoveryStats.currentAsTarget(), equalTo(0));
assertThat(nodeName + " throttling should be >0", recoveryStats.throttleTime().millis(), greaterThan(0L));
};
assertBusy(() -> assertNodeHasThrottleTimeAndNoRecoveries.accept(nodeA));
assertBusy(() -> assertNodeHasThrottleTimeAndNoRecoveries.accept(nodeB));
logger.info("--> bump replica count");
client().admin().indices().prepareUpdateSettings(INDEX_NAME).setSettings(Settings.builder().put("number_of_replicas", 1)).execute().actionGet();
ensureGreen();
assertBusy(() -> assertNodeHasThrottleTimeAndNoRecoveries.accept(nodeA));
assertBusy(() -> assertNodeHasThrottleTimeAndNoRecoveries.accept(nodeB));
logger.info("--> start node C");
String nodeC = internalCluster().startNode();
assertFalse(client().admin().cluster().prepareHealth().setWaitForNodes("3").get().isTimedOut());
logger.info("--> slowing down recoveries");
slowDownRecovery(shardSize);
logger.info("--> move replica shard from: {} to: {}", nodeA, nodeC);
client().admin().cluster().prepareReroute().add(new MoveAllocationCommand(INDEX_NAME, 0, nodeA, nodeC)).execute().actionGet().getState();
response = client().admin().indices().prepareRecoveries(INDEX_NAME).execute().actionGet();
recoveryStates = response.shardRecoveryStates().get(INDEX_NAME);
nodeARecoveryStates = findRecoveriesForTargetNode(nodeA, recoveryStates);
assertThat(nodeARecoveryStates.size(), equalTo(1));
nodeBRecoveryStates = findRecoveriesForTargetNode(nodeB, recoveryStates);
assertThat(nodeBRecoveryStates.size(), equalTo(1));
List<RecoveryState> nodeCRecoveryStates = findRecoveriesForTargetNode(nodeC, recoveryStates);
assertThat(nodeCRecoveryStates.size(), equalTo(1));
assertRecoveryState(nodeARecoveryStates.get(0), 0, PeerRecoverySource.INSTANCE, false, Stage.DONE, nodeB, nodeA);
validateIndexRecoveryState(nodeARecoveryStates.get(0).getIndex());
assertRecoveryState(nodeBRecoveryStates.get(0), 0, PeerRecoverySource.INSTANCE, true, Stage.DONE, nodeA, nodeB);
validateIndexRecoveryState(nodeBRecoveryStates.get(0).getIndex());
assertOnGoingRecoveryState(nodeCRecoveryStates.get(0), 0, PeerRecoverySource.INSTANCE, false, nodeB, nodeC);
validateIndexRecoveryState(nodeCRecoveryStates.get(0).getIndex());
if (randomBoolean()) {
internalCluster().stopRandomNode(InternalTestCluster.nameFilter(nodeA));
ensureStableCluster(2);
response = client().admin().indices().prepareRecoveries(INDEX_NAME).execute().actionGet();
recoveryStates = response.shardRecoveryStates().get(INDEX_NAME);
nodeARecoveryStates = findRecoveriesForTargetNode(nodeA, recoveryStates);
assertThat(nodeARecoveryStates.size(), equalTo(0));
nodeBRecoveryStates = findRecoveriesForTargetNode(nodeB, recoveryStates);
assertThat(nodeBRecoveryStates.size(), equalTo(1));
nodeCRecoveryStates = findRecoveriesForTargetNode(nodeC, recoveryStates);
assertThat(nodeCRecoveryStates.size(), equalTo(1));
assertRecoveryState(nodeBRecoveryStates.get(0), 0, PeerRecoverySource.INSTANCE, true, Stage.DONE, nodeA, nodeB);
validateIndexRecoveryState(nodeBRecoveryStates.get(0).getIndex());
assertOnGoingRecoveryState(nodeCRecoveryStates.get(0), 0, PeerRecoverySource.INSTANCE, false, nodeB, nodeC);
validateIndexRecoveryState(nodeCRecoveryStates.get(0).getIndex());
}
logger.info("--> speeding up recoveries");
restoreRecoverySpeed();
ensureGreen();
response = client().admin().indices().prepareRecoveries(INDEX_NAME).execute().actionGet();
recoveryStates = response.shardRecoveryStates().get(INDEX_NAME);
nodeARecoveryStates = findRecoveriesForTargetNode(nodeA, recoveryStates);
assertThat(nodeARecoveryStates.size(), equalTo(0));
nodeBRecoveryStates = findRecoveriesForTargetNode(nodeB, recoveryStates);
assertThat(nodeBRecoveryStates.size(), equalTo(1));
nodeCRecoveryStates = findRecoveriesForTargetNode(nodeC, recoveryStates);
assertThat(nodeCRecoveryStates.size(), equalTo(1));
assertRecoveryState(nodeBRecoveryStates.get(0), 0, PeerRecoverySource.INSTANCE, true, Stage.DONE, nodeA, nodeB);
validateIndexRecoveryState(nodeBRecoveryStates.get(0).getIndex());
assertRecoveryState(nodeCRecoveryStates.get(0), 0, PeerRecoverySource.INSTANCE, false, Stage.DONE, nodeB, nodeC);
validateIndexRecoveryState(nodeCRecoveryStates.get(0).getIndex());
}
public void testSnapshotRecovery() throws Exception {
logger.info("--> start node A");
String nodeA = internalCluster().startNode();
logger.info("--> create repository");
assertAcked(client().admin().cluster().preparePutRepository(REPO_NAME).setType("fs").setSettings(Settings.builder().put("location", randomRepoPath()).put("compress", false)).get());
ensureGreen();
logger.info("--> create index on node: {}", nodeA);
createAndPopulateIndex(INDEX_NAME, 1, SHARD_COUNT, REPLICA_COUNT);
logger.info("--> snapshot");
CreateSnapshotResponse createSnapshotResponse = client().admin().cluster().prepareCreateSnapshot(REPO_NAME, SNAP_NAME).setWaitForCompletion(true).setIndices(INDEX_NAME).get();
assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(), greaterThan(0));
assertThat(createSnapshotResponse.getSnapshotInfo().successfulShards(), equalTo(createSnapshotResponse.getSnapshotInfo().totalShards()));
assertThat(client().admin().cluster().prepareGetSnapshots(REPO_NAME).setSnapshots(SNAP_NAME).get().getSnapshots().get(0).state(), equalTo(SnapshotState.SUCCESS));
client().admin().indices().prepareClose(INDEX_NAME).execute().actionGet();
logger.info("--> restore");
RestoreSnapshotResponse restoreSnapshotResponse = client().admin().cluster().prepareRestoreSnapshot(REPO_NAME, SNAP_NAME).setWaitForCompletion(true).execute().actionGet();
int totalShards = restoreSnapshotResponse.getRestoreInfo().totalShards();
assertThat(totalShards, greaterThan(0));
ensureGreen();
logger.info("--> request recoveries");
RecoveryResponse response = client().admin().indices().prepareRecoveries(INDEX_NAME).execute().actionGet();
for (Map.Entry<String, List<RecoveryState>> indexRecoveryStates : response.shardRecoveryStates().entrySet()) {
assertThat(indexRecoveryStates.getKey(), equalTo(INDEX_NAME));
List<RecoveryState> recoveryStates = indexRecoveryStates.getValue();
assertThat(recoveryStates.size(), equalTo(totalShards));
for (RecoveryState recoveryState : recoveryStates) {
SnapshotRecoverySource recoverySource = new SnapshotRecoverySource(new Snapshot(REPO_NAME, createSnapshotResponse.getSnapshotInfo().snapshotId()), Version.CURRENT, INDEX_NAME);
assertRecoveryState(recoveryState, 0, recoverySource, true, Stage.DONE, null, nodeA);
validateIndexRecoveryState(recoveryState.getIndex());
}
}
}
private List<RecoveryState> findRecoveriesForTargetNode(String nodeName, List<RecoveryState> recoveryStates) {
List<RecoveryState> nodeResponses = new ArrayList<>();
for (RecoveryState recoveryState : recoveryStates) {
if (recoveryState.getTargetNode().getName().equals(nodeName)) {
nodeResponses.add(recoveryState);
}
}
return nodeResponses;
}
private IndicesStatsResponse createAndPopulateIndex(String name, int nodeCount, int shardCount, int replicaCount) throws ExecutionException, InterruptedException {
logger.info("--> creating test index: {}", name);
assertAcked(prepareCreate(name, nodeCount, Settings.builder().put("number_of_shards", shardCount).put("number_of_replicas", replicaCount).put(Store.INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING.getKey(), 0)));
ensureGreen();
logger.info("--> indexing sample data");
final int numDocs = between(MIN_DOC_COUNT, MAX_DOC_COUNT);
final IndexRequestBuilder[] docs = new IndexRequestBuilder[numDocs];
for (int i = 0; i < numDocs; i++) {
docs[i] = client().prepareIndex(name, INDEX_TYPE).setSource("foo-int", randomInt(), "foo-string", randomAlphaOfLength(32), "foo-float", randomFloat());
}
indexRandom(true, docs);
flush();
assertThat(client().prepareSearch(name).setSize(0).get().getHits().getTotalHits(), equalTo((long) numDocs));
return client().admin().indices().prepareStats(name).execute().actionGet();
}
private void validateIndexRecoveryState(RecoveryState.Index indexState) {
assertThat(indexState.time(), greaterThanOrEqualTo(0L));
assertThat(indexState.recoveredFilesPercent(), greaterThanOrEqualTo(0.0f));
assertThat(indexState.recoveredFilesPercent(), lessThanOrEqualTo(100.0f));
assertThat(indexState.recoveredBytesPercent(), greaterThanOrEqualTo(0.0f));
assertThat(indexState.recoveredBytesPercent(), lessThanOrEqualTo(100.0f));
}
public void testDisconnectsWhileRecovering() throws Exception {
final String indexName = "test";
final Settings nodeSettings = Settings.builder().put(RecoverySettings.INDICES_RECOVERY_RETRY_DELAY_NETWORK_SETTING.getKey(), "100ms").put(RecoverySettings.INDICES_RECOVERY_INTERNAL_ACTION_TIMEOUT_SETTING.getKey(), "1s").put(MockFSDirectoryService.RANDOM_PREVENT_DOUBLE_WRITE_SETTING.getKey(), false).build();
internalCluster().startNode(nodeSettings);
final String blueNodeName = internalCluster().startNode(Settings.builder().put("node.attr.color", "blue").put(nodeSettings).build());
final String redNodeName = internalCluster().startNode(Settings.builder().put("node.attr.color", "red").put(nodeSettings).build());
ClusterHealthResponse response = client().admin().cluster().prepareHealth().setWaitForNodes(">=3").get();
assertThat(response.isTimedOut(), is(false));
client().admin().indices().prepareCreate(indexName).setSettings(Settings.builder().put(IndexMetaData.INDEX_ROUTING_INCLUDE_GROUP_SETTING.getKey() + "color", "blue").put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)).get();
List<IndexRequestBuilder> requests = new ArrayList<>();
int numDocs = scaledRandomIntBetween(25, 250);
for (int i = 0; i < numDocs; i++) {
requests.add(client().prepareIndex(indexName, "type").setSource("{}", XContentType.JSON));
}
indexRandom(true, requests);
ensureSearchable(indexName);
ClusterStateResponse stateResponse = client().admin().cluster().prepareState().get();
final String blueNodeId = internalCluster().getInstance(ClusterService.class, blueNodeName).localNode().getId();
assertFalse(stateResponse.getState().getRoutingNodes().node(blueNodeId).isEmpty());
SearchResponse searchResponse = client().prepareSearch(indexName).get();
assertHitCount(searchResponse, numDocs);
String[] recoveryActions = new String[] { PeerRecoverySourceService.Actions.START_RECOVERY, PeerRecoveryTargetService.Actions.FILES_INFO, PeerRecoveryTargetService.Actions.FILE_CHUNK, PeerRecoveryTargetService.Actions.CLEAN_FILES, PeerRecoveryTargetService.Actions.PREPARE_TRANSLOG, PeerRecoveryTargetService.Actions.FINALIZE };
final String recoveryActionToBlock = randomFrom(recoveryActions);
final boolean dropRequests = randomBoolean();
logger.info("--> will {} between blue & red on [{}]", dropRequests ? "drop requests" : "break connection", recoveryActionToBlock);
MockTransportService blueMockTransportService = (MockTransportService) internalCluster().getInstance(TransportService.class, blueNodeName);
MockTransportService redMockTransportService = (MockTransportService) internalCluster().getInstance(TransportService.class, redNodeName);
TransportService redTransportService = internalCluster().getInstance(TransportService.class, redNodeName);
TransportService blueTransportService = internalCluster().getInstance(TransportService.class, blueNodeName);
final CountDownLatch requestBlocked = new CountDownLatch(1);
blueMockTransportService.addDelegate(redTransportService, new RecoveryActionBlocker(dropRequests, recoveryActionToBlock, blueMockTransportService.original(), requestBlocked));
redMockTransportService.addDelegate(blueTransportService, new RecoveryActionBlocker(dropRequests, recoveryActionToBlock, redMockTransportService.original(), requestBlocked));
logger.info("--> starting recovery from blue to red");
client().admin().indices().prepareUpdateSettings(indexName).setSettings(Settings.builder().put(IndexMetaData.INDEX_ROUTING_INCLUDE_GROUP_SETTING.getKey() + "color", "red,blue").put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1)).get();
requestBlocked.await();
logger.info("--> stopping to block recovery");
blueMockTransportService.clearAllRules();
redMockTransportService.clearAllRules();
ensureGreen();
searchResponse = client(redNodeName).prepareSearch(indexName).setPreference("_local").get();
assertHitCount(searchResponse, numDocs);
}
private class RecoveryActionBlocker extends MockTransportService.DelegateTransport {
private final boolean dropRequests;
private final String recoveryActionToBlock;
private final CountDownLatch requestBlocked;
RecoveryActionBlocker(boolean dropRequests, String recoveryActionToBlock, Transport delegate, CountDownLatch requestBlocked) {
super(delegate);
this.dropRequests = dropRequests;
this.recoveryActionToBlock = recoveryActionToBlock;
this.requestBlocked = requestBlocked;
}
@Override
protected void sendRequest(Connection connection, long requestId, String action, TransportRequest request, TransportRequestOptions options) throws IOException {
if (recoveryActionToBlock.equals(action) || requestBlocked.getCount() == 0) {
logger.info("--> preventing {} request", action);
requestBlocked.countDown();
if (dropRequests) {
return;
}
throw new ConnectTransportException(connection.getNode(), "DISCONNECT: prevented " + action + " request");
}
super.sendRequest(connection, requestId, action, request, options);
}
}
@TestLogging("_root:DEBUG,org.elasticsearch.indices.recovery:TRACE")
public void testDisconnectsDuringRecovery() throws Exception {
boolean primaryRelocation = randomBoolean();
final String indexName = "test";
final Settings nodeSettings = Settings.builder().put(RecoverySettings.INDICES_RECOVERY_RETRY_DELAY_NETWORK_SETTING.getKey(), TimeValue.timeValueMillis(randomIntBetween(0, 100))).build();
TimeValue disconnectAfterDelay = TimeValue.timeValueMillis(randomIntBetween(0, 100));
String masterNodeName = internalCluster().startMasterOnlyNode(nodeSettings);
final String blueNodeName = internalCluster().startNode(Settings.builder().put("node.attr.color", "blue").put(nodeSettings).build());
final String redNodeName = internalCluster().startNode(Settings.builder().put("node.attr.color", "red").put(nodeSettings).build());
client().admin().indices().prepareCreate(indexName).setSettings(Settings.builder().put(IndexMetaData.INDEX_ROUTING_INCLUDE_GROUP_SETTING.getKey() + "color", "blue").put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1).put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)).get();
List<IndexRequestBuilder> requests = new ArrayList<>();
int numDocs = scaledRandomIntBetween(25, 250);
for (int i = 0; i < numDocs; i++) {
requests.add(client().prepareIndex(indexName, "type").setSource("{}", XContentType.JSON));
}
indexRandom(true, requests);
ensureSearchable(indexName);
assertHitCount(client().prepareSearch(indexName).get(), numDocs);
MockTransportService masterTransportService = (MockTransportService) internalCluster().getInstance(TransportService.class, masterNodeName);
MockTransportService blueMockTransportService = (MockTransportService) internalCluster().getInstance(TransportService.class, blueNodeName);
MockTransportService redMockTransportService = (MockTransportService) internalCluster().getInstance(TransportService.class, redNodeName);
redMockTransportService.addDelegate(blueMockTransportService, new MockTransportService.DelegateTransport(redMockTransportService.original()) {
private final AtomicInteger count = new AtomicInteger();
@Override
protected void sendRequest(Connection connection, long requestId, String action, TransportRequest request, TransportRequestOptions options) throws IOException {
logger.info("--> sending request {} on {}", action, connection.getNode());
if (PeerRecoverySourceService.Actions.START_RECOVERY.equals(action) && count.incrementAndGet() == 1) {
try {
awaitBusy(() -> client(blueNodeName).admin().cluster().prepareState().setLocal(true).get().getState().getRoutingTable().index("test").shard(0).getAllInitializingShards().isEmpty() == false);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
super.sendRequest(connection, requestId, action, request, options);
try {
Thread.sleep(disconnectAfterDelay.millis());
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
throw new ConnectTransportException(connection.getNode(), "DISCONNECT: simulation disconnect after successfully sending " + action + " request");
} else {
super.sendRequest(connection, requestId, action, request, options);
}
}
});
final AtomicBoolean finalized = new AtomicBoolean();
blueMockTransportService.addDelegate(redMockTransportService, new MockTransportService.DelegateTransport(blueMockTransportService.original()) {
@Override
protected void sendRequest(Connection connection, long requestId, String action, TransportRequest request, TransportRequestOptions options) throws IOException {
logger.info("--> sending request {} on {}", action, connection.getNode());
if (action.equals(PeerRecoveryTargetService.Actions.FINALIZE)) {
finalized.set(true);
}
super.sendRequest(connection, requestId, action, request, options);
}
});
for (MockTransportService mockTransportService : Arrays.asList(redMockTransportService, blueMockTransportService)) {
mockTransportService.addDelegate(masterTransportService, new MockTransportService.DelegateTransport(mockTransportService.original()) {
@Override
protected void sendRequest(Connection connection, long requestId, String action, TransportRequest request, TransportRequestOptions options) throws IOException {
logger.info("--> sending request {} on {}", action, connection.getNode());
if ((primaryRelocation && finalized.get()) == false) {
assertNotEquals(action, ShardStateAction.SHARD_FAILED_ACTION_NAME);
}
super.sendRequest(connection, requestId, action, request, options);
}
});
}
if (primaryRelocation) {
logger.info("--> starting primary relocation recovery from blue to red");
client().admin().indices().prepareUpdateSettings(indexName).setSettings(Settings.builder().put(IndexMetaData.INDEX_ROUTING_INCLUDE_GROUP_SETTING.getKey() + "color", "red")).get();
ensureGreen();
client().admin().indices().prepareRefresh(indexName).get();
} else {
logger.info("--> starting replica recovery from blue to red");
client().admin().indices().prepareUpdateSettings(indexName).setSettings(Settings.builder().put(IndexMetaData.INDEX_ROUTING_INCLUDE_GROUP_SETTING.getKey() + "color", "red,blue").put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1)).get();
ensureGreen();
}
for (int i = 0; i < 10; i++) {
assertHitCount(client().prepareSearch(indexName).get(), numDocs);
}
}
} | [
"namasikanam@gmail.com"
] | namasikanam@gmail.com |
f4fc8684a43291d3dd14f9a46e39a96785fc25d0 | 353b042b8d37b1b30ecffb9ad3f250e7d0718820 | /ChatUI/app/src/main/java/com/example/administrator/chatui/MainActivity.java | 075a837ff440b91a3cc54bfac3fd8f4c8c2f74a1 | [] | no_license | Chivi6/as-workplace | 2c8710a255ec26159fac30e86b755c3d2ab60d51 | d494da6388a9131abbdf79812a8990c619c460b6 | refs/heads/master | 2020-03-26T01:55:32.896988 | 2018-10-02T07:27:57 | 2018-10-02T07:27:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,824 | java | package com.example.administrator.chatui;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
ArrayList<mesage> msg=new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final RecyclerView recycler = findViewById(R.id.recyclerview);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recycler.setLayoutManager(layoutManager);
setMsg();
final msgAdapter adapter = new msgAdapter(msg);
recycler.setAdapter(adapter);
final TextView sendText = findViewById(R.id.edittext);
Button send = findViewById(R.id.button);
send.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String text = sendText.getText().toString();
if(!text.equals("")){
mesage newmsg=new mesage(text,mesage.Type_Send);
msg.add(newmsg);
adapter.notifyItemInserted(msg.size()-1);
recycler.scrollToPosition(msg.size()-1);
sendText.setText("");
}
Log.d("msg:",msg.get(msg.size()-1).getText());
}
});
}
private void setMsg(){
msg.add(new mesage("hollowrold",mesage.Type_Received));
}
}
| [
"1106582340@qq.com"
] | 1106582340@qq.com |
91febe88707fff92b99050563b0fa2ae3993f5c4 | 15a0fc848c18efda0ebfe327004ccb27fcce830f | /src/com/github/herong/comm/Environment.java | 7bb28e3f01efb7dd1513dd55a6862b57ff5ee116 | [] | no_license | herong/EncryptPwdGUI | 8658c705057b6f7648689c2841e2ab39ec3cef52 | eccb0781df300b3f109f1c6c39bb523e7d4ee3a0 | refs/heads/master | 2020-06-03T08:36:01.405676 | 2013-06-24T06:28:18 | 2013-06-24T06:28:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,573 | java | /**
* @文件名 : Environment.java
* @包名 : cn.sinobest.framework.comm
* @描述 : TODO(用一句话描述该文件做什么)
* @作者 : herong 填写您的邮箱地址
* @版权 : cn.sinobest 版权所有
* @创建时间: 2010-11-1 下午11:04:28
* @版本 : V1.0
*/
package com.github.herong.comm;
import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.Serializable;
import java.util.Properties;
/**
* @类型名称: Environment
* @功能说明: TODO(这里用一句话描述这个类的作用)
* @作者 : herong
* @创建时间: 2010-11-1 下午11:04:28
* @修改人员: herong
* @修改说明: TODO(描述本次修改内容)
* @修改时间: 2010-11-1 下午11:04:28
* @版本 : V1.0
* @参考 :
*/
public class Environment implements Serializable {
/**
* 系统配置文件
*/
public static final String JDBC_PROPERTIES = "./sysconfig.properties";
/**
* 系统配置信息
*/
public static final Properties GLOBAL_PROPERTIES;
public static String DB_JDBC_CLASS = "";
public static String DB_URL = "";
public static String DB_USERNAME = "";
public static String DB_PASSWORD = "";
public static String DB_JDBC_CLASS2 = "";
public static String DB_URL2 = "";
public static String DB_USERNAME2 = "";
public static String DB_PASSWORD2 = "";
public static String SQL_TPL = "";
public static String DEFUALT_PWD = "aaaaaa";
static {
GLOBAL_PROPERTIES = new Properties();
try {
InputStream stream = Util.getResourceAsStream(JDBC_PROPERTIES);
try {
System.out.println("加载" + JDBC_PROPERTIES);
GLOBAL_PROPERTIES.load(stream);
System.out.println("初始化host");
init();
} catch (IOException e) {
System.out.println("加载" + JDBC_PROPERTIES + "失败!");
e.printStackTrace();
System.exit(1);
} finally {
try {
stream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
} catch (Exception ex) {
System.out.println(JDBC_PROPERTIES + "未找到");
}
}
private static void init() {
DB_JDBC_CLASS = Environment.GLOBAL_PROPERTIES.getProperty("jdbc.driver");
DB_URL = Environment.GLOBAL_PROPERTIES.getProperty("jdbc.url");
DB_USERNAME = Environment.GLOBAL_PROPERTIES.getProperty("jdbc.username");
DB_PASSWORD = Environment.GLOBAL_PROPERTIES.getProperty("jdbc.password");
SQL_TPL = Environment.GLOBAL_PROPERTIES.getProperty("sql.tpl");
DEFUALT_PWD = Environment.GLOBAL_PROPERTIES.getProperty("defualt.pwd");
/*
* DB_JDBC_CLASS2 =
* Environment.GLOBAL_PROPERTIES.getProperty("jdbc.driver2"); DB_URL2 =
* Environment.GLOBAL_PROPERTIES.getProperty("jdbc.url2"); DB_USERNAME2
* = Environment.GLOBAL_PROPERTIES.getProperty("jdbc.username2");
* DB_PASSWORD2 =
* Environment.GLOBAL_PROPERTIES.getProperty("jdbc.password2");
*/
}
public static String save() {
BufferedWriter fileWriter = null;
try {
GLOBAL_PROPERTIES.setProperty("jdbc.url",Environment.DB_URL);
GLOBAL_PROPERTIES.setProperty("jdbc.username",Environment.DB_USERNAME);
GLOBAL_PROPERTIES.setProperty("jdbc.password",Environment.DB_PASSWORD);
GLOBAL_PROPERTIES.setProperty("sql.tpl",Environment.SQL_TPL);
GLOBAL_PROPERTIES.setProperty("defualt.pwd",Environment.DEFUALT_PWD);
fileWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(JDBC_PROPERTIES),"GBK"));
GLOBAL_PROPERTIES.store(fileWriter,"保存参数");
return "保存成功";
} catch (Exception ex) {
ex.printStackTrace();
return "保存失败!" + Util.exception2String(ex, 20);
} finally {
if (fileWriter != null) {
try {
fileWriter.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}
| [
"herong@herong.hnisi.com.cn"
] | herong@herong.hnisi.com.cn |
8b0aba5f68c0e0b64bd592fa1e6c6eec491e1fe9 | c7987a13de41608ab4d0c3227706423aaf7d596c | /src/main/java/com/kotoblog/grabit/exceptions/WrongLoginGrabitException.java | 9bee041b3dd2689c38948161c721c9fbf66fda7d | [] | no_license | Lanqu/grabit | 38c951926bcb7d938ad2dac117c53692e13b438e | 3f2422a4f44a95fa8ad36264fa062c8b18b0d1e6 | refs/heads/master | 2021-01-25T05:21:50.254530 | 2013-06-04T18:39:31 | 2013-06-04T18:39:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 640 | java | package com.kotoblog.grabit.exceptions;
public class WrongLoginGrabitException extends SpinnerGrabitException {
public WrongLoginGrabitException() {
super();
// TODO Auto-generated constructor stub
}
public WrongLoginGrabitException(Exception ex) {
super(ex);
// TODO Auto-generated constructor stub
}
public WrongLoginGrabitException(String message, String page) {
super(message, page);
// TODO Auto-generated constructor stub
}
public WrongLoginGrabitException(String message) {
super(message);
// TODO Auto-generated constructor stub
}
private static final long serialVersionUID = 3108461772342613904L;
}
| [
"lanqu@yandex-team.ru"
] | lanqu@yandex-team.ru |
821bacdbb1a974327d029bda47c405ce5405fa4b | 344afa388b09f281fac8cf9f1776af726577298a | /src/main/java/com/loveholidays/services/AddressPrinter.java | f11f7d448ba54cd1a99b56377d0d35cdc42c12f1 | [] | no_license | linleysmith/address-finder | bfce20b25a92656bd99acc63cb7e8b007cc82dea | 25b419595c191cecf2cb6c76e1c87cdc358e7441 | refs/heads/master | 2020-12-30T16:15:47.947770 | 2017-05-16T10:22:11 | 2017-05-16T10:22:11 | 90,975,214 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 245 | java | package com.loveholidays.services;
import com.loveholidays.domain.Address;
import java.util.Set;
/**
* Created by linleysmith on 15/05/2017.
*
*/
public interface AddressPrinter {
void print(String postcode, Set<Address> addresses);
}
| [
"linley_smith@yahoo.com"
] | linley_smith@yahoo.com |
ed0c1bddae2af188dfad29cc9568b2a1eeb6f969 | ed3a594781fa57d72697ba83619585c3bd52919a | /code/nionetty/src/main/java/com/self/netty/netty/codechandler/StringEncoderHandler.java | 216e8727ec96831c173caf673c4599b3c315ea30 | [] | no_license | zpj0427/study | ab405c5ba186ef9762fae7ff58140cb6dac9d633 | a9a758b95a2299e5660334c4e6a6013450936bac | refs/heads/master | 2022-10-16T09:16:12.725020 | 2022-06-27T14:17:44 | 2022-06-27T14:17:44 | 227,598,053 | 0 | 0 | null | 2022-10-05T00:00:35 | 2019-12-12T12:08:48 | Java | UTF-8 | Java | false | false | 610 | java | package com.self.netty.netty.codechandler;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
import io.netty.util.CharsetUtil;
/**
* @author LiYanBin
* @create 2019-12-26 11:17
**/
public class StringEncoderHandler extends MessageToByteEncoder<String> {
@Override
protected void encode(ChannelHandlerContext ctx, String msg, ByteBuf out) throws Exception {
System.out.println("编码数据..., msg: " + msg);
// 写数据到服务端
out.writeBytes(msg.getBytes(CharsetUtil.UTF_8));
}
}
| [
"758041985@qq.com"
] | 758041985@qq.com |
206ba8e2c608773da8e04d6ff904530053227f93 | 4d0f2d62d1c156d936d028482561585207fb1e49 | /Ma nguon/zcs-8.0.2_GA_5570-src/ZimbraServer/src/java/com/zimbra/cs/account/AttributeCallback.java | f4d94e09e19ff9451cb6a56acc186aa2bc6ef6c2 | [] | no_license | vuhung/06-email-captinh | e3f0ff2e84f1c2bc6bdd6e4167cd7107ec42c0bd | af828ac73fc8096a3cc096806c8080e54d41251f | refs/heads/master | 2020-07-08T09:09:19.146159 | 2013-05-18T12:57:24 | 2013-05-18T12:57:24 | 32,319,083 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 10,236 | java | /*
* ***** BEGIN LICENSE BLOCK *****
* Zimbra Collaboration Suite Server
* Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Zimbra, Inc.
*
* The contents of this file are subject to the Zimbra Public License
* Version 1.3 ("License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.zimbra.com/license.
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
* ***** END LICENSE BLOCK *****
*/
package com.zimbra.cs.account;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.zimbra.common.service.ServiceException;
import com.zimbra.common.util.SetUtil;
import com.zimbra.cs.account.callback.CallbackContext;
/**
* @author schemers
*/
public abstract class AttributeCallback {
/**
* called before an attribute is modified. If a ServiceException is thrown, no attributes will
* be modified. The attrsToModify map should not be modified, other then for the current attrName
* being called.
*
* TODO: if dn/name/type is needed on a create (for whatever reason), we could consider passing
* them in context with well-known-keys, or having separate *Create callbacks.
*
* @param context place to stash data between invocations of pre/post
* @param attrName name of the attribute being modified so the callback can be used with multiple attributes.
* @param attrValue will be null, String, or String[]
* @param attrsToModify a map of all the attributes being modified
* @param entry entry object being modified. null if entry is being created.
* @param isCreate set to true if called during create
* @throws ServiceException causes the whole transaction to abort.
*/
public abstract void preModify(
CallbackContext context,
String attrName,
Object attrValue,
Map attrsToModify,
Entry entry) throws ServiceException;
/**
* called after a successful modify of the attributes. should not throw any exceptions.
*
* @param context
* @param attrName
* @param entry Set on modify and create.
* @param isCreate set to true if called during create
*/
public abstract void postModify(
CallbackContext context,
String attrName,
Entry entry);
protected static class SingleValueMod {
static enum Mod {
SETTING,
UNSETTING
}
Mod mMod;
String mValue;
public boolean setting() { return mMod==Mod.SETTING; }
public boolean unsetting() { return mMod==Mod.UNSETTING; }
public String value() { return mValue; }
}
protected static class MultiValueMod {
static enum Mod {
ADDING,
REMOVING, // removing some values
REPLACING,
DELETING // removing all values
}
Mod mMod;
List<String> mValues = new ArrayList<String>();
public boolean adding() { return mMod==Mod.ADDING; }
public boolean removing() { return mMod==Mod.REMOVING; }
public boolean replacing() { return mMod==Mod.REPLACING; }
public boolean deleting() { return mMod==Mod.DELETING; }
public List<String> values() { return mValues; }
public Set<String> valuesSet() { return new HashSet<String>(mValues); }
}
protected SingleValueMod singleValueMod(String attrName, Object value) throws ServiceException {
SingleValueMod svm = new SingleValueMod();
if (value == null)
svm.mMod = SingleValueMod.Mod.UNSETTING;
else if (!(value instanceof String))
throw ServiceException.INVALID_REQUEST(attrName + " is a single-valued attribute", null);
else {
String s = (String)value;
if ("".equals(s))
svm.mMod = SingleValueMod.Mod.UNSETTING;
else {
svm.mMod = SingleValueMod.Mod.SETTING;
svm.mValue = s;
}
}
return svm;
}
// TODO, remove the above singleValueMod in main and change all callsites to
// use this one. The above does not handle the case if someone does
// a -attrName value for a single-valued attribute, a quite corner case.
protected SingleValueMod singleValueMod(Map attrsToModify, String attrName)
throws ServiceException {
SingleValueMod svm = new SingleValueMod();
Object v = attrsToModify.get("-" + attrName);
if (v != null) {
svm.mMod = SingleValueMod.Mod.UNSETTING;
return svm;
}
Object value = attrsToModify.get(attrName);
if (value == null)
value = attrsToModify.get("+" + attrName);
if (value == null)
svm.mMod = SingleValueMod.Mod.UNSETTING;
else {
String s = null;
if (value instanceof String)
s = (String)value;
else if (value instanceof String[]) {
String[] ss = (String[])value;
if (ss.length == 1)
s = ss[0];
}
// s should be set by now
if (s == null)
throw ServiceException.INVALID_REQUEST(attrName + " is a single-valued attribute", null);
if ("".equals(s))
svm.mMod = SingleValueMod.Mod.UNSETTING;
else {
svm.mMod = SingleValueMod.Mod.SETTING;
svm.mValue = s;
}
}
return svm;
}
/**
*
* @param attrsToModify
* @param attrName
* @return how the attribute named attrName is being modified, returns null if it it not being modified.
* Note, this can be called to test other attributes in the modifyAttr, not only the attribute for
* which the callback function is called.
* If attrName is the attr for which the callback is invoked (i.e. is the attr passed in to preModify),
* then multiValueMod should not return null.
* Null can be returned only when attrName is not the attr for which the preModify callback is called.
*
* @throws ServiceException
*/
protected MultiValueMod multiValueMod(Map attrsToModify, String attrName) throws ServiceException {
MultiValueMod mvm = new MultiValueMod();
Object v = attrsToModify.get(attrName);
if (v != null) {
if ((v instanceof String) && ((String)v).length() == 0)
mvm.mMod = MultiValueMod.Mod.DELETING;
else
mvm.mMod = MultiValueMod.Mod.REPLACING;
} else if (attrsToModify.keySet().contains(attrName)) {
// attrsToModify contains attrName, and the value is null
mvm.mMod = MultiValueMod.Mod.DELETING;
}
if (v == null) {
v = attrsToModify.get("+" + attrName);
if (v != null)
mvm.mMod = MultiValueMod.Mod.ADDING;
}
if (v == null) {
v = attrsToModify.get("-" + attrName);
if (v != null)
mvm.mMod = MultiValueMod.Mod.REMOVING;
}
if (mvm.mMod != null && mvm.mMod != MultiValueMod.Mod.DELETING)
mvm.mValues = getMultiValue(v);
return (mvm.mMod == null)? null : mvm;
}
protected List<String> getMultiValue(Object value) throws ServiceException {
List<String> list = null;
if (value instanceof String) {
list = new ArrayList<String>(1);
list.add((String)value);
} else if (value instanceof String[]) {
list = new ArrayList<String>(Arrays.asList((String[])value));
} else if (value instanceof Collection) {
list = new ArrayList<String>();
for (Object o : (Collection)value)
list.add(o.toString());
} else
throw ServiceException.INVALID_REQUEST("value not a String or String[]", null);
return list;
}
protected Set<String> getMultiValueSet(Object value) throws ServiceException {
Set<String> values = new HashSet<String>();
if (value instanceof String) {
values.add((String)value);
} else if (value instanceof String[]) {
for (String s : (String[])value) {
values.add(s);
}
} else if (value instanceof Collection) {
for (Object o : (Collection)value) {
values.add(o.toString());
}
} else {
throw ServiceException.INVALID_REQUEST("value not a String or String[] or a Collection", null);
}
return values;
}
protected Set<String> newValuesToBe(MultiValueMod mod, Entry entry, String attrName) {
Set<String> newValues = null;
if (entry != null) {
Set<String> curValues = entry.getMultiAttrSet(attrName);
if (mod == null) {
newValues = curValues;
} else {
if (mod.adding()) {
newValues = new HashSet<String>();
SetUtil.union(newValues, curValues, mod.valuesSet());
} else if (mod.removing()) {
newValues = SetUtil.subtract(curValues, mod.valuesSet());
} else if (mod.deleting()) {
newValues = new HashSet<String>();
} else {
newValues = mod.valuesSet();
}
}
} else {
if (mod == null)
newValues = new HashSet<String>();
else
newValues = mod.valuesSet();
}
return newValues;
}
}
| [
"vuhung16plus@gmail.com@ec614674-f94a-24a8-de76-55dc00f2b931"
] | vuhung16plus@gmail.com@ec614674-f94a-24a8-de76-55dc00f2b931 |
97a9ddf35d4db67f50ed74361049808a7afa0f52 | f43dd2eda7759579b03002830a9fc31362922721 | /src/main/java/io/tech/airmate/service/mapper/UserMapper.java | 37ed6d4cf7a271b96ad9b2e91799a6cf9b251bb3 | [] | no_license | guessmyfuture/Airmate | 6401b7f2673eca2bb2a65b56ea43978203952d56 | 34131ebee36c40a4a60e3fb07ca31a3a233113cb | refs/heads/master | 2021-01-19T06:32:52.871915 | 2017-08-17T19:12:47 | 2017-08-17T19:12:47 | 100,636,920 | 0 | 1 | null | 2020-09-18T08:30:10 | 2017-08-17T19:12:44 | Java | UTF-8 | Java | false | false | 2,309 | java | package io.tech.airmate.service.mapper;
import io.tech.airmate.domain.Authority;
import io.tech.airmate.domain.User;
import io.tech.airmate.service.dto.UserDTO;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* Mapper for the entity User and its DTO called UserDTO.
*
* Normal mappers are generated using MapStruct, this one is hand-coded as MapStruct
* support is still in beta, and requires a manual step with an IDE.
*/
@Service
public class UserMapper {
public UserDTO userToUserDTO(User user) {
return new UserDTO(user);
}
public List<UserDTO> usersToUserDTOs(List<User> users) {
return users.stream()
.filter(Objects::nonNull)
.map(this::userToUserDTO)
.collect(Collectors.toList());
}
public User userDTOToUser(UserDTO userDTO) {
if (userDTO == null) {
return null;
} else {
User user = new User();
user.setId(userDTO.getId());
user.setLogin(userDTO.getLogin());
user.setFirstName(userDTO.getFirstName());
user.setLastName(userDTO.getLastName());
user.setEmail(userDTO.getEmail());
user.setImageUrl(userDTO.getImageUrl());
user.setActivated(userDTO.isActivated());
user.setLangKey(userDTO.getLangKey());
Set<Authority> authorities = this.authoritiesFromStrings(userDTO.getAuthorities());
if(authorities != null) {
user.setAuthorities(authorities);
}
return user;
}
}
public List<User> userDTOsToUsers(List<UserDTO> userDTOs) {
return userDTOs.stream()
.filter(Objects::nonNull)
.map(this::userDTOToUser)
.collect(Collectors.toList());
}
public User userFromId(Long id) {
if (id == null) {
return null;
}
User user = new User();
user.setId(id);
return user;
}
public Set<Authority> authoritiesFromStrings(Set<String> strings) {
return strings.stream().map(string -> {
Authority auth = new Authority();
auth.setName(string);
return auth;
}).collect(Collectors.toSet());
}
}
| [
"jhipster-bot@users.noreply.github.com"
] | jhipster-bot@users.noreply.github.com |
306b287772496b0183b48665c3c6cca9a2bf376e | a0f3250517d7433ed2569a4d2d23ba01fec3f4b4 | /src/dropdownDrop/DropdownautoSuggestive.java | 3e9ae24d02ba6a8dfa40c95a25b631d1583bd1e6 | [] | no_license | Khalid-Mahrach/Section_6_8 | 7ecb87f8279b7ceed594e73cbd50dd9b27f1cc63 | a206a70a553983c3e80e581bf9299dbb3b726f4a | refs/heads/main | 2023-03-08T09:01:32.384192 | 2021-02-25T09:09:00 | 2021-02-25T09:09:00 | 342,148,191 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,228 | java | package dropdownDrop;
import java.util.Iterator;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class DropdownautoSuggestive {
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.gecko.driver", "D://Home-Work//seleniumJars//geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("https://rahulshettyacademy.com/dropdownsPractise/");
// driver.findElement(By.id("")).sendKeys("");
// WebDriverWait wait = new WebDriverWait(driver, 4000);
// wait.until(ExpectedConditions.visibilityOfElementLocated((By.id("id"))));
driver.findElement(By.id("autosuggest")).sendKeys("ind");
Thread.sleep(3000);
List<WebElement> option = driver.findElements(By.cssSelector("li[class='ui-menu-item'] a"));
for (WebElement webElement : option) {
if (webElement.getText().equals("India")) {
webElement.click();
break;
}
}
Thread.sleep(3000);
driver.quit();
}
}
| [
"kmahrach76@gmail.com"
] | kmahrach76@gmail.com |
e0c0cfeb2cec6dfc144efca3e19751122c890270 | a0493af7a9ad25f1ba0335a175bc2065da87d669 | /sdk-samples/halo-demo/src/main/java/com/mobgen/halo/android/app/ui/storelocator/SingleLocationFetcher.java | b867c75ba5651f4414a6bd2c19ec632ba0330644 | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] | permissive | mobgen/halo-android | 98373dfa6b387cb6c9fa09b2a258445b41dbfed1 | 71ac76a642f83a5047f767dc90336b8daf79c16b | refs/heads/develop | 2021-01-12T13:18:38.856217 | 2020-05-08T10:20:46 | 2020-05-08T10:20:46 | 72,189,814 | 6 | 4 | Apache-2.0 | 2020-05-08T15:26:14 | 2016-10-28T08:39:14 | Java | UTF-8 | Java | false | false | 2,720 | java | package com.mobgen.halo.android.app.ui.storelocator;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.Looper;
import com.mobgen.halo.android.framework.common.helpers.logger.Halog;
/**
* Gps manager that tries to get the current user location.
*/
public class SingleLocationFetcher implements LocationListener {
/**
* Callback call to receive the location.
*/
public interface LocationCallback {
/**
* The new location saving callback.
*
* @param location The location obtained.
*/
void sendNewLocation(Location location);
}
/**
* The location manager.
*/
private LocationManager mLocationManager;
/**
* The callback.
*/
private LocationCallback mCallback;
/**
* Determines if the manager is enabled or not.
*/
private boolean mEnabled;
/**
* Constructor to keep locations.
*
* @param context The context.
* @param callback The current callback.
*/
public SingleLocationFetcher(Context context, LocationCallback callback) {
mLocationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
mCallback = callback;
}
/**
* Enables the location fetcher.
*/
public void enable() {
if (!mEnabled) {
if (mLocationManager.getAllProviders().contains(LocationManager.GPS_PROVIDER)) {
mLocationManager.requestSingleUpdate(LocationManager.GPS_PROVIDER, this, Looper.myLooper());
}
if (mLocationManager.getAllProviders().contains(LocationManager.GPS_PROVIDER)) {
mLocationManager.requestSingleUpdate(LocationManager.NETWORK_PROVIDER, this, Looper.myLooper());
}
mEnabled = true;
Halog.d(getClass(), "Location service started");
}
}
public void shutdown() {
if (mEnabled) {
mLocationManager.removeUpdates(this);
mLocationManager.removeUpdates(this);
mEnabled = false;
Halog.d(getClass(), "Location service stopped");
}
}
@Override
public void onLocationChanged(Location location) {
if (mCallback != null) {
mCallback.sendNewLocation(location);
}
shutdown();
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onProviderDisabled(String provider) {
}
}
| [
"javier.pedro@mobgen.com"
] | javier.pedro@mobgen.com |
a1a9d443fef83a13357b184406a9792c5fd87366 | 4ba0707f9111d1ef453d6149d6af6ae85972c534 | /src/main/java/com/xulu/demo/framework/util/MyMapper.java | 65b3ea2dc011e6e90556c5a22696f6de2782d6ee | [] | no_license | xulu163/springboot-jedis-activemq-mybatis | 7265ebcf90433d6d6984f1a6798f38763a90e83f | 57a9c6ed7c49157c58a08e22a6000f1893e457d8 | refs/heads/master | 2022-07-14T03:21:34.809584 | 2019-07-02T04:35:48 | 2019-07-02T04:35:48 | 194,772,876 | 0 | 0 | null | 2022-06-21T01:22:23 | 2019-07-02T02:22:39 | Java | UTF-8 | Java | false | false | 244 | java | package com.xulu.demo.framework.util;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.MySqlMapper;
/**
* @author xulu
* 继承自己的MyMapper
*/
public interface MyMapper<T> extends Mapper<T>, MySqlMapper<T> {
}
| [
"xulu@fangjisuo.com"
] | xulu@fangjisuo.com |
25169e4ed6a160bff07c863d2ccab2ecdfd59aa3 | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Math/16/org/apache/commons/math3/util/FastMath_asinh_691.java | 45129e200caa942691e7170e0c920ac33040d121 | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 5,426 | java |
org apach common math3 util
faster accur portabl altern link math
link strict math strictmath larg scale comput
fast math fastmath drop replac math strict math strictmath
mean method math code math sin
code math cbrt user directli chang
method code fast math fastmath sin code fast math fastmath cbrt
previou
fast math fastmath speed achiev reli heavili optim compil
code present jvm todai larg tabl
larger tabl lazili initialis setup
time penalis method
note fast math fastmath
extens insid apach common math call algorithm
overhead tabl intialis occur
end user call fast math fastmath method directli
perform figur specif jvm hardwar evalu
run fast math test perform fastmathtestperform test test directori sourc
distribut
fast math fastmath accuraci independ jvm reli
ieee basic oper embed tabl oper
accur ulp domain rang statement
rough global observ behavior
guarante number input william kahan'
href http wikipedia org wiki round tabl maker 27 dilemma tabl
maker' dilemma
fast math fastmath addition method found math strict math strictmath
link asinh
link acosh
link atanh
method found math strict math strictmath provid
fast math fastmath java virtual machin
link copi sign copysign
link expon getexpon
link nextaft
link nextup
link scalb
link copi sign copysign
link expon getexpon
link nextaft
link nextup
link scalb
version
fast math fastmath
comput invers hyperbol sine number
param number evalu
invers hyperbol sine
asinh
neg
neg
ab asinh absasinh
ab asinh absasinh fast math fastmath log fast math fastmath sqrt
ab asinh absasinh
ab asinh absasinh
ab asinh absasinh
ab asinh absasinh
neg ab asinh absasinh ab asinh absasinh
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
1b6374ef574fc828e05bb1288a50fc7c41a77751 | 902cbae1f871f128a64e1b140fff23f72465ca0c | /spring-creed-mvc/spring-creed-oauth2/spring-creed-oauth2-standalone/src/main/java/com/ethan/std/provisioning/OauthRefreshToken.java | 8ddf8bdad392cf582e1bc6512caaed5d52dad192 | [
"Apache-2.0"
] | permissive | PhotonAlpha/spring-creed | 5f085e612fccd767baa68de7359f1ca53fcb111d | 64a08bc59ef1e21e47893ace707307bb7c529866 | refs/heads/master | 2023-06-23T02:03:34.214592 | 2023-05-13T12:05:29 | 2023-05-13T12:05:29 | 225,605,374 | 2 | 0 | Apache-2.0 | 2023-08-07T16:18:15 | 2019-12-03T11:38:37 | JavaScript | UTF-8 | Java | false | false | 1,318 | java | package com.ethan.std.provisioning;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @description: spring-creed
* @author: EthanCao
* @email: ethan.caoq@foxmail.com
* @date: 8/4/2022 10:09 AM
*/
@Data
@Entity
@Table(name = "oauth_refresh_token")
public class OauthRefreshToken implements Serializable {
@Id
@Column(name = "token_id")
private String tokenId;
@Lob
@Column(name = "token")
private byte[] token;
@Lob
@Column(name = "authentication")
private byte[] authentication;
@Column(name = "create_time")
private LocalDateTime createTime;
public OauthRefreshToken() {
}
public OauthRefreshToken(String tokenId, byte[] token) {
this.tokenId = tokenId;
this.token = token;
}
public OauthRefreshToken(String tokenId, byte[] token, byte[] authentication) {
this.tokenId = tokenId;
this.token = token;
this.authentication = authentication;
}
@Override
public String toString() {
return "OauthRefreshToken{" +
"tokenId='" + tokenId + '\'' +
'}';
}
}
| [
"411084090@qq.com"
] | 411084090@qq.com |
5d1e86c6acb1e7c0a93edbeedf621211d277542b | 5a99280182ff8d447949788d438302a13ab7f930 | /src/main/java/deduper/oscar/haglund/Library.java | 5a2ee4d8114762afc8a6cb892b855fff0dc0972d | [] | no_license | deduper/mockito.jpms.solution.demo | 245e5ef1e21982608ca5431f9fe8df295385ec1f | c199064003b0d58a440e42bb997bb585d4ebf64f | refs/heads/master | 2022-12-21T04:24:28.328674 | 2020-09-30T01:08:26 | 2020-09-30T01:08:26 | 299,768,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 325 | java | /*
* This Java source file was generated by the Gradle 'init' task.
*/
package deduper.oscar.haglund;
public class Library {
private Collaborator collaborator;
public boolean someLibraryMethod() {
return true;
}
public Collaborator collaborate( String anyString ){ return this.collaborator; }
}
| [
"velonista@freenet.de"
] | velonista@freenet.de |
539adbdd667505bbcac1e1e15587a3ca60e1771d | 9b67a87584b7135dba7aff705688bec4d2c5eb24 | /components/components-pubsub/pubsub-definition/src/test/java/org/talend/components/pubsub/PubSubDatastoreDefinitionTest.java | ba2fb71afe2d0c52713f0e8dcc7e830990b62ff9 | [
"Apache-2.0"
] | permissive | RyanSkraba/components | 522373814f340ee95eb7997495561dd8f6ff161b | 390685023185987db4f842c75a2af5cc97dc82d6 | refs/heads/master | 2022-12-23T02:27:03.882504 | 2021-01-11T14:24:33 | 2021-01-11T14:24:33 | 44,814,249 | 1 | 1 | Apache-2.0 | 2022-12-16T03:37:50 | 2015-10-23T13:18:46 | Java | UTF-8 | Java | false | false | 1,405 | java | // ============================================================================
//
// Copyright (C) 2006-2017 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.components.pubsub;
import org.junit.Ignore;
import org.junit.Test;
import org.talend.daikon.runtime.RuntimeInfo;
import static org.junit.Assert.assertEquals;
public class PubSubDatastoreDefinitionTest {
private final PubSubDatastoreDefinition datastoreDefinition = new PubSubDatastoreDefinition();
/**
* Check {@link PubSubDatastoreDefinition#getRuntimeInfo(PubSubDatastoreProperties) returns RuntimeInfo,
* which runtime class name is "org.talend.components.pubsub.runtime.PubSubDatastoreRuntime"
*/
@Test
@Ignore("This can't work unless the runtime jar is already installed in maven!")
public void testRuntimeInfo() {
RuntimeInfo runtimeInfo = datastoreDefinition.getRuntimeInfo(null);
assertEquals("org.talend.components.pubsub.runtime.PubSubDatastoreRuntime", runtimeInfo.getRuntimeClassName());
}
}
| [
"noreply@github.com"
] | noreply@github.com |
69434f4e57b54b0d044f1113e4a69e37a089c918 | c988795800e8e6c8150657e03359e04160396be9 | /app/src/main/java/com/dh/perfectoffer/event/framework/alibaba/fastjson/serializer/CollectionSerializer.java | e3c35b1595264f52d5b61d6de6c20609150b5717 | [] | no_license | caozhiou0804/perfectoffer | 740b194710d3ffc1641216626f7ca85133837ebc | 102a1c5c1300b66c0eaf13f3310eeccf57c0ab61 | refs/heads/master | 2020-12-25T09:28:30.567523 | 2016-08-08T01:43:21 | 2016-08-08T01:43:21 | 64,631,956 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,095 | java | /*
* Copyright 1999-2101 Alibaba Group.
*
* 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.dh.perfectoffer.event.framework.alibaba.fastjson.serializer;
import java.io.IOException;
import java.util.Collection;
/**
* @author wenshao<szujobs@hotmail.com>
*/
public class CollectionSerializer implements ObjectSerializer {
public final static CollectionSerializer instance = new CollectionSerializer();
public void write(JSONSerializer serializer, Object object) throws IOException {
SerializeWriter out = serializer.getWriter();
if (object == null) {
if (out.isEnabled(SerializerFeature.WriteNullListAsEmpty)) {
out.write("[]");
} else {
out.writeNull();
}
return;
}
Collection<?> collection = (Collection<?>) object;
out.append('[');
boolean first = true;
for (Object item : collection) {
if (!first) {
out.append(',');
}
first = false;
if (item == null) {
out.writeNull();
continue;
}
Class<?> clazz = item.getClass();
if (clazz == Integer.class) {
out.writeInt(((Integer) item).intValue());
continue;
}
if (clazz == Long.class) {
out.writeLong(((Long) item).longValue());
continue;
}
serializer.write(item);
}
out.append(']');
}
}
| [
"1195002650@qq.com"
] | 1195002650@qq.com |
98467f8994e611e245dd66c86fbd0d75c8ee4aca | ad81181ac8e251461bbb0777e2c47ee2ed2ad94b | /Month5Day29_2/src/com/xderhuo/service/impl/BookServiceImpl.java | 910ad4165a6e4c88869dd708bd7d83f0b68bf373 | [] | no_license | xuedierhuo/StudyTest | 60f01c94fd5f301fa90ac79f3f78376b2c772f8b | a34ef01c633c54e81332aca28d63e8e99b369def | refs/heads/master | 2020-03-17T05:47:26.759729 | 2018-05-31T00:36:13 | 2018-05-31T00:36:13 | 133,328,827 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 634 | java | package com.xderhuo.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xderhuo.domain.Book;
import com.xderhuo.mapper.BookMapper;
import com.xderhuo.service.BookService;
import com.xderhuo.utils.MyBatisUtils;
import java.util.List;
public class BookServiceImpl implements BookService {
@Override
public PageInfo<Book> findAll(Integer page, Integer rows) {
BookMapper bookMapper = MyBatisUtils.getMapper(BookMapper.class);
PageHelper.startPage(page, rows);
List<Book> books = bookMapper.selectAll();
return new PageInfo<>(books);
}
}
| [
"1598691642@qq.com"
] | 1598691642@qq.com |
b8fdc2263040052fd45c237dd55ab54dd6c28c0a | 1a693235039e2e445a87a91d260f44524bf5e9cb | /AtlasParent/Atlas/src/main/java/cc/funkemunky/api/utils/MathHelper.java | 614483d6132893d7a395549eae5aed8544eb0cd1 | [] | no_license | funkemunky/Atlas | 65cf226254fd991f9dc0990057ef57b51a585070 | 47ae3afc7f87630613fd65951c50159c1c416f42 | refs/heads/master | 2023-06-21T22:08:34.513770 | 2023-03-23T15:39:39 | 2023-03-23T15:39:39 | 163,244,168 | 140 | 48 | null | 2023-06-14T22:51:03 | 2018-12-27T03:44:54 | Java | UTF-8 | Java | false | false | 16,973 | java | package cc.funkemunky.api.utils;
import java.util.Random;
import java.util.UUID;
public class MathHelper {
public static final float SQRT_2 = sqrt_float(2.0F);
public static final float PI = (float) Math.PI;
public static final float PI2 = ((float) Math.PI * 2F);
public static final float PId2 = ((float) Math.PI / 2F);
public static final float deg2Rad = 0.017453292F;
private static final int SIN_BITS = 12;
private static final int SIN_MASK = 4095;
private static final int SIN_COUNT = 4096;
private static final float radFull = ((float) Math.PI * 2F);
private static final float degFull = 360.0F;
private static final float radToIndex = 651.8986F;
private static final float degToIndex = 11.377778F;
private static final float[] SIN_TABLE_FAST = new float[4096];
/**
* A table of sin values computed from 0 (inclusive) to 2*pi (exclusive), with steps of 2*PI / 65536.
*/
private static final float[] SIN_TABLE = new float[65536];
/**
* Though it looks like an array, this is really more like a mapping. Key (index of this array) is the upper 5 bits
* of the result of multiplying a 32-bit unsigned integer by the B(2, 5) De Bruijn sequence 0x077CB531. Value
* (value stored in the array) is the unique index (from the right) of the leftmost one-bit in a 32-bit unsigned
* integer that can cause the upper 5 bits to get that value. Used for highly optimized "find the log-base-2 of
* this number" calculations.
*/
private static final int[] multiplyDeBruijnBitPosition;
private static final double field_181163_d;
private static final double[] field_181164_e;
private static final double[] field_181165_f;
private static final String __OBFID = "CL_00001496";
public static boolean fastMath = false;
static {
for (int i = 0; i < 65536; ++i) {
SIN_TABLE[i] = (float) Math.sin((double) i * Math.PI * 2.0D / 65536.0D);
}
for (int j = 0; j < 4096; ++j) {
SIN_TABLE_FAST[j] = (float) Math.sin((double) (((float) j + 0.5F) / 4096.0F * ((float) Math.PI * 2F)));
}
for (int l = 0; l < 360; l += 90) {
SIN_TABLE_FAST[(int) ((float) l * 11.377778F) & 4095] = (float) Math.sin((double) ((float) l * 0.017453292F));
}
multiplyDeBruijnBitPosition = new int[]{0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8, 31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9};
field_181163_d = Double.longBitsToDouble(4805340802404319232L);
field_181164_e = new double[257];
field_181165_f = new double[257];
for (int k = 0; k < 257; ++k) {
double d1 = (double) k / 256.0D;
double d0 = Math.asin(d1);
field_181165_f[k] = Math.cos(d0);
field_181164_e[k] = d0;
}
}
/**
* sin looked up in a table
*/
public static float sin(float p_76126_0_) {
return fastMath ? SIN_TABLE_FAST[(int) (p_76126_0_ * 651.8986F) & 4095] : SIN_TABLE[(int) (p_76126_0_ * 10430.378F) & 65535];
}
/**
* cos looked up in the sin table with the appropriate offset
*/
public static float cos(float value) {
return fastMath ? SIN_TABLE_FAST[(int) ((value + ((float) Math.PI / 2F)) * 651.8986F) & 4095] : SIN_TABLE[(int) (value * 10430.378F + 16384.0F) & 65535];
}
public static float sqrt_float(float value) {
return (float) Math.sqrt((double) value);
}
public static float sqrt_double(double value) {
return (float) Math.sqrt(value);
}
/**
* Returns the greatest integer less than or equal to the float argument
*/
public static int floor_float(float value) {
int i = (int) value;
return value < (float) i ? i - 1 : i;
}
/**
* returns par0 cast as an int, and no greater than Integer.MAX_VALUE-1024
*/
public static int truncateDoubleToInt(double value) {
return (int) (value + 1024.0D) - 1024;
}
/**
* Returns the greatest integer less than or equal to the double argument
*/
public static int floor_double(double value) {
int i = (int) value;
return value < (double) i ? i - 1 : i;
}
/**
* Long version of floor_double
*/
public static long floor_double_long(double value) {
long i = (long) value;
return value < (double) i ? i - 1L : i;
}
public static int func_154353_e(double value) {
return (int) (value >= 0.0D ? value : -value + 1.0D);
}
public static float abs(float value) {
return value >= 0.0F ? value : -value;
}
/**
* Returns the unsigned value of an int.
*/
public static int abs_int(int value) {
return value >= 0 ? value : -value;
}
public static int ceiling_float_int(float value) {
int i = (int) value;
return value > (float) i ? i + 1 : i;
}
public static int ceiling_double_int(double value) {
int i = (int) value;
return value > (double) i ? i + 1 : i;
}
/**
* Returns the value of the first parameter, clamped to be within the lower and upper limits given by the second and
* third parameters.
*/
public static int clamp_int(int num, int min, int max) {
return num < min ? min : (num > max ? max : num);
}
/**
* Returns the value of the first parameter, clamped to be within the lower and upper limits given by the second and
* third parameters
*/
public static float clamp_float(float num, float min, float max) {
return num < min ? min : (num > max ? max : num);
}
public static double clamp_double(double num, double min, double max) {
return num < min ? min : (num > max ? max : num);
}
public static double denormalizeClamp(double p_151238_0_, double p_151238_2_, double p_151238_4_) {
return p_151238_4_ < 0.0D ? p_151238_0_ : (p_151238_4_ > 1.0D ? p_151238_2_ : p_151238_0_ + (p_151238_2_ - p_151238_0_) * p_151238_4_);
}
/**
* Maximum of the absolute value of two numbers.
*/
public static double abs_max(double p_76132_0_, double p_76132_2_) {
if (p_76132_0_ < 0.0D) {
p_76132_0_ = -p_76132_0_;
}
if (p_76132_2_ < 0.0D) {
p_76132_2_ = -p_76132_2_;
}
return p_76132_0_ > p_76132_2_ ? p_76132_0_ : p_76132_2_;
}
/**
* Buckets an integer with specifed bucket sizes. Args: i, bucketSize
*/
public static int bucketInt(int p_76137_0_, int p_76137_1_) {
return p_76137_0_ < 0 ? -((-p_76137_0_ - 1) / p_76137_1_) - 1 : p_76137_0_ / p_76137_1_;
}
public static int getRandomIntegerInRange(Random p_76136_0_, int p_76136_1_, int p_76136_2_) {
return p_76136_1_ >= p_76136_2_ ? p_76136_1_ : p_76136_0_.nextInt(p_76136_2_ - p_76136_1_ + 1) + p_76136_1_;
}
public static float randomFloatClamp(Random p_151240_0_, float p_151240_1_, float p_151240_2_) {
return p_151240_1_ >= p_151240_2_ ? p_151240_1_ : p_151240_0_.nextFloat() * (p_151240_2_ - p_151240_1_) + p_151240_1_;
}
public static double getRandomDoubleInRange(Random p_82716_0_, double p_82716_1_, double p_82716_3_) {
return p_82716_1_ >= p_82716_3_ ? p_82716_1_ : p_82716_0_.nextDouble() * (p_82716_3_ - p_82716_1_) + p_82716_1_;
}
public static double average(long[] values) {
long i = 0L;
for (long j : values) {
i += j;
}
return (double) i / (double) values.length;
}
public static boolean epsilonEquals(float p_180185_0_, float p_180185_1_) {
return abs(p_180185_1_ - p_180185_0_) < 1.0E-5F;
}
public static int normalizeAngle(int p_180184_0_, int p_180184_1_) {
return (p_180184_0_ % p_180184_1_ + p_180184_1_) % p_180184_1_;
}
/**
* the angle is reduced to an angle between -180 and +180 by mod, and a 360 check
*/
public static float wrapAngleTo180_float(float value) {
value = value % 360.0F;
if (value >= 180.0F) {
value -= 360.0F;
}
if (value < -180.0F) {
value += 360.0F;
}
return value;
}
/**
* the angle is reduced to an angle between -180 and +180 by mod, and a 360 check
*/
public static double wrapAngleTo180_double(double value) {
value = value % 360.0D;
if (value >= 180.0D) {
value -= 360.0D;
}
if (value < -180.0D) {
value += 360.0D;
}
return value;
}
/**
* parses the string as integer or returns the second parameter if it fails
*/
public static int parseIntWithDefault(String p_82715_0_, int p_82715_1_) {
try {
return Integer.parseInt(p_82715_0_);
} catch (Throwable var3) {
return p_82715_1_;
}
}
/**
* parses the string as integer or returns the second parameter if it fails. this value is capped to par2
*/
public static int parseIntWithDefaultAndMax(String p_82714_0_, int p_82714_1_, int p_82714_2_) {
return Math.max(p_82714_2_, parseIntWithDefault(p_82714_0_, p_82714_1_));
}
/**
* parses the string as double or returns the second parameter if it fails.
*/
public static double parseDoubleWithDefault(String p_82712_0_, double p_82712_1_) {
try {
return Double.parseDouble(p_82712_0_);
} catch (Throwable var4) {
return p_82712_1_;
}
}
public static double parseDoubleWithDefaultAndMax(String p_82713_0_, double p_82713_1_, double p_82713_3_) {
return Math.max(p_82713_3_, parseDoubleWithDefault(p_82713_0_, p_82713_1_));
}
/**
* Returns the input value rounded up to the next highest power of two.
*/
public static int roundUpToPowerOfTwo(int value) {
int i = value - 1;
i = i | i >> 1;
i = i | i >> 2;
i = i | i >> 4;
i = i | i >> 8;
i = i | i >> 16;
return i + 1;
}
/**
* Is the given value a power of two? (1, 2, 4, 8, 16, ...)
*/
private static boolean isPowerOfTwo(int value) {
return value != 0 && (value & value - 1) == 0;
}
/**
* Uses a B(2, 5) De Bruijn sequence and a lookup table to efficiently calculate the log-base-two of the given
* value. Optimized for cases where the input value is a power-of-two. If the input value is not a power-of-two,
* then subtract 1 from the return value.
*/
private static int calculateLogBaseTwoDeBruijn(int value) {
value = isPowerOfTwo(value) ? value : roundUpToPowerOfTwo(value);
return multiplyDeBruijnBitPosition[(int) ((long) value * 125613361L >> 27) & 31];
}
/**
* Efficiently calculates the floor of the base-2 log of an integer value. This is effectively the index of the
* highest bit that is set. For example, if the number in binary is 0...100101, this will return 5.
*/
public static int calculateLogBaseTwo(int value) {
return calculateLogBaseTwoDeBruijn(value) - (isPowerOfTwo(value) ? 0 : 1);
}
public static int func_154354_b(int p_154354_0_, int p_154354_1_) {
if (p_154354_1_ == 0) {
return 0;
} else if (p_154354_0_ == 0) {
return p_154354_1_;
} else {
if (p_154354_0_ < 0) {
p_154354_1_ *= -1;
}
int i = p_154354_0_ % p_154354_1_;
return i == 0 ? p_154354_0_ : p_154354_0_ + p_154354_1_ - i;
}
}
public static int func_180183_b(float p_180183_0_, float p_180183_1_, float p_180183_2_) {
return func_180181_b(floor_float(p_180183_0_ * 255.0F), floor_float(p_180183_1_ * 255.0F), floor_float(p_180183_2_ * 255.0F));
}
public static int func_180181_b(int p_180181_0_, int p_180181_1_, int p_180181_2_) {
int i = (p_180181_0_ << 8) + p_180181_1_;
i = (i << 8) + p_180181_2_;
return i;
}
public static int func_180188_d(int p_180188_0_, int p_180188_1_) {
int i = (p_180188_0_ & 16711680) >> 16;
int j = (p_180188_1_ & 16711680) >> 16;
int k = (p_180188_0_ & 65280) >> 8;
int l = (p_180188_1_ & 65280) >> 8;
int i1 = (p_180188_0_ & 255) >> 0;
int j1 = (p_180188_1_ & 255) >> 0;
int k1 = (int) ((float) i * (float) j / 255.0F);
int l1 = (int) ((float) k * (float) l / 255.0F);
int i2 = (int) ((float) i1 * (float) j1 / 255.0F);
return p_180188_0_ & -16777216 | k1 << 16 | l1 << 8 | i2;
}
public static double func_181162_h(double p_181162_0_) {
return p_181162_0_ - Math.floor(p_181162_0_);
}
public static long getCoordinateRandom(int x, int y, int z) {
long i = (long) (x * 3129871) ^ (long) z * 116129781L ^ (long) y;
i = i * i * 42317861L + i * 11L;
return i;
}
public static UUID getRandomUuid(Random rand) {
long i = rand.nextLong() & -61441L | 16384L;
long j = rand.nextLong() & 4611686018427387903L | Long.MIN_VALUE;
return new UUID(i, j);
}
public static double func_181160_c(double p_181160_0_, double p_181160_2_, double p_181160_4_) {
return (p_181160_0_ - p_181160_2_) / (p_181160_4_ - p_181160_2_);
}
public static double func_181159_b(double p_181159_0_, double p_181159_2_) {
double d0 = p_181159_2_ * p_181159_2_ + p_181159_0_ * p_181159_0_;
if (Double.isNaN(d0)) {
return Double.NaN;
} else {
boolean flag = p_181159_0_ < 0.0D;
if (flag) {
p_181159_0_ = -p_181159_0_;
}
boolean flag1 = p_181159_2_ < 0.0D;
if (flag1) {
p_181159_2_ = -p_181159_2_;
}
boolean flag2 = p_181159_0_ > p_181159_2_;
if (flag2) {
double d1 = p_181159_2_;
p_181159_2_ = p_181159_0_;
p_181159_0_ = d1;
}
double d9 = func_181161_i(d0);
p_181159_2_ = p_181159_2_ * d9;
p_181159_0_ = p_181159_0_ * d9;
double d2 = field_181163_d + p_181159_0_;
int i = (int) Double.doubleToRawLongBits(d2);
double d3 = field_181164_e[i];
double d4 = field_181165_f[i];
double d5 = d2 - field_181163_d;
double d6 = p_181159_0_ * d4 - p_181159_2_ * d5;
double d7 = (6.0D + d6 * d6) * d6 * 0.16666666666666666D;
double d8 = d3 + d7;
if (flag2) {
d8 = (Math.PI / 2D) - d8;
}
if (flag1) {
d8 = Math.PI - d8;
}
if (flag) {
d8 = -d8;
}
return d8;
}
}
public static double func_181161_i(double p_181161_0_) {
double d0 = 0.5D * p_181161_0_;
long i = Double.doubleToRawLongBits(p_181161_0_);
i = 6910469410427058090L - (i >> 1);
p_181161_0_ = Double.longBitsToDouble(i);
p_181161_0_ = p_181161_0_ * (1.5D - d0 * p_181161_0_ * p_181161_0_);
return p_181161_0_;
}
public static int func_181758_c(float p_181758_0_, float p_181758_1_, float p_181758_2_) {
int i = (int) (p_181758_0_ * 6.0F) % 6;
float f = p_181758_0_ * 6.0F - (float) i;
float f1 = p_181758_2_ * (1.0F - p_181758_1_);
float f2 = p_181758_2_ * (1.0F - f * p_181758_1_);
float f3 = p_181758_2_ * (1.0F - (1.0F - f) * p_181758_1_);
float f4;
float f5;
float f6;
switch (i) {
case 0:
f4 = p_181758_2_;
f5 = f3;
f6 = f1;
break;
case 1:
f4 = f2;
f5 = p_181758_2_;
f6 = f1;
break;
case 2:
f4 = f1;
f5 = p_181758_2_;
f6 = f3;
break;
case 3:
f4 = f1;
f5 = f2;
f6 = p_181758_2_;
break;
case 4:
f4 = f3;
f5 = f1;
f6 = p_181758_2_;
break;
case 5:
f4 = p_181758_2_;
f5 = f1;
f6 = f2;
break;
default:
throw new RuntimeException("Something went wrong when converting from HSV to RGB. Input was " + p_181758_0_ + ", " + p_181758_1_ + ", " + p_181758_2_);
}
int j = clamp_int((int) (f4 * 255.0F), 0, 255);
int k = clamp_int((int) (f5 * 255.0F), 0, 255);
int l = clamp_int((int) (f6 * 255.0F), 0, 255);
return j << 16 | k << 8 | l;
}
}
| [
"funkemunkybiz@gmail.com"
] | funkemunkybiz@gmail.com |
a3bd0d0e017c2c42be65aad2bbdda2305dbdd60a | 473fc28d466ddbe9758ca49c7d4fb42e7d82586e | /app/src/main/java/com/syd/source/aosp/cts/tests/app/app/src/android/app/stubs/TestDialog.java | 18ef3be68141b5107dafb83145651899a907d24c | [] | no_license | lz-purple/Source | a7788070623f2965a8caa3264778f48d17372bab | e2745b756317aac3c7a27a4c10bdfe0921a82a1c | refs/heads/master | 2020-12-23T17:03:12.412572 | 2020-01-31T01:54:37 | 2020-01-31T01:54:37 | 237,205,127 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 10,645 | java | /*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.app.stubs;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.WindowManager.LayoutParams;
public class TestDialog extends Dialog {
private static final int OPTIONS_MENU_ITEM_0 = Menu.FIRST;
private static final int OPTIONS_MENU_ITEM_1 = Menu.FIRST + 1;
private static final int OPTIONS_MENU_ITEM_2 = Menu.FIRST + 2;
private static final int OPTIONS_MENU_ITEM_3 = Menu.FIRST + 3;
private static final int OPTIONS_MENU_ITEM_4 = Menu.FIRST + 4;
private static final int OPTIONS_MENU_ITEM_5 = Menu.FIRST + 5;
private static final int OPTIONS_MENU_ITEM_6 = Menu.FIRST + 6;
private static final int CONTEXT_MENU_ITEM_0 = Menu.FIRST + 7;
private static final int CONTEXT_MENU_ITEM_1 = Menu.FIRST + 8;
private static final int CONTEXT_MENU_ITEM_2 = Menu.FIRST + 9;
public boolean isOnStartCalled;
public boolean isOnStopCalled;
public boolean isOnCreateCalled;
public boolean isRequestWindowFeature;
public boolean isOnContentChangedCalled;
public boolean isOnWindowFocusChangedCalled;
public boolean isOnTouchEventCalled;
public boolean isOnTrackballEventCalled;
public boolean isOnKeyDownCalled;
public boolean isOnKeyUpCalled;
public boolean isOnKeyMultipleCalled;
public final OrientationTestUtils.Observer onSaveInstanceStateObserver =
new OrientationTestUtils.Observer();
public final static OrientationTestUtils.Observer onRestoreInstanceStateObserver =
new OrientationTestUtils.Observer();
public boolean isOnWindowAttributesChangedCalled;
public boolean isOnCreatePanelMenuCalled;
public boolean isOnCreatePanelViewCalled;
public boolean isOnPreparePanelCalled;
public boolean isOnMenuOpenedCalled;
public boolean isOnMenuItemSelectedCalled;
public boolean isOnPanelClosedCalled;
public boolean isOnCreateOptionsMenuCalled;
public boolean isOnPrepareOptionsMenuCalled;
public boolean isOnOptionsItemSelectedCalled;
public boolean isOnOptionsMenuClosedCalled;
public boolean isOnContextItemSelectedCalled;
public boolean isOnContextMenuClosedCalled;
public boolean isOnCreateContextMenuCalled;
public boolean isOnSearchRequestedCalled;
public boolean onKeyDownReturn;
public boolean onKeyMultipleReturn;
public boolean dispatchTouchEventResult;
public boolean dispatchKeyEventResult;
public int keyDownCode = -1;
public Window window;
public Bundle saveInstanceState;
public Bundle savedInstanceState;
public KeyEvent keyEvent;
public MotionEvent touchEvent;
public MotionEvent trackballEvent;
public MotionEvent onTrackballEvent;
public MotionEvent onTouchEvent;
public KeyEvent keyMultipleEvent;
public TestDialog(Context context) {
super(context);
}
public TestDialog(Context context, int theme) {
super(context, theme);
}
public TestDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
super(context, cancelable, cancelListener);
}
@Override
protected void onStart() {
super.onStart();
isOnStartCalled = true;
}
@Override
protected void onStop() {
super.onStop();
isOnStopCalled = true;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
isRequestWindowFeature = requestWindowFeature(Window.FEATURE_LEFT_ICON);
super.onCreate(savedInstanceState);
isOnCreateCalled = true;
}
@Override
public void onContentChanged() {
super.onContentChanged();
isOnContentChangedCalled = true;
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
isOnWindowFocusChangedCalled = true;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
isOnTouchEventCalled = true;
onTouchEvent = event;
return super.onTouchEvent(event);
}
@Override
public boolean onTrackballEvent(MotionEvent event) {
isOnTrackballEventCalled = true;
onTrackballEvent = event;
return super.onTrackballEvent(event);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
isOnKeyDownCalled = true;
keyDownCode = keyCode;
onKeyDownReturn = super.onKeyDown(keyCode, event);
return onKeyDownReturn;
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
isOnKeyUpCalled = true;
return super.onKeyUp(keyCode, event);
}
@Override
public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) {
isOnKeyMultipleCalled = true;
onKeyMultipleReturn = super.onKeyMultiple(keyCode, repeatCount, event);
keyMultipleEvent = event;
return onKeyMultipleReturn;
}
@Override
public Bundle onSaveInstanceState() {
saveInstanceState = super.onSaveInstanceState();
onSaveInstanceStateObserver.onObserved();
return saveInstanceState;
}
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
this.savedInstanceState = savedInstanceState;
onRestoreInstanceStateObserver.onObserved();
super.onRestoreInstanceState(savedInstanceState);
}
@Override
public void onWindowAttributesChanged(LayoutParams params) {
isOnWindowAttributesChangedCalled = true;
super.onWindowAttributesChanged(params);
}
@Override
public boolean onCreatePanelMenu(int featureId, Menu menu) {
isOnCreatePanelMenuCalled = true;
return super.onCreatePanelMenu(featureId, menu);
}
@Override
public View onCreatePanelView(int featureId) {
isOnCreatePanelViewCalled = true;
return super.onCreatePanelView(featureId);
}
@Override
public boolean onPreparePanel(int featureId, View view, Menu menu) {
isOnPreparePanelCalled = true;
return super.onPreparePanel(featureId, view, menu);
}
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
isOnMenuItemSelectedCalled = true;
return super.onMenuItemSelected(featureId, item);
}
@Override
public boolean onMenuOpened(int featureId, Menu menu) {
isOnMenuOpenedCalled = true;
return super.onMenuOpened(featureId, menu);
}
@Override
public void onPanelClosed(int featureId, Menu menu) {
isOnPanelClosedCalled = true;
super.onPanelClosed(featureId, menu);
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
isOnPrepareOptionsMenuCalled = true;
return super.onPrepareOptionsMenu(menu);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
menu.add(0, OPTIONS_MENU_ITEM_0, 0, "OptionsMenuItem0");
menu.add(0, OPTIONS_MENU_ITEM_1, 0, "OptionsMenuItem1");
menu.add(0, OPTIONS_MENU_ITEM_2, 0, "OptionsMenuItem2");
menu.add(0, OPTIONS_MENU_ITEM_3, 0, "OptionsMenuItem3");
menu.add(0, OPTIONS_MENU_ITEM_4, 0, "OptionsMenuItem4");
menu.add(0, OPTIONS_MENU_ITEM_5, 0, "OptionsMenuItem5");
menu.add(0, OPTIONS_MENU_ITEM_6, 0, "OptionsMenuItem6");
isOnCreateOptionsMenuCalled = true;
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
isOnOptionsItemSelectedCalled = true;
switch (item.getItemId()) {
case OPTIONS_MENU_ITEM_0:
case OPTIONS_MENU_ITEM_1:
case OPTIONS_MENU_ITEM_2:
case OPTIONS_MENU_ITEM_3:
case OPTIONS_MENU_ITEM_4:
case OPTIONS_MENU_ITEM_5:
case OPTIONS_MENU_ITEM_6:
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
public void onOptionsMenuClosed(Menu menu) {
isOnOptionsMenuClosedCalled = true;
super.onOptionsMenuClosed(menu);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
isOnContextItemSelectedCalled = true;
switch (item.getItemId()) {
case CONTEXT_MENU_ITEM_0:
case CONTEXT_MENU_ITEM_1:
case CONTEXT_MENU_ITEM_2:
return true;
default:
return super.onContextItemSelected(item);
}
}
@Override
public void onContextMenuClosed(Menu menu) {
isOnContextMenuClosedCalled = true;
super.onContextMenuClosed(menu);
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
menu.add(0, CONTEXT_MENU_ITEM_0, 0, "ContextMenuItem0");
menu.add(0, CONTEXT_MENU_ITEM_1, 0, "ContextMenuItem1");
menu.add(0, CONTEXT_MENU_ITEM_2, 0, "ContextMenuItem2");
isOnCreateContextMenuCalled = true;
}
@Override
public boolean onSearchRequested() {
isOnSearchRequestedCalled = true;
return super.onSearchRequested();
}
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
keyEvent = event;
dispatchKeyEventResult = super.dispatchKeyEvent(event);
return dispatchKeyEventResult;
}
@Override
public boolean dispatchTrackballEvent(MotionEvent ev) {
trackballEvent = ev;
return super.dispatchTrackballEvent(ev);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
touchEvent = ev;
dispatchTouchEventResult = super.dispatchTouchEvent(ev);
return dispatchTouchEventResult;
}
}
| [
"997530783@qq.com"
] | 997530783@qq.com |
909132c81cc339de81e43448c8849a498478861b | 81253ee5b0cff00685fdce73417182da7a1e19cf | /Hello.java | d7771d43a6581889d8e1b5987cf682af1ce9ad47 | [] | no_license | baismall1983/myProject | 72178f8ca7a961e8895d5a977ce78280c4ca6d12 | 58948b7dabfc0a47ba54937a8419e5c22885cd1f | refs/heads/master | 2021-08-16T19:23:47.243431 | 2017-11-20T08:16:19 | 2017-11-20T08:16:19 | 111,376,061 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 214 | java | /**
* @author baichaoda
* @ClassName: Hello
* @Description: test java
* @date 2017-11-20
*/
public class Hello {
public static void main(String[] args) {
System.out.println("Hello java!");
}
}
| [
"81010512@qq.com"
] | 81010512@qq.com |
2df39e02f5e090dd9c84cc5a800f16603e1f9536 | ddce1fbc658e4bf9d124dc4acfc3914817a580a5 | /sources/com/google/android/gms/common/api/BooleanResult.java | f690f97b22e0a0a3f81336b473ab2ba9534ed49d | [] | no_license | ShahedSabab/eExpense | 1011f833a614c64cbb52a203821e38f18fce8a4f | b85c7ad6ee5ce6ae433a6220df182e14c0ea2d6d | refs/heads/master | 2020-12-21T07:39:45.956655 | 2020-07-13T21:52:04 | 2020-07-13T21:52:04 | 235,963,863 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,045 | java | package com.google.android.gms.common.api;
import com.google.android.gms.common.internal.zzaa;
public class BooleanResult implements Result {
/* renamed from: hv */
private final Status f133hv;
/* renamed from: xv */
private final boolean f134xv;
public BooleanResult(Status status, boolean z) {
this.f133hv = (Status) zzaa.zzb(status, (Object) "Status must not be null");
this.f134xv = z;
}
public final boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof BooleanResult)) {
return false;
}
BooleanResult booleanResult = (BooleanResult) obj;
return this.f133hv.equals(booleanResult.f133hv) && this.f134xv == booleanResult.f134xv;
}
public Status getStatus() {
return this.f133hv;
}
public boolean getValue() {
return this.f134xv;
}
public final int hashCode() {
return (this.f134xv ? 1 : 0) + ((this.f133hv.hashCode() + 527) * 31);
}
}
| [
"59721350+ShahedSabab@users.noreply.github.com"
] | 59721350+ShahedSabab@users.noreply.github.com |
0d9a06a4046e9d0392d2d2cf879803ff4b0c5586 | 10f3b1d345bddb8f52cc77fc6f8aecb13351bdb6 | /src/main/java/com/ctgdesktop/testctyun/common/CodedException.java | 6f27a5027374468c328df0a2eb42e7b6a7b28be5 | [] | no_license | dylan10000/testctyun | ea9ecbed2e7591ab02a5e3ab05d4165d30c7e0a7 | cb0b758531e39a696308bea4acf6fdd666aa1eb0 | refs/heads/master | 2022-06-23T23:55:50.825690 | 2019-11-26T07:18:56 | 2019-11-26T07:18:56 | 224,127,343 | 0 | 0 | null | 2022-06-21T02:19:07 | 2019-11-26T07:18:54 | Java | UTF-8 | Java | false | false | 360 | java | package com.ctgdesktop.testctyun.common;
public class CodedException extends RuntimeException {
private int code;
public CodedException(int code, String message) {
super(message);
this.code = code;
}
public int getCode() {
return this.code;
}
public void setCode(int code) {
this.code = code;
}
} | [
""
] | |
4e4f354e3cc39ccc841d2380f64a609fd2956b02 | 362f05add0c809ec571e1168cbfbb944a8f2298e | /demo/src/com/hit/math/observer/api/CurrentConditionsDisplayApi.java | 51b28150387794bd1466b307b3caf4619835388d | [
"MIT"
] | permissive | guobinhit/design-pattern | 6d84dfc165843f8ebd16d21a7c9b24b46242b329 | 78493a6f750fc25e92bcf97c48a32608e756ab89 | refs/heads/master | 2023-02-16T12:18:58.773692 | 2020-12-24T06:50:27 | 2020-12-24T06:50:27 | 103,791,529 | 32 | 23 | null | null | null | null | UTF-8 | Java | false | false | 1,601 | java | package com.hit.math.observer.api;
import com.hit.math.observer.mime.DisplayElement;
import java.util.Observable;
import java.util.Observer;
/**
* author:Charies Gavin
* date:2017/10/18,23:09
* https:github.com/guobinhit
* description:观察者模式(实现了 Java 内置的 Observer 接口以及我们自定义的展示接口)
*/
public class CurrentConditionsDisplayApi implements Observer, DisplayElement {
private float temperature;
private float humidity;
private float pressure;
/**
* 有参构造器,在构造器内部注册观察者
*
* @param observable
*/
public CurrentConditionsDisplayApi(Observable observable) {
observable.addObserver(this);
}
/**
* 覆盖 Observer 接口中的 update() 方法
* 其中 obs 表示实现了可观察者的类,arg 则为传递给观察者的数据对象,可以为 null
*
* @param obs 可观察者实现类
* @param arg 传递给观察者的数据对象
*/
@Override
public void update(Observable obs, Object arg) {
if (obs instanceof WeatherDataApi) {
WeatherDataApi weatherDate = (WeatherDataApi) obs;
this.temperature = weatherDate.getTemperature();
this.humidity = weatherDate.getHumidity();
this.pressure = weatherDate.getPressure();
display();
}
}
@Override
public void display() {
System.out.println("Current conditions: " + temperature +
"F degrees and " + humidity + "% humidity and " + pressure + "Pa Pressure!");
}
} | [
"guobinhit@qq.com"
] | guobinhit@qq.com |
ccf7c45d5f855ab079f7676ff4f324ca07668084 | 639b1876d2aa29b1a2bbafcce868e26ca6bf4d2c | /src/main/java/com/ms/learning/designpatterns/observer/MyObserver.java | 0811c4ca9da4580c6fcd834e489794e26c6b6b0d | [] | no_license | smile-sam/ms-learning | 5fed7013f17e8e8fc0ab81b8408328529e0781e6 | 5061ff54349d5f09d952a9820ea0fa85ae106564 | refs/heads/master | 2023-07-05T07:10:59.886658 | 2021-08-31T09:26:22 | 2021-08-31T09:26:22 | 320,188,808 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 334 | java | package com.ms.learning.designpatterns.observer;
/**
* @description: TODO
* @author: sam
* @date: 2021/1/9 9:30
* @version: v1.0
*/
public class MyObserver implements Observer{
@Override
public void update(int temperature, int humidity) {
System.out.println("温度" +temperature+"\t 湿度"+ humidity);
}
}
| [
"760448125@qq.com"
] | 760448125@qq.com |
7112fd735b7eddb79f07da7def1ddecbd20ea624 | f825c34d76ef01f94b7920001418597770962b26 | /eCareIS_II/src/main/java/utils/Mappers/UserMapper.java | 3cbd72db60924e3a2e92f47f3ea56ca43584322f | [] | no_license | ag4work/FirstRepository | c9eb55b827d0facc584d145bc4cfd066a6fb2e91 | d8478e7f34c4ea79f6261e3343965c606b4e0e61 | refs/heads/master | 2021-01-10T20:38:54.367162 | 2018-01-17T07:58:39 | 2018-01-17T07:58:39 | 37,475,012 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,581 | java | package utils.Mappers;
import entity.User;
import service.DTO.UserDTO;
/**
* Created by Alexey on 26.06.2015.
*/
public class UserMapper {
private UserMapper() {
}
public static User DTOToEntity(UserDTO userDTO){
if (userDTO==null) return null;
User user = new User();
user.setUserId(userDTO.getUserId());
user.setName(userDTO.getName());
user.setLastname(userDTO.getLastname());
user.setBirthday(userDTO.getBirthday());
user.setPassport(userDTO.getPassport());
user.setAddress(userDTO.getAddress());
user.setEmail(userDTO.getEmail());
user.setPassword(userDTO.getPassword());
user.setRole(userDTO.getRole());
return user;
}
public static UserDTO EntityToDTO(User user){
if (user==null) return null;
UserDTO userDTO = new UserDTO();
userDTO.setUserId(user.getUserId());
userDTO.setName(user.getName());
userDTO.setLastname(user.getLastname());
userDTO.setBirthday(user.getBirthday());
userDTO.setPassport(user.getPassport());
userDTO.setAddress(user.getAddress());
userDTO.setEmail(user.getEmail());
userDTO.setPassword(user.getPassword());
userDTO.setRole(user.getRole());
return userDTO;
}
public static UserDTO EntityToDTOWithSet(User user){
if (user==null) return null;
UserDTO userDTO = EntityToDTO(user);
userDTO.setContracts(ContractMapper.EntitySetToDTOSet(user.getContractOfUser()));
return userDTO;
}
}
| [
"erutirce3"
] | erutirce3 |
2bb2fd44280a3e468f0e7ce8442aa9f43f49e6ae | 08bed978f5279cb193951359cb6c7dd08bb5cde0 | /empty/src/com/san/chengxin/common/model/t0100/T0100OperationCode.java | ae7037147179c7508bd68f683e5ffaefd2a84a67 | [] | no_license | finaltracker/chongming | e71cf4fc1c6b948084b7af274ca89e5213ab9aaa | cbdc198ff5068484b29dd4f30f6fe6b07efd72ea | refs/heads/master | 2020-12-24T06:54:01.183651 | 2017-08-09T06:07:29 | 2017-08-09T06:07:29 | 61,361,401 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 947 | java | package com.san.chengxin.common.model.t0100;
import com.san.chengxin.common.model.t0100.BaseT0100OperationCode;
public class T0100OperationCode extends BaseT0100OperationCode {
private static final long serialVersionUID = 1L;
/*[CONSTRUCTOR MARKER BEGIN]*/
public T0100OperationCode () {
super();
}
/**
* Constructor for primary key
*/
public T0100OperationCode (java.lang.String id) {
super(id);
}
/**
* Constructor for required fields
*/
public T0100OperationCode (
java.lang.String id,
java.lang.String type) {
super (
id,
type);
}
/*[CONSTRUCTOR MARKER END]*/
public String flag = "";
/**
* @return Returns the serialVersionUID.
*/
public static long getSerialVersionUID() {
return serialVersionUID;
}
/**
* @return Returns the flag.
*/
public String getFlag() {
return flag;
}
/**
* @param flag The flag to set.
*/
public void setFlag(String flag) {
this.flag = flag;
}
} | [
"amoi.jinxp@gmail.com"
] | amoi.jinxp@gmail.com |
91d0c44c1579da10471f15a645b9ce1ca5120019 | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project53/src/main/java/org/gradle/test/performance/largejavamultiproject/project53/p266/Production5331.java | ad650b2995a5c0ab497091c98202ac94e0f4a705 | [] | no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,887 | java | package org.gradle.test.performance.largejavamultiproject.project53.p266;
public class Production5331 {
private String property0;
public String getProperty0() {
return property0;
}
public void setProperty0(String value) {
property0 = value;
}
private String property1;
public String getProperty1() {
return property1;
}
public void setProperty1(String value) {
property1 = value;
}
private String property2;
public String getProperty2() {
return property2;
}
public void setProperty2(String value) {
property2 = value;
}
private String property3;
public String getProperty3() {
return property3;
}
public void setProperty3(String value) {
property3 = value;
}
private String property4;
public String getProperty4() {
return property4;
}
public void setProperty4(String value) {
property4 = value;
}
private String property5;
public String getProperty5() {
return property5;
}
public void setProperty5(String value) {
property5 = value;
}
private String property6;
public String getProperty6() {
return property6;
}
public void setProperty6(String value) {
property6 = value;
}
private String property7;
public String getProperty7() {
return property7;
}
public void setProperty7(String value) {
property7 = value;
}
private String property8;
public String getProperty8() {
return property8;
}
public void setProperty8(String value) {
property8 = value;
}
private String property9;
public String getProperty9() {
return property9;
}
public void setProperty9(String value) {
property9 = value;
}
} | [
"sterling.greene@gmail.com"
] | sterling.greene@gmail.com |
1dfcf37961beb143a065599ad95281716ce0c64f | 7e6a8e64ace9ad4c461d78fff5387032df1026b7 | /UnderstandingCDI/basic/src/main/java/tangyong/javaee/understadingcdi/basic11/LoggingProducer.java | cabd52ebd10106ea27d1dba8a328b9a0116200f3 | [
"Apache-2.0"
] | permissive | tangyong/JavaEETraining | 2a2b215c7ba22414e571397c90ce77644f06cd02 | 934afb946b30e18da973ba6e2dd80dc232f54e84 | refs/heads/master | 2016-09-05T12:57:54.463053 | 2013-10-17T05:25:31 | 2013-10-17T05:25:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 400 | java | package tangyong.javaee.understadingcdi.basic11;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.InjectionPoint;
import java.util.logging.Logger;
public class LoggingProducer {
@StandardLog
@Produces
public Logger produceLogger(InjectionPoint injectionPoint) {
return Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getName());
}
}
| [
"tangyong@cn.fujitsu.com"
] | tangyong@cn.fujitsu.com |
f6923029016cc34cf6792aacdc3d5d299d1ab189 | 7dcf477e65d49973a8a6a9e424e0598e576afd01 | /Task5-Computer/src/computerParts/api/StandardMotherboard.java | 4fd38105717aa0e97d69aa6a87a506258d28df9d | [] | no_license | entropiyaa/Java-task | ce3883ca95317501c92ef419a0701b425a4b0541 | 5d6b3b7c87782c22acfa3e59977fc6a1506af07b | refs/heads/master | 2020-11-24T09:35:52.690010 | 2020-02-12T21:18:33 | 2020-02-12T21:18:33 | 228,083,261 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 210 | java | package computerParts.api;
public enum StandardMotherboard implements IStandard {
ST1,
ST2,
ST3,
ST4;
@Override
public String getStandardName() {
return "Motherboard";
}
} | [
"tanyaz.228.67@gmail.com"
] | tanyaz.228.67@gmail.com |
d6186491f695934185d3c9217a006fa005c00311 | a89fc2b525cc47402b4b254a47df1d528d5f2d8e | /src/main/java/com/example/demo/AuthConfig.java | 971da7f544c0c656562b4ed1205192cf550fd3dd | [] | no_license | eduardosplima/mock-atpve | b0d73be1d064daa5836d8d101ef34e2ed5db62c9 | ec2c598fcd16b2c6a93d560ba62da37460808ada | refs/heads/master | 2023-08-29T08:09:59.876823 | 2021-09-22T21:01:41 | 2021-09-22T21:01:41 | 409,032,116 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,643 | java | package com.example.demo;
import org.springframework.beans.factory.annotation.Autowired;
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.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.firewall.DefaultHttpFirewall;
@Configuration
public class AuthConfig extends WebSecurityConfigurerAdapter{
// @Autowired
// private UserDetailsService userDetailsService;
// @Override
// protected void configure(AuthenticationManagerBuilder auth) throws Exception {
// auth.userDetailsService(userDetailsService).passwordEncoder(new BCryptPasswordEncoder());
// }
@Override
public final void configure(final WebSecurity web) throws Exception {
System.out.println(">>>>configure<<<<");
super.configure(web);
web.httpFirewall(new DefaultHttpFirewall());
}
@Override
protected void configure(HttpSecurity http) throws Exception {
// super.configure(http);
System.out.println(">>>>configureII<<<<");
http.csrf().disable().authorizeRequests()
.antMatchers("/employee/me").authenticated()
.antMatchers("/**").permitAll();;
}
} | [
"eduardosplima@gmail.com"
] | eduardosplima@gmail.com |
c5ae4af5ff573e46a672945346e3b3ef92a3c0d5 | 7e61eca0be60390eb48c126dec7e5f9eaa3cd750 | /sample_uvc_camera/src/main/java/com/hsj/sample/uvc/MainActivity.java | 2993abcbc924fdb8d87f27e3a114cb531d4ef736 | [
"Apache-2.0"
] | permissive | webstorage119/android_sample_uvccamera | 6e0010d1ba5d7b8c33e42166d79adfead40ccb79 | 391782a416de566753f588e3d0c4622823bf13d8 | refs/heads/master | 2023-03-28T02:58:00.492371 | 2021-04-06T12:02:22 | 2021-04-06T12:02:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,436 | java | package com.hsj.sample.uvc;
import android.Manifest;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.graphics.SurfaceTexture;
import android.hardware.usb.UsbDevice;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.TextureView;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import com.hsj.camera.DeviceFilter;
import com.hsj.camera.IFrameCallback;
import com.hsj.camera.Size;
import com.hsj.camera.USBMonitor;
import com.hsj.camera.UVCCamera;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.util.List;
/**
* @Author:Hsj
* @Date:2020-06-22
* @Class:MainActivity
* @Desc:Sample of UVCCamera
*/
public final class MainActivity extends AppCompatActivity implements Handler.Callback, SurfaceHolder.Callback {
private static final String TAG = "MainActivity";
//TODO Set your usb camera productId
private static final int PRODUCT_ID = 12384;
//TODO Set your usb camera display width and height
private static int PREVIEW_WIDTH = 1280;
private static int PREVIEW_HEIGHT = 720;
private static final int CAMERA_CREATE = 1;
private static final int CAMERA_PREVIEW = 2;
private static final int CAMERA_START = 3;
private static final int CAMERA_STOP = 4;
private static final int CAMERA_DESTROY = 5;
private int index;
private Context context;
private LinearLayout ll_action;
private USBMonitor mUSBMonitor;
private Handler cameraHandler;
private HandlerThread cameraThread;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SurfaceView sv = findViewById(R.id.sv);
sv.setZOrderOnTop(true);
sv.setZOrderMediaOverlay(true);
sv.getHolder().addCallback(this);
this.ll_action = findViewById(R.id.ll_action);
this.context = getApplicationContext();
this.cameraThread = new HandlerThread("thread_uvc_camera");
this.cameraThread.start();
this.cameraHandler = new Handler(cameraThread.getLooper(), this);
if (hasPermissions(Manifest.permission.CAMERA)) {
createUsbMonitor();
}
}
@Override
protected void onDestroy() {
if (mUSBMonitor != null) {
mUSBMonitor.destroy();
mUSBMonitor = null;
}
if (cameraThread != null) {
try {
cameraThread.join(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
cameraThread = null;
}
super.onDestroy();
Log.d(TAG, "activity destroy");
}
@Override
public void onRequestPermissionsResult(int requestCode,
@NonNull String[] permissions,
@NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
boolean hasAllPermissions = true;
for (int granted : grantResults) {
hasAllPermissions &= (granted == PackageManager.PERMISSION_GRANTED);
}
if (hasAllPermissions) {
createUsbMonitor();
}
}
private void createUsbMonitor() {
this.mUSBMonitor = new USBMonitor(context, dcl);
this.mUSBMonitor.register();
}
private void showToast(@NonNull String msg) {
Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
}
private boolean hasPermissions(String... permissions) {
if (permissions == null || permissions.length == 0) return true;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) return true;
boolean allGranted = true;
for (String permission : permissions) {
if (ActivityCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED) {
allGranted = false;
ActivityCompat.requestPermissions(this, permissions, 0);
}
}
return allGranted;
}
//==========================================Menu====================================================
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if (item.getItemId() == R.id.item_camera) {
showSingleChoiceDialog();
}
return super.onOptionsItemSelected(item);
}
private void showSingleChoiceDialog() {
if (this.mUSBMonitor == null) {
showToast("Wait USBMonitor created success");
} else {
List<UsbDevice> deviceList = mUSBMonitor.getDeviceList();
if (deviceList.size() == 0) {
showToast("No Usb Camera to be found");
} else {
//Close Usb Camera
this.ll_action.setVisibility(View.GONE);
this.cameraHandler.obtainMessage(CAMERA_DESTROY).sendToTarget();
String[] items = new String[deviceList.size()];
for (int i = 0; i < deviceList.size(); ++i) {
UsbDevice device = deviceList.get(i);
items[i] = device.getProductName();
}
AlertDialog.Builder selectDialog = new AlertDialog.Builder(this);
selectDialog.setTitle(R.string.select_camera);
selectDialog.setSingleChoiceItems(items, index, (dialog, which) -> {
index = which;
});
selectDialog.setPositiveButton(R.string.btn_confirm, (dialog, which) -> {
this.ll_action.setVisibility(View.VISIBLE);
UsbDevice device = deviceList.get(index);
if (this.mUSBMonitor.hasPermission(device)){
USBMonitor.UsbControlBlock ctrlBlock = this.mUSBMonitor.openDevice(device);
this.cameraHandler.obtainMessage(CAMERA_CREATE, ctrlBlock).sendToTarget();
}else {
this.mUSBMonitor.requestPermission(device);
}
});
selectDialog.show();
}
}
}
//==========================================Button Click============================================
public void startPreview(View view) {
cameraHandler.obtainMessage(CAMERA_START).sendToTarget();
}
public void stopPreview(View view) {
cameraHandler.obtainMessage(CAMERA_STOP).sendToTarget();
}
public void destroyCamera(View view) {
cameraHandler.obtainMessage(CAMERA_DESTROY).sendToTarget();
}
//===================================Surface========================================================
@Override
public void surfaceCreated(SurfaceHolder holder) {
Log.d(TAG, "->surfaceCreated");
cameraHandler.obtainMessage(CAMERA_PREVIEW, holder.getSurface()).sendToTarget();
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
Log.d(TAG, "->surfaceDestroyed");
cameraHandler.obtainMessage(CAMERA_DESTROY, holder.getSurface()).sendToTarget();
}
//====================================UsbDevice Status==============================================
private final USBMonitor.OnDeviceConnectListener dcl = new USBMonitor.OnDeviceConnectListener() {
@Override
public void onAttach(UsbDevice device) {
Log.i(TAG, "Usb->onAttach->" + device.getProductId());
}
@Override
public void onConnect(UsbDevice device, USBMonitor.UsbControlBlock ctrlBlock, boolean createNew) {
Log.i(TAG, "Usb->onConnect->" + device.getProductId());
cameraHandler.obtainMessage(CAMERA_CREATE, ctrlBlock).sendToTarget();
}
@Override
public void onDisconnect(UsbDevice device, USBMonitor.UsbControlBlock ctrlBlock) {
Log.i(TAG, "Usb->onDisconnect->" + device.getProductId());
}
@Override
public void onCancel(UsbDevice device) {
Log.i(TAG, "Usb->onCancel->" + device.getProductId());
}
@Override
public void onDetach(UsbDevice device) {
Log.i(TAG, "Usb->onDetach->" + device.getProductId());
}
};
//=====================================UVCCamera Action=============================================
private boolean isStart;
private Surface surface;
private UVCCamera camera;
@Override
public boolean handleMessage(@NonNull Message msg) {
switch (msg.what) {
case CAMERA_CREATE:
initCamera((USBMonitor.UsbControlBlock) msg.obj);
break;
case CAMERA_PREVIEW:
setSurface((Surface) msg.obj);
break;
case CAMERA_START:
startCamera();
break;
case CAMERA_STOP:
stopCamera();
break;
case CAMERA_DESTROY:
destroyCamera();
break;
default:
break;
}
return true;
}
private void initCamera(@NonNull USBMonitor.UsbControlBlock block) {
long t = System.currentTimeMillis();
if (camera != null) {
destroyCamera();
camera = null;
}
Log.i(TAG, "camera create start");
try {
camera = new UVCCamera();
camera.open(block);
camera.setPreviewRotate(UVCCamera.PREVIEW_ROTATE.ROTATE_90);
camera.setPreviewFlip(UVCCamera.PREVIEW_FLIP.FLIP_H);
checkSupportSize(camera);
camera.setPreviewSize(PREVIEW_WIDTH, PREVIEW_HEIGHT,
UVCCamera.FRAME_FORMAT_YUYV, 1.0f);
} catch (UnsupportedOperationException | IllegalArgumentException e) {
e.printStackTrace();
camera.destroy();
camera = null;
return;
}
Log.i(TAG, "camera create time=" + (System.currentTimeMillis() - t));
if (surface != null) {
startCamera();
}
}
private void checkSupportSize(UVCCamera mCamera) {
List<Size> sizes = mCamera.getSupportedSizeList();
//Most UsbCamera support 640x480
//A few UsbCamera may fail to obtain the supported resolution
if (sizes == null || sizes.size() == 0) return;
Log.i(TAG, mCamera.getSupportedSize());
boolean isSupport = false;
for (Size size : sizes) {
if (size.width == PREVIEW_WIDTH && size.height == PREVIEW_HEIGHT) {
isSupport = true;
break;
}
}
if (!isSupport) {
//Use intermediate support size
Size size = sizes.get(sizes.size() / 2);
PREVIEW_WIDTH = size.width;
PREVIEW_HEIGHT = size.height;
}
Log.i(TAG, String.format("SupportSize->with=%d,height=%d", PREVIEW_WIDTH, PREVIEW_HEIGHT));
}
private void setSurface(Surface surface) {
this.surface = surface;
if (isStart) {
stopCamera();
startCamera();
} else if (camera != null) {
startCamera();
}
}
private void startCamera() {
long start = System.currentTimeMillis();
if (!isStart && camera != null) {
isStart = true;
if (surface != null) {
//Call this method when you need show preview
Log.i(TAG, "setPreviewDisplay()");
camera.setPreviewDisplay(surface);
}
//TODO Camera frame callback
/*camera.setFrameCallback(frame -> {
Log.d(TAG,"frameSize="+frame.capacity());
}, UVCCamera.PIXEL_FORMAT_RAW);*/
camera.startPreview();
}
Log.i(TAG, "camera start time=" + (System.currentTimeMillis() - start));
}
private void stopCamera() {
long start = System.currentTimeMillis();
if (isStart && camera != null) {
isStart = false;
camera.stopPreview();
}
Log.i(TAG, "camera stop time=" + (System.currentTimeMillis() - start));
}
private void destroyCamera() {
long start = System.currentTimeMillis();
stopCamera();
if (camera != null) {
camera.destroy();
camera = null;
}
Log.i(TAG, "camera destroy time=" + (System.currentTimeMillis() - start));
}
}
| [
"hushengjun@angstrong.com"
] | hushengjun@angstrong.com |
d7c078d8ec048c138bae1d21f46e3807fd299ea5 | f19da17d2d937117cb9fbc86e29cde0ad99729ee | /src/controller/Encryption.java | e009af79b901658f46410e6da16effca34268743 | [] | no_license | IvyNguyenn/web-security-final | b9f8d44aed7b7e9eec31c548935ca8d1b7a9c511 | 6201a6d833a58a3c409db8aa6d8b0c87cdcb1235 | refs/heads/master | 2020-03-20T14:35:49.323294 | 2018-06-16T04:06:20 | 2018-06-16T04:06:20 | 137,489,340 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 854 | java | package controller;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class Encryption {
public static String encryption(String str) {
byte[] defaultBytes = str.getBytes();
try {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(defaultBytes);
byte messageDigest[] = algorithm.digest();
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < messageDigest.length; i++) {
String hex = Integer.toHexString(0xFF & messageDigest[i]);
if (hex.length() == 1) {
hexString.append('0');
}
hexString.append(hex);
}
str = hexString + "";
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return str;
}
}
| [
"ivynguyen@gmail.com"
] | ivynguyen@gmail.com |
4b8d6c34c9b0f1af5fd8a2767ea8ce9c55461455 | 447520f40e82a060368a0802a391697bc00be96f | /apks/apks_from_phone/data_app_com_monefy_app_lite-2/source/android/support/v4/view/a/c.java | 25de31472dda4d92c22f680101e53e2018f70074 | [
"Apache-2.0"
] | permissive | iantal/AndroidPermissions | 7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465 | d623b732734243590b5f004d167e542e2e2ae249 | refs/heads/master | 2023-07-19T01:29:26.689186 | 2019-09-30T19:01:42 | 2019-09-30T19:01:42 | 107,239,248 | 0 | 0 | Apache-2.0 | 2023-07-16T07:41:38 | 2017-10-17T08:22:57 | null | UTF-8 | Java | false | false | 1,026 | java | package android.support.v4.view.a;
import android.os.Build.VERSION;
import android.view.accessibility.AccessibilityManager;
public final class c
{
private static final d a = new c();
static
{
if (Build.VERSION.SDK_INT >= 19)
{
a = new b();
return;
}
if (Build.VERSION.SDK_INT >= 14)
{
a = new a();
return;
}
}
public static boolean a(AccessibilityManager paramAccessibilityManager)
{
return a.a(paramAccessibilityManager);
}
static class a
extends c.c
{
a() {}
public boolean a(AccessibilityManager paramAccessibilityManager)
{
return d.a(paramAccessibilityManager);
}
}
static class b
extends c.a
{
b() {}
}
static class c
implements c.d
{
c() {}
public boolean a(AccessibilityManager paramAccessibilityManager)
{
return false;
}
}
static abstract interface d
{
public abstract boolean a(AccessibilityManager paramAccessibilityManager);
}
}
| [
"antal.micky@yahoo.com"
] | antal.micky@yahoo.com |
e36fba3686f2e34339a364b9c244a2b6b6943356 | d42bf33e62121c9d615e2e6cfde6f89e9847b3fa | /src/picoplaca/DateValidator.java | d12c4d5dd24b3bf5c331c484ea02d5076dc58e3f | [] | no_license | elpoli/StackBuilder | fb44945e22b2e29810620e4504ea9c175451ce21 | 8057875b76ef1b059e76cb532ce457a6ed742680 | refs/heads/master | 2021-01-13T04:33:13.134732 | 2017-01-20T19:57:45 | 2017-01-20T19:57:45 | 79,592,631 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 941 | java | package picoplaca;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class DateValidator extends DataValidator{
private String _dateCar;
SimpleDateFormat dateFormat;
Date dateTemp;
public String getDateCar() {
return _dateCar;
}
public void setDateCar(String dateCar) {
this._dateCar = dateCar;
}
public DateValidator(String dateCar) {
this._dateCar = dateCar;
}
@Override
public boolean validate() {
//validate date
try {
dateFormat = new SimpleDateFormat("dd/MM/yyyy", Locale.ENGLISH);
dateFormat.setLenient(false);
dateTemp = dateFormat.parse(this._dateCar);
return true;
} catch (ParseException e) {
//e.printStackTrace();
return false;
}
}
@Override
public String convert(){
//get day of week
dateFormat.applyPattern("EEEE");
return dateFormat.format(dateTemp).toUpperCase();
}
}
| [
"fpardo@espol.edu.ec"
] | fpardo@espol.edu.ec |
d7ccd2f7981caf89c1b59e0cd422ecd64680aca0 | e5683b820e6c34bd2c0acaf0a915d0c400775324 | /app-order-service/src/main/java/uz/pdp/apporderservice/payload/ReqOrder.java | 785ac8640ea5cb6b5bf00e19c475f09a34195aca | [] | no_license | ismoil001/ismoilsrepository | 11258f0bf83fe4a9fd17a2f49aa29199edc6837f | ac62f8589559eab43b79bb53298eb6ebfb03aaed | refs/heads/master | 2021-06-21T00:01:31.548251 | 2019-10-08T00:10:31 | 2019-10-08T00:10:31 | 214,147,748 | 0 | 0 | null | 2021-04-26T19:34:43 | 2019-10-10T09:58:09 | JavaScript | UTF-8 | Java | false | false | 428 | java | package uz.pdp.apporderservice.payload;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.sql.Timestamp;
import java.util.UUID;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ReqOrder {
private String status;
private UUID userId;
private Timestamp orderedDate;
private String productName;
private Double price;
private Double count;
}
| [
"abdullohibnbotir@mail.ru"
] | abdullohibnbotir@mail.ru |
30504bd512b6d77f649fb3135698f83e645dc285 | 5d20e3494f3b0e12f4e1d804f18d86b9f82b2a18 | /app/src/main/java/com/currency/converter/views/ConverterActivity.java | e3d0bf4148300b07ba017cfd8cd36c9832ba5c6e | [
"MIT"
] | permissive | ramona-cristea/CurrencyConverter | af2cf2bac3fa6769e3c28bbd075b0b0364ff23c1 | c68ee1bc2c0f4ccdf30fc99306b2ab6a8b8c16af | refs/heads/master | 2020-06-18T09:49:29.910557 | 2019-07-10T19:12:13 | 2019-07-10T19:12:13 | 196,261,082 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,105 | java | package com.currency.converter.views;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle;
import com.currency.converter.R;
import com.currency.converter.model.CurrencyViewModel;
import com.currency.converter.model.Rate;
import java.util.List;
public class ConverterActivity extends AppCompatActivity implements RatesAdapter.RatesAdapterHandler{
CurrencyViewModel mCurrencyViewModel;
private static final String BASE_CURRENCY = "EUR";
private static final Double BASE_VALUE = 1.0;
private RatesAdapter mRatesAdapter;
private String mSelectedCurrency = BASE_CURRENCY;
private Double mSelectedValue = BASE_VALUE;
private RecyclerView recyclerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_converter);
mCurrencyViewModel = ViewModelProviders.of(this).get(CurrencyViewModel.class);
recyclerView = findViewById(R.id.recyclerview_rates);
LinearLayoutManager layoutManager = new LinearLayoutManager(this,
RecyclerView.VERTICAL, false);
recyclerView.setLayoutManager(layoutManager);
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(),
layoutManager.getOrientation());
recyclerView.addItemDecoration(dividerItemDecoration);
mRatesAdapter = new RatesAdapter(null, this);
mRatesAdapter.setSelectedCurrency(mSelectedCurrency);
recyclerView.setAdapter(mRatesAdapter);
mCurrencyViewModel.setBaseCurrency(BASE_CURRENCY, BASE_VALUE, false);
mCurrencyViewModel.getPeriodicRatesData().observe(this, observerRates);
}
Observer<List<Rate>> observerRates = this::handleResponse;
private void handleResponse(List<Rate> rates) {
if (rates == null) {
return;
}
mRatesAdapter.setData(rates);
}
@Override
protected void onResume() {
super.onResume();
mCurrencyViewModel.retrieveCurrencyRates();
}
@Override
public void onItemSelected(Rate currency, Double value) {
mCurrencyViewModel.getPeriodicRatesData().removeObserver(observerRates);
recyclerView.scrollToPosition(0);
mSelectedCurrency = currency.getCode();
mSelectedValue = value;
mCurrencyViewModel.setBaseCurrency(mSelectedCurrency, mSelectedValue, false);
mCurrencyViewModel.getPeriodicRatesData().observe(this, observerRates);
}
@Override
public void onCurrencyValueUpdated(String currency, Double value) {
mSelectedCurrency = currency;
mSelectedValue = value;
mCurrencyViewModel.setBaseCurrency(mSelectedCurrency, mSelectedValue, true);
mRatesAdapter.setSelectedCurrency(mSelectedCurrency);
}
}
| [
"ramona.cristea89@gmail.com"
] | ramona.cristea89@gmail.com |
70a625e55cdd14ade18815e94426dca44cb6a002 | e94da104d068117bb0c1f0996e074f64a07c6d8f | /app/src/main/java/com/m520it/jdmall03/bean/OrderProductBean.java | 8b2757647c975869719e9b182c1f2c1c5f8fd96d | [] | no_license | K0rol/Project-For-JDMall | 859cfb71adaa9e5e319751e267b9c902027a26ed | 6ee46d61619e24774a3a37a0c58153db8a7bbee6 | refs/heads/master | 2021-07-13T10:40:56.051368 | 2017-10-17T17:02:23 | 2017-10-17T17:02:23 | 107,299,155 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,132 | java | package com.m520it.jdmall03.bean;
/**
* Created by Administrator on 2017/8/15 0015.
*/
public class OrderProductBean {
private double amount;
private String piconUrl;
private String pname;
private String version;
private Long pid;
private int buyCount;
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public String getPiconUrl() {
return piconUrl;
}
public void setPiconUrl(String piconUrl) {
this.piconUrl = piconUrl;
}
public String getPname() {
return pname;
}
public void setPname(String pname) {
this.pname = pname;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public Long getPid() {
return pid;
}
public void setPid(Long pid) {
this.pid = pid;
}
public int getBuyCount() {
return buyCount;
}
public void setBuyCount(int buyCount) {
this.buyCount = buyCount;
}
}
| [
"1716704029@qq.com"
] | 1716704029@qq.com |
ccc25cac3b497d6a77db55b8887e69312cd2bca5 | 57f6ea6ba85dc1e1635a3e3a26ad0b512546e1d6 | /br.ufcg.edu.csp/src/br/ufcg/edu/csp/utils/CSPViewsContentProvider.java | 46459dd39370c5900d3f755667d93e43f75c3e3f | [
"MIT"
] | permissive | igorbrasileiro/CSPDev | 29cfe0fd6d651ec35c6309d5daf551f3d83d1c7e | ea980afb290c1370547cb2024499d070ebcce184 | refs/heads/master | 2023-08-03T23:39:53.585771 | 2023-07-26T13:52:57 | 2023-07-26T13:52:57 | 102,363,226 | 1 | 0 | MIT | 2023-07-26T13:52:58 | 2017-09-04T13:15:23 | Java | UTF-8 | Java | false | false | 4,341 | java | package br.ufcg.edu.csp.utils;
import java.util.ArrayList;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.tree.ParseTree;
import org.antlr.v4.runtime.tree.TerminalNodeImpl;
import org.eclipse.jface.viewers.ITreeContentProvider;
import br.ufcg.edu.csp.outline.ExpressionNodeDecorator;
import br.ufcg.edu.csp.parser.CspParser;
import br.ufcg.edu.csp.parser.ParserUtil;
public class CSPViewsContentProvider<T> implements ITreeContentProvider {
private INodeFactory factory;
public CSPViewsContentProvider(INodeFactory factory) {
this.factory = factory;
}
public ParserRuleContext getTree() {
return ParserUtil.getRootFromTextEditor(); // nao pode retornar null, impede de criar a tree;
}
@Override
public boolean hasChildren(Object obj) {
boolean result = false;
if(obj instanceof CspParser.DefinitionContext){
result = ((ParseTree) obj).getChildCount() > 1;
} else if(obj instanceof ExpressionNodeDecorator) {
result = ((ExpressionNodeDecorator)obj).hasChildren();
}
return result;
}
@Override
public Object getParent(Object obj) {
return ((INodeDecorator)obj).getNode().getParent();
}
@Override
public Object[] getElements(Object obj) {
ArrayList<T> elementos = new ArrayList<>();
if(obj instanceof CspParser.SpecContext){
getElements(obj, elementos);
} else if (obj instanceof INodeDecorator){
return getElements(((INodeDecorator) obj).getNode());
} else if(obj instanceof Object[]) {
return (Object[]) obj;
}
return elementos.toArray();
}
/**
* Metodo recursivo para descer da regra Spec até SimpleDefinition
* @param obj
* @param list
*/
@SuppressWarnings("unchecked")
private void getElements(Object obj, ArrayList<T> list) {
if(obj instanceof CspParser.SpecContext){
// regra de muitos filhos
int children = ((ParseTree) obj).getChildCount();
for (int i = 0; i < children; i++) {
ParseTree node = ((ParseTree) obj).getChild(i);
getElements(node, list);
}
} else if(obj instanceof CspParser.DefinitionContext) {
// regra de filho unico
ParseTree node = ((ParseTree) obj).getChild(0);
getElements(node, list);
} else if(obj instanceof CspParser.SimpleDefinitionContext) {
addNodeInList((ParseTree) obj, list);
} else if (obj instanceof CspParser.AnyContext) {
getElements(((ParseTree)obj).getChild(0), list);
} else if(obj instanceof CspParser.ProcContext) {
ParseTree node = (ParseTree) obj;
// if it comes from any, has left proc OPERATOR proc2, need get the second proc
if(node.getChild(0) instanceof TerminalNodeImpl && node.getChild(1) instanceof TerminalNodeImpl) {
//ID ARROW proc
addNodeInList(node, list);
} else if(node.getChild(0).getText().equals("(")) {
// LPAREN proc RPAREN
getElements(node.getChild(1), list);
} else if(node.getChild(0) instanceof CspParser.ProcContext
&& node.getChild(2) instanceof CspParser.ProcContext) {
// proc operator proc
addNodeInList(node.getChild(0), list);
addNodeInList(node.getChild(2), list);
} else if(node.getChild(0) instanceof CspParser.ProcContext
&& node.getChild(2) instanceof CspParser.SetContext) {
// proc LSYNC set RSYNC proc
addNodeInList(node.getChild(0), list);
addNodeInList(node.getChild(4), list);
} else if(node.getChild(0).getText().equals("if")) {
//if bool then proc else proc
addNodeInList(node.getChild(3), list);
addNodeInList(node.getChild(5), list);
} else if(node.getChild(0) instanceof CspParser.BoolExpContext) {
// boolexp guard proc
addNodeInList(node.getChild(2), list);
} else {
addNodeInList(node, list);
}
}
}
public void addNodeInList(ParseTree node, ArrayList<T> list) {
INodeDecorator nodeDecorator = factory.createInstance();
nodeDecorator.setNode(node);
list.add((T) nodeDecorator);
}
@Override
public Object[] getChildren(Object obj) {
ArrayList<T> elementos = new ArrayList<>();
if (obj instanceof ExpressionNodeDecorator) {
ParseTree node = ((ExpressionNodeDecorator) obj).getNode();
if(node instanceof CspParser.SimpleDefinitionContext) {
// pega regra any
getElements(node.getChild(2), elementos);
} else if(node instanceof CspParser.ProcContext) {
getElements(node.getChild(2), elementos);
}
}
return elementos.toArray();
}
}
| [
"brasileiro456@gmail.com"
] | brasileiro456@gmail.com |
d75cab03057a68b64cd104d9fb5f9f7fb0d65814 | 26f58561cda045395a1ae980b0ad7499cb719ec2 | /src/hasor-jetty/src/main/java/org/eclipse/jetty/security/authentication/DeferredAuthentication.java | 4908c541a60a7b4090a8089c56a2f89623d316bd | [] | no_license | simplechen/hasor | 5338037bb4e4553df4c78dc13b118b70da779a47 | 438fe8caa378aa0d6835121d06a5cf5b77c4e11d | refs/heads/master | 2021-01-16T22:24:41.395124 | 2014-07-04T11:59:07 | 2014-07-04T11:59:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,689 | java | //
// ========================================================================
// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.security.authentication;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Collection;
import java.util.Collections;
import java.util.Locale;
import javax.servlet.ServletOutputStream;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.eclipse.jetty.security.Authenticator;
import org.eclipse.jetty.security.IdentityService;
import org.eclipse.jetty.security.LoginService;
import org.eclipse.jetty.security.ServerAuthException;
import org.eclipse.jetty.security.UserAuthentication;
import org.eclipse.jetty.server.Authentication;
import org.eclipse.jetty.server.UserIdentity;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
public class DeferredAuthentication implements Authentication.Deferred
{
private static final Logger LOG = Log.getLogger(DeferredAuthentication.class);
protected final LoginAuthenticator _authenticator;
private Object _previousAssociation;
/* ------------------------------------------------------------ */
public DeferredAuthentication(LoginAuthenticator authenticator)
{
if (authenticator == null)
throw new NullPointerException("No Authenticator");
this._authenticator = authenticator;
}
/* ------------------------------------------------------------ */
/**
* @see org.eclipse.jetty.server.Authentication.Deferred#authenticate(ServletRequest)
*/
public Authentication authenticate(ServletRequest request)
{
try
{
Authentication authentication = _authenticator.validateRequest(request,__deferredResponse,true);
if (authentication!=null && (authentication instanceof Authentication.User) && !(authentication instanceof Authentication.ResponseSent))
{
LoginService login_service= _authenticator.getLoginService();
IdentityService identity_service=login_service.getIdentityService();
if (identity_service!=null)
_previousAssociation=identity_service.associate(((Authentication.User)authentication).getUserIdentity());
return authentication;
}
}
catch (ServerAuthException e)
{
LOG.debug(e);
}
return this;
}
/* ------------------------------------------------------------ */
/**
* @see org.eclipse.jetty.server.Authentication.Deferred#authenticate(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
*/
public Authentication authenticate(ServletRequest request, ServletResponse response)
{
try
{
LoginService login_service= _authenticator.getLoginService();
IdentityService identity_service=login_service.getIdentityService();
Authentication authentication = _authenticator.validateRequest(request,response,true);
if (authentication instanceof Authentication.User && identity_service!=null)
_previousAssociation=identity_service.associate(((Authentication.User)authentication).getUserIdentity());
return authentication;
}
catch (ServerAuthException e)
{
LOG.debug(e);
}
return this;
}
/* ------------------------------------------------------------ */
/**
* @see org.eclipse.jetty.server.Authentication.Deferred#login(java.lang.String, java.lang.String)
*/
public Authentication login(String username, Object password, ServletRequest request)
{
UserIdentity identity = _authenticator.login(username, password, request);
if (identity != null)
{
IdentityService identity_service = _authenticator.getLoginService().getIdentityService();
UserAuthentication authentication = new UserAuthentication("API",identity);
if (identity_service != null)
_previousAssociation=identity_service.associate(identity);
return authentication;
}
return null;
}
/* ------------------------------------------------------------ */
public Object getPreviousAssociation()
{
return _previousAssociation;
}
/* ------------------------------------------------------------ */
/**
* @param response
* @return true if this response is from a deferred call to {@link #authenticate(ServletRequest)}
*/
public static boolean isDeferred(HttpServletResponse response)
{
return response==__deferredResponse;
}
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */
final static HttpServletResponse __deferredResponse = new HttpServletResponse()
{
public void addCookie(Cookie cookie)
{
}
public void addDateHeader(String name, long date)
{
}
public void addHeader(String name, String value)
{
}
public void addIntHeader(String name, int value)
{
}
public boolean containsHeader(String name)
{
return false;
}
public String encodeRedirectURL(String url)
{
return null;
}
public String encodeRedirectUrl(String url)
{
return null;
}
public String encodeURL(String url)
{
return null;
}
public String encodeUrl(String url)
{
return null;
}
public void sendError(int sc) throws IOException
{
}
public void sendError(int sc, String msg) throws IOException
{
}
public void sendRedirect(String location) throws IOException
{
}
public void setDateHeader(String name, long date)
{
}
public void setHeader(String name, String value)
{
}
public void setIntHeader(String name, int value)
{
}
public void setStatus(int sc)
{
}
public void setStatus(int sc, String sm)
{
}
public void flushBuffer() throws IOException
{
}
public int getBufferSize()
{
return 1024;
}
public String getCharacterEncoding()
{
return null;
}
public String getContentType()
{
return null;
}
public Locale getLocale()
{
return null;
}
public ServletOutputStream getOutputStream() throws IOException
{
return __nullOut;
}
public PrintWriter getWriter() throws IOException
{
return IO.getNullPrintWriter();
}
public boolean isCommitted()
{
return true;
}
public void reset()
{
}
public void resetBuffer()
{
}
public void setBufferSize(int size)
{
}
public void setCharacterEncoding(String charset)
{
}
public void setContentLength(int len)
{
}
public void setContentType(String type)
{
}
public void setLocale(Locale loc)
{
}
public Collection<String> getHeaderNames()
{
return Collections.emptyList();
}
public String getHeader(String arg0)
{
return null;
}
public Collection<String> getHeaders(String arg0)
{
return Collections.emptyList();
}
public int getStatus()
{
return 0;
}
};
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */
private static ServletOutputStream __nullOut = new ServletOutputStream()
{
public void write(int b) throws IOException
{
}
public void print(String s) throws IOException
{
}
public void println(String s) throws IOException
{
}
};
}
| [
"zyc@byshell.org"
] | zyc@byshell.org |
73caf8601508158dbff9f75a0e27bbc53a137c89 | 0974a9b9302ea02e42556ebf7ca2b3f9956eac70 | /app/src/main/java/com/example/doorstep/Login.java | 8c83118a57ab587498d0d55eccc40943fcb49cfb | [] | no_license | aochoa6/DoorStep_app | b4e0854fa3256eba03dce1836e6fb7cd23b6dae5 | 50af50288dbea2666efb84448af7db2d650db483 | refs/heads/master | 2023-04-11T03:41:34.217890 | 2021-04-24T23:58:41 | 2021-04-24T23:58:41 | 361,218,915 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,649 | java | package com.example.doorstep;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
public class Login extends AppCompatActivity {
private Button LogIn_Button;
private EditText LogIn_Email, LogIn_password;
private FirebaseAuth auth;
private static final String TAG = "EmailPassword";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Get Firebase auth instance
auth = FirebaseAuth.getInstance();
//set view now
setContentView(R.layout.login);
auth = FirebaseAuth.getInstance();
LogIn_Email = findViewById(R.id.email_edit);
LogIn_Email = findViewById(R.id.password_edit);
LogIn_Button = findViewById(R.id.login2Home);
//Get Firebase auth instance
auth = FirebaseAuth.getInstance();
LogIn_Button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//username
String email = LogIn_Email.getText().toString();
//password
String password = LogIn_password.getText().toString();
if(TextUtils.isEmpty(email)){
Toast.makeText(getApplicationContext(), "Enter your email address", Toast.LENGTH_SHORT).show();
return;
}
if(TextUtils.isEmpty(password)){
Toast.makeText(getApplicationContext(), "Enter your password", Toast.LENGTH_SHORT).show();
return;
}
//authenticate user
auth.signInWithEmailAndPassword(email,password)
.addOnCompleteListener(Login.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Log.d(TAG, "signInWithEmail:success");
FirebaseUser user = auth.getCurrentUser();
startActivity(new Intent(Login.this, Home.class));
finish();
} else {
// If sign in fails, display a message to the user.
Log.w(TAG, "signInWithEmail:failure", task.getException());
Toast.makeText(Login.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
}
});
}
});
}
public void NavigateSignUp(View v){
Intent inent = new Intent(this, SignUp.class);
startActivity(inent);
}
public void NavigateForgetPassword(View v){
Intent inent = new Intent(this, ResetPassword.class);
startActivity(inent);
}
}
| [
"43618794+aochoa6@users.noreply.github.com"
] | 43618794+aochoa6@users.noreply.github.com |
2d1ad0eeb598e4126c58e04480ea3811ebcb70bd | 1c7048e669ea4b57742dec55989469a49e61f131 | /projecta/projecta/src/main/java/com/example/projecta/config/StringOperation.java | 9b346244d6a938acc80a66fc65cab9c41c111793 | [] | no_license | wiolGit/repo | bd4e5d2efb6e0c9228dd3f04cc6f688220763cc6 | 503dd09d3fb1b9119cf163ad787274be6d256761 | refs/heads/main | 2023-05-31T14:37:03.197639 | 2021-06-16T08:23:56 | 2021-06-16T08:23:56 | 372,363,622 | 0 | 1 | null | 2021-06-16T08:11:46 | 2021-05-31T02:43:55 | Java | UTF-8 | Java | false | false | 618 | java | package com.example.projecta.config;
import org.springframework.stereotype.Component;
import com.google.common.base.CharMatcher;
@Component
public class StringOperation {
public String remoweLeadAndTrailChar(String str, char s1, char s2) {
String rob = removeLeadingChar(str, s1);
rob = removeTrailingChar(rob, s2);
return rob;
}
private String removeLeadingChar(String s, char sym) {
return CharMatcher.is(sym).trimLeadingFrom(s);
}
private String removeTrailingChar(String s, char sym) {
return CharMatcher.is(sym).trimTrailingFrom(s);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
7e58130160c02b4572654800dff010ea73d9cf6f | 7a3eaf874913296c0cedc251927b563a56899b20 | /GuessWhoAcumen/src/net/nrp/tasks/LoadImageTask.java | 09d560708b9f2d804794812555e9409104636b71 | [] | no_license | nphillips-github/GuessWhoAcumen_Master | 7cfb0eac01220b3ebdd3292981f04d81f539b998 | 59cecd3515a87941d7dd475d82204e2da59c8cdf | refs/heads/master | 2021-01-01T19:51:33.251505 | 2013-12-11T23:04:07 | 2013-12-11T23:04:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,513 | java | package net.nrp.tasks;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.util.Log;
import com.salesforce.androidsdk.rest.RestClient;
import net.nrp.interfaces.iAsyncTaskAction;
import java.io.InputStream;
import java.net.URL;
/**
* Created by mchin on 12/5/13.
*/
/*
This task is for individual image loading.
*/
public class LoadImageTask extends AsyncTask<String,Void,Integer> {
public RestClient rc;
public iAsyncTaskAction<Bitmap> handle;
public Bitmap passBack;
public LoadImageTask(RestClient client, iAsyncTaskAction<Bitmap> action)
{
rc = client;
handle = action;
}
@Override
public Integer doInBackground(String ... param)
{
int status = 0;
try
{
if(param != null && param.length > 0 && param[0] != "")
{
String fullLink = param[0] + "?oauth_token=" + rc.getAuthToken();
passBack = BitmapFactory.decodeStream((InputStream) new URL(fullLink).getContent());
}
}
catch (Exception e)
{
Log.d("LoadImageException", e.getLocalizedMessage());
status = 1;
}
return status;
}
@Override
protected void onPostExecute(Integer result)
{
super.onPostExecute(result);
if(result == 0 && passBack != null && handle != null)
{
handle.execute(passBack);
}
}
}
| [
"mchin@acumensolutions.com"
] | mchin@acumensolutions.com |
b66a236b1caa2e92b4d79aeeca5063d1bcb05572 | 70a0358697c877274c777817df92d54a73adb38b | /sdses-admin/src/main/java/io/sdses/modules/sys/entity/SysLogEntity.java | 1170c71314ea21bf75682ed747dde33af9b6819d | [] | no_license | DXXiang/renren_pure | e6ff38d904d7a2b981983bb0fb3326d202af3a62 | 10070628d30f85f2ad494262ee117dc314f88bcd | refs/heads/master | 2022-10-24T12:41:32.403544 | 2019-07-13T11:38:08 | 2019-07-13T11:38:08 | 192,865,847 | 6 | 2 | null | 2022-10-12T20:28:10 | 2019-06-20T06:52:50 | JavaScript | UTF-8 | Java | false | false | 2,867 | java | /**
* Copyright 2018 神思电子 http://www.sdses.com
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 io.sdses.modules.sys.entity;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 系统日志
*
* @author chenshun
* @email sunlightcs@gmail.com
* @date 2017-03-08 10:40:56
*/
@TableName("sys_log")
public class SysLogEntity implements Serializable {
private static final long serialVersionUID = 1L;
@TableId
private Long id;
//用户名
private String username;
//用户操作
private String operation;
//请求方法
private String method;
//请求参数
private String params;
//执行时长(毫秒)
private Long time;
//IP地址
private String ip;
//创建时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createDate;
/**
* 设置:
*/
public void setId(Long id) {
this.id = id;
}
/**
* 获取:
*/
public Long getId() {
return id;
}
/**
* 设置:用户名
*/
public void setUsername(String username) {
this.username = username;
}
/**
* 获取:用户名
*/
public String getUsername() {
return username;
}
/**
* 设置:用户操作
*/
public void setOperation(String operation) {
this.operation = operation;
}
/**
* 获取:用户操作
*/
public String getOperation() {
return operation;
}
/**
* 设置:请求方法
*/
public void setMethod(String method) {
this.method = method;
}
/**
* 获取:请求方法
*/
public String getMethod() {
return method;
}
/**
* 设置:请求参数
*/
public void setParams(String params) {
this.params = params;
}
/**
* 获取:请求参数
*/
public String getParams() {
return params;
}
/**
* 设置:IP地址
*/
public void setIp(String ip) {
this.ip = ip;
}
/**
* 获取:IP地址
*/
public String getIp() {
return ip;
}
/**
* 设置:创建时间
*/
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
/**
* 获取:创建时间
*/
public Date getCreateDate() {
return createDate;
}
public Long getTime() {
return time;
}
public void setTime(Long time) {
this.time = time;
}
}
| [
"286482796@outlook.com"
] | 286482796@outlook.com |
c5ea8c78dcdf3e70ed7f035657a5eaa30fb1b656 | 3f0945876e05456ab6ed26991548560cc77d76c3 | /src/CadastrarSolicitacoes.java | 7eb01a7c147611ab0d312f458a9f22a25866a286 | [] | no_license | WalmirMelo/SREE | 5babe231259e8ccb4354c2317880c79cee6bb4de | 6a5fea18876b6d08e6cd2fba8b54a5b40526ac9e | refs/heads/master | 2021-01-01T19:10:43.053018 | 2014-06-19T22:29:23 | 2014-06-19T22:29:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 29,909 | 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.
*/
/**
*
* @author TIC
*/
public class CadastrarSolicitacoes extends javax.swing.JFrame {
/**
* Creates new form CadastrarSolicitacoes
*/
public CadastrarSolicitacoes() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel3 = new javax.swing.JPanel();
jButton5 = new javax.swing.JButton();
jButton7 = new javax.swing.JButton();
jPanel4 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton11 = new javax.swing.JButton();
jButton12 = new javax.swing.JButton();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jFormattedTextField1 = new javax.swing.JFormattedTextField();
jFormattedTextField2 = new javax.swing.JFormattedTextField();
jLabel4 = new javax.swing.JLabel();
jFormattedTextField3 = new javax.swing.JFormattedTextField();
jButton8 = new javax.swing.JButton();
jPanel5 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
jTextField4 = new javax.swing.JTextField();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton13 = new javax.swing.JButton();
jButton14 = new javax.swing.JButton();
jLabel11 = new javax.swing.JLabel();
jFormattedTextField4 = new javax.swing.JFormattedTextField();
jFormattedTextField5 = new javax.swing.JFormattedTextField();
jPanel6 = new javax.swing.JPanel();
jButton9 = new javax.swing.JButton();
jButton10 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel3.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/document-icon.png"))); // NOI18N
jButton5.setText("Novo");
jButton7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/stop-icon.png"))); // NOI18N
jButton7.setText("Cancelar");
jButton7.setEnabled(false);
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton7)
.addContainerGap(59, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton5)
.addComponent(jButton7))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel4.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
jLabel1.setFont(new java.awt.Font("Segoe Print", 1, 14)); // NOI18N
jLabel1.setText("Equipamento");
jLabel2.setText("Equipamento:");
jLabel3.setText("Usuário:");
jTextField1.setEditable(false);
jTextField2.setEditable(false);
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/04-Save-icon.png"))); // NOI18N
jButton1.setText("Salvar");
jButton1.setEnabled(false);
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/trash-icon.png"))); // NOI18N
jButton2.setText("Limpar");
jButton2.setEnabled(false);
jButton11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Botoes_Site_5752_Knob_Add.png"))); // NOI18N
jButton12.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Botoes_Site_5752_Knob_Add.png"))); // NOI18N
jLabel9.setText("Data Retirada:");
jLabel10.setText("Hora Retirada:");
jFormattedTextField1.setEditable(false);
jFormattedTextField1.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter()));
jFormattedTextField2.setEditable(false);
jFormattedTextField2.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(java.text.DateFormat.getTimeInstance())));
jLabel4.setText("Hora Entrega:");
jFormattedTextField3.setEditable(false);
jFormattedTextField3.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(java.text.DateFormat.getTimeInstance())));
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel1)
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel4Layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField2)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton11, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton12, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel4Layout.createSequentialGroup()
.addComponent(jLabel9)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jFormattedTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(jLabel10))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jFormattedTextField2)
.addComponent(jFormattedTextField3)))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 33, Short.MAX_VALUE)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(jButton1))
.addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING))
.addContainerGap())
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jButton1)
.addGap(18, 18, 18)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel4Layout.createSequentialGroup()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton11)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel4Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton12)))
.addGap(18, 18, 18)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(jFormattedTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10)
.addComponent(jFormattedTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jFormattedTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4))
.addGap(0, 28, Short.MAX_VALUE))
);
jButton8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Botoes_5116_cross_48.png"))); // NOI18N
jButton8.setText("Sair");
jPanel5.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
jLabel5.setFont(new java.awt.Font("Segoe Print", 1, 14)); // NOI18N
jLabel5.setText("Sala");
jLabel6.setText("Sala:");
jLabel7.setText("Usuário:");
jLabel8.setText("Data:");
jTextField3.setEditable(false);
jTextField4.setEditable(false);
jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/04-Save-icon.png"))); // NOI18N
jButton3.setText("Salvar");
jButton3.setEnabled(false);
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/trash-icon.png"))); // NOI18N
jButton4.setText("Limpar");
jButton4.setEnabled(false);
jButton13.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Botoes_Site_5752_Knob_Add.png"))); // NOI18N
jButton14.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Botoes_Site_5752_Knob_Add.png"))); // NOI18N
jLabel11.setText("Hora:");
jFormattedTextField4.setEditable(false);
jFormattedTextField4.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(java.text.DateFormat.getTimeInstance())));
jFormattedTextField5.setEditable(false);
jFormattedTextField5.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(java.text.DateFormat.getTimeInstance())));
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel5)
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jFormattedTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTextField4))
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jLabel11)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jFormattedTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton13, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton14, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 46, Short.MAX_VALUE)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton3)
.addComponent(jButton4))
.addGap(33, 33, 33))
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jButton3)
.addGap(25, 25, 25)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup()
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jButton13))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jButton14))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(jFormattedTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel11)
.addComponent(jFormattedTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(0, 0, Short.MAX_VALUE))
);
jPanel6.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
jButton9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/document-icon.png"))); // NOI18N
jButton9.setText("Novo");
jButton10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/stop-icon.png"))); // NOI18N
jButton10.setText("Cancelar");
jButton10.setEnabled(false);
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton10)
.addContainerGap(35, Short.MAX_VALUE))
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton9)
.addComponent(jButton10))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(86, 86, 86)))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jButton8))
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton8))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(79, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton3ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(CadastrarSolicitacoes.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(CadastrarSolicitacoes.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(CadastrarSolicitacoes.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(CadastrarSolicitacoes.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new CadastrarSolicitacoes().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton10;
private javax.swing.JButton jButton11;
private javax.swing.JButton jButton12;
private javax.swing.JButton jButton13;
private javax.swing.JButton jButton14;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton7;
private javax.swing.JButton jButton8;
private javax.swing.JButton jButton9;
private javax.swing.JFormattedTextField jFormattedTextField1;
private javax.swing.JFormattedTextField jFormattedTextField2;
private javax.swing.JFormattedTextField jFormattedTextField3;
private javax.swing.JFormattedTextField jFormattedTextField4;
private javax.swing.JFormattedTextField jFormattedTextField5;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
// End of variables declaration//GEN-END:variables
}
| [
"TIC@192.168.1.130"
] | TIC@192.168.1.130 |
657a6d62c75b2cf8de093a06694d5ed600379860 | 9b825b16ebd79ab179148498da58c95827a56869 | /jse/src/oop01/syntax/No06_StaticSyntax.java | a6c2bdc400bffdd7028a540245ef7ac4b0b934c7 | [] | no_license | jwjang81/jse-2 | 809990d02f170a75eb63376e3231a06a74d84c11 | c73c499c215c96449bef4cc91cd4d25ab76599db | refs/heads/master | 2020-12-30T22:44:17.067718 | 2015-05-21T02:57:38 | 2015-05-21T02:57:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 881 | java | package oop01.syntax;
/*
Date :2015.5.20
Author : 김하융
Desc: Static 문법에 관하여
* */
/*
static 변수
- 정적변수
- 클래스가 JVM 상으로 로딩시에 메모리 할당을 한다.
- 해시코드(Hash Code) 의 출력
- 객체의 해시코드는 JVM 의 해시알고리즘에 의해 패키지명과
클래스명이 조합되어 해시코드가 산출된다.
- String 은 객체변수의 값이 같을 경우 즉 같은 문자열을 가지고 있다면,
해시코드를 공유한다.
String str1= "헐크";
String str2= "헐크";
str1.hashCode() = str2.hashCode(); //true
* */
/*
static 사용을 고려해야 하는 상황
- 멤버변수 중 모든 인스턴스에 공통적으로 사용해야 하는 것에 붙여 사용.
- 인스턴스 변수를 사용하지 않고, 클래스에서 바로 접근하려 할때.
* */
public class No06_StaticSyntax {
}
| [
"onsoftel@hanmail.net"
] | onsoftel@hanmail.net |
b787e9eba258536e229a773a8fd46d4764a89de8 | 1e6a6d4a9f4a710b2b68d07ab0048b7856056b8e | /src/MedicineTest.java | 0c9f08e5ad3c2b0f5b3c7c4e521479b1875d23f0 | [] | no_license | gabrivera/TextAdventure | 5aa40c54ceadd92f6c5b118956480325c629c951 | fc37e74b60ed16fe9f07d982556bdefdc8a45e63 | refs/heads/master | 2021-06-01T09:48:58.691223 | 2016-07-23T13:27:29 | 2016-07-23T13:27:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 564 | java | import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
public class MedicineTest {
private Medicine bandage;
@Before
public void setUp() throws Exception {
bandage = new Medicine("bandage", 10, "a medical wrap soaked in alcohol");
}
@Test
public void testGetName() {
assertEquals("bandage", bandage.getName());
}
@Test
public void testGetDescription() {
assertEquals("a medical wrap soaked in alcohol", bandage.getDescription());
}
@Test
public void testGetValue() {
assertEquals(10, bandage.getValue());
}
} | [
"gabrielrivera@Gabriels-MacBook-Pro.local"
] | gabrielrivera@Gabriels-MacBook-Pro.local |
dee60550c5668dff8451186cc13f570df910f058 | b82b9bd2dab8253fbbe2cbe256f033ac65af644a | /src/main/java/com/xpanxion/automation/dummyapp/security/SecurityConfig.java | bdfa6a04d287d8fc4c503995420fd780abe3b506 | [] | no_license | apofahl/AutomationTraining | 1cb71385bcda5c6e934a947705786d64090a98ed | 73bf5cbad30bf97b2bb0444c27ddd288cdc8195c | refs/heads/master | 2021-01-10T13:52:39.335224 | 2016-05-05T20:45:38 | 2016-05-05T20:45:38 | 54,155,381 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,917 | java | package com.xpanxion.automation.dummyapp.security;
import org.springframework.beans.factory.annotation.Autowired;
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.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import com.xpanxion.automation.dummyapp.service.UserDetailService;
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private UserDetailService userDetailService;
@Autowired
private SuccessHandler successHandler;
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
// .antMatchers("/", "/stylists", "/salons").permitAll()
.antMatchers("/", "/static/**").permitAll()
.anyRequest().authenticated()
.and()
.authorizeRequests()
.antMatchers("/stylists/**", "/salons/**").hasRole("Client")
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login").successHandler(successHandler)
.permitAll()
.and()
.logout()
.logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
// .logoutSuccessUrl("/logout")
.permitAll();
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
.userDetailsService(userDetailService);
}
}
| [
"apofahl@xpanxion.com"
] | apofahl@xpanxion.com |
994fdeb73237b5d324ea9516a97b6479d07a4764 | b72c55c06f721399ef52aa21eb82036daa6825d2 | /src/bases/Mathx.java | 603f61cb7ebae090b8741b602eb1ef6cf11880cd | [] | no_license | snowsiechau/ci-chaunm-hw | 12f7253b6664fb2a89f52a34b328678d708abfc2 | 4f1cd444f0145b1db0606bab77b3c1448983d292 | refs/heads/master | 2020-12-02T08:12:33.400370 | 2017-07-31T16:28:21 | 2017-07-31T16:28:21 | 96,787,103 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 372 | java | package bases;
/**
* Created by SNOW on 7/17/2017.
*/
public class Mathx {
public static float clamp(float value, float min, float max){
if (value > max) return max;
if (value < min) return min;
return value;
}
public static boolean inRange(float value, float min, float max){
return value >= min && value <= max;
}
}
| [
"chautho95@gmail.com"
] | chautho95@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.