blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4b80c693e2762fcb60904b21f88fb9780bb21848 | dcf39795ab34a32a755f41d0f5c9bea66b856380 | /src/main/java/chat/gui/ChatFrame.java | abb3868e5e1cbe7b61705d3febb3f247d0f142a1 | [] | no_license | AlexeyElizarov/gb_s03_e06 | d7d12c951698436a5bcb485f8260bd587d74fc63 | ce26706d7a5e0b4d3f5917c853ca0deaad5f7458 | refs/heads/master | 2023-02-22T01:19:04.339736 | 2021-01-27T07:39:39 | 2021-01-27T07:39:39 | 333,341,080 | 0 | 0 | null | 2021-01-27T07:42:45 | 2021-01-27T07:38:45 | Java | UTF-8 | Java | false | false | 1,578 | java | package chat.gui;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.util.function.Consumer;
public class ChatFrame extends JFrame {
private StringBuilder stringBuilder;
private TextArea textArea;
private ActionListener submitListener;
public ChatFrame(Consumer<String> transmitter) {
stringBuilder = new StringBuilder();
setTitle("Chat Frame v1.0.0");
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setBounds(new Rectangle(150, 150, 400, 700));
setLayout(new BorderLayout());
textArea = new TextArea();
JPanel top = new JPanel();
top.setLayout(new BorderLayout());
top.add(textArea, BorderLayout.CENTER);
add(top, BorderLayout.CENTER);
TextField textField = new TextField();
JButton jButton = new JButton("Submit");
JPanel bottom = new JPanel();
bottom.setLayout(new BorderLayout());
bottom.add(textField, BorderLayout.CENTER);
bottom.add(jButton, BorderLayout.EAST);
add(bottom, BorderLayout.SOUTH);
submitListener = new SubmitActionListener(textField, transmitter);
jButton.addActionListener(submitListener);
textField.addActionListener(submitListener);
setVisible(true);
}
public void append(String message) {
stringBuilder.append(textArea.getText())
.append("\n")
.append(message);
textArea.setText(stringBuilder.toString());
stringBuilder.setLength(0);
}
}
| [
"haakee@gmail.com"
] | haakee@gmail.com |
91323178419222735932b8cb324bfeb81d8fcd38 | f82bcfb9afe11e2ebad32054c887a2eb524ad006 | /dentaku-metadata-service/src/java/org/omg/java/cwm/foundation/datatypes/EnumerationLiteralClass.java | 798697be226fc4f0299bd4327305b759d6a48d40 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | codehaus/dentaku | 8655e76c29e207156f175fd61360fe270bc528d7 | c916d029069b84ee444d3606fa28db79cf5a6ba8 | refs/heads/master | 2023-07-20T00:36:04.244855 | 2006-03-18T06:43:18 | 2006-03-18T06:43:18 | 36,364,422 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 536 | java | /*
* Java(TM) OLAP Interface
*/
package org.omg.java.cwm.foundation.datatypes;
public interface EnumerationLiteralClass
extends javax.jmi.reflect.RefClass {
public org.omg.java.cwm.foundation.datatypes.EnumerationLiteral createEnumerationLiteral( java.lang.String _name, org.omg.java.cwm.objectmodel.core.VisibilityKind _visibility, org.omg.java.cwm.objectmodel.core.Expression _value )
throws javax.jmi.reflect.JmiException;
public org.omg.java.cwm.foundation.datatypes.EnumerationLiteral createEnumerationLiteral();
}
| [
"topping@51e4faab-3f0f-0410-8d7f-865566f634a9"
] | topping@51e4faab-3f0f-0410-8d7f-865566f634a9 |
aac000b5245099125539ddcb2472326354a2c0f3 | 8f465362e8b38000200e6ca2686fd7f55a4f451f | /src/main/java/org/efix/message/field/TimeUnit.java | b9b23afef7a0d57c1e95277c37f8834d2ef1cd62 | [
"Apache-2.0"
] | permissive | weinjsuny/efix | fd4f88cd1e8ff9d7fa4876c00f48d643c7cae897 | 80d2751dc5d7d37afb36844d8c0375af7faadcdb | refs/heads/master | 2022-12-27T17:34:03.120089 | 2020-10-20T14:35:34 | 2020-10-20T14:35:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 659 | java | package org.efix.message.field;
import org.efix.util.ByteSequence;
import org.efix.util.ByteSequenceWrapper;
public class TimeUnit {
public static final ByteSequence DAY = ByteSequenceWrapper.of("D");
public static final ByteSequence HOUR = ByteSequenceWrapper.of("H");
public static final ByteSequence SECOND = ByteSequenceWrapper.of("S");
public static final ByteSequence MONTH = ByteSequenceWrapper.of("Mo");
public static final ByteSequence WEEK = ByteSequenceWrapper.of("Wk");
public static final ByteSequence YEAR = ByteSequenceWrapper.of("Yr");
public static final ByteSequence MINUTE = ByteSequenceWrapper.of("Min");
} | [
"mon5ter@list.ru"
] | mon5ter@list.ru |
268e2a2006ab7f6ff7ebc6a26fd6712d9d750ef2 | e71f4b99dac0899e187c7fdf43bf755e2a73d422 | /app/src/main/java/com/tosin/healthee/MainActivity.java | ad57e6f76ce4d4bfe470b3e73757dce90f252dc8 | [] | no_license | SudoSmart/BasicWebViewApp | c1689b54163a4af89554cc5bab248cf0c1b5af24 | 1fb0d2a529c6fed2a6e563963d9c8e2121432fda | refs/heads/master | 2020-09-11T22:27:26.938762 | 2019-11-03T01:28:37 | 2019-11-03T01:28:37 | 222,210,905 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,280 | java | package com.tosin.healthee;
import android.os.Bundle;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import android.view.View;
import androidx.navigation.NavController;
import androidx.navigation.Navigation;
import androidx.navigation.ui.AppBarConfiguration;
import androidx.navigation.ui.NavigationUI;
import com.google.android.material.navigation.NavigationView;
import com.tosin.healthee.ui.IOActivity;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.Menu;
import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
private AppBarConfiguration mAppBarConfiguration;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "In progress", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
DrawerLayout drawer = findViewById(R.id.drawer_layout);
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
mAppBarConfiguration = new AppBarConfiguration.Builder(
R.id.nav_home, R.id.nav_gallery, R.id.nav_slideshow,
R.id.nav_tools, R.id.nav_share, R.id.nav_send)
.setDrawerLayout(drawer)
.build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
NavigationUI.setupWithNavController(navigationView, navController);
String[] maintitle ={
"Mushroom-Quinoa Burger",
"Tofu Pad Thai",
"10 Things to Know About Anxiety",
"10 health benefits of daily yoga practice" ,
"Zucchanoush",
"Creamy Roasted Squash Puree",
"9 Ways Practicing Yoga Benefits Your Health and Well-Being",
"What Is a Mendiant? Everything You Need to Know About the Chocolate Treat" ,
};
String[] subtitle ={
"2 days ago",
"2 days ago",
"2 days ago",
"2 days ago",
"2 days ago",
"2 days ago",
"2 days ago",
"2 days ago"
};
Integer[] imgid={
R.drawable.vegan1,R.drawable.vegan2,
R.drawable.mentalhealth,
R.drawable.yoga1,R.drawable.vegan3,
R.drawable.vegan4,
R.drawable.yoga2,
R.drawable.vegan5
};
ListView mainListView = (ListView)findViewById(R.id.mainListView);
customListAdapter adapter = new customListAdapter(this , maintitle , subtitle , imgid);
mainListView.setAdapter((adapter));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onSupportNavigateUp() {
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
return NavigationUI.navigateUp(navController, mAppBarConfiguration)
|| super.onSupportNavigateUp();
}
}
| [
"helloshivampsd@gmail.com"
] | helloshivampsd@gmail.com |
caef4bd3b4dfbd08e12e22dc5e4dcaacaee29bb1 | 5ed10e8dcd8d03358b483413a099c682708e6e98 | /gaedo-guice/src/test/java/com/dooapp/gaedo/guice/GaedoModuleTest.java | d824bcaeb50fa49a89b6db1aece0308be38d9bad | [] | no_license | alexblanquart/gaedo | f5efe46fae06ccabf9f1f289a6224fd20fe0dad8 | e332f935163ee6cf37e48e755957178513b590a8 | refs/heads/master | 2021-01-15T15:57:25.121006 | 2014-07-04T13:39:50 | 2014-07-04T13:39:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 580 | java | package com.dooapp.gaedo.guice;
import org.hamcrest.core.IsNull;
import org.junit.Assert;
import org.junit.Test;
import com.dooapp.gaedo.finders.dynamic.ServiceGenerator;
import com.google.inject.Guice;
import com.google.inject.Injector;
/**
* Simple test verifying all things works
* @author ndx
*
*/
public class GaedoModuleTest {
@Test
public void testInjector() {
Injector injector = Guice.createInjector(new GaedoModule());
ServiceGenerator g = (ServiceGenerator) injector.getInstance(ServiceGenerator.class);
Assert.assertThat(g, IsNull.notNullValue());
}
}
| [
"nicolas.delsaux@gmail.com"
] | nicolas.delsaux@gmail.com |
ed24132bd2865a1123740371ebd50355b50bcd28 | 6da06ab5421809416c3023bbde7d380a25b019bb | /DataStructures/src/tree/BSTInt.java | 51825bff37fd7a7f693c78b04da0e6378d0a563f | [] | no_license | chef-bowyer/DataStructures | b5f88fb95f424607de54e2ea5af9295f4c443251 | 6c7dd6ca8c77c58745d9c87bff30928d36f257a9 | refs/heads/master | 2023-01-20T12:22:55.662832 | 2014-11-09T11:12:56 | 2014-11-09T11:12:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 875 | java | package tree;
public class BSTInt {
private BSTIntNode root;
int size;
public BSTInt() {
root = null;
size = 0;
}
public BSTIntNode search(int target) {
BSTIntNode ptr=root;
while (ptr != null) {
if (target == ptr.data) {
return ptr;
}
if (target < ptr.data) {
ptr = ptr.left;
} else {
ptr = ptr.right;
}
}
return null;
}
public void insert(int target) {
BSTIntNode ptr=root, prev=null;
boolean left=false;
while (ptr != null) {
if (target == ptr.data) {
throw new IllegalArgumentException();
}
prev = ptr;
if (target < ptr.data) {
ptr = ptr.left; left = true;
} else {
ptr = ptr.right;left = false;
}
}
BSTIntNode temp = new BSTIntNode(target);
size++;
if (root == null) {
root = temp;
return;
}
if (left) { prev.left = temp; }
else { prev.right = temp; }
}
}
| [
"mattcbow@gmail.com"
] | mattcbow@gmail.com |
7e2884efaf7401648b7e57dd8714233bc080d0b9 | 09a5ac07a5684563ef0b92868c6427efa53e17e0 | /src/main/java/neuralnerdwork/math/ScaledMatrix.java | c0085b1c97f44cab1d995325f03e1e839b72238c | [
"Apache-2.0"
] | permissive | NeuralNerdWork/NeuralNerdWork | 1ccb8c230f56b0b4821a4d7c9a2f87fd7db73200 | 65ec4be419f07b52cc36e1ca88f1d04829ad02da | refs/heads/master | 2022-11-23T17:40:05.453722 | 2020-10-14T02:41:18 | 2020-10-14T02:41:18 | 246,424,415 | 0 | 2 | Apache-2.0 | 2022-11-16T08:58:49 | 2020-03-10T22:48:48 | Java | UTF-8 | Java | false | false | 1,924 | java | package neuralnerdwork.math;
import org.ejml.data.DMatrix;
import org.ejml.data.DMatrixRMaj;
import org.ejml.data.DMatrixSparseCSC;
import org.ejml.dense.row.CommonOps_DDRM;
import org.ejml.sparse.csc.CommonOps_DSCC;
public record ScaledMatrix(ScalarExpression scalarExpression, MatrixExpression matrixExpression) implements MatrixExpression {
public ScaledMatrix(double value, MatrixExpression matrixExpression) {
this(new ConstantScalar(value), matrixExpression);
}
@Override
public int rows() {
return matrixExpression.rows();
}
@Override
public int cols() {
return matrixExpression.cols();
}
@Override
public boolean isZero() {
return scalarExpression.isZero() || matrixExpression.isZero();
}
@Override
public DMatrix evaluate(Model.ParameterBindings bindings) {
final DMatrix matrix = matrixExpression.evaluate(bindings);
final double value = scalarExpression.evaluate(bindings);
if (matrix instanceof DMatrixRMaj m) {
DMatrixRMaj retVal = m.createLike();
CommonOps_DDRM.scale(value, m, retVal);
return retVal;
} else if (matrix instanceof DMatrixSparseCSC m) {
DMatrixSparseCSC retVal = m.createLike();
CommonOps_DSCC.scale(value, m, retVal);
return retVal;
} else {
throw new UnsupportedOperationException("Can't scale matrix type " + matrix.getClass());
}
}
@Override
public DMatrix computePartialDerivative(Model.ParameterBindings bindings, int variable) {
return MatrixSum.sum(
new ScaledMatrix(scalarExpression.computePartialDerivative(bindings, variable), matrixExpression),
new ScaledMatrix(scalarExpression, new DMatrixExpression(matrixExpression.computePartialDerivative(bindings, variable)))
).evaluate(bindings);
}
}
| [
"max.barkley@gmail.com"
] | max.barkley@gmail.com |
ce2e1a577392a9871d4ed74c42a9d98ecb340e62 | d71f24d0dbc7e8ba41ab6341657d0eecbf0a5d76 | /src/main/java/Business/Organization/InventoryOrganization.java | 96dc86cb1e8f4570fa59f53a167c33d5eccaeb15 | [] | no_license | pranavmujumdar/UrbanManagementSystem | e8a597916b9002d78f86a75810f3afd65d95351a | be4185f2500f9dccc0210a78891f7aa0f50b6ecf | refs/heads/master | 2022-12-31T06:39:17.108709 | 2020-10-17T15:20:09 | 2020-10-17T15:20:09 | 304,691,093 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 678 | 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 Business.Organization;
import Business.Role.InventoryMgr;
import Business.Role.Role;
import java.util.ArrayList;
/**
*
* @author pranav
*/
public class InventoryOrganization extends Organization{
public InventoryOrganization() {
super(Organization.Type.Inventory.getValue());
}
@Override
public ArrayList<Role> getSupportedRole() {
ArrayList<Role> roles = new ArrayList();
roles.add(new InventoryMgr());
return roles;
}
}
| [
"psmujumdar@gmail.com"
] | psmujumdar@gmail.com |
99fe892d798ae3121972d9053ca739275a270af9 | 91f7dc07b2c0d07cf02ecee54b8548d42fe2f720 | /sources/external/scy-com-ext/ext-impl/src/com/liferay/portlet/messageboards/action/LinkAction.java | 319b7b172b76f1d666cb16432fb3fda9ce189577 | [] | no_license | yattias/scy | 8996a485de7dfef22ac9ae69005cfb12be91dbc3 | e80421c7457e5ba27874abeef06668196ed8125a | refs/heads/master | 2021-01-10T01:15:04.267584 | 2013-04-03T09:32:50 | 2013-04-03T09:32:50 | 36,696,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,504 | java | package com.liferay.portlet.messageboards.action;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletConfig;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.liferay.portal.kernel.servlet.SessionErrors;
import com.liferay.portal.kernel.util.Constants;
import com.liferay.portal.security.auth.PrincipalException;
import com.liferay.portal.service.ClassNameLocalServiceUtil;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.service.ServiceContextFactory;
import com.liferay.portal.struts.PortletAction;
import com.liferay.portal.util.WebKeys;
import com.liferay.portlet.bookmarks.EntryURLException;
import com.liferay.portlet.bookmarks.NoSuchEntryException;
import com.liferay.portlet.bookmarks.NoSuchFolderException;
import com.liferay.portlet.bookmarks.model.BookmarksEntry;
import com.liferay.portlet.journal.model.JournalArticle;
import com.liferay.portlet.messageboards.model.MBMessage;
import com.liferay.portlet.messageboards.model.MBMessageDisplay;
import com.liferay.portlet.messageboards.service.MBMessageLocalServiceUtil;
import com.liferay.portlet.tags.TagsEntryException;
import com.liferay.util.LinkToolUtil;
/**
* Extern-Link action for message board portlet. Add extern links from a chosen
* start resource to an entered url. It is fired after pressing the taglib ui
* add_link. If the user chose callByRefence or let the radio button empty an
* new bookmark entry will create. A new link from viewed resource to created
* where created and a new link from created bookmark. If user chose callByValue
* the content from entered url will be save from stream as new webcontent and
* also links between the resource would be create.
*
* @author daniel
*
*/
public class LinkAction extends PortletAction {
public static final String NL = System.getProperty("line.separator");
public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, ActionRequest req, ActionResponse res) throws Exception {
Long entryId = Long.valueOf(req.getParameter("entryId"));
String redirect = req.getParameter("redirect");
String cmd = req.getParameter(Constants.CMD);
String radio;
if (req.getParameter("saveAsRadio") == null) {
radio = "bookmark";
} else {
radio = req.getParameter("saveAsRadio");
}
LinkToolUtil util = new LinkToolUtil();
MBMessage mb = MBMessageLocalServiceUtil.getMBMessage(entryId);
long threadId = mb.getThread().getThreadId();
MBMessageDisplay entry;
try {
entry = MBMessageLocalServiceUtil.getMessageDisplay(entryId, Long.toString(threadId));
ServiceContext serviceContext = ServiceContextFactory.getInstance(MBMessage.class.getName(), req);
if (cmd == null) {
req.setAttribute(WebKeys.MESSAGE_BOARDS_MESSAGE, entry);
req.setAttribute("redirect", redirect);
// set Forward
setForward(req, "portlet.message_boards.view_link");
return;
} else if (cmd.equals("extern") && radio.equals("bookmark")) {
Long linkedResourceId = util.updateEntry(req, serviceContext);
String classNameIdBookmark = String.valueOf(ClassNameLocalServiceUtil.getClassNameId(BookmarksEntry.class.getName()));
String classNameIdMessage = String.valueOf(ClassNameLocalServiceUtil.getClassNameId(MBMessage.class.getName()));
// add link for blog
util.addLink(entryId.toString(), linkedResourceId.toString(), classNameIdBookmark, serviceContext);
// add link for new bookmark
util.addLink(linkedResourceId.toString(), entryId.toString(), classNameIdMessage, serviceContext);
res.sendRedirect(redirect);
} else if (cmd.equals("extern") && radio.equals("copy")) {
JournalArticle ja = util.saveCopyFromUrl(req, serviceContext);
Long linkedResourceId = ja.getResourcePrimKey();
String classNameIdJournalArticle = String.valueOf(ClassNameLocalServiceUtil.getClassNameId(JournalArticle.class.getName()));
String classNameIdMessage = String.valueOf(ClassNameLocalServiceUtil.getClassNameId(MBMessage.class.getName()));
// add link for blog
util.addLink(entryId.toString(), linkedResourceId.toString(), classNameIdJournalArticle, serviceContext);
// add link for new bookmark
util.addLink(linkedResourceId.toString(), entryId.toString(), classNameIdMessage, serviceContext);
res.sendRedirect(redirect);
}
res.sendRedirect(redirect);
} catch (Exception e) {
if (e instanceof NoSuchEntryException || e instanceof PrincipalException) {
SessionErrors.add(req, e.getClass().getName());
setForward(req, "portlet.bookmarks.error");
} else if (e instanceof EntryURLException || e instanceof NoSuchFolderException) {
SessionErrors.add(req, e.getClass().getName());
setForward(req, "portlet.message_boards.view_link");
} else if (e instanceof TagsEntryException) {
SessionErrors.add(req, e.getClass().getName(), e);
} else {
throw e;
}
}
}
public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, RenderRequest renderRequest, RenderResponse renderResponse)
throws Exception {
return mapping.findForward(getForward(renderRequest, "portlet.message_boards.view_link"));
}
}
| [
"mueller.daniel.1981@b2e416e9-8f50-0410-b9aa-47b31ee1ff64"
] | mueller.daniel.1981@b2e416e9-8f50-0410-b9aa-47b31ee1ff64 |
e68e5a0123205fef6bed305a25a3ad3c1bcfcd7e | 57412d953cda47551af5c4941c7e5247e8ee93a3 | /src/main/java/com/example/batch/repository/UtentiRepository.java | 5c9805fd8fd5c14ecbfd5f2a779cca08e53fa6fd | [] | no_license | Salvatore-Di-Costanzo/ProvaBatch | 451b8422f05dfed498f872f166768150665c8550 | f55087acf87e27d236eea4828f2c89c760ffb5a8 | refs/heads/master | 2023-06-05T09:13:10.782439 | 2021-06-22T13:24:53 | 2021-06-22T13:24:53 | 378,972,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 367 | java | package com.example.batch.repository;
import com.example.batch.model.Utenti;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface UtentiRepository extends JpaRepository<Utenti,Integer> {
List<Utenti> findAll();
Utenti getUtentiById(int id);
}
| [
"ForestadiconiferE01!"
] | ForestadiconiferE01! |
3a4cd4cb75936a874f47eb9024c2b135d1425e90 | 1e6d2eb107d6445f58f420a33f348454baf9cc28 | /app/src/main/java/com/example/secondlifetesting/MyAccountFragment.java | f5729a2902a6b036641bcad7cc8690afbdfbd10a | [] | no_license | vaishnavimantri/E2_4_SecondLife | 4213e79cb1e0e8752346511b6f508ceefc191f14 | 8591b64e130d88e0c8651cdf65801672b4b46ba7 | refs/heads/master | 2023-08-24T04:54:57.077005 | 2021-10-26T17:26:58 | 2021-10-26T17:26:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 900 | java | package com.example.secondlifetesting;
import android.database.Cursor;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.secondlifetesting.DBHelper;
import com.example.secondlifetesting.LoginActivity;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatCallback;
import androidx.fragment.app.Fragment;
public class MyAccountFragment extends Fragment {
private TextView emailtext, phonetext;
String emailid1, phone;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view= inflater.inflate(R.layout.fragment_my_account, container, false);
return view;
}
} | [
"vaishnavi.mantri18@siesgst.ac.in"
] | vaishnavi.mantri18@siesgst.ac.in |
c469b28fba47baca0a7241ff54ed90756ad2d80f | 9e339fd21ec8f5a94691e3ba9fbc946bd6556969 | /app/src/main/java/com/technextassignment/view_models/MainActivityViewModel.java | 04b3044c0858c7e64b410d1b9d7a3180df5c0fab | [] | no_license | sumonece15/TechNext-Assignment | 592c944de819c5650e62728420ecbd38e4b30e78 | aad10af524ec92f2f5ef5fd638a25d4d1f4c3617 | refs/heads/master | 2023-04-01T11:13:14.692152 | 2021-04-12T15:57:55 | 2021-04-12T15:57:55 | 357,254,021 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,111 | java | package com.technextassignment.view_models;
import android.app.Application;
import android.content.Context;
import android.util.Log;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.databinding.ObservableInt;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import com.google.gson.Gson;
import com.technextassignment.R;
import com.technextassignment.adapters.BlogAdapter;
import com.technextassignment.api.RetrofitClient;
import com.technextassignment.data.entity.Blog;
import com.technextassignment.data.entity.Category;
import com.technextassignment.data.helper.DbLoaderInterface;
import com.technextassignment.data.loader.BlogsLoader;
import com.technextassignment.data.loader.CategoryLoader;
import com.technextassignment.models.ServerResponse;
import com.technextassignment.repository.BlogRepository;
import java.util.List;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import static com.technextassignment.data.helper.DaoHelper.FETCH_ALL;
public class MainActivityViewModel extends AndroidViewModel {
public MutableLiveData<Blog> selected;
private BlogAdapter adapter;
private BlogRepository repository;
private MutableLiveData<List<Blog>> dataList = new MutableLiveData<>();
private MutableLiveData<List<Category>> categoryDataList = new MutableLiveData<>();
public ObservableInt loading;
public ObservableInt showEmpty;
public Context mContext;
public MainActivityViewModel(@NonNull Application application) {
super(application);
mContext = application;
repository = new BlogRepository(application);
selected = new MutableLiveData<>();
adapter = new BlogAdapter(R.layout.item_blog, this);
loading = new ObservableInt(View.GONE);
showEmpty = new ObservableInt(View.GONE);
}
public void setBlogsInAdapter(List<Blog> blogs) {
this.adapter.setBlogss(blogs);
this.adapter.notifyDataSetChanged();
}
public BlogAdapter getAdapter() {
return adapter;
}
public MutableLiveData<Blog> getSelected() {
return selected;
}
public void onItemClick(Integer index) {
Blog db = getBlogAt(index);
selected.setValue(db);
}
public Blog getBlogAt(Integer index) {
if (dataList.getValue() != null &&
index != null &&
dataList.getValue().size() > index) {
return dataList.getValue().get(index);
}
return null;
}
public void fetchDataFromServer(){
RetrofitClient.getClient().getBlogData().enqueue(new Callback<ServerResponse>() {
@Override
public void onResponse(Call<ServerResponse> call, Response<ServerResponse> response) {
Log.e("TAG", "response 33: "+new Gson().toJson(response.body()) );
insert(response.body().getBlogs());
getAllBlogsFromDb();
}
@Override
public void onFailure(Call<ServerResponse> call, Throwable t) {
}
});
}
// Database function START
public void insert(List<Blog> blogs) {
repository.insert(blogs);
}
public void update(Blog blog) {
repository.update(blog);
}
public void delete(Blog blog) {
repository.delete(blog);
}
public void deleteAllBlogs() {
repository.deleteAllBlogs();
}
public MutableLiveData<List<Blog>> getAllBlogs() {
return dataList;
}
public void getAllBlogsFromDb() {
BlogsLoader loader = new BlogsLoader(mContext);
loader.setDbLoaderInterface(new DbLoaderInterface() {
@Override
public void onFinished(Object object) {
List<Blog> blogs = (List<Blog>) object;
dataList.setValue(blogs);
Log.d("BlogData",new Gson().toJson(blogs));
}
});
loader.execute(FETCH_ALL);
}
// Database Function END
}
| [
"sumonece15@gmail.com"
] | sumonece15@gmail.com |
cad99c56dc96c79cd14ceacce8f5330f048640f1 | 104ce512995362162045498c8abce35f105bb40e | /fc/src/main/java/com/dxl/fc/model/WorkRecord.java | 4afe79d60b695f9f47f7e367bdd7ac671604d936 | [
"Apache-2.0"
] | permissive | Duan-You/Java | 0d40c185520cbf7881f1e8a1c98151f5efdf5765 | 63cffd71c9a9b6dcf03bae16099469899b612ec8 | refs/heads/main | 2023-08-26T09:09:09.147007 | 2021-09-16T01:47:06 | 2021-09-16T01:47:06 | 306,904,199 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 959 | java | package com.dxl.fc.model;
public class WorkRecord {
private Integer id;
private String status;
private String score;
private Integer workId;
private Integer studentId;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public String getScore() {
return score;
}
public void setScore(String score) {
this.score = score == null ? null : score.trim();
}
public Integer getWorkId() {
return workId;
}
public void setWorkId(Integer workId) {
this.workId = workId;
}
public Integer getStudentId() {
return studentId;
}
public void setStudentId(Integer studentId) {
this.studentId = studentId;
}
} | [
"1634995987@qq.com"
] | 1634995987@qq.com |
23de9d6716e83a46d81a548334d4ad0a9bd7cad8 | 1575d3acf628563b48ecb6ec85bf76e55c271a9e | /app/src/androidTest/java/org/nicomda/clashchestcalculator/ApplicationTest.java | fc0832f1d84077313b2188d5e40c75e8740a9f46 | [] | no_license | nicomda/Clash_Chest_Calculator | 49c366602c07e20f9573806d8c9e9b4b73c7ae3a | 90773acf741bde25c47d9053fc2129dc472263d5 | refs/heads/master | 2021-01-11T07:50:32.748304 | 2016-10-11T03:07:47 | 2016-10-11T03:07:47 | 54,741,771 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | package org.nicomda.clashchestcalculator;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"nicomda@hotmail.com"
] | nicomda@hotmail.com |
a5335ee438d96ead900b675f0c04e585f50911d7 | 9f81b06be9b34366271c6ac26e7d31e0eec85e0c | /src/test/java/com/technicalassignment/urlshortener/service/UrlShortenerServiceTest.java | 3a94cfc7f03cb5ea9c3e5bcc6193077d1a02e076 | [] | no_license | kullenius/url-shortener | 0a3212ab3fa6a5412dbfa15328afde0d98f4540f | f204a54e155f43a2b6268e2d081f54552cc7085c | refs/heads/master | 2022-12-27T13:08:59.686395 | 2020-10-12T06:30:13 | 2020-10-12T06:30:13 | 302,846,065 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | java | package com.technicalassignment.urlshortener.service;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class UrlShortenerServiceTest {
@Test
void createUrl() {
}
@Test
void redirectToOrgUrl() {
}
} | [
"rebecca.kullenius@evry.com"
] | rebecca.kullenius@evry.com |
46a7597a3609b2c8f88afa5bf838d0e4d36021db | 936074e6bc5ba4e8aff13a23688a11d57f10ba30 | /loginregister/src/main/java/com/sam/loginregister/repositories/UserRepository.java | b3d2570f963df541ea1867eb5d84ba043ed620a1 | [] | no_license | sammymengistu/Java | 8420bb66424f533c15fdadcff465bb1721d59ffd | a68ac5c1a44a4e2fa334c415a51f4e59628937d0 | refs/heads/master | 2021-04-28T07:31:37.627983 | 2018-02-20T16:48:55 | 2018-02-20T16:48:55 | 122,226,086 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 494 | java | package com.sam.loginregister.repositories;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import com.sam.loginregister.models.User;
@Repository
public interface UserRepository extends CrudRepository<User, Long> {
User findByEmail(String email);
@Query(value="SELECT COUNT(*) FROM users_roles ur WHERE ur.role_id = 2", nativeQuery=true)
int getCountOfAdminRoleUser();
}
| [
"samuelqa7@gmail.com"
] | samuelqa7@gmail.com |
1331cd8abd25ac2fc7c05c48f5caefc3efb7242b | 4da9097315831c8639a8491e881ec97fdf74c603 | /src/StockIT-v2-release_source_from_JADX/sources/com/google/android/gms/internal/ads/zzblq.java | bd7f339429f40c778a60e6a425327fcd1578554a | [
"Apache-2.0"
] | permissive | atul-vyshnav/2021_IBM_Code_Challenge_StockIT | 5c3c11af285cf6f032b7c207e457f4c9a5b0c7e1 | 25c26a4cc59a3f3e575f617b59acc202ee6ee48a | refs/heads/main | 2023-08-11T06:17:05.659651 | 2021-10-01T08:48:06 | 2021-10-01T08:48:06 | 410,595,708 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 238 | java | package com.google.android.gms.internal.ads;
/* compiled from: com.google.android.gms:play-services-ads@@19.4.0 */
final class zzblq {
/* access modifiers changed from: private */
public static final zzbln zzfmn = new zzbln();
}
| [
"57108396+atul-vyshnav@users.noreply.github.com"
] | 57108396+atul-vyshnav@users.noreply.github.com |
5ef4cccc579003ea9e986e6180b18b43b2409b0f | 2b9aa54ee954683cbf49dc44ac01e2a17145b7c1 | /TP_algo/exo3/Hex.java | b06698a04c1b4a30256d338e533a0920ea45db31 | [] | no_license | orichalque/l3 | 5d49dfba50f61d0e84b679c8341fbee831ccf9df | 4c31faf327e987a3dc1c5f893dc12ca9b2ce0b89 | refs/heads/master | 2016-09-06T03:50:01.962851 | 2014-11-27T15:38:43 | 2014-11-27T15:38:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 725 | java | class Hex {
protected int x;
protected int y;
protected int etq;
protected int rpz;
protected boolean chosen;
protected int player;
public int rpz() {
return rpz;
}
public void union(Hex a) {
rpz = a.rpz;
chosen = true;
}
public void setPlayer(int i) {
player = i;
}
public Hex(int x_,int y_,int etq_) {
x = x_;
y = y_;
etq = etq_;
rpz = etq;
player = 0;
chosen = false;
}
public String color() {
if (player == 1) {
return new String("X");
} else if (player == 2) {
return new String("8");
} else {
return new String("O");
}
}
public void data(int x_,int y_,int etq_) {
x = x_;
y = y_;
etq = etq_;
}
public int getEtq() {
return etq;
}
}
| [
"E104607D@I019V7pc06.ensinfo.sciences.univ-nantes.prive"
] | E104607D@I019V7pc06.ensinfo.sciences.univ-nantes.prive |
18cddf8f3588072d16cfb776be19d0f541e726b4 | 9918c5d3f6ef7d75fbf5548f153453b97a90f43f | /Android/ShareSDK/src/com/gumichina/sharesdk/framework/PlatformContainer.java | 2bef4978e9685ad67ddf4e94b792a3f6aaac9b0a | [] | no_license | pktangyue/ShareSDKProject | 00928d1947d675669fa268bb4a49af46d9fa1143 | 787c04d8dc68728e4f05644c5095f24d8e980cbb | refs/heads/master | 2020-09-22T15:15:01.341378 | 2015-01-16T11:11:25 | 2015-01-16T11:11:51 | 29,099,837 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 965 | java | package com.gumichina.sharesdk.framework;
import java.util.ArrayList;
import com.gumichina.sharesdk.framework.sinaweibo.PlatformSinaWeibo;
import com.gumichina.sharesdk.framework.wechat.PlatformWechatTimeline;
import android.content.Context;
public class PlatformContainer
{
private ArrayList<Platform> platforms = new ArrayList<Platform>();
private Context context = null;
public PlatformContainer(Context context)
{
this.context = context;
}
public Platform getPlatform(int platformid)
{
for (Platform platform : platforms)
{
if (platform.platformid == platformid)
return platform;
}
Platform platform = null;
// 如果内存中没有
switch (platformid)
{
case PlatformType.SinaWeibo:
platform = new PlatformSinaWeibo(context);
break;
case PlatformType.WechatTimeline:
platform = new PlatformWechatTimeline(context);
break;
default:
return null;
}
platforms.add(platform);
return platform;
}
}
| [
"tangyue1004@gmail.com"
] | tangyue1004@gmail.com |
f14a58101b1c5cd2842d0262decb8d97e785490e | e44b1d93e02ec93dd8710d8c4b730a5e4c78b27b | /src/control/lighting/sequences/Sequence.java | d9ae4960d8ff064cb8f70e6f22de76ef5fc7a1bc | [] | no_license | BSvER1/LightControl2.0 | d37e47652ed5f6db3affa2337879816db6d25733 | 63b94f63ab842bb0313673b87dda14d65fb97dcb | refs/heads/master | 2021-01-13T00:56:33.561991 | 2015-12-16T01:44:14 | 2015-12-16T01:44:14 | 45,227,130 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,257 | java | package control.lighting.sequences;
import java.awt.Color;
import java.io.Serializable;
import java.util.concurrent.ConcurrentSkipListMap;
import control.lighting.layout.components.LightingComponent;
import control.main.Driver;
public abstract class Sequence implements Serializable{
private static final long serialVersionUID = 8896923278218931353L;
private String name;
private int zone;
private int maxTime = -1;
private ConcurrentSkipListMap<ComponentTimePair<LightingComponent, Integer>, Color> sequence;
public Sequence(String name, int zone) {
sequence = new ConcurrentSkipListMap<ComponentTimePair<LightingComponent, Integer>, Color>();
this.zone = zone;
this.name = name;
}
public int getSequenceLength() {
return maxTime;
}
/**
* internal method for getting the sequence.
* @return the sequence as its internal data structure.
*/
@SuppressWarnings("unused")
@Deprecated
private ConcurrentSkipListMap<ComponentTimePair<LightingComponent, Integer>, Color> getSequence() {
return sequence;
}
public void clearSequence() {
sequence.clear();
maxTime = -1;
}
public Color getColor(LightingComponent component, Integer time) {
if (component.isGroup()) {
Driver.trace("cant get the colour of grouped components");
return Color.BLACK;
}
//ComponentTimePair<LightingComponent, Integer> key = getKey(component, time);
return sequence.get(sequence.floorKey(getKey(component, time)));
}
public void setColor(LightingComponent component, Integer time, Color col) {
if (time > maxTime) maxTime = time;
if (sequence.get(getKey(component, time)) != null)
Driver.trace("Replacing "+sequence.get(getKey(component, time))+"@["+component.getIdentifier()+", "+time+"] with "+col.toString());
sequence.put(getKey(component, time), col);
}
private ComponentTimePair<LightingComponent, Integer> getKey(LightingComponent component, Integer time) {
return new ComponentTimePair<LightingComponent, Integer>(component, time);
}
public int getZone() {
return zone;
}
public void setZone(int zone) {
this.zone = zone;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public abstract void initSequence();
}
| [
"bsver1@hotmail.com"
] | bsver1@hotmail.com |
030d7bf163eb40bdeed2a1aaf34e442e9fa2b16d | eb5bd02f38eab527b6b8987962d10c830470b3fa | /Test/DataCollectionTest.java | ab7a23aa40a72248f1a2efc52fa3f434eb8d5d6b | [] | no_license | liha1104/Prosjektarbeid_Programmering2 | 43ae4afa7f008ae66e84bd39f2830bd364c018db | 3b482d1827fe4e4f9cdb2f34becd75cfe512330e | refs/heads/master | 2021-01-10T08:44:29.323072 | 2015-11-27T09:56:34 | 2015-11-27T09:56:34 | 46,728,371 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,884 | java | import org.junit.*;
import static org.mockito.Mockito.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
public class DataCollectionTest {
private DataCollection data;
private MyReader mockReader;
private String first = "000000000000000000000010";
private String second = "000000000000000000000110";
private String bwand = "000000000000000000000010";
private String bwor = "000000000000000000000110";
@Before
public void setUp() throws Exception {
mockReader = mock(MyReader.class);
data = new DataCollection(mockReader);
}
@Test
public void getReader_Returns_CorrectReader() {
assertThat(data.getReader(), is(mockReader));
}
@Test
public void setReader_Returns_NewReader() {
MyReader newMockReader = mock(MyReader.class);
data.setReader(newMockReader);
assertThat(data.getReader(), is(newMockReader));
}
@Test(expected = IllegalArgumentException.class)
public void setReader_toNull_shouldNotWork() {
data.setReader(null);
}
@Test
public void readLine_GoodLine_ReturnsCorrectly() {
when(mockReader.readLine()).thenReturn("2 1 " + first + " " + second);
assertThat(data.readLine(), is("2 1 " + first + " " + second));
}
@Test(expected = IllegalArgumentException.class)
public void readLine_badLine_shouldResultInException() {
when(mockReader.readLine()).thenReturn("2 1 " + first);
data.readLine();
}
@Test
public void readLine_withNullPointer_shouldWork() {
when(mockReader.readLine()).thenReturn(null);
assertThat(data.readLine(), nullValue());
}
@Test
public void readFile_Returns_FileCorrectly() {
when(mockReader.readLine()).thenReturn("2 1 " + first + " " + second);
when(mockReader.readLine()).thenReturn(null);
data.readFile();
assertThat(mockReader.readLine(), nullValue());
}
@Test
public void splitLine_ReturnsLine_Correctly() {
String[] t = data.splitLine("2 1 " + first + " " + second);
assertThat(t[0], is("2"));
assertThat(t[2], is(first));
assertThat(t[3], is(second));
}
@Test
public void calculate_BWAndAndReturns_Correctly() {
assertThat(data.calculate("1", first, second), is(bwand));
}
@Test
public void calculate_BWOrAndReturns_Correctly() {
assertThat(data.calculate("2", first, second), is(bwor));
}
@Test(expected = IllegalArgumentException.class)
public void calculate_withbadBitwise_shouldResultInException() {
data.calculate("3", first, second);
}
@Test
public void save_withGoodValues_shouldStoreCorrectly() {
data.save("2 1 " + first + " " + second);
assertThat(data.getEntry("2").getBitwise(), is("1"));
assertThat(data.getEntry("2").getFirstString(), is(first));
assertThat(data.getEntry("2").getSecondString(), is(second));
assertThat(data.getEntry("2").getBinaryResult(), is(bwand));
assertThat(data.getEntry("2").getDecimalResult(), is(5));
}
@Test
public void save_withBadBitwise_shouldSaveInErrors() {
data.save("2 3 " + first + " " + second);
assertThat(data.getErrors().get(0), is("2 3 " + first + " " + second));
}
@Test
public void save_duplexData_InDuplex() {
data.save("2 1 " + first + " " + second);
data.save("2 2 " + second + " " + first);
assertThat(data.getDuplex().get(0).getBitwise(), is("2"));
assertThat(data.getDuplex().get(0).getFirstString(), is(second));
assertThat(data.getDuplex().get(0).getSecondString(), is(first));
assertThat(data.getDuplex().get(0).getBinaryResult(), is(bwor));
assertThat(data.getDuplex().get(0).getDecimalResult(), is(35));
}
}
| [
"victorlindback2@yahoo.no"
] | victorlindback2@yahoo.no |
a54e80b75799edcfb0ba9876584ec21d9b1094b4 | 993ce8d7946179b8ecb51ba3ec26ed2dde30a160 | /src/section2/MembershipCard.java | 15e7b112522f2c879ef17486ec01b3c5bececeb1 | [] | no_license | 835553-Reshma/object-oriented-concepts | 15a708eff237930945411486898b3304521e1c67 | 67790ceceb2463ceafd869bf606b516d7a995bce | refs/heads/master | 2020-12-07T18:37:33.209459 | 2020-01-09T09:36:31 | 2020-01-09T09:36:31 | 232,773,056 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 664 | java | package section2;
public class MembershipCard extends Card {
private int rating;
public int getRating() {
return rating;
}
public void setRating(int rating) {
this.rating = rating;
}
public MembershipCard(String cardNumber, String holderName, String expiryDate, int rating) {
super(cardNumber, holderName, expiryDate);
this.rating = rating;
System.out.println("Rating" + rating);
}
void display() {
System.out.println(holderName + "'s Membership Card Details: ");
System.out.println("Card Number " + cardNumber);
System.out.println("Rating " + rating);
}
}
| [
"835553@cognizant.com"
] | 835553@cognizant.com |
273d02472b57f5a6f818884593fd78075174e849 | f2e254fe3f9fe530b0d49e5e13bf9057a2022d0c | /AL_09/src/BFS.java | bfa323e47ca0a46c29185a12cd5c9985d8dabb10 | [] | no_license | namsanghoon/Algorithm- | 2456a4e017135adf02e3e907018c55af4d24d91a | 9d1fcea956324594ff05a037b4a138515582e257 | refs/heads/master | 2020-03-30T20:13:17.803898 | 2018-12-14T09:20:08 | 2018-12-14T09:20:08 | 151,578,589 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,630 | java | import java.io.BufferedWriter;
import java.io.FileWriter;
import java.util.LinkedList;
import java.util.Queue;
public class BFS {
public class Graph {
private String color;
private int d;// 거리
private Graph pie = null;
private int index;
public Graph(String color) {
}
public Graph(String color, int d, Graph pie, int index) {
this.color = color;
this.d = d;
this.pie = null;
this.index = index;
}
}
private Graph u, v;
Queue<Graph> queue = new LinkedList<Graph>();
public BFS(int[][] arr, int start_Vertex) {
// TODO Auto-generated constructor stub
Graph[] V = new Graph[arr.length];
int s = start_Vertex - 1;// s = 시작 정점의 인덱스
for (int i = 0; i < arr.length; i++)
V[i] = new Graph("WHITE", Integer.MAX_VALUE, null, i + 1);
V[s] = new Graph("GRAY", 0, null, start_Vertex);
queue.add(V[s]);
while (!queue.isEmpty()) {
u = queue.peek();
for (int i = 0; i < arr.length; i++) {
if (arr[u.index - 1][i] == 1) {
v = V[i];
if (v.color == "WHITE") {
v.color = "GRAY";
v.d = u.d + 1;
v.pie = u;
queue.add(v);
}
}
}
u.color = "BLACK";
u = queue.remove();
}
writeFile(V);
}
private void writeFile(Graph[] V) {
// TODO Auto-generated method stub
String fileName = "Output(BFS).txt";
try {
BufferedWriter fw = new BufferedWriter(new FileWriter(fileName, true));
for (int i = 0; i < V.length; i++) {
fw.write(i + 1 + " " + V[i].d);
System.out.println(i + 1 + " " + V[i].d);
fw.newLine();
}
fw.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"gktkdgnsgk@cnu.ac.kr"
] | gktkdgnsgk@cnu.ac.kr |
3ec74f467ee74a65e7aa45aaef1d8ea3a9e26d09 | 53a7c6fe094730e92ac92274d97ddf6c38ce95b8 | /software/interpreter/ast/Gettable.java | a50e85dbc69ab1ec3a2b533cce35cf47b2c614e0 | [] | no_license | jsseng/arduino_robot | 94130331eec2227037e6bf5b553c92d4324cd414 | 4430be82f9eaf0cd89a47d4aba9853484409affc | refs/heads/master | 2016-09-05T12:13:30.062595 | 2016-01-08T18:01:29 | 2016-01-08T18:01:29 | 16,319,887 | 0 | 0 | null | 2014-10-13T23:19:04 | 2014-01-28T17:42:11 | C | UTF-8 | Java | false | false | 76 | java | package ast;
public interface Gettable
{
public String toGetString();
}
| [
"ooee123@gmail.com"
] | ooee123@gmail.com |
b5b1af1264abd7aa3c458cb96fbf4834d01c6e73 | 4d63e2bcd37c17ab54c8c197282dc26af6a723f9 | /src/main/java/PopularItemTransaction.java | 3a3943f379b88b3c6a768bb611632f889a960b57 | [] | no_license | fcu-D0462213/team_p_coc | 5d8f088e9b0ecc1160ac53a54c576066745e9fe8 | cf62e3c318fba69cc138550b42d8d781bb579807 | refs/heads/master | 2023-01-12T00:16:46.415307 | 2020-11-10T14:14:23 | 2020-11-10T14:14:23 | 310,523,632 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,958 | java |
import com.sun.rowset.internal.Row;
import java.math.BigDecimal;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class PopularItemTransaction {
private PreparedStatement selectLastOrdersStmt;
private PreparedStatement selectCustomerStmt;
private PreparedStatement selectTopQuantityStmt;
private PreparedStatement selectOrderWithItemStmt;
public Connection connection;
private static final String SELECT_LAST_ORDERS =
"SELECT o_id, o_c_id, o_entry_d "
+ "FROM orders "
+ "WHERE o_w_id = ? AND o_d_id = ? "
+ "LIMIT ? ;";
private static final String SELECT_CUSTOMER =
"SELECT c_first, c_middle, c_last "
+ "FROM customer "
+ "WHERE c_w_id = ? AND c_d_id = ? AND c_id = ? ;";
private static final String SELECT_TOP_QUANTITY =
"SELECT ol_quantity "
+ "FROM order_line "
+ "WHERE ol_w_id = ? AND ol_d_id = ? AND ol_o_id = ? LIMIT 1 ;";
private static final String SELECT_ORDER_WITH_ITEM =
"SELECT ol_i_id, ol_i_name, ol_quantity "
+ "FROM order_line "
+ "WHERE ol_w_id = ? AND ol_d_id = ? AND ol_o_id = ? AND ol_quantity = ? ;";
PopularItemTransaction(Connection connection) {
this.connection = connection;
try {
selectLastOrdersStmt = connection.prepareStatement(SELECT_LAST_ORDERS);
selectCustomerStmt = connection.prepareStatement(SELECT_CUSTOMER);
selectTopQuantityStmt = connection.prepareStatement(SELECT_TOP_QUANTITY);
selectOrderWithItemStmt = connection.prepareStatement(SELECT_ORDER_WITH_ITEM);
} catch (SQLException e) {
e.printStackTrace();
}
}
void popularItem(int wId, int dId, int numOfOrders) {
ResultSet lastOrders = selectLastOrders(wId, dId, numOfOrders);
HashMap<Integer, Doubles<String, Integer>> popularItems = new HashMap<>();
ResultSet popularItem = null;
ResultSet custom = null;
int order_cnt = 0;
System.out.println("District Identifier WId: " + wId + ",DId: " + dId);
System.out.println("number of orders been examined: " + numOfOrders);
try {
while (lastOrders.next()) {
int orderId = lastOrders.getInt("o_id");
int orderCId = lastOrders.getInt("o_c_id");
String orderEntryDay = lastOrders.getTimestamp("o_entry_d").toString();
System.out.println("order Id: " + orderId + ", entry date and time: " + orderEntryDay);
popularItem = getPopularItem(wId, dId, orderId);
custom = getCustomer(wId, dId, orderCId);
custom.next();
String c_first = custom.getString("c_first");
String c_middle = custom.getString("c_middle");
String c_last = custom.getString("c_last");
System.out.println("customer name: " + c_first + " " + c_middle + " " + c_last);
System.out.println("============ popular item info ============");
while (popularItem.next()) {
int itemId = popularItem.getInt("ol_i_id");
String itemName = popularItem.getString("ol_i_name");
float itemQuantity = popularItem.getBigDecimal("ol_quantity").floatValue();
System.out.println("item name: " + itemName);
System.out.println("item quantity: " + itemQuantity);
if (!popularItems.containsKey(itemId)) {
Doubles<String, Integer> itemDouble = new Doubles<>(itemName, 1);
//System.out.println("second when add key:" + itemDouble.second);
popularItems.put(itemId, itemDouble);
//System.out.println("Put successfully");
} else {
int newItemCnt = popularItems.get(itemId).getSecond() + 1;
Doubles<String, Integer> newItemDouble = new Doubles<>(itemName, newItemCnt);
//newItemDouble.put(itemName, newItemCnt);
//System.out.println("second when exist key:" + newItemDouble.second);
popularItems.replace(itemId, newItemDouble);
}
}
System.out.println("==========================================");
order_cnt = lastOrders.getRow();
}
} catch (SQLException e) {
e.printStackTrace();
}
System.out.println("============ percentage info ============");
for (Map.Entry<Integer, Doubles<String, Integer>> entry : popularItems.entrySet()) {
//System.out.println("before itemINfo");
Doubles<String, Integer> itemInfo = entry.getValue();
//System.out.println("print itemINfo" +itemINfo);
String itemNameInfo = itemInfo.getFirst();
int itemNum = itemInfo.getSecond();
//System.out.println("second:"+itemNum+" & order_cnt:"+order_cnt);
//float percentage = itemInfo.getSecond() / order_cnt;
System.out.println("item name: " + itemNameInfo);
System.out.println(String.format("percentage: %.3f", (float) itemNum / order_cnt));
}
System.out.println("==========================================");
}
private ResultSet selectLastOrders(final int wId, final int dId, final int numOfOrders) {
ResultSet resultSet = null;
try {
selectLastOrdersStmt.setInt(1, wId);
selectLastOrdersStmt.setInt(2, dId);
selectLastOrdersStmt.setInt(3, numOfOrders);
selectLastOrdersStmt.execute();
resultSet = selectLastOrdersStmt.getResultSet();
} catch (SQLException e) {
e.printStackTrace();
}
return resultSet;
}
private ResultSet getCustomer(final int wId, final int dId, final int orderCId) {
ResultSet resultSet = null;
try {
selectCustomerStmt.setInt(1, wId);
selectCustomerStmt.setInt(2, dId);
selectCustomerStmt.setInt(3, orderCId);
selectCustomerStmt.execute();
resultSet = selectCustomerStmt.getResultSet();
} catch (SQLException e) {
e.printStackTrace();
}
return resultSet;
}
private ResultSet getPopularItem(final int wId, final int dId, final int orderId) {
ResultSet resultSet2 = null;
try {
selectTopQuantityStmt.setInt(1, wId);
selectTopQuantityStmt.setInt(2, dId);
selectTopQuantityStmt.setInt(3, orderId);
selectTopQuantityStmt.execute();
ResultSet resultSet1 = selectTopQuantityStmt.getResultSet();
resultSet1.next();
BigDecimal maxQuantity = resultSet1.getBigDecimal("ol_quantity");
selectOrderWithItemStmt.setInt(1, wId);
selectOrderWithItemStmt.setInt(2, dId);
selectOrderWithItemStmt.setInt(3, orderId);
selectOrderWithItemStmt.setBigDecimal(4, maxQuantity);
selectOrderWithItemStmt.execute();
resultSet2 = selectOrderWithItemStmt.getResultSet();
} catch (SQLException e) {
e.printStackTrace();
}
return resultSet2;
}
class Doubles<T, U> {
final T first;
final U second;
Doubles(T first, U second) {
this.first = first;
this.second = second;
}
public T getFirst() {
return first;
}
public U getSecond() {
return second;
}
}
}
| [
"654391654@qq.com"
] | 654391654@qq.com |
f9bbb9407575df52794bcd93c008bf86b1512153 | 3dc1544635c9e4a1fefbacbf3b20f798499b4102 | /src/Logica/DtTemaRemoto.java | 972a02c0cf4b8135e9bd76033addafa437eef9f0 | [] | no_license | Jorge1701/ProgApliTarea1 | cb1a293d357af0142ca38f68da49683d3b0ddc49 | 3b8562824ad2d7d52c2d488e4c1e507ad7319e5b | refs/heads/master | 2021-01-23T18:44:32.956532 | 2017-11-15T20:13:38 | 2017-11-15T20:13:38 | 102,805,254 | 0 | 0 | null | 2017-11-12T20:31:33 | 2017-09-08T01:59:50 | Java | UTF-8 | Java | false | false | 584 | java | package Logica;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DtTemaRemoto")
public class DtTemaRemoto extends DtTema {
public String url;
public DtTemaRemoto(int reproducciones, String url, String nombre, DtTime duracion, int ubicacion) {
super(reproducciones, nombre, duracion, ubicacion);
this.url = url;
}
public DtTemaRemoto() {
}
public String getUrl() {
return url;
}
}
| [
"Brian@192.168.56.1"
] | Brian@192.168.56.1 |
4fb13a934f9b04dcfc7d6c0f3d74128f63c64f2a | 69e3b0b38a51441360188de76457527d76a9fe08 | /src/main/java/com/mallorcasoftware/curatorioclient/ProgressResponseBody.java | 713f8269ed8a54410b35236ecc5f23aab1770d9d | [
"Apache-2.0"
] | permissive | MallorcaSoftware/CuratorIoApiClient | 062b26e3b4995a5064313729d0e14993cf0b95f9 | a70f6035ef3fae25617406724abae993790ba928 | refs/heads/master | 2020-12-03T04:08:51.517374 | 2017-07-05T00:05:08 | 2017-07-05T00:05:08 | 95,821,900 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,757 | java | /**
* curator.io client
* No descripton provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*
* 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.mallorcasoftware.curatorioclient;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.ResponseBody;
import java.io.IOException;
import okio.Buffer;
import okio.BufferedSource;
import okio.ForwardingSource;
import okio.Okio;
import okio.Source;
public class ProgressResponseBody extends ResponseBody {
public interface ProgressListener {
void update(long bytesRead, long contentLength, boolean done);
}
private final ResponseBody responseBody;
private final ProgressListener progressListener;
private BufferedSource bufferedSource;
public ProgressResponseBody(ResponseBody responseBody, ProgressListener progressListener) {
this.responseBody = responseBody;
this.progressListener = progressListener;
}
@Override
public MediaType contentType() {
return responseBody.contentType();
}
@Override
public long contentLength() throws IOException {
return responseBody.contentLength();
}
@Override
public BufferedSource source() throws IOException {
if (bufferedSource == null) {
bufferedSource = Okio.buffer(source(responseBody.source()));
}
return bufferedSource;
}
private Source source(Source source) {
return new ForwardingSource(source) {
long totalBytesRead = 0L;
@Override
public long read(Buffer sink, long byteCount) throws IOException {
long bytesRead = super.read(sink, byteCount);
// read() returns the number of bytes read, or -1 if this source is exhausted.
totalBytesRead += bytesRead != -1 ? bytesRead : 0;
progressListener.update(totalBytesRead, responseBody.contentLength(), bytesRead == -1);
return bytesRead;
}
};
}
}
| [
"pallidotcom@gmail.com"
] | pallidotcom@gmail.com |
3cd24e73acfd45073ceed8a7d6be12b0693de80b | cb6989c974fe812e68539387029374e6ca8e9594 | /spotty.spots.svc/src/main/java/com/spotty/spotty/spots/svc/controller/CreateSpotController.java | 849368f9b41dd49eb5871205e91244bd9d3dac0c | [] | no_license | Sero7777/spotty-java | cac820e804d421bcb9a9d8202e628a6cb6df59c7 | 3fb797848b0f3deb80d77807eb28ef995686882f | refs/heads/master | 2023-02-08T04:03:16.168760 | 2021-01-02T19:30:37 | 2021-01-02T19:30:37 | 326,251,747 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,080 | java | package com.spotty.spotty.spots.svc.controller;
import com.spotty.spotty.spots.svc.models.SpotDto;
import com.spotty.spotty.spots.svc.services.SpotService;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
@RestController
@RequestMapping("api/v1/spots")
@RequiredArgsConstructor
public class CreateSpotController {
private final SpotService spotService;
@PostMapping
public ResponseEntity createNewSpot(@RequestBody @Valid SpotDto spotDto){
SpotDto savedSpotDto = spotService.saveNewSpot(spotDto);
if (savedSpotDto != null) {
return new ResponseEntity(savedSpotDto, HttpStatus.CREATED);
}
return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
| [
"max_wa@gmx.de"
] | max_wa@gmx.de |
b59fdd6dd17c919802f57d7449c62b41b586e4e3 | 0fa2d9a9c9e7198b977b0f161a766763beb5440f | /src/dit2_a1/DIT2_A1.java | 82848c7b4ef53611f9885e718dbad5893cb7fd6e | [] | no_license | dgonzalezl-dev/DI_T2A1_DaniGonzalez | 8aa15058e5fb7e6c90dc7de3228d9a152aee8052 | c4db6922bf03af3f3dc132812f9a6acba266cff0 | refs/heads/master | 2020-09-13T06:25:25.234276 | 2019-11-19T11:31:05 | 2019-11-19T11:31:05 | 222,680,982 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 931 | 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 dit2_a1;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
/**
*
* @author Usuario
*/
public class DIT2_A1 extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent root = FXMLLoader.load(getClass().getResource("FXML_example.fxml"));
Scene scene = new Scene(root,300,275);
stage.setTitle("FXML Welcome");
stage.setScene(scene);
stage.show();
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}
| [
"danigl77118844@gmail.com"
] | danigl77118844@gmail.com |
57810e04386ab81013c9c65c4d0be05449d0c6b2 | c885ef92397be9d54b87741f01557f61d3f794f3 | /results/Gson-18/com.google.gson.internal.$Gson$Types/BBC-F0-opt-10/tests/20/com/google/gson/internal/$Gson$Types_ESTest_scaffolding.java | 0eb3425c21f2b06a5336e8e05ce409ed4b77e7ce | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 542 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Wed Oct 20 22:50:18 GMT 2021
*/
package com.google.gson.internal;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class $Gson$Types_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"pderakhshanfar@serg2.ewi.tudelft.nl"
] | pderakhshanfar@serg2.ewi.tudelft.nl |
ade9a0265638181997aef648dd734bd21a07b696 | c588972aa64e2f3f7146b480477474d1c03711b6 | /test/com.company/QuickSortTest.java | e467c44649e5f9f33ffcea538115acfa5152be28 | [] | no_license | htsondk251/Sorting | 18367862ca499a58282754e0b8dfc4a77c9a0a66 | fac92b46888ab5517d461cff40984732fc3a59ec | refs/heads/master | 2023-01-05T23:32:38.847130 | 2020-11-07T05:57:57 | 2020-11-07T05:57:57 | 308,808,381 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,611 | java | package com.company;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class QuickSortTest {
QuickSort qs = new QuickSort();
int[] A, AAsc, ADesc, ASame;
int[] result;
@BeforeEach
void setUp() {
A= new int[]{42, 23, 74, 11, 65, 58, 94, 36, 99, 87, 101};
ASame = new int[]{1,5,3,9,3,10,12,6,7,8,15};
result = A.clone();
AAsc = new int[]{0,1,2,3,4,5,6,7};
ADesc = new int[]{7,6,5,4,3,2,1,0};
}
@Test
void sortIfNormal() {
assertArrayEquals(new int[]{11,23,36,42,58,65,74,87,94,99,101}, qs.sort(A));
}
@Test
void sortIfHavingSameElements() {
// assertArrayEquals(new int[]{1,3,3,5,6,7,8,9,10,12,15}, qs.sort(ASame));
assertArrayEquals(new int[]{3,3,5}, qs.sort(new int[]{3,3,5}));
}
@Test
void sortIfDescending() {
assertArrayEquals(new int[]{0,1,2,3,4,5,6,7}, qs.sort(ADesc));
}
@Test
void sortIfAscending() {
assertArrayEquals(new int[]{0,1,2,3,4,5,6,7}, qs.sort(AAsc));
}
@Test
void quickSort() {
}
@Test
void partBy2Pointers() {
assertEquals(3, qs.partBy2Pointers(A, 0, A.length-1));
assertEquals(0, qs.partBy2Pointers(new int[]{11,23,36}, 0, 2));
assertEquals(2, qs.partBy2Pointers(new int[]{36,23,11}, 0, 2));
}
@Test
void part() {
assertEquals(3, qs.part(A, 0, A.length-1));
assertEquals(0, qs.part(new int[]{11,23,36}, 0, 2));
assertEquals(2, qs.part(new int[]{36,23,11}, 0, 2));
}
} | [
"thanh_son_hoang_70@yahoo.com"
] | thanh_son_hoang_70@yahoo.com |
459a6690a317dc5966146a537f242415c5264cee | d75663e7cf46408422830b2ac2171d4b8d9c6042 | /generic/src/com/java/advanced/practice/Utils.java | 9c585f60425bea398efdca152b8a8a801a1b930e | [] | no_license | molicode/java-advanced-practice | b149a1c65b6b1b3fffc290ed203a95fb89f006ea | d7e2ae3796d994913d69c29c65aea55ea8158835 | refs/heads/master | 2023-06-03T13:32:39.653501 | 2021-06-21T19:26:43 | 2021-06-21T19:26:43 | 378,152,644 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 60 | java | package com.java.advanced.practice;
public class Utils {
}
| [
"molicode1347@gmail.com"
] | molicode1347@gmail.com |
926039c01a6ca51dbf27416592f8122943cbad3c | dcbb283767eeca5ba82f2675346ba0302497009a | /dubbo-provider/src/main/java/com/jk/service/UserServiceImpl.java | f1511ffb1643d080f386529654be6c4f417b56b4 | [] | no_license | Lfjnb/dubbo | 68c26a3279a9859381ba94a3dbfe9855d6c0db85 | 48de264981c6206ac2d557475236326ecdacc06b | refs/heads/master | 2020-05-05T13:53:35.786261 | 2019-04-09T00:41:51 | 2019-04-09T00:41:51 | 180,097,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,093 | java | package com.jk.service;
import com.alibaba.dubbo.config.annotation.Service;
import com.jk.dao.UserDao;
import com.jk.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
@Service(interfaceClass = UserService.class)
@Component
public class UserServiceImpl implements UserService {
@Autowired
private UserDao userDao;
@Override
public User saveUser(User user) {
user.setUserId(1001);
return user;
}
@Override
public List<User> selectUser() {
List<User> list=userDao.selectUser();
return list;
}
@Override
public void addUser(User user) {
userDao.addUser(user);
}
@Override
public void deleteUser(Integer userId) {
userDao.deleteUser(userId);
}
@Override
public User queryUserById(Integer userId) {
User user=userDao.queryUserById(userId);
return user;
}
@Override
public void updateUserById(User user) {
userDao.updateUserById(user);
}
}
| [
"910419990@qq.com"
] | 910419990@qq.com |
3fcc7389471f6ede438242c263c3fdd7981c41b3 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/11/11_2c4b68c00f4022c5cdcc261d944d8eed09fb84ad/FregeParseController/11_2c4b68c00f4022c5cdcc261d944d8eed09fb84ad_FregeParseController_t.java | d1e4f38632e2d23ae169fe485a085837b8ec449f | [] | 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 | 22,561 | java | package frege.imp.parser;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
// import lpg.runtime.ILexStream;
// import lpg.runtime.IPrsStream;
// import lpg.runtime.Monitor;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.imp.builder.MarkerCreatorWithBatching;
import org.eclipse.imp.builder.ProblemLimit.LimitExceededException;
import org.eclipse.imp.model.ISourceProject;
import org.eclipse.imp.parser.IMessageHandler;
import org.eclipse.imp.parser.IParseController;
import org.eclipse.imp.parser.IParser;
import org.eclipse.imp.parser.ISourcePositionLocator;
import org.eclipse.imp.parser.ParseControllerBase;
import org.eclipse.imp.parser.SimpleAnnotationTypeInfo;
import org.eclipse.imp.preferences.IPreferencesService;
import org.eclipse.imp.services.IAnnotationTypeInfo;
import org.eclipse.imp.services.ILanguageSyntaxProperties;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.source.LineRange;
import frege.FregePlugin;
import frege.rt.Array;
import frege.rt.Lambda;
import frege.rt.Box;
import frege.rt.FV;
import frege.rt.Lazy;
import frege.prelude.PreludeBase.TList.DCons;
import frege.prelude.PreludeBase.TTuple2;
import frege.prelude.PreludeBase.TList;
import frege.prelude.PreludeBase.TTuple3;
import frege.prelude.PreludeBase.TState;
import frege.prelude.PreludeList.IListLike__lbrack_rbrack;
import frege.compiler.BaseTypes.TFlag;
import frege.compiler.BaseTypes.IEnum_Flag;
import frege.compiler.Data.TGlobal;
import frege.compiler.Data.TMessage;
import frege.compiler.Data.TOptions;
import frege.compiler.BaseTypes.TPosition;
import frege.compiler.Data.TSeverity;
import frege.compiler.Data.TSubSt;
import frege.compiler.BaseTypes.TToken;
import frege.compiler.BaseTypes.TTokenID;
import frege.compiler.Utilities;
import frege.compiler.EclipseUtil;
import frege.compiler.Main;
import frege.imp.builders.FregeBuilder;
import frege.imp.preferences.FregePreferencesConstants;
/**
* NOTE: This version of the Parse Controller is for use when the Parse
* Controller and corresponding Node Locator are generated separately from
* a corresponding set of LPG grammar templates and possibly in the absence
* of the lexer, parser, and AST-related types that would be generated from
* those templates. It is assumed that either a) the Controller will be
* used with a suitable set of lexer, parser, and AST-related types
* that are provided by some means other than LPG, or b) the Controller will
* be used with a set of lexer, parser, and AST types that have been, or will
* be, separately generated based on LPG. In order to enable this version of
* the Parse Controller to compile, dummy lexer, parser, and AST-related types
* have been included as member types in the Controller. These types are not
* operational and are merely placeholders for types that would support a
* functioning implementation. Apart from the inclusion of these dummy types,
* this representation of the Parse Controller is the same as that used
* with LPG.
*
* @author Stan Sutton (suttons@us.ibm.com)
* @since May 1, 2007 Addition of marker types
* @since May 10, 2007 Conversion IProject -> ISourceProject
* @since May 15, 2007 Addition of dummy types
*/
public class FregeParseController extends ParseControllerBase implements
IParseController {
public static class TokensIterator implements Iterator<TToken> {
/** current token array */
final private Array toks;
private IRegion region;
private int inx;
/** check if token is within region */
public static boolean within(TToken tok, IRegion region) {
return (TToken.offset(tok) + TToken.value(tok).length() >= region.getOffset()
&& TToken.offset(tok) <= region.getOffset() + region.getLength());
}
/** construct an Iterator */
public TokensIterator(Array it, IRegion reg) {
toks = it;
region = reg;
inx = 0;
while (inx < toks.length()) {
TToken t = (TToken) toks.getAt(inx)._e();
if (within(t, reg)) break;
inx++;
}
}
public static int skipBraces(final Array toks, int j) {
while (j < toks.length()) {
TToken tok = (TToken) toks.getAt(j)._e();
if (tok.mem1 == TTokenID.CHAR.j
&& (tok.mem2.charAt(0) == '{'
|| tok.mem2.charAt(0) == '}'
|| tok.mem2.charAt(0) == ';')) {
j++;
}
else break;
}
return j;
}
@Override
public boolean hasNext() {
// skip { ; }
inx = skipBraces(toks, inx);
// we have a next if we are not the empty list and the token is in the region
return inx < toks.length()
&& within((TToken)toks.getAt(inx)._e(), region);
}
@Override
public TToken next() {
// give back next token
if (inx < toks.length()) {
return (TToken) toks.getAt(inx++)._e();
}
return null;
}
@Override
public void remove() {
throw new UnsupportedOperationException("TokensIterator");
}
}
public static class FregeData {
private String sp = ".";
private String fp = ".";
private String bp = ".";
private ISourceProject project = null;
public FregeData(ISourceProject sourceProject) {
project = sourceProject;
if (project != null) {
IProject rp = project.getRawProject();
// System.out.println("The raw project has type: " + jp.getClass());
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IPath wroot = workspace.getRoot().getLocation();
// IProjectNatureDescriptor[] nds = workspace.getNatureDescriptors();
boolean isJava = false;
try {
isJava = rp.hasNature("org.eclipse.jdt.core.javanature");
} catch (CoreException e) {
// e.printStackTrace();
// System.out.println("The " + nd.getNatureId() + " is not supported, or so it seems.");
}
if (isJava) {
IJavaProject jp = JavaCore.create(rp);
try {
bp = wroot.append(jp.getOutputLocation()).toPortableString();
IClasspathEntry[] cpes = jp.getResolvedClasspath(true);
fp = "";
sp = ".";
for (IClasspathEntry cpe: cpes) {
if (cpe.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
if (sp.length() > 0) sp += System.getProperty("path.separator");
sp += cpe.getPath().makeRelativeTo(jp.getPath()).toString();
}
else {
if (fp.length() > 0) fp += System.getProperty("path.separator");
fp += cpe.getPath().toString();
}
}
} catch (JavaModelException e) {
} catch (NullPointerException np) {
}
}
}
if (fp.equals("")) fp=".";
if (sp.equals("")) sp=".";
}
/**
* The source path always includes the project directory, as otherwise source resolution in
* linked directories will work only if one links below a source directory, which may not be
* possible always.
* @return the sp
*/
public String getSp() {
return sp;
}
/**
* @return the fp
*/
public String getFp() {
return fp;
}
/**
* @return the bp
*/
public String getBp() {
return bp;
}
/**
* get all frege source files in the work space
*/
public List<String> getAllSources(final String hint) {
final FregeBuilder builder = new FregeBuilder();
final Set<String> result = new HashSet<String>();
try {
project.getRawProject().getWorkspace().getRoot().accept(builder.fResourceVisitor);
} catch (CoreException e) {
// problems getting the file names
return new ArrayList<String>(result);
}
LineNumberReader rdr = null;
for (IFile file : builder.fChangedSources) try {
rdr = null;
rdr = new LineNumberReader(new InputStreamReader(file.getContents(true)));
String line;
java.util.regex.Pattern pat = Pattern.compile("\\b(package|module)\\s+(\\S+)");
while ((line = rdr.readLine()) != null) {
Matcher m = pat.matcher(line);
if (m.find()) {
String p = m.group(2);
if (p.startsWith(hint))
result.add(p);
}
}
rdr.close(); rdr = null;
} catch (Exception e) {
if (rdr != null)
try {
rdr.close();
} catch (IOException e1) {
rdr = null;
}
rdr = null;
}
ArrayList<String> sorted = new ArrayList<String>(result);
Collections.sort(sorted);
return sorted;
}
/**
* look for a path that contains the source code for pack
*/
public IPath getSource(final String pack) {
final String fr = pack.replaceAll("\\.", "/") + ".fr";
// final String[] srcs = getSp().split(System.getProperty("path.separator"));
final FregeBuilder builder = new FregeBuilder();
try {
project.getRawProject().getWorkspace().getRoot().accept(builder.fResourceVisitor);
} catch (CoreException e) {
// problems getting the file names
return null;
}
for (IFile file : builder.fChangedSources) {
IPath it = file.getFullPath();
if (it.toString().endsWith(fr)) return it;
}
/*
for (String sf: srcs) {
final IPath p = new Path(sf + "/" + fr);
final IResource toRes = project.getRawProject().findMember(p);
if (toRes != null && toRes instanceof IFile) {
final IFile to = (IFile) toRes;
return to.getFullPath();
}
}
*/
return null;
}
}
public FregeParseController() {
super(FregePlugin.getInstance().getLanguageID());
}
private int timeout;
private TGlobal global, goodglobal;
private int hash = 0;
private int leng = 0;
private final ISourcePositionLocator fSourcePositionLocator
= new FregeSourcePositionLocator(this);
private final SimpleAnnotationTypeInfo fSimpleAnnotationTypeInfo
= new SimpleAnnotationTypeInfo();
private IMessageHandler msgHandler = null;
private FregeData fregeData = null;
/**
* @author ingo
* @return the frege data structure
*/
public FregeData getFD() { return fregeData; }
/**
* tell if we have errors
*/
public static int errors(TGlobal global) { return global == null ? 1 : TGlobal.errors(global); }
/**
* tell how far we are advanced
*/
public static int achievement(TGlobal global) {
if (global == null) return 0;
final TSubSt sub = TGlobal.sub(global);
return 2 * TSubSt.nextPass(sub) - (errors(global) > 0 ? 1 : 0);
}
/**
* run a {@link frege.prelude.PreludeBase.TState} action and return the new TGlobal state
* @return the new state
*/
public static TGlobal runStG(Lazy<FV> action, TGlobal g) {
Lambda stg = (Lambda) action._e(); // State (g -> (a, g))
TTuple2 r = (TTuple2)TState.run(stg, g)._e();
return (TGlobal) r.mem2._e();
}
/**
* Run a {@link frege.prelude.PreludeBase.TState} action and return the result.
* The state must not be changed by the action.
* @return the result
*/
public static FV funStG(Lazy<FV> action, TGlobal g) {
Lambda stg = (Lambda) action._e(); // State (g -> (a, g))
TTuple2 r = (TTuple2)TState.run(stg, g)._e();
return r.mem1._e();
}
/**
* @param filePath Project-relative path of file
* @param project Project that contains the file
* @param handler A message handler to receive error messages (or any others)
* from the parser
*/
public void initialize(IPath filePath, ISourceProject project,
IMessageHandler handler) {
super.initialize(filePath, project, handler);
IPath fullFilePath = project != null ?
project.getRawProject().getLocation().append(filePath)
: filePath;
global = (TGlobal)
frege.prelude.PreludeBase.TST.performUnsafe(
(Lambda) frege.compiler.Main.eclipseOptions._e())._e();
fregeData = new FregeData(project);
createLexerAndParser(fullFilePath, project);
msgHandler = handler;
}
public IParser getParser() {
new Exception("getParser: called").printStackTrace(System.out);
return null; // parser;
}
public ISourcePositionLocator getNodeLocator() {
return fSourcePositionLocator;
}
private void createLexerAndParser(IPath filePath, ISourceProject project) {
System.err.println("createLexerAndParser: " + filePath.toPortableString());
System.err.println("classpath: " + System.getProperty("java.class.path"));
global = TGlobal.upd$options(global, TOptions.upd$source(
TGlobal.options(global),
filePath.toPortableString()));
final FregeData data = fregeData;
final String fp = data.getFp();
final String bp = data.getBp();
final String sp = data.getSp();
System.err.println("FregePath: " + fp);
global = TGlobal.upd$options(global, TOptions.upd$path(
TGlobal.options(global),
frege.prelude.Arrays.IStringSplitter_Regex.splitted(
((frege.rt.Box<Pattern>)frege.compiler.Utilities.pathRE._e()).j,
fp)));
System.err.println("SourcePath: " + sp);
global = TGlobal.upd$options(global, TOptions.upd$sourcePath(
TGlobal.options(global),
frege.prelude.Arrays.IStringSplitter_Regex.splitted(
((frege.rt.Box<Pattern>)frege.compiler.Utilities.pathRE._e()).j,
sp)));
System.err.println("Destination: " + bp);
global = TGlobal.upd$options(global, TOptions.upd$dir(
TGlobal.options(global),
bp));
global = runStG(frege.compiler.Main.newLoader, global);
IPreferencesService service = FregePlugin.getInstance().getPreferencesService();
if (service != null) {
timeout = service.getIntPreference(FregePreferencesConstants.P_PARSETIMEOUT);
if (service.getBooleanPreference(FregePreferencesConstants.P_INLINE)) {
global = TGlobal.upd$options(global, TOptions.upd$flags(
TGlobal.options(global),
Utilities.setFlag(
new IEnum_Flag(),
TOptions.flags(TGlobal.options(global)).j,
TFlag.INLINE).j
));
}
final String prefix = service.getStringPreference(FregePreferencesConstants.P_PREFIX);
if (prefix != null && prefix.length() > 0) {
global = TGlobal.upd$options(global, TOptions.upd$prefix(
TGlobal.options(global), prefix));
}
}
else timeout = 250;
goodglobal = global;
}
/**
* The msgHandler must be in place
*/
public TGlobal parse(String contents, boolean scanOnly,
IProgressMonitor monitor) {
long t0 = System.nanoTime();
long te = 0;
long t1 = 0;
TList passes = null;
DCons pass = null;
int index;
synchronized (this) {
if (monitor.isCanceled()) return global;
if (contents.length() == leng && contents.hashCode() == hash)
return global; // nothing really updated here
msgHandler.clearMessages();
final IProgressMonitor myMonitor = monitor;
Lambda cancel = new frege.rt.Lam1() {
public Lazy<FV> eval(Lazy<FV> realworld) {
return (myMonitor.isCanceled()) ? Box.Bool.t : Box.Bool.f;
}
};
global = TGlobal.upd$sub(global, TSubSt.upd$cancelled(
TGlobal.sub(global),
cancel));
global = TGlobal.upd$sub(global, TSubSt.upd$errors(TGlobal.sub(global), 0));
passes = (TList) frege.compiler.Main.passes._e();
monitor.beginTask(this.getClass().getName() + " parsing",
1 + IListLike__lbrack_rbrack.length(passes));
index = 0;
while (!monitor.isCanceled()
&& (pass = passes._Cons()) != null
&& errors(global) == 0
&& index < 2) { // do lexer and parser synchronized
t1 = System.nanoTime();
index++;
passes = (TList) pass.mem2._e();
final TTuple3 adx = (TTuple3) pass.mem1._e();
final Lazy<FV> action = index == 1 ? Main.lexPassIDE(contents) : adx.mem1;
final String desc = Box.<String>box(adx.mem2._e()).j;
final TGlobal g = runStG(action, global);
te = System.nanoTime();
System.err.println(desc + " took "
+ (te-t1)/1000000 + "ms, cumulative "
+ (te-t0)/1000000 + "ms");
monitor.worked(1);
global = runStG(EclipseUtil.passDone._e(), g);
}
if (achievement(global) >= achievement(goodglobal))
goodglobal = global; // when opening a file with errors
else {
// update token array in goodglobal
Array toks = TSubSt.toks(TGlobal.sub(global));
goodglobal = TGlobal.upd$sub(goodglobal, TSubSt.upd$toks(
TGlobal.sub(goodglobal), toks));
}
// Array gtoks = TSubSt.toks(TGlobal.sub(global));
// System.err.println("global.toks==good.toks is " + (toks == gtoks));
}
// adjust timeout
int needed = (int) ((te-t0) / 1000000);
if (needed > 0) {
System.err.print("needed=" + needed + "ms, timeout=" + timeout + "ms, ");
if (needed > timeout)
timeout = 5 * timeout / 4;
else
timeout = 4 * timeout / 5;
System.err.println("new timeout=" + timeout + "ms");
}
if (scanOnly && timeout - needed > 0 && errors(global) == 0)
try { Thread.sleep(timeout - needed); } catch (InterruptedException e) {}
while (!monitor.isCanceled()
&& errors(global) == 0
&& (pass = passes._Cons()) != null) { // do the rest unsynchronized
t1 = System.nanoTime();
passes = (TList) pass.mem2._e();
index++;
final TTuple3 adx = (TTuple3) pass.mem1._e();
final Lazy<FV> action = adx.mem1;
final String desc = Box.<String>box(adx.mem2._e()).j;
final TGlobal g = runStG(action, global);
te = System.nanoTime();
System.err.println(desc + " took "
+ (te-t1)/1000000 + "ms, cumulative "
+ (te-t0)/1000000 + "ms");
monitor.worked(1);
global = runStG(EclipseUtil.passDone._e(), g);
if (achievement(global) >= achievement(goodglobal))
goodglobal = global;
else if (index >= 6) {
// give token resolve table to goodglobal
goodglobal = TGlobal.upd$sub(goodglobal, TSubSt.upd$idKind(
TGlobal.sub(goodglobal), TSubSt.idKind(TGlobal.sub(global))));
// give locals to goodglobals
goodglobal = TGlobal.upd$locals(goodglobal, TGlobal.locals(global));
}
if (scanOnly && desc.startsWith("type check")) {
goodglobal = global;
break;
}
}
leng = contents.length();
hash = contents.hashCode();
return global;
}
@Override
synchronized public TGlobal getCurrentAst() {
// System.err.println("delivered goodglobal");
return global;
}
synchronized public TGlobal getGoodAst() {
// System.err.println("delivered goodglobal");
return goodglobal;
}
@Override
public TGlobal parse(String input, IProgressMonitor monitor) {
MarkerCreatorWithBatching mcwb = msgHandler instanceof MarkerCreatorWithBatching ?
(MarkerCreatorWithBatching) msgHandler : null;
// when we build, we'll get a MarkerCreatorWithBatching
// Hence, if we do not have one, we just scan&parse, otherwise we do a full compile
TGlobal g = parse(input, mcwb == null, monitor);
TList msgs = TSubSt.messages(TGlobal.sub(g));
while (true) {
TList.DCons node = msgs._Cons();
if (node == null) break;
msgs = (TList) node.mem2._e();
TMessage msg = (TMessage) node.mem1._e();
if (mcwb != null) {
// do also warnings and hints
int sev = IMarker.SEVERITY_ERROR;
if (TMessage.level(msg).j == TSeverity.HINT.j) sev = IMarker.SEVERITY_INFO;
else if (TMessage.level(msg).j == TSeverity.WARNING.j)
sev = IMarker.SEVERITY_WARNING;
try {
mcwb.addMarker(sev,
TMessage.text(msg)
.replaceAll("\n", " "),
TToken.line( TPosition.first(TMessage.pos(msg)) ),
TPosition.start(TMessage.pos(msg)),
TPosition.end(TMessage.pos(msg)));
} catch (LimitExceededException e) {
break;
}
continue;
}
// normal message handling
if (TMessage.level(msg).j != TSeverity.ERROR.j) continue;
msgHandler.handleSimpleMessage(TMessage.text(msg),
TPosition.start(TMessage.pos(msg)),
TPosition.end(TMessage.pos(msg))-1,
0, 0, 0, 0);
}
if (mcwb == null) monitor.done();
return g;
}
@Override
public Iterator<TToken> getTokenIterator(IRegion region) {
System.err.println("getTokenIterator(): ");
return new TokensIterator(TSubSt.toks(TGlobal.sub(global)), region);
}
@Override
public ISourcePositionLocator getSourcePositionLocator() {
return fSourcePositionLocator;
}
@Override
public IAnnotationTypeInfo getAnnotationTypeInfo() {
return fSimpleAnnotationTypeInfo;
}
private ILanguageSyntaxProperties lsp;
/**
* @return an implementation of {@link ILanguageSyntaxProperties} that
* describes certain syntactic features of this language
*/
@Override
public ILanguageSyntaxProperties getSyntaxProperties() {
if (lsp == null) {
lsp = new ILanguageSyntaxProperties() {
@Override
public String getSingleLineCommentPrefix() {
return "--";
}
@Override
public String getIdentifierConstituentChars() {
return null;
}
@Override
public int[] getIdentifierComponents(String ident) {
return null;
}
@Override
public String[][] getFences() {
return new String[][] { {"(", ")"}, {"{", "}"}, {"[", "]"}};
}
@Override
public String getBlockCommentStart() {
return "{-";
}
@Override
public String getBlockCommentEnd() {
return "-}";
}
@Override
public String getBlockCommentContinuation() {
return null;
}
};
}
return lsp;
}
public synchronized final int getHash() {
return hash;
}
public synchronized final int getLeng() {
return leng;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
93818f5b3c6d71bf2d944296f32faceee33926f5 | 9b064d38121fb4a54bc2a33f7bbc153a5314b4f9 | /api-PRICE/src/main/java/com/danco/bpc/service/api/PRICE/IPrcMessagesErrorsService.java | 73e17dedc11389b1b36ced3107eb0ac29ebb07ee | [] | no_license | DzianisSinkevich/java-db-test | 30da33a46ed0d057edf0a1291063d29ae2ca4ac0 | ad28f77a73c2178f110d1d530737704bf7020aa9 | refs/heads/master | 2020-04-06T07:02:05.335532 | 2016-10-12T10:47:32 | 2016-10-12T10:47:32 | 49,379,701 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 339 | java | package com.danco.bpc.service.api.PRICE;
import java.util.ArrayList;
import com.danco.bpc.entity.PRICE.PrcMessagesErrors;
import com.danco.bpc.service.api.IGenericService;
public interface IPrcMessagesErrorsService extends IGenericService<PrcMessagesErrors> {
public ArrayList<PrcMessagesErrors> getErrors(Long id) throws Exception;
}
| [
"dzianis_sinkevich@dancosoft.com"
] | dzianis_sinkevich@dancosoft.com |
cf58d8a560db08d42be229d5450e68a1e49dd609 | ceb37d74e9d6e713cb10b74b3ca7fef1d04e77c8 | /src/com/maadlabs/blocko/model/MySQLiteHelper.java | 67e4039ac93f0557324a12d778ff2e387bd62929 | [] | no_license | sreeram103610/BlockOApp | 1fc49f992f2715cf743b82a6951f966590c98886 | 406fec191853dffd0640356ec1fe5f95d7ca7b5e | refs/heads/master | 2021-01-13T01:59:31.622306 | 2014-10-30T18:40:57 | 2014-10-30T18:40:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 647 | java | package com.maadlabs.blocko.model;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class MySQLiteHelper extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1;
public static final String DATABASE_NAME = "blockODatabase";
public MySQLiteHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
// TODO Auto-generated constructor stub
}
@Override
public void onCreate(SQLiteDatabase db) {
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
| [
"sree@maadlabs.com"
] | sree@maadlabs.com |
812a75c4aa31f7d4ee0aec72e66cdc9abc94f530 | ca030864a3a1c24be6b9d1802c2353da4ca0d441 | /classes5.dex_source_from_JADX/com/facebook/graphql/model/GraphQLFollowUpFeedUnitsConnection$1.java | 5661c0d6f73f015cf9599f2ca4e1ce1ec194cdf2 | [] | no_license | pxson001/facebook-app | 87aa51e29195eeaae69adeb30219547f83a5b7b1 | 640630f078980f9818049625ebc42569c67c69f7 | refs/heads/master | 2020-04-07T20:36:45.758523 | 2018-03-07T09:04:57 | 2018-03-07T09:04:57 | 124,208,458 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 530 | java | package com.facebook.graphql.model;
import android.os.Parcel;
import android.os.Parcelable.Creator;
/* compiled from: hdAtomSize */
final class GraphQLFollowUpFeedUnitsConnection$1 implements Creator<GraphQLFollowUpFeedUnitsConnection> {
GraphQLFollowUpFeedUnitsConnection$1() {
}
public final Object createFromParcel(Parcel parcel) {
return new GraphQLFollowUpFeedUnitsConnection(parcel);
}
public final Object[] newArray(int i) {
return new GraphQLFollowUpFeedUnitsConnection[i];
}
}
| [
"son.pham@jmango360.com"
] | son.pham@jmango360.com |
3a9e512568d509f71562e4020c8782dfb60e1afb | e1a1c0ecd5f77d1c2ed6ae87436cb38cf37b2190 | /src/main/java/org/agilewiki/jasocket/commands/CommandAgent.java | 8adace1f25e319a3fbffeb7bcae906b8fdbf9072 | [] | no_license | luciendra/JASocket | c79cf216ffa27c6293b74c9ead7ad8c4eababda3 | 4ec753d23b236b92a66d32e3bd42069e3382107d | refs/heads/master | 2020-12-25T01:44:43.045143 | 2012-12-08T04:26:31 | 2012-12-08T04:26:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,421 | java | /*
* Copyright 2012 Bill La Forge
*
* This file is part of AgileWiki and is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License (LGPL) as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* or navigate to the following url http://www.gnu.org/licenses/lgpl-2.1.txt
*
* Note however that only Scala, Java and JavaScript files are being covered by LGPL.
* All other files are covered by the Common Public License (CPL).
* A copy of this license is also included and can be
* found as well at http://www.opensource.org/licenses/cpl1.0.txt
*/
package org.agilewiki.jasocket.commands;
import org.agilewiki.jactor.RP;
import org.agilewiki.jactor.factory.JAFactory;
import org.agilewiki.jasocket.jid.agent.AgentJid;
import org.agilewiki.jid.JidFactories;
import org.agilewiki.jid.collection.vlenc.BListJid;
import org.agilewiki.jid.scalar.vlens.string.StringJid;
import java.util.Iterator;
abstract public class CommandAgent extends AgentJid {
protected BListJid<StringJid> out;
public void setCommandLineString(String commandLine) throws Exception {
}
protected Commands commands() {
return (Commands) getAncestor(Commands.class);
}
protected Command getCommand(String name) {
return commands().get(name);
}
protected Iterator<String> commandIterator() {
return commands().iterator();
}
protected void println(String v) throws Exception {
out.iAdd(-1);
StringJid sj = out.iGet(-1);
sj.setValue(v);
}
abstract protected void process(RP rp) throws Exception;
@Override
public void start(RP rp) throws Exception {
out = (BListJid<StringJid>) JAFactory.newActor(
this, JidFactories.STRING_BLIST_JID_TYPE, getMailboxFactory().createMailbox());
process(rp);
}
}
| [
"laforge49@gmail.com"
] | laforge49@gmail.com |
e32fdb3e6e4a3b593d60418b8d884d6cc5a522d5 | 17b2223310983f0252ff58ac3f395cf9503f0fa2 | /services/hrdb/src/com/auto_wihrycxpim/hrdb/service/HrdbQueryExecutorServiceImpl.java | 11d0005738e69b025db1a23d6e3aef243b4d2229 | [] | no_license | wavemakerapps/Auto_wIHRycXPIM | f04cbc215665064a7940409d10f88cf01a16673a | f464925a6b1fd8369b2869feb51b2866d43da1ad | refs/heads/master | 2021-08-08T06:59:52.537801 | 2017-11-09T20:42:51 | 2017-11-09T20:42:51 | 110,164,134 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,053 | java | /*Copyright (c) 2016-2017 wavemaker.com All Rights Reserved.
This software is the confidential and proprietary information of wavemaker.com You shall not disclose such Confidential Information and shall use it only in accordance
with the terms of the source code license agreement you entered into with wavemaker.com*/
package com.auto_wihrycxpim.hrdb.service;
/*This is a Studio Managed File. DO NOT EDIT THIS FILE. Your changes may be reverted by Studio.*/
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import com.wavemaker.runtime.data.dao.query.WMQueryExecutor;
@Service
public class HrdbQueryExecutorServiceImpl implements HrdbQueryExecutorService {
private static final Logger LOGGER = LoggerFactory.getLogger(HrdbQueryExecutorServiceImpl.class);
@Autowired
@Qualifier("hrdbWMQueryExecutor")
private WMQueryExecutor queryExecutor;
}
| [
"appTest1@wavemaker.com"
] | appTest1@wavemaker.com |
ef0036108b2116dc3e3d6729b5e4ecf4faded628 | 1304e5f703b2fd682603e676a4156ce9e944febc | /xbms/index-server/src/main/java/com/pl/model/ReportJiangxiFamilyPlanning.java | 109388266ab471cf905b5e1d074488ef7fdfeaf7 | [] | no_license | HuangGuangLei666/xbms | 1a726298ae72454bfc8b22c1cbe348aed7387cc1 | 535952f652fa716e8fce677ccfc29898d9c73dae | refs/heads/master | 2022-12-10T10:29:25.975200 | 2019-11-19T02:57:40 | 2019-11-19T02:57:40 | 222,399,619 | 0 | 0 | null | 2022-12-06T00:44:08 | 2019-11-18T08:32:09 | Java | UTF-8 | Java | false | false | 3,848 | java | package com.pl.model;
import java.io.Serializable;
import java.util.Date;
public class ReportJiangxiFamilyPlanning implements Serializable {
private Integer id;
private Long dialogId;
private String phone;
private String name;
private String medicalExamination;
private String free;
private String satisfaction;
private String status;
private String createBy;
private Date createDate;
private String updateBy;
private Date updateDate;
private String remark;
private static final long serialVersionUID = 1L;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Long getDialogId() {
return dialogId;
}
public void setDialogId(Long dialogId) {
this.dialogId = dialogId;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone == null ? null : phone.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getMedicalExamination() {
return medicalExamination;
}
public void setMedicalExamination(String medicalExamination) {
this.medicalExamination = medicalExamination == null ? null : medicalExamination.trim();
}
public String getFree() {
return free;
}
public void setFree(String free) {
this.free = free == null ? null : free.trim();
}
public String getSatisfaction() {
return satisfaction;
}
public void setSatisfaction(String satisfaction) {
this.satisfaction = satisfaction == null ? null : satisfaction.trim();
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status == null ? null : status.trim();
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy == null ? null : createBy.trim();
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy == null ? null : updateBy.trim();
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", dialogId=").append(dialogId);
sb.append(", phone=").append(phone);
sb.append(", name=").append(name);
sb.append(", medicalExamination=").append(medicalExamination);
sb.append(", free=").append(free);
sb.append(", satisfaction=").append(satisfaction);
sb.append(", status=").append(status);
sb.append(", createBy=").append(createBy);
sb.append(", createDate=").append(createDate);
sb.append(", updateBy=").append(updateBy);
sb.append(", updateDate=").append(updateDate);
sb.append(", remark=").append(remark);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | [
"1144716956@qq.com"
] | 1144716956@qq.com |
c96941a30903a8295e9560e79a76e57f8bf1092c | 46a720356159eef917d46f011cf41de394cfa38b | /src/main/java/com/blz/algorithm/BinarySearch.java | d6b35a285fea9e2bc60684544be588afa85a9e5f | [] | no_license | saurabhsiddharth68/AlgorithmProgram | cbc12742cd4027b904f3a4515b159a96274d4097 | 09e5e6780bd9d80f497a751c5309aa1c75bd6ff7 | refs/heads/master | 2023-08-28T15:00:12.724284 | 2021-10-20T16:45:51 | 2021-10-20T16:45:51 | 419,397,215 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,363 | java | package com.blz.algorithm;
import java.util.Arrays;
import java.util.Scanner;
public class BinarySearch {
public static void main(String[] args) {
BinarySearch binaryObj = new BinarySearch();
Scanner scanner = new Scanner(System.in);
String[] wordList = {"hero", "bmw", "ducati", "tvs", "yamaha"};
Arrays.sort(wordList);
System.out.println("List of Words :");
System.out.println(Arrays.toString(wordList));
System.out.println("Enter the word you want to search");
String searchName = scanner.nextLine();
scanner.close();
int result = binaryObj.binarySearch(wordList, searchName);
if (result == -1)
System.out.println("word is not present in the list");
else
System.out.println("word is found at "
+ "index " + result);
}
public int binarySearch(String[] wordList, String searchName) {
int start = 0, length = wordList.length - 1;
while (start <= length) {
int middle = start + (length - start) / 2;
int result = searchName.compareTo(wordList[middle]);
if (result == 0)
return middle;
if (result > 0)
start = middle + 1;
else
length = middle - 1;
}
return -1;
}
}
| [
"saurabhsiddharth68"
] | saurabhsiddharth68 |
2d8cd4ae7be9dcf93a4875f11db55eabf0b07a0e | 48d14428252e431628e34aeca2068b181a68c830 | /backend/src/main/java/br/com/les/backend/navigator/NavigatorContext.java | cb0cd5df8a9efcb10da17d0416ab34db174ade63 | [] | no_license | WesleyJSO/LES | d62b2a4148845b77b2bf0e4d423e8e8031cbcc58 | 20cc9448072ec6469822c3818597614108e07c17 | refs/heads/master | 2023-03-04T12:37:40.210664 | 2022-02-27T13:01:13 | 2022-02-27T13:01:13 | 144,155,209 | 7 | 2 | null | 2023-02-28T04:43:54 | 2018-08-09T13:18:36 | Java | UTF-8 | Java | false | false | 1,000 | java | package br.com.les.backend.navigator;
import java.util.HashMap;
import java.util.Map;
import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;
@Component
@Scope(proxyMode = ScopedProxyMode.TARGET_CLASS, value = "prototype")
public class NavigatorContext implements INavigatorContext {
private Map<String, Object> params;
public NavigatorContext() {
this.params = new HashMap<>();
}
public Map<String, Object> getParams() {
return new HashMap<>(this.params);
}
@Override
public void setAttribute(String key, Object attribute) {
this.params.put(key, attribute);
}
@Override
@SuppressWarnings("unchecked")
public <R> R getAttribute(String key) {
return (R) params.get(key);
}
@Override
public Map<String, Object> getAttributes() {
return params;
}
@Override
public void setAttributes(Map<String, Object> attributes) {
this.params.putAll(attributes);
}
}
| [
"wesley.silva@muralis.com.br"
] | wesley.silva@muralis.com.br |
f08da247f727953b6b33ee73524a0d1ce44a8f66 | 451d574cd7f7b9596c0305487fc69e1e243b53a0 | /demoTest/src/main/java/com/tsn/main.java | 51be9c52590f49b36b65a6a8f9a18e50a557963a | [] | no_license | tsn778/mySpringTest | c0d3740d16017deb2f94287df13dce27fd50b473 | 850052f09fc14973b1f27473af7d75194b186d29 | refs/heads/master | 2023-06-15T14:39:30.180283 | 2021-07-08T06:30:05 | 2021-07-08T06:30:05 | 383,708,210 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,253 | java | package com.tsn;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import com.baomidou.mybatisplus.generator.config.GlobalConfig;
import com.baomidou.mybatisplus.generator.config.PackageConfig;
import com.baomidou.mybatisplus.generator.config.StrategyConfig;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
public class main {
public static void main(String[] args) {
//创建generator对象
AutoGenerator autoGenerator = new AutoGenerator();
//数据源
DataSourceConfig dataSourceConfig = new DataSourceConfig();
dataSourceConfig.setDbType(DbType.MYSQL);
dataSourceConfig.setUrl("jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8");
dataSourceConfig.setUsername("root");
dataSourceConfig.setPassword("123456");
dataSourceConfig.setDriverName("com.mysql.cj.jdbc.Driver");
autoGenerator.setDataSource(dataSourceConfig);
//全局配置
GlobalConfig globalConfig = new GlobalConfig();
globalConfig.setOutputDir(System.getProperty("user.dir")+"/src/main/java");
globalConfig.setOpen(false);
globalConfig.setAuthor("tsn");
globalConfig.setServiceName("%sService");
autoGenerator.setGlobalConfig(globalConfig);
//包信息
PackageConfig packageConfig = new PackageConfig();
packageConfig.setParent("com");//改
packageConfig.setModuleName("tsn");//改
packageConfig.setController("controller");
packageConfig.setService("service");
packageConfig.setServiceImpl("service.impl");
packageConfig.setMapper("mapper");
packageConfig.setEntity("entity");
autoGenerator.setPackageInfo(packageConfig);
//配置策略
StrategyConfig strategyConfig = new StrategyConfig();
strategyConfig.setEntityLombokModel(true);
strategyConfig.setNaming(NamingStrategy.underline_to_camel);
strategyConfig.setColumnNaming(NamingStrategy.underline_to_camel);
autoGenerator.setStrategy(strategyConfig);
autoGenerator.execute();
}
} | [
"tsn778@126.com"
] | tsn778@126.com |
cdf0b365d009f96d23f4fc90b4322d3d9c134764 | 1f12cd6ce9a1a2db60cb98bd40961143619bcf00 | /taotao-manager/taotao-manager-mapper/src/main/java/com/zt/mapper/TbItemParamMapper.java | a67fa2f358fa5a8c4d781affdaf5c681c7a1ec40 | [] | no_license | luckHanZ/taotaodemo | d729d62d216720975db1821780de4b20a54a717c | 926fdbcc2c16744e96ccc9de4b11c3429571fc97 | refs/heads/master | 2023-04-27T13:44:18.422817 | 2019-03-17T15:05:55 | 2019-03-17T15:05:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,129 | java | package com.zt.mapper;
import com.zt.pojo.TbItemParam;
import com.zt.pojo.TbItemParamExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface TbItemParamMapper {
int countByExample(TbItemParamExample example);
int deleteByExample(TbItemParamExample example);
int deleteByPrimaryKey(Long id);
int insert(TbItemParam record);
int insertSelective(TbItemParam record);
List<TbItemParam> selectByExampleWithBLOBs(TbItemParamExample example);
List<TbItemParam> selectByExample(TbItemParamExample example);
TbItemParam selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") TbItemParam record, @Param("example") TbItemParamExample example);
int updateByExampleWithBLOBs(@Param("record") TbItemParam record, @Param("example") TbItemParamExample example);
int updateByExample(@Param("record") TbItemParam record, @Param("example") TbItemParamExample example);
int updateByPrimaryKeySelective(TbItemParam record);
int updateByPrimaryKeyWithBLOBs(TbItemParam record);
int updateByPrimaryKey(TbItemParam record);
} | [
"814124246@qq.com"
] | 814124246@qq.com |
765b2e196e2ca389bb574640fac703cee57fbacf | d4e6d4f7437c82482ad1f7079205e4a749c03985 | /src/java/ar/edu/unju/fi/apu/dao/imp/ram/TablaPaciente.java | cdee49da74967c9fc86af974677c9be90264cbd3 | [] | no_license | cristian04yamil/Veterinaria | 4aa45b12a200de37bac1ce3fc97dc43d9430a0f9 | 87c9e3c43ca258011481e199fe6ae794f4d126a0 | refs/heads/master | 2021-01-18T02:02:51.924423 | 2015-05-19T04:51:11 | 2015-05-19T04:51:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,159 | 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 ar.edu.unju.fi.apu.dao.imp.ram;
import ar.edu.unju.fi.apu.modelo.dominio.Paciente;
import ar.edu.unju.fi.apu.modelo.dominio.Propietario;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
/**
*
* @author Fernando
*/
public class TablaPaciente {
//solo era declarar la variable
public static List<Paciente> pacientes;
public static void llenarPacientes(){
pacientes=new ArrayList<>();
Calendar calendario = Calendar.getInstance();
calendario.set(2003, 2, 1);
Propietario propietario = new Propietario("domicilio 1","(54) 388 154346580","11.223.344","Cosio","David",calendario.getTime(),true);
pacientes.add(new Paciente(001, 2727, "michiBebe", calendario.getTime(), "Canino", 'M',propietario , null));
calendario.set(2011, 2, 1);
pacientes.add(new Paciente(002, 2728, "laika", calendario.getTime(), "Canino", 'H',propietario, null));
}
}
| [
"ser.cim90@gmail.com"
] | ser.cim90@gmail.com |
a45b52f068cecefd1a9ad628286021351a4c0c45 | f2395c2667f93df09d3e36542562ce2943925662 | /src/main/java/wenyu/jca/JCAUsage/SignatureDemo.java | 56280e094b7b108ae2c6d4af499a6d9b8aa715fc | [] | no_license | WenyuChang/JCAUsage | 089820aa0c343e8947446143f5bce4b8ad91d3e0 | 62f28737ee1fe8a1c595496fb37b410b37a209fe | refs/heads/master | 2021-01-10T21:26:48.793915 | 2014-10-30T02:43:50 | 2014-10-30T02:43:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,249 | java | package wenyu.jca.JCAUsage;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.Signature;
import javax.xml.bind.DatatypeConverter;
public class SignatureDemo {
public static final String algorithm = "SHA512withRSA"; // For demo, pls don't change
public PrivateKey privKey;
public PublicKey pubKey;
public Signature sign;
public byte[] signedResult;
public void initKey() throws Exception {
if(GeneralProperties.privKey == null || GeneralProperties.pubKey == null) {
SecureRandomDemo.ExportValue();
KeyPairGeneratorDemo.ExportValue();
privKey = GeneralProperties.privKey;
pubKey = GeneralProperties.pubKey;
}
}
public void initSignSignature() throws Exception {
if(StandardAlgorithmNameMapping.Signature.ifValid(algorithm)) {
sign = Signature.getInstance(algorithm);
} else {
System.out.println("Pls input correct algorithm.");
return;
}
initKey();
sign.initSign(privKey);
}
public void initVeriferSignature() throws Exception {
if(StandardAlgorithmNameMapping.Signature.ifValid(algorithm)) {
sign = Signature.getInstance(algorithm);
} else {
System.out.println("Pls input correct algorithm.");
return;
}
initKey();
sign.initVerify(pubKey);
}
public void sign(String[] messages) throws Exception {
initSignSignature();
for(String message:messages) {
sign.update(message.getBytes());
}
signedResult = sign.sign();
System.out.println("The signed result is: " + DatatypeConverter.printBase64Binary(signedResult));
}
public void verify(String[] messages) throws Exception {
if(signedResult == null) {
return;
}
initVeriferSignature();
for(String message:messages) {
sign.update(message.getBytes());
}
boolean result = sign.verify(signedResult);
String resultMessage = result?"Successed":"Failed";
System.out.println(String.format("%s to verify!", resultMessage));
}
public static void main(String[] args) throws Exception {
String[] messages = {"message-1", "message-2", "message-3"};
String[] messages1 = {"message-3", "message-4", "message-5"};
SignatureDemo demo = new SignatureDemo();
demo.sign(messages);
demo.verify(messages);
demo.verify(messages1);
}
}
| [
"changwy_1987@hotmail.com"
] | changwy_1987@hotmail.com |
5a03446464fe9900fff8b1a03214fbc51d4ce7dc | 837cd9aad0a7e41b56ae52cd6603bd85d3760111 | /sample/src/test/java/com/lazerycode/selenium/tests/sample/realexample/PaycoTest.java | 7b53db03af35cf8960cdc90b5f7d607e1aaf516e | [] | no_license | hyunil-shin/SeleniumTraining | 04a1105c7f709fc67f0bf859d3d18fa244d9daf1 | dce73b8a8a864069fb0f8c9d5bba60b1732ec51d | refs/heads/master | 2021-10-07T20:19:39.746076 | 2018-12-05T02:45:08 | 2018-12-05T02:45:08 | 111,078,015 | 0 | 0 | null | 2018-04-30T02:24:50 | 2017-11-17T08:28:26 | null | UTF-8 | Java | false | false | 1,948 | java | package com.lazerycode.selenium.tests.sample.realexample;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import com.lazerycode.selenium.DriverBase;
import static org.fest.assertions.api.Assertions.*;
/**
*
*
*/
public class PaycoTest extends DriverBase {
static WebDriver driver;
static String url = "https://www.payco.com/";
static String login_id = "";
static String login_pw = "";
@BeforeClass
public static void beforeClass() throws Exception {
driver = getDriver();
WebDriverWait wait = new WebDriverWait(driver, 10);
driver.get(url);
// login
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id='gnbGlobalInfo']/ul[2]/li[1]"))).click();
String a = driver.getWindowHandle();
driver.switchTo().window("PaycoLoginPopup");
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("id")));
driver.findElement(By.id("id")).sendKeys(login_id);
driver.findElement(By.id("pw")).sendKeys(login_pw);
driver.findElement(By.id("loginBtn")).submit();
driver.switchTo().window(a);
System.out.println(driver.getCurrentUrl());
}
@Before
public void setup() throws Exception {
}
@Test
public void checkPayments() {
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id='lnb']/li[4]/a"))).click();
WebElement paymentCount = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//*[@id='content']/div[2]/div[1]/div[1]/dl/dd/span[1]/a/span[1]")));
System.out.println("4월 결제내역: " + paymentCount.getText() + "건");
}
}
| [
"hyunil.shin@nhnent.com"
] | hyunil.shin@nhnent.com |
4be641c62e91227e481c357db0971b5ecfe57950 | 46cf3cf4b111f78d32cce77631ea4e2be74a11cf | /src/test/java/org/assertj/core/internal/iterables/Iterables_assertHasSameSizeAs_with_Iterable_Test.java | 4c657e348961f400fd9a7ecb04a062040de1e5be | [
"Apache-2.0"
] | permissive | KBiron/assertj-core | 269c4c1349c88087d3462b696c646f230b80be2f | 8940a37eb89e98ca0ffafbc2e6329c9247054077 | refs/heads/master | 2021-01-17T20:34:25.469725 | 2013-12-23T13:10:29 | 2013-12-23T13:10:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,198 | java | /*
* Created on Apr 27, 2010
*
* 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.
*
* Copyright @2010-2015 the original author or authors.
*/
package org.assertj.core.internal.iterables;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.error.ShouldHaveSameSizeAs.shouldHaveSameSizeAs;
import static org.assertj.core.test.TestData.someInfo;
import static org.assertj.core.test.TestFailures.failBecauseExpectedAssertionErrorWasNotThrown;
import static org.assertj.core.util.FailureMessages.actualIsNull;
import static org.assertj.core.util.Lists.newArrayList;
import static org.mockito.Mockito.verify;
import java.util.Collection;
import org.assertj.core.api.AssertionInfo;
import org.assertj.core.internal.Iterables;
import org.assertj.core.internal.IterablesBaseTest;
import org.junit.Test;
/**
* Tests for <code>{@link Iterables#assertHasSameSizeAs(AssertionInfo, Iterable, Iterable)}</code>.
*
* @author Nicolas François
*/
public class Iterables_assertHasSameSizeAs_with_Iterable_Test extends IterablesBaseTest {
@Test
public void should_pass_if_size_of_actual_is_equal_to_expected_size() {
iterables.assertHasSameSizeAs(someInfo(), newArrayList("Yoda", "Luke"), newArrayList("Solo", "Leia"));
}
@Test
public void should_fail_if_actual_is_null() {
thrown.expectAssertionError(actualIsNull());
iterables.assertHasSameSizeAs(someInfo(), null, newArrayList("Solo", "Leia"));
}
@Test
public void should_fail_if_other_is_null() {
thrown.expectNullPointerException("The Iterable to compare actual size with should not be null");
Iterable<?> other = null;
iterables.assertHasSameSizeAs(someInfo(), newArrayList("Yoda", "Luke"), other);
}
@Test
public void should_fail_if_actual_size_is_not_equal_to_other_size() {
AssertionInfo info = someInfo();
Collection<String> actual = newArrayList("Yoda");
Collection<String> other = newArrayList("Solo", "Luke", "Leia");
try {
iterables.assertHasSameSizeAs(info, actual, other);
} catch (AssertionError e) {
assertThat(e).hasMessage(shouldHaveSameSizeAs(actual, actual.size(), other.size()).create(null));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
@Test
public void should_pass_if_actual_has_same_size_as_other_whatever_custom_comparison_strategy_is() {
iterablesWithCaseInsensitiveComparisonStrategy.assertHasSameSizeAs(someInfo(), newArrayList("Luke", "Yoda"), newArrayList("Solo", "Leia"));
}
@Test
public void should_fail_if_actual_is_null_whatever_custom_comparison_strategy_is() {
thrown.expectAssertionError(actualIsNull());
iterablesWithCaseInsensitiveComparisonStrategy.assertHasSameSizeAs(someInfo(), null, newArrayList("Solo", "Leia"));
}
@Test
public void should_fail_if_other_is_null_whatever_custom_comparison_strategy_is() {
thrown.expectNullPointerException("The Iterable to compare actual size with should not be null");
Iterable<?> other = null;
iterables.assertHasSameSizeAs(someInfo(), newArrayList("Yoda", "Luke"), other);
}
@Test
public void should_fail_if_actual_size_is_not_equal_to_other_size_whatever_custom_comparison_strategy_is() {
AssertionInfo info = someInfo();
Collection<String> actual = newArrayList("Yoda");
Collection<String> other = newArrayList("Solo", "Luke", "Leia");
try {
iterablesWithCaseInsensitiveComparisonStrategy.assertHasSameSizeAs(info, actual, other);
} catch (AssertionError e) {
assertThat(e).hasMessage(shouldHaveSameSizeAs(actual, actual.size(), other.size()).create(null));
return;
}
failBecauseExpectedAssertionErrorWasNotThrown();
}
}
| [
"joel.costigliola@gmail.com"
] | joel.costigliola@gmail.com |
eec551dee4951ccd1a83518a724f66e3704d6807 | a2c8a3ebd97519334ece955c985fa4357c1d7076 | /src/projavafx/motivatingexample/JavaFXBeanModelHalfLazyExample.java | 576745bb3ba6b81658573f135c761610b15a1181 | [] | no_license | orb1t/JavaProFX | d92772df2c613feae343b5c3a0a17090d2b10805 | 6634abb6154681d686f49e6519a0b4c3e2f1251e | refs/heads/master | 2020-04-11T10:57:00.026944 | 2012-06-26T12:54:56 | 2012-06-26T12:54:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 664 | java | package projavafx.motivatingexample;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
public class JavaFXBeanModelHalfLazyExample {
private static final String DEFAULT_STR = "Hello";
private StringProperty str;
public final String getString() {
if (str != null) {
return str.get();
} else {
return DEFAULT_STR;
}
}
public final void setStr(String str) {
if ((this.str != null) || !(str.equals(DEFAULT_STR))) {
strProperty().set(str);
}
}
public StringProperty strProperty() {
if (str == null) {
str = new SimpleStringProperty(this, "str", DEFAULT_STR);
}
return str;
}
}
| [
"i-boy_1204_y.i@auone.jp"
] | i-boy_1204_y.i@auone.jp |
08194b1f9e93d86c983db90fd3f5a8f216eb5642 | acb27852de415f88d6a6a998efe8162e6297a18a | /src/com/maiseenok/second_homework/Task8/Runner.java | 9d6b459344485c7cbdbeb84b9554f43764244717 | [] | no_license | MaiseenokAlex/COURSE-BelHard | 71f747be479bfad3798cd2657726fba8f704c333 | 031ac3d16ece4e042b7050ffb50c214aeab4002a | refs/heads/master | 2021-07-10T21:41:59.806224 | 2018-10-16T12:09:18 | 2018-10-16T12:09:18 | 125,559,572 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 652 | java | package com.maiseenok.second_homework.task8;
public class Runner {
public static void main(String[] args) {
Kettle device1 = new Kettle();
System.out.println("Hot water status: " + device1.isHotWater());
device1.on();
device1.off();
System.out.println("Hot water status: " + device1.isHotWater() + "\n");
Heater device2 = new Heater();
System.out.println("Temperature is " + Heater.temperature);
device2.on();
device2.off();
System.out.println("Temperature is " + Heater.temperature + "\n");
device2.autoOn();
Heater.temperature = 10;
device2.autoOn();
System.out.println("Temperature is " + Heater.temperature);
}
}
| [
"mais.tut@gmail.com"
] | mais.tut@gmail.com |
e0522bb3d6461d2f1e940229535cd312971c238d | 9b75d8540ff2e55f9ff66918cc5676ae19c3bbe3 | /bazaar8.apk-decompiled/sources/j/a/a/f.java | e8cfb23c64692edfb70478d338378657b1931b4e | [] | no_license | BaseMax/PopularAndroidSource | a395ccac5c0a7334d90c2594db8273aca39550ed | bcae15340907797a91d39f89b9d7266e0292a184 | refs/heads/master | 2020-08-05T08:19:34.146858 | 2019-10-06T20:06:31 | 2019-10-06T20:06:31 | 212,433,298 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 487 | java | package j.a.a;
import java.io.IOException;
import k.y;
/* compiled from: DiskLruCache */
class f extends i {
/* renamed from: c reason: collision with root package name */
public final /* synthetic */ h f15278c;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public f(h hVar, y yVar) {
super(yVar);
this.f15278c = hVar;
}
public void a(IOException iOException) {
this.f15278c.n = true;
}
}
| [
"MaxBaseCode@gmail.com"
] | MaxBaseCode@gmail.com |
fe1ad0455041c0ad5f64dc95f4c515c2d254c8f7 | b2af7db82f7945963b5812b9992063d3e747f219 | /src/main/java/com/ws/customerservice/service/OrderService.java | 8362dca23e460f56d8006b50e2b5095f51c21982 | [] | no_license | CyndeeShank/CustomerService | b9c44ec1b15ca6638e5049b8940a94decd676f84 | b0297cf37fb70af7e5e51937d7bf89c2a37e809a | refs/heads/master | 2021-01-19T16:59:29.863276 | 2017-04-14T20:48:18 | 2017-04-14T20:48:18 | 88,296,937 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,390 | java | package com.ws.customerservice.service;
import com.ws.customerservice.dao.OrderDao;
import com.ws.customerservice.dto.order.*;
import com.ws.customerservice.model.StatusDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* ----------------------------------------------------------------------------
* - Title: Order Service
* - Description: This class contains the service calls for the Order portion
* of the Customer Service Application
* - Copyright: Copyright (c) 2016
* - Company: Wet Seal, LLC
* - @author <a href="Cyndee.Shank@wetseal.com">Cyndee Shank</a>
* - @package: com.ws.customerservice.service
* - @date: 5/20/16
* - @version $Rev$
* - 5/20/16 - Cyndee Shank - Created the file
* --------------------------------------------------------------------------
*/
@Slf4j
@Service
public class OrderService {
@Autowired
private OrderDao orderDao;
private List<OrderDto> currentOrderDtoList;
public List<OrderDto> getNewOrders() {
List<OrderDto> orderDtoList = orderDao.daoGetOrders(OrderDto.ORDER_STATUS.NEW);
currentOrderDtoList = orderDtoList;
return orderDtoList;
}
public List<OrderDto> getDistributionOrders() {
List<OrderDto> orderDtoList = orderDao.daoGetOrders(OrderDto.ORDER_STATUS.SENT_TO_DIST);
currentOrderDtoList = orderDtoList;
return orderDtoList;
}
/**
* Test -- this method currently only returns my (cyndee's) order for testing purposes
* @return
*/
public List<OrderDto> getShippedOrders() {
//List<OrderDto> orderDtoList = orderDao.daoGetOrders(OrderDto.ORDER_STATUS.SHIPPED);
List<OrderDto> orderDtoList = orderDao.daoGetOrdersTest();
currentOrderDtoList = orderDtoList;
return orderDtoList;
}
public List<OrderDto> getAutoHoldOrders() {
List<OrderDto> orderDtoList = orderDao.daoGetOrders(OrderDto.ORDER_STATUS.AUTO_HOLD);
currentOrderDtoList = orderDtoList;
return orderDtoList;
}
public List<OrderDto> getManualHoldOrders() {
List<OrderDto> orderDtoList = orderDao.daoGetOrders(OrderDto.ORDER_STATUS.MANUAL_HOLD);
currentOrderDtoList = orderDtoList;
return orderDtoList;
}
public List<OrderDto> getCancelledOrders() {
List<OrderDto> orderDtoList = orderDao.daoGetOrders(OrderDto.ORDER_STATUS.CANCELLED);
currentOrderDtoList = orderDtoList;
return orderDtoList;
}
public List<OrderDto> searchOrders(OrderSearchDto orderSearchDto) {
// add check for required fields based on searchType (number, cc, name, email)
List<OrderDto> orderDtoList = orderDao.daoSearchOrders(orderSearchDto);
currentOrderDtoList = orderDtoList;
return orderDtoList;
}
public List<OrderDto> getOrderByCard(String matchType, String number) {
List<OrderDto> orderDtoList = orderDao.daoSearchOrderByCard(matchType, number);
currentOrderDtoList = orderDtoList;
return orderDtoList;
}
public OrderDetailDto getOrderDetailsById(Long orderId) {
OrderDto currentOrderDto = new OrderDto();
// figure out how to get the OrderDto object that was selected
// so we can pre-populate those fields and just add the new detail fields
for (OrderDto orderDto : currentOrderDtoList) {
if (orderDto.getOrderNo().equals(orderId)) {
BeanUtils.copyProperties(orderDto, currentOrderDto);
}
}
OrderDetailDto orderDetailDto = new OrderDetailDto();
// copy the OrderDto values into the new orderDetailDto object
if (currentOrderDto != null) {
BeanUtils.copyProperties(currentOrderDto, orderDetailDto);
orderDetailDto = orderDao.daoGetOrderDetailsById(orderId, orderDetailDto);
List<OrderLineItemDto> orderLineItemDtoList = orderDao.daoGetOrderLineItemsById(orderId);
orderDetailDto.setOrderLineItemDtoList(orderLineItemDtoList);
}
return orderDetailDto;
}
public List<OrderStatusDto> getOrderStatusById(Long orderId) {
List<OrderStatusDto> orderStatusDtoList = orderDao.daoGetOrderStatusById(orderId);
return orderStatusDtoList;
}
public List<OrderPaymentDto> getOrderPaymentById(Long orderId) {
List<OrderPaymentDto> orderPaymentDtoList = orderDao.daoGetOrderPaymentById(orderId);
return orderPaymentDtoList;
}
public OrderDetailDto getOrderNoForInvoiceNo(String invoiceNo) {
Long orderNo = orderDao.daoGetOrderNoFromInvoiceNo(invoiceNo);
OrderDetailDto orderDetailDto = new OrderDetailDto();
orderDetailDto = orderDao.daoGetOrderDetailsById(orderNo, orderDetailDto);
orderDetailDto.setOrderNo(orderNo);
orderDetailDto.setInvoiceNo(Long.valueOf(invoiceNo));
List<OrderLineItemDto> orderLineItemDtoList = orderDao.daoGetOrderLineItemsById(orderNo);
orderDetailDto.setOrderLineItemDtoList(orderLineItemDtoList);
return orderDetailDto;
}
public StatusDto resubmitOrder(Long orderId) {
StatusDto statusDto = orderDao.daoResubmitOrder(orderId);
return statusDto;
}
}
| [
"cyndee.shank@gmail.com"
] | cyndee.shank@gmail.com |
5d682bc41f3f53d2f3616993e4c34e4b3f0cabe4 | 465ed76dda2d590e3d518810f6028776ba94c91e | /src/com/kevin/testguide/GuideActivity.java | 7b6678de23aab256bd8db277cd8779ca1888d985 | [] | no_license | student9128/TestGuide | 53839000a6ba4b5e205fc63e65a86fd3d8763754 | 8ec4150a5f860d2725566b2e4da9dc31fc40c69a | refs/heads/master | 2021-01-10T03:30:42.667591 | 2016-03-20T03:00:50 | 2016-03-20T03:56:25 | 54,297,486 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 4,153 | java | package com.kevin.testguide;
import java.util.ArrayList;
import java.util.List;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import com.kevin.testguide.fragment.Fragment1;
import com.kevin.testguide.fragment.Fragment2;
import com.kevin.testguide.fragment.Fragment3;
public class GuideActivity extends FragmentActivity {
private ViewPager viewPager;
private Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.guide);
viewPager = (ViewPager) findViewById(R.id.view_pager);
button = (Button) findViewById(R.id.button);
initData();// 将图片初始化
// MyAdapter adapter = new MyAdapter();
MyFragmentPagerAdapter adapter = new MyFragmentPagerAdapter(
getSupportFragmentManager());
viewPager.setAdapter(adapter);
viewPager.setOnPageChangeListener(new OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
if (position == imageResId.length - 1) {
button.setVisibility(View.VISIBLE);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(GuideActivity.this,
MainActivity.class));
finish();
}
});
}
}
@Override
public void onPageScrolled(int position, float positionOffset,
int positionOffsetPixels) {
// TODO Auto-generated method stub
}
@Override
public void onPageScrollStateChanged(int state) {
// TODO Auto-generated method stub
}
});
}
private int[] imageResId = new int[] { R.drawable.guide_1,
R.drawable.guide_2, R.drawable.guide_3 };
private List<ImageView> imageViewList = new ArrayList<ImageView>();
private void initData() {
for (int i = 0; i < imageResId.length; i++) {
ImageView imageView = new ImageView(getBaseContext());
imageView.setImageResource(imageResId[i]);
imageView.setScaleType(ScaleType.FIT_XY);
imageViewList.add(imageView);// 放入集合中
}
}
public class MyAdapter extends PagerAdapter {
@Override
public int getCount() {
return imageResId.length;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
// 根据位置获取图片
ImageView imageView = imageViewList.get(position);
container.addView(imageView);// 将图片添加到容器中
return imageView;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
// 将图片从容器中移除
((ViewPager) container).removeView((View) object);
}
/**
* objcet指的是容器中的对象,view指的是instantiateItem返回的imageView
*/
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
}
public class MyFragmentPagerAdapter extends FragmentPagerAdapter {
public MyFragmentPagerAdapter(FragmentManager fm) {
super(fm);
// TODO Auto-generated constructor stub
}
@Override
public Fragment getItem(int position) {
Fragment fragment = null;
switch (position) {
case 0:
fragment = new Fragment1();
break;
case 1:
fragment = new Fragment2();
break;
case 2:
fragment = new Fragment3();
break;
default:
break;
}
return fragment;
}
@Override
public int getCount() {
return imageResId.length;
}
}
}
| [
"1367900516@qq.com"
] | 1367900516@qq.com |
03a3e7a60694f1ffb44c98d3d6e1cbd2f1c98362 | 03b95b47ac45714bf07d27705d8c18881daeb669 | /src/com/dr/service/impl/UserServiceImpl.java | 7958140f9f9b5074670e2d7dd86a71c73b613bdf | [] | no_license | durui01/hss | 9bc8481434cc5ab00787c26a12ec190c8e6276b2 | 1eed8c0ff90a7dcb7eeaa07e33663539b0aa7e29 | refs/heads/master | 2021-01-12T01:41:40.548861 | 2017-01-09T10:51:29 | 2017-01-09T10:51:29 | 78,420,218 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 982 | java | package com.dr.service.impl;
import java.util.List;
import com.dr.bean.User;
import com.dr.dao.UserDAO;
import com.dr.service.UserService;
public class UserServiceImpl implements UserService {
private UserDAO dao;
public UserDAO getDao() {
return dao;
}
public void setDao(UserDAO dao) {
this.dao = dao;
}
@Override
public void doCreatUser(User user) {
// TODO Auto-generated method stub
this.dao.doCreatUser(user);
}
@Override
public List<User> findAllUsers() {
// TODO Auto-generated method stub
return this.dao.findAllUsers();
}
@Override
public void delete(User user) {
// TODO Auto-generated method stub
this.dao.removeUser(user);
}
@Override
public void update(User user) {
// TODO Auto-generated method stub
this.dao.updateUser(user);
}
@Override
public User findUserById(int id) {
// TODO Auto-generated method stub
return this.dao.findUserById(id);
}
}
| [
"durui@hoolai.com"
] | durui@hoolai.com |
835f387bdf7223303119732dcf26d26079a94ff2 | a0aaefdd50df84ddc4a05cc6f6880ac58b4f94e7 | /src/test/java/com/cs499/assignment2/web/rest/AccountResourceIntTest.java | 74ccfa0e0e3f40f4564cda359abdad7fd3f68a69 | [] | no_license | jdhan96/CS499Assignment | d03a8550139e7ba7f54324ca026d05a6068c6afb | 7dc448ad2888994069a64136f0df8894eda4d96b | refs/heads/master | 2021-01-22T02:53:49.973306 | 2017-02-06T11:32:51 | 2017-02-06T11:32:51 | 81,080,207 | 0 | 1 | null | 2020-09-18T09:04:08 | 2017-02-06T11:26:34 | HTML | UTF-8 | Java | false | false | 16,139 | java | package com.cs499.assignment2.web.rest;
import com.cs499.assignment2.Assignment2App;
import com.cs499.assignment2.domain.Authority;
import com.cs499.assignment2.domain.User;
import com.cs499.assignment2.repository.AuthorityRepository;
import com.cs499.assignment2.repository.UserRepository;
import com.cs499.assignment2.security.AuthoritiesConstants;
import com.cs499.assignment2.service.MailService;
import com.cs499.assignment2.service.UserService;
import com.cs499.assignment2.service.dto.UserDTO;
import com.cs499.assignment2.web.rest.vm.ManagedUserVM;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import javax.inject.Inject;
import java.util.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Test class for the AccountResource REST controller.
*
* @see UserService
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Assignment2App.class)
public class AccountResourceIntTest {
@Inject
private UserRepository userRepository;
@Inject
private AuthorityRepository authorityRepository;
@Inject
private UserService userService;
@Mock
private UserService mockUserService;
@Mock
private MailService mockMailService;
private MockMvc restUserMockMvc;
private MockMvc restMvc;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
doNothing().when(mockMailService).sendActivationEmail((User) anyObject());
AccountResource accountResource = new AccountResource();
ReflectionTestUtils.setField(accountResource, "userRepository", userRepository);
ReflectionTestUtils.setField(accountResource, "userService", userService);
ReflectionTestUtils.setField(accountResource, "mailService", mockMailService);
AccountResource accountUserMockResource = new AccountResource();
ReflectionTestUtils.setField(accountUserMockResource, "userRepository", userRepository);
ReflectionTestUtils.setField(accountUserMockResource, "userService", mockUserService);
ReflectionTestUtils.setField(accountUserMockResource, "mailService", mockMailService);
this.restMvc = MockMvcBuilders.standaloneSetup(accountResource).build();
this.restUserMockMvc = MockMvcBuilders.standaloneSetup(accountUserMockResource).build();
}
@Test
public void testNonAuthenticatedUser() throws Exception {
restUserMockMvc.perform(get("/api/authenticate")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().string(""));
}
@Test
public void testAuthenticatedUser() throws Exception {
restUserMockMvc.perform(get("/api/authenticate")
.with(request -> {
request.setRemoteUser("test");
return request;
})
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().string("test"));
}
@Test
public void testGetExistingAccount() throws Exception {
Set<Authority> authorities = new HashSet<>();
Authority authority = new Authority();
authority.setName(AuthoritiesConstants.ADMIN);
authorities.add(authority);
User user = new User();
user.setLogin("test");
user.setFirstName("john");
user.setLastName("doe");
user.setEmail("john.doe@jhipter.com");
user.setAuthorities(authorities);
when(mockUserService.getUserWithAuthorities()).thenReturn(user);
restUserMockMvc.perform(get("/api/account")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.login").value("test"))
.andExpect(jsonPath("$.firstName").value("john"))
.andExpect(jsonPath("$.lastName").value("doe"))
.andExpect(jsonPath("$.email").value("john.doe@jhipter.com"))
.andExpect(jsonPath("$.authorities").value(AuthoritiesConstants.ADMIN));
}
@Test
public void testGetUnknownAccount() throws Exception {
when(mockUserService.getUserWithAuthorities()).thenReturn(null);
restUserMockMvc.perform(get("/api/account")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isInternalServerError());
}
@Test
@Transactional
public void testRegisterValid() throws Exception {
ManagedUserVM validUser = new ManagedUserVM(
null, // id
"joe", // login
"password", // password
"Joe", // firstName
"Shmoe", // lastName
"joe@example.com", // e-mail
true, // activated
"en", // langKey
new HashSet<>(Arrays.asList(AuthoritiesConstants.USER)),
null, // createdBy
null, // createdDate
null, // lastModifiedBy
null // lastModifiedDate
);
restMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(validUser)))
.andExpect(status().isCreated());
Optional<User> user = userRepository.findOneByLogin("joe");
assertThat(user.isPresent()).isTrue();
}
@Test
@Transactional
public void testRegisterInvalidLogin() throws Exception {
ManagedUserVM invalidUser = new ManagedUserVM(
null, // id
"funky-log!n", // login <-- invalid
"password", // password
"Funky", // firstName
"One", // lastName
"funky@example.com", // e-mail
true, // activated
"en", // langKey
new HashSet<>(Arrays.asList(AuthoritiesConstants.USER)),
null, // createdBy
null, // createdDate
null, // lastModifiedBy
null // lastModifiedDate
);
restUserMockMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(invalidUser)))
.andExpect(status().isBadRequest());
Optional<User> user = userRepository.findOneByEmail("funky@example.com");
assertThat(user.isPresent()).isFalse();
}
@Test
@Transactional
public void testRegisterInvalidEmail() throws Exception {
ManagedUserVM invalidUser = new ManagedUserVM(
null, // id
"bob", // login
"password", // password
"Bob", // firstName
"Green", // lastName
"invalid", // e-mail <-- invalid
true, // activated
"en", // langKey
new HashSet<>(Arrays.asList(AuthoritiesConstants.USER)),
null, // createdBy
null, // createdDate
null, // lastModifiedBy
null // lastModifiedDate
);
restUserMockMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(invalidUser)))
.andExpect(status().isBadRequest());
Optional<User> user = userRepository.findOneByLogin("bob");
assertThat(user.isPresent()).isFalse();
}
@Test
@Transactional
public void testRegisterInvalidPassword() throws Exception {
ManagedUserVM invalidUser = new ManagedUserVM(
null, // id
"bob", // login
"123", // password with only 3 digits
"Bob", // firstName
"Green", // lastName
"bob@example.com", // e-mail
true, // activated
"en", // langKey
new HashSet<>(Arrays.asList(AuthoritiesConstants.USER)),
null, // createdBy
null, // createdDate
null, // lastModifiedBy
null // lastModifiedDate
);
restUserMockMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(invalidUser)))
.andExpect(status().isBadRequest());
Optional<User> user = userRepository.findOneByLogin("bob");
assertThat(user.isPresent()).isFalse();
}
@Test
@Transactional
public void testRegisterDuplicateLogin() throws Exception {
// Good
ManagedUserVM validUser = new ManagedUserVM(
null, // id
"alice", // login
"password", // password
"Alice", // firstName
"Something", // lastName
"alice@example.com", // e-mail
true, // activated
"en", // langKey
new HashSet<>(Arrays.asList(AuthoritiesConstants.USER)),
null, // createdBy
null, // createdDate
null, // lastModifiedBy
null // lastModifiedDate
);
// Duplicate login, different e-mail
ManagedUserVM duplicatedUser = new ManagedUserVM(validUser.getId(), validUser.getLogin(), validUser.getPassword(), validUser.getLogin(), validUser.getLastName(),
"alicejr@example.com", true, validUser.getLangKey(), validUser.getAuthorities(), validUser.getCreatedBy(), validUser.getCreatedDate(), validUser.getLastModifiedBy(), validUser.getLastModifiedDate());
// Good user
restMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(validUser)))
.andExpect(status().isCreated());
// Duplicate login
restMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(duplicatedUser)))
.andExpect(status().is4xxClientError());
Optional<User> userDup = userRepository.findOneByEmail("alicejr@example.com");
assertThat(userDup.isPresent()).isFalse();
}
@Test
@Transactional
public void testRegisterDuplicateEmail() throws Exception {
// Good
ManagedUserVM validUser = new ManagedUserVM(
null, // id
"john", // login
"password", // password
"John", // firstName
"Doe", // lastName
"john@example.com", // e-mail
true, // activated
"en", // langKey
new HashSet<>(Arrays.asList(AuthoritiesConstants.USER)),
null, // createdBy
null, // createdDate
null, // lastModifiedBy
null // lastModifiedDate
);
// Duplicate e-mail, different login
ManagedUserVM duplicatedUser = new ManagedUserVM(validUser.getId(), "johnjr", validUser.getPassword(), validUser.getLogin(), validUser.getLastName(),
validUser.getEmail(), true, validUser.getLangKey(), validUser.getAuthorities(), validUser.getCreatedBy(), validUser.getCreatedDate(), validUser.getLastModifiedBy(), validUser.getLastModifiedDate());
// Good user
restMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(validUser)))
.andExpect(status().isCreated());
// Duplicate e-mail
restMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(duplicatedUser)))
.andExpect(status().is4xxClientError());
Optional<User> userDup = userRepository.findOneByLogin("johnjr");
assertThat(userDup.isPresent()).isFalse();
}
@Test
@Transactional
public void testRegisterAdminIsIgnored() throws Exception {
ManagedUserVM validUser = new ManagedUserVM(
null, // id
"badguy", // login
"password", // password
"Bad", // firstName
"Guy", // lastName
"badguy@example.com", // e-mail
true, // activated
"en", // langKey
new HashSet<>(Arrays.asList(AuthoritiesConstants.ADMIN)),
null, // createdBy
null, // createdDate
null, // lastModifiedBy
null // lastModifiedDate
);
restMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(validUser)))
.andExpect(status().isCreated());
Optional<User> userDup = userRepository.findOneByLogin("badguy");
assertThat(userDup.isPresent()).isTrue();
assertThat(userDup.get().getAuthorities()).hasSize(1)
.containsExactly(authorityRepository.findOne(AuthoritiesConstants.USER));
}
@Test
@Transactional
public void testSaveInvalidLogin() throws Exception {
UserDTO invalidUser = new UserDTO(
"funky-log!n", // login <-- invalid
"Funky", // firstName
"One", // lastName
"funky@example.com", // e-mail
true, // activated
"en", // langKey
new HashSet<>(Arrays.asList(AuthoritiesConstants.USER))
);
restUserMockMvc.perform(
post("/api/account")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(invalidUser)))
.andExpect(status().isBadRequest());
Optional<User> user = userRepository.findOneByEmail("funky@example.com");
assertThat(user.isPresent()).isFalse();
}
}
| [
"jdhan@cpp.edu"
] | jdhan@cpp.edu |
4e031b257f51a1d49a281c8244ca44d282ccf723 | d3239df248b621564115092faef26e43024d7e7b | /src/main/java/br/com/javaChallenge/webStore/resource/GrupoProdutosResource.java | c202b6de6a990e653700be9c170415c24d90182c | [] | no_license | lucasfealves/webStore | 3ee807ce3c8a553baa5c694fd77e8f259f10ffb5 | 44336cb773d406268df817c7f15214a07ef3f29b | refs/heads/master | 2022-12-17T10:56:18.635683 | 2020-09-21T13:19:36 | 2020-09-21T13:19:36 | 276,673,964 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,424 | java | package br.com.javaChallenge.webStore.resource;
import java.util.List;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import br.com.javaChallenge.webStore.core.IResource;
import br.com.javaChallenge.webStore.core.model.WebServiceResponse;
import br.com.javaChallenge.webStore.model.GrupoProduto;
import br.com.javaChallenge.webStore.service.GrupoProdutosService;
@RestController
@CrossOrigin("${origem-permitida}")
public class GrupoProdutosResource implements IResource<GrupoProduto> {
@Autowired
private GrupoProdutosService grupoProdutosService;
@Override
@GetMapping("/grupoProdutos")
public List<GrupoProduto> listar() {
return grupoProdutosService.listar();
}
@Override
@GetMapping("/grupoProdutos/{grupoId}")
public GrupoProduto editar(@PathVariable Long grupoId) {
return grupoProdutosService.editar(grupoId);
}
@Override
@PostMapping("/grupoProdutos")
public WebServiceResponse adicionar(@RequestBody @Valid GrupoProduto T) {
return grupoProdutosService.adicionar(T);
}
}
| [
"lucas.alves@quantus.com.br"
] | lucas.alves@quantus.com.br |
73eaea222edc47afdb07c94bbe54f199d5a0667c | 56255a760b5cfb45e6b083adc97138eb14235355 | /main/java/AddressBookController/AddressBookSystem.java | 63693c4ed6e0603273e4d923da531db0ed3075fd | [] | no_license | kumar804/Address-bookdb | cef0e489d4b7bc882903726ceb505f2dec569cef | 1b600357b5a378c65e9551a8b94915d7e87290f7 | refs/heads/main | 2023-07-16T19:41:39.041390 | 2021-08-24T05:39:52 | 2021-08-24T05:39:52 | 399,063,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,636 | java | package AddressBookController;
import AddressBookModel.PersonInfo;
import AddressBookService.AddressBook;
import Utill.UserInputOutput;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Scanner;
public class AddressBookSystem {
private static final int ADD = 1;
private static final int EDIT = 2;
private static final int DELETE = 3;
private static final int DISPLAY = 4;
private static final int SEARCH_CITY = 5;
private static final int SORT_DATA = 6;
private static final int QUIT = 7;
static AddressBook add_Book = new AddressBook();
static Scanner input = new Scanner(System.in);
public static void main(String args[]){
Hashtable<String, ArrayList<PersonInfo>> personInfoDict = new Hashtable<>();
boolean flag = true;
int option;
while(flag) {
option = UserInputOutput.menu();
switch (option) {
case ADD:
System.out.println("\n" + "Add a new Address Book");
personInfoDict = add_Book.insertContactDetails();
//System.out.println(personInfoDict + "\n");
break;
case EDIT:
System.out.print("\n" + "Enter the name of the Address Book that you want to replace: ");
String companyName = input.next();
add_Book.updateContact(companyName, personInfoDict);
break;
case DELETE:
System.out.print("\n" + "Enter the name of the Address Book that you want to delete: ");
String deletedName = input.next();
add_Book.deleteContact(deletedName, personInfoDict);
break;
case DISPLAY:
System.out.println("\n" + "Display all contacts in the Address Book");
add_Book.displayCompanyContacts(personInfoDict);
break;
case SEARCH_CITY:
System.out.println("\n" + "Search Address Book based on City or State");
add_Book.searchPerson();
flag = true;
break;
case SORT_DATA:
System.out.println("\n" + "Sort Address Book");
add_Book.sortPerson();
flag = true;
break;
case QUIT:
flag = false;
System.out.println("\n" + "Thank you for referring the address book.");
break;
}
}
}
}
| [
"kumarsinghmanish547@gmail.com"
] | kumarsinghmanish547@gmail.com |
3735fcf1c5b37ab29996441bfdae473891a4f3cb | bca92895afca88385a2d899e81a41e6628473ba3 | /app/src/main/java/com/meltwater/androidviper/presentation/ui/activity/MainActivity.java | 11a6ef767661b9cb93d3c1942933f7eaf173ede1 | [] | no_license | marcogalicia25/testviper | bdbadc56c53636205cd733aac9bbf0ce3be2582e | d08c3a90275fe5f6ef0708132e693f0360470214 | refs/heads/master | 2021-08-23T06:54:59.663286 | 2017-12-04T01:23:22 | 2017-12-04T01:23:22 | 112,674,237 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,134 | java | package com.meltwater.androidviper.presentation.ui.activity;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.meltwater.androidviper.R;
import com.meltwater.androidviper.presentation.presenter.CarBrandsPresenter;
import com.meltwater.androidviper.presentation.ui.Router.Router;
import com.meltwater.androidviper.presentation.ui.Router.RouterImp;
import com.meltwater.androidviper.presentation.view.CarBrandView;
import com.mswim.architecture.BaseActivity;
public class MainActivity extends BaseActivity<CarBrandView, CarBrandsPresenter> implements CarBrandView {
private TextView txtView;
private Button btnView;
private Button btnRouterView;
private Router router;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
txtView = findViewById(R.id.text_main);
btnView = findViewById(R.id.btn_go);
btnRouterView = findViewById(R.id.btn_router);
btnView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
getPresenter().getDatas();
}
});
btnRouterView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
getPresenter().routerNextScreen();
}
});
router = new RouterImp(this);
}
@NonNull
@Override
public CarBrandsPresenter createPresenter() {
return new CarBrandsPresenter();
}
@Override
protected void onResume() {
super.onResume();
getPresenter().attachView(this);
}
@Override
protected void onStop() {
super.onStop();
getPresenter().detachView();
}
@Override
public void showDatas(String data) {
txtView.setText(data);
}
@Override
public void goNextScreen() {
router.goNextScreen();
finish();
}
}
| [
"marco.galicia@meltwater.com"
] | marco.galicia@meltwater.com |
1179a40b8a524f8c687e1e82729666687c1dfdc5 | 86cbffe946d7301f2c4a23f443e55a6ccfa5a426 | /anet_java_sdk/src/test/java/net/authorize/sim/FingerprintTest.java | 3ec3dc4a84baae189fbc1c271e01d4c46e623012 | [
"Apache-2.0"
] | permissive | mazhar266/AIM-Test | 86443211d756824fb95bf0b8f64c97893667feec | 8a3c8328153b04f8d44d05a664870e85c9f09d46 | refs/heads/master | 2021-01-23T16:31:17.960298 | 2019-01-08T04:47:01 | 2019-01-08T04:47:01 | 18,871,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,713 | java | package net.authorize.sim;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.security.MessageDigest;
import junit.framework.Assert;
import net.authorize.UnitTestData;
import org.junit.Test;
public class FingerprintTest extends UnitTestData {
@Test
public void createFingerprintWithRawFields() {
Fingerprint fingerprint = Fingerprint.createFingerprint("loginID",
"transactionKey", 1, "1.99");
Assert.assertNotNull(fingerprint);
Assert.assertNotNull(fingerprint.getFingerprintHash());
Assert.assertEquals(32, fingerprint.getFingerprintHash().length());
Assert.assertTrue(fingerprint.getSequence() >= 0);
Assert.assertTrue(fingerprint.getTimeStamp() > 0);
}
@Test
public void createFingerprintWithObjectFields() {
Fingerprint fingerprint = Fingerprint.createFingerprint(merchant, 1,
new BigDecimal(1.99));
Assert.assertNotNull(fingerprint);
Assert.assertNotNull(fingerprint.getFingerprintHash());
Assert.assertEquals(32, fingerprint.getFingerprintHash().length());
Assert.assertTrue(fingerprint.getSequence() >= 0);
Assert.assertTrue(fingerprint.getTimeStamp() > 0);
}
@Test
public void testMD5HashVerification() {
String x_MD5_Hash = "CCF694F4A97B54462CE6329BEF6B0901";
String amount = "2.18";
String txnId = "2154896102";
String md5Check = null;
try {
MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
String s = merchantMD5Key + merchant.getLogin() + txnId + amount;
digest.update(s.getBytes());
md5Check = new BigInteger(1,digest.digest()).toString(16).toUpperCase();
} catch (Exception e) {
}
Assert.assertNotNull(md5Check);
Assert.assertEquals(md5Check, x_MD5_Hash);
}
}
| [
"mazhar266@gmail.com"
] | mazhar266@gmail.com |
c9a7ad1b8f4d2e79638480cd908f46dd099a796f | 3620d9c864353d0a50b1a8e23102dedcba6d561b | /src/java/edu/webapp1966781a/facade/RolFacadeLocal.java | ecc8acca89da050c709eb014f0cd37c72406ec9a | [] | no_license | josarta/WebApp1966781A | 0c52244f241c696e530dcb11b35362d624923025 | 545864fbd750466944a3df4a269323540b69943d | refs/heads/master | 2023-01-22T08:23:22.348354 | 2020-12-04T01:34:55 | 2020-12-04T01:34:55 | 311,831,513 | 10 | 1 | null | null | null | null | UTF-8 | Java | false | false | 606 | 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 edu.webapp1966781a.facade;
import edu.webapp1966781a.entity.Rol;
import java.util.List;
import javax.ejb.Local;
/**
*
* @author Usuario
*/
@Local
public interface RolFacadeLocal {
void create(Rol rol);
void edit(Rol rol);
void remove(Rol rol);
Rol find(Object id);
List<Rol> findAll();
List<Rol> findRange(int[] range);
int count();
}
| [
"Usuario@DESKTOP-99ROSGA"
] | Usuario@DESKTOP-99ROSGA |
27d48b4cd4db8ad15a5fc2aac00d11e68867fcab | d298c203168ede6c5ae7d8fa0878dd8efcafcd58 | /QuizApp/app/src/test/java/quizapp/iniyan/com/quizapp/ExampleUnitTest.java | 483022761175db45cef3980e151fa023f59b92ec | [] | no_license | iniyan455/QuizApp | 92708fece901be9bd0acf140af68a5a4f6ccb2ee | eafc558319b137710cb796c169d097f9c684012a | refs/heads/master | 2020-04-09T13:46:52.160058 | 2018-12-04T15:35:28 | 2018-12-04T15:35:28 | 160,380,781 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 387 | java | package quizapp.iniyan.com.quizapp;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"iniyan455@gmail.com"
] | iniyan455@gmail.com |
1cf833ec342aada756b59787cc03ac3b4def7d14 | 9a7e02510639e1a162e236cff18d6745c2dc2429 | /app/src/main/java/com/example/kkfreshfoods/RegisterActivity.java | c1afe21dfb9597155174b38a5a0cfae7b48d74d7 | [] | no_license | ssozi91/kkFreshFoods | 323394507c2ff7c3dbb78c34f0180370f6146b52 | e28b7f3e824ed8100e2f3e15b8343789d26d678d | refs/heads/master | 2021-09-24T23:01:40.968266 | 2021-09-23T03:48:29 | 2021-09-23T03:48:29 | 249,336,608 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,366 | java | package com.example.kkfreshfoods;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
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.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.HashMap;
public class RegisterActivity extends AppCompatActivity {
private Button CreateAccountButton;
private EditText InputName, InputPhoneNumber, InputPassword;
private ProgressDialog loadingBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
CreateAccountButton = (Button) findViewById(R.id.register_btn);
InputName = (EditText) findViewById(R.id.register_username_input);
InputPassword = (EditText) findViewById(R.id.register_password_input);
InputPhoneNumber = (EditText) findViewById(R.id.register_phone_number_input);
loadingBar = new ProgressDialog(this);
CreateAccountButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view)
{
CreateAccount();
}
});
}
private void CreateAccount()
{
String name = InputName.getText().toString();
String phone = InputPhoneNumber.getText().toString();
String password = InputPassword.getText().toString();
if (TextUtils.isEmpty(name))
{
Toast.makeText(this, "Please write your name...", Toast.LENGTH_SHORT).show();
}
else if (TextUtils.isEmpty(phone))
{
Toast.makeText(this, "Please write your phone number...", Toast.LENGTH_SHORT).show();
}
else if (TextUtils.isEmpty(password))
{
Toast.makeText(this, "Please write your password...", Toast.LENGTH_SHORT).show();
}
else
{
loadingBar.setTitle("Create Account");
loadingBar.setMessage("Please wait, while we are checking the credentials.");
loadingBar.setCanceledOnTouchOutside(false);
loadingBar.show();
ValidatephoneNumber(name, phone, password);
}
}
private void ValidatephoneNumber(final String name, final String phone, final String password)
{
final DatabaseReference RootRef;
RootRef = FirebaseDatabase.getInstance().getReference();
RootRef.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot)
{
if (!(dataSnapshot.child("Users").child(phone).exists()))
{
HashMap<String, Object> userdataMap = new HashMap<>();
userdataMap.put("phone", phone);
userdataMap.put("password", password);
userdataMap.put("name", name);
RootRef.child("Users").child(phone).updateChildren(userdataMap)
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task)
{
if (task.isSuccessful())
{
Toast.makeText(RegisterActivity.this, "Congratulations, your account has been created.", Toast.LENGTH_SHORT).show();
loadingBar.dismiss();
Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);
startActivity(intent);
}
else
{
loadingBar.dismiss();
Toast.makeText(RegisterActivity.this, "Network Error: Please try again after some time...", Toast.LENGTH_SHORT).show();
}
}
});
}
else
{
Toast.makeText(RegisterActivity.this, "This " + phone + " already exists.", Toast.LENGTH_SHORT).show();
loadingBar.dismiss();
Toast.makeText(RegisterActivity.this, "Please try again using another phone number.", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(RegisterActivity.this, MainActivity.class);
startActivity(intent);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
| [
"frankssozi@franks-mbp.home"
] | frankssozi@franks-mbp.home |
e30a70c32cea49ff3cef1ae8d178710659686d6e | 4d574f5816e3b0e4ce88e7fb9c4e2202dbca2dfa | /jodconverter-local/src/test/java/org/jodconverter/local/process/ProcessManagerTest.java | 294012bb62ced687b898e5da7dc438dd07f22504 | [
"Apache-2.0"
] | permissive | mexekanez/jodconverter | f5f91c92b9a5fbff5dadc127b8c3a6eb1822b0a7 | 70096f4136367b920b3c7269dc3cf59924a00a0e | refs/heads/master | 2022-07-21T19:55:09.069810 | 2020-05-16T12:25:17 | 2020-05-16T12:25:17 | 264,429,795 | 0 | 0 | null | 2020-05-16T12:16:15 | 2020-05-16T12:16:15 | null | UTF-8 | Java | false | false | 8,072 | java | /*
* Copyright 2004 - 2012 Mirko Nasato and contributors
* 2016 - 2020 Simon Braconnier and contributors
*
* This file is part of JODConverter - Java OpenDocument Converter.
*
* 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.jodconverter.local.process;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
import java.io.IOException;
import org.junit.jupiter.api.Test;
import org.jodconverter.core.test.util.TestUtil;
import org.jodconverter.core.util.OSUtils;
import org.jodconverter.local.office.LocalOfficeManager;
import org.jodconverter.local.office.LocalOfficeUtils;
/** Contains tests for the {@link ProcessManager} classes */
public class ProcessManagerTest {
private static long waitForPidNotFound(
final ProcessManager processManager, final ProcessQuery query) throws IOException {
int tryCount = 0;
long pid;
do {
tryCount++;
pid = processManager.findPid(query);
if (pid != ProcessManager.PID_NOT_FOUND) {
TestUtil.sleepQuietly(250L);
}
} while (pid != ProcessManager.PID_NOT_FOUND && tryCount != 10);
return pid;
}
@Test
public void freeBsdProcessManager() throws IOException {
assumeTrue(OSUtils.IS_OS_FREE_BSD);
final ProcessManager processManager = FreeBSDProcessManager.getDefault();
final Process process = Runtime.getRuntime().exec("ping -c 5 127.0.0.1");
final ProcessQuery query = new ProcessQuery("ping", "-c 5 127.0.0.1");
final long pid = processManager.findPid(query);
assertThat(pid).isNotEqualTo(ProcessManager.PID_NOT_FOUND);
assertThat(process)
.extracting("pid")
.isInstanceOfSatisfying(
Number.class, number -> assertThat(number.longValue()).isEqualTo(pid));
processManager.kill(process, pid);
assertThat(waitForPidNotFound(processManager, query)).isEqualTo(ProcessManager.PID_NOT_FOUND);
}
@Test
public void freeBsdPureJavaProcessManager() throws IOException {
assumeTrue(OSUtils.IS_OS_FREE_BSD);
final ProcessManager defaultManager = LocalOfficeUtils.findBestProcessManager();
final ProcessManager processManager = PureJavaProcessManager.getDefault();
final Process process = Runtime.getRuntime().exec("ping -c 5 127.0.0.1");
final ProcessQuery query = new ProcessQuery("ping", "-c 5 127.0.0.1");
final long pid = processManager.findPid(query);
assertThat(pid).isEqualTo(ProcessManager.PID_UNKNOWN);
processManager.kill(process, pid);
assertThat(waitForPidNotFound(defaultManager, query)).isEqualTo(ProcessManager.PID_NOT_FOUND);
}
@Test
public void unixProcessManager() throws IOException {
assumeTrue(OSUtils.IS_OS_UNIX && !OSUtils.IS_OS_MAC && !OSUtils.IS_OS_FREE_BSD);
final ProcessManager processManager = UnixProcessManager.getDefault();
final Process process = Runtime.getRuntime().exec("sleep 5s");
final ProcessQuery query = new ProcessQuery("sleep", "5s");
final long pid = processManager.findPid(query);
assertThat(pid).isNotEqualTo(ProcessManager.PID_NOT_FOUND);
assertThat(process)
.extracting("pid")
.isInstanceOfSatisfying(
Number.class, number -> assertThat(number.longValue()).isEqualTo(pid));
processManager.kill(process, pid);
assertThat(waitForPidNotFound(processManager, query)).isEqualTo(ProcessManager.PID_NOT_FOUND);
}
@Test
public void unixPureJavaProcessManager() throws IOException {
assumeTrue(OSUtils.IS_OS_UNIX && !OSUtils.IS_OS_MAC && !OSUtils.IS_OS_FREE_BSD);
final ProcessManager defaultManager = LocalOfficeUtils.findBestProcessManager();
final ProcessManager processManager = PureJavaProcessManager.getDefault();
final Process process = Runtime.getRuntime().exec("sleep 5s");
final ProcessQuery query = new ProcessQuery("sleep", "5s");
final long pid = processManager.findPid(query);
assertThat(pid).isEqualTo(ProcessManager.PID_UNKNOWN);
processManager.kill(process, pid);
assertThat(waitForPidNotFound(defaultManager, query)).isEqualTo(ProcessManager.PID_NOT_FOUND);
}
@Test
public void macProcessManager() throws IOException {
assumeTrue(OSUtils.IS_OS_MAC);
final ProcessManager processManager = MacProcessManager.getDefault();
final Process process = Runtime.getRuntime().exec("sleep 5s");
final ProcessQuery query = new ProcessQuery("sleep", "5s");
final long pid = processManager.findPid(query);
assertThat(pid).isNotEqualTo(ProcessManager.PID_NOT_FOUND);
assertThat(process)
.extracting("pid")
.isInstanceOfSatisfying(
Number.class, number -> assertThat(number.longValue()).isEqualTo(pid));
processManager.kill(process, pid);
assertThat(waitForPidNotFound(processManager, query)).isEqualTo(ProcessManager.PID_NOT_FOUND);
}
@Test
public void macPureJavaProcessManager() throws IOException {
assumeTrue(OSUtils.IS_OS_MAC);
final ProcessManager defaultManager = LocalOfficeUtils.findBestProcessManager();
final ProcessManager processManager = PureJavaProcessManager.getDefault();
final Process process = Runtime.getRuntime().exec("sleep 5s");
final ProcessQuery query = new ProcessQuery("sleep", "5s");
final long pid = processManager.findPid(query);
assertThat(pid).isEqualTo(ProcessManager.PID_UNKNOWN);
processManager.kill(process, pid);
assertThat(waitForPidNotFound(defaultManager, query)).isEqualTo(ProcessManager.PID_NOT_FOUND);
}
@Test
public void windowsProcessManager() throws IOException {
assumeTrue(OSUtils.IS_OS_WINDOWS);
final ProcessManager processManager = WindowsProcessManager.getDefault();
final Process process = Runtime.getRuntime().exec("ping 127.0.0.1 -n 5");
final ProcessQuery query = new ProcessQuery("ping", "127.0.0.1 -n 5");
final long pid = processManager.findPid(query);
assertThat(pid).isNotEqualTo(ProcessManager.PID_NOT_FOUND);
// Won't work on Windows, skip this assertion
// assertThat(process).extracting("pid")
// .isInstanceOfSatisfying(
// Number.class, number -> assertThat(number.longValue()).isEqualTo(pid));
processManager.kill(process, pid);
assertThat(waitForPidNotFound(processManager, query)).isEqualTo(ProcessManager.PID_NOT_FOUND);
}
@Test
public void windowsPureJavaProcessManager() throws IOException {
assumeTrue(OSUtils.IS_OS_WINDOWS);
final ProcessManager defaultManager = LocalOfficeUtils.findBestProcessManager();
final ProcessManager processManager = PureJavaProcessManager.getDefault();
final Process process = Runtime.getRuntime().exec("ping 127.0.0.1 -n 5");
final ProcessQuery query = new ProcessQuery("ping", "127.0.0.1 -n 5");
final long pid = processManager.findPid(query);
assertThat(pid).isEqualTo(ProcessManager.PID_UNKNOWN);
processManager.kill(process, pid);
assertThat(waitForPidNotFound(defaultManager, query)).isEqualTo(ProcessManager.PID_NOT_FOUND);
}
/**
* Tests that using an custom process manager that does not appear in the classpath will fail with
* an IllegalArgumentException.
*/
@Test
public void customProcessManagerNotFound() {
assertThatIllegalArgumentException()
.isThrownBy(
() ->
LocalOfficeManager.builder()
.processManager("org.foo.fallback.ProcessManager")
.build());
}
}
| [
"simonbraconnier@gmail.com"
] | simonbraconnier@gmail.com |
a64ae9913a9932ef9adf6732dab32ef8935081d8 | 41691cf6846c00f112b5990c1bcca20ed7b85709 | /dcpro/src/com/dcpro/demo/controller/util/UUIDTool.java | 18998a9258e5ef14b0021a18c0ce9214ead55b75 | [] | no_license | llllll12/mybaits | fdba63c0c7ab8f0d2500f3674c21ce668459812b | 6ac5b465937265f31b3ad1a33eff0ea852fc2208 | refs/heads/master | 2020-03-30T00:13:06.220896 | 2018-09-27T02:47:00 | 2018-09-27T02:47:00 | 150,511,088 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,027 | java | package com.dcpro.demo.controller.util;
import java.util.UUID;
public class UUIDTool {
public UUIDTool() {
}
/**
* 閼奉亜濮╅悽鐔稿灇32娴e秶娈慤Uid閿涘苯顕惔鏃�鏆熼幑顔肩氨閻ㄥ嫪瀵岄柨鐢禿鏉╂稖顢戦幓鎺戝弳閻€劊锟斤拷
* @return
*/
public static String getUUID() {
/*UUID uuid = UUID.randomUUID();
String str = uuid.toString();
// 閸樼粯甯�"-"缁楋箑褰�
String temp = str.substring(0, 8) + str.substring(9, 13)
+ str.substring(14, 18) + str.substring(19, 23)
+ str.substring(24);
return temp;*/
return UUID.randomUUID().toString().replace("-", "");
}
public static void main(String[] args) {
// String[] ss = getUUID(10);
for (int i = 0; i < 10; i++) {
System.out.println("ss[" + i + "]=====" + getUUID());
}
}
}
| [
"975784266@qq.com"
] | 975784266@qq.com |
0abcfed6f047d5e74a11ee76d29b23ebdea684e7 | 9a95b29692e2c7bae893eb597cfb2b3f87fd9c20 | /src/test/java/com/redis/study/RedisStudyApplicationTests.java | 19dad3bc26c1ff431143ae987fd374bfc5a3ece0 | [] | no_license | whdals7337/redis-study | faebf57c8f33c76bb8768acc7578bdf23f0e2f6b | e80d2d38ff81e564e7d350dd710ff3d6dcc45dc6 | refs/heads/master | 2023-05-06T19:41:13.766112 | 2021-05-22T16:24:03 | 2021-05-22T16:24:03 | 369,801,137 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 211 | java | package com.redis.study;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class RedisStudyApplicationTests {
@Test
void contextLoads() {
}
}
| [
"uok02018496@naver.com"
] | uok02018496@naver.com |
e7eb30d92afaf0409b45f3231bcf49bf9f937d6a | 1a8ba5adf5d9737e0fd115c1ef7930d8b4bdbb72 | /mingthai/Projectbaru/android/app/src/main/java/com/projectbaru/MainApplication.java | 7fd8f2333d763325bfe5d937c2defbc7066c6dbe | [] | no_license | encepsuryana/Belajar-React-Native | 5df438c0b1801e23a4912b5684a68172fd406160 | 3d6bba99d30838c46163dcc5379db28de1639e74 | refs/heads/master | 2023-03-29T04:59:15.578189 | 2021-03-31T10:09:05 | 2021-03-31T10:09:05 | 328,089,519 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,605 | java | package com.projectbaru;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.projectbaru.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
| [
"mingthai@gmail.com"
] | mingthai@gmail.com |
0e5cf92e090e554823fc73ba834c0c655320a011 | 17e8438486cb3e3073966ca2c14956d3ba9209ea | /dso/branches/partialkeys/code/base/dso-common/src/com/tc/net/protocol/tcm/AbstractMessageChannel.java | 5c9460124ca4d278bca407cd0c7d200f73e20793 | [] | no_license | sirinath/Terracotta | fedfc2c4f0f06c990f94b8b6c3b9c93293334345 | 00a7662b9cf530dfdb43f2dd821fa559e998c892 | refs/heads/master | 2021-01-23T05:41:52.414211 | 2015-07-02T15:21:54 | 2015-07-02T15:21:54 | 38,613,711 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,814 | java | /*
* All content copyright (c) 2003-2008 Terracotta, Inc., except as may otherwise be noted in a separate copyright
* notice. All rights reserved.
*/
package com.tc.net.protocol.tcm;
import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
import EDU.oswego.cs.dl.util.concurrent.CopyOnWriteArraySet;
import EDU.oswego.cs.dl.util.concurrent.SynchronizedRef;
import com.tc.async.api.Sink;
import com.tc.bytes.TCByteBuffer;
import com.tc.logging.TCLogger;
import com.tc.net.ClientID;
import com.tc.net.MaxConnectionsExceededException;
import com.tc.net.NodeID;
import com.tc.net.TCSocketAddress;
import com.tc.net.protocol.NetworkLayer;
import com.tc.net.protocol.NetworkStackID;
import com.tc.net.protocol.TCNetworkMessage;
import com.tc.net.protocol.transport.MessageTransport;
import com.tc.util.Assert;
import com.tc.util.TCTimeoutException;
import java.io.IOException;
import java.net.UnknownHostException;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/**
* @author teck
*/
abstract class AbstractMessageChannel implements MessageChannel, MessageChannelInternal {
private final Map attachments = new ConcurrentReaderHashMap();
private final Object attachmentLock = new Object();
private final Set listeners = new CopyOnWriteArraySet();
private final ChannelStatus status = new ChannelStatus();
private final SynchronizedRef remoteAddr = new SynchronizedRef(null);
private final SynchronizedRef localAddr = new SynchronizedRef(null);
private final TCMessageFactory msgFactory;
private final TCMessageRouter router;
private final TCMessageParser parser;
private final TCLogger logger;
private final NodeID remoteNodeID;
private volatile NodeID localNodeID;
protected NetworkLayer sendLayer;
AbstractMessageChannel(final TCMessageRouter router, final TCLogger logger, final TCMessageFactory msgFactory,
final NodeID remoteNodeID) {
this.router = router;
this.logger = logger;
this.msgFactory = msgFactory;
this.parser = new TCMessageParser(this.msgFactory);
this.remoteNodeID = remoteNodeID;
// This is set after hand shake for the clients
this.localNodeID = ClientID.NULL_ID;
}
public void addAttachment(final String key, final Object value, final boolean replace) {
synchronized (this.attachmentLock) {
boolean exists = this.attachments.containsKey(key);
if (replace || !exists) {
this.attachments.put(key, value);
}
}
}
public Object removeAttachment(final String key) {
return this.attachments.remove(key);
}
public Object getAttachment(final String key) {
return this.attachments.get(key);
}
public boolean isOpen() {
return this.status.isOpen();
}
public boolean isClosed() {
return this.status.isClosed();
}
public void addListener(final ChannelEventListener listener) {
if (listener == null) { return; }
this.listeners.add(listener);
}
public NodeID getLocalNodeID() {
return this.localNodeID;
}
public void setLocalNodeID(final NodeID localNodeID) {
this.localNodeID = localNodeID;
}
public NodeID getRemoteNodeID() {
return this.remoteNodeID;
}
public TCMessage createMessage(final TCMessageType type) {
TCMessage rv = this.msgFactory.createMessage(this, type);
// TODO: set default channel specific information in the TC message header
return rv;
}
public void routeMessageType(final TCMessageType messageType, final TCMessageSink dest) {
this.router.routeMessageType(messageType, dest);
}
public void unrouteMessageType(final TCMessageType messageType) {
this.router.unrouteMessageType(messageType);
}
public abstract NetworkStackID open() throws MaxConnectionsExceededException, TCTimeoutException,
UnknownHostException, IOException;
/**
* Routes a TCMessage to a sink. The hydrate sink will do the hydrate() work
*/
public void routeMessageType(final TCMessageType messageType, final Sink destSink, final Sink hydrateSink) {
routeMessageType(messageType, new TCMessageSinkToSedaSink(destSink, hydrateSink));
}
private void fireChannelOpenedEvent() {
fireEvent(new ChannelEventImpl(ChannelEventType.CHANNEL_OPENED_EVENT, AbstractMessageChannel.this));
}
private void fireChannelClosedEvent() {
fireEvent(new ChannelEventImpl(ChannelEventType.CHANNEL_CLOSED_EVENT, AbstractMessageChannel.this));
}
void channelOpened() {
this.status.open();
fireChannelOpenedEvent();
}
public void close() {
if (!this.status.getAndSetIsClosed()) {
Assert.assertNotNull(this.sendLayer);
this.sendLayer.close();
fireChannelClosedEvent();
}
}
public boolean isConnected() {
return this.sendLayer != null && this.sendLayer.isConnected();
}
public final void setSendLayer(final NetworkLayer layer) {
this.sendLayer = layer;
}
public final void setReceiveLayer(final NetworkLayer layer) {
throw new UnsupportedOperationException();
}
public NetworkLayer getReceiveLayer() {
// this is the topmost layer, it has no parent
return null;
}
public void send(final TCNetworkMessage message) {
if (this.logger.isDebugEnabled()) {
final Runnable logMsg = new Runnable() {
public void run() {
AbstractMessageChannel.this.logger.debug("Message Sent: " + message.toString());
}
};
final Runnable existingCallback = message.getSentCallback();
final Runnable newCallback;
if (existingCallback != null) {
newCallback = new Runnable() {
public void run() {
try {
existingCallback.run();
} catch (Exception e) {
AbstractMessageChannel.this.logger.error(e);
} finally {
logMsg.run();
}
}
};
} else {
newCallback = logMsg;
}
message.setSentCallback(newCallback);
}
this.sendLayer.send(message);
}
public final void receive(final TCByteBuffer[] msgData) {
this.router.putMessage(this.parser.parseMessage(this, msgData));
}
protected final ChannelStatus getStatus() {
return this.status;
}
public void notifyTransportDisconnected(final MessageTransport transport) {
this.remoteAddr.set(null);
this.localAddr.set(null);
fireTransportDisconnectedEvent();
}
protected void fireTransportDisconnectedEvent() {
fireEvent(new ChannelEventImpl(ChannelEventType.TRANSPORT_DISCONNECTED_EVENT, AbstractMessageChannel.this));
}
public void notifyTransportConnected(final MessageTransport transport) {
this.remoteAddr.set(transport.getRemoteAddress());
this.localAddr.set(transport.getLocalAddress());
fireEvent(new ChannelEventImpl(ChannelEventType.TRANSPORT_CONNECTED_EVENT, AbstractMessageChannel.this));
}
public void notifyTransportConnectAttempt(final MessageTransport transport) {
return;
}
public void notifyTransportClosed(final MessageTransport transport) {
// yeah, we know. We closed it.
return;
}
public TCSocketAddress getLocalAddress() {
return (TCSocketAddress) this.localAddr.get();
}
public TCSocketAddress getRemoteAddress() {
return (TCSocketAddress) this.remoteAddr.get();
}
private void fireEvent(final ChannelEventImpl event) {
for (Iterator i = this.listeners.iterator(); i.hasNext();) {
((ChannelEventListener) i.next()).notifyChannelEvent(event);
}
}
/**
* this function gets the stack Lyaer Flag added to build the communctaion stack information
*/
public short getStackLayerFlag() {
// this is the channel layer
return TYPE_CHANNEL_LAYER;
}
/**
* this function gets the stack Layer Name added to build the communctaion stack information
*/
public String getStackLayerName() {
// this is the channel layer
return NAME_CHANNEL_LAYER;
}
class ChannelStatus {
private ChannelState state;
public ChannelStatus() {
this.state = ChannelState.INIT;
}
synchronized void open() {
Assert.assertTrue("Switch only from init state to open state", ChannelState.INIT.equals(this.state));
this.state = ChannelState.OPEN;
}
synchronized boolean getAndSetIsClosed() {
// must not in INIT state
Assert.assertFalse("Wrong to be in init state to switch to close state", ChannelState.INIT.equals(this.state));
if (ChannelState.CLOSED.equals(this.state)) {
return true;
} else {
this.state = ChannelState.CLOSED;
return false;
}
}
synchronized boolean isOpen() {
return ChannelState.OPEN.equals(this.state);
}
synchronized boolean isClosed() {
return ChannelState.CLOSED.equals(this.state);
}
}
private static class ChannelState {
private static final int STATE_INIT = 0;
private static final int STATE_OPEN = 1;
private static final int STATE_CLOSED = 2;
static final ChannelState INIT = new ChannelState(STATE_INIT);
static final ChannelState OPEN = new ChannelState(STATE_OPEN);
static final ChannelState CLOSED = new ChannelState(STATE_CLOSED);
private final int state;
private ChannelState(final int state) {
this.state = state;
}
@Override
public String toString() {
switch (this.state) {
case STATE_INIT:
return "INIT";
case STATE_OPEN:
return "OPEN";
case STATE_CLOSED:
return "CLOSED";
default:
return "UNKNOWN";
}
}
}
// for testing purpose
protected NetworkLayer getSendLayer() {
return this.sendLayer;
}
}
| [
"nelrahma@7fc7bbf3-cf45-46d4-be06-341739edd864"
] | nelrahma@7fc7bbf3-cf45-46d4-be06-341739edd864 |
8a5f08b09fe59066827802160029715339c52a8c | 2dafa1bc8436d282c552cb1cb55df69ef70d9dbc | /jsure-analysis/src/edu/cmu/cs/fluid/java/operator/ExtendedTreeWalker.java | 93db00872dd0f70f0685c72d212afc7d9c6a4bb4 | [] | no_license | surelogic/jsure | 99c47d195674234b688d08a4b03e506b3a235620 | 184d698991d0fbb8f73735b5aab2c5051d2518fd | refs/heads/master | 2021-05-01T00:15:53.632353 | 2016-05-27T02:35:14 | 2016-05-27T02:35:14 | 50,687,249 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,364 | java | package edu.cmu.cs.fluid.java.operator;
import edu.cmu.cs.fluid.ir.IRNode;
import edu.cmu.cs.fluid.tree.Operator;
/** Extension of <TT>TreeWalker</tt> that overrides <tt>binOpExpression</tt>
* to branch on the different binary operators.
* @see TreeWalker
* @author Aaron Greenhouse
*/
public abstract class ExtendedTreeWalker extends TreeWalker {
/** Create a new ExtendedTreeWalker.
* @param defVal The value to be returned if the operator is unknown,
* or if the analysis has nothing to do. This may not necessarily be
* useful for all analyses.
*/
public ExtendedTreeWalker(final Object defVal) {
super(defVal);
}
/** An expression using a binary operator. Branches on the operator
* to call one of the new operator specific methods.
* @param op The operator being used
* @param root The node of the expression
* @param op1 The node of the first operand
* @param op2 The node of the second operand
* @return <tt>defaultValue</tt> if the operator is unknown
*/
@Override
public Object binOpExpression(
final Operator op,
final IRNode root,
final IRNode op1,
final IRNode op2) {
if (op == AddExpression.prototype)
return this.addExpression(root, op1, op2);
else if (op == DivExpression.prototype)
return this.divExpression(root, op1, op2);
else if (op == RemExpression.prototype)
return this.remExpression(root, op1, op2);
else if (op == MulExpression.prototype)
return this.mulExpression(root, op1, op2);
else if (op == SubExpression.prototype)
return this.subExpression(root, op1, op2);
else if (op == ConditionalAndExpression.prototype)
return this.conditionalAndExpression(root, op1, op2);
else if (op == ConditionalOrExpression.prototype)
return this.conditionalOrExpression(root, op1, op2);
else if (op == AndExpression.prototype)
return this.andExpression(root, op1, op2);
else if (op == OrExpression.prototype)
return this.orExpression(root, op1, op2);
else if (op == XorExpression.prototype)
return this.xorExpression(root, op1, op2);
else if (op == GreaterThanEqualExpression.prototype)
return this.greaterThanEqualExpression(root, op1, op2);
else if (op == GreaterThanExpression.prototype)
return this.greaterThanExpression(root, op1, op2);
else if (op == LessThanEqualExpression.prototype)
return this.lessThanEqualExpression(root, op1, op2);
else if (op == LessThanExpression.prototype)
return this.LessThanExpression(root, op1, op2);
else if (op == EqExpression.prototype)
return this.eqExpression(root, op1, op2);
else if (op == NotEqExpression.prototype)
return this.notEqExpression(root, op1, op2);
else if (op == LeftShiftExpression.prototype)
return this.leftShiftExpression(root, op1, op2);
else if (op == RightShiftExpression.prototype)
return this.rightShiftExpression(root, op1, op2);
else if (op == UnsignedRightShiftExpression.prototype)
return this.unsignedRightShiftExpression(root, op1, op2);
else
return defaultValue;
}
/** <tt>+</tt> operator
* @param root The node of the expression
* @param op1 The node of the first operand
* @param op2 The node of the second operand
*/
public abstract Object addExpression(IRNode root, IRNode op1, IRNode op2);
/** <tt>/</tt> operator
* @param root The node of the expression
* @param op1 The node of the first operand
* @param op2 The node of the second operand
*/
public abstract Object divExpression(IRNode root, IRNode op1, IRNode op2);
/** <tt>%</tt> operator
* @param root The node of the expression
* @param op1 The node of the first operand
* @param op2 The node of the second operand
*/
public abstract Object remExpression(IRNode root, IRNode op1, IRNode op2);
/** <tt>*</tt> operator
* @param root The node of the expression
* @param op1 The node of the first operand
* @param op2 The node of the second operand
*/
public abstract Object mulExpression(IRNode root, IRNode op1, IRNode op2);
/** <tt>-</tt> operator
* @param root The node of the expression
* @param op1 The node of the first operand
* @param op2 The node of the second operand
*/
public abstract Object subExpression(IRNode root, IRNode op1, IRNode op2);
/** <tt>&&</tt> operator
* @param root The node of the expression
* @param op1 The node of the first operand
* @param op2 The node of the second operand
*/
public abstract Object conditionalAndExpression(
IRNode root,
IRNode op1,
IRNode op2);
/** <tt>||</tt> operator
* @param root The node of the expression
* @param op1 The node of the first operand
* @param op2 The node of the second operand
*/
public abstract Object conditionalOrExpression(
IRNode root,
IRNode op1,
IRNode op2);
/** <tt>&</tt> operator
* @param root The node of the expression
* @param op1 The node of the first operand
* @param op2 The node of the second operand
*/
public abstract Object andExpression(IRNode root, IRNode op1, IRNode op2);
/** <tt>|</tt> operator
* @param root The node of the expression
* @param op1 The node of the first operand
* @param op2 The node of the second operand
*/
public abstract Object orExpression(IRNode root, IRNode op1, IRNode op2);
/** <tt>^</tt> operator
* @param root The node of the expression
* @param op1 The node of the first operand
* @param op2 The node of the second operand
*/
public abstract Object xorExpression(IRNode root, IRNode op1, IRNode op2);
/** <tt><=</tt> operator
* @param root The node of the expression
* @param op1 The node of the first operand
* @param op2 The node of the second operand
*/
public abstract Object greaterThanEqualExpression(
IRNode root,
IRNode op1,
IRNode op2);
/** <tt>></tt> operator
* @param root The node of the expression
* @param op1 The node of the first operand
* @param op2 The node of the second operand
*/
public abstract Object greaterThanExpression(
IRNode root,
IRNode op1,
IRNode op2);
/** <tt><=</tt> operator
* @param root The node of the expression
* @param op1 The node of the first operand
* @param op2 The node of the second operand
*/
public abstract Object lessThanEqualExpression(
IRNode root,
IRNode op1,
IRNode op2);
/** <tt><</tt> operator
* @param root The node of the expression
* @param op1 The node of the first operand
* @param op2 The node of the second operand
*/
public abstract Object LessThanExpression(
IRNode root,
IRNode op1,
IRNode op2);
/** <tt>==</tt> operator
* @param root The node of the expression
* @param op1 The node of the first operand
* @param op2 The node of the second operand
*/
public abstract Object eqExpression(IRNode root, IRNode op1, IRNode op2);
/** <tt>!=</tt> operator
* @param root The node of the expression
* @param op1 The node of the first operand
* @param op2 The node of the second operand
*/
public abstract Object notEqExpression(IRNode root, IRNode op1, IRNode op2);
/** <tt><<</tt> operator
* @param root The node of the expression
* @param op1 The node of the first operand
* @param op2 The node of the second operand
*/
public abstract Object leftShiftExpression(
IRNode root,
IRNode op1,
IRNode op2);
/** <tt>>></tt> operator
* @param root The node of the expression
* @param op1 The node of the first operand
* @param op2 The node of the second operand
*/
public abstract Object rightShiftExpression(
IRNode root,
IRNode op1,
IRNode op2);
/** <tt>>>></tt> operator
* @param root The node of the expression
* @param op1 The node of the first operand
* @param op2 The node of the second operand
*/
public abstract Object unsignedRightShiftExpression(
IRNode root,
IRNode op1,
IRNode op2);
}
| [
"edwin.chan@surelogic.com"
] | edwin.chan@surelogic.com |
1a9ed0cf323a3dcbcb146172bcb3f55c3cf9b872 | 95f7631d81b98021806184999ff7351259282a7e | /app/src/main/java/com/stafiiyevskyi/mlsdev/droidfm/data/dto/artist/detail/Link.java | ee4d26e821d7f0332e0c6d285f213f9541421db0 | [] | no_license | OlafStaf/DroidFM | a6379b30a500930e4d13bcf82cce37547325966b | f9893dcb73232537864c12f4c8a4be1686d22710 | refs/heads/master | 2016-09-14T06:09:52.652926 | 2016-05-23T07:15:04 | 2016-05-23T07:15:04 | 56,680,310 | 3 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,141 | java | package com.stafiiyevskyi.mlsdev.droidfm.data.dto.artist.detail;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* Created by oleksandr on 25.04.16.
*/
public class Link {
@SerializedName("#text")
@Expose
private String Text;
@SerializedName("rel")
@Expose
private String rel;
@SerializedName("href")
@Expose
private String href;
/**
*
* @return
* The Text
*/
public String getText() {
return Text;
}
/**
*
* @param Text
* The #text
*/
public void setText(String Text) {
this.Text = Text;
}
/**
*
* @return
* The rel
*/
public String getRel() {
return rel;
}
/**
*
* @param rel
* The rel
*/
public void setRel(String rel) {
this.rel = rel;
}
/**
*
* @return
* The href
*/
public String getHref() {
return href;
}
/**
*
* @param href
* The href
*/
public void setHref(String href) {
this.href = href;
}
} | [
"a.stafiyevsky@gmail.com"
] | a.stafiyevsky@gmail.com |
b24f856cbee288caf0e10d70c1da67ab0236209c | 7d1cfaa9ca674bd3e1802232960d31738cd9851d | /stack/RemoveKDigits.java | f8f61a01ab2681a66ee877396c7d08d95abcc70f | [] | no_license | XunPeng715/leetcode | 5ef5aa7ff07e383a60314a2a0877132d8890e95e | b3232e7bb7fde4dee68526256ca0d40a06913c59 | refs/heads/master | 2023-06-06T01:27:45.620019 | 2021-06-29T02:26:57 | 2021-06-29T02:26:57 | 305,764,843 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 774 | java | class Solution {
public String removeKdigits(String num, int k) {
int m = num.length() - k;
char[] tmp = new char[m];
char[] nums = num.toCharArray();
Deque<Character> deq = new LinkedList<>();
for (int i = 0; i < nums.length; i++) {
char c = nums[i];
while (!deq.isEmpty() && deq.peek() > c) {
deq.removeFirst();
}
deq.addFirst(c);
if (i >= k) tmp[i - k] = deq.removeLast();
}
int i = 0;
for (i = 0; i < m; i++) {
if (tmp[i] != '0') break;
}
if (i == m) return "0";
char[] res = new char[m - i];
for (int j = i; j < m; j++) res[j - i] = tmp[j];
return new String(res);
}
}
| [
"xunpeng715@gmail.com"
] | xunpeng715@gmail.com |
b1acd7e77e024fa519792f43de2b7673f7363441 | dcef7cfd1d3c1fb30db923fc2aeaa45d82deab03 | /test/src/com/lichao/io/CreateFile.java | d4c378c6b190e6f84c333811f3bf4ab4749a2458 | [] | no_license | Bailing1992/java-source-1.8 | 2616c98e68afbdc209d7a3ebbb6533a02d8fef81 | 8446eece22872b593393ada9ae74e4bdd70b89fc | refs/heads/master | 2021-07-25T20:12:35.158047 | 2020-04-21T03:04:08 | 2020-04-21T03:04:08 | 156,389,106 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 607 | java | package com.lichao.io;
import java.io.File;
/**
* describe: 创建一个新文件
*
* @author lichao
* @date 2019/01/01
*/
public class CreateFile {
public static void main(String[] args) {
File f = new File(System.getProperty("user.dir") + File.separator +"hello.txt");
try{
System.out.println(f.getAbsoluteFile());
// File类的两个常量
System.out.println(File.separator);
System.out.println(File.pathSeparator);
f.createNewFile();
}catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"lichao16@vipkid.com.cn"
] | lichao16@vipkid.com.cn |
8d08eaa5f54c221f272def70ba195fae02439f19 | 211794d72bb6deeef5773184218ddd5701284fbe | /MyFirstJavaProject/src/arrayfor.java | ddda8aa85d0d87435f60c34fdc8079fbaa7851f8 | [] | no_license | tiborlakatoss/personalProjects | 0f26a0380b206a9c5f040aa1bc0ef6ccb6d7e402 | 6f8ea324305f999e809e92d479d8b1ece36cc800 | refs/heads/master | 2020-05-22T18:11:25.088659 | 2019-05-13T17:54:40 | 2019-05-13T17:54:40 | 186,465,604 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 158 | java | import java.util.Arrays;
public class arrayfor {
public static void main(String[] args) {
for(i=0;i<100;i++) {
if(i%i=0)
System.out.println(i);
}
} | [
"lakatosstibor@gmail.com"
] | lakatosstibor@gmail.com |
af065ebd4f2c3d78193fc893316f51c908901de2 | 520b880758ecdf98240c303918e890bfbc4109f9 | /src/com/gk/study/java/hibernate/crud/App03_PersistingDetachedObjects.java | 39110220b8e1151529207400e0b236ea8d5ecdef | [] | no_license | javaenthugm/Hibernate | d7b80585c2d8406cb60421b19852a54637258a6e | e34875728a934514f6d5b59c862d02e739038320 | refs/heads/master | 2021-01-11T15:37:38.551323 | 2017-01-24T11:08:10 | 2017-01-24T11:08:10 | 79,903,843 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,158 | java | package com.gk.study.java.hibernate.crud;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import com.gk.study.java.hibernate.util.HibernateUtil;
public class App03_PersistingDetachedObjects {
public static void main(String args[]){
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
try {
Session session = sessionFactory.openSession();
session.getTransaction().begin();
//Persistent
CrudUser user = (CrudUser)session.get(CrudUser.class,1);
System.out.println(user.getName());
session.getTransaction().commit();
session.close(); // user became Detached
//Waiting for user's reponse -
//Remaining code may be in another method'
Thread.sleep(1000);
//user.setName("Updating a detached object");
session = sessionFactory.openSession();
session.getTransaction().begin();
session.update(user);
//user.setName("Changing back...");
session.getTransaction().commit();
session.close();
} catch (Exception e) {
e.printStackTrace();
} finally {
sessionFactory.close();
System.out.println("Hibernate Session Close");
}
}
}
| [
"javaenthu@gmail.com"
] | javaenthu@gmail.com |
3542c16de4547cff6f874481f66658290331c5d8 | 988225faeaed492b89937d1b8ee0e4a85cd63ce5 | /TOMProjekte - Kopie/beispiele/kap18-schach-javadoc/Laeufer.java | 04334dda6f4188da8e7fab33a3c193993eae25d6 | [] | no_license | TOMcyber/TomJavaWorkSchule2018 | 576195f32261784403c5983d1d516d9509205447 | 8d9f5474b7335b78670673d09078b73401ca241d | refs/heads/master | 2020-03-16T21:50:45.703139 | 2018-06-07T13:29:12 | 2018-06-07T13:29:12 | 133,016,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 792 | java | /**
* Klasse für die Schachfigur 'Läufer'
* @author kofler
*/
public class Laeufer extends Schachfigur {
/**
* erzeugt einen Läufer (Schachfigur)
* @param startpos Startposition in Schachnotation
*/
public Laeufer(String startpos) {
// Konstruktur der übergeordneten Klasse aufrufen
super(startpos);
}
// kein Javadoc-Kommentar erforderlich,
// ist in Schachfigur.java dokumentierg
public String ermittleZiele() {
String zuege="";
for(int i=-7; i<=7; i++) {
if(i==0) // überspringen, das ist die Ausgangsposition
continue;
zuege += position(spalte+i, reihe+i); // die Felder auf den
zuege += position(spalte+i, reihe-i); // Diagonalen ermitteln
}
return(zuege.substring(0, zuege.length()-1));
}
}
| [
"Alfa@KA-B09-103.alfatraining.local"
] | Alfa@KA-B09-103.alfatraining.local |
66003107c358575fa2d3ed8a588a4fd2ba9c352d | 163c9f58cf4a98d7c198eca1381410e405b6004d | /springboot-rabbitmq-learn/src/main/java/com/learn/springbootrabbitmqlearn/listener/InsertOrderRecordListener.java | 641db8a93839755f70e7aea332c176d2b4eba2bc | [] | no_license | liman657/springboot_rabbitmq | c2441f5f664f4f703e5af53bd6048b16d4f451d9 | 54655bee1a1a74a9b9f88264f7d76fb307b9dadf | refs/heads/master | 2023-08-08T19:50:49.751247 | 2019-11-20T12:37:28 | 2019-11-20T12:41:24 | 222,933,335 | 0 | 0 | null | 2023-07-22T22:09:10 | 2019-11-20T12:33:17 | Java | UTF-8 | Java | false | false | 1,624 | java | package com.learn.springbootrabbitmqlearn.listener;
import com.learn.springbootrabbitmqlearn.entity.OrderRecord;
import com.learn.springbootrabbitmqlearn.mapper.OrderRecordMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
/**
* autor:liman
* createtime:2019/10/20
* comment:
*/
@Component
public class InsertOrderRecordListener implements ApplicationListener<InsertOrderRecordEvent> {
private static final Logger log = LoggerFactory.getLogger(InsertOrderRecordListener.class);
@Autowired
private OrderRecordMapper orderRecordMapper;
@Override
public void onApplicationEvent(InsertOrderRecordEvent insertOrderRecordEvent) {
log.info("监听到下单记录");
try{
if(insertOrderRecordEvent!=null){
OrderRecord orderRecord = new OrderRecord();
BeanUtils.copyProperties(insertOrderRecordEvent,orderRecord);
try {
log.info("我看看事件处理是否是异步的");
Thread.sleep(5000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
orderRecordMapper.insert(orderRecord);
log.info("数据保存完成");
}
}catch (Exception e){
log.error("监听下单事件异常,异常信息为:{}",e.fillInStackTrace());
}
}
}
| [
"657271181@qq.com"
] | 657271181@qq.com |
9e64819fe7e0e15a236d63f0b14f355e03fe3e00 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/19/19_3f8c37e8a08176a12f2b18aef27a8cb53d01a037/DeadlinesController/19_3f8c37e8a08176a12f2b18aef27a8cb53d01a037_DeadlinesController_t.java | 2ac4f626ae36f5ec9783c9612df0f2faad8208ac | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 5,775 | java | package uk.ac.cam.dashboard.controllers;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ws.rs.DELETE;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.hibernate.Session;
import org.jboss.resteasy.annotations.Form;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.ac.cam.cl.dtg.ldap.LDAPObjectNotFoundException;
import uk.ac.cam.cl.dtg.ldap.LDAPPartialQuery;
import uk.ac.cam.cl.dtg.ldap.LDAPQueryManager;
import uk.ac.cam.cl.dtg.ldap.LDAPUser;
import uk.ac.cam.dashboard.exceptions.AuthException;
import uk.ac.cam.dashboard.forms.DeadlineForm;
import uk.ac.cam.dashboard.models.Deadline;
import uk.ac.cam.dashboard.models.DeadlineUser;
import uk.ac.cam.dashboard.models.Group;
import uk.ac.cam.dashboard.models.User;
import uk.ac.cam.dashboard.queries.DeadlineQuery;
import uk.ac.cam.dashboard.util.HibernateUtil;
import uk.ac.cam.dashboard.util.Mail;
import uk.ac.cam.dashboard.util.Strings;
import uk.ac.cam.dashboard.util.Util;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ImmutableMap;
@Path("/api/deadlines")
@Produces(MediaType.APPLICATION_JSON)
public class DeadlinesController extends ApplicationController {
// Create the logger
private static Logger log = LoggerFactory.getLogger(GroupsController.class);
private User currentUser;
// Index
@GET @Path("/")
public ImmutableMap<String, ?> indexDeadlines() {
try {
currentUser = validateUser();
} catch (AuthException e) {
return ImmutableMap.of("error", e.getMessage());
}
return ImmutableMap.of("user", currentUser.toMap(), "deadlines", currentUser.setDeadlinesToMap());
}
// Manage
@GET @Path("/{id}")
public Map<String, ?> getDeadline(@PathParam("id") int id) {
try {
currentUser = validateUser();
} catch (AuthException e) {
return ImmutableMap.of("error", e.getMessage());
}
Deadline deadline = DeadlineQuery.get(id);
if(!deadline.getOwner().equals(currentUser)){
return ImmutableMap.of("redirectTo", "deadlines");
}
return ImmutableMap.of("deadline", deadline.toMap(), "deadlineEdit", deadline.toMap(), "users", deadline.usersToMap(), "errors", "undefined");
}
// Create
@POST @Path("/")
public Map<String, ?> createDeadline(@Form DeadlineForm deadlineForm) throws Exception {
try {
currentUser = validateUser();
} catch (AuthException e) {
return ImmutableMap.of("error", e.getMessage());
}
ArrayListMultimap<String, String> errors = deadlineForm.validate();
ImmutableMap<String, List<String>> actualErrors = Util.multimapToImmutableMap(errors);
if(errors.isEmpty()){
int id = deadlineForm.handleCreate(currentUser);
return ImmutableMap.of("redirectTo", "deadlines/"+id);
} else {
return ImmutableMap.of("deadline", deadlineForm.toMap(-1), "errors", actualErrors);
}
}
// Update
@POST @Path("/{id}")
public Map<String, ?> updateDeadline(@Form DeadlineForm deadlineForm, @PathParam("id") int id) {
try {
currentUser = validateUser();
} catch (AuthException e) {
return ImmutableMap.of("error", e.getMessage());
}
ArrayListMultimap<String, String> errors = deadlineForm.validate();
ImmutableMap<String, List<String>> actualErrors = Util.multimapToImmutableMap(errors);
if(errors.isEmpty()){
deadlineForm.handleUpdate(currentUser, id);
return ImmutableMap.of("redirectTo", "deadlines/"+id);
} else {
return ImmutableMap.of("errors", actualErrors, "deadlineEdit", deadlineForm.toMap(id), "target", "edit");
}
}
// Delete
@DELETE @Path("/{id}")
public Map<String, ?> deleteDeadline(@PathParam("id") int id) {
Session session = HibernateUtil.getTransactionSession();
Deadline deadline = DeadlineQuery.get(id);
session.delete(deadline);
return ImmutableMap.of("success", "true", "id", id);
}
// Mark as complete/not complete
@PUT @Path("/{id}/complete")
public Map<String, ?> updateComplete(@PathParam("id") int id) {
DeadlineUser d = DeadlineQuery.getDUser(id);
if(d.getComplete()){ d.toggleComplete(false);
} else { d.toggleComplete(true); }
return d.toMap();
}
// Mark as archived
@PUT @Path("/{id}/archive")
public Map<String, ?> updateArchive(@PathParam("id") int id) {
DeadlineUser d = DeadlineQuery.getDUser(id);
if(d.getArchived()){ d.toggleArchived(false);
} else { d.toggleArchived(true); }
return d.toMap();
}
// Find users by crsid
@POST @Path("/queryCRSID")
public List<HashMap<String, String>> queryCRSId(@FormParam("q") String x) {
List<HashMap<String, String>> matches = null;
try {
matches = LDAPPartialQuery.partialUserByCrsid(x);
} catch (LDAPObjectNotFoundException e){
log.error("Error performing LDAPQuery: " + e.getMessage());
return new ArrayList<HashMap<String, String>>();
}
return matches;
}
// Find groups
@POST @Path("/queryGroup")
public List<ImmutableMap<String, ?>> queryCRSID(@FormParam("q") String x) {
try {
currentUser = validateUser();
} catch (AuthException e) {
return new ArrayList<ImmutableMap<String, ?>>();
}
ArrayList<ImmutableMap<String,?>> matches = new ArrayList<ImmutableMap<String, ?>>();
for(Group g : currentUser.getGroups()){
matches.add(ImmutableMap.of("group_id", g.getId(), "group_name", g.getTitle()));
}
return matches;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
c9ebd1179adf81f43bf1bdce5bb9d5c058ac1e16 | ab083f03b7b29d01e9dce49621de996867116fe5 | /Standard_algorithm_and_data_structure/ArraySort_Review/Main.java | 7392d21fc297b434d88ddab0ecc6ae2a24106f51 | [] | no_license | njushishuo/Algorithm | 510beb9d612fd4cc4b21bd46b10529f4b1746993 | ab61365322fe1e8f3a1c73470f2a3f00383de84b | refs/heads/master | 2022-12-25T11:07:32.097584 | 2019-12-04T15:06:21 | 2019-12-04T15:06:21 | 106,374,625 | 0 | 0 | null | 2020-10-13T12:07:38 | 2017-10-10T06:02:11 | Java | UTF-8 | Java | false | false | 644 | java | public class Main {
public static void main(String[] args) {
int a[] = {7,5,3,1,2,4,0,6,6,5,7,3,1,2,4,4,3,7};
ArrayHelper.printArray(a);
//InsertSort insertSort = new InsertSort();
//ShellSort shellSort = new ShellSort();
// BubbleSort bubbleSort = new BubbleSort();
QuickSort quickSort = new QuickSort();
//MergeSort mergeSort = new MergeSort();
//shellSort.shellSort(a);
//bubbleSort.bubbleSort(a);
//bubbleSort.bubbleSortImproved(a);
quickSort.quickSort(a);
// mergeSort.mergeSort(a);
ArrayHelper.printArray(a);
}
}
| [
"675342907@qq.com"
] | 675342907@qq.com |
e36c8551535da1b72618eba5b4585bff329a98dc | 4fede234d6dc8424f6869d89cc084c076dfd05b0 | /src/main/java/guru/sfg/beer/order/service/web/controllers/CustomerController.java | c9fd87aef3e32b3da557fce131e9b0f60fe6bfd7 | [] | no_license | holocaster/mssc-beer-order-service | 3f18aee15574780874fc20f04797a2c6d3523b76 | 883a8159115715c3b641f79ccfd14563310f2ae7 | refs/heads/master | 2023-06-03T00:58:30.085096 | 2021-06-15T21:44:43 | 2021-06-15T21:44:43 | 358,233,797 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,337 | java | /*
* Copyright 2019 the original author or authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package guru.sfg.beer.order.service.web.controllers;
import br.com.prcompany.beerevents.model.CustomerDto;
import guru.sfg.beer.order.service.services.CustomerService;
import guru.sfg.beer.order.service.web.model.CustomerDtoPagedList;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.UUID;
@Slf4j
@RequestMapping("/api/v1/customers/")
@RestController
@RequiredArgsConstructor
public class CustomerController {
private static final Integer DEFAULT_PAGE_NUMBER = 0;
private static final Integer DEFAULT_PAGE_SIZE = 25;
private final CustomerService customerService;
@GetMapping
public CustomerDtoPagedList listOrders(@RequestParam(value = "pageNumber", required = false) Integer pageNumber,
@RequestParam(value = "pageSize", required = false) Integer pageSize) {
if (pageNumber == null || pageNumber < 0) {
pageNumber = DEFAULT_PAGE_NUMBER;
}
if (pageSize == null || pageSize < 1) {
pageSize = DEFAULT_PAGE_SIZE;
}
return this.customerService.listCustomers(PageRequest.of(pageNumber, pageSize));
}
@GetMapping("{customerId}")
public ResponseEntity<CustomerDto> getCustomer(@PathVariable("customerId") UUID customerId) {
CustomerDto customerDto = this.customerService.findById(customerId);
return ResponseEntity.ok(customerDto);
}
}
| [
"paulorobertosp@gmail.com"
] | paulorobertosp@gmail.com |
d3da38023c3b61f9fef62d4600c4edb7101c287b | b5f404eba50a00bd45b711d762ffb2ef8ee7ac0d | /src/cn/ac/irsa/landcirculation/ApplypostResponse.java | d6afb9a1c54084bea4ba9440fd1db26fcb00dd20 | [] | no_license | BNU-Chen/landCirculation | 607c4e4f24468baa69c514805f0f08e17c710af4 | aa605f3e995b71b92809b08db89338855956351c | refs/heads/master | 2016-09-01T07:48:26.278494 | 2016-04-11T07:01:57 | 2016-04-11T07:01:57 | 47,209,283 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,499 | java | package cn.ac.irsa.landcirculation;
// Generated 2015-3-14 18:18:06 by Hibernate Tools 3.4.0.CR1
/**
* ApplypostResponse generated by hbm2java
*/
public class ApplypostResponse implements java.io.Serializable {
private Integer id;
private PostApply postApply;
private UserPerson userPersonByRecorderId;
private Apply apply;
private UserPerson userPersonByDealerId;
private String question;
private String responserName;
private String responserIdcode;
private String responserTel;
private String responserEmail;
private String responserAddress;
private String dealType;
private String dealComment;
public ApplypostResponse() {
}
public ApplypostResponse(PostApply postApply, UserPerson userPersonByRecorderId, Apply apply, UserPerson userPersonByDealerId, String question, String responserName, String responserIdcode, String responserTel, String responserEmail, String responserAddress, String dealType, String dealComment) {
this.postApply = postApply;
this.userPersonByRecorderId = userPersonByRecorderId;
this.apply = apply;
this.userPersonByDealerId = userPersonByDealerId;
this.question = question;
this.responserName = responserName;
this.responserIdcode = responserIdcode;
this.responserTel = responserTel;
this.responserEmail = responserEmail;
this.responserAddress = responserAddress;
this.dealType = dealType;
this.dealComment = dealComment;
}
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public PostApply getPostApply() {
return this.postApply;
}
public void setPostApply(PostApply postApply) {
this.postApply = postApply;
}
public UserPerson getUserPersonByRecorderId() {
return this.userPersonByRecorderId;
}
public void setUserPersonByRecorderId(UserPerson userPersonByRecorderId) {
this.userPersonByRecorderId = userPersonByRecorderId;
}
public Apply getApply() {
return this.apply;
}
public void setApply(Apply apply) {
this.apply = apply;
}
public UserPerson getUserPersonByDealerId() {
return this.userPersonByDealerId;
}
public void setUserPersonByDealerId(UserPerson userPersonByDealerId) {
this.userPersonByDealerId = userPersonByDealerId;
}
public String getQuestion() {
return this.question;
}
public void setQuestion(String question) {
this.question = question;
}
public String getResponserName() {
return this.responserName;
}
public void setResponserName(String responserName) {
this.responserName = responserName;
}
public String getResponserIdcode() {
return this.responserIdcode;
}
public void setResponserIdcode(String responserIdcode) {
this.responserIdcode = responserIdcode;
}
public String getResponserTel() {
return this.responserTel;
}
public void setResponserTel(String responserTel) {
this.responserTel = responserTel;
}
public String getResponserEmail() {
return this.responserEmail;
}
public void setResponserEmail(String responserEmail) {
this.responserEmail = responserEmail;
}
public String getResponserAddress() {
return this.responserAddress;
}
public void setResponserAddress(String responserAddress) {
this.responserAddress = responserAddress;
}
public String getDealType() {
return this.dealType;
}
public void setDealType(String dealType) {
this.dealType = dealType;
}
public String getDealComment() {
return this.dealComment;
}
public void setDealComment(String dealComment) {
this.dealComment = dealComment;
}
}
| [
"wucangeo@gmail.com"
] | wucangeo@gmail.com |
15077ef6e5d4eb987b0fdd36db2747fac8a3e0b8 | ce2de5b640b068299cc7652356487c681de38793 | /src/test/java/testingxperts/web/tests/IGP_TC_217.java | d5aa2713894ce18b79a0fe85882cfc6df97fa7bd | [] | no_license | sanyamigp/Automation_IGP | 40c8d6f3149f2af9432567b69d8b75e5599b255c | c06a78c9516f4b34842d16641ccc56f4f30a48f1 | refs/heads/master | 2021-01-19T09:58:35.436010 | 2017-05-26T13:10:41 | 2017-05-26T13:10:41 | 87,804,173 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,075 | java | package testingxperts.web.tests;
import org.openqa.selenium.By;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import listeners.CustomListeners;
import listeners.ExecutionStartEndListner;
import testingxperts.web.pages.CartPage;
import testingxperts.web.pages.CheckOutPage;
import testingxperts.web.pages.Constants;
import testingxperts.web.pages.DeliveryPage;
import testingxperts.web.pages.HomePage;
import testingxperts.web.pages.OrderSummaryPage;
import testingxperts.web.pages.PaymentPage;
import testingxperts.web.pages.PersonalizedGiftsPage;
import testingxperts.web.pages.PaymentPage.Wallets;
import utilities.ConfigReader;
import utilities.GlobalUtil;
import utilities.HtmlReportUtil;
import utilities.KeywordUtil;
@Listeners({CustomListeners.class,ExecutionStartEndListner.class})
public class IGP_TC_217 extends KeywordUtil{
String stepInfo="";
int retryCount=getIntValue("retryCount");
static int retryingNumber=1;
@Test(
testName="IGP_TC_217",
groups={"Payment"},
description="PayPal: Ensure that PayPal option in Payment page."
)
public void test() throws Throwable {
try{
setTestCaseID(getClass().getSimpleName());
//======================BASIC SETTING FOR TEST==========================================================
if(retryingNumber==1)
initTest();
//================== END BASIC SETTING ============================================================
/*
How to Test steps
1. Define step info
2. Log to report and Logger
3. Perform Action
4. Verify Action
*/
//.........Script Start...........................
stepInfo="Open home page";
logStep(stepInfo);
HomePage.openHomePage();
verifyStep(HomePage.isHomePageOpened(), stepInfo);
stepInfo="Select product from best selling";
logStep(stepInfo);
verifyStep(HomePage.selectItemEditorPick(2),stepInfo);
stepInfo="Enter valid Pin code and validate";
logStep(stepInfo);
CartPage.inputPinCode(Constants.PINCODE);
CartPage.checkPinCode();
verifyStep(PersonalizedGiftsPage.personalizedMethod(), stepInfo);
stepInfo="Buy Now";
logStep(stepInfo);
executeStep(CartPage.clikBuyNow(), stepInfo);
stepInfo="The page should navigate to cart page";
verifyStep(CartPage.verifyOrderDetailsPageLoaded(),stepInfo);
stepInfo="Place order";
logStep(stepInfo);
CartPage.clickPlaceOrder();
pause(2000);
stepInfo="The user should be navigated to checkout page.";
verifyStep(CheckOutPage.isCheckOutPageLoaded(),
stepInfo);
stepInfo="Login at checkout page";
logStep(stepInfo);
CheckOutPage.doLogin(ConfigReader.getValue("loginUser"), ConfigReader.getValue("loginPassword"));
verifyStep(DeliveryPage.verifyDeliveryPageLoaded(),
stepInfo);
stepInfo="Click Deliver here";
executeStep(click(DeliveryPage.btnDeliverHere), stepInfo);
stepInfo="Verify user navigated to Order Summary page";
logStep(stepInfo);
verifyStep(OrderSummaryPage.isOrderSummaryPageLoaded(),stepInfo);
stepInfo="Verify User should Navigate to Payment page";
logStep(stepInfo);
executeStep(click(OrderSummaryPage.btnPlaceOrder), "Click place order");
verifyStep(PaymentPage.isPaymentPageLoaded(),stepInfo);
PaymentPage.clickPaymentOption(PaymentPage.PaymentOptions.PAYPAL);
stepInfo="Verify Paypal option. When use click on PAYPAL it should opne the PAYPAL form.";
logStep(stepInfo);
verifyStep(
PaymentPage.verifyPaymentOptionIsDisplayed(PaymentPage.PaymentOptions.PAYPAL),
stepInfo);
String elementSShot=takeScreenshotWebElement(waitForVisibile(By.cssSelector(".payment-block")),"PaymentMethods");
HtmlReportUtil.attachScreenshotForInfo(elementSShot);
//.........Script Start...........................
}
catch (Exception e){
if(retryCount>0)
{
String imagePath = takeScreenshot(getDriver(), getTestCaseID()+"_"+ retryingNumber,"Automation Bugs: "+stepInfo);
logStepFail(stepInfo+" - "+KeywordUtil.lastAction);
logStepError(e.getMessage());
HtmlReportUtil.attachScreenshot(imagePath,false);
GlobalUtil.getTestResult().setScreenshotref(imagePath);
HtmlReportUtil.stepInfo("Trying to Rerun" + " "+getTestCaseID() +" for " + retryingNumber + " time");
retryCount--;
retryingNumber++;
utilities.LogUtil.infoLog(getClass(), "****************Waiting for " + getIntValue("retryDelayTime") +" Secs before retrying.***********");
delay(getIntValue("retryDelayTime"));
//Rerun same test
test();
}
else{
String imagePath = takeScreenshot(getDriver(), getTestCaseID(),"Automation Bugs: "+stepInfo);
logStepFail(stepInfo+" - "+KeywordUtil.lastAction);
logStepError(e.getMessage());
HtmlReportUtil.attachScreenshot(imagePath,false);
GlobalUtil.getTestResult().setScreenshotref(imagePath);
GlobalUtil.setTestException(e);
throw e;
}
}
}//End Test
}
| [
"sanyam.arora@testingxperts.com"
] | sanyam.arora@testingxperts.com |
a4ff2a5f9a0da270f07d3ce98db70cdee93fb5d8 | 618d877ff4e57f03fde767996480602ab1c5f668 | /app/src/main/java/cuanlee/pcstore_application/views/MainActivity.java | 8b81769bf1d13d4126a80299cc122955ad9d153e | [] | no_license | OptimusLee/pcStoreApp | 201236e5e9227c1273b23fa55fc1a7f58c4f4b33 | 25fa6f31fe8df8e4ce9d1f4f137029cd7cfacb46 | refs/heads/master | 2020-09-16T20:19:32.929892 | 2016-09-01T17:16:46 | 2016-09-01T17:16:46 | 67,104,990 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,095 | java | package cuanlee.pcstore_application.views;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.util.List;
import cuanlee.pcstore_application.R;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
login();
exit();
}
private void login() {
Button btn = (Button)findViewById(R.id.btnLogin);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
EditText txtusername = (EditText)findViewById(R.id.txtBxUsername);
EditText txtpassword = (EditText)findViewById(R.id.txtBxPassword);
TextView lbl = (TextView)findViewById(R.id.lblInvalid);
if(txtusername.getText().toString().equalsIgnoreCase("cuanlee" ) && txtpassword.getText().toString().equalsIgnoreCase("cuanlee123"))
{
Toast.makeText(MainActivity.this,"Welcome To My PC Store",Toast.LENGTH_LONG).show();
lbl.setVisibility(View.INVISIBLE);
Intent i = new Intent(MainActivity.this, Home.class);
//i.putExtra("Tab", "Patient");
finish();
startActivity(i);
}
else
{
lbl.setVisibility(View.VISIBLE);
}
}
});
}
private void exit() {
Button btn = (Button)findViewById(R.id.btnExit);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
System.exit(1);
}
});
}
}
| [
"cuan.secret.lee@gmail.com"
] | cuan.secret.lee@gmail.com |
a9d1e34e8c880607beb38515bec71effefd8cd25 | 9302b7abc83eaaf9a15205bc10d36305c7c78c8c | /Dungeons_Online/src/bg/sofia/uni/fmi/mjt/field/Map.java | 7a8921be67cc8804862c7a3c8436f50dbffa3e99 | [] | no_license | KristiyanGeorgiev98/Java-problems | 1943fa22e3a079c5b1fb0767e511dc6784486645 | 43722f91e787239d4c1da35383cc4e5950866152 | refs/heads/master | 2020-08-15T09:18:43.205309 | 2020-02-12T11:12:59 | 2020-02-12T11:12:59 | 215,315,367 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,081 | java | package bg.sofia.uni.fmi.mjt.field;
import bg.sofia.uni.fmi.mjt.actors.Minion;
import bg.sofia.uni.fmi.mjt.actors.Player;
public interface Map {
//get minion by his coordinates on the map
Minion getMinion(int rawPosition, int columnPosition);
//get treasure by his coordinates on the map
Treasure getTreasure(int rawPosition, int columnPosition);
//get mapArray
Cell[][] getMapArray();
//get array of minions
Minion[] getArrayOfMinions();
//get array of players
Player[] getArrayOfPlayers();
//get array of treasures
Treasure[] getArrayOfTreasures();
//convert Map to StringBuilder
StringBuilder convertToStringBuilder();
//put minion on the map
void putMinionOnMap(int uniqueNumber);
//put player on the map
void putPlayerOnMap(Player player);
////pick random type of treasure(weapon,spell,potion)
Treasure setRandomTreasure();
////put treasure on the map
void putTreasureOnMap(int uniqueNumber);
//a player moves on the map
void move(int direction, Player player);
}
| [
"33729969+krisi9825@users.noreply.github.com"
] | 33729969+krisi9825@users.noreply.github.com |
156d97d489f2eea5d681bbedfbb7ac82f247dc74 | 1a936b7ba78ebd9020af19bbfd837bf5fd8cfc99 | /src/main/java/com/kshrd/repository/PropertyRepository.java | 7cb6acd11dcc0444b820da6e390e8f29f11f129c | [] | no_license | spring-advanced-course-5th/lost-and-found | 9be4804d71971c36fb7d5dde6038087ddac52519 | 8687df2ce1117289f41b16c5436cf5b9de943592 | refs/heads/master | 2021-08-06T13:34:28.323590 | 2017-11-06T01:55:50 | 2017-11-06T01:55:50 | 108,991,805 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 625 | java | package com.kshrd.repository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RestResource;
import org.springframework.stereotype.Repository;
import com.kshrd.model.Property;
@Repository
public interface PropertyRepository extends JpaRepository<Property, Integer>{
@RestResource(path="type", rel="type")
Page<Property> findByType(@Param("type") String type, @Param("pageable") Pageable pageable);
}
| [
"rathphearun168@gmail.com"
] | rathphearun168@gmail.com |
927bd2f66726075eddb06e8d8ef03f96bbf51138 | c54ab7d7d7e0161af315d7cbae669b4c52029951 | /CoreJava/src/com/techchefs/javaapp/doublecolon/six/Example1.java | 479cea71d65b2683cb68b1f15deca30b47055856 | [] | no_license | deekshitr/ELF-06June19-TechChefs-DeekshitR | 82c6796ad0ec142896e17971f2d9fd73aeb0d1c4 | 5296cbdddb89b3ef4a529f04f6aba500d474a327 | refs/heads/master | 2023-01-13T12:33:11.550703 | 2019-08-22T14:33:09 | 2019-08-22T14:33:09 | 192,527,129 | 0 | 0 | null | 2023-01-04T06:58:16 | 2019-06-18T11:31:00 | Rich Text Format | UTF-8 | Java | false | false | 368 | java | package com.techchefs.javaapp.doublecolon.six;
import lombok.extern.java.Log;
@Log
public class Example1 {
public static void main(String[] args) {
MyProduct mp = Product::new;
Product p1 = mp.getProductDetails("Fan", 45646.43);
log.info("Product: "+p1);
Product p2 = mp.getProductDetails("AirConditioner", 56756.34);
log.info("Product: "+p2);
}
}
| [
"deekshitr456@gmai.com"
] | deekshitr456@gmai.com |
df277a27e080ca7edf1eb293cfce32f5684dbbb5 | 7166891906830d7f572730e02ce4cf01ccf792c7 | /plugins/dotnet/robocode.dotnet.host/src/main/java/robocode/exception/DisabledException_.java | c826c3f030f2b0ae05757f0285c83469f234165f | [] | no_license | EamonnACI/ACI-SpaceRace | 99ea5968119521aa3dcc957957e26439b4e6eeae | bf92be98e9c44d9df8b5e4c1463e9cd68ed51363 | refs/heads/master | 2020-12-11T03:20:26.232651 | 2014-09-16T15:46:50 | 2014-09-16T15:46:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 900 | java | // ------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by jni4net. See http://jni4net.sourceforge.net/
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
// ------------------------------------------------------------------------------
package robocode.exception;
@net.sf.jni4net.attributes.ClrTypeInfo
public final class DisabledException_ {
//<generated-static>
private static system.Type staticType;
public static system.Type typeof() {
return robocode.exception.DisabledException_.staticType;
}
private static void InitJNI(net.sf.jni4net.inj.INJEnv env, system.Type staticType) {
robocode.exception.DisabledException_.staticType = staticType;
}
//</generated-static>
}
| [
"ericcurtin1990@gmail.com"
] | ericcurtin1990@gmail.com |
980a4b3be81dd693b3462702eb65c269a0294e7d | 87a0ddd63ad59eece0b7964a22a710c43f333ad5 | /src/main/java/com/baizhitong/resource/dao/point/sqlserver/PointRuleLotteryOrgDaoImpl.java | e2ed21df96c840fbf0acf1e69ee19f56c7237470 | [] | no_license | royxpf/cloud | b41101f87b4edf3e228266f533836d1951768959 | 84f81431536c11ebe98fc67773e0c8a1223f7b7b | refs/heads/master | 2020-06-27T02:13:56.374981 | 2017-04-25T07:48:42 | 2017-04-25T07:48:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,928 | java | package com.baizhitong.resource.dao.point.sqlserver;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import com.baizhitong.common.Page;
import com.baizhitong.common.dao.jdbc.QueryRule;
import com.baizhitong.resource.common.core.dao.BaseSqlServerDao;
import com.baizhitong.resource.dao.point.PointRuleLotteryOrgDao;
import com.baizhitong.resource.model.point.PointRuleLotteryOrg;
import com.baizhitong.utils.DateUtils;
/**
* 积分规则dao实现 PointRuleLotteryOrgDaoImpl TODO
*
* @author creator BZT 2016年6月23日 下午5:03:07
* @author updater
*
* @version 1.0.0
*/
@Service
public class PointRuleLotteryOrgDaoImpl extends BaseSqlServerDao<PointRuleLotteryOrg>
implements PointRuleLotteryOrgDao {
/**
* 查询积分规则 ()<br>
*
* @param page
* @param rows
* @return
*/
public Page getList(String orgCode, Integer page, Integer rows) {
StringBuffer sql = new StringBuffer();
Map<String, Object> sqlParam = new HashMap<String, Object>();
sql.append("select");
sql.append(" * ");
sql.append(" FROM");
sql.append(" point_rule_lottery_org ");
sql.append(" WHERE");
sql.append(" 1=1 and flagDelete=0 ");
if (StringUtils.isNotEmpty(orgCode)) {
sql.append(" and orgCode=:orgCode ");
sqlParam.put("orgCode", orgCode);
}
sql.append(" order by startTime desc ");
return super.queryDistinctPage(sql.toString(), sqlParam, page, rows);
}
/**
* 机构积分规则 ()<br>
*
* @param ruleOrg
* @return
*/
public boolean add(PointRuleLotteryOrg ruleOrg) {
try {
return super.saveOne(ruleOrg);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
}
/**
* 查询机构积分规则 ()<br>
*
* @param id
* @return
*/
public PointRuleLotteryOrg getById(Integer id) {
QueryRule qr = QueryRule.getInstance();
qr.andEqual("id", id);
qr.andEqual("flagDelete", 0);
return super.findUnique(qr);
}
/**
* 让之前的规则失效 ()<br>
*
* @return
*/
public int makeExpire(String orgCode) {
StringBuffer sql = new StringBuffer();
Map<String, Object> sqlParam = new HashMap<String, Object>();
sql.append("UPDATE");
sql.append(" point_rule_lottery_org ");
sql.append(" SET");
sql.append(" expireTime =:expireTime ");
sql.append(" WHERE");
sql.append(" expireTime='99999999999999' ");
sql.append(" and orgCode=:orgCode");
sqlParam.put("orgCode", orgCode);
sqlParam.put("expireTime", Long.parseLong(DateUtils.getDate(new Date(), "yyyyMMddHHmmss")));
sqlParam.put("startTime", Long.parseLong(DateUtils.getDate(new Date(), "yyyyMMddHHmmss")));
return super.update(sql.toString(), sqlParam);
}
/**
* 删除 ()<br>
*
* @param id
* @return
*/
public int delete(int id) {
StringBuffer sql = new StringBuffer();
Map<String, Object> sqlParam = new HashMap<String, Object>();
sql.append("UPDATE");
sql.append(" point_rule_lottery_org ");
sql.append(" SET");
sql.append(" flagDelete =1 ");
sql.append(" WHERE");
sql.append(" id =:id ");
sqlParam.put("id", id);
return super.update(sql.toString(), sqlParam);
}
}
| [
"2636011620@qq.com"
] | 2636011620@qq.com |
09d2051123fd906c79ae6f159f4224dbb6085d75 | 0ff8e08c3ff14b7c1375770292fc0dd5f91de99a | /core/src/main/java/com/xmg/p2p/base/query/SystemDictionaryQueryObject.java | 57a20e938377aefb81cd120a51be22f0ace7ca6a | [] | no_license | jluffy/p2p | a529f21d5af158febd556f5397efa2237c512a5d | 7d50a00a3877f120b0f0f384fff41b4020abdbc6 | refs/heads/master | 2021-05-15T06:41:36.736977 | 2017-12-04T14:07:24 | 2017-12-04T14:07:27 | 113,047,126 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 327 | java | package com.xmg.p2p.base.query;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;
@Setter@Getter
public class SystemDictionaryQueryObject extends QueryObject {
private String keyword;
public String getKeyword(){
return StringUtils.isEmpty(keyword)?null:keyword;
}
}
| [
"522346046@qq.com"
] | 522346046@qq.com |
fcf35bf580fdf89c94c2e01bea708baf5fef0f41 | 69ee54f441cf7f756efb22fd04adaf4375c4246b | /src/logic/testclass.java | 6f328357ebedf0e4cc0a0958bff9635a22f6ec2c | [] | no_license | cualquiercosa327/Nbody | e047b9b968deee389ad73c385e557e132704b1cb | 00a8769b19f00aba38d1527419c5c13593de76b8 | refs/heads/master | 2023-03-16T18:20:30.001932 | 2017-06-13T11:49:14 | 2017-06-13T11:49:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,293 | 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 logic;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import static java.lang.Double.parseDouble;
import java.util.Scanner;
/**
*
* @author Kuba
*/
public class testclass {
public static void main(String[] args) {
PlanetList pl = new PlanetList();
//Planet planet = new Planet();
int i = 0;
Scanner file = null;
try {
file = new Scanner(new BufferedReader(new FileReader("data.txt")));
while (i < 5) {
Planet planet = new Planet(file.next(), parseDouble(file.next()), parseDouble(file.next()), parseDouble(file.next()), parseDouble(file.next()),
parseDouble(file.next()), parseDouble(file.next()), parseDouble(file.next()));
pl.addNewPlanet(planet);
i++;
}
} catch (IOException e) {
System.err.println("Nieudana próba otwarcia pliku!");
} finally {
if (file != null) {
file.close();
}
}
pl.showPlanetList();
}
}
| [
"kubabar1@interia.pl"
] | kubabar1@interia.pl |
2923e3a31181a4f7dc1882b3154466bb025d33cd | 0cc72c58116db16698bbac7a93673f3e9668e052 | /FirstProject/src/learning/constructor/example/Employee.java | 569c7a1fc7820bd2ea576810c539b39e20ea57b6 | [] | no_license | sajansunny/SeleniumProjects | d67c90d329a455df96d3a645149a02eebc5f7767 | 0501098b50221983b3a8e67b926b89a8482373cc | refs/heads/master | 2020-04-19T04:18:56.648435 | 2019-02-08T08:21:15 | 2019-02-08T08:21:15 | 167,959,697 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 691 | java | package learning.constructor.example;
public class Employee extends Human {
private String name;
private int age;
public Employee() {
System.out.println("Inside Employee");
// TODO Auto-generated constructor stub
}
public Employee(String name, int age) {
super(age+1);
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
@Override
public String toString() {
return "Employee [name=" + name + ", age=" + age + ", getId()=" + getId() + "]";
}
}
| [
"admin@DESKTOP-IBO3EG0"
] | admin@DESKTOP-IBO3EG0 |
0c515ee67c329f4a25bbf1e1dfa8878ee6e0b5e0 | 7b1d46edebf84b215e0285a69f6565532c72c4ef | /src/main/java/org/bootcamp/AWS/ApacheHttpClientGet.java | bf838f19ae2c421b45499713cbffeaa4da7cf7a0 | [] | no_license | bootcamp-repository/eBook-linux2 | a282adc4ddb4de93d8ad3d701683e2074f4d37dc | 643b260083b3582b997fd68bfa666110af6a508b | refs/heads/master | 2021-01-01T15:49:11.570031 | 2017-07-19T11:54:51 | 2017-07-19T11:54:51 | 97,710,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,135 | java | package org.bootcamp.AWS;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.ObjectOutputStream;
import java.io.Reader;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.util.Base64;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.web.util.UriComponentsBuilder;
import com.google.gson.Gson;
import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
public class ApacheHttpClientGet {
//final static String url = "http://localhost:5000/";
final static String url = "http://spring-boot-jpa-oracle-example-dev.eu-central-1.elasticbeanstalk.com/";
private static String readAll(Reader rd) throws IOException {
StringBuilder sb = new StringBuilder();
int cp;
while ((cp = rd.read()) != -1) {
sb.append((char) cp);
}
return sb.toString();
}
public static User searchUser(User user) throws IOException, JSONException {
String request = "searchUser?name=";
String fullUrl = url + request + user.getName();
InputStream is = new URL(fullUrl).openStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
String jsonText = readAll(rd);
Gson gson=new Gson();
User[] user2 = gson.fromJson(jsonText,User[].class);
if (user2.length > 0)
return user2[0];
else
return null;
} finally {
is.close();
}
}
public static Book searchBook(Book book) throws IOException, JSONException {
String request = "searchUser?name=";
String fullUrl = url + request + book.getName();
InputStream is = new URL(fullUrl).openStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
String jsonText = readAll(rd);
Gson gson=new Gson();
Book[] book2 = gson.fromJson(jsonText,Book[].class);
if (book2.length > 0)
return book2[0];
else
return null;
} finally {
is.close();
}
}
public static void deleteUser(User user) throws IOException, JSONException {
String request = "deleteUser?id=";
String fullUrl = url + request + user.getId();
System.out.println(fullUrl);
new URL(fullUrl).openStream();
}
public static void deleteBook(Book book) throws IOException, JSONException {
String request = "deleteBook?id=";
String fullUrl = url + request + book.getId();
System.out.println(fullUrl);
new URL(fullUrl).openStream();
}
public static User inserUser(User user) throws IOException, JSONException {
String request = "insertUser?name=";
String fullUrl = url + request + user.getName();
System.out.println(fullUrl);
InputStream is = new URL(fullUrl).openStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
String jsonText2 = readAll(rd);
Gson gson=new Gson();
User user2 = gson.fromJson(jsonText2,User.class);
return user2;
} finally {
is.close();
}
}
public static Book inserBook(Book book, User user) throws IOException, JSONException {
String request = "insertBook?name=";
String request2 = "&user=";
String fullUrl = url + request + book.getName() + request2 + user.getId();
System.out.println(fullUrl);
InputStream is = new URL(fullUrl).openStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
String jsonText2 = readAll(rd);
Gson gson=new Gson();
Book book2 = gson.fromJson(jsonText2,Book.class);
return book2;
} finally {
is.close();
}
}
public static Book updateBook(Book book, User user) throws IOException, JSONException {
String request = "insertUser?line=";
String request2 = "&user=";
String request3 = "&name=";
String request4 = "&id=";
String fullUrl = url + request + book.getLine() + request2 + user.getId()+request3 + book.getName()+request4 + book.getId();
System.out.println(fullUrl);
InputStream is = new URL(fullUrl).openStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
String jsonText2 = readAll(rd);
Gson gson=new Gson();
Book book2 = gson.fromJson(jsonText2,Book.class);
return book2;
} finally {
is.close();
}
}
public static User updateUser(User user) throws IOException, JSONException {
String request = "insertUser?book=";
String request1 = "&user=";
String request2 = "&name=";
String fullUrl = url + request + user.getBookId() + request1 + user.getId() + request2 + user.getName();
System.out.println(fullUrl);
InputStream is = new URL(fullUrl).openStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
String jsonText2 = readAll(rd);
Gson gson=new Gson();
User user2 = gson.fromJson(jsonText2,User.class);
return user2;
} finally {
is.close();
}
}
}
| [
"smolovskis@gmail.com"
] | smolovskis@gmail.com |
6f66f35a24b9cf0496dc4ac38e87c4cb5ce01d67 | 51cdd218729cf232a9a607be97d0ca9dc4769103 | /src/main/java/com/cos/blog/test/BlogControllerTest.java | 0bf6c39964f4a35124334c2ca784c128b023da9c | [] | no_license | choiheejo/Springboot-Jpa-Blog | 46d5297e4ce25a172427230e7d45de9fc3508e2a | 4537a95ba90a96d6dad3f543d85876e9cc5cc49d | refs/heads/master | 2023-07-16T17:52:59.306824 | 2021-09-04T12:15:00 | 2021-09-04T12:15:00 | 313,815,596 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 425 | java | package com.cos.blog.test;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController // 스프링이 com.cos.blog 패키지 이하를 스캔해서 모든파일을 메모리에 new 하는것은 아니구요
public class BlogControllerTest {
@GetMapping("/test/hello")
public String hello() {
return "<h1>hello spring boot </h1>";
}
}
| [
"hjmask@empal.com"
] | hjmask@empal.com |
bbc7f03170a218df409fa9114ec92cdd74900009 | c6a2ddd0afbdd7fbdab6f121c9dfe00e38ff3434 | /src/main/java/com/bs/util/AuthImage.java | fdb609641aa3c8f41e1862eabf9d23a005657310 | [] | no_license | huangcz3/rentcar | 3c298ea45cfe3dd461092f96afacf2d13240a880 | 3b33288106dd34e3181828edc623dd92646866bf | refs/heads/master | 2020-03-07T21:42:40.650388 | 2018-05-12T11:17:33 | 2018-05-12T11:17:33 | 127,733,562 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,314 | java | package com.bs.util;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
/**
* AuthImage Description:(验证码)
* @author User
*/
public class AuthImage extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
static final long serialVersionUID = 1L;
@Override
public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
response.setContentType("image/jpeg");
System.out.println("AuthImage.service()");
//生成随机字串
String verifyCode = VerifyCodeUtils.generateVerifyCode(4);
//存入会话session
HttpSession session = request.getSession(true);
//删除以前的
session.removeAttribute("randStr");
//设置新的验证码
session.setAttribute("randStr", verifyCode.toLowerCase());
//生成图片
int w = 107, h = 38;
VerifyCodeUtils.outputImage(w, h, response.getOutputStream(), verifyCode);
}
} | [
"273514614@qq.com"
] | 273514614@qq.com |
5e931b0d58d97dd2ba80c11020e1dbbacdce4b8c | ed84e80142efce9d6c36cc0751ba9f4a3cb4c9fc | /compilertools/src/com/strobel/decompiler/languages/java/ast/AstBuilder.java | 8e744c7b54e5ecf4332f1ff9d1cb0bdd5efdf55b | [] | no_license | fxxing/procyon | 0c02da60ff598942e600490a2d18f47ded62b592 | 623e3966a25345e3985d4eb70c49100ae4e76661 | refs/heads/master | 2021-03-12T23:55:46.386475 | 2013-12-20T07:55:44 | 2013-12-20T07:55:44 | 15,332,921 | 7 | 0 | null | null | null | null | UTF-8 | Java | false | false | 33,468 | java | /*
* AstBuilder.java
*
* Copyright (c) 2013 Mike Strobel
*
* This source code is based on Mono.Cecil from Jb Evain, Copyright (c) Jb Evain;
* and ILSpy/ICSharpCode from SharpDevelop, Copyright (c) AlphaSierraPapa.
*
* This source code is subject to terms and conditions of the Apache License, Version 2.0.
* A copy of the license can be found in the License.html file at the root of this distribution.
* By using this source code in any fashion, you are agreeing to be bound by the terms of the
* Apache License, Version 2.0.
*
* You must not remove this notice, or any other, from this software.
*/
package com.strobel.decompiler.languages.java.ast;
import com.strobel.assembler.ir.attributes.AnnotationDefaultAttribute;
import com.strobel.assembler.ir.attributes.AttributeNames;
import com.strobel.assembler.ir.attributes.LineNumberTableAttribute;
import com.strobel.assembler.ir.attributes.SourceAttribute;
import com.strobel.assembler.metadata.*;
import com.strobel.assembler.metadata.annotations.*;
import com.strobel.core.ArrayUtilities;
import com.strobel.core.MutableInteger;
import com.strobel.core.Predicate;
import com.strobel.core.StringUtilities;
import com.strobel.core.VerifyArgument;
import com.strobel.decompiler.DecompilerContext;
import com.strobel.decompiler.DecompilerSettings;
import com.strobel.decompiler.ITextOutput;
import com.strobel.decompiler.ast.TypeAnalysis;
import com.strobel.decompiler.languages.LineNumberPosition;
import com.strobel.decompiler.languages.java.JavaOutputVisitor;
import com.strobel.decompiler.languages.java.ast.transforms.IAstTransform;
import com.strobel.decompiler.languages.java.ast.transforms.TransformationPipeline;
import com.strobel.util.ContractUtils;
import javax.lang.model.element.Modifier;
import java.util.*;
public final class AstBuilder {
private final DecompilerContext _context;
private final CompilationUnit _compileUnit = new CompilationUnit();
private final Map<String, TypeDeclaration> _typeDeclarations = new LinkedHashMap<>();
private final Map<String, String> _unqualifiedTypeNames = new LinkedHashMap<>();
private TextNode _packagePlaceholder;
private boolean _decompileMethodBodies = true;
private boolean _haveTransformationsRun;
public AstBuilder(final DecompilerContext context) {
_context = VerifyArgument.notNull(context, "context");
final String headerText = context.getSettings().getOutputFileHeaderText();
if (!StringUtilities.isNullOrWhitespace(headerText)) {
final List<String> lines = StringUtilities.split(headerText, false, '\n');
for (final String line : lines) {
_compileUnit.addChild(new Comment(" " + line.trim(), CommentType.SingleLine), Roles.COMMENT);
}
_compileUnit.addChild(new UnixNewLine(), Roles.NEW_LINE);
}
_packagePlaceholder = new TextNode();
_compileUnit.addChild(_packagePlaceholder, Roles.TEXT);
if (_context.getUserData(Keys.AST_BUILDER) == null) {
_context.putUserData(Keys.AST_BUILDER, this);
}
}
final DecompilerContext getContext() {
return _context;
}
public final boolean getDecompileMethodBodies() {
return _decompileMethodBodies;
}
public final void setDecompileMethodBodies(final boolean decompileMethodBodies) {
_decompileMethodBodies = decompileMethodBodies;
}
public final CompilationUnit getCompilationUnit() {
return _compileUnit;
}
public final void runTransformations() {
runTransformations(null);
}
public final void runTransformations(final Predicate<IAstTransform> transformAbortCondition) {
TransformationPipeline.runTransformationsUntil(_compileUnit, transformAbortCondition, _context);
_haveTransformationsRun = true;
}
public final void addType(final TypeDefinition type) {
final TypeDeclaration astType = createType(type);
final String packageName = type.getPackageName();
if (_compileUnit.getPackage().isNull() && !StringUtilities.isNullOrWhitespace(packageName)) {
_compileUnit.insertChildBefore(
_packagePlaceholder,
new PackageDeclaration(packageName),
Roles.PACKAGE
);
_packagePlaceholder.remove();
}
_compileUnit.addChild(astType, CompilationUnit.MEMBER_ROLE);
}
public final TypeDeclaration createType(final TypeDefinition type) {
VerifyArgument.notNull(type, "type");
final TypeDeclaration existingDeclaration = _typeDeclarations.get(type.getInternalName());
if (existingDeclaration != null) {
return existingDeclaration;
}
return createTypeNoCache(type);
}
protected final TypeDeclaration createTypeNoCache(final TypeDefinition type) {
VerifyArgument.notNull(type, "type");
final TypeDefinition oldCurrentType = _context.getCurrentType();
_context.setCurrentType(type/*typeWithCode*/);
try {
return createTypeCore(type/*typeWithCode*/);
}
finally {
_context.setCurrentType(oldCurrentType);
}
}
public AstType convertType(final TypeReference type) {
return convertType(type, new ConvertTypeOptions());
}
public AstType convertType(final TypeReference type, final ConvertTypeOptions options) {
return convertType(type, new MutableInteger(0), options);
}
public final List<ParameterDeclaration> createParameters(final Iterable<ParameterDefinition> parameters) {
final List<ParameterDeclaration> declarations = new ArrayList<>();
for (final ParameterDefinition p : parameters) {
final TypeReference type = p.getParameterType();
final AstType astType = convertType(type);
final ParameterDeclaration d = new ParameterDeclaration(p.getName(), astType);
d.putUserData(Keys.PARAMETER_DEFINITION, p);
for (final CustomAnnotation annotation : p.getAnnotations()) {
d.getAnnotations().add(createAnnotation(annotation));
}
declarations.add(d);
if (p.isFinal()) {
EntityDeclaration.addModifier(d, Modifier.FINAL);
}
}
return Collections.unmodifiableList(declarations);
}
final AstType convertType(final TypeReference type, final MutableInteger typeIndex, final ConvertTypeOptions options) {
if (type == null) {
return AstType.NULL;
}
if (type.isArray()) {
return convertType(type.getElementType(), typeIndex.increment(), options).makeArrayType();
}
if (type.isGenericParameter()) {
final SimpleType simpleType = new SimpleType(type.getSimpleName());
simpleType.putUserData(Keys.TYPE_REFERENCE, type);
return simpleType;
}
if (type.isPrimitive()) {
final SimpleType simpleType = new SimpleType(type.getSimpleName());
simpleType.putUserData(Keys.TYPE_REFERENCE, type.resolve());
return simpleType;
}
if (type.isWildcardType()) {
if (!options.getAllowWildcards()) {
if (type.hasExtendsBound()) {
return convertType(type.getExtendsBound(), options);
}
return convertType(BuiltinTypes.Object, options);
}
final WildcardType wildcardType = new WildcardType();
if (type.hasExtendsBound()) {
wildcardType.addChild(convertType(type.getExtendsBound()), Roles.EXTENDS_BOUND);
}
else if (type.hasSuperBound()) {
wildcardType.addChild(convertType(type.getSuperBound()), Roles.SUPER_BOUND);
}
wildcardType.putUserData(Keys.TYPE_REFERENCE, type);
return wildcardType;
}
final boolean includeTypeArguments = options == null || options.getIncludeTypeArguments();
final boolean includeTypeParameterDefinitions = options == null || options.getIncludeTypeParameterDefinitions();
final boolean allowWildcards = options == null || options.getAllowWildcards();
if (type instanceof IGenericInstance && includeTypeArguments) {
final AstType baseType;
final IGenericInstance genericInstance = (IGenericInstance) type;
if (options != null) {
options.setIncludeTypeParameterDefinitions(false);
}
try {
baseType = convertType(
(TypeReference) genericInstance.getGenericDefinition(),
typeIndex.increment(),
options
);
}
finally {
if (options != null) {
options.setIncludeTypeParameterDefinitions(includeTypeParameterDefinitions);
}
}
if (options != null) {
options.setAllowWildcards(true);
}
final List<AstType> typeArguments = new ArrayList<>();
try {
for (final TypeReference typeArgument : genericInstance.getTypeArguments()) {
typeArguments.add(convertType(typeArgument, typeIndex.increment(), options));
}
}
finally {
if (options != null) {
options.setAllowWildcards(allowWildcards);
}
}
applyTypeArguments(baseType, typeArguments);
baseType.putUserData(Keys.TYPE_REFERENCE, type);
return baseType;
}
final String name;
final PackageDeclaration packageDeclaration = _compileUnit.getPackage();
final TypeDefinition resolvedType = type.resolve();
final TypeReference nameSource = resolvedType != null ? resolvedType : type;
if (options == null || options.getIncludePackage()) {
final String packageName = nameSource.getPackageName();
name = StringUtilities.isNullOrEmpty(packageName) ? nameSource.getSimpleName()
: packageName + "." + nameSource.getSimpleName();
}
else if (packageDeclaration != null &&
StringUtilities.equals(packageDeclaration.getName(), nameSource.getPackageName())) {
String unqualifiedName = nameSource.getSimpleName();
TypeReference current = nameSource;
while (current.isNested()) {
current = current.getDeclaringType();
if (isContextWithinType(current)) {
break;
}
unqualifiedName = current.getSimpleName() + "." + unqualifiedName;
}
name = unqualifiedName;
}
else {
final TypeReference typeToImport;
String unqualifiedName;
if (nameSource.isNested()) {
unqualifiedName = nameSource.getSimpleName();
TypeReference current = nameSource;
while (current.isNested()) {
current = current.getDeclaringType();
unqualifiedName = current.getSimpleName() + "." + unqualifiedName;
}
typeToImport = current;
}
else {
typeToImport = nameSource;
unqualifiedName = nameSource.getSimpleName();
}
if (options.getAddImports() && !_typeDeclarations.containsKey(typeToImport.getInternalName())) {
String importedName = _unqualifiedTypeNames.get(typeToImport.getSimpleName());
if (importedName == null) {
final SimpleType importedType = new SimpleType(typeToImport.getFullName());
importedType.putUserData(Keys.TYPE_REFERENCE, typeToImport);
if (!StringUtilities.equals(typeToImport.getPackageName(), "java.lang")) {
if (packageDeclaration != null) {
_compileUnit.insertChildAfter(
packageDeclaration,
new ImportDeclaration(importedType),
CompilationUnit.IMPORT_ROLE
);
}
else {
_compileUnit.getImports().add(new ImportDeclaration(importedType));
}
}
_unqualifiedTypeNames.put(typeToImport.getSimpleName(), typeToImport.getFullName());
importedName = typeToImport.getFullName();
}
if (importedName.equals(typeToImport.getFullName())) {
name = unqualifiedName;
}
else {
final String packageName = nameSource.getPackageName();
name = StringUtilities.isNullOrEmpty(packageName) ? nameSource.getSimpleName()
: packageName + "." + nameSource.getSimpleName();
}
}
else {
name = nameSource.getSimpleName();
}
}
final SimpleType astType = new SimpleType(name);
astType.putUserData(Keys.TYPE_REFERENCE, type);
/*
if (nameSource.isGenericType() && includeTypeParameterDefinitions) {
addTypeArguments(nameSource, astType);
}
*/
return astType;
}
private boolean isContextWithinType(final TypeReference type) {
final TypeReference scope = _context.getCurrentType();
for (TypeReference current = scope;
current != null;
current = current.getDeclaringType()) {
if (MetadataResolver.areEquivalent(current, type)) {
return true;
}
}
return false;
}
private TypeDeclaration createTypeCore(final TypeDefinition type) {
final TypeDeclaration astType = new TypeDeclaration();
final String packageName = type.getPackageName();
if (_compileUnit.getPackage().isNull() && !StringUtilities.isNullOrWhitespace(packageName)) {
final PackageDeclaration packageDeclaration = new PackageDeclaration(packageName);
packageDeclaration.putUserData(Keys.PACKAGE_REFERENCE, PackageReference.parse(packageName));
_compileUnit.insertChildBefore(
_packagePlaceholder,
packageDeclaration,
Roles.PACKAGE
);
_packagePlaceholder.remove();
}
_typeDeclarations.put(type.getInternalName(), astType);
long flags = type.getFlags();
if (type.isInterface() || type.isEnum()) {
flags &= Flags.AccessFlags;
}
else {
flags &= (Flags.AccessFlags | Flags.ClassFlags | Flags.STATIC | Flags.FINAL);
}
EntityDeclaration.setModifiers(
astType,
Flags.asModifierSet(scrubAccessModifiers(flags))
);
astType.setName(type.getSimpleName());
astType.putUserData(Keys.TYPE_DEFINITION, type);
astType.putUserData(Keys.TYPE_REFERENCE, type);
if (type.isEnum()) {
astType.setClassType(ClassType.ENUM);
}
else if (type.isAnnotation()) {
astType.setClassType(ClassType.ANNOTATION);
}
else if (type.isInterface()) {
astType.setClassType(ClassType.INTERFACE);
}
else {
astType.setClassType(ClassType.CLASS);
}
final List<TypeParameterDeclaration> typeParameters = createTypeParameters(type.getGenericParameters());
if (!typeParameters.isEmpty()) {
astType.getTypeParameters().addAll(typeParameters);
}
final TypeReference baseType = type.getBaseType();
if (baseType != null && !type.isEnum() && !BuiltinTypes.Object.equals(baseType)) {
astType.addChild(convertType(baseType), Roles.BASE_TYPE);
}
for (final TypeReference interfaceType : type.getExplicitInterfaces()) {
if (type.isAnnotation() && "java/lang/annotations/Annotation".equals(interfaceType.getInternalName())) {
continue;
}
astType.addChild(convertType(interfaceType), Roles.IMPLEMENTED_INTERFACE);
}
for (final CustomAnnotation annotation : type.getAnnotations()) {
astType.getAnnotations().add(createAnnotation(annotation));
}
addTypeMembers(astType, type);
return astType;
}
private long scrubAccessModifiers(final long flags) {
final long result = flags & ~Flags.AccessFlags;
if ((flags & Flags.PRIVATE) != 0) {
return result | Flags.PRIVATE;
}
if ((flags & Flags.PROTECTED) != 0) {
return result | Flags.PROTECTED;
}
if ((flags & Flags.PUBLIC) != 0) {
return result | Flags.PUBLIC;
}
return result;
}
private void addTypeMembers(final TypeDeclaration astType, final TypeDefinition type) {
for (final FieldDefinition field : type.getDeclaredFields()) {
astType.addChild(createField(field), Roles.TYPE_MEMBER);
}
for (final MethodDefinition method : type.getDeclaredMethods()) {
if (method.isConstructor()) {
astType.addChild(createConstructor(method), Roles.TYPE_MEMBER);
}
else {
astType.addChild(createMethod(method), Roles.TYPE_MEMBER);
}
}
final List<TypeDefinition> nestedTypes = new ArrayList<>();
for (final TypeDefinition nestedType : type.getDeclaredTypes()) {
final TypeReference declaringType = nestedType.getDeclaringType();
if (!nestedType.isLocalClass() &&
type.isEquivalentTo(declaringType)) {
if (nestedType.isAnonymous()) {
_typeDeclarations.put(type.getInternalName(), astType);
}
else {
nestedTypes.add(nestedType);
}
}
}
sortNestedTypes(nestedTypes);
for (final TypeDefinition nestedType : nestedTypes) {
astType.addChild(createTypeNoCache(nestedType), Roles.TYPE_MEMBER);
}
}
private static void sortNestedTypes(final List<TypeDefinition> types) {
final IdentityHashMap<TypeDefinition, Integer> minOffsets = new IdentityHashMap<>();
for (final TypeDefinition type : types) {
minOffsets.put(type, findFirstLineNumber(type));
}
Collections.sort(
types,
new Comparator<TypeDefinition>() {
@Override
public int compare(final TypeDefinition o1, final TypeDefinition o2) {
return Integer.compare(minOffsets.get(o1), minOffsets.get(o2));
}
}
);
}
private static Integer findFirstLineNumber(final TypeDefinition type) {
int minLineNumber = Integer.MAX_VALUE;
for (final MethodDefinition method : type.getDeclaredMethods()) {
final LineNumberTableAttribute attribute = SourceAttribute.find(AttributeNames.LineNumberTable, method.getSourceAttributes());
if (attribute != null && !attribute.getEntries().isEmpty()) {
final int firstLineNumber = attribute.getEntries().get(0).getLineNumber();
if (firstLineNumber < minLineNumber) {
minLineNumber = firstLineNumber;
}
}
}
return minLineNumber;
}
private FieldDeclaration createField(final FieldDefinition field) {
final FieldDeclaration astField = new FieldDeclaration();
final VariableInitializer initializer = new VariableInitializer(field.getName());
astField.addChild(initializer, Roles.VARIABLE);
astField.setReturnType(convertType(field.getFieldType()));
astField.putUserData(Keys.FIELD_DEFINITION, field);
astField.putUserData(Keys.MEMBER_REFERENCE, field);
EntityDeclaration.setModifiers(
astField,
Flags.asModifierSet(scrubAccessModifiers(field.getFlags() & Flags.VarFlags))
);
if (field.hasConstantValue()) {
initializer.setInitializer(new PrimitiveExpression(Expression.MYSTERY_OFFSET, field.getConstantValue()));
initializer.putUserData(Keys.FIELD_DEFINITION, field);
initializer.putUserData(Keys.MEMBER_REFERENCE, field);
}
return astField;
}
private MethodDeclaration createMethod(final MethodDefinition method) {
final MethodDeclaration astMethod = new MethodDeclaration();
final Set<Modifier> modifiers;
if (method.isTypeInitializer()) {
modifiers = Collections.singleton(Modifier.STATIC);
}
else if (method.getDeclaringType().isInterface()) {
modifiers = Collections.emptySet();
}
else {
modifiers = Flags.asModifierSet(scrubAccessModifiers(method.getFlags() & Flags.MethodFlags));
}
EntityDeclaration.setModifiers(astMethod, modifiers);
astMethod.setName(method.getName());
astMethod.getParameters().addAll(createParameters(method.getParameters()));
astMethod.getTypeParameters().addAll(createTypeParameters(method.getGenericParameters()));
astMethod.setReturnType(convertType(method.getReturnType()));
astMethod.putUserData(Keys.METHOD_DEFINITION, method);
astMethod.putUserData(Keys.MEMBER_REFERENCE, method);
for (final TypeDefinition declaredType : method.getDeclaredTypes()) {
if (!declaredType.isAnonymous()) {
astMethod.getDeclaredTypes().add(createType(declaredType));
}
}
if (!method.getDeclaringType().isInterface() || method.isTypeInitializer() || method.isDefault()) {
astMethod.setBody(createMethodBody(method, astMethod.getParameters()));
}
for (final TypeReference thrownType : method.getThrownTypes()) {
astMethod.addChild(convertType(thrownType), Roles.THROWN_TYPE);
}
for (final CustomAnnotation annotation : method.getAnnotations()) {
astMethod.getAnnotations().add(createAnnotation(annotation));
}
final AnnotationDefaultAttribute defaultAttribute = SourceAttribute.find(
AttributeNames.AnnotationDefault,
method.getSourceAttributes()
);
if (defaultAttribute != null) {
final Expression defaultValue = createAnnotationElement(defaultAttribute.getDefaultValue());
if (defaultValue != null && !defaultValue.isNull()) {
astMethod.setDefaultValue(defaultValue);
}
}
return astMethod;
}
private ConstructorDeclaration createConstructor(final MethodDefinition method) {
final ConstructorDeclaration astMethod = new ConstructorDeclaration();
EntityDeclaration.setModifiers(
astMethod,
Flags.asModifierSet(scrubAccessModifiers(method.getFlags() & Flags.ConstructorFlags))
);
astMethod.setName(method.getDeclaringType().getName());
astMethod.getParameters().addAll(createParameters(method.getParameters()));
astMethod.setBody(createMethodBody(method, astMethod.getParameters()));
astMethod.putUserData(Keys.METHOD_DEFINITION, method);
astMethod.putUserData(Keys.MEMBER_REFERENCE, method);
for (final TypeReference thrownType : method.getThrownTypes()) {
astMethod.addChild(convertType(thrownType), Roles.THROWN_TYPE);
}
return astMethod;
}
final List<TypeParameterDeclaration> createTypeParameters(final List<GenericParameter> genericParameters) {
if (genericParameters.isEmpty()) {
return Collections.emptyList();
}
final int count = genericParameters.size();
final TypeParameterDeclaration[] typeParameters = new TypeParameterDeclaration[genericParameters.size()];
for (int i = 0; i < count; i++) {
final GenericParameter genericParameter = genericParameters.get(i);
final TypeParameterDeclaration typeParameter = new TypeParameterDeclaration(genericParameter.getName());
if (genericParameter.hasExtendsBound()) {
typeParameter.setExtendsBound(convertType(genericParameter.getExtendsBound()));
}
typeParameter.putUserData(Keys.TYPE_REFERENCE, genericParameter);
typeParameters[i] = typeParameter;
}
return ArrayUtilities.asUnmodifiableList(typeParameters);
}
static void addTypeArguments(final TypeReference type, final AstType astType) {
if (type.hasGenericParameters()) {
final List<GenericParameter> genericParameters = type.getGenericParameters();
final int count = genericParameters.size();
final AstType[] typeArguments = new AstType[count];
for (int i = 0; i < count; i++) {
final GenericParameter genericParameter = genericParameters.get(i);
final SimpleType typeParameter = new SimpleType(genericParameter.getName());
typeParameter.putUserData(Keys.TYPE_REFERENCE, genericParameter);
typeArguments[i] = typeParameter;
}
applyTypeArguments(astType, ArrayUtilities.asUnmodifiableList(typeArguments));
}
}
static void applyTypeArguments(final AstType baseType, final List<AstType> typeArguments) {
if (baseType instanceof SimpleType) {
final SimpleType st = (SimpleType) baseType;
st.getTypeArguments().addAll(typeArguments);
}
}
private BlockStatement createMethodBody(
final MethodDefinition method,
final Iterable<ParameterDeclaration> parameters) {
if (_decompileMethodBodies) {
return AstMethodBodyBuilder.createMethodBody(this, method, _context, parameters);
}
return null;
}
public static Expression makePrimitive(final long val, final TypeReference type) {
if (TypeAnalysis.isBoolean(type)) {
if (val == 0L) {
return new PrimitiveExpression(Expression.MYSTERY_OFFSET, Boolean.FALSE);
}
return new PrimitiveExpression(Expression.MYSTERY_OFFSET, Boolean.TRUE);
}
if (type != null) {
return new PrimitiveExpression(Expression.MYSTERY_OFFSET, JavaPrimitiveCast.cast(type.getSimpleType(), val));
}
return new PrimitiveExpression(Expression.MYSTERY_OFFSET, JavaPrimitiveCast.cast(JvmType.Integer, val));
}
public static Expression makeDefaultValue(final TypeReference type) {
if (type == null) {
return new NullReferenceExpression(Expression.MYSTERY_OFFSET);
}
switch (type.getSimpleType()) {
case Boolean:
return new PrimitiveExpression(Expression.MYSTERY_OFFSET, Boolean.FALSE);
case Byte:
return new PrimitiveExpression(Expression.MYSTERY_OFFSET, (byte) 0);
case Character:
return new PrimitiveExpression(Expression.MYSTERY_OFFSET, '\0');
case Short:
return new PrimitiveExpression(Expression.MYSTERY_OFFSET, (short) 0);
case Integer:
return new PrimitiveExpression(Expression.MYSTERY_OFFSET, 0);
case Long:
return new PrimitiveExpression(Expression.MYSTERY_OFFSET, 0L);
case Float:
return new PrimitiveExpression(Expression.MYSTERY_OFFSET, 0f);
case Double:
return new PrimitiveExpression(Expression.MYSTERY_OFFSET, 0d);
default:
return new NullReferenceExpression(Expression.MYSTERY_OFFSET);
}
}
public List<LineNumberPosition> generateCode(final ITextOutput output) {
if (!_haveTransformationsRun) {
runTransformations();
}
_compileUnit.acceptVisitor(new InsertParenthesesVisitor(), null);
JavaOutputVisitor visitor = new JavaOutputVisitor(output, _context.getSettings());
_compileUnit.acceptVisitor(visitor, null);
return visitor.getLineNumberPositions();
}
public static boolean isMemberHidden(final IMemberDefinition member, final DecompilerContext context) {
final DecompilerSettings settings = context.getSettings();
if (member.isSynthetic() && !settings.getShowSyntheticMembers()) {
return !context.getForcedVisibleMembers().contains(member);
}
if (member instanceof TypeReference &&
((TypeReference) member).isNested() &&
settings.getExcludeNestedTypes()) {
final TypeDefinition resolvedType = ((TypeReference) member).resolve();
return resolvedType == null ||
!resolvedType.isAnonymous() && findLocalType(resolvedType) == null;
}
return false;
}
private static TypeReference findLocalType(final TypeReference type) {
if (type != null) {
final TypeDefinition resolvedType = type.resolve();
if (resolvedType != null && resolvedType.isLocalClass()) {
return resolvedType;
}
final TypeReference declaringType = type.getDeclaringType();
if (declaringType != null) {
return findLocalType(declaringType);
}
}
return null;
}
public Annotation createAnnotation(final CustomAnnotation annotation) {
final Annotation a = new Annotation();
final AstNodeCollection<Expression> arguments = a.getArguments();
a.setType(convertType(annotation.getAnnotationType()));
final List<AnnotationParameter> parameters = annotation.getParameters();
for (final AnnotationParameter p : parameters) {
final String member = p.getMember();
final Expression value = createAnnotationElement(p.getValue());
if (StringUtilities.isNullOrEmpty(member) ||
parameters.size() == 1 && "value".equals(member)) {
arguments.add(value);
}
else {
arguments.add(new AssignmentExpression(new IdentifierExpression(value.getOffset(), member), value));
}
}
return a;
}
public Expression createAnnotationElement(final AnnotationElement element) {
switch (element.getElementType()) {
case Constant: {
final ConstantAnnotationElement constant = (ConstantAnnotationElement) element;
return new PrimitiveExpression(Expression.MYSTERY_OFFSET, constant.getConstantValue());
}
case Enum: {
final EnumAnnotationElement enumElement = (EnumAnnotationElement) element;
return new TypeReferenceExpression(Expression.MYSTERY_OFFSET, convertType(enumElement.getEnumType())).member(enumElement.getEnumConstantName());
}
case Array: {
final ArrayAnnotationElement arrayElement = (ArrayAnnotationElement) element;
final ArrayInitializerExpression initializer = new ArrayInitializerExpression();
final AstNodeCollection<Expression> elements = initializer.getElements();
for (final AnnotationElement e : arrayElement.getElements()) {
elements.add(createAnnotationElement(e));
}
return initializer;
}
case Class: {
return new ClassOfExpression(
Expression.MYSTERY_OFFSET,
convertType(((ClassAnnotationElement) element).getClassType())
);
}
case Annotation: {
return createAnnotation(((AnnotationAnnotationElement) element).getAnnotation());
}
}
throw ContractUtils.unreachable();
}
}
| [
"xingfengxiang@gmail.com"
] | xingfengxiang@gmail.com |
2d5441e074df19153774bbd235e807a2d24c4995 | 0949364728a9370098a255fb3b4dce90187f65cc | /src/main/java/com/company/servicioweb/serviciologeo/LogeoResponse.java | eaaee0b9c1a9ff330ef17213829b0d51598b8ee0 | [] | no_license | borjaOrtizLlamas/ClienteWebLogeo | a3c2a80a4b02e1043802858289dad4a7a487e240 | 3eb16446f82110f2dc24cac46fe636af6747d9d2 | refs/heads/master | 2021-01-01T04:46:25.273206 | 2016-05-12T10:43:39 | 2016-05-12T10:43:39 | 58,630,818 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,284 | java |
package com.company.servicioweb.serviciologeo;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="usuarioValido" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"usuarioValido"
})
@XmlRootElement(name = "LogeoResponse")
public class LogeoResponse {
protected boolean usuarioValido;
/**
* Gets the value of the usuarioValido property.
*
*/
public boolean isUsuarioValido() {
return usuarioValido;
}
/**
* Sets the value of the usuarioValido property.
*
*/
public void setUsuarioValido(boolean value) {
this.usuarioValido = value;
}
}
| [
"birtiz@ste.dom"
] | birtiz@ste.dom |
6ad3ab8dd00f02bbd38d9cbf1184a4d31ad9ce22 | 88b8cb43b9619fa2b5427f2c578da1ef24555c4d | /src/main/java/com/wlminus/security/UserNotActivatedException.java | 0f5c305c405a6db567f1d24259262b8e0bdbe029 | [] | no_license | wlminus/jam2-be | 4193217bf6911d8437a92fa767822ecb7001be3b | f1fb9844153a6b29a6d05ee12bf9f0f3862dafd0 | refs/heads/master | 2023-02-26T00:23:01.597402 | 2021-02-03T05:25:39 | 2021-02-03T05:25:39 | 199,049,361 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 507 | java | package com.wlminus.security;
import org.springframework.security.core.AuthenticationException;
/**
* This exception is thrown in case of a not activated user trying to authenticate.
*/
public class UserNotActivatedException extends AuthenticationException {
private static final long serialVersionUID = 1L;
public UserNotActivatedException(String message) {
super(message);
}
public UserNotActivatedException(String message, Throwable t) {
super(message, t);
}
}
| [
"wlminus.dev@gmail.com"
] | wlminus.dev@gmail.com |
5de21f7ecbd0316cb4c815ec558fc002f6776b15 | 08c96f3e86871ee5d1e2a8cd4a8efbe25ec3eeae | /src/main/java/com/yaoyaohao/study/zookeeper/session/SessionMetaData.java | 9f5af57bd867f05515b64f3751ccc2da89d0305c | [] | no_license | yezijiang/study-java | 1b7af08066bb08768451ee1fef4a986f00d5bde2 | 1ac28c4ea07350b6bb44d251b5085613b0997ded | refs/heads/master | 2021-05-04T04:09:43.023683 | 2016-10-13T11:36:40 | 2016-10-13T11:36:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,252 | java | package com.yaoyaohao.study.zookeeper.session;
import java.io.Serializable;
/**
* 基于zookeeper实现分布式session
*
* SessionMetaData类表示一个Session实例的元数据,保存一些与session生命周期控制相关的数据
*
* 属性说明->
* id :session实例ID
* maxIdle :session的最大空闲时间,默认情况下是30分钟
* lastAccessTm:session的最后一次访问时间,每次调用Request.getSession方法时都会更新此值。用来计算当前session是否超时。
* 如果lastAccessTm+maxIdle小于System.currentTimeMillis(),就表示当前session超时.
* validate:表示当前session是否可用,如果超时,则此属性为false
* version :此属性是为了冗余Znode的version值,用来实现乐观锁,对session节点的元数据进行更新操作。
* @author liujianzhu
* @date 2016年10月10日 下午2:39:05
*/
public class SessionMetaData implements Serializable {
private static final long serialVersionUID = 2807835364286292206L;
private String id;
private Long createTm; // session的创建时间
private Long maxIdle; // session的最大空闲时间
private Long lastAccessTm; // session的最后一次访问时间
private boolean validate = false; // 是否可用
private int version = 0;
public SessionMetaData() {
this.createTm = System.currentTimeMillis();
this.lastAccessTm = createTm;
this.validate = true;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Long getCreateTm() {
return createTm;
}
public void setCreateTm(Long createTm) {
this.createTm = createTm;
}
public Long getMaxIdle() {
return maxIdle;
}
public void setMaxIdle(Long maxIdle) {
this.maxIdle = maxIdle;
}
public Long getLastAccessTm() {
return lastAccessTm;
}
public void setLastAccessTm(Long lastAccessTm) {
this.lastAccessTm = lastAccessTm;
}
public boolean isValidate() {
return validate;
}
public void setValidate(boolean validate) {
this.validate = validate;
}
public int getVersion() {
return version;
}
public void setVersion(int version) {
this.version = version;
}
}
| [
"janzolau1987@gmail.com"
] | janzolau1987@gmail.com |
bbb6b38d7d5a9e43ba76274225b1842814636888 | 8dc2fc950dc78285f9cbe400ae1bd7db30966b04 | /chapter9/pax-exam/src/test/java/camelinaction/PaxExamIT.java | 42dd0ff12a74c804b73e61b2929b6b19d9422b99 | [
"Apache-2.0"
] | permissive | espre05/camelinaction2 | fd8a057cdbc475bb5d0af0898127b15a8f1eb74f | 6739b5c82fa7248bba934f402c19a3dea1711e1c | refs/heads/master | 2021-07-23T02:38:09.923325 | 2017-11-02T19:25:39 | 2017-11-02T19:25:39 | 109,548,095 | 1 | 0 | null | 2017-11-05T03:15:03 | 2017-11-05T03:15:02 | null | UTF-8 | Java | false | false | 4,417 | java | package camelinaction;
import java.io.File;
import javax.inject.Inject;
import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.PaxExam;
import org.ops4j.pax.exam.karaf.options.LogLevelOption;
import org.ops4j.pax.exam.options.UrlReference;
import org.ops4j.pax.exam.util.Filter;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.junit.Assert.assertEquals;
import static org.ops4j.pax.exam.CoreOptions.junitBundles;
import static org.ops4j.pax.exam.CoreOptions.maven;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
/**
* Integration test to test this example running in Apache Karaf using Pax-Exam for testing on the container.
*/
@RunWith(PaxExam.class)
public class PaxExamIT {
private static final Logger LOG = LoggerFactory.getLogger(PaxExamIT.class);
@Inject
protected BundleContext bundleContext;
// inject the Camel application with this name (eg the id attribute in <camelContext>)
@Inject
@Filter("(camel.context.name=quotesCamel)")
protected CamelContext camelContext;
@Test
public void testPaxExam() throws Exception {
// we should have completed 0 exchange
long total = camelContext.getManagedCamelContext().getExchangesTotal();
assertEquals("Should be 0 exchanges completed", 0, total);
// need a little delay to be ready
Thread.sleep(2000);
// call the servlet, and log what it returns
String url = "http4://localhost:8181/camel/say";
ProducerTemplate template = camelContext.createProducerTemplate();
String json = template.requestBody(url, null, String.class);
System.out.println("Wiseman says: " + json);
LOG.info("Wiseman says: {}", json);
// and we should have completed 1 exchange
total = camelContext.getManagedCamelContext().getExchangesTotal();
assertEquals("Should be 1 exchanges completed", 1, total);
}
@Configuration
public Option[] config() {
return new Option[]{
// setup which karaf server we are using
karafDistributionConfiguration()
.frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf").version("4.1.2").type("tar.gz"))
.karafVersion("4.1.2")
.name("Apache Karaf")
.useDeployFolder(false)
.unpackDirectory(new File("target/karaf")),
// keep the folder so we can look inside when something fails, eg check the data/logs directory
keepRuntimeFolder(),
// Disable the SSH port
configureConsole().ignoreRemoteShell(),
// Configure Logging to not be verbose, if you set to DEBUG you see a lot of details
logLevel(LogLevelOption.LogLevel.WARN),
// Install JUnit
junitBundles(),
// Install base camel features
features(getCamelKarafFeatureUrl(), "camel", "camel-test"),
// and use camel-http for testing
features(getCamelKarafFeatureUrl(), "camel-http4"),
// install our example feature
features(maven().groupId("com.camelinaction").artifactId("chapter9-pax-exam").version("2.0.0").classifier("features").type("xml"), "camel-quote")
};
}
public static UrlReference getCamelKarafFeatureUrl() {
// the Apache Camel Karaf feature file
return mavenBundle().
groupId("org.apache.camel.karaf").
artifactId("apache-camel")
.version("2.19.0")
.classifier("features")
.type("xml");
}
}
| [
"claus.ibsen@gmail.com"
] | claus.ibsen@gmail.com |
81ee4e640f16c352d271932fa73539ff862db427 | d12f95385450aa3b7789deb572c46b351d3ee614 | /src/main/java/repractice/CheapLetterDeletion.java | 5538f3c93221ed64da0d9636b4b01d7ae0957699 | [] | no_license | rahulagrawal-sw/datastructure-practice | 4009eb6e040af78bef0068d38d1d6ebb6d07ea93 | c509e7abeb2c99126b9069fbdc6878f136f65074 | refs/heads/master | 2023-02-07T22:05:46.619753 | 2020-12-30T08:38:10 | 2020-12-30T08:38:10 | 316,137,057 | 0 | 0 | null | 2020-12-30T08:38:11 | 2020-11-26T06:00:03 | Java | UTF-8 | Java | false | false | 1,291 | java | package repractice;
import java.util.HashMap;
public class CheapLetterDeletion {
public static void main(String[] args) {
String str1 = "abccbd";
int[] deletionCost1 = new int[]{0, 1, 2, 3, 4, 5};
int result = solution(str1, deletionCost1);
System.out.println(result);
String str2 = "aabbcc";
int[] deletionCost2 = new int[]{1, 2, 1, 2, 1, 2};
result = solution(str2, deletionCost2);
System.out.println(result);
String str3 = "aaaa";
int[] deletionCost3 = new int[]{3, 4, 5, 6};
result = solution(str3, deletionCost3);
System.out.println(result);
String str4 = "ababa";
int[] deletionCost4 = new int[]{10, 5, 10, 5, 10};
result = solution(str4, deletionCost4);
System.out.println(result);
}
public static int solution(String S, int[] C) {
int result = 0;
char prevChar = 0;
for (int i = 0; i < S.length(); i++) {
char ch = S.charAt(i);
if (prevChar == ch) {
if (C[i-1] < C[i]) {
result += C[i-1];
} else {
result += C[i];
}
}
prevChar = ch;
}
return result;
}
}
| [
"rahulagrawal.sw@gmail.com"
] | rahulagrawal.sw@gmail.com |
0128a09fcd7a5c032a3668fe6192658e2f9c40da | 95270cf9741637fcfc394af8847efea6504f79cf | /src/main/java/de/hpi/interactionnet/enforceability/EnforceabilityChecker.java | ad5ca858dd7ce33239b6a59d7ba63650dd76ca7e | [] | no_license | juyixin/yxxf | 5a0f8ec45e3f2941006baea504478dba023e1c41 | ff101a3e7436238322099bc2e94be17da5f41a97 | refs/heads/master | 2020-04-11T21:17:02.190272 | 2018-12-18T06:13:21 | 2018-12-18T06:13:21 | 162,100,650 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,844 | java | package de.hpi.interactionnet.enforceability;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import de.hpi.PTnet.Marking;
import de.hpi.PTnet.verification.PTNetInterpreter;
import de.hpi.interactionnet.InteractionNet;
import de.hpi.interactionnet.InteractionNetFactory;
import de.hpi.interactionnet.InteractionTransition;
public class EnforceabilityChecker {
private InteractionNet net;
private PTNetInterpreter interpreter;
private Set<String> visited;
private Set<String> visitedcancel;
private boolean[] wasreached;
private int numtransitions;
private boolean[][] shareRole;
public EnforceabilityChecker(InteractionNet net) {
this.net = net;
interpreter = InteractionNetFactory.eINSTANCE.createInterpreter();
visited = new HashSet<String>();
visitedcancel = new HashSet<String>();
wasreached = new boolean[net.getTransitions().size()];
numtransitions = net.getTransitions().size();
setupShareRole();
}
public boolean checkEnforceability() {
visited.clear();
visitedcancel.clear();
for (int i=0; i<wasreached.length; i++)
wasreached[i] = false;
if (!recursivelyCheck(net.getInitialMarking(), new boolean[numtransitions]))
return false;
for (int i=0; i<wasreached.length; i++)
if (!wasreached[i])
return false;
return true;
}
private boolean recursivelyCheck(Marking marking, boolean[] blocked) {
String markingstr = marking.toString();
if (!visited.add(markingstr+" + "+blocked))
return true;
boolean completed = false;
boolean hasEnabledTransitions = false;
boolean[] enabled = getEnablement(marking); // enabled(M)
for (int ui=0; ui<numtransitions; ui++)
if (enabled[ui]) {
hasEnabledTransitions = true;
if (!blocked[ui]) {
Marking marking2 = interpreter.fireTransition(net, marking, net.getTransitions().get(ui));
boolean[] enabled2 = getEnablement(marking2); // enabled(M')
for (int vi=0; vi<numtransitions; vi++) {
if (enabled[vi] && !enabled2[vi] && !shareRole[ui][vi])
return false;
}
boolean[] blocked2 = new boolean[numtransitions];
for (int vi=0; vi<numtransitions; vi++) {
if (enabled2[vi] && !enabled[vi] && !shareRole[ui][vi])
blocked2[vi] = true;
else if (blocked[vi] && !shareRole[ui][vi])
blocked2[vi] = true;
}
if (!recursivelyCheck(marking2, blocked2))
return false;
if (!visitedcancel.contains(marking2+" + "+blocked2)) {
wasreached[ui] = true;
completed = true;
}
}
}
if (!completed && hasEnabledTransitions) {
visitedcancel.add(marking+" + "+blocked);
}
return true;
}
protected void setupShareRole() {
shareRole = new boolean[numtransitions][numtransitions];
int x1 = 0;
for (Iterator<de.hpi.petrinet.Transition> iter=net.getTransitions().iterator(); iter.hasNext(); ) {
InteractionTransition i1 = (InteractionTransition)iter.next();
int x2 = 0;
for (Iterator<de.hpi.petrinet.Transition> iter2=net.getTransitions().iterator(); iter2.hasNext(); ) {
InteractionTransition i2 = (InteractionTransition)iter2.next();
shareRole[x1][x2] = (i1.getSender().equals(i2.getSender()) ||
i1.getSender().equals(i2.getReceiver()) ||
i1.getReceiver().equals(i2.getSender()) ||
i1.getReceiver().equals(i2.getReceiver()));
x2++;
}
x1++;
}
}
private Map<String,boolean[]> enablementMap = new HashMap<String,boolean[]>();
private boolean[] getEnablement(Marking marking) {
boolean[] enablement = enablementMap.get(marking.toString());
if (enablement != null)
return enablement;
enablement = interpreter.getEnablement(net, marking);
enablementMap.put(marking.toString(), enablement);
return enablement;
}
}
| [
"juyx@eazytec.com"
] | juyx@eazytec.com |
05b415ed7c3252266897325ac0f77eb1f3be9002 | 73a5748d9b51732ca1ec1f7648ce6fb341969f5d | /src/test/java/cours/spring/springbootlab/SpringBootLabApplicationTests.java | b92255bc05dab8d3e85af59d008136ec9c98ddbe | [] | no_license | CKTanguay/Formation_SpringBoot | 4a63ee77e8cddab5389eaa30a395fea307ffd473 | 04ca157639713bff27f75793737ca05afc575a1d | refs/heads/main | 2023-08-07T10:12:01.175441 | 2021-09-29T14:58:35 | 2021-09-29T14:58:35 | 411,695,213 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 225 | java | package cours.spring.springbootlab;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class SpringBootLabApplicationTests {
@Test
void contextLoads() {
}
}
| [
"cktanguay@gmail.com"
] | cktanguay@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.