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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a850f1a1128d2c9fdd125481419897e9ed28ece6 | 0fbef70405a7a8714f857085dbad43d069cb01a7 | /app/src/test/java/com/t/androidcaproject/ExampleUnitTest.java | 838747abbfc46bf4d15f7ae470d6a01fc14dfc51 | [] | no_license | manikmittal18/AndroidCAProject | 2600eb89341566fb7835a0ee8261384d36101b14 | e42438905523f1d3d8120999c8e5509cc95e5154 | refs/heads/master | 2021-06-12T15:59:35.714309 | 2020-04-09T11:33:54 | 2020-04-09T11:33:54 | 254,353,742 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package com.t.androidcaproject;
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);
}
} | [
"="
] | = |
0c786c2b9893eeec881c8f09bf978d934fd47647 | e2e986e296a21b0e5685a7d9016e699a24113100 | /schoolApp/src/main/java/com/champs21/schoolapp/fragments/SchoolJoinGetAdditionalInfoFragment.java | a869cab5806f40e8c9b91bb1562a06629bf34566 | [] | no_license | tcse9/DummySchoolApp | 28e8875e82118ac5626003ddc6c8655e93406542 | 2cf12949b64fc174dea29632f3c7a3f4ef07b661 | refs/heads/master | 2016-09-01T18:45:05.208048 | 2015-03-19T09:41:22 | 2015-03-19T09:41:22 | 32,510,557 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,041 | java | package com.champs21.schoolapp.fragments;
import java.util.ArrayList;
import java.util.List;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.Toast;
import com.champs21.schoolapp.R;
import com.champs21.schoolapp.callbacks.onGradeDialogButtonClickListener;
import com.champs21.schoolapp.fragments.SchoolJoinUserTypeSelection.UserTypeSelectedListener;
import com.champs21.schoolapp.model.BaseType;
import com.champs21.schoolapp.model.Picker;
import com.champs21.schoolapp.model.PickerType;
import com.champs21.schoolapp.model.Picker.PickerItemSelectedListener;
import com.champs21.schoolapp.model.SchoolJoinAdditionalInfo;
import com.champs21.schoolapp.model.SchoolJoinObject;
import com.champs21.schoolapp.utils.UserHelper.UserTypeEnum;
import com.champs21.schoolapp.viewhelpers.GradeDialog;
public class SchoolJoinGetAdditionalInfoFragment extends DialogFragment {
private onInfoListener listener;
private int typeOrdinal;
private LinearLayout classPanel, rollNoPanel, employeePanel, batchPanel,
contactNoPanel, studentIdPanel;
private Button selectGradeBtn;
private EditText sectionEditText, rollNoEditText, employeeIdEditText,
contactNoEditText, batchEditText, studentIdEditText;
private String gradeStr = "";
private List<Integer> selectedGrades;
private ImageButton submit;
public void setData(onInfoListener lis) {
this.listener = lis;
}
public interface onInfoListener
{
public void onInfoEntered(SchoolJoinObject obj);
}
@Override
public void onActivityCreated(Bundle arg0) {
super.onActivityCreated(arg0);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
typeOrdinal = getArguments().getInt("type");
selectedGrades = new ArrayList<Integer>();
}
private ImageButton cancelBtn;
public SchoolJoinGetAdditionalInfoFragment() {
}
public static SchoolJoinGetAdditionalInfoFragment newInstance(int type) {
SchoolJoinGetAdditionalInfoFragment frag = new SchoolJoinGetAdditionalInfoFragment();
Bundle args = new Bundle();
args.putInt("type", type);
frag.setArguments(args);
return frag;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
final View view = inflater.inflate(R.layout.school_join_info_popup,
container, false);
classPanel = (LinearLayout) view.findViewById(R.id.class_name_panel);
rollNoPanel = (LinearLayout) view.findViewById(R.id.roll_no_panel);
employeePanel = (LinearLayout) view
.findViewById(R.id.employee_id_panel);
batchPanel = (LinearLayout) view.findViewById(R.id.batch_panel);
contactNoPanel = (LinearLayout) view
.findViewById(R.id.contact_no_panel);
studentIdPanel = (LinearLayout) view
.findViewById(R.id.student_id_panel);
sectionEditText = (EditText) view.findViewById(R.id.edit_text_section);
rollNoEditText = (EditText) view.findViewById(R.id.edit_text_roll);
employeeIdEditText = (EditText) view
.findViewById(R.id.edit_text_employee_id);
contactNoEditText = (EditText) view
.findViewById(R.id.edit_text_contact_no);
batchEditText = (EditText) view.findViewById(R.id.edit_text_batch);
studentIdEditText = (EditText) view
.findViewById(R.id.edit_text_student_ids);
submit=(ImageButton)view.findViewById(R.id.btn_submit);
submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
doSubmit();
}
});
selectGradeBtn = (Button) view.findViewById(R.id.btn_select_grade);
selectGradeBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
selectGrades();
}
});
updateUI();
cancelBtn = (ImageButton) view.findViewById(R.id.cancel_btn);
cancelBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
getDialog().dismiss();
}
});
return view;
}
private void updateUI() {
// TODO Auto-generated method stub
UserTypeEnum value = UserTypeEnum.values()[typeOrdinal];
switch (value) {
case STUDENT:
classPanel.setVisibility(View.VISIBLE);
rollNoPanel.setVisibility(View.VISIBLE);
break;
case TEACHER:
classPanel.setVisibility(View.VISIBLE);
employeePanel.setVisibility(View.VISIBLE);
contactNoPanel.setVisibility(View.VISIBLE);
break;
case PARENTS:
classPanel.setVisibility(View.VISIBLE);
studentIdPanel.setVisibility(View.VISIBLE);
contactNoPanel.setVisibility(View.VISIBLE);
break;
case ALUMNI:
batchPanel.setVisibility(View.VISIBLE);
contactNoPanel.setVisibility(View.VISIBLE);
break;
default:
break;
}
}
private void selectGrades() {
// TODO Auto-generated method stub
new GradeDialog(getActivity(), new onGradeDialogButtonClickListener() {
@Override
public void onDoneBtnClick(GradeDialog gradeDialog,
String gradeString, List<Integer> grades) {
gradeDialog.dismiss();
gradeStr = new String(gradeString);
selectedGrades.clear();
selectedGrades.addAll(grades);
selectGradeBtn.setText("Grades: "
+ getFormattedGradeString(grades));
}
}, gradeStr).show();
}
public String getFormattedGradeString(List<Integer> data) {
String temp = "";
for (int i = 0; i < data.size(); i++) {
if (data.get(i) == -1) {
temp = temp + "Playgroup";
} else if (data.get(i) == 0) {
temp = temp + "KG";
} else {
temp = temp + data.get(i);
}
if (i != data.size() - 1) {
temp = temp + ",";
}
}
return temp;
}
private void doSubmit() {
SchoolJoinObject joinObject = new SchoolJoinObject();
SchoolJoinAdditionalInfo info = new SchoolJoinAdditionalInfo();
UserTypeEnum value = UserTypeEnum.values()[typeOrdinal];
boolean flag = true;
String temp;
switch (value) {
case STUDENT:
joinObject.setType(value);
joinObject.setGradeIDs(getFormattedGradeString(selectedGrades));
temp = sectionEditText.getText().toString().trim();
if (TextUtils.isEmpty(temp)) {
sectionEditText.setError("Enter Section!");
flag = false;
} else
info.setUserSection(temp);
temp = rollNoEditText.getText().toString().trim();
if (TextUtils.isEmpty(temp)) {
rollNoEditText.setError("Enter roll!");
flag = false;
} else
info.setRollNo(temp);
joinObject.setAdditionalInfo(info);
break;
case TEACHER:
joinObject.setType(value);
joinObject.setGradeIDs(getFormattedGradeString(selectedGrades));
temp = sectionEditText.getText().toString().trim();
if (TextUtils.isEmpty(temp)) {
sectionEditText.setError("Enter Section!");
flag = false;
} else
info.setUserSection(temp);
temp = employeeIdEditText.getText().toString().trim();
if (TextUtils.isEmpty(temp)) {
employeeIdEditText.setError("Enter employee no!");
flag = false;
} else
info.setEmployeeId(temp);
temp = contactNoEditText.getText().toString().trim();
if (TextUtils.isEmpty(temp)) {
contactNoEditText.setError("Enter Contact No!");
flag = false;
} else
info.setContactNo(temp);
joinObject.setAdditionalInfo(info);
break;
case PARENTS:
joinObject.setType(value);
joinObject.setGradeIDs(getFormattedGradeString(selectedGrades));
temp = sectionEditText.getText().toString().trim();
if (TextUtils.isEmpty(temp)) {
sectionEditText.setError("Enter Section!");
flag = false;
} else
info.setUserSection(temp);
temp = studentIdEditText.getText().toString().trim();
if (TextUtils.isEmpty(temp)) {
studentIdEditText.setError("Enter student Id!");
flag = false;
} else
info.setStudentId(temp);
temp = contactNoEditText.getText().toString().trim();
if (TextUtils.isEmpty(temp)) {
contactNoEditText.setError("Enter Contact No!");
flag = false;
} else
info.setContactNo(temp);
joinObject.setAdditionalInfo(info);
break;
case ALUMNI:
joinObject.setType(value);
joinObject.setGradeIDs("111");
temp = batchEditText.getText().toString().trim();
if (TextUtils.isEmpty(temp)) {
batchEditText.setError("Enter batch");
flag = false;
} else
info.setBatch(temp);
temp = contactNoEditText.getText().toString().trim();
if (TextUtils.isEmpty(temp)) {
contactNoEditText.setError("Enter Contact No!");
flag = false;
} else
info.setContactNo(temp);
joinObject.setAdditionalInfo(info);
break;
default:
break;
}
if(flag)
{
listener.onInfoEntered(joinObject);
getDialog().dismiss();
}
}
}
| [
"ovioviovi@gmail.com"
] | ovioviovi@gmail.com |
b5e1a3d16dbe5b086978be169f7a8372a697e57f | 5cf5a940451b0306015177abf7aab7dfe3708253 | /app/src/main/java/com/ekoja/transform/TunerView.java | b8f87f6ae49ff8941a8cc8c8192809b13424fa46 | [] | no_license | erturkkadir/fourier | a7b36581076a45c5472efda22aed4c70b147a21b | 28cc39a164083d1d081834fcf48185d8451150f0 | refs/heads/master | 2021-06-21T22:03:31.269051 | 2020-11-30T03:26:16 | 2020-11-30T03:26:16 | 136,542,647 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,414 | java | package com.ekoja.transform;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;
public abstract class TunerView extends View {
protected MainActivity.Audio audio;
protected Resources resources;
protected int width;
protected int height;
protected Paint paint;
protected Rect clipRect;
private RectF outlineRect;
protected TunerView(Context context, AttributeSet attrs) {
super(context, attrs);
paint = new Paint();
resources = getResources();
}
/* On Size Changed */
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
width = w;
height = h;
outlineRect = new RectF( 1, 1, width-1, height-1);
clipRect = new Rect( 10, 10, width-10, height-10);
}
@Override
protected void onDraw(Canvas canvas) {
paint.setStrokeWidth(3);
paint.setAntiAlias(true);
paint.setColor(Color.DKGRAY);
paint.setStyle(Paint.Style.STROKE);
canvas.drawRoundRect(outlineRect, 10, 10, paint);
canvas.clipRect(clipRect);
canvas.translate(clipRect.left,clipRect.top); // Translate to the clip rect
}
}
| [
"kadirerturk@gmail.com"
] | kadirerturk@gmail.com |
8c8084d30e093496f10f48680c92fae210ae2427 | 692a7b9325014682d72bd41ad0af2921a86cf12e | /iWiFi/src/com/pubinfo/freewifialliance/view/PersonalPage$1$2.java | 388fa615ce95387fe5ce59a64085e0f879974a47 | [] | no_license | syanle/WiFi | f76fbd9086236f8a005762c1c65001951affefb6 | d58fb3d9ae4143cbe92f6f893248e7ad788d3856 | refs/heads/master | 2021-01-20T18:39:13.181843 | 2015-10-29T12:38:57 | 2015-10-29T12:38:57 | 45,156,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,897 | java | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.pubinfo.freewifialliance.view;
import android.content.Intent;
import android.net.Uri;
import android.os.Handler;
import android.os.Message;
import com.pubinfo.wifi_core.core.view.WifiDialog;
import java.io.IOException;
// Referenced classes of package com.pubinfo.freewifialliance.view:
// PersonalPage
class val.wifiDialog2
implements com.pubinfo.wifi_core.core.view.hClickListener
{
final ler this$1;
private final WifiDialog val$wifiDialog2;
public void onCancelClick()
{
val$wifiDialog2.dismiss();
}
public void onWatchClick()
{
val$wifiDialog2.dismiss();
handler.sendEmptyMessage(6);
}
is._cls0()
{
this$1 = final__pcls0;
val$wifiDialog2 = WifiDialog.this;
super();
}
// Unreferenced inner class com/pubinfo/freewifialliance/view/PersonalPage$1
/* anonymous class */
class PersonalPage._cls1 extends Handler
{
final PersonalPage this$0;
public void handleMessage(final Message wifiDialog1)
{
switch (wifiDialog1.what)
{
case 3: // '\003'
default:
return;
case 2: // '\002'
PersonalPage.access$0(PersonalPage.this, "\u5DF2\u7ECF\u662F\u6700\u65B0\u7248\u672C");
return;
case 4: // '\004'
wifiDialog1 = new WifiDialog(PersonalPage.this, 0x7f070002);
wifiDialog1.setOnWatchClickListener(new PersonalPage._cls1._cls1());
wifiDialog1.setPoint(introfomation);
wifiDialog1.setCanceBtn(w);
wifiDialog1.show();
return;
case 5: // '\005'
wifiDialog1 = new WifiDialog(PersonalPage.this, 0x7f070002);
wifiDialog1.setOnWatchClickListener(wifiDialog1. new PersonalPage._cls1._cls2());
wifiDialog1.setPoint(introfomation);
wifiDialog1.show();
return;
case 6: // '\006'
break;
}
try
{
Runtime.getRuntime().exec((new StringBuilder("chmod 755 ")).append(PersonalPage.access$1(PersonalPage.this)).toString());
}
// Misplaced declaration of an exception variable
catch (final Message wifiDialog1)
{
wifiDialog1.printStackTrace();
}
wifiDialog1 = new Intent("android.intent.action.VIEW");
wifiDialog1.addFlags(0x10000000);
wifiDialog1.setDataAndType(Uri.fromFile(PersonalPage.access$1(PersonalPage.this)), "application/vnd.android.package-archive");
startActivity(wifiDialog1);
finish();
}
{
this$0 = PersonalPage.this;
super();
}
// Unreferenced inner class com/pubinfo/freewifialliance/view/PersonalPage$1$1
/* anonymous class */
class PersonalPage._cls1._cls1
implements com.pubinfo.wifi_core.core.view.WifiDialog.OnWatchClickListener
{
final PersonalPage._cls1 this$1;
private final WifiDialog val$wifiDialog1;
public void onCancelClick()
{
wifiDialog1.dismiss();
}
public void onWatchClick()
{
wifiDialog1.dismiss();
handler.sendEmptyMessage(6);
}
{
this$1 = PersonalPage._cls1.this;
wifiDialog1 = wifidialog;
super();
}
}
}
}
| [
"arehigh@gmail.com"
] | arehigh@gmail.com |
15afbf419b4b90f37ff2df6bf23f54e857fe891d | a93c4d528147fbe9da2447b71b70f94dfca35103 | /src/main/java/com/study/directoryfiles/service/DirectoryService.java | c560d9133598dc900bed3cdad691f36c18ca4e18 | [] | no_license | Laboulaye/dirs-files-web-service | f04e3258c79304193e5ac52f16f6fba0f085ce62 | d395dce850e36a47c79b02e2124388a4a0284970 | refs/heads/master | 2020-10-01T02:14:06.594007 | 2019-12-22T11:05:17 | 2019-12-22T11:05:17 | 227,431,143 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 225 | java | package com.study.directoryfiles.service;
import com.study.directoryfiles.model.Directory;
import java.util.List;
public interface DirectoryService {
List<Directory> getDirectoriesByParentSorted(Directory parent);
}
| [
"maks.demianov@gmail.com"
] | maks.demianov@gmail.com |
206d495d8b2a408e8de74df1fca9838b472f7c43 | c057b74f13a4b916c02cca7e6d7333c1cb9bfd28 | /leetcode/solution/src/MergeTwoSortedList.java | f006d7cb0840a9c11473a13072f3a520766640de | [] | no_license | Jeffernic/Leetcode-Java | 12c4fa65c40db06333654f2643abf311026eb6a0 | a1411c56e4013933109faf5bba3b34d7714b0e51 | refs/heads/master | 2023-07-10T04:28:07.357881 | 2021-08-21T03:32:54 | 2021-08-21T03:32:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 542 | java | public class MergeTwoSortedList {
// 耗时15ms
public ListNode mergeTwoLists(ListNode l1, ListNode l2) {
ListNode dummy = new ListNode(0);
ListNode p = l1, q = l2, cur = dummy;
for ( ; p != null && q != null; ) {
if (p.val < q.val) {
cur.next = p;
p = p.next;
} else {
cur.next = q;
q = q.next;
}
cur = cur.next;
}
cur.next = p != null ? p : q;
return dummy.next;
}
}
| [
"dingjikerbo@gmail.com"
] | dingjikerbo@gmail.com |
7e5e87782e6fb0b40e98022a1af1ed6c56ab8171 | f9134ea3d106f467f19eefb1eb59bee0a7ac0d97 | /Networkme/com/example/networkme/fragments/ExpandTextFragmentDialog.java | 5228dd1327282140f5d780a9b1a999d24909987f | [] | no_license | Sniffing/NetworkMe | 967789c85445ce325e76e72c0884f4e5a5bd34d4 | 255ce568d06fd30298f4cda4db8ae8e099a43e81 | refs/heads/master | 2021-01-23T13:36:11.873995 | 2015-03-02T00:16:23 | 2015-03-02T00:16:23 | 15,917,560 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,243 | java | package example.networkme.fragments;
import android.app.AlertDialog;
import android.app.Dialog;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import com.example.networkme.R;
import com.loopj.android.image.SmartImageView;
import example.networkme.Handler.FacebookObject;
import example.networkme.Handler.InstagramObject;
import example.networkme.Handler.SocialMediaObject;
import example.networkme.Handler.TwitterObject;
import example.networkme.activities.MainActivity;
import example.networkme.views.SquareImageView;
public class ExpandTextFragmentDialog extends DialogFragment {
private SocialMediaObject object;
private final String TAG = "EXPAND_TEXT_FRAGMENT_DIALOG";
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
super.onCreateDialog(savedInstanceState);
final int position = getArguments().getInt("position");
final int list_type = getArguments().getInt("type");
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(
getActivity());
switch(list_type) {
case MainActivity.LIST_MASH: this.object = ((MainActivity)getActivity())
.getSocialMediaAtIndex(position);
break;
case MainActivity.LIST_TEXT: this.object = ((MainActivity) getActivity())
.getTextMediaAtIndex(position);
break;
}
View view = null;
String type = object.getType();
Log.d(TAG, "Is object null" + object.getType());
if (type.equals("twitter")) {
if (!((TwitterObject) object).containsPicture()) {
TwitterObject obj = (TwitterObject) object;
view = getActivity().getLayoutInflater().inflate(
R.layout.item_click_twitter_dialog, null, false);
final TextView twitter_username = (TextView) view
.findViewById(R.id.textClick_twitter_username);
final TextView twitter_status = (TextView) view
.findViewById(R.id.textClick_twitter_status);
final TextView twitter_time = (TextView) view
.findViewById(R.id.textClick_twitter_time);
final TextView twitter_actualname = (TextView) view
.findViewById(R.id.textClick_twitter_realname);
final SquareImageView twitter_profilePic = (SquareImageView) view
.findViewById(R.id.textClick_twitter_PP);
final TextView twitter_date = (TextView) view
.findViewById(R.id.textClick_twitter_date);
twitter_status.setText('\"' + obj.getStatus() + '"');
twitter_time.setText(obj.getTime());
twitter_date.setText(obj.getDate());
twitter_username.setText("@"+obj.getUsername());
twitter_actualname.setText(obj.getActualName());
twitter_profilePic.setImageUrl(obj.getPPUrlString());
twitter_username.setSelected(true);
twitter_actualname.setSelected(true);
dialogBuilder.setView(view);
} else {
view = getActivity().getLayoutInflater().inflate(
R.layout.pic_click_twitter_dialog, null, false);
final TextView username = (TextView) view
.findViewById(R.id.onclick_twitter_username);
final TextView time = (TextView) view
.findViewById(R.id.onclick_twitter_time);
final TextView tweet = (TextView) view
.findViewById(R.id.onclick_twitter_tweet);
final SquareImageView image = (SquareImageView) view
.findViewById(R.id.onclick_twitter_img);
dialogBuilder.setTitle("Twitter Image");
TwitterObject obj = (TwitterObject) object;
username.setText(obj.getUsername());
time.setText(obj.getTime() + " " + obj.getDate());
tweet.setText(obj.getStatus());
image.setImageUrl(obj.getUrlString());
dialogBuilder.setView(view);
}
}
if (type.equals("facebook")) {
// Consider not making a new object every time, just go straight for
// the cast if using up too much memory.
FacebookObject obj = (FacebookObject) object;
view = getActivity().getLayoutInflater().inflate(
R.layout.item_click_facebook_dialog, null, false);
final TextView fb_location = (TextView) view
.findViewById(R.id.onclick_fbevent_location);
final TextView fb_name = (TextView) view
.findViewById(R.id.onclick_fbevent_name);
final TextView fb_start = (TextView) view
.findViewById(R.id.onclick_fbevent_starttime);
final TextView fb_finish = (TextView) view
.findViewById(R.id.onclick_fbevent_finishtime);
final TextView fb_desc = (TextView) view
.findViewById(R.id.onclick_fbevent_description);
final TextView fb_hosts = (TextView) view
.findViewById(R.id.onclick_fbevent_hosts);
final SmartImageView fb_coverpic = (SmartImageView) view
.findViewById(R.id.onclick_fbevent_cover);
final TextView fb_attending = (TextView) view
.findViewById(R.id.onclick_fbevent_atten);
fb_desc.setText(obj.getDescription());
fb_finish.setText(obj.getEndTime());
fb_start.setText(obj.getStartTime());
fb_hosts.setText(obj.getHost());
fb_name.setText(obj.getName());
fb_location.setText(obj.getLocation());
fb_attending.setText(Integer.toString(obj.getAttending()));
fb_name.setSelected(true);
if (obj.getPicCoverString().equals(MainActivity.NOT_AVAILABLE_STRING)) {
fb_coverpic.setImageResource(R.drawable.no_cover);
} else {
fb_coverpic.setImageUrl(obj.getPicCoverString());
}
dialogBuilder.setView(view);
}
if (type.equals("instagram")) {
view = getActivity().getLayoutInflater().inflate(
R.layout.pic_click_instagram_dialog, null, false);
final TextView username = (TextView) view
.findViewById(R.id.onclick_instagram_username);
final TextView time = (TextView) view
.findViewById(R.id.onclick_instagram_time);
final TextView location = (TextView) view
.findViewById(R.id.onclick_instagram_location);
final TextView tags = (TextView) view
.findViewById(R.id.onclick_instagram_hashtags);
final SmartImageView image = (SmartImageView) view
.findViewById(R.id.onclick_instagram_img);
InstagramObject obj = (InstagramObject) object;
username.setText(obj.getUsername());
time.setText(obj.getTimeStamp());
location.setText(obj.getLocation());
tags.setText(obj.getFlattenedTags());
image.setImageUrl(obj.getUrlString());
dialogBuilder.setView(view);
}
return dialogBuilder.create();
}
}
| [
"terence@terence.(none)"
] | terence@terence.(none) |
f48ab9e52e4cfa4dc0c1ee7f3961b801b8a6e730 | c2a0a1b938213db4f95c62f40ae34257cfec6028 | /src/main/java/com/wlw/leetcode/Q92_ReverseLinkedListII.java | 15835a588c44c585f71e459fdb2eb4ddfc68ba5d | [] | no_license | hahahahaha320/leetcode | 74e6c32e1f274a87bf1eed307ad3c295677371dc | 82989915a1b97193cc783a62b188cc03e6e83cce | refs/heads/master | 2020-04-06T13:56:14.222108 | 2020-03-23T03:02:38 | 2020-03-23T03:02:38 | 48,479,173 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,181 | java | package com.wlw.leetcode;
import java.util.Date;
import com.wlw.leetcode.util.ListNode;
public class Q92_ReverseLinkedListII {
public static void main(String[] args) {
Q92_ReverseLinkedListII test = new Q92_ReverseLinkedListII();
Date start = new Date();
ListNode head = ListNode.makeList(new int[]{1,2,3,4,5});
Object result = test.reverseBetween(head,1,5);
Date end = new Date();
System.out.println("time:"+ (end.getTime()-start.getTime()));
System.out.println(result);
}
public ListNode reverseBetween(ListNode head, int m, int n) {
ListNode cur = head,firstEnd = head,second = head,third = head;
for(int i=1;i<=n+1;i++) {
if(i==m-1) {
second = cur.next;
firstEnd = cur;
}
if(i==n) {
third = cur.next;
cur.next = null;
break;
}
cur = cur.next;
}
while(second != null) {
ListNode next = second.next;
second.next = third;
third = second;
second = next;
}
if(m == 1) {
return third;
}
firstEnd.next = third;
return head;
}
}
| [
"108452287@qq.com"
] | 108452287@qq.com |
093b9e65e70b381e37d6fb888870aa4753f19717 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/14/14_4d05cb9de388dd7ebc753d063bc5943079b5d2d2/LuntDeployTask/14_4d05cb9de388dd7ebc753d063bc5943079b5d2d2_LuntDeployTask_t.java | 63c23571ef0edde4be5250ddd04675b117f2da24 | [] | 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 | 3,376 | java | package net.mccg.lunt;
import java.io.DataInputStream;
import java.io.FileOutputStream;
import java.net.URL;
import java.net.URLConnection;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
public class LuntDeployTask extends Task{
private String luntUsername;
private String luntPassword;
private String luntServer;
private String project;
private String schedule;
private String artifact;
private String deployUsername;
private String deployPassword;
private String deployServer;
private String deployDir;
private String isLocalDeploy;
public void execute() throws BuildException {
try {
String filepath = getLuntService(getLuntProject()).getArtifactUrl();
deploy(filepath);
} catch (Exception e) {
throw new BuildException(e);
}
}
LuntProject getLuntProject() {
return new LuntProject(luntUsername, luntPassword, luntServer, project, schedule, artifact);
}
LuntServiceImpl getLuntService(LuntProject luntProject) throws Exception {
return new LuntServiceImpl(luntProject);
}
SshServiceImpl getSshService() throws Exception {
return new SshServiceImpl(deployServer, deployUsername, deployPassword);
}
void deploy(final String filepath) {
log("Deploying Lunt Artifact: " + filepath);
try {
URL url = new URL(filepath);
URLConnection urlConn = url.openConnection();
urlConn.setDoInput(true);
urlConn.setUseCaches(false);
DataInputStream dis = new DataInputStream(urlConn.getInputStream());
if(isLocalCopy()){
FileOutputStream fos = new FileOutputStream(deployDir+"/"+getArtifactName(artifact));
int c;
while ((c = dis.read()) != -1)
fos.write(c);
fos.close();
} else {
getSshService().sftp(dis, deployDir, getArtifactName(artifact));
}
} catch (Exception e) {
throw new BuildException(e);
}
}
private String getArtifactName(final String artifact) {
if(artifact.indexOf("/") != -1)
return artifact.substring(artifact.lastIndexOf("/")+1);
return artifact;
}
private boolean isLocalCopy() {
return "true".equalsIgnoreCase(isLocalDeploy);
}
public void setLuntUsername(String luntUsername) {
this.luntUsername = luntUsername;
}
public void setLuntPassword(String luntPassword) {
this.luntPassword = luntPassword;
}
public void setLuntServer(String luntServer) {
this.luntServer = luntServer;
}
public void setDeployUsername(String deployUsername) {
this.deployUsername = deployUsername;
}
public void setDeployPassword(String deployPassword) {
this.deployPassword = deployPassword;
}
public void setDeployServer(String deployServer) {
this.deployServer = deployServer;
}
public void setProject(String project) {
this.project = project;
}
public void setSchedule(String schedule) {
this.schedule = schedule;
}
public void setArtifact(String artifact) {
this.artifact = artifact;
}
public void setDeployDir(String deployDir) {
this.deployDir = deployDir;
}
public void setIsLocalDeploy(String isLocalDeploy) {
this.isLocalDeploy = isLocalDeploy;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
a782adf20eef385f76ad36e70ae3f04699b828ab | 2c107c0051d942362a5632ca7eca477d6cd66468 | /paopao-parent/paopao-api/src/main/java/com/kuangji/paopao/controller/DictAreaController.java | 53c05abf7c418d2ea4be7861b943a681476d5f6d | [] | no_license | Mo-AG/xinlizixun_app | 8ac23f9ef3091dd40b4aecc59d517808979b7139 | 40b587a5a69b72547b4b98fa45f4def4c0128fef | refs/heads/master | 2023-03-20T06:12:51.074683 | 2020-06-09T23:03:53 | 2020-06-09T23:03:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,076 | java | package com.kuangji.paopao.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.kuangji.paopao.service.DictAreaService;
import com.kuangji.paopao.util.ServiceResultUtils;
import com.kuangji.paopao.vo.DictAreaVO;
/**
* Author 金威正
* Date 2020-02-18
*/
@RestController
@RequestMapping(value = "/v1/dictArea")
public class DictAreaController {
@Autowired
private DictAreaService dictAreaService;
/***
* parentId 0 省
*
* areaType 1直辖市 2市 3区
* */
@PostMapping(value = {"/list"})
public Object list(Integer areaType,@RequestParam(defaultValue="0")Integer parentId) {
List<DictAreaVO> dictAreaVOs=dictAreaService.listDictAreaVO();
return ServiceResultUtils.success(dictAreaVOs);
}
}
| [
"root@localhost.localdomain"
] | root@localhost.localdomain |
189073f98088d46a804cd634852a2949755fe21e | 720a1d60d3abe6845abc60e943fb24a12278fcce | /src/main/java/com/baamtu/atelier/bank/config/LoggingAspectConfiguration.java | e0073bd059f2b6d103fef393af2eb08dedb3782a | [] | no_license | mathiamry/bank-advice-system-blob | c9cc97d4388f581b043ce2795114d9da83c7d3e4 | b17024025be4abf4756428f7cd9dcac78ffb1dd8 | refs/heads/main | 2023-07-05T01:24:02.817332 | 2021-08-21T18:16:19 | 2021-08-21T18:16:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 501 | java | package com.baamtu.atelier.bank.config;
import com.baamtu.atelier.bank.aop.logging.LoggingAspect;
import org.springframework.context.annotation.*;
import org.springframework.core.env.Environment;
import tech.jhipster.config.JHipsterConstants;
@Configuration
@EnableAspectJAutoProxy
public class LoggingAspectConfiguration {
@Bean
@Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)
public LoggingAspect loggingAspect(Environment env) {
return new LoggingAspect(env);
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
fc6f6fb3da5852ab138f82fffaeb299b9b872b95 | accff7fe3dfff09ce904bc3bbe185b41f4a57f71 | /src/main/java/org/chinalbs/logistics/common/utils/ReflectionUtils.java | fcf67560d8d8e9a13d7fc2e43e2dabeb09a3a55c | [] | no_license | wangyiran125/huaxing | 6fae74b3c0e27863e6675dc9e3e68a70ce84cf56 | 2b531aa58d713306fae49ba09d5c9fc483bc73bc | refs/heads/master | 2021-01-10T01:37:50.095847 | 2015-05-29T02:36:30 | 2015-05-29T02:36:30 | 36,478,552 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 679 | java | package org.chinalbs.logistics.common.utils;
import java.lang.reflect.Method;
public class ReflectionUtils {
/**
* 获得method对象的一个简单字符串描述,不能保证唯一性
* @param method
* @return
*/
public static String toSimpleSignature(Method method) {
StringBuilder sb = new StringBuilder();
sb.append(method.getDeclaringClass().getSimpleName()).append('.').append(method.getName()).append('(');
Class<?>[] params = method.getParameterTypes();
for (int i = 0; i < params.length; i++) {
sb.append(params[i].getSimpleName());
if (i < params.length -1) {
sb.append(",");
}
}
sb.append(')');
return sb.toString();
}
}
| [
"wangyiran125@icloud.com"
] | wangyiran125@icloud.com |
07dcaf80c5f82829ae6f0d03ef6842fb39cc2b9a | af50dbd4779a6778ba3cd12c8cbe2c55a7e8de75 | /src/main/java/com/codeclan/example/FileSystemService/components/DataLoader.java | c3b3a03b49252e62b24fc70b2332cea7bc4df7f0 | [] | no_license | azma03/cc_week13_day3_homework | 799bbd090ce2e9b76b71eb00c3f21adaa5b60fc6 | 0882734cd4fd23845fef10e0479384e8be4cb10d | refs/heads/master | 2020-04-08T17:54:07.504366 | 2018-11-29T00:47:23 | 2018-11-29T00:47:23 | 159,585,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,792 | java | package com.codeclan.example.FileSystemService.components;
import com.codeclan.example.FileSystemService.models.File;
import com.codeclan.example.FileSystemService.models.Folder;
import com.codeclan.example.FileSystemService.models.User;
import com.codeclan.example.FileSystemService.repositories.FileRepository;
import com.codeclan.example.FileSystemService.repositories.FolderRepository;
import com.codeclan.example.FileSystemService.repositories.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
@Component
public class DataLoader implements ApplicationRunner {
@Autowired
FolderRepository folderRepository;
@Autowired
FileRepository fileRepository;
@Autowired
UserRepository userRepository;
public DataLoader() {
}
public void run(ApplicationArguments args) throws Exception {
User user1 = new User("Asma");
userRepository.save(user1);
Folder folder1 = new Folder("week12", user1);
folderRepository.save(folder1);
Folder folder2 = new Folder("week13", user1);
folderRepository.save(folder2);
File file1 = new File("lab", ".java", 200, folder1);
fileRepository.save(file1);
File file2 = new File("homework", ".txt", 100, folder1);
fileRepository.save(file2);
File file3 = new File("notes", ".txt", 100, folder2);
fileRepository.save(file3);
File file4 = new File("task", ".txt", 200, folder2);
fileRepository.save(file4);
// user1.addFolders(folder1);
// user1.addFolders(folder2);
// userRepository.save(user1);
}
}
| [
"asma.virgo85@gmail.com"
] | asma.virgo85@gmail.com |
22cb0c1c1c362876d7e0d771ed7aa13041dd35e3 | 995f73d30450a6dce6bc7145d89344b4ad6e0622 | /Mate20-9.0/src/main/java/android/opengl/GLErrorWrapper.java | 5f0ee593015d5c0d420be3cc2ea22eb3a374e7d4 | [] | no_license | morningblu/HWFramework | 0ceb02cbe42585d0169d9b6c4964a41b436039f5 | 672bb34094b8780806a10ba9b1d21036fd808b8e | refs/heads/master | 2023-07-29T05:26:14.603817 | 2021-09-03T05:23:34 | 2021-09-03T05:23:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 45,808 | java | package android.opengl;
import java.nio.Buffer;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
import javax.microedition.khronos.opengles.GL;
class GLErrorWrapper extends GLWrapperBase {
boolean mCheckError;
boolean mCheckThread;
Thread mOurThread;
public GLErrorWrapper(GL gl, int configFlags) {
super(gl);
boolean z = false;
this.mCheckError = (configFlags & 1) != 0;
this.mCheckThread = (configFlags & 2) != 0 ? true : z;
}
private void checkThread() {
if (this.mCheckThread) {
Thread currentThread = Thread.currentThread();
if (this.mOurThread == null) {
this.mOurThread = currentThread;
} else if (!this.mOurThread.equals(currentThread)) {
throw new GLException(28672, "OpenGL method called from wrong thread.");
}
}
}
private void checkError() {
if (this.mCheckError) {
int glGetError = this.mgl.glGetError();
int glError = glGetError;
if (glGetError != 0) {
throw new GLException(glError);
}
}
}
public void glActiveTexture(int texture) {
checkThread();
this.mgl.glActiveTexture(texture);
checkError();
}
public void glAlphaFunc(int func, float ref) {
checkThread();
this.mgl.glAlphaFunc(func, ref);
checkError();
}
public void glAlphaFuncx(int func, int ref) {
checkThread();
this.mgl.glAlphaFuncx(func, ref);
checkError();
}
public void glBindTexture(int target, int texture) {
checkThread();
this.mgl.glBindTexture(target, texture);
checkError();
}
public void glBlendFunc(int sfactor, int dfactor) {
checkThread();
this.mgl.glBlendFunc(sfactor, dfactor);
checkError();
}
public void glClear(int mask) {
checkThread();
this.mgl.glClear(mask);
checkError();
}
public void glClearColor(float red, float green, float blue, float alpha) {
checkThread();
this.mgl.glClearColor(red, green, blue, alpha);
checkError();
}
public void glClearColorx(int red, int green, int blue, int alpha) {
checkThread();
this.mgl.glClearColorx(red, green, blue, alpha);
checkError();
}
public void glClearDepthf(float depth) {
checkThread();
this.mgl.glClearDepthf(depth);
checkError();
}
public void glClearDepthx(int depth) {
checkThread();
this.mgl.glClearDepthx(depth);
checkError();
}
public void glClearStencil(int s) {
checkThread();
this.mgl.glClearStencil(s);
checkError();
}
public void glClientActiveTexture(int texture) {
checkThread();
this.mgl.glClientActiveTexture(texture);
checkError();
}
public void glColor4f(float red, float green, float blue, float alpha) {
checkThread();
this.mgl.glColor4f(red, green, blue, alpha);
checkError();
}
public void glColor4x(int red, int green, int blue, int alpha) {
checkThread();
this.mgl.glColor4x(red, green, blue, alpha);
checkError();
}
public void glColorMask(boolean red, boolean green, boolean blue, boolean alpha) {
checkThread();
this.mgl.glColorMask(red, green, blue, alpha);
checkError();
}
public void glColorPointer(int size, int type, int stride, Buffer pointer) {
checkThread();
this.mgl.glColorPointer(size, type, stride, pointer);
checkError();
}
public void glCompressedTexImage2D(int target, int level, int internalformat, int width, int height, int border, int imageSize, Buffer data) {
checkThread();
this.mgl.glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
checkError();
}
public void glCompressedTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int imageSize, Buffer data) {
checkThread();
this.mgl.glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
checkError();
}
public void glCopyTexImage2D(int target, int level, int internalformat, int x, int y, int width, int height, int border) {
checkThread();
this.mgl.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
checkError();
}
public void glCopyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y, int width, int height) {
checkThread();
this.mgl.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
checkError();
}
public void glCullFace(int mode) {
checkThread();
this.mgl.glCullFace(mode);
checkError();
}
public void glDeleteTextures(int n, int[] textures, int offset) {
checkThread();
this.mgl.glDeleteTextures(n, textures, offset);
checkError();
}
public void glDeleteTextures(int n, IntBuffer textures) {
checkThread();
this.mgl.glDeleteTextures(n, textures);
checkError();
}
public void glDepthFunc(int func) {
checkThread();
this.mgl.glDepthFunc(func);
checkError();
}
public void glDepthMask(boolean flag) {
checkThread();
this.mgl.glDepthMask(flag);
checkError();
}
public void glDepthRangef(float near, float far) {
checkThread();
this.mgl.glDepthRangef(near, far);
checkError();
}
public void glDepthRangex(int near, int far) {
checkThread();
this.mgl.glDepthRangex(near, far);
checkError();
}
public void glDisable(int cap) {
checkThread();
this.mgl.glDisable(cap);
checkError();
}
public void glDisableClientState(int array) {
checkThread();
this.mgl.glDisableClientState(array);
checkError();
}
public void glDrawArrays(int mode, int first, int count) {
checkThread();
this.mgl.glDrawArrays(mode, first, count);
checkError();
}
public void glDrawElements(int mode, int count, int type, Buffer indices) {
checkThread();
this.mgl.glDrawElements(mode, count, type, indices);
checkError();
}
public void glEnable(int cap) {
checkThread();
this.mgl.glEnable(cap);
checkError();
}
public void glEnableClientState(int array) {
checkThread();
this.mgl.glEnableClientState(array);
checkError();
}
public void glFinish() {
checkThread();
this.mgl.glFinish();
checkError();
}
public void glFlush() {
checkThread();
this.mgl.glFlush();
checkError();
}
public void glFogf(int pname, float param) {
checkThread();
this.mgl.glFogf(pname, param);
checkError();
}
public void glFogfv(int pname, float[] params, int offset) {
checkThread();
this.mgl.glFogfv(pname, params, offset);
checkError();
}
public void glFogfv(int pname, FloatBuffer params) {
checkThread();
this.mgl.glFogfv(pname, params);
checkError();
}
public void glFogx(int pname, int param) {
checkThread();
this.mgl.glFogx(pname, param);
checkError();
}
public void glFogxv(int pname, int[] params, int offset) {
checkThread();
this.mgl.glFogxv(pname, params, offset);
checkError();
}
public void glFogxv(int pname, IntBuffer params) {
checkThread();
this.mgl.glFogxv(pname, params);
checkError();
}
public void glFrontFace(int mode) {
checkThread();
this.mgl.glFrontFace(mode);
checkError();
}
public void glFrustumf(float left, float right, float bottom, float top, float near, float far) {
checkThread();
this.mgl.glFrustumf(left, right, bottom, top, near, far);
checkError();
}
public void glFrustumx(int left, int right, int bottom, int top, int near, int far) {
checkThread();
this.mgl.glFrustumx(left, right, bottom, top, near, far);
checkError();
}
public void glGenTextures(int n, int[] textures, int offset) {
checkThread();
this.mgl.glGenTextures(n, textures, offset);
checkError();
}
public void glGenTextures(int n, IntBuffer textures) {
checkThread();
this.mgl.glGenTextures(n, textures);
checkError();
}
public int glGetError() {
checkThread();
return this.mgl.glGetError();
}
public void glGetIntegerv(int pname, int[] params, int offset) {
checkThread();
this.mgl.glGetIntegerv(pname, params, offset);
checkError();
}
public void glGetIntegerv(int pname, IntBuffer params) {
checkThread();
this.mgl.glGetIntegerv(pname, params);
checkError();
}
public String glGetString(int name) {
checkThread();
String result = this.mgl.glGetString(name);
checkError();
return result;
}
public void glHint(int target, int mode) {
checkThread();
this.mgl.glHint(target, mode);
checkError();
}
public void glLightModelf(int pname, float param) {
checkThread();
this.mgl.glLightModelf(pname, param);
checkError();
}
public void glLightModelfv(int pname, float[] params, int offset) {
checkThread();
this.mgl.glLightModelfv(pname, params, offset);
checkError();
}
public void glLightModelfv(int pname, FloatBuffer params) {
checkThread();
this.mgl.glLightModelfv(pname, params);
checkError();
}
public void glLightModelx(int pname, int param) {
checkThread();
this.mgl.glLightModelx(pname, param);
checkError();
}
public void glLightModelxv(int pname, int[] params, int offset) {
checkThread();
this.mgl.glLightModelxv(pname, params, offset);
checkError();
}
public void glLightModelxv(int pname, IntBuffer params) {
checkThread();
this.mgl.glLightModelxv(pname, params);
checkError();
}
public void glLightf(int light, int pname, float param) {
checkThread();
this.mgl.glLightf(light, pname, param);
checkError();
}
public void glLightfv(int light, int pname, float[] params, int offset) {
checkThread();
this.mgl.glLightfv(light, pname, params, offset);
checkError();
}
public void glLightfv(int light, int pname, FloatBuffer params) {
checkThread();
this.mgl.glLightfv(light, pname, params);
checkError();
}
public void glLightx(int light, int pname, int param) {
checkThread();
this.mgl.glLightx(light, pname, param);
checkError();
}
public void glLightxv(int light, int pname, int[] params, int offset) {
checkThread();
this.mgl.glLightxv(light, pname, params, offset);
checkError();
}
public void glLightxv(int light, int pname, IntBuffer params) {
checkThread();
this.mgl.glLightxv(light, pname, params);
checkError();
}
public void glLineWidth(float width) {
checkThread();
this.mgl.glLineWidth(width);
checkError();
}
public void glLineWidthx(int width) {
checkThread();
this.mgl.glLineWidthx(width);
checkError();
}
public void glLoadIdentity() {
checkThread();
this.mgl.glLoadIdentity();
checkError();
}
public void glLoadMatrixf(float[] m, int offset) {
checkThread();
this.mgl.glLoadMatrixf(m, offset);
checkError();
}
public void glLoadMatrixf(FloatBuffer m) {
checkThread();
this.mgl.glLoadMatrixf(m);
checkError();
}
public void glLoadMatrixx(int[] m, int offset) {
checkThread();
this.mgl.glLoadMatrixx(m, offset);
checkError();
}
public void glLoadMatrixx(IntBuffer m) {
checkThread();
this.mgl.glLoadMatrixx(m);
checkError();
}
public void glLogicOp(int opcode) {
checkThread();
this.mgl.glLogicOp(opcode);
checkError();
}
public void glMaterialf(int face, int pname, float param) {
checkThread();
this.mgl.glMaterialf(face, pname, param);
checkError();
}
public void glMaterialfv(int face, int pname, float[] params, int offset) {
checkThread();
this.mgl.glMaterialfv(face, pname, params, offset);
checkError();
}
public void glMaterialfv(int face, int pname, FloatBuffer params) {
checkThread();
this.mgl.glMaterialfv(face, pname, params);
checkError();
}
public void glMaterialx(int face, int pname, int param) {
checkThread();
this.mgl.glMaterialx(face, pname, param);
checkError();
}
public void glMaterialxv(int face, int pname, int[] params, int offset) {
checkThread();
this.mgl.glMaterialxv(face, pname, params, offset);
checkError();
}
public void glMaterialxv(int face, int pname, IntBuffer params) {
checkThread();
this.mgl.glMaterialxv(face, pname, params);
checkError();
}
public void glMatrixMode(int mode) {
checkThread();
this.mgl.glMatrixMode(mode);
checkError();
}
public void glMultMatrixf(float[] m, int offset) {
checkThread();
this.mgl.glMultMatrixf(m, offset);
checkError();
}
public void glMultMatrixf(FloatBuffer m) {
checkThread();
this.mgl.glMultMatrixf(m);
checkError();
}
public void glMultMatrixx(int[] m, int offset) {
checkThread();
this.mgl.glMultMatrixx(m, offset);
checkError();
}
public void glMultMatrixx(IntBuffer m) {
checkThread();
this.mgl.glMultMatrixx(m);
checkError();
}
public void glMultiTexCoord4f(int target, float s, float t, float r, float q) {
checkThread();
this.mgl.glMultiTexCoord4f(target, s, t, r, q);
checkError();
}
public void glMultiTexCoord4x(int target, int s, int t, int r, int q) {
checkThread();
this.mgl.glMultiTexCoord4x(target, s, t, r, q);
checkError();
}
public void glNormal3f(float nx, float ny, float nz) {
checkThread();
this.mgl.glNormal3f(nx, ny, nz);
checkError();
}
public void glNormal3x(int nx, int ny, int nz) {
checkThread();
this.mgl.glNormal3x(nx, ny, nz);
checkError();
}
public void glNormalPointer(int type, int stride, Buffer pointer) {
checkThread();
this.mgl.glNormalPointer(type, stride, pointer);
checkError();
}
public void glOrthof(float left, float right, float bottom, float top, float near, float far) {
checkThread();
this.mgl.glOrthof(left, right, bottom, top, near, far);
checkError();
}
public void glOrthox(int left, int right, int bottom, int top, int near, int far) {
checkThread();
this.mgl.glOrthox(left, right, bottom, top, near, far);
checkError();
}
public void glPixelStorei(int pname, int param) {
checkThread();
this.mgl.glPixelStorei(pname, param);
checkError();
}
public void glPointSize(float size) {
checkThread();
this.mgl.glPointSize(size);
checkError();
}
public void glPointSizex(int size) {
checkThread();
this.mgl.glPointSizex(size);
checkError();
}
public void glPolygonOffset(float factor, float units) {
checkThread();
this.mgl.glPolygonOffset(factor, units);
checkError();
}
public void glPolygonOffsetx(int factor, int units) {
checkThread();
this.mgl.glPolygonOffsetx(factor, units);
checkError();
}
public void glPopMatrix() {
checkThread();
this.mgl.glPopMatrix();
checkError();
}
public void glPushMatrix() {
checkThread();
this.mgl.glPushMatrix();
checkError();
}
public void glReadPixels(int x, int y, int width, int height, int format, int type, Buffer pixels) {
checkThread();
this.mgl.glReadPixels(x, y, width, height, format, type, pixels);
checkError();
}
public void glRotatef(float angle, float x, float y, float z) {
checkThread();
this.mgl.glRotatef(angle, x, y, z);
checkError();
}
public void glRotatex(int angle, int x, int y, int z) {
checkThread();
this.mgl.glRotatex(angle, x, y, z);
checkError();
}
public void glSampleCoverage(float value, boolean invert) {
checkThread();
this.mgl.glSampleCoverage(value, invert);
checkError();
}
public void glSampleCoveragex(int value, boolean invert) {
checkThread();
this.mgl.glSampleCoveragex(value, invert);
checkError();
}
public void glScalef(float x, float y, float z) {
checkThread();
this.mgl.glScalef(x, y, z);
checkError();
}
public void glScalex(int x, int y, int z) {
checkThread();
this.mgl.glScalex(x, y, z);
checkError();
}
public void glScissor(int x, int y, int width, int height) {
checkThread();
this.mgl.glScissor(x, y, width, height);
checkError();
}
public void glShadeModel(int mode) {
checkThread();
this.mgl.glShadeModel(mode);
checkError();
}
public void glStencilFunc(int func, int ref, int mask) {
checkThread();
this.mgl.glStencilFunc(func, ref, mask);
checkError();
}
public void glStencilMask(int mask) {
checkThread();
this.mgl.glStencilMask(mask);
checkError();
}
public void glStencilOp(int fail, int zfail, int zpass) {
checkThread();
this.mgl.glStencilOp(fail, zfail, zpass);
checkError();
}
public void glTexCoordPointer(int size, int type, int stride, Buffer pointer) {
checkThread();
this.mgl.glTexCoordPointer(size, type, stride, pointer);
checkError();
}
public void glTexEnvf(int target, int pname, float param) {
checkThread();
this.mgl.glTexEnvf(target, pname, param);
checkError();
}
public void glTexEnvfv(int target, int pname, float[] params, int offset) {
checkThread();
this.mgl.glTexEnvfv(target, pname, params, offset);
checkError();
}
public void glTexEnvfv(int target, int pname, FloatBuffer params) {
checkThread();
this.mgl.glTexEnvfv(target, pname, params);
checkError();
}
public void glTexEnvx(int target, int pname, int param) {
checkThread();
this.mgl.glTexEnvx(target, pname, param);
checkError();
}
public void glTexEnvxv(int target, int pname, int[] params, int offset) {
checkThread();
this.mgl.glTexEnvxv(target, pname, params, offset);
checkError();
}
public void glTexEnvxv(int target, int pname, IntBuffer params) {
checkThread();
this.mgl.glTexEnvxv(target, pname, params);
checkError();
}
public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, Buffer pixels) {
checkThread();
this.mgl.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
checkError();
}
public void glTexParameterf(int target, int pname, float param) {
checkThread();
this.mgl.glTexParameterf(target, pname, param);
checkError();
}
public void glTexParameterx(int target, int pname, int param) {
checkThread();
this.mgl.glTexParameterx(target, pname, param);
checkError();
}
public void glTexParameteriv(int target, int pname, int[] params, int offset) {
checkThread();
this.mgl11.glTexParameteriv(target, pname, params, offset);
checkError();
}
public void glTexParameteriv(int target, int pname, IntBuffer params) {
checkThread();
this.mgl11.glTexParameteriv(target, pname, params);
checkError();
}
public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, int type, Buffer pixels) {
checkThread();
this.mgl.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
checkError();
}
public void glTranslatef(float x, float y, float z) {
checkThread();
this.mgl.glTranslatef(x, y, z);
checkError();
}
public void glTranslatex(int x, int y, int z) {
checkThread();
this.mgl.glTranslatex(x, y, z);
checkError();
}
public void glVertexPointer(int size, int type, int stride, Buffer pointer) {
checkThread();
this.mgl.glVertexPointer(size, type, stride, pointer);
checkError();
}
public void glViewport(int x, int y, int width, int height) {
checkThread();
this.mgl.glViewport(x, y, width, height);
checkError();
}
public void glClipPlanef(int plane, float[] equation, int offset) {
checkThread();
this.mgl11.glClipPlanef(plane, equation, offset);
checkError();
}
public void glClipPlanef(int plane, FloatBuffer equation) {
checkThread();
this.mgl11.glClipPlanef(plane, equation);
checkError();
}
public void glClipPlanex(int plane, int[] equation, int offset) {
checkThread();
this.mgl11.glClipPlanex(plane, equation, offset);
checkError();
}
public void glClipPlanex(int plane, IntBuffer equation) {
checkThread();
this.mgl11.glClipPlanex(plane, equation);
checkError();
}
public void glDrawTexfOES(float x, float y, float z, float width, float height) {
checkThread();
this.mgl11Ext.glDrawTexfOES(x, y, z, width, height);
checkError();
}
public void glDrawTexfvOES(float[] coords, int offset) {
checkThread();
this.mgl11Ext.glDrawTexfvOES(coords, offset);
checkError();
}
public void glDrawTexfvOES(FloatBuffer coords) {
checkThread();
this.mgl11Ext.glDrawTexfvOES(coords);
checkError();
}
public void glDrawTexiOES(int x, int y, int z, int width, int height) {
checkThread();
this.mgl11Ext.glDrawTexiOES(x, y, z, width, height);
checkError();
}
public void glDrawTexivOES(int[] coords, int offset) {
checkThread();
this.mgl11Ext.glDrawTexivOES(coords, offset);
checkError();
}
public void glDrawTexivOES(IntBuffer coords) {
checkThread();
this.mgl11Ext.glDrawTexivOES(coords);
checkError();
}
public void glDrawTexsOES(short x, short y, short z, short width, short height) {
checkThread();
this.mgl11Ext.glDrawTexsOES(x, y, z, width, height);
checkError();
}
public void glDrawTexsvOES(short[] coords, int offset) {
checkThread();
this.mgl11Ext.glDrawTexsvOES(coords, offset);
checkError();
}
public void glDrawTexsvOES(ShortBuffer coords) {
checkThread();
this.mgl11Ext.glDrawTexsvOES(coords);
checkError();
}
public void glDrawTexxOES(int x, int y, int z, int width, int height) {
checkThread();
this.mgl11Ext.glDrawTexxOES(x, y, z, width, height);
checkError();
}
public void glDrawTexxvOES(int[] coords, int offset) {
checkThread();
this.mgl11Ext.glDrawTexxvOES(coords, offset);
checkError();
}
public void glDrawTexxvOES(IntBuffer coords) {
checkThread();
this.mgl11Ext.glDrawTexxvOES(coords);
checkError();
}
public int glQueryMatrixxOES(int[] mantissa, int mantissaOffset, int[] exponent, int exponentOffset) {
checkThread();
int valid = this.mgl10Ext.glQueryMatrixxOES(mantissa, mantissaOffset, exponent, exponentOffset);
checkError();
return valid;
}
public int glQueryMatrixxOES(IntBuffer mantissa, IntBuffer exponent) {
checkThread();
int valid = this.mgl10Ext.glQueryMatrixxOES(mantissa, exponent);
checkError();
return valid;
}
public void glBindBuffer(int target, int buffer) {
checkThread();
this.mgl11.glBindBuffer(target, buffer);
checkError();
}
public void glBufferData(int target, int size, Buffer data, int usage) {
checkThread();
this.mgl11.glBufferData(target, size, data, usage);
checkError();
}
public void glBufferSubData(int target, int offset, int size, Buffer data) {
checkThread();
this.mgl11.glBufferSubData(target, offset, size, data);
checkError();
}
public void glColor4ub(byte red, byte green, byte blue, byte alpha) {
checkThread();
this.mgl11.glColor4ub(red, green, blue, alpha);
checkError();
}
public void glColorPointer(int size, int type, int stride, int offset) {
checkThread();
this.mgl11.glColorPointer(size, type, stride, offset);
checkError();
}
public void glDeleteBuffers(int n, int[] buffers, int offset) {
checkThread();
this.mgl11.glDeleteBuffers(n, buffers, offset);
checkError();
}
public void glDeleteBuffers(int n, IntBuffer buffers) {
checkThread();
this.mgl11.glDeleteBuffers(n, buffers);
checkError();
}
public void glDrawElements(int mode, int count, int type, int offset) {
checkThread();
this.mgl11.glDrawElements(mode, count, type, offset);
checkError();
}
public void glGenBuffers(int n, int[] buffers, int offset) {
checkThread();
this.mgl11.glGenBuffers(n, buffers, offset);
checkError();
}
public void glGenBuffers(int n, IntBuffer buffers) {
checkThread();
this.mgl11.glGenBuffers(n, buffers);
checkError();
}
public void glGetBooleanv(int pname, boolean[] params, int offset) {
checkThread();
this.mgl11.glGetBooleanv(pname, params, offset);
checkError();
}
public void glGetBooleanv(int pname, IntBuffer params) {
checkThread();
this.mgl11.glGetBooleanv(pname, params);
checkError();
}
public void glGetBufferParameteriv(int target, int pname, int[] params, int offset) {
checkThread();
this.mgl11.glGetBufferParameteriv(target, pname, params, offset);
checkError();
}
public void glGetBufferParameteriv(int target, int pname, IntBuffer params) {
checkThread();
this.mgl11.glGetBufferParameteriv(target, pname, params);
checkError();
}
public void glGetClipPlanef(int pname, float[] eqn, int offset) {
checkThread();
this.mgl11.glGetClipPlanef(pname, eqn, offset);
checkError();
}
public void glGetClipPlanef(int pname, FloatBuffer eqn) {
checkThread();
this.mgl11.glGetClipPlanef(pname, eqn);
checkError();
}
public void glGetClipPlanex(int pname, int[] eqn, int offset) {
checkThread();
this.mgl11.glGetClipPlanex(pname, eqn, offset);
checkError();
}
public void glGetClipPlanex(int pname, IntBuffer eqn) {
checkThread();
this.mgl11.glGetClipPlanex(pname, eqn);
checkError();
}
public void glGetFixedv(int pname, int[] params, int offset) {
checkThread();
this.mgl11.glGetFixedv(pname, params, offset);
checkError();
}
public void glGetFixedv(int pname, IntBuffer params) {
checkThread();
this.mgl11.glGetFixedv(pname, params);
checkError();
}
public void glGetFloatv(int pname, float[] params, int offset) {
checkThread();
this.mgl11.glGetFloatv(pname, params, offset);
checkError();
}
public void glGetFloatv(int pname, FloatBuffer params) {
checkThread();
this.mgl11.glGetFloatv(pname, params);
checkError();
}
public void glGetLightfv(int light, int pname, float[] params, int offset) {
checkThread();
this.mgl11.glGetLightfv(light, pname, params, offset);
checkError();
}
public void glGetLightfv(int light, int pname, FloatBuffer params) {
checkThread();
this.mgl11.glGetLightfv(light, pname, params);
checkError();
}
public void glGetLightxv(int light, int pname, int[] params, int offset) {
checkThread();
this.mgl11.glGetLightxv(light, pname, params, offset);
checkError();
}
public void glGetLightxv(int light, int pname, IntBuffer params) {
checkThread();
this.mgl11.glGetLightxv(light, pname, params);
checkError();
}
public void glGetMaterialfv(int face, int pname, float[] params, int offset) {
checkThread();
this.mgl11.glGetMaterialfv(face, pname, params, offset);
checkError();
}
public void glGetMaterialfv(int face, int pname, FloatBuffer params) {
checkThread();
this.mgl11.glGetMaterialfv(face, pname, params);
checkError();
}
public void glGetMaterialxv(int face, int pname, int[] params, int offset) {
checkThread();
this.mgl11.glGetMaterialxv(face, pname, params, offset);
checkError();
}
public void glGetMaterialxv(int face, int pname, IntBuffer params) {
checkThread();
this.mgl11.glGetMaterialxv(face, pname, params);
checkError();
}
public void glGetPointerv(int pname, Buffer[] params) {
checkThread();
this.mgl11.glGetPointerv(pname, params);
checkError();
}
public void glGetTexEnviv(int env, int pname, int[] params, int offset) {
checkThread();
this.mgl11.glGetTexEnviv(env, pname, params, offset);
checkError();
}
public void glGetTexEnviv(int env, int pname, IntBuffer params) {
checkThread();
this.mgl11.glGetTexEnviv(env, pname, params);
checkError();
}
public void glGetTexEnvxv(int env, int pname, int[] params, int offset) {
checkThread();
this.mgl11.glGetTexEnvxv(env, pname, params, offset);
checkError();
}
public void glGetTexEnvxv(int env, int pname, IntBuffer params) {
checkThread();
this.mgl11.glGetTexEnvxv(env, pname, params);
checkError();
}
public void glGetTexParameterfv(int target, int pname, float[] params, int offset) {
checkThread();
this.mgl11.glGetTexParameterfv(target, pname, params, offset);
checkError();
}
public void glGetTexParameterfv(int target, int pname, FloatBuffer params) {
checkThread();
this.mgl11.glGetTexParameterfv(target, pname, params);
checkError();
}
public void glGetTexParameteriv(int target, int pname, int[] params, int offset) {
checkThread();
this.mgl11.glGetTexParameteriv(target, pname, params, offset);
checkError();
}
public void glGetTexParameteriv(int target, int pname, IntBuffer params) {
checkThread();
this.mgl11.glGetTexParameteriv(target, pname, params);
checkError();
}
public void glGetTexParameterxv(int target, int pname, int[] params, int offset) {
checkThread();
this.mgl11.glGetTexParameterxv(target, pname, params, offset);
checkError();
}
public void glGetTexParameterxv(int target, int pname, IntBuffer params) {
checkThread();
this.mgl11.glGetTexParameterxv(target, pname, params);
checkError();
}
public boolean glIsBuffer(int buffer) {
checkThread();
boolean valid = this.mgl11.glIsBuffer(buffer);
checkError();
return valid;
}
public boolean glIsEnabled(int cap) {
checkThread();
boolean valid = this.mgl11.glIsEnabled(cap);
checkError();
return valid;
}
public boolean glIsTexture(int texture) {
checkThread();
boolean valid = this.mgl11.glIsTexture(texture);
checkError();
return valid;
}
public void glNormalPointer(int type, int stride, int offset) {
checkThread();
this.mgl11.glNormalPointer(type, stride, offset);
checkError();
}
public void glPointParameterf(int pname, float param) {
checkThread();
this.mgl11.glPointParameterf(pname, param);
checkError();
}
public void glPointParameterfv(int pname, float[] params, int offset) {
checkThread();
this.mgl11.glPointParameterfv(pname, params, offset);
checkError();
}
public void glPointParameterfv(int pname, FloatBuffer params) {
checkThread();
this.mgl11.glPointParameterfv(pname, params);
checkError();
}
public void glPointParameterx(int pname, int param) {
checkThread();
this.mgl11.glPointParameterx(pname, param);
checkError();
}
public void glPointParameterxv(int pname, int[] params, int offset) {
checkThread();
this.mgl11.glPointParameterxv(pname, params, offset);
checkError();
}
public void glPointParameterxv(int pname, IntBuffer params) {
checkThread();
this.mgl11.glPointParameterxv(pname, params);
checkError();
}
public void glPointSizePointerOES(int type, int stride, Buffer pointer) {
checkThread();
this.mgl11.glPointSizePointerOES(type, stride, pointer);
checkError();
}
public void glTexCoordPointer(int size, int type, int stride, int offset) {
checkThread();
this.mgl11.glTexCoordPointer(size, type, stride, offset);
checkError();
}
public void glTexEnvi(int target, int pname, int param) {
checkThread();
this.mgl11.glTexEnvi(target, pname, param);
checkError();
}
public void glTexEnviv(int target, int pname, int[] params, int offset) {
checkThread();
this.mgl11.glTexEnviv(target, pname, params, offset);
checkError();
}
public void glTexEnviv(int target, int pname, IntBuffer params) {
checkThread();
this.mgl11.glTexEnviv(target, pname, params);
checkError();
}
public void glTexParameterfv(int target, int pname, float[] params, int offset) {
checkThread();
this.mgl11.glTexParameterfv(target, pname, params, offset);
checkError();
}
public void glTexParameterfv(int target, int pname, FloatBuffer params) {
checkThread();
this.mgl11.glTexParameterfv(target, pname, params);
checkError();
}
public void glTexParameteri(int target, int pname, int param) {
checkThread();
this.mgl11.glTexParameteri(target, pname, param);
checkError();
}
public void glTexParameterxv(int target, int pname, int[] params, int offset) {
checkThread();
this.mgl11.glTexParameterxv(target, pname, params, offset);
checkError();
}
public void glTexParameterxv(int target, int pname, IntBuffer params) {
checkThread();
this.mgl11.glTexParameterxv(target, pname, params);
checkError();
}
public void glVertexPointer(int size, int type, int stride, int offset) {
checkThread();
this.mgl11.glVertexPointer(size, type, stride, offset);
checkError();
}
public void glCurrentPaletteMatrixOES(int matrixpaletteindex) {
checkThread();
this.mgl11Ext.glCurrentPaletteMatrixOES(matrixpaletteindex);
checkError();
}
public void glLoadPaletteFromModelViewMatrixOES() {
checkThread();
this.mgl11Ext.glLoadPaletteFromModelViewMatrixOES();
checkError();
}
public void glMatrixIndexPointerOES(int size, int type, int stride, Buffer pointer) {
checkThread();
this.mgl11Ext.glMatrixIndexPointerOES(size, type, stride, pointer);
checkError();
}
public void glMatrixIndexPointerOES(int size, int type, int stride, int offset) {
checkThread();
this.mgl11Ext.glMatrixIndexPointerOES(size, type, stride, offset);
checkError();
}
public void glWeightPointerOES(int size, int type, int stride, Buffer pointer) {
checkThread();
this.mgl11Ext.glWeightPointerOES(size, type, stride, pointer);
checkError();
}
public void glWeightPointerOES(int size, int type, int stride, int offset) {
checkThread();
this.mgl11Ext.glWeightPointerOES(size, type, stride, offset);
checkError();
}
public void glBindFramebufferOES(int target, int framebuffer) {
checkThread();
this.mgl11ExtensionPack.glBindFramebufferOES(target, framebuffer);
checkError();
}
public void glBindRenderbufferOES(int target, int renderbuffer) {
checkThread();
this.mgl11ExtensionPack.glBindRenderbufferOES(target, renderbuffer);
checkError();
}
public void glBlendEquation(int mode) {
checkThread();
this.mgl11ExtensionPack.glBlendEquation(mode);
checkError();
}
public void glBlendEquationSeparate(int modeRGB, int modeAlpha) {
checkThread();
this.mgl11ExtensionPack.glBlendEquationSeparate(modeRGB, modeAlpha);
checkError();
}
public void glBlendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha) {
checkThread();
this.mgl11ExtensionPack.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
checkError();
}
public int glCheckFramebufferStatusOES(int target) {
checkThread();
int result = this.mgl11ExtensionPack.glCheckFramebufferStatusOES(target);
checkError();
return result;
}
public void glDeleteFramebuffersOES(int n, int[] framebuffers, int offset) {
checkThread();
this.mgl11ExtensionPack.glDeleteFramebuffersOES(n, framebuffers, offset);
checkError();
}
public void glDeleteFramebuffersOES(int n, IntBuffer framebuffers) {
checkThread();
this.mgl11ExtensionPack.glDeleteFramebuffersOES(n, framebuffers);
checkError();
}
public void glDeleteRenderbuffersOES(int n, int[] renderbuffers, int offset) {
checkThread();
this.mgl11ExtensionPack.glDeleteRenderbuffersOES(n, renderbuffers, offset);
checkError();
}
public void glDeleteRenderbuffersOES(int n, IntBuffer renderbuffers) {
checkThread();
this.mgl11ExtensionPack.glDeleteRenderbuffersOES(n, renderbuffers);
checkError();
}
public void glFramebufferRenderbufferOES(int target, int attachment, int renderbuffertarget, int renderbuffer) {
checkThread();
this.mgl11ExtensionPack.glFramebufferRenderbufferOES(target, attachment, renderbuffertarget, renderbuffer);
checkError();
}
public void glFramebufferTexture2DOES(int target, int attachment, int textarget, int texture, int level) {
checkThread();
this.mgl11ExtensionPack.glFramebufferTexture2DOES(target, attachment, textarget, texture, level);
checkError();
}
public void glGenerateMipmapOES(int target) {
checkThread();
this.mgl11ExtensionPack.glGenerateMipmapOES(target);
checkError();
}
public void glGenFramebuffersOES(int n, int[] framebuffers, int offset) {
checkThread();
this.mgl11ExtensionPack.glGenFramebuffersOES(n, framebuffers, offset);
checkError();
}
public void glGenFramebuffersOES(int n, IntBuffer framebuffers) {
checkThread();
this.mgl11ExtensionPack.glGenFramebuffersOES(n, framebuffers);
checkError();
}
public void glGenRenderbuffersOES(int n, int[] renderbuffers, int offset) {
checkThread();
this.mgl11ExtensionPack.glGenRenderbuffersOES(n, renderbuffers, offset);
checkError();
}
public void glGenRenderbuffersOES(int n, IntBuffer renderbuffers) {
checkThread();
this.mgl11ExtensionPack.glGenRenderbuffersOES(n, renderbuffers);
checkError();
}
public void glGetFramebufferAttachmentParameterivOES(int target, int attachment, int pname, int[] params, int offset) {
checkThread();
this.mgl11ExtensionPack.glGetFramebufferAttachmentParameterivOES(target, attachment, pname, params, offset);
checkError();
}
public void glGetFramebufferAttachmentParameterivOES(int target, int attachment, int pname, IntBuffer params) {
checkThread();
this.mgl11ExtensionPack.glGetFramebufferAttachmentParameterivOES(target, attachment, pname, params);
checkError();
}
public void glGetRenderbufferParameterivOES(int target, int pname, int[] params, int offset) {
checkThread();
this.mgl11ExtensionPack.glGetRenderbufferParameterivOES(target, pname, params, offset);
checkError();
}
public void glGetRenderbufferParameterivOES(int target, int pname, IntBuffer params) {
checkThread();
this.mgl11ExtensionPack.glGetRenderbufferParameterivOES(target, pname, params);
checkError();
}
public void glGetTexGenfv(int coord, int pname, float[] params, int offset) {
checkThread();
this.mgl11ExtensionPack.glGetTexGenfv(coord, pname, params, offset);
checkError();
}
public void glGetTexGenfv(int coord, int pname, FloatBuffer params) {
checkThread();
this.mgl11ExtensionPack.glGetTexGenfv(coord, pname, params);
checkError();
}
public void glGetTexGeniv(int coord, int pname, int[] params, int offset) {
checkThread();
this.mgl11ExtensionPack.glGetTexGeniv(coord, pname, params, offset);
checkError();
}
public void glGetTexGeniv(int coord, int pname, IntBuffer params) {
checkThread();
this.mgl11ExtensionPack.glGetTexGeniv(coord, pname, params);
checkError();
}
public void glGetTexGenxv(int coord, int pname, int[] params, int offset) {
checkThread();
this.mgl11ExtensionPack.glGetTexGenxv(coord, pname, params, offset);
checkError();
}
public void glGetTexGenxv(int coord, int pname, IntBuffer params) {
checkThread();
this.mgl11ExtensionPack.glGetTexGenxv(coord, pname, params);
checkError();
}
public boolean glIsFramebufferOES(int framebuffer) {
checkThread();
boolean result = this.mgl11ExtensionPack.glIsFramebufferOES(framebuffer);
checkError();
return result;
}
public boolean glIsRenderbufferOES(int renderbuffer) {
checkThread();
this.mgl11ExtensionPack.glIsRenderbufferOES(renderbuffer);
checkError();
return false;
}
public void glRenderbufferStorageOES(int target, int internalformat, int width, int height) {
checkThread();
this.mgl11ExtensionPack.glRenderbufferStorageOES(target, internalformat, width, height);
checkError();
}
public void glTexGenf(int coord, int pname, float param) {
checkThread();
this.mgl11ExtensionPack.glTexGenf(coord, pname, param);
checkError();
}
public void glTexGenfv(int coord, int pname, float[] params, int offset) {
checkThread();
this.mgl11ExtensionPack.glTexGenfv(coord, pname, params, offset);
checkError();
}
public void glTexGenfv(int coord, int pname, FloatBuffer params) {
checkThread();
this.mgl11ExtensionPack.glTexGenfv(coord, pname, params);
checkError();
}
public void glTexGeni(int coord, int pname, int param) {
checkThread();
this.mgl11ExtensionPack.glTexGeni(coord, pname, param);
checkError();
}
public void glTexGeniv(int coord, int pname, int[] params, int offset) {
checkThread();
this.mgl11ExtensionPack.glTexGeniv(coord, pname, params, offset);
checkError();
}
public void glTexGeniv(int coord, int pname, IntBuffer params) {
checkThread();
this.mgl11ExtensionPack.glTexGeniv(coord, pname, params);
checkError();
}
public void glTexGenx(int coord, int pname, int param) {
checkThread();
this.mgl11ExtensionPack.glTexGenx(coord, pname, param);
checkError();
}
public void glTexGenxv(int coord, int pname, int[] params, int offset) {
checkThread();
this.mgl11ExtensionPack.glTexGenxv(coord, pname, params, offset);
checkError();
}
public void glTexGenxv(int coord, int pname, IntBuffer params) {
checkThread();
this.mgl11ExtensionPack.glTexGenxv(coord, pname, params);
checkError();
}
}
| [
"dstmath@163.com"
] | dstmath@163.com |
eab986faec01e6b9108743498fa055c7cf02b5f3 | e95284f9bc87a9151f296d56f7a2fbc2b9429114 | /redis-distributed-lock-relock/src/main/java/cn/itcast/zt/redis/AquiredLockWorker.java | 8ba8f605a1124ab31ed5bc190b93f1cee7c37772 | [] | no_license | zt971064178/Redis | 875a3bfbe09ad3105b46e055b78c7318b623e68c | 366f3614770e6cf5e0dcf17d253b23ec1751b32f | refs/heads/master | 2021-01-20T01:44:20.457189 | 2017-06-16T07:19:28 | 2017-06-16T07:19:28 | 89,323,508 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 317 | java | package cn.itcast.zt.redis;
/**
* 主要是用于获取锁后需要处理的逻辑:
* Created by zhangtian on 2017/5/2.
*/
public interface AquiredLockWorker<T> {
/**
* 获取锁后需要处理的逻辑
* @return
* @throws Exception
*/
T invokeAfterLockAquire() throws Exception ;
}
| [
"zhang.tian20080808"
] | zhang.tian20080808 |
2a8451750a3d5900f7d1b39be2de3cfce95499c6 | fc3c62fd117112d4f0baaca35d7c6db96a06702c | /app/web/src/main/java/com/zeh/wms/web/form/RoleForm.java | c2db6b8b9ab38f9cf4b486500b0313ebe77144e8 | [] | no_license | tonycody/wms | 2c8aad1af792e29377fe0aea4560f7e615d5f6a2 | 428de46c9024c16e0cea9a81d728541868cfbb4f | refs/heads/master | 2020-03-18T22:50:26.999393 | 2018-03-21T07:14:25 | 2018-03-21T07:14:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 663 | java | package com.zeh.wms.web.form;
import java.io.Serializable;
import java.util.List;
import com.google.common.collect.Lists;
import lombok.Getter;
import lombok.Setter;
/**
* @author allen
* @create $ ID: RoleForm, 18/2/23 16:58 allen Exp $
* @since 1.0.0
*/
@Getter
@Setter
public class RoleForm implements Serializable {
private static final long serialVersionUID = 1L;
/** 角色ID */
private Long id;
/** 角色名称 */
private String name;
/** 角色状态 */
private Integer enabled;
/** 角色包含的权限 */
private List<String> authorizations = Lists.newArrayList();
} | [
"wjx20000@ly.com"
] | wjx20000@ly.com |
9d8f943266ce8eada500354589bc9c6cbbfc0eee | 8ca83d453b74cc45b460915126f01c2a1a42a9d7 | /bootstrap/src/main/java/io/pity/bootstrap/publish/xml/model/RootResults.java | e02235962e674f24b9218296b3bcdc8e6c642e1b | [
"Apache-2.0"
] | permissive | pity/pity | d21db3f8087b19c9b14461f9d348160e4450badd | 958012c2b199519f63ef04dbd0c1472dbb0d33ff | refs/heads/master | 2021-01-17T04:51:39.897509 | 2015-09-07T04:58:39 | 2015-09-07T04:58:39 | 35,466,012 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,033 | java | package io.pity.bootstrap.publish.xml.model;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import io.pity.api.reporting.CollectionResults;
import java.util.List;
import java.util.stream.Collectors;
@JacksonXmlRootElement(localName = "results")
public class RootResults {
public RootResults(CollectionResults collectedResults) {
this.environment = collectedResults.getEnvironmentData().stream()
.map(EnvironmentResults::new)
.collect(Collectors.toList());
this.execution = collectedResults.getCommandExecutionResults().stream()
.map(ExecutionResults::new)
.collect(Collectors.toList());
}
@JacksonXmlElementWrapper(localName = "collector")
@JacksonXmlProperty(localName = "environment")
List<EnvironmentResults> environment;
List<Object> execution;
}
| [
"ethan@ehdev.io"
] | ethan@ehdev.io |
0956026b96681853357c5e016adbd80f8dfcfcc6 | 32927026863b4e7ecab9b956ee4eb1b3958ce20b | /webs/simple-web-netty/src/test/java/com/simple/boot/web/netty/model/User.java | e15024929a34ce430f6dd35ac0ad6ab4a0af1b21 | [
"Apache-2.0"
] | permissive | visualkhh/simple-boot | d4acbea85f0b7c70c28d943d885ec64c430c10b5 | d28e9645e230181fcb3b5c848f4721e047857657 | refs/heads/master | 2023-04-13T14:29:59.740547 | 2021-04-22T02:20:01 | 2021-04-22T02:20:01 | 338,986,538 | 7 | 2 | null | 2021-04-22T02:20:02 | 2021-02-15T06:27:51 | Java | UTF-8 | Java | false | false | 310 | java | package com.simple.boot.web.netty.model;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class User {
public String name;
public Integer age;
@Builder
public User(String name, Integer age) {
this.name = name;
this.age = age;
}
}
| [
"visualkhh@gmail.com"
] | visualkhh@gmail.com |
a6d1cd13181dfb1436321abe9b5e3b670cfa90d5 | 4facb3958b33ec195c9982e99866720f32a11804 | /app/src/main/java/br/com/lundi/logis/ui/tools/ToolsViewModel.java | 532bb67642e6eead810e8c345f16934c35cdd6a6 | [] | no_license | crenilsonsouza/applogistica | 149a8d2f889744dba0f685623b7fd9291e474b4d | 6dd6150f0d0cf0d647bb391c133d4f863556d591 | refs/heads/master | 2020-08-27T11:00:00.709674 | 2019-10-24T18:09:05 | 2019-10-24T18:09:05 | 217,341,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 445 | java | package br.com.lundi.logis.ui.tools;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class ToolsViewModel extends ViewModel {
private MutableLiveData<String> mText;
public ToolsViewModel() {
mText = new MutableLiveData<>();
mText.setValue("This is tools fragment");
}
public LiveData<String> getText() {
return mText;
}
} | [
"crenilson@lundi.com.br"
] | crenilson@lundi.com.br |
7154dbb476c09cfac77277ac736807d5a1291f13 | 125faa53731942190322abfedf7072a55c4293aa | /api-admin/src/main/java/com/lmxdawn/api/admin/res/auth/LoginUserInfoResponse.java | 720c4bba17b36cba1e65a0feb6d246128a1e4fa8 | [
"MIT"
] | permissive | lmxdawn/vue-admin-java | e391dc2317daf4ce33fe7c3a279e133bac3191b4 | 1895f509b421ccbccb0630e821e77841611cf0fb | refs/heads/master | 2023-03-13T04:57:28.659678 | 2023-03-06T09:01:00 | 2023-03-06T09:01:00 | 156,002,061 | 210 | 107 | null | null | null | null | UTF-8 | Java | false | false | 304 | java | package com.lmxdawn.api.admin.res.auth;
import lombok.Data;
import java.util.List;
/**
* 登录用户的信息视图
*/
@Data
public class LoginUserInfoResponse {
private Long id;
private String username;
private String avatar;
// 权限列表
private List<String> authRules;
}
| [
"lmxdawn@qq.com"
] | lmxdawn@qq.com |
ef117fc20d46a18895f5811a7dbb11151f949d7c | fedcd1486107bbea40bed3aa88a966d63d2cca74 | /src/main/java/trabalho/lp/cliente/repository/ClienteRepository.java | f2a6cfe0f889af96836fefa382384d1868e09b39 | [] | no_license | paulocromano/sistema-materiais-construcao-back | 81d13b1458bb2a226698f394a0081896fb5fcaec | 9d5c2bb7291019e07e89a2bc2e48c841fd670b1f | refs/heads/master | 2023-01-03T18:52:37.807447 | 2020-11-03T22:49:11 | 2020-11-03T22:49:11 | 307,716,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 298 | java | package trabalho.lp.cliente.repository;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import trabalho.lp.cliente.model.Cliente;
public interface ClienteRepository extends JpaRepository<Cliente, Long> {
Optional<Cliente> findByEmail(String email);
}
| [
"1911420024@fema.edu.br"
] | 1911420024@fema.edu.br |
d7b4b26a7d0b0a45c3ec450962ade7ec2e4458f5 | 81096e981c37bfab7fed85deeb63064821b532a4 | /src/test/java/com/ghost/autotest/BrowserEnum.java | 797acddb9f1a5d1fbdd73259fe681272e0d80d2e | [] | no_license | FreeIrbis/AutoTest | 10c17ace0bc6fb1475ff71dca9015842f3131876 | a6f33eabbd040c4be585e0e9fedae7dee5ed4afd | refs/heads/master | 2020-04-01T10:50:54.280276 | 2018-10-17T17:34:22 | 2018-10-17T17:34:22 | 153,134,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 568 | java | package com.ghost.autotest;
public enum BrowserEnum {
GOOGLE("webdriver.chrome.driver", "D:\\Codding\\IdeasProjects\\Driver\\chromedriver.exe"),
FIREFOX("webdriver.gecko.driver", "D:\\Codding\\IdeasProjects\\Driver\\geckodriver.exe");
String nameDriver;
String urlDriver;
public String getNameDriver() {
return nameDriver;
}
public String getUrlDriver() {
return urlDriver;
}
BrowserEnum(String nameDriver ,String urlDriver){
this.nameDriver = nameDriver;
this.urlDriver = urlDriver;
}
}
| [
"westblackjoe246@gmail.com"
] | westblackjoe246@gmail.com |
10503fad75e66ecfa88dab84f78b72254aabd361 | 90203ac581902437bec13d9c2284d06302e4a81e | /OurTechnique/examples/jmock-1.1.0/core/src/byTestCase/output/InvokeAtMostOnceAcceptanceTest_1.java | 3a8ace95f8370c4bc236346952dd4ba1f9f29b99 | [
"BSD-3-Clause"
] | permissive | evertonlga/refactoringbasedtestprioritization | 29c47720dba07f48a0f877741eeebc63a4dda434 | 96f50d42b9ac0a32d39e67a100324c1d84eae61b | refs/heads/master | 2021-01-10T12:08:49.033089 | 2013-04-02T12:30:36 | 2013-04-02T12:30:36 | 50,374,778 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 448 | java | package byTestCase.output;
import org.jmock.Mock;
import org.jmock.MockObjectTestCase;
import org.jmock.core.DynamicMockError;
public class InvokeAtMostOnceAcceptanceTest_1 extends MockObjectTestCase {
public void testPassesIfMethodExpectedAtMostOnceIsNotCalled() {
Mock mock = mock(MockedType.class, "mock");
mock.expects(atMostOnce()).method("m");
}
public interface MockedType {
public void m();
}
}
| [
"evertongaldino@0965c72e-1c0b-3060-5483-b5c99505fe47"
] | evertongaldino@0965c72e-1c0b-3060-5483-b5c99505fe47 |
3b7eb5f5d84ef01b883ca46f4445fb8308c7badd | 67e94be3e7db237a680cc14d264a7da0294f40aa | /initializr-generator/src/test/java/io/spring/initializr/util/AgentTests.java | cb9e7b95ca2b9ba2587806075816103d750cecc4 | [
"Apache-2.0"
] | permissive | fluig/initializr | 0b79f0e4f5757de864b5d342a1c7b84373421648 | 899f6d3967143a8db3fa234bd709f592de1a819a | refs/heads/master | 2020-03-11T03:35:22.906768 | 2018-04-12T16:04:47 | 2018-04-12T16:04:47 | 129,752,225 | 0 | 1 | Apache-2.0 | 2018-04-16T14:00:12 | 2018-04-16T14:00:11 | null | UTF-8 | Java | false | false | 3,378 | java | /*
* Copyright 2012-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.spring.initializr.util;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
/**
* Tests for {@link Agent}.
*
* @author Stephane Nicoll
*/
public class AgentTests {
@Test
public void checkCurl() {
Agent agent = Agent.fromUserAgent("curl/1.2.4");
assertThat(agent.getId(), equalTo(Agent.AgentId.CURL));
assertThat(agent.getVersion(), equalTo("1.2.4"));
}
@Test
public void checkHttpie() {
Agent agent = Agent.fromUserAgent("HTTPie/0.8.0");
assertThat(agent.getId(), equalTo(Agent.AgentId.HTTPIE));
assertThat(agent.getVersion(), equalTo("0.8.0"));
}
@Test
public void checkJBossForge() {
Agent agent = Agent.fromUserAgent("SpringBootForgeCli/1.0.0.Alpha4");
assertThat(agent.getId(), equalTo(Agent.AgentId.JBOSS_FORGE));
assertThat(agent.getVersion(), equalTo("1.0.0.Alpha4"));
}
@Test
public void checkSpringBootCli() {
Agent agent = Agent.fromUserAgent("SpringBootCli/1.3.1.RELEASE");
assertThat(agent.getId(), equalTo(Agent.AgentId.SPRING_BOOT_CLI));
assertThat(agent.getVersion(), equalTo("1.3.1.RELEASE"));
}
@Test
public void checkSts() {
Agent agent = Agent.fromUserAgent("STS 3.7.0.201506251244-RELEASE");
assertThat(agent.getId(), equalTo(Agent.AgentId.STS));
assertThat(agent.getVersion(), equalTo("3.7.0.201506251244-RELEASE"));
}
@Test
public void checkIntelliJIDEA() {
Agent agent = Agent.fromUserAgent("IntelliJ IDEA");
assertThat(agent.getId(), equalTo(Agent.AgentId.INTELLIJ_IDEA));
assertThat(agent.getVersion(), is(nullValue()));
}
@Test
public void checkIntelliJIDEAWithVersion() {
Agent agent = Agent.fromUserAgent("IntelliJ IDEA/144.2 (Community edition; en-us)");
assertThat(agent.getId(), equalTo(Agent.AgentId.INTELLIJ_IDEA));
assertThat(agent.getVersion(), is("144.2"));
}
@Test
public void checkNetBeans() {
Agent agent = Agent.fromUserAgent("nb-springboot-plugin/0.1");
assertThat(agent.getId(), equalTo(Agent.AgentId.NETBEANS));
assertThat(agent.getVersion(), is("0.1"));
}
@Test
public void checkVsCode() {
Agent agent = Agent.fromUserAgent("vscode/0.2.0");
assertThat(agent.getId(), equalTo(Agent.AgentId.VSCODE));
assertThat(agent.getVersion(), is("0.2.0"));
}
@Test
public void checkGenericBrowser() {
Agent agent = Agent.fromUserAgent(
"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MMB29K) ");
assertThat(agent.getId(), equalTo(Agent.AgentId.BROWSER));
assertThat(agent.getVersion(), is(nullValue()));
}
@Test
public void checkRobot() {
Agent agent = Agent.fromUserAgent("Googlebot-Mobile");
assertThat(agent, is(nullValue()));
}
}
| [
"snicoll@pivotal.io"
] | snicoll@pivotal.io |
5b0c956d74187992ad295ded17b80cc3ae5a5a07 | a61d019ccc331c2ac68694dc6bce06f06a8adba2 | /springboot-demo/src/main/java/com/personal/test/demo/FilterConfig.java | 688b62a1f35ba1767cc998b2655cf0398ccce80e | [] | no_license | OuYangLiang/code-example | de110b36ba3c3066019b95c7fc1b9463f9d3a6bd | 80f1dbb52ffb761d8b25ab677e4957136301d20e | refs/heads/master | 2023-07-25T21:42:54.999876 | 2022-06-28T01:10:03 | 2022-06-28T01:10:03 | 112,132,893 | 1 | 2 | null | 2023-07-16T10:23:58 | 2017-11-27T01:38:56 | Java | UTF-8 | Java | false | false | 727 | java | package com.personal.test.demo;
import javax.servlet.Filter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.personal.test.demo.filter.DemoFilter;
@Configuration
public class FilterConfig {
/**
* 注册Demo Filter
*/
@Bean
public FilterRegistrationBean<Filter> filterRegistrationBean() {
FilterRegistrationBean<Filter> registration =
new FilterRegistrationBean<>();
registration.setOrder(1);
registration.setFilter(new DemoFilter());
registration.addUrlPatterns("/*");
return registration;
}
}
| [
"ouyanggod@gmail.com"
] | ouyanggod@gmail.com |
32571ac8e85daaca90bb119344cabd7a544bacc8 | 0f73ffda4dbf8813ad88e963123b8050e756d2b9 | /src/main/java/com/spring/boot/repository/MenuRepository.java | 0d482212d0d0ccb73e8d513bf942c5b9bdee4aa5 | [] | no_license | yudr31/genCode | e601c3ab5f96e014c53c9d7e48b443b076a73ec0 | c53aa8a285d79fb6b18b26a0bb8e35885d12df87 | refs/heads/master | 2021-08-30T14:20:55.131878 | 2017-12-18T09:16:04 | 2017-12-18T09:16:04 | 113,008,142 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 193 | java | package com.spring.boot.repository;
import org.springframework.data.repository.CrudRepository;
/**
* @author: yuderen
* @version: 1.0 2017-9-17 14:07
*/
public interface MenuRepository{
}
| [
"yuderen6312@163.com"
] | yuderen6312@163.com |
873038f310171b5ef3d1124b609034c3f20821cf | c36d08386a88e139e6325ea7f5de64ba00a45c9f | /hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/api/impl/pb/service/DistributedSchedulingAMProtocolPBServiceImpl.java | 11f36203b23025c7f57fdb34e6357c222e339175 | [
"Apache-2.0",
"LicenseRef-scancode-unknown",
"CC0-1.0",
"CC-BY-3.0",
"EPL-1.0",
"LicenseRef-scancode-unknown-license-reference",
"Classpath-exception-2.0",
"CC-PDDC",
"GCC-exception-3.1",
"CDDL-1.0",
"MIT",
"GPL-2.0-only",
"BSD-3-Clause",
"LicenseRef-scancode-public-domain",
"LGPL-2.1-on... | permissive | dmgerman/hadoop | 6197e3f3009196fb4ca528ab420d99a0cd5b9396 | 70c015914a8756c5440cd969d70dac04b8b6142b | refs/heads/master | 2020-12-01T06:30:51.605035 | 2019-12-19T19:37:17 | 2019-12-19T19:37:17 | 230,528,747 | 0 | 0 | Apache-2.0 | 2020-01-31T18:29:52 | 2019-12-27T22:48:25 | Java | UTF-8 | Java | false | false | 14,282 | java | begin_unit|revision:0.9.5;language:Java;cregit-version:0.0.1
begin_comment
comment|/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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. */
end_comment
begin_package
DECL|package|org.apache.hadoop.yarn.server.api.impl.pb.service
package|package
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|server
operator|.
name|api
operator|.
name|impl
operator|.
name|pb
operator|.
name|service
package|;
end_package
begin_import
import|import
name|com
operator|.
name|google
operator|.
name|protobuf
operator|.
name|RpcController
import|;
end_import
begin_import
import|import
name|com
operator|.
name|google
operator|.
name|protobuf
operator|.
name|ServiceException
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|server
operator|.
name|api
operator|.
name|DistributedSchedulingAMProtocol
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|proto
operator|.
name|YarnServerCommonServiceProtos
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|server
operator|.
name|api
operator|.
name|DistributedSchedulingAMProtocolPB
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|api
operator|.
name|protocolrecords
operator|.
name|AllocateResponse
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|server
operator|.
name|api
operator|.
name|protocolrecords
operator|.
name|DistributedSchedulingAllocateResponse
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|server
operator|.
name|api
operator|.
name|protocolrecords
operator|.
name|RegisterDistributedSchedulingAMResponse
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|api
operator|.
name|protocolrecords
operator|.
name|FinishApplicationMasterResponse
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|api
operator|.
name|protocolrecords
operator|.
name|RegisterApplicationMasterResponse
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|api
operator|.
name|protocolrecords
operator|.
name|impl
operator|.
name|pb
operator|.
name|AllocateRequestPBImpl
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|api
operator|.
name|protocolrecords
operator|.
name|impl
operator|.
name|pb
operator|.
name|AllocateResponsePBImpl
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|server
operator|.
name|api
operator|.
name|protocolrecords
operator|.
name|impl
operator|.
name|pb
operator|.
name|DistributedSchedulingAllocateRequestPBImpl
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|server
operator|.
name|api
operator|.
name|protocolrecords
operator|.
name|impl
operator|.
name|pb
operator|.
name|DistributedSchedulingAllocateResponsePBImpl
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|server
operator|.
name|api
operator|.
name|protocolrecords
operator|.
name|impl
operator|.
name|pb
operator|.
name|RegisterDistributedSchedulingAMResponsePBImpl
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|api
operator|.
name|protocolrecords
operator|.
name|impl
operator|.
name|pb
operator|.
name|FinishApplicationMasterRequestPBImpl
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|api
operator|.
name|protocolrecords
operator|.
name|impl
operator|.
name|pb
operator|.
name|FinishApplicationMasterResponsePBImpl
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|api
operator|.
name|protocolrecords
operator|.
name|impl
operator|.
name|pb
operator|.
name|RegisterApplicationMasterRequestPBImpl
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|api
operator|.
name|protocolrecords
operator|.
name|impl
operator|.
name|pb
operator|.
name|RegisterApplicationMasterResponsePBImpl
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|exceptions
operator|.
name|YarnException
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|proto
operator|.
name|YarnServiceProtos
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|proto
operator|.
name|YarnServiceProtos
operator|.
name|AllocateRequestProto
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|hadoop
operator|.
name|yarn
operator|.
name|proto
operator|.
name|YarnServiceProtos
operator|.
name|RegisterApplicationMasterRequestProto
import|;
end_import
begin_import
import|import
name|java
operator|.
name|io
operator|.
name|IOException
import|;
end_import
begin_comment
comment|/** * Implementation of {@link DistributedSchedulingAMProtocolPB}. */
end_comment
begin_class
DECL|class|DistributedSchedulingAMProtocolPBServiceImpl
specifier|public
class|class
name|DistributedSchedulingAMProtocolPBServiceImpl
implements|implements
name|DistributedSchedulingAMProtocolPB
block|{
DECL|field|real
specifier|private
name|DistributedSchedulingAMProtocol
name|real
decl_stmt|;
DECL|method|DistributedSchedulingAMProtocolPBServiceImpl ( DistributedSchedulingAMProtocol impl)
specifier|public
name|DistributedSchedulingAMProtocolPBServiceImpl
parameter_list|(
name|DistributedSchedulingAMProtocol
name|impl
parameter_list|)
block|{
name|this
operator|.
name|real
operator|=
name|impl
expr_stmt|;
block|}
annotation|@
name|Override
specifier|public
name|YarnServerCommonServiceProtos
operator|.
name|RegisterDistributedSchedulingAMResponseProto
DECL|method|registerApplicationMasterForDistributedScheduling ( RpcController controller, RegisterApplicationMasterRequestProto proto)
name|registerApplicationMasterForDistributedScheduling
parameter_list|(
name|RpcController
name|controller
parameter_list|,
name|RegisterApplicationMasterRequestProto
name|proto
parameter_list|)
throws|throws
name|ServiceException
block|{
name|RegisterApplicationMasterRequestPBImpl
name|request
init|=
operator|new
name|RegisterApplicationMasterRequestPBImpl
argument_list|(
name|proto
argument_list|)
decl_stmt|;
try|try
block|{
name|RegisterDistributedSchedulingAMResponse
name|response
init|=
name|real
operator|.
name|registerApplicationMasterForDistributedScheduling
argument_list|(
name|request
argument_list|)
decl_stmt|;
return|return
operator|(
operator|(
name|RegisterDistributedSchedulingAMResponsePBImpl
operator|)
name|response
operator|)
operator|.
name|getProto
argument_list|()
return|;
block|}
catch|catch
parameter_list|(
name|YarnException
name|e
parameter_list|)
block|{
throw|throw
operator|new
name|ServiceException
argument_list|(
name|e
argument_list|)
throw|;
block|}
catch|catch
parameter_list|(
name|IOException
name|e
parameter_list|)
block|{
throw|throw
operator|new
name|ServiceException
argument_list|(
name|e
argument_list|)
throw|;
block|}
block|}
annotation|@
name|Override
specifier|public
name|YarnServerCommonServiceProtos
operator|.
name|DistributedSchedulingAllocateResponseProto
DECL|method|allocateForDistributedScheduling (RpcController controller, YarnServerCommonServiceProtos. DistributedSchedulingAllocateRequestProto proto)
name|allocateForDistributedScheduling
parameter_list|(
name|RpcController
name|controller
parameter_list|,
name|YarnServerCommonServiceProtos
operator|.
name|DistributedSchedulingAllocateRequestProto
name|proto
parameter_list|)
throws|throws
name|ServiceException
block|{
name|DistributedSchedulingAllocateRequestPBImpl
name|request
init|=
operator|new
name|DistributedSchedulingAllocateRequestPBImpl
argument_list|(
name|proto
argument_list|)
decl_stmt|;
try|try
block|{
name|DistributedSchedulingAllocateResponse
name|response
init|=
name|real
operator|.
name|allocateForDistributedScheduling
argument_list|(
name|request
argument_list|)
decl_stmt|;
return|return
operator|(
operator|(
name|DistributedSchedulingAllocateResponsePBImpl
operator|)
name|response
operator|)
operator|.
name|getProto
argument_list|()
return|;
block|}
catch|catch
parameter_list|(
name|YarnException
name|e
parameter_list|)
block|{
throw|throw
operator|new
name|ServiceException
argument_list|(
name|e
argument_list|)
throw|;
block|}
catch|catch
parameter_list|(
name|IOException
name|e
parameter_list|)
block|{
throw|throw
operator|new
name|ServiceException
argument_list|(
name|e
argument_list|)
throw|;
block|}
block|}
annotation|@
name|Override
DECL|method|allocate (RpcController arg0, AllocateRequestProto proto)
specifier|public
name|YarnServiceProtos
operator|.
name|AllocateResponseProto
name|allocate
parameter_list|(
name|RpcController
name|arg0
parameter_list|,
name|AllocateRequestProto
name|proto
parameter_list|)
throws|throws
name|ServiceException
block|{
name|AllocateRequestPBImpl
name|request
init|=
operator|new
name|AllocateRequestPBImpl
argument_list|(
name|proto
argument_list|)
decl_stmt|;
try|try
block|{
name|AllocateResponse
name|response
init|=
name|real
operator|.
name|allocate
argument_list|(
name|request
argument_list|)
decl_stmt|;
return|return
operator|(
operator|(
name|AllocateResponsePBImpl
operator|)
name|response
operator|)
operator|.
name|getProto
argument_list|()
return|;
block|}
catch|catch
parameter_list|(
name|YarnException
name|e
parameter_list|)
block|{
throw|throw
operator|new
name|ServiceException
argument_list|(
name|e
argument_list|)
throw|;
block|}
catch|catch
parameter_list|(
name|IOException
name|e
parameter_list|)
block|{
throw|throw
operator|new
name|ServiceException
argument_list|(
name|e
argument_list|)
throw|;
block|}
block|}
annotation|@
name|Override
specifier|public
name|YarnServiceProtos
operator|.
name|FinishApplicationMasterResponseProto
DECL|method|finishApplicationMaster ( RpcController arg0, YarnServiceProtos .FinishApplicationMasterRequestProto proto)
name|finishApplicationMaster
parameter_list|(
name|RpcController
name|arg0
parameter_list|,
name|YarnServiceProtos
operator|.
name|FinishApplicationMasterRequestProto
name|proto
parameter_list|)
throws|throws
name|ServiceException
block|{
name|FinishApplicationMasterRequestPBImpl
name|request
init|=
operator|new
name|FinishApplicationMasterRequestPBImpl
argument_list|(
name|proto
argument_list|)
decl_stmt|;
try|try
block|{
name|FinishApplicationMasterResponse
name|response
init|=
name|real
operator|.
name|finishApplicationMaster
argument_list|(
name|request
argument_list|)
decl_stmt|;
return|return
operator|(
operator|(
name|FinishApplicationMasterResponsePBImpl
operator|)
name|response
operator|)
operator|.
name|getProto
argument_list|()
return|;
block|}
catch|catch
parameter_list|(
name|YarnException
name|e
parameter_list|)
block|{
throw|throw
operator|new
name|ServiceException
argument_list|(
name|e
argument_list|)
throw|;
block|}
catch|catch
parameter_list|(
name|IOException
name|e
parameter_list|)
block|{
throw|throw
operator|new
name|ServiceException
argument_list|(
name|e
argument_list|)
throw|;
block|}
block|}
annotation|@
name|Override
specifier|public
name|YarnServiceProtos
operator|.
name|RegisterApplicationMasterResponseProto
DECL|method|registerApplicationMaster ( RpcController arg0, RegisterApplicationMasterRequestProto proto)
name|registerApplicationMaster
parameter_list|(
name|RpcController
name|arg0
parameter_list|,
name|RegisterApplicationMasterRequestProto
name|proto
parameter_list|)
throws|throws
name|ServiceException
block|{
name|RegisterApplicationMasterRequestPBImpl
name|request
init|=
operator|new
name|RegisterApplicationMasterRequestPBImpl
argument_list|(
name|proto
argument_list|)
decl_stmt|;
try|try
block|{
name|RegisterApplicationMasterResponse
name|response
init|=
name|real
operator|.
name|registerApplicationMaster
argument_list|(
name|request
argument_list|)
decl_stmt|;
return|return
operator|(
operator|(
name|RegisterApplicationMasterResponsePBImpl
operator|)
name|response
operator|)
operator|.
name|getProto
argument_list|()
return|;
block|}
catch|catch
parameter_list|(
name|YarnException
name|e
parameter_list|)
block|{
throw|throw
operator|new
name|ServiceException
argument_list|(
name|e
argument_list|)
throw|;
block|}
catch|catch
parameter_list|(
name|IOException
name|e
parameter_list|)
block|{
throw|throw
operator|new
name|ServiceException
argument_list|(
name|e
argument_list|)
throw|;
block|}
block|}
block|}
end_class
end_unit
| [
"asuresh@apache.org"
] | asuresh@apache.org |
d4214cf622bda5fa99c7981734bed5755c4d2b9f | 473b76b1043df2f09214f8c335d4359d3a8151e0 | /benchmark/bigclonebenchdata_completed/13041693.java | 7ac3849718cfc2bc63f53a650a0be3d59b1891f9 | [] | no_license | whatafree/JCoffee | 08dc47f79f8369af32e755de01c52d9a8479d44c | fa7194635a5bd48259d325e5b0a190780a53c55f | refs/heads/master | 2022-11-16T01:58:04.254688 | 2020-07-13T20:11:17 | 2020-07-13T20:11:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,501 | java | import java.io.*;
import java.lang.*;
import java.util.*;
import java.net.*;
import java.applet.*;
import java.security.*;
class c13041693 {
public MyHelperClass getCookies(HttpURLConnection o0){ return null; }
// @Override
public void vote(String urlString, Map<String, String> headData, Map<String, String> paramData) throws Throwable {
HttpURLConnection httpConn = null;
try {
URL url = new URL(urlString);
httpConn = (HttpURLConnection) url.openConnection();
String cookies =(String)(Object) getCookies(httpConn);
System.out.println(cookies);
BufferedReader post = new BufferedReader(new InputStreamReader(httpConn.getInputStream(), "GB2312"));
String text = null;
while ((text = post.readLine()) != null) {
System.out.println(text);
}
} catch (MalformedURLException e) {
e.printStackTrace();
throw new VoteBeanException("网址不正确", e);
} catch (IOException e) {
e.printStackTrace();
throw new VoteBeanException("不能打开网址", e);
}
}
}
// Code below this line has been added to remove errors
class MyHelperClass {
}
class VoteBeanException extends Exception{
public VoteBeanException(String errorMessage) { super(errorMessage); }
VoteBeanException(String o0, IOException o1){}
VoteBeanException(){}
VoteBeanException(String o0, MalformedURLException o1){}
}
| [
"piyush16066@iiitd.ac.in"
] | piyush16066@iiitd.ac.in |
c2ef2887201a31d2aa4c66f95a9ac7a38578f8b1 | e0129a91fb55bd07c3125b47a8a34ddf2f27bfc8 | /abstractDemo/src/OracleDatabaseManager.java | d9b20bbfceaf5929f082a6ff9894330cd456d1dc | [] | no_license | BatikanUgur/JavaDemos | 07858739f36ba8bf5e150eca0bda1435ff5a1e61 | 6d99f709c3a1ff12b67aa61b6ee352b6d0d16117 | refs/heads/master | 2022-10-04T08:21:12.657245 | 2020-05-23T18:30:37 | 2020-05-23T18:30:37 | 266,395,838 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 158 | java | public class OracleDatabaseManager extends BaseDatabaseManager {
public void getData() {
System.out.println("Veri getirildi : Oracle");
}
}
| [
"batikanugurtizer@gmail.com"
] | batikanugurtizer@gmail.com |
f556a967404e051b202fcafb32474564ad62e682 | 14095f8f6df75707c91ceb54faeaa88ead72beab | /edu.leicester.cw3/src/main/java/edu/leicester/cw3/controller/ModuleController.java | 9b323d5c3f2207014103f85180f1546ce174b765 | [] | no_license | 4exov/education | d88b300a07aca67468bfbfe4068e5d639fa05588 | 6dfc81a98a3a40c8f7243f5df363be8840f52b3c | refs/heads/master | 2021-02-07T06:44:19.997501 | 2020-02-29T15:32:40 | 2020-02-29T15:32:40 | 243,993,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,959 | java | package edu.leicester.cw3.controller;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.server.ResponseStatusException;
import edu.leicester.cw3.entity.Lecture;
import edu.leicester.cw3.repository.ModuleRepository;
import edu.leicester.cw3.entity.Module;
@RestController
public class ModuleController {
@Autowired
ModuleRepository moduleRepository;
@GetMapping("/modules")
public ResponseEntity<List<Module>> getModules(){
List<Module> modules = (List<Module>) moduleRepository.findAll();
return new ResponseEntity<List<Module>>(modules,HttpStatus.OK);
}
@ResponseStatus(HttpStatus.OK)
@GetMapping("/modules/{id}")
Module getModule(@PathVariable long id) {
Optional<Module> module = moduleRepository.findById(id);
if (module.isPresent())
return module.get();
else
throw new ResponsesStatusException(HttpStatus.NOT_FOUND, "Module does not exist ");
}
@GetMapping("/modules/{id}/lectures")
ResponseEntity<List<Lecture>> getLectureForModule(@PathVariable long id){
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.add("Content-Type", "application/json");
Optional<Module> module = moduleRepository.findById(id);
if (module.isPresent()) {
return new ResponseEntity<List<Lecture>>(module.get().get????);
}else
throw new ResponseStatusException(HttpStatus.NOT_FOUND, " lecture does not exist bro");
}
@PostMapping("/modules")
public ResponseEntity<Module> createModule(@RequestBody Module module){
Module newModule = moduleRepository.save(module);
return new ResponseEntity<Module> (newModule, HttpStatus.CREATED);
}
@PutMapping(value = "/modules/{id}")
Module updateModule(@RequestBody Module module, @PathVariable long id) {
return moduleRepository.findById(id)
.map(x -> {
x.setCode(module.getCode());
x.setTitle(module.getTitle());
x.setCore(module.getCore());
x.setSemester(module.getSemester());
return moduleRepository.save(x);
})
.orElseGet(()-> {
throw new ModuleNotFoundException(id);
});
}
@PatchMapping("/modules/{id}")
Module patch (@RequstBody Map<String, String> update, @PathVariable long id) {
return moduleRepositoryfindById(id)
.map(x -> {
String moduleCode = update.get("code");
if (!StringUtils.isEmpty(moduleCode)) {
x.setCode(moduleCode);
}
String moduleTitle = update.get("title");
if (!StringUtils.isEmpty(moduleTitle)) {
x.setCode(moduleTitle);
}
String moduleCore = update.get("core");
if (!StringUtils.isEmpty(moduleCore)) {
x.setCore(moduleCore);
}
String moduleSemester = update.get("semester");
if (!StringUtils.isEmpty(moduleSemester)) {
x.setCode(moduleSemester);
}
return moduleRepository.save(x);
})
.orElseGet(() -> {
throw new ModuleNotFoundException(id);
});
}
private Optional<Module> moduleRepositoryfindById(long id) {
// TODO Auto-generated method stub
return null;
}
@DeleteMapping("/modules/{id}")
void deleteModule(@PathVariable long id) {
moduleRepository.deleteById(id);
}
} | [
"fuulve@gmail.com"
] | fuulve@gmail.com |
da70f79f49ec965732fba8c993b0b440638f2a52 | 6aa5dcdb7773705c326f22d4577139e38905fd10 | /EclipseMate/src/eclipsemate/Utilities.java | 486667c276b77db105b064561d367bc0fcd8263b | [] | no_license | sandipchitale/sandipchitaleseclipseplugins | 49084c1854b5c9b35d28a84b394263fded5949c6 | 83c2b6e77331e7a73cc60488ab9ae44bcde13f07 | refs/heads/master | 2020-12-02T12:39:28.803307 | 2019-03-03T00:51:24 | 2019-03-03T00:51:24 | 32,247,353 | 5 | 3 | null | 2015-09-26T06:57:26 | 2015-03-15T05:57:57 | Java | UTF-8 | Java | false | false | 6,020 | java | package eclipsemate;
import java.io.File;
import java.util.LinkedList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.filesystem.IFileSystem;
import org.eclipse.core.runtime.IPath;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.internal.editors.text.NonExistingFileEditorInput;
/**
* This implements some utility methods.
*
* @author Sandip V. Chitale
*
*/
@SuppressWarnings("restriction")
public class Utilities {
@SuppressWarnings("unused")
private static String[] escapeBackslash(String[] paths) {
String[] escapedPaths = new String[paths.length];
for (int i = 0; i < paths.length; i++) {
escapedPaths[i] = paths[i].replaceAll(Pattern.quote("\\"), Matcher.quoteReplacement("\\\\"));
}
return escapedPaths;
}
/**
* Parses parameters from a given string in shell-like manner. Users of the
* Bourne shell (e.g. on Unix) will already be familiar with the behavior.
* For example, when using <code>java.lang.ProcessBuilder</code> (Execution
* API) you should be able to:
* <ul>
* <li>Include command names with embedded spaces, such as
* <code>c:\Program Files\jdk\bin\javac</code>.
* <li>Include extra command arguments, such as <code>-Dname=value</code>.
* <li>Do anything else which might require unusual characters or
* processing. For example:
* <p>
* <code><pre>
* "c:\program files\jdk\bin\java" -Dmessage="Hello /\\/\\ there!" -Xmx128m
* </pre></code>
* <p>
* This example would create the following executable name and arguments:
* <ol>
* <li> <code>c:\program files\jdk\bin\java</code>
* <li> <code>-Dmessage=Hello /\/\ there!</code>
* <li> <code>-Xmx128m</code>
* </ol>
* Note that the command string does not escape its backslashes--under the
* assumption that Windows users will not think to do this, meaningless
* escapes are just left as backslashes plus following character.
* </ul>
* <em>Caveat</em>: even after parsing, Windows programs (such as the Java
* launcher) may not fully honor certain characters, such as quotes, in
* command names or arguments. This is because programs under Windows
* frequently perform their own parsing and unescaping (since the shell
* cannot be relied on to do this). On Unix, this problem should not occur.
*
* Copied from org.openide.util.Utilities.
*
* @param s
* a string to parse
* @return an array of parameters
*/
public static String[] parseParameters(String s) {
int NULL = 0x0; // STICK + whitespace or NULL + non_"
int INPARAM = 0x1; // NULL + " or STICK + " or INPARAMPENDING + "\ //
// NOI18N
int INPARAMPENDING = 0x2; // INPARAM + \
int STICK = 0x4; // INPARAM + " or STICK + non_" // NOI18N
int STICKPENDING = 0x8; // STICK + \
List<String> params = new LinkedList<String>();
char c;
int state = NULL;
StringBuffer buff = new StringBuffer(20);
int slength = s.length();
for (int i = 0; i < slength; i++) {
c = s.charAt(i);
if (Character.isWhitespace(c)) {
if (state == NULL) {
if (buff.length() > 0) {
params.add(buff.toString());
buff.setLength(0);
}
} else if (state == STICK) {
params.add(buff.toString());
buff.setLength(0);
state = NULL;
} else if (state == STICKPENDING) {
buff.append('\\');
params.add(buff.toString());
buff.setLength(0);
state = NULL;
} else if (state == INPARAMPENDING) {
state = INPARAM;
buff.append('\\');
buff.append(c);
} else { // INPARAM
buff.append(c);
}
continue;
}
if (c == '\\') {
if (state == NULL) {
++i;
if (i < slength) {
char cc = s.charAt(i);
if ((cc == '"') || (cc == '\\')) {
buff.append(cc);
} else if (Character.isWhitespace(cc)) {
buff.append(c);
--i;
} else {
buff.append(c);
buff.append(cc);
}
} else {
buff.append('\\');
break;
}
continue;
} else if (state == INPARAM) {
state = INPARAMPENDING;
} else if (state == INPARAMPENDING) {
buff.append('\\');
state = INPARAM;
} else if (state == STICK) {
state = STICKPENDING;
} else if (state == STICKPENDING) {
buff.append('\\');
state = STICK;
}
continue;
}
if (c == '"') {
if (state == NULL) {
state = INPARAM;
} else if (state == INPARAM) {
state = STICK;
} else if (state == STICK) {
state = INPARAM;
} else if (state == STICKPENDING) {
buff.append('"');
state = STICK;
} else { // INPARAMPENDING
buff.append('"');
state = INPARAM;
}
continue;
}
if (state == INPARAMPENDING) {
buff.append('\\');
state = INPARAM;
} else if (state == STICKPENDING) {
buff.append('\\');
state = STICK;
}
buff.append(c);
}
// collect
if (state == INPARAM) {
params.add(buff.toString());
} else if ((state & (INPARAMPENDING | STICKPENDING)) != 0) {
buff.append('\\');
params.add(buff.toString());
} else { // NULL or STICK
if (buff.length() != 0) {
params.add(buff.toString());
}
}
String[] ret = params.toArray(new String[0]);
return ret;
}
/**
* Creates a new NonExistingFileEditorInput
*
* @param file
* @param fileName
* @return IEditorInput
*/
public static IEditorInput createNonExistingFileEditorInput(File file, String fileName)
{
IEditorInput input = null;
try
{
IFileSystem fs = EFS.getLocalFileSystem();
IFileStore localFile = fs.fromLocalFile(file);
input = new NonExistingFileEditorInput(localFile, fileName);
}
catch (Exception e)
{
// TODO
}
return input;
}
static File queryFile()
{
IPath stateLocation = Activator.getDefault().getStateLocation();
IPath path = stateLocation.append("/_" + new Object().hashCode()); //$NON-NLS-1$
return new File(path.toOSString());
}
}
| [
"sandipchitale@47c47cea-daa5-11dd-801b-4930de48a34e"
] | sandipchitale@47c47cea-daa5-11dd-801b-4930de48a34e |
5ada98390c4faec0cdb268f1cf636b9140dcc861 | dc2cd532798e8b3f1477ae17fd363a04a680a710 | /docx4j-openxml-objects/src/main/java/org/docx4j/com/microsoft/schemas/office/drawing/x2014/chartex/STEntityType.java | 67d57f249eeeb05d9911bfc8ef9419d3e9ffd1ea | [
"Apache-2.0"
] | permissive | aammar79/docx4j | 4715a6924f742e6e921b08c009cb556e1c42e284 | 0eec2587ab38db5265ce66c12423849c1bea2c60 | refs/heads/master | 2022-09-15T07:27:19.545649 | 2022-02-24T22:18:53 | 2022-02-24T22:18:53 | 175,789,215 | 0 | 0 | null | 2019-03-15T09:27:09 | 2019-03-15T09:27:07 | null | UTF-8 | Java | false | false | 2,302 | java |
package org.docx4j.com.microsoft.schemas.office.drawing.x2014.chartex;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ST_EntityType.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <pre>
* <simpleType name="ST_EntityType">
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="Address"/>
* <enumeration value="AdminDistrict"/>
* <enumeration value="AdminDistrict2"/>
* <enumeration value="AdminDistrict3"/>
* <enumeration value="Continent"/>
* <enumeration value="CountryRegion"/>
* <enumeration value="Locality"/>
* <enumeration value="Ocean"/>
* <enumeration value="Planet"/>
* <enumeration value="PostalCode"/>
* <enumeration value="Region"/>
* <enumeration value="Unsupported"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "ST_EntityType")
@XmlEnum
public enum STEntityType {
@XmlEnumValue("Address")
ADDRESS("Address"),
@XmlEnumValue("AdminDistrict")
ADMIN_DISTRICT("AdminDistrict"),
@XmlEnumValue("AdminDistrict2")
ADMIN_DISTRICT_2("AdminDistrict2"),
@XmlEnumValue("AdminDistrict3")
ADMIN_DISTRICT_3("AdminDistrict3"),
@XmlEnumValue("Continent")
CONTINENT("Continent"),
@XmlEnumValue("CountryRegion")
COUNTRY_REGION("CountryRegion"),
@XmlEnumValue("Locality")
LOCALITY("Locality"),
@XmlEnumValue("Ocean")
OCEAN("Ocean"),
@XmlEnumValue("Planet")
PLANET("Planet"),
@XmlEnumValue("PostalCode")
POSTAL_CODE("PostalCode"),
@XmlEnumValue("Region")
REGION("Region"),
@XmlEnumValue("Unsupported")
UNSUPPORTED("Unsupported");
private final String value;
STEntityType(String v) {
value = v;
}
public String value() {
return value;
}
public static STEntityType fromValue(String v) {
for (STEntityType c: STEntityType.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
}
}
| [
"jason@plutext.org"
] | jason@plutext.org |
503b1d80ec554551a57c39d74ee550d5c22d132b | 175400b1c5941e56db16420d18e91a25be9fdd6a | /java_program/nit_batch1/28feb/Employee.java | 0fe2d5cd7233d2ddaba050a256bd6b3b321c383a | [] | no_license | ManojLucky/NIT-Raipur | b7efaec35397f4447c7ad8a7baca0fcbf16bd4e1 | 7d54fc932077c4d01f7463d5d1f05d35ff611d93 | refs/heads/master | 2021-01-11T04:24:21.493170 | 2017-02-18T19:50:40 | 2017-02-18T19:50:40 | 71,196,450 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 801 | java |
public class Employee {
String name;
String id;
String gender;
int age;
float salary;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public float getSalary() {
return salary;
}
public void setSalary(float salary) {
this.salary = salary;
}
public String toString() {
//return super.toString();
return "EMP_ID " + id +" Name: " + name +" Gender : " +this.gender;
}
}
| [
"manojlucky.216@gmail.com"
] | manojlucky.216@gmail.com |
293f27b54d15156f5e1ef02b5e76011a4b61d447 | 093c07c41eb350efe7a579d0375e3c50e007dff9 | /src/messaging/MessageDispatcher.java | c40c0a59533299173317c9ea2e2681bfb9648c83 | [] | no_license | loictessier/Projet-Multi-Agent-BWAPI-Java | 2f968985be51997f641e79ca36f135365040344f | 1883622f1662afc1604c60c0cef1c07a23be318c | refs/heads/master | 2021-01-20T02:19:35.090065 | 2015-04-22T02:20:58 | 2015-04-22T02:20:58 | 34,282,647 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 2,692 | java | package messaging;
import java.util.Iterator;
import java.util.LinkedHashSet;
import messaging.Message.message_type;
import agents.Agent;
import agents.AgentManager;
public class MessageDispatcher {
public static final double SEND_MSG_IMMEDIATELY = 0.0f;
public static final int NO_ADDITIONAL_INFO = 0;
public static final int SENDER_ID_IRRELEVANT = -1;
private static MessageDispatcher INSTANCE = new MessageDispatcher();
// Liste ne contenant pas de doublon et trié par ordre d'arrivé
private LinkedHashSet<Message> PriorityQ = new LinkedHashSet<Message>();
// singleton
public static MessageDispatcher Instance() {
return INSTANCE;
}
// Distribue le message au receveur
private void Discharge(Agent pReceiver, final Message msg) {
if (!pReceiver.HandleMessage(msg))
{
//telegram could not be handled
System.out.println("Message not handled");
}
}
private MessageDispatcher() {}
/**
* Envoie un message
* @param delay
* @param sender
* @param receiver
* @param msg
* @param ExtraInfo
*/
public void DispatchMessage(double delay, int sender, int receiver, message_type msg, Object ExtraInfo) {
// Recuperation des agents
Agent pReceiver = AgentManager.Instance().GetEntityFromID(receiver);
// Verifie le receveur
if (pReceiver == null) {
System.out.println("Warning! No Receiver with ID of " + receiver + " found");
return;
}
// Creation du message
Message message = new Message(0, sender, receiver, msg, ExtraInfo);
// Message sans délai
if (delay <= 0.0f) {
//Envoie du message
Discharge(pReceiver, message);
} else { // Sinon calcul du moment ou le message sera envoyé
double CurrentTime = System.nanoTime();
message.DispatchTime = CurrentTime + delay;
// Insertion dans la liste
PriorityQ.add(message);
}
}
/**
* Envoi des messages avec délai
*/
public void DispatchDelayedMessages() {
// Recuperation du temps atuel
double CurrentTime = System.nanoTime();
//Suppression des messages avec un délai dépassé
Iterator<Message> iter = PriorityQ.iterator();
while( !PriorityQ.isEmpty() && (((Message[])PriorityQ.toArray())[0].DispatchTime < CurrentTime)
&& (((Message[])PriorityQ.toArray())[0].DispatchTime > 0) ) {
// Recuperation du premier message
Message message = iter.next();
// Receveur
Agent pReceiver = AgentManager.Instance().GetEntityFromID(message.Receiver);
// Envoie du message
Discharge(pReceiver, message);
// Suppression de la liste
iter.remove();
}
}
}
| [
"languew7@P3-3100-08.laboratoire.uqac.ca"
] | languew7@P3-3100-08.laboratoire.uqac.ca |
995db099c862dd76e056c22637ecafb8e9a445c1 | a006a042abaa330740fd1a6b2a982206423f097b | /src/main/java/br/com/controlepartidascs/service/JogadorService.java | 0884c04ee36916769fc8adb78fd3703a95ea6b5e | [] | no_license | EdanSmith/TesteControlePartida-Refatorado | 87003d29f1c4777cd247f297c82fa80e211c346c | 4f554c8003d5bae700abb43369c5bc9091dbccb0 | refs/heads/master | 2020-03-13T18:16:44.359069 | 2018-04-29T17:32:12 | 2018-04-29T17:32:12 | 131,232,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,384 | java | package br.com.controlepartidascs.service;
import java.util.Iterator;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import br.com.controlepartidascs.controller.LogController;
import br.com.controlepartidascs.model.Jogador;
import br.com.controlepartidascs.repository.JogadorRepository;
@Service
public class JogadorService {
@Autowired
JogadorRepository jogadorRepository;
public void salvar(Jogador jogador) {
jogadorRepository.save(jogador);
}
public Jogador findByNome(String nome) {
return jogadorRepository.findByNome(nome);
}
public Iterable<Jogador> findAll() {
return jogadorRepository.findAll();
}
public boolean verificarExistenciaJogadorPorNome(String nomeJogador) {
Jogador jogador = jogadorRepository.findByNome(nomeJogador);
if (jogador == null) {
return false;
}
return true;
}
public void salvarJogadoresInexistentes(Set<Jogador> jogadores) {
Jogador jogadorTemp;
Boolean jogadorExistente;
Iterator<Jogador> itr = jogadores.iterator();
while (itr.hasNext()) {
jogadorTemp = (Jogador) itr.next();
jogadorExistente = verificarExistenciaJogadorPorNome(jogadorTemp.getNome());
if (!jogadorExistente) {
jogadorRepository.save(jogadorTemp);
LogController.log("Jogador adicionado: " + jogadorTemp.getNome());
}
}
}
}
| [
"lucas_zeroken@hotmail.com"
] | lucas_zeroken@hotmail.com |
f772108ace5ef7784a3d96b473d328174081e35b | f220fd7a31a4fd4ce534066e87ca1d13467a0562 | /src/Morena/MorenaStudioFX7.java | 2b595dd49e75ec87ea0c043066e4f72772963604 | [] | no_license | GuilhermeGit/SISGAV | 75433bc503281cb89ce22592ae47599b97aa1734 | 3eed89ee1c444b0b77db42f1b1170011a2a595d3 | refs/heads/master | 2021-01-18T22:39:40.498711 | 2016-05-19T12:50:25 | 2016-05-19T12:50:25 | 44,845,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,801 | java |
import java.io.File;
import java.net.URL;
import java.util.Date;
import java.util.List;
import java.util.Vector;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.Separator;
import javafx.scene.control.ToolBar;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import eu.gnome.morena.Configuration;
import eu.gnome.morena.Device;
import eu.gnome.morena.DeviceListChangeListener;
import eu.gnome.morena.Manager;
import eu.gnome.morena.Scanner;
import eu.gnome.morena.TransferListener;
import eu.gnome.morena.wia.WIAScanner;
public class MorenaStudioFX7 extends Application {
HBox imageBox;
Button removeButton;
Button acquireButton;
Button saveButton;
Button uploadButton;
CheckBox displayUICheckBox;
CheckBox adfScan;
CheckBox duplexScan;
CheckBox transferProgres;
ComboBox<Device> deviceComboBox;
// AnchorPane statusPane;
BorderPane statusPane;
Label status;
Button cancelButton;
ProgressBar pbar;
HBox progressBox;
DeviceListListener deviceListListener;
List<Device> liveDevices;
ObservableList<Device> boundDevices;
Scanner scanningDevice;
private Manager manager;
public static void main(String[] args) {
System.out.println("MorenaStudioFX7 v1.0.2 started at " + (new Date()));
launch(args);
}
@Override
public void start(Stage primaryStage) throws Exception {
Configuration.addDeviceType(".*fficejet.*", true);
Configuration.setMode(Configuration.MODE_NATIVE_UI); // | Configuration.MODE_WIA1_POLL_ENABLED);
manager = Manager.getInstance();
liveDevices = manager.listDevices();
deviceListListener = new DeviceListListener();
manager.addDeviceListChangeListener(deviceListListener);
boundDevices = FXCollections.observableList(new Vector<Device>(liveDevices));
primaryStage.setTitle("Morena StudioFX");
StackPane root = new StackPane();
Text sceneTitle = new Text("Morena Studio 7");
sceneTitle.setId("welcome-text");
Image cancelIcon = new Image(MorenaStudioFX7.class.getResourceAsStream("/resource/cancel.png"));
deviceComboBox = new ComboBox<Device>();
deviceComboBox.setPrefWidth(200);
deviceComboBox.setPromptText("Select device");
BorderPane appletView = new BorderPane();
ToolBar toolbar = new ToolBar();
toolbar.getItems().add(acquireButton = new Button("acquire image"));
toolbar.getItems().add(removeButton = new Button("remove all"));
saveButton = new Button("save to file");
uploadButton = new Button("upload to server");
// toolbar.getItems().add(saveButton=new Button("save to file"));
// toolbar.getItems().add(uploadButton=new Button("upload to server"));
toolbar.getItems().add(new Separator());
toolbar.getItems().add(new Label(" Device:"));
toolbar.getItems().add(deviceComboBox);
toolbar.getItems().add(displayUICheckBox = new CheckBox("display UI"));
toolbar.getItems().add(adfScan = new CheckBox("ADF scan"));
toolbar.getItems().add(duplexScan = new CheckBox("Duplex"));
deviceComboBox.setItems(boundDevices);
deviceComboBox.setOnAction(deviceSelected);
deviceComboBox.setOnShowing(deviceSelecting);
adfScan.setDisable(true);
duplexScan.setDisable(true);
removeButton.setOnAction(removeEvent);
acquireButton.setOnAction(acquireEvent);
saveButton.setOnAction(saveEvent);
uploadButton.setOnAction(uploadEvent);
saveButton.setDisable(true);
uploadButton.setDisable(true);
ScrollPane scrollPane = new ScrollPane();
imageBox = new HBox();
imageBox.getChildren().addListener(new ListChangeListener<Node>() { //@Override
public void onChanged(ListChangeListener.Change<? extends Node> c) {
System.out.println("list changed " + c);
if (imageBox.getChildren().size() > 0) {
saveButton.setDisable(false);
uploadButton.setDisable(false);
} else {
saveButton.setDisable(true);
uploadButton.setDisable(true);
}
}
});
scrollPane.setContent(imageBox);
// statusPane=new AnchorPane();
statusPane = new BorderPane();
status = new Label("status");
status.setAlignment(Pos.CENTER);
pbar = new ProgressBar();
ImageView cancelView = new ImageView(cancelIcon);
cancelButton = new Button();
cancelButton.setGraphic(cancelView);
cancelButton.setId("cancelButton");
cancelButton.setMinSize(cancelIcon.getWidth() + 2, cancelIcon.getHeight() + 2);
cancelButton.setPrefSize(cancelIcon.getWidth() + 2, cancelIcon.getHeight() + 2);
cancelButton.setMaxSize(cancelIcon.getWidth() + 2, cancelIcon.getHeight() + 2);
System.out.println(cancelButton.getMaxHeight() + ", " + cancelButton.getMaxWidth());
cancelButton.setOnAction(cancelEvent);
progressBox = new HBox();
progressBox.getChildren().add(cancelButton);
progressBox.getChildren().add(pbar);
progressBox.setAlignment(Pos.CENTER);
progressBox.setSpacing(5);
statusPane.setLeft(status);
statusPane.setRight(progressBox);
BorderPane.setAlignment(status, Pos.CENTER_LEFT);
BorderPane.setMargin(status, new Insets(0, 0, 0, 5));
BorderPane.setAlignment(progressBox, Pos.CENTER);
BorderPane.setMargin(progressBox, new Insets(0, 5, 0, 0));
statusPane.setLeft(status);
statusPane.setId("status-bar");
statusPane.setMinHeight(22);
statusPane.setPrefHeight(22);
statusPane.setMaxHeight(22);
disableProgressBar();
appletView.setTop(toolbar);
appletView.setCenter(scrollPane);
appletView.setBottom(statusPane);
// BorderPane.setMargin(scrollPane, new Insets(0,0,1,0));
BorderPane.setMargin(statusPane, new Insets(1, 0, 0, 0));
root.setAlignment(Pos.TOP_CENTER);
StackPane.setMargin(appletView, new Insets(30, 15, 30, 15));
root.getChildren().add(sceneTitle);
root.getChildren().add(appletView);
Scene scene = new Scene(root, 1200, 720);
primaryStage.setScene(scene);
URL css = MorenaStudioFX7.class.getResource("/resource/MorenaStudioFX7.css");
// System.out.println(css);
scene.getStylesheets().add(css.toExternalForm());
primaryStage.show();
}
@Override
public void stop() throws Exception {
try {
manager.close();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void disableProgressBar() {
cancelButton.setDisable(true);
pbar.setDisable(true);
pbar.setProgress(0);
}
private void enableProgressBar() {
cancelButton.setDisable(false);
pbar.setDisable(false);
}
// ---------------------- Handlers -
class DeviceListListener implements DeviceListChangeListener {
Vector<Device> devAdded;
Vector<Device> devRemoved;
// @Override
public void listChanged() {
// deprecated
}
// @Override
public void deviceConnected(Device device) {
boundDevices.add(device);
status.setText("device added : " + device);
}
// @Override
public void deviceDisconnected(Device device) {
boundDevices.remove(device);
status.setText("device removed " + device);
}
}
class FileTransferHandler implements TransferListener {
File imageFile;
String message;
boolean transferDone = false;
/**
* Transferred image is handled in this callback method. File containing
* the image is provided as an argument. The image file may be
* invalidated after this method returns and so if the application needs
* to retain the file moving or renaming should be used. The image type
* may vary depending on the interface (Wia/ICA) and the device driver.
* Typical format includes BMP for WIA scanners and JPEG for WIA camera
* and for ICA devices. Please note that this method runs in different
* thread than that where the device.startTransfer() has been called.
*
* @param file - the file containing the acquired image
*
* @see eu.gnome.morena.TransferDoneListener#transferDone(java.io.File)
*/
// @Override
public void transferDone(File file) {
imageFile = file;
System.out.println("image file:" + imageFile.getAbsolutePath());
if (!adfScan.isSelected()) {
transferDone = true;
}
Platform.runLater(new Runnable() {
// @Override
public void run() {
imageBox.getChildren().add(new ImageView("file:" + imageFile.getAbsolutePath()));
if (transferDone) {
disableProgressBar();
status.setText("Transfer done");
transferDone = false;
}
}
});
}
/**
* This callback method is called when scanning process failed for any
* reason. Description of the problem is provided.
*/
// @Override
public void transferFailed(int code, String error) {
message = (code == 0) ? "Feeder empty" : "Scan error (" + code + ") " + error;
System.out.println(message);
transferDone = false;
Platform.runLater(new Runnable() {
// @Override
public void run() {
disableProgressBar();
status.setText(message);
}
});
}
// @Override
public void transferProgress(int percent) {
pbar.setProgress(percent / 100d);
System.out.println("transfer progress " + percent);
}
}
EventHandler<Event> deviceSelecting = new EventHandler<Event>() {
// @Override
public void handle(Event event) {
System.out.println("Selecting device");
if ((Configuration.getMode() & Configuration.MODE_NATIVE_UI) == Configuration.MODE_NATIVE_UI) {
System.out.println("List devices");
//deviceListListener.listChanged();
liveDevices = manager.listDevices();
}
}
};
EventHandler<ActionEvent> deviceSelected = new EventHandler<ActionEvent>() { //@Override
public void handle(ActionEvent event) {
Device device = deviceComboBox.getValue();
// display handling properties for wia device
if (device instanceof WIAScanner) {
WIAScanner ws = (WIAScanner) device;
System.out.println("selected device: " + ws.toString() + " | cap=" + String.format("%02X ", ws.getHandlingCapab()) + " sel=" + String.format("%03X ", ws.getHandlingSelect()));
}
if (device != null && device instanceof Scanner) {
adfScan.setDisable(((Scanner) device).getFeederFunctionalUnit() < 0);
duplexScan.setDisable(!((Scanner) device).isDuplexSupported());
} else {
adfScan.setDisable(true);
duplexScan.setDisable(true);
}
}
};
EventHandler<ActionEvent> removeEvent = new EventHandler<ActionEvent>() {
// @Override
public void handle(ActionEvent event) {
System.out.println("remove event");
imageBox.getChildren().clear();
}
};
EventHandler<ActionEvent> acquireEvent = new EventHandler<ActionEvent>() {
// @Override
public void handle(ActionEvent event) {
System.out.println("acquire event");
try {
status.setText("Working ...");
boolean displayUI = displayUICheckBox.isSelected();
Device device = deviceComboBox.getValue();
if (device != null) {
if (device instanceof Scanner) {
Scanner scanner = (Scanner) device;
if (!displayUI) {
enableProgressBar();
scanningDevice = scanner;
}
int funit = adfScan.isSelected() ? scanner.getFeederFunctionalUnit() : scanner.getFlatbedFunctionalUnit();
if (scanner.isDuplexSupported() && duplexScan.isSelected()) {
scanner.setDuplexEnabled(true);
} else {
scanner.setDuplexEnabled(false);
}
if (funit < 0) {
System.out.println("functional unit type not reported by WIA");
funit = 0; // default functional unit
}
scanner.setMode(Scanner.RGB_8);
scanner.setResolution(75);
//scanner.setFrame(100, 100, 500, 500);
scanner.startTransfer(new FileTransferHandler(), funit);
} else // it would transfer all images from the camera storage and so always show driver UI to select image you want to pick up
{
device.startTransfer(new FileTransferHandler());
}
status.setText("Selected " + device + " transfering ...");
} else {
status.setText("No device selected, please select one!");
}
} catch (Throwable exception) {
exception.printStackTrace();
status.setText("Failed, try again ...");
}
}
};
EventHandler<ActionEvent> saveEvent = new EventHandler<ActionEvent>() {
// @Override
public void handle(ActionEvent event) {
}
};
EventHandler<ActionEvent> uploadEvent = new EventHandler<ActionEvent>() {
// @Override
public void handle(ActionEvent event) {
}
};
EventHandler<ActionEvent> cancelEvent = new EventHandler<ActionEvent>() {
// @Override
public void handle(ActionEvent event) {
scanningDevice.cancelTransfer();
}
};
}
| [
"gitguilherme@yahoo.com"
] | gitguilherme@yahoo.com |
7fe7034f2b73551aea2d466bb809aa3447ac3e09 | 6376b1b0c6e9bde95dc6200bc0c66b9a5eebad7d | /TeamCode/src/main/java/org/firstinspires/ftc/teamcode/AutoBeaconRedUltrasonic.java | a1311cfc715b7154fda4b51441335302151e0c9a | [
"BSD-3-Clause"
] | permissive | FTC-4160/ftc_app | 7d982343c093ced293c9068059b7307febe14622 | 614246f58a463182b061979d377002076b11d6a2 | refs/heads/master | 2021-01-21T09:42:42.354266 | 2017-01-05T23:06:37 | 2017-01-05T23:06:37 | 43,092,208 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,043 | java | package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.util.ElapsedTime;
/**
* Created by Muskies on 12/1/2016.
*/
@Autonomous( name = "Red Beacon with Ultrasonic" )
public class AutoBeaconRedUltrasonic extends LinearOpMode {
private void claim(){
Robot.claimBeacon();
sleep( 2500 );
Robot.resetButtonServos();
sleep( 1000 );
}
void move(double x, double y){
Robot.drive_straight_gyro( x, y );
}
void initRobot(){
Robot.init( hardwareMap, Robot.Alliance.RED );
}
@Override
public void runOpMode() {
initRobot();
waitForStart();
ElapsedTime time = new ElapsedTime();
//move to the wall
while( opModeIsActive() && (time.seconds() < 1.5 || Robot.getUltrasonicLevel() > 27) && !Robot.detectsLine() ){
move( -0.3, 0.4 );
}
Robot.stop();
sleep( 2000 );
//drive to the line
while( opModeIsActive() && !Robot.detectsLine() ) {
move( 0, 0.3 );
}
//drive to the beacon
while( opModeIsActive() && Robot.getUltrasonicLevel() > 5 ){
move( -0.3, 0.0 );
}
Robot.stop();
claim();
while( opModeIsActive() && Robot.getUltrasonicLevel() < 10 ){
move( 0.3, 0.0 );
}
time.reset();
//move off the line
while( opModeIsActive() && time.seconds() < 2 ){
move( 0, 0.5 );
}
//drive to the second line
while( opModeIsActive() && !Robot.detectsLine() ) {
move( 0, 0.5 );
}
Robot.stop();
claim();
move( 0.5, 0 );
sleep( 250 );
Robot.stop();
}
@Override
public void handleLoop(){
Robot.addTelemetry( telemetry );
Robot.sayInitData();
updateTelemetry( telemetry );
super.handleLoop();
}
}
| [
"steven.dirth@gmail.com"
] | steven.dirth@gmail.com |
1c8e5a5c658d960be6a7329d6d5d8519d92da771 | 65ea4160ca54f63add3359274639f858d491bd29 | /MyGame/src/cn/bjsxt/test/TuoYuan.java | 78f622930ed7d62520c64b7881ab718733341d6e | [] | no_license | gaozhuq/plane-javatest | ce6eb716ae6fa2f4dba48cb2eb9e43d21728570b | 18edbb30b62fb49b6aeaa6d2140fca8d4b32e4c2 | refs/heads/master | 2020-12-02T21:17:02.205193 | 2017-07-05T07:03:07 | 2017-07-05T07:03:07 | 96,287,391 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 826 | java | package cn.bjsxt.test;
import java.awt.Graphics;
import java.awt.Image;
import cn.bjsxt.util.GameUtil;
import cn.bjsxt.util.MyFrame;
public class TuoYuan extends MyFrame{
Image img=GameUtil.getImage("images/sun.jpg");
double x=300,y=200;
double degree=0;
private double a=100,b=80;
int init=200;
// int wx=500,wy=500;
@Override
public void paint(Graphics g) {
g.drawOval(init-(int)a, init-(int)b, (int)a*2, (int)b*2);
g.drawImage(img, (int)x-15, (int)y-15, null);
x=init+a*Math.cos(degree);
y=init+b*Math.sin(degree);
if(degree>=6.28){
degree-=6.28;
}else if(degree <0){
degree+=6.28;
}
else{
degree+=0.1;
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new TuoYuan().launchFrame();
}
}
| [
"gaozhq@easemob.com"
] | gaozhq@easemob.com |
2043ce5db34e68dbaba214d9f29a2e02c2089deb | cedc63f489fd48619fe3325d42d3227ccc19746e | /DesignPatternAndjsk8Feature/src/com/company/Main.java | 57ea3b0c873f6f50ca09990b8cd969c0cdf584eb | [] | no_license | jiujiujiujiujiuaia/DesignPattern | 3e931bcdab392a12b202630dbb2c150a0c29e664 | 9466241a643d25c28eae29f2eb999264f81dd98c | refs/heads/master | 2020-03-23T17:41:51.326942 | 2018-07-22T12:05:17 | 2018-07-22T12:05:17 | 141,870,883 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 773 | java | package com.company;
import com.company.PatternDesign.builder.Builder;
import com.company.PatternDesign.facade.FacadeInterface;
import com.company.PatternDesign.facade_factory_strategy.Facade;
import com.sun.prism.impl.BaseMesh;
public class Main {
public static void main(String[] args) {
//----------------builder---------------
// Builder builder = new Builder("A");
// System.out.print("\n");
// Builder builder1 = new Builder("B");
//----------------facade----------------
// FacadeInterface facadeInterface = new FacadeInterface();
// facadeInterface.doAction();
//---------------facade-factory-strategy------------
Facade facade = new Facade();
facade.interfa("B");
facade.interfa("A");
}
}
| [
"yuchunwei@hujiang.com"
] | yuchunwei@hujiang.com |
20619ae4d2a394d03dbe40b60d8b39ea6f9662ce | c4de97b5088a39d9f2d684f07e6811b5185606d6 | /AndroidBasic/app/src/main/java/com/example/nurhidayati/androidbasic/EditName.java | 14f3173f01692d4da0b15f7df6e7d0e8331c0207 | [] | no_license | nurhidayati2703/AndroidBasic | 232defb0d731931a410cc962ddb403c6ee625253 | 4c1a0730e34ab4bb001178b1941e4e18c4a70e36 | refs/heads/master | 2020-04-30T07:20:30.301940 | 2019-03-20T07:57:03 | 2019-03-20T07:57:03 | 176,681,355 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 972 | java | package com.example.nurhidayati.androidbasic;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class EditName extends AppCompatActivity {
public static final String EXTRA_NAME ="EXTRA_NAME";
@BindView(R.id.editText2)
EditText editText2;
@BindView(R.id.btn_save)
Button btnSave;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_name);
ButterKnife.bind(this);
}
@OnClick(R.id.btn_save)
public void onViewClicked(){
String name = editText2.getText().toString();
Intent i = new Intent();
i.putExtra(EXTRA_NAME, name);
setResult(RESULT_OK, i);
finish();
}
}
| [
"nurhidayati"
] | nurhidayati |
f40eb62a8214cdaa5c9188f210a7edb75c0e0e1e | 67984d7d945b67709b24fda630efe864b9ae9c72 | /base-info/src/main/java/com/ey/piit/sdo/invoice/vo/InvoiceOtherVo.java | bcd078900184aa43311f6785e62b4e1cceebaa8b | [] | no_license | JackPaiPaiNi/Piit | 76c7fb6762912127a665fa0638ceea1c76893fc6 | 89b8d79487e6d8ff21319472499b6e255104e1f6 | refs/heads/master | 2020-04-07T22:30:35.105370 | 2018-11-23T02:58:31 | 2018-11-23T02:58:31 | 158,773,760 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 301 | java | package com.ey.piit.sdo.invoice.vo;
import com.ey.piit.sdo.invoice.entity.InvoiceOther;
/**
* 发票其他费用明细Entity
* @author 高文浩
*/
public class InvoiceOtherVo extends InvoiceOther {
public InvoiceOtherVo() {
super();
}
public InvoiceOtherVo(String id){
super(id);
}
} | [
"1210287515@master"
] | 1210287515@master |
ba2e3d6eea9c354b8f0731e2abb00c53573b8376 | 2f127b28c78313819cd9af27ee04baa4858256e4 | /oauth-server/src/main/java/com/mca/server/controller/RegisterController.java | 64342cbb4e36463faae79662889376f76e819034 | [] | no_license | WeekFirst/myprodev | ff01b879b42f8d4ccda41efa070605fe66028883 | 12822c3574966880074b39e3e7b3b0a1202ca292 | refs/heads/main | 2023-06-23T17:40:18.894716 | 2021-07-05T08:44:46 | 2021-07-05T08:44:46 | 382,616,764 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,388 | java | package com.mca.server.controller;
import com.alibaba.fastjson.JSONObject;
import com.mca.server.entity.UserInfo;
import com.mca.server.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
//@CrossOrigin(origins = "*" , maxAge = 3600)
@RestController
@RequestMapping(value = "/register")
@Slf4j
public class RegisterController {
@Autowired
private UserService userService;
@PostMapping(value = "")
public Object register(UserInfo userInfo){
Map<String, Object> map;
try {
Boolean result = userService.register(userInfo);
if(result){
map = new HashMap<>();
map.put("code", 200);
map.put("message", "创建成功");
return new JSONObject(map);
}else{
map = new HashMap<>();
map.put("code", 100);
map.put("message", "用户名以存在");
return new JSONObject(map);
}
} catch (Exception e) {
log.error(e.getMessage());
map = new HashMap<>();
map.put("code", 403);
map.put("message", "create err");
return new JSONObject(map);
}
}
}
| [
"mca19930914@outlook.com"
] | mca19930914@outlook.com |
f4384dd596edf1c5f75de960e59b3d8d3ae45529 | 4f0f96670125316a457adbab146f46d37f0f8410 | /src/clientserveurweb/Client.java | 732de74c44a9963c5112f5d68b71c8bad285ee19 | [] | no_license | dmattiola/ClientServeurWeb | 1964ead9a23fd06c151221ffbd06ba510f7efe9d | aff4853a2ff9b04e55c5d420bd86ee252f239204 | refs/heads/master | 2016-09-05T13:48:20.490408 | 2014-05-19T08:51:17 | 2014-05-19T08:51:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 288 | 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 clientserveurweb;
/**
*
* @author p1305435
*/
public class Client {
}
| [
"p1305435@EPULWKS56.univ-lyon1.fr"
] | p1305435@EPULWKS56.univ-lyon1.fr |
33783a186c5be2fea710c647652bc4b0d27f1ad6 | 7aee0be0bff8eba84841a8a407c76502dafabfe3 | /src/main/java/org/example/pages/ResultPage.java | 7aa453d6f09723eb6d560a5e83952e4aa18786e0 | [] | no_license | danilishe/PageObjectExample | 2435c592146fe43ed30815b040d8e3cfc5926a37 | ca132c2cba48dfc0344580c61e83797629d3a3f6 | refs/heads/master | 2023-05-14T09:24:31.738052 | 2019-12-14T19:35:59 | 2019-12-14T19:35:59 | 228,077,939 | 1 | 0 | null | 2023-05-09T18:36:34 | 2019-12-14T19:33:10 | Java | UTF-8 | Java | false | false | 415 | java | package org.example.pages;
import com.codeborne.selenide.Condition;
import static com.codeborne.selenide.Selenide.$x;
public class ResultPage {
public ResultPage() {
$x("//*[@id='hdtb']").shouldBe(Condition.visible);
}
public GoogleCalc googleCalc() {
return new GoogleCalc();
}
public GoogleVideoResult googleVideoResult() {
return new GoogleVideoResult();
}
}
| [
"suetin.danil@gmail.com"
] | suetin.danil@gmail.com |
3326b4b6af35c6cfc594cfefba418596741f16e6 | 376ec956f1a0d707a4e50b067aa86afdebfc52c4 | /src/enums/ECardStatus.java | 7e4a17818a6c3a3df2c2be87733c72d5abb3d77a | [
"Apache-2.0"
] | permissive | ybarrantes/java-match_match | 60e562073b045835ce8dea7404c7d93de0182cf7 | 7be9308e09ecf1cf65eb70ffbcc665c87b239ce7 | refs/heads/master | 2020-09-12T07:39:18.159195 | 2019-12-18T04:44:17 | 2019-12-18T04:44:17 | 222,357,592 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 68 | java | package enums;
public enum ECardStatus {
Hidden, Visible, Match
}
| [
"ybarrantes.juntos085@gmail.com"
] | ybarrantes.juntos085@gmail.com |
a0d2ecde5d4dceec6df2c4bb8cab66d189da0665 | 48a39953497d891d1948735427b6eb73fc1b052f | /app/src/main/java/com/example/measurementhw/SecondActivity.java | 4ef4b6cb5eed7ad9cbddb1fcd46ab59266b93ae1 | [] | no_license | Uchihiha/MeasurementHW | 20a9147654b911bbf4b1b7e32233067d07fdcd9f | effc1923148ed0158098647dabee8286f1e1656e | refs/heads/master | 2023-01-23T10:06:37.257589 | 2020-12-04T00:33:48 | 2020-12-04T00:33:48 | 318,358,105 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,250 | java | package com.example.measurementhw;
import android.database.Cursor;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
public class SecondActivity extends AppCompatActivity {
DatabaseHelper myDB;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
ListView listView = (ListView) findViewById(R.id.listView);
myDB = new DatabaseHelper(this);
ArrayList<String> theList = new ArrayList<>();
Cursor data = myDB.getListContents();
if(data.getCount()== 0){
Toast.makeText(SecondActivity.this,"The Database is Empty !",Toast.LENGTH_LONG).show();
}else{
while(data.moveToNext()){
theList.add(data.getString(1));
ListAdapter listAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1,theList);
listView.setAdapter(listAdapter);
}
}
}
}
| [
"alish.kapali@yahoo.com"
] | alish.kapali@yahoo.com |
af0ebe44e9da5b89cd9841a185753b6075d5173f | e3308bbe87116392869a19acafd64d412b815952 | /app/src/main/java/co/nano/nanowallet/network/model/request/WorkRequest.java | a7d991ee60133db8c9d294b0b601f063da9bd298 | [
"BSD-2-Clause"
] | permissive | nano-wallet-company/nano-wallet-android | 2874fc393d57caae9c5bfedf1104186d6c1b458c | cfc1cb86205d2e68e4d495657217e57e51b45492 | refs/heads/master | 2021-03-22T04:36:25.922110 | 2019-12-18T16:58:15 | 2019-12-18T16:58:15 | 116,496,686 | 40 | 42 | BSD-2-Clause | 2020-10-12T15:26:54 | 2018-01-06T16:11:50 | Java | UTF-8 | Java | false | false | 878 | java | package co.nano.nanowallet.network.model.request;
import com.google.gson.annotations.SerializedName;
import co.nano.nanowallet.network.model.Actions;
import co.nano.nanowallet.network.model.BaseRequest;
/**
* Fetch work for a transaction
*/
public class WorkRequest extends BaseRequest {
@SerializedName("action")
private String action;
@SerializedName("hash")
private String hash;
public WorkRequest() {
this.action = Actions.WORK.toString();
}
public WorkRequest(String hash) {
this.action = Actions.WORK.toString();
this.hash = hash;
}
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public String getHash() {
return hash;
}
public void setHash(String hash) {
this.hash = hash;
}
}
| [
"szeidner@gmail.com"
] | szeidner@gmail.com |
cc8ed29d8deccc54610e85139fc4fa088a012e9a | 64461dee5a743cee7bbe1fafaf6235cb49c8d600 | /comunicationcenterservice/src/main/java/comunicationcenter/service/dto/user/UserDTO.java | c765b8d28fb36330263d9de201f9d6a7ff632cf9 | [] | no_license | simoncalabrese/comunicationcenter | 5a0de9f7a1b83e6f0ee4af4d83f29bdec5dc6073 | 748510b6e581c13728062b2e5d1cb0307368e78a | refs/heads/master | 2021-07-21T22:24:24.245685 | 2017-10-31T17:21:21 | 2017-10-31T17:21:21 | 109,029,436 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,079 | java | package comunicationcenter.service.dto.user;
import comunicationcenter.service.dto.base.AbstractDTO;
/**
* Created by simon.calabrese on 31/10/2017.
*/
public class UserDTO extends AbstractDTO {
private static final long serialVersionUID = -814487417621307500L;
private Integer id;
private String name;
private String surname;
private String codFisc;
private String partIva;
private UserDTO reference;
private Boolean readPermission;
private Boolean writePermission;
private String email;
private String phone;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public String getCodFisc() {
return codFisc;
}
public void setCodFisc(String codFisc) {
this.codFisc = codFisc;
}
public String getPartIva() {
return partIva;
}
public void setPartIva(String partIva) {
this.partIva = partIva;
}
public UserDTO getReference() {
return reference;
}
public void setReference(UserDTO reference) {
this.reference = reference;
}
public Boolean getReadPermission() {
return readPermission;
}
public void setReadPermission(Boolean readPermission) {
this.readPermission = readPermission;
}
public Boolean getWritePermission() {
return writePermission;
}
public void setWritePermission(Boolean writePermission) {
this.writePermission = writePermission;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
}
| [
"bartolomeomio8"
] | bartolomeomio8 |
df4e8c8309d01a657b98b6f7a3d7ef22fe1a1659 | 5fc944a63146f22815499fa643a040ea705457da | /src/main/java/com/productcredit/app/util/ICRUD.java | 201028ab1a10fb13fbf12ba237a8380b7a6bb8a6 | [] | no_license | observadorxpl/micro-credito | 7e62d259fb890a9fb93f630945f9e2033c5434f7 | 9218e676da944d248f790212745f6e26a54d4250 | refs/heads/master | 2020-12-12T18:02:50.384474 | 2020-02-05T21:57:05 | 2020-02-05T21:57:05 | 234,192,742 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 304 | java | package com.productcredit.app.util;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
public interface ICRUD<T>{
public Flux<T> findAll();
public Mono<T> finById(String id);
public Mono<T> save(T t);
public Mono<Void> delete(T t);
public Mono<Void> deleteById(String id);
}
| [
"jcayoacu@everis.com"
] | jcayoacu@everis.com |
b50a918193eca0202f392659c5e3551eec42b592 | 416324f1bb89b8795b437845f397c814c0960d0c | /libraries/igeo/src/igeo/IObject.java | c6791a039ef75d4fd23f6433cbb8d7a7ae694aa6 | [] | no_license | doloresjoya/programming-processing | a7ad6c9c6489552361c3c5843cf0542b07444221 | 885a546a5d83c6fabccbca0656e61e1448dccf62 | refs/heads/master | 2016-08-11T10:18:41.826771 | 2016-03-19T16:48:16 | 2016-03-19T16:48:16 | 54,273,689 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,628 | java | /*---
iGeo - http://igeo.jp
Copyright (c) 2002-2013 Satoru Sugihara
This file is part of iGeo.
iGeo is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, version 3.
iGeo 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 iGeo. If not, see <http://www.gnu.org/licenses/>.
---*/
package igeo;
import java.util.*;
import java.awt.Color;
import igeo.gui.*;
/**
A base class of iGeo object to be contained by IServer.
Only instances of sub-classes of IObject can be carried by IServer.
IObject contains three types of subobjects.
One IParameterObject, multiple IGraphicObject and multiple IDynamics.
If you assign IServerI in the constructor, the instance is contained by the server.
If not the instance is contained by a server found in static IG methods.
@author Satoru Sugihara
*/
//public interface IElement{
//public class IElement{
public class IObject{
//public int id; // or use String UUID or use object instance's hash code?
//public String name;
public IServer server;
/*protected*/ public IParameterObject parameter;
//IGraphicObject graphic;
//IDynamics dynamic;
public ArrayList<IGraphicObject> graphics;
public ArrayList<IDynamics> dynamics;
//public ILayer layer;
/** object attributes like color, layer, etc. */
public IAttribute attribute;
/** for user's custom data */
public Object[] userData;
/** IObject is stored in default IServer (through current static IG instance) */
public IObject(){ initObject(null); }
/** IObject is stored in the IServer via holder */
public IObject(IServerI holder){ initObject(holder); }
public IObject(IObject e){
initObject(e.server);
// geometry might not be ready in subclass
//if(graphics!=null){ initGraphic(e.server); setColor(e.getColor()); }
if(e.attribute!=null){ attribute = e.attribute.dup(); }
}
public IObject(IServerI holder, IObject e){
initObject(holder);
// geometry might not be ready in subclass
//if(graphics!=null){ initGraphic(holder); setColor(e.getColor()); }
if(e.attribute!=null){ attribute = e.attribute.dup(); }
}
/** duplicate object */
public IObject dup(){ return new IObject(this); }
/** alias of dup() */
public IObject cp(){ return dup(); }
public void initObject(IServerI holder){
/*IServer*/ server = null;
if(holder==null){
IG ig = IG.cur();
if(ig==null){
IOut.err("no IG is found. IObject is not stored in a server.");
return;
}
server = ig.server();
}
else server = holder.server();
//synchronized(IG.lock){ // already synchronized in add
server.add(this);
//}
}
public void initGraphic(IServerI holder){
/*IServer*/ server = null;
if(holder==null){
IG ig = IG.current();
if(ig==null){
IOut.err("no IG is found. IObject is not stored in a server.");
return;
}
server = ig.server();
}
else server = holder.server();
if(server.isGraphicMode())
//synchronized(IG.lock){
synchronized(server.server().ig){
server.graphicServer().add(this);
}
}
public void del(){
if(server!=null){ server.remove(this); server=null; }
else if(IG.current()!=null) IG.current().server().remove(this); // necessary?
}
/** checking parameters validity. to be overriden. */
public boolean isValid(){ return true; }
public void setParameter(IParameterObject param){
if(parameter!=null) IOut.err("parameter is already set. overwrote.");
parameter = param;
}
/*
public void addGraphic(IGraphicObject graf){
if(graphics==null) graphics = new ArrayList<IGraphicObject>();
if(graphics.size()>0){
if(!IGConfig.keepMultipleGraphicsInElement){
for(IGraphicObject g:graphics) server.removeGraphicElement(g);
graphics.clear();
}
else{
graf.setColor(graphics.get(0).getColor());
}
}
graphics.add(graf);
}
public void setDynamic(IGDynamicSubelement dyna){
if(dynamics==null) dynamics = new ArrayList<IGDynamicSubelement>();
dynamics.add(dyna);
}
*/
public void addDynamics(IDynamics dyna){
if(dynamics==null) dynamics = new ArrayList<IDynamics>();
if(!dynamics.contains(dyna)) dynamics.add(dyna);
if(server!=null&&server.dynamicServer()!=null) server.dynamicServer().add(dyna);
}
public IParameterObject getParameter(){ return parameter; }
public IGraphicObject getGraphic(int i){
if(graphics==null) return null;
return graphics.get(i);
}
public IDynamics getDynamics(int i){
if(dynamics==null) return null;
return dynamics.get(i);
}
public int graphicsNum(){ if(graphics==null) return 0; return graphics.size(); }
public int dynamicsNum(){ if(dynamics==null) return 0; return dynamics.size(); }
public void clearGraphics(){ if(graphics!=null) graphics.clear(); }
public void clearDynamics(){ if(dynamics!=null) dynamics.clear(); }
public void deletDynamics(int index){
if(index<0||index>=dynamics.size()) return;
if(server!=null && server.dynamicServer!=null)
server.dynamicServer.remove(dynamics.get(index));
dynamics.remove(index);
}
public void deleteDynamics(IDynamics dyn){
if(!dynamics.contains(dyn)) return;
if(server!=null && server.dynamicServer!=null) server.dynamicServer.remove(dyn);
dynamics.remove(dyn);
}
public void deleteDynamics(){
if(server!=null && server.dynamicServer!=null){
for(IDynamics dyn:dynamics)
server.dynamicServer.remove(dyn);
}
}
//public void setGraphicMode(IGraphicMode m){} //create graphics if necessary
//create graphics if necessary
public IGraphicObject getGraphic(IGraphicMode m){
if(graphics==null) graphics = new ArrayList<IGraphicObject>();
else{
for(IGraphicObject gr: graphics)
if(gr.isDrawable(m)) return gr;
}
IGraphicObject gr = createGraphic(m);
if(attribute!=null) gr.setAttribute(attribute);
if(gr!=null) graphics.add(gr);
return gr;
//return null;
}
// to be overwritten in subclasses
public IGraphicObject createGraphic(IGraphicMode m){
return null;
}
/** delete all graphics */
public void deleteGraphic(){
if(server!=null && server.graphicServer!=null && graphics!=null){
//for(IGraphicObject gr:graphics)
for(int i=0; i<graphics.size(); i++)
server.graphicServer.remove(graphics.get(i));
}
}
/**
update graphic when control point location changes or some minor change.
*/
public void updateGraphic(){
/*
deleteGraphic();
if(server!=null && server.graphicServer!=null)
synchronized(IG.lock){ server.graphicServer().add(this); }
*/
//for(IGraphicObject gr:graphics) gr.update();
if(graphics!=null) for(int i=0; i<graphics.size(); i++) graphics.get(i).update();
}
/**
update whole graphic by deleting current one when there is major change.
*/
public void resetGraphic(){
deleteGraphic();
if(server!=null && server.graphicServer!=null)
//synchronized(IG.lock){
synchronized(server.server().ig){
server.graphicServer().add(this);
}
}
public IServer server(){ return server; }
public String name(){
if(attribute!=null) return attribute.name;
return null;
}
public IObject name(String name){
if(attribute==null) attribute = defaultAttribute();
attribute.name = name;
return this;
}
/** Get layer of the object */
public ILayer layer(){
//return layer;
if(attribute!=null) return attribute.layer;
return null;
}
/** Set layer by ILayer object */
public IObject layer(ILayer l){
if(l==null){
if(attribute!=null){ attribute.layer = null; }
}
else{
if(attribute==null){
attribute = defaultAttribute();
if(!l.contains(this)) l.add(this);
attribute.layer = l;
}
else if(attribute.layer!=l){
if(!l.contains(this)) l.add(this);
attribute.layer = l;
}
}
/*
if(l==null) layer=null;
else if(layer!=l){
if(!l.contains(this)) l.add(this);
layer=l;
}
*/
return this;
}
/** Set layer by layer name. If the layer specified by the name is not existing in the server, a new layer is automatically created in the server */
public IObject layer(String layerName){
if(server!=null) return layer(server.layer(layerName));
return layer(IG.layer(layerName));
}
/** get attributes */
public IAttribute attr(){ return attribute; }
/** set attributes */
public IObject attr(IAttribute at){
attribute=at;
//syncGraphic();
if(attribute!=null && graphics!=null){
for(int i=0; i<graphics.size(); i++){ graphics.get(i).setAttribute(attribute); }
}
return this;
}
/** set a duplicate of attributes of another object. if obj is null or its attributes is null, ignored. */
public IObject attr(IObject obj){ if(obj!=null && obj.attr()!=null) attr(obj.attr().dup()); return this; }
/** default setting in each object class; to be overridden in a child class */
public IAttribute defaultAttribute(){
return new IAttribute();
}
/** get user's custom data */
public Object[] userData(){ return userData; }
/** get user's custom data */
public Object userData(int index){
if(userData==null || index>=userData.length) return null;
return userData[index];
}
/** get user's custom data */
public int userDataNum(){ return userData==null?0:userData.length; }
/** set user's custom data */
public IObject userData(Object[] data){ userData=data; return this; }
/** set user's custom data */
public IObject addUserData(Object data){
if(userData==null){
userData=new Object[1];
userData[0] = data;
}
else{
Object[] newUserData = new Object[userData.length+1];
for(int i=0; i<userData.length; i++){
newUserData[i] = userData[i];
}
newUserData[userData.length] = data;
userData = newUserData;
}
return this;
}
/** set user's custom data */
public IObject addUserData(String key, String value){
HashMap<String,String> map=null;
if(userData==null){
userData=new Object[1];
map = new HashMap<String,String>();
userData[0] = map;
}
else{
for(int i=0; i<userData.length && map==null; i++){ // find existing HashMap<String,String>
if(userData[i] instanceof HashMap){
HashMap generalMap = (HashMap)userData[i];
Set keys = generalMap.keySet();
if(keys!=null){
Iterator iter = keys.iterator();
if(iter!=null){
Object k =iter.next();
if(k instanceof String){
Object v = generalMap.get(k);
if(v instanceof String){
map = castStringHashMap(generalMap);
}
}
}
}
}
}
if(map==null){
Object[] newUserData = new Object[userData.length+1];
for(int i=0; i<userData.length; i++){
newUserData[i] = userData[i];
}
map = new HashMap<String,String>();
newUserData[userData.length] = map;
userData = newUserData;
}
}
map.put(key,value);
return this;
}
//
@SuppressWarnings("unchecked") //
public static HashMap<String,String> castStringHashMap(HashMap m){
return (HashMap<String,String>)m;
}
// shouldn't these methods be in other graphic class?
public boolean visible(){
//if(attribute==null) attribute=defaultAttribute(); // default true?
//return attribute.visible;
//if(graphics==null) return false; // some objects like agent which have no graphics but as attributes it's visible
if(attribute!=null) return attribute.visible();
if(graphics!=null) for(IGraphicObject gr:graphics) if(gr.visible()) return true;
return false;
}
public boolean isVisible(){ return visible(); }
public IObject hide(){
if(graphics!=null) for(IGraphicObject gr:graphics) gr.hide();
if(attribute==null) attribute=defaultAttribute();
//attribute.visible=false;
attribute.hide();
return this;
}
public IObject show(){
if(graphics!=null) for(IGraphicObject gr:graphics) gr.show();
if(attribute==null) attribute=defaultAttribute();
//attribute.visible=true;
attribute.show();
return this;
}
/** update all graphics by the attribute */
public void syncGraphic(){
syncColor(); syncWeight(); syncVisibility();
}
/** update color of all graphics by the color in attribute */
public void syncColor(){
if(attribute!=null && attribute.clr()!=null && graphics!=null){
for(IGraphicObject gr:graphics) gr.setColor(attribute.clr());
}
}
/** update color of all graphics by the color in attribute */
public void syncVisibility(){
if(attribute!=null && graphics!=null){
for(IGraphicObject gr:graphics) gr.setVisible(attribute.visible());
}
}
/** update weight of all graphics by the color in attribute */
public void syncWeight(){
if(attribute!=null && graphics!=null){
for(IGraphicObject gr:graphics) gr.setWeight(attribute.weight());
}
}
/** @return returns whatever Color of any graphics member. (first found) */
public IColor clr(){
if(attribute!=null && attribute.clr()!=null) return attribute.clr();
if(graphics!=null)
for(IGraphicObject gr:graphics)
if(gr.getColor()!=null) return gr.getColor();
//return IGraphicObject.getColor(IGraphicObject.defaultRed,IGraphicObject.defaultGreen,IGraphicObject.defaultBlue,IGraphicObject.defaultAlpha);
return IConfig.objectColor;
}
/** @return returns weight in attribute if any attribute exists. if not default weight in IConfig */
public float weight(){
if(attribute!=null) return attribute.weight;
if(graphics!=null)
for(IGraphicObject gr:graphics)
if(gr.getWeight()>=0) return gr.getWeight(); // if weight is not implented, it returns -1
return IConfig.strokeWeight;
}
public int redInt(){ return clr().getRed(); }
public int greenInt(){ return clr().getGreen(); }
public int blueInt(){ return clr().getBlue(); }
public int alphaInt(){ return clr().getAlpha(); }
public int greyInt(){ return clr().getGrey(); }
public int grayInt(){ return greyInt(); }
public float red(){ return clr().red(); }
public float green(){ return clr().green(); }
public float blue(){ return clr().blue(); }
public float alpha(){ return clr().alpha(); }
public float grey(){ return clr().grey(); }
public float gray(){ return clr().gray(); }
public float hue(){ return clr().hue(); }
public float saturation(){ return clr().saturation(); }
public float brightness(){ return clr().brightness(); }
/** to set an object color */
public IObject clr(IColor c){
if(c==null) return this; // if null, do nothing, don't create attribute
if(attribute==null) attribute = defaultAttribute();
attribute.clr(c);
syncColor();
return this;
}
/** to set color, with alpha value overwritten */
public IObject clr(IColor c, int alpha){
if(attribute==null) attribute = defaultAttribute();
attribute.clr(c,alpha);
syncColor();
return this;
}
/** to set color, with alpha value overwritten */
public IObject clr(IColor c, float alpha){
if(attribute==null) attribute = defaultAttribute();
attribute.clr(c,alpha);
syncColor();
return this;
}
/** to set color, with alpha value overwritten */
public IObject clr(IColor c, double alpha){ return clr(c,(float)alpha); }
/** to set the same color with the object */
public IObject clr(IObject o){ clr(o.clr()); return this; }
/** @return returns whatever Color of any graphics member. (first found) */
//public Color color(){ return awtColor(); }
/** @return returns whatever Color of any graphics member. (first found) */
public Color awtColor(){
if(attribute!=null) return attribute.color.awt();
if(graphics!=null)
for(IGraphicObject gr:graphics) if(gr.getColor()!=null) return gr.getColor().awt();
return IConfig.objectColor.awt();
}
public Color getAWTColor(){ return awtColor(); }
public IObject clr(Color c){ return clr(new IColor(c)); }
public IObject clr(Color c, int alpha){ return clr(new IColor(c),alpha); }
public IObject clr(Color c, float alpha){ return clr(new IColor(c),alpha); }
public IObject clr(Color c, double alpha){ return clr(new IColor(c),alpha); }
/** @return returns whatever Color of any graphics member. (first found) */
public IColor getColor(){ return clr(); }
public IObject clr(int gray){
if(attribute==null) attribute = defaultAttribute();
attribute.clr(gray);
syncColor();
return this;
}
public IObject clr(double dgray){
if(attribute==null) attribute = defaultAttribute();
attribute.clr(dgray);
syncColor();
return this;
}
public IObject clr(float fgray){
if(attribute==null) attribute = defaultAttribute();
attribute.clr(fgray);
syncColor();
return this;
}
public IObject clr(int gray, int alpha){
if(attribute==null) attribute = defaultAttribute();
attribute.clr(gray,alpha);
syncColor();
return this;
}
public IObject clr(double dgray, double dalpha){
if(attribute==null) attribute = defaultAttribute();
attribute.clr(dgray, dalpha);
syncColor();
return this;
}
public IObject clr(float fgray, float falpha){
if(attribute==null) attribute = defaultAttribute();
attribute.clr(fgray, falpha);
syncColor();
return this;
}
public IObject clr(int r, int g, int b){
if(attribute==null) attribute = defaultAttribute();
attribute.clr(r,g,b);
syncColor();
return this;
}
public IObject clr(double dr, double dg, double db){
if(attribute==null) attribute = defaultAttribute();
attribute.clr(dr,dg,db);
syncColor();
return this;
}
public IObject clr(float fr, float fg, float fb){
if(attribute==null) attribute = defaultAttribute();
attribute.clr(fr,fg,fb);
syncColor();
return this;
}
public IObject clr(int r, int g, int b, int a){
if(attribute==null) attribute = defaultAttribute();
attribute.clr(r,g,b,a);
syncColor();
return this;
}
public IObject clr(double dr, double dg, double db, double da){
if(attribute==null) attribute = defaultAttribute();
attribute.clr(dr,dg,db,da);
syncColor();
return this;
}
public IObject clr(float fr, float fg, float fb, float fa){
if(attribute==null) attribute = defaultAttribute();
attribute.clr(fr,fg,fb,fa);
syncColor();
return this;
}
public IObject hsb(double dh, double ds, double db, double da){
if(attribute==null) attribute = defaultAttribute();
attribute.hsb(dh,ds,db,da);
syncColor();
return this;
}
public IObject hsb(float h, float s, float b, float a){
if(attribute==null) attribute = defaultAttribute();
attribute.hsb(h,s,b,a);
syncColor();
return this;
}
public IObject hsb(double dh, double ds, double db){
if(attribute==null) attribute = defaultAttribute();
attribute.hsb(dh,ds,db);
syncColor();
return this;
}
public IObject hsb(float h, float s, float b){
if(attribute==null) attribute = defaultAttribute();
attribute.hsb(h,s,b);
syncColor();
return this;
}
public IObject weight(double w){ return weight((float)w); }
public IObject weight(float w){
if(attribute==null) attribute = defaultAttribute();
attribute.weight(w);
syncWeight();
return this;
}
public IObject setColor(IColor c){ return clr(c); }
public IObject setColor(IColor c, int alpha){ return clr(c,alpha); }
public IObject setColor(IColor c, float alpha){ return clr(c,alpha); }
public IObject setColor(IColor c, double alpha){ return clr(c,alpha); }
//
public IObject setColor(Color c){ return clr(c); }
public IObject setColor(Color c, int alpha){ return clr(c,alpha); }
public IObject setColor(Color c, float alpha){ return clr(c,alpha); }
public IObject setColor(Color c, double alpha){ return clr(c,alpha); }
//
public IObject setColor(int gray){ return clr(gray); }
public IObject setColor(float fgray){ return clr(fgray); }
public IObject setColor(double dgray){ return clr(dgray); }
public IObject setColor(int gray, int alpha){ return clr(gray,alpha); }
public IObject setColor(float fgray, float falpha){ return clr(fgray,falpha); }
public IObject setColor(double dgray, double dalpha){ return clr(dgray,dalpha); }
public IObject setColor(int r, int g, int b){ return clr(r,g,b); }
public IObject setColor(float fr, float fg, float fb){ return clr(fr,fg,fb); }
public IObject setColor(double dr, double dg, double db){ return clr(dr,dg,db); }
public IObject setColor(int r, int g, int b, int a){ return clr(r,g,b,a); }
public IObject setColor(float fr, float fg, float fb, float fa){ return clr(fr,fg,fb,fa); }
public IObject setColor(double dr, double dg, double db, double da){ return clr(dr,dg,db,da); }
public IObject setHSBColor(float h, float s, float b, float a){ return hsb(h,s,b,a); }
public IObject setHSBColor(double h, double s, double b, double a){ return hsb(h,s,b,a); }
public IObject setHSBColor(float h, float s, float b){ return hsb(h,s,b); }
public IObject setHSBColor(double h, double s, double b){ return hsb(h,s,b); }
/*
public void setGraphic(IGraphicObject graf){
if(graphic!=null) IOut.p("graphic is already set. overwrote.");
graphic = graf;
}
public void setDynamic(IGDynamicSubelement dyna){
if(dynamic!=null) IOut.p("dynamic is already set. overwrote.");
dynamic = dyna;
}
public void createGraphics(){
if(graphic!=null) IOut.p("graphic is already set. overwrote.");
}
public void createDynamics(){
if(dynamic!=null) IOut.p("dynamic is already set. overwrote.");
}
*/
//public IGParameter parameter();
//public IGraphics graphics();
//public IGDynamics dynamics();
//public void enableParameter();
//public void enableGraphics();
//public void enableDynamics();
//public void register();
//public void delete();
}
| [
"djoya@ebay.com"
] | djoya@ebay.com |
46208be56eb688073535c4b9758b34d9c82d03c5 | 92a7feddf1ac9af9c2e6e39292f820a03504599f | /positioning/src/main/java/com/sybd/znld/position/model/Point.java | 182bc7aab77c1c0111ba91542577d2f8c90f0b9d | [] | no_license | xiamu126/parent | db74381cc613c5829c5b3b91e3b54d254f4d5155 | e670e1a7fba3088479ed1078c80b144cc6b78ca0 | refs/heads/dev | 2023-08-14T16:26:32.493228 | 2020-01-10T06:02:36 | 2020-01-10T06:02:36 | 232,977,647 | 2 | 0 | null | 2023-07-23T02:24:40 | 2020-01-10T06:06:41 | JavaScript | UTF-8 | Java | false | false | 187 | java | package com.sybd.znld.position.model;
public class Point {
public Double lng;
public Double lat;
@Override
public String toString() {
return lng+","+lat;
}
}
| [
"xw@sybd.com"
] | xw@sybd.com |
cd0ce8e9389fcae1ad2a4f6dc6ae13d13429cb35 | fa2c9ba7adf219c8ae86864061a7673b9f5f009b | /src/main/java/com/linkedin/cubert/block/TupleStoreBlock.java | 116af23f524adf8d87e88db0a371b29691085721 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | Cyber-Fussion/Cubert | b8d1fb52de13cc76ee3962194851108125535c51 | dc3b4e643d50abd855b94ed4655bef65cf57764f | refs/heads/master | 2020-06-26T00:48:27.571093 | 2017-07-12T11:24:28 | 2017-07-12T11:24:28 | 96,999,414 | 0 | 0 | null | 2017-07-12T11:18:27 | 2017-07-12T11:18:27 | null | UTF-8 | Java | false | false | 2,822 | java | /* (c) 2014 LinkedIn Corp. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use
* this file except in compliance with the License. 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.
*/
package com.linkedin.cubert.block;
import java.io.IOException;
import java.util.Iterator;
import org.apache.pig.data.Tuple;
import org.codehaus.jackson.JsonNode;
import com.linkedin.cubert.utils.TupleStore;
/**
* Provides a block interface for an underlying TupleStore, which can be
* SerializedTupleStore or RawTupleStore. This block exhibits the "Auto Rewind" behavior.
*
* In standard use, a block generate tuples (in the next() method) and finally when it
* cannot generate any more data, it returns null. If the next() method were to be called
* from this point on, the block will keep not returning null, indicating that is no data
* to return.
*
* In auto-rewind case, however, the block will rewind to the beginning of the buffer once
* it has exhausted all tuples. That is, the block will first return tuples in the next()
* method, and when not more data is available, it will return null. After returning null,
* this block will then rewind the in-memory buffer. Therefore, if a next() call were to
* be made now, the first tuple will be returned.
*
* @author Maneesh Varshney
*
*/
public class TupleStoreBlock implements Block
{
private final TupleStore store;
private final BlockProperties props;
private Iterator<Tuple> iterator;
public TupleStoreBlock(TupleStore store, BlockProperties props)
{
this.store = store;
this.props = props;
this.iterator = store.iterator();
if (!store.getSchema().equals(props.getSchema()))
{
throw new RuntimeException("Schema of TupleStore and Block should match!");
}
}
@Override
public BlockProperties getProperties()
{
return props;
}
@Override
public void configure(JsonNode json) throws IOException,
InterruptedException
{
}
@Override
public Tuple next() throws IOException,
InterruptedException
{
if (!iterator.hasNext())
{
// "rewinding" the iterator here!!
iterator = store.iterator();
return null;
}
return iterator.next();
}
@Override
public void rewind() throws IOException
{
iterator = store.iterator();
}
public TupleStore getStore()
{
return store;
}
}
| [
"mvarshney@linkedin.com"
] | mvarshney@linkedin.com |
8437258a75564f9e7b078d5d007d1b50606e8960 | 7307237b41614b9e2cf318131485bde24e093755 | /ORM/src/main/java/ru/kpfu/itis/repository/BookmarkRepository.java | 02c35d4fcff4e3e00c66fbae1bf1004dfb004e02 | [] | no_license | muyapparova/homework | bc133868a4d4ee0208314808d7569fd762e9c3b3 | fd5ce52dfb2de8fa899b0618dda8692eac2aad34 | refs/heads/master | 2021-01-20T17:53:57.533723 | 2016-06-07T05:49:54 | 2016-06-07T05:49:54 | 60,585,662 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 258 | java | package ru.kpfu.itis.repository;
import ru.kpfu.itis.model.Bookmark;
import ru.kpfu.itis.model.User;
import java.util.List;
public interface BookmarkRepository {
void addBookmark(Bookmark bookmark);
List<Bookmark> allUserBookmarks(User user);
}
| [
"steamnotblock@mail.ru"
] | steamnotblock@mail.ru |
693479b878b74e16214a976f7e8b5c55c9abe722 | 2af17e20773cb5f80ae5e27b53da5904b83cf5a4 | /source code/opeserver_Onsite_Release_Source_Code/src/paymentsrc/com/ope/patu/payments/lum2/beans/LUM2PaymentRecordBean.java | c4cecd1d623a7bad1d21b74b46509e8c6ccb2fdc | [] | no_license | debjava/OPE_releases | d977e8a16d7f33230456566f555fe50522162151 | d9d1c34d998dd128392e2e6e9572fab7da3fd41d | refs/heads/master | 2020-04-08T09:07:19.787283 | 2018-11-26T18:21:09 | 2018-11-26T18:21:09 | 159,208,875 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,169 | java | package com.ope.patu.payments.lum2.beans;
import java.util.ArrayList;
import java.util.List;
public class LUM2PaymentRecordBean {
String applicationCode,recordCode,acceptanceCode,beneficiaryNameAddress,beneficiaryCountryCode,swiftCode,
beneficiaryBankNameAddress,beneficiaryAccountCode,reasonPaymentInformation, currencyAmount,currencyCode,
reservedWord1,exchangeRateAgmtNo,paymentType,serviceFee, debitDate, counterValuePayment,exchangeRatePayment,
debitingAccount, debitingAccountCurrencyCode,debitingAmount,archiveId,feedbackCurrency,reservedWord2;
int lineLength;
int seqNo;
private List<String> paymentErrorMsg = new ArrayList<String>();
private List<String> paymentSuccessMsg = new ArrayList<String>();
private List<String> itemisationErrorMsg = new ArrayList<String>();
private List<String> paymentRejectedMsg = new ArrayList<String>();
public int getSeqNo() {
return seqNo;
}
public void setSeqNo(int seqNo) {
this.seqNo = seqNo;
}
public List<String> getItemisationErrorMsg() {
return itemisationErrorMsg;
}
public void setItemisationErrorMsg(List<String> itemisationErrorMsg) {
this.itemisationErrorMsg = itemisationErrorMsg;
}
public String getApplicationCode() {
return applicationCode;
}
public void setApplicationCode(String applicationCode) {
this.applicationCode = applicationCode;
}
public String getRecordCode() {
return recordCode;
}
public void setRecordCode(String recordCode) {
this.recordCode = recordCode;
}
public String getAcceptanceCode() {
return acceptanceCode;
}
public void setAcceptanceCode(String acceptanceCode) {
this.acceptanceCode = acceptanceCode;
}
public String getBeneficiaryNameAddress() {
return beneficiaryNameAddress;
}
public void setBeneficiaryNameAddress(String beneficiaryNameAddress) {
this.beneficiaryNameAddress = beneficiaryNameAddress;
}
public String getBeneficiaryCountryCode() {
return beneficiaryCountryCode;
}
public void setBeneficiaryCountryCode(String beneficiaryCountryCode) {
this.beneficiaryCountryCode = beneficiaryCountryCode;
}
public String getSwiftCode() {
return swiftCode;
}
public void setSwiftCode(String swiftCode) {
this.swiftCode = swiftCode;
}
public String getBeneficiaryBankNameAddress() {
return beneficiaryBankNameAddress;
}
public void setBeneficiaryBankNameAddress(String beneficiaryBankNameAddress) {
this.beneficiaryBankNameAddress = beneficiaryBankNameAddress;
}
public String getBeneficiaryAccountCode() {
return beneficiaryAccountCode;
}
public void setBeneficiaryAccountCode(String beneficiaryAccountCode) {
this.beneficiaryAccountCode = beneficiaryAccountCode;
}
public String getReasonPaymentInformation() {
return reasonPaymentInformation;
}
public void setReasonPaymentInformation(String reasonPaymentInformation) {
this.reasonPaymentInformation = reasonPaymentInformation;
}
public String getCurrencyAmount() {
return currencyAmount;
}
public void setCurrencyAmount(String currencyAmount) {
this.currencyAmount = currencyAmount;
}
public String getCurrencyCode() {
return currencyCode;
}
public void setCurrencyCode(String currencyCode) {
this.currencyCode = currencyCode;
}
public String getReservedWord1() {
return reservedWord1;
}
public void setReservedWord1(String reservedWord1) {
this.reservedWord1 = reservedWord1;
}
public String getExchangeRateAgmtNo() {
return exchangeRateAgmtNo;
}
public void setExchangeRateAgmtNo(String exchangeRateAgmtNo) {
this.exchangeRateAgmtNo = exchangeRateAgmtNo;
}
public String getPaymentType() {
return paymentType;
}
public void setPaymentType(String paymentType) {
this.paymentType = paymentType;
}
public String getServiceFee() {
return serviceFee;
}
public void setServiceFee(String serviceFee) {
this.serviceFee = serviceFee;
}
public String getDebitDate() {
return debitDate;
}
public void setDebitDate(String debitDate) {
this.debitDate = debitDate;
}
public String getCounterValuePayment() {
return counterValuePayment;
}
public void setCounterValuePayment(String counterValuePayment) {
this.counterValuePayment = counterValuePayment;
}
public String getExchangeRatePayment() {
return exchangeRatePayment;
}
public void setExchangeRatePayment(String exchangeRatePayment) {
this.exchangeRatePayment = exchangeRatePayment;
}
public String getDebitingAccount() {
return debitingAccount;
}
public void setDebitingAccount(String debitingAccount) {
this.debitingAccount = debitingAccount;
}
public String getDebitingAccountCurrencyCode() {
return debitingAccountCurrencyCode;
}
public void setDebitingAccountCurrencyCode(String debitingAccountCurrencyCode) {
this.debitingAccountCurrencyCode = debitingAccountCurrencyCode;
}
public String getDebitingAmount() {
return debitingAmount;
}
public void setDebitingAmount(String debitingAmount) {
this.debitingAmount = debitingAmount;
}
public String getArchiveId() {
return archiveId;
}
public void setArchiveId(String archiveId) {
this.archiveId = archiveId;
}
public String getFeedbackCurrency() {
return feedbackCurrency;
}
public void setFeedbackCurrency(String feedbackCurrency) {
this.feedbackCurrency = feedbackCurrency;
}
public String getReservedWord2() {
return reservedWord2;
}
public void setReservedWord2(String reservedWord2) {
this.reservedWord2 = reservedWord2;
}
public int getLineLength() {
return lineLength;
}
public void setLineLength(int lineLength) {
this.lineLength = lineLength;
}
public List<String> getPaymentErrorMsg() {
return paymentErrorMsg;
}
public void setPaymentErrorMsg(List<String> paymentErrorMsg) {
this.paymentErrorMsg = paymentErrorMsg;
}
public List<String> getPaymentSuccessMsg() {
return paymentSuccessMsg;
}
public void setPaymentSuccessMsg(List<String> paymentSuccessMsg) {
this.paymentSuccessMsg = paymentSuccessMsg;
}
public List<String> getPaymentRejectedMsg() {
return paymentRejectedMsg;
}
public void setPaymentRejectedMsg(List<String> paymentRejectedMsg) {
this.paymentRejectedMsg = paymentRejectedMsg;
}
}
| [
"deba.java@gmail.com"
] | deba.java@gmail.com |
96bbd31e765ec639318724e8673ec473de194202 | 09593b82d461da36cc67655739b953822dfdff9f | /first-web-app/src/main/java/webapp/LoginServlet.java | 396c73affc5144c65e20537bbbccdc3363cda70e | [] | no_license | mviswa36/java | b0afb52e7edbed897dd00e4b0eb812dc2bb429d1 | 5fea9d1c6e4c5dd4bb86ed350b1f0540a43eed6a | refs/heads/master | 2021-01-12T09:08:05.404627 | 2016-12-23T23:28:13 | 2016-12-23T23:28:13 | 76,770,137 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,412 | java | package webapp;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/*
* Browser sends Http Request to Web Server
*
* Code in Web Server => Input:HttpRequest, Output: HttpResponse
* JEE with Servlets
*
* Web Server responds with Http Response
*/
//Java Platform, Enterprise Edition (Java EE) JEE6
//Servlet is a Java programming language class
//used to extend the capabilities of servers
//that host applications accessed by means of
//a request-response programming model.
//1. extends javax.servlet.http.HttpServlet
//2. @WebServlet(urlPatterns = "/login.do")
//3. doGet(HttpServletRequest request, HttpServletResponse response)
//4. How is the response created?
@WebServlet(urlPatterns = "/login.do")
public class LoginServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Yahoo!!!!!!!!</title>");
out.println("</head>");
out.println("<body>");
out.println("My First Servlet");
out.println("</body>");
out.println("</html>");
}
}
| [
"viswanath muddada"
] | viswanath muddada |
9f8cfd0da8d4c225ffa4e641191c784ea66d3ba1 | 6f98ae382525553896f550dde6002c53d193cf8b | /src/main/java/com/liuyanzhao/forum/controller/common/KaptchaController.java | 00cbe920b88ca68920e7698b2acdcf9330653795 | [] | no_license | saysky/codergroup | 8979d4c3801c4b799827aae49c39a1569cbfba4e | c62521da1add3179a5dceed1707e6c355d06c67d | refs/heads/master | 2023-03-03T10:42:52.474469 | 2022-05-07T04:39:37 | 2022-05-07T04:39:37 | 190,708,888 | 31 | 9 | null | 2023-02-22T05:15:58 | 2019-06-07T08:05:46 | Java | UTF-8 | Java | false | false | 1,911 | java | package com.liuyanzhao.forum.controller.common;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import com.google.code.kaptcha.Constants;
import com.google.code.kaptcha.Producer;
/**
* @author 言曌
* @date 2018/5/4 下午12:36
*/
@Controller
public class KaptchaController extends BaseController {
@Autowired
private Producer captchaProducer;
@GetMapping("/getKaptchaImage")
public void getKaptchaImage() throws Exception {
response.setDateHeader("Expires", 0);
// Set standard HTTP/1.1 no-cache headers.
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
// Set IE extended HTTP/1.1 no-cache headers (use addHeader).
response.addHeader("Cache-Control", "post-check=0, pre-check=0");
// Set standard HTTP/1.0 no-cache header.
response.setHeader("Pragma", "no-cache");
// return a jpeg
response.setContentType("image/jpeg");
// create the text for the image
String capText = captchaProducer.createText();
// store the text in the session
//request.getSession().setAttribute(Constants.KAPTCHA_SESSION_KEY, capText);
//将验证码存到session
session.setAttribute(Constants.KAPTCHA_SESSION_KEY, capText);
// System.out.println("验证码是:"+capText);
// create the image with the text
BufferedImage bi = captchaProducer.createImage(capText);
ServletOutputStream out = response.getOutputStream();
// write the data out
ImageIO.write(bi, "jpg", out);
try {
out.flush();
} finally {
out.close();
}
}
}
| [
"847064370@qq.com"
] | 847064370@qq.com |
d99eeacbd877a4214e5513b62e36456d2e9b99fc | ebdc4d7001d84bf428d0579e58441e1f2a39f125 | /src/main/java/com/example/schoolManagement/Schools/SchoolRepository.java | 3ef468eab718e17ff31779a4e59f5eb42268ea85 | [] | no_license | GeorgeKariukiNgugi/Spring-Boot-Starter-Student-Management-Sytstem | 23924ef1409d020a7aab760dde0b3229e218855b | f8b9439faae86349ca0d85b0acbdf86d32f377f9 | refs/heads/master | 2023-07-10T00:50:03.724366 | 2021-08-18T04:59:58 | 2021-08-18T04:59:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 251 | java | package com.example.schoolManagement.Schools;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface SchoolRepository extends JpaRepository<SchoolEntity,Long> {
}
| [
"ngugigeorge697@gmail.com"
] | ngugigeorge697@gmail.com |
6a0323de1a3993e479791b58514f4750e732dfc0 | 4d19f80ca2d81c3555a59f6e983cfa33c65cbaa3 | /src/model/Restaurant.java | 1e68ddef216ae16509601bfb9c9892a305bb4f34 | [] | no_license | zychjdtc/firstWeb | 736fb37b8397cd77c827b711c920dc17a4b85681 | bf5905e5c62b7f5beba31448d13feb516f887347 | refs/heads/master | 2021-01-20T02:37:52.472698 | 2017-04-26T04:17:20 | 2017-04-26T04:17:20 | 89,432,215 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 5,395 | java | package model;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class Restaurant {
// * Performed data cleanup and purify from Yelp API.
//因为java里和前段对斜杠的理解不一样 所以做个特殊处理
public static String parseString(String str) {
return str.replace("\"", "\\\"").replace("/", " or ");
}
//把restaurant的信息都穿在java class里, 但是前段无法识别data 只能改成Json,
public static String jsonArrayToString(JSONArray array) {
StringBuilder sb = new StringBuilder();
try {
for (int i = 0; i < array.length(); i++) {
String obj = (String) array.get(i);
sb.append(obj);
if (i != array.length() - 1) {
sb.append(",");
}
}
} catch (JSONException e) {
e.printStackTrace();
}
return sb.toString();
}
public static JSONArray stringToJSONArray(String str) {
try {
return new JSONArray("[" + parseString(str) + "]");
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
private String businessId;
private String name;
private String categories;
private String city;
private String state;
private String fullAddress;
private double stars;
private double latitude;
private double longitude;
private String imageUrl;
private String url;
//把有用的数据从API里拿出来 然后放到java class里传进数据库
public Restaurant(JSONObject object) {
try {
if (object != null) {
this.businessId = object.getString("id");
JSONArray jsonArray = (JSONArray) object.get("categories");
List<String> list = new ArrayList<>();
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject subObejct = jsonArray.getJSONObject(i);
list.add(subObejct.getString("title"));
}
this.categories = String.join(",", list);
this.name = object.getString("name");
this.imageUrl = object.getString("image_url");
this.stars = object.getDouble("rating");
JSONObject coordinates = (JSONObject) object.get("coordinates");
this.latitude = coordinates.getDouble("latitude");
this.longitude = coordinates.getDouble("longitude");
JSONObject location = (JSONObject) object.get("location");
this.city = location.getString("city");
this.state = location.getString("state");
this.fullAddress = jsonArrayToString((JSONArray) location.get("display_address"));
this.url = object.getString("url");
}
} catch (Exception e) {
e.printStackTrace();
}
}
// do not automatically generate this constructor
public Restaurant(String businessId, String name, String categories,
String city, String state, double stars, String fullAddress,
double latitude, double longitude, String imageUrl, String url) {
this.businessId = businessId;
this.name = name;
this.categories = categories;
this.city = city;
this.state = state;
this.fullAddress = fullAddress;
this.stars = stars;
this.latitude = latitude;
this.longitude = longitude;
this.imageUrl = imageUrl;
this.url = url;
}
//把java class转成JSON
public JSONObject toJSONObject() {
JSONObject obj = new JSONObject();
try {
obj.put("business_id", businessId);
obj.put("name", name);
obj.put("stars", stars);
obj.put("latitude", latitude);
obj.put("longitude", longitude);
obj.put("full_address", fullAddress);
obj.put("city", city);
obj.put("state", state);
obj.put("categories", stringToJSONArray(categories));
obj.put("image_url", imageUrl);
obj.put("url", url);
} catch (JSONException e) {
e.printStackTrace();
}
return obj;
}
public String getBusinessId() {
return businessId;
}
public void setBusinessId(String businessId) {
this.businessId = businessId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCategories() {
return categories;
}
public void setCategories(String categories) {
this.categories = categories;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getFullAddress() {
return fullAddress;
}
public void setFullAddress(String fullAddress) {
this.fullAddress = fullAddress;
}
public double getStars() {
return stars;
}
public void setStars(double stars) {
this.stars = stars;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
}
| [
"zychjdtc@hotmail.com"
] | zychjdtc@hotmail.com |
506b27b3a82f54ede637d07e535cbb0c9750b33b | 9f66a597dc10e088a0c6632edfc52b3ef96157ca | /Basic Corejava/src/exceptionhandling/Exceptionhandlingclass3.java | 67c44ba320c82fac4822caf3d0b8430da6f73c58 | [] | no_license | kavishwaramruta/Automation | fa0240d9ad3cb491f71ca4253f07aff1daea22a4 | a9cd8ead3c48a735abb0f1fc9d2f53c8a556c1cb | refs/heads/master | 2023-05-11T03:35:00.044533 | 2020-09-13T08:40:05 | 2020-09-13T08:40:05 | 188,669,118 | 0 | 0 | null | 2023-05-09T17:55:11 | 2019-05-26T10:30:32 | HTML | UTF-8 | Java | false | false | 728 | java | package exceptionhandling;
import oops.abstractions.RBI;
public class Exceptionhandlingclass3 {
public static void main(String[] args) throws InterruptedException {
try { // Exception type1:Unchecked Exception
int a=10;
int b=10;
System.out.println(a/b);
RBI obj=null;
//obj.creditCard();
String str="anand";
System.out.println(str.charAt(5));
System.out.println("anand");
Thread.sleep(3000);
System.out.println("bhayre");
Test.login();
}catch(ArithmeticException e)
{
System.out.println("Divident is zero");
}catch(NullPointerException e)
{
System.out.println("RBI reference is not initialized");
}catch(RuntimeException e)
{
System.out.println(e.getMessage());
}
}
}
| [
"kavishwaramruta@gmail.com"
] | kavishwaramruta@gmail.com |
3f0cbc930d1d6838566961e42702ceb43e17429a | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_1799c69368ad9913af499678bcdbde26c203e138/InitialResolver/2_1799c69368ad9913af499678bcdbde26c203e138_InitialResolver_t.java | 1a69defb1a7ad14a0c3b4f732fa89b7bc7b524bd | [] | 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 | 59,507 | java | package soot.javaToJimple;
import soot.*;
import java.util.*;
public class InitialResolver {
private polyglot.ast.Node astNode; // source node
private soot.SootClass sootClass; // class being processed
private ArrayList staticFieldInits;
private ArrayList fieldInits;
private HashMap fieldMap; // maps field instances to soot fields
//private HashMap sourceToClassMap; // is used
private ArrayList initializerBlocks;
private ArrayList staticInitializerBlocks;
private polyglot.frontend.Compiler compiler;
private polyglot.util.Position currentClassDeclPos;
private BiMap anonClassMap; // maps New to SootClass (name)
private HashMap anonTypeMap; //maps polyglot types to soot types
private BiMap localClassMap; // maps LocalClassDecl to SootClass (name)
private HashMap localTypeMap; // maps polyglot types to soot types
private int privateAccessCounter = 0; // global for whole program because
// the methods created are static
private HashMap privateAccessMap;
private HashMap finalLocalInfo; // new or lcd mapped to list of final locals avail in current meth and the whether its static
private HashMap newToOuterMap;
private HashMap sootNameToAST = null;
private ArrayList hasOuterRefInInit; // list of sootclass types that need an outer class this param in for init
private HashMap classToSourceMap;
private HashMap specialAnonMap;
/**
* returns true if there is an AST avail for given soot class
*/
public boolean hasASTForSootName(String name){
if (sootNameToAST == null) return false;
if (sootNameToAST.containsKey(name)) return true;
return false;
}
/**
* sets AST for given soot class if possible
*/
public void setASTForSootName(String name){
if (!hasASTForSootName(name)) {
throw new RuntimeException("Can only set AST for name if it exists. You should probably not be calling this method unless you know what you're doing1!");
}
setAst((polyglot.ast.Node)sootNameToAST.get(name));
}
public InitialResolver(soot.Singletons.Global g){}
public static InitialResolver v() {
return soot.G.v().soot_javaToJimple_InitialResolver();
}
/**
* Invokes polyglot and gets the AST for the source given in fullPath
*/
public void formAst(String fullPath, List locations){
JavaToJimple jtj = new JavaToJimple();
polyglot.frontend.ExtensionInfo extInfo = jtj.initExtInfo(fullPath, locations);
// only have one compiler - for memory issues
if (compiler == null) {
compiler = new polyglot.frontend.Compiler(extInfo);
}
// build ast
astNode = jtj.compile(compiler, fullPath, extInfo);
}
/**
* if you have a special AST set it here then call resolveFormJavaFile
* on the soot class
*/
public void setAst(polyglot.ast.Node ast) {
astNode = ast;
}
/**
* adds source file tag to each sootclass
*/
private void addSourceFileTag(soot.SootClass sc){
if (sc.getTag("SourceFileTag") != null) return;
String name = Util.getSourceFileOfClass(sc);
if (classToSourceMap != null){
if (classToSourceMap.containsKey(name)){
name = (String)classToSourceMap.get(name);
}
}
//System.out.println("source file tag: "+name);
// all classes may be in map
/*if (soot.SourceLocator.v().getSourceToClassMap() != null) {
if (soot.SourceLocator.v().getSourceToClassMap().get(name) != null) {
name = (String)soot.SourceLocator.v().getSourceToClassMap().get(name);
}
}*/
// add file extension
//name += ".java";
sc.addTag(new soot.tagkit.SourceFileTag(name));
}
/* get types and resolve them in the Scene
* use a polyglot visitor to find all types in AST
* for nested inner classes fix names (. -> $)
* for local and anon find, invent names and resolve those
*/
private void resolveTypes(){
// get types and resolve them in the Scene
TypeListBuilder typeListBuilder = new TypeListBuilder();
astNode.visit(typeListBuilder);
Iterator it = typeListBuilder.getList().iterator();
while (it.hasNext()) {
polyglot.types.Type type = (polyglot.types.Type)it.next();
// ignore primitives
if (type.isPrimitive()) continue;
// ignore non class types
if (!type.isClass()) continue;
polyglot.types.ClassType classType = (polyglot.types.ClassType)type;
resolveClassType(classType);
}
// resolve Object, StringBuffer(used for string concat) and Throwable
// (used for finally)
SootResolver.v().assertResolvedClass("java.lang.Object");
SootResolver.v().assertResolvedClass("java.lang.StringBuffer");
SootResolver.v().assertResolvedClass("java.lang.Throwable");
}
/**
* resolve class types - recursively resolving outer class if nec.
*/
private void resolveClassType(polyglot.types.ClassType classType){
soot.Type sootClassType;
// fix class names of inner member classes
if (classType.isNested()){
resolveClassType(classType.outer());
}
if (classType.isLocal()) {
resolveLocalClass(classType);
}
if (classType.isAnonymous()) {
resolveAnonClass(classType);
}
sootClassType = Util.getSootType(classType);
if (classTypesFound == null){
classTypesFound = new ArrayList();
}
classTypesFound.add(classType);
// saves classnames mapped to AST
/*ClassDeclFinder finder = new ClassDeclFinder();
finder.typeToFind(classType);
astNode.visit(finder);
if (finder.declFound() != null){
addNameToAST(((soot.RefType)sootClassType).getClassName());
}*/
SootResolver.v().assertResolvedClassForType(sootClassType);
}
private ArrayList classTypesFound;
private void makeASTMap(){
ClassDeclFinder finder = new ClassDeclFinder();
finder.typesToFind(classTypesFound);
astNode.visit(finder);
Iterator it = finder.declsFound().iterator();
while (it.hasNext()){
addNameToAST(Util.getSootType(((polyglot.ast.ClassDecl)it.next()).type()).toString());
}
}
/**
* add name to AST to map - used mostly for inner and non public
* top-level classes
*/
private void addNameToAST(String name){
if (sootNameToAST == null){
sootNameToAST = new HashMap();
}
sootNameToAST.put(name, astNode);
}
// resolves all types and deals with .class literals and asserts
public void resolveFromJavaFile(soot.SootClass sc) {
sootClass = sc;
//System.out.println("resolving sc: "+sc.getName()+" is interface: "+soot.Modifier.isInterface(sc.getModifiers()));
// add sourcefile tag to Soot class
//addSourceFileTag(sc);
// get types and resolve them in the Scene
resolveTypes();
makeASTMap();
// determine is ".class" literal is used
/*ClassLiteralChecker classLitChecker = new ClassLiteralChecker();
astNode.visit(classLitChecker);
ArrayList classLitList = classLitChecker.getList();
if (!classLitList.isEmpty()) {
String methodName = "class$";
soot.Type methodRetType = soot.RefType.v("java.lang.Class");
ArrayList paramTypes = new ArrayList();
paramTypes.add(soot.RefType.v("java.lang.String"));
if (!sc.declaresMethod(methodName, paramTypes, methodRetType)){
soot.SootMethod sootMethod = new soot.SootMethod(methodName, paramTypes, methodRetType, soot.Modifier.STATIC);
ClassLiteralMethodSource mSrc = new ClassLiteralMethodSource();
sootMethod.setSource(mSrc);
sc.addMethod(sootMethod);
}
}
Iterator classLitIt = classLitList.iterator();
while (classLitIt.hasNext()) {
polyglot.ast.ClassLit classLit = (polyglot.ast.ClassLit)classLitIt.next();
// field
String fieldName = "class$";
String type = Util.getSootType(classLit.typeNode().type()).toString();
type = soot.util.StringTools.replaceAll(type, ".", "$");
fieldName = fieldName+type;
soot.Type fieldType = soot.RefType.v("java.lang.Class");
if (!sc.declaresField(fieldName, fieldType)){
soot.SootField sootField = new soot.SootField(fieldName, fieldType, soot.Modifier.STATIC);
sc.addField(sootField);
}
}*/
// determine if assert is used
/*AssertStmtChecker asc = new AssertStmtChecker();
astNode.visit(asc);
if (asc.isHasAssert()){
handleAssert();
}*/
// create class to source map first
// create source file
if (astNode instanceof polyglot.ast.SourceFile) {
createClassToSourceMap((polyglot.ast.SourceFile)astNode);
createSource((polyglot.ast.SourceFile)astNode);
}
addSourceFileTag(sc);
}
private void createClassToSourceMap(polyglot.ast.SourceFile src){
//System.out.println("src source name: "+src.source().name());
//System.out.println("src source path: "+src.source().path());
//System.out.println("src package: "+src.package_());
String srcName = src.source().path();
String srcFileName = null;
if (src.package_() != null){
String slashedPkg = soot.util.StringTools.replaceAll(src.package_().package_().fullName(), ".", System.getProperty("file.separator"));
//System.out.println("slashPkg: "+slashedPkg);
srcFileName = srcName.substring(srcName.lastIndexOf(slashedPkg));
}
else {
srcFileName = srcName.substring(srcName.lastIndexOf(System.getProperty("file.separator"))+1);
}
//System.out.println("srcFile name: "+srcFileName);
//polyglot.ast.ClassDecl publicDecl = null;
ArrayList list = new ArrayList();
Iterator it = src.decls().iterator();
while (it.hasNext()){
polyglot.ast.ClassDecl nextDecl = (polyglot.ast.ClassDecl)it.next();
/*if (nextDecl.flags().isPublic()){
publicDecl = nextDecl;
}
else {*/
// list.add(nextDecl);
//System.out.println("adding to class to source map: "+nextDecl.type().toString()+" and "+srcFileName);
addToClassToSourceMap(Util.getSootType(nextDecl.type()).toString(), srcFileName);
//}
}
/*Iterator it2 = list.iterator();
while (it2.hasNext()){
//addToClassToSourceMap(Util.getSootType(((polyglot.ast.ClassDecl)it2.next()).type()).toString(), Util.getSootType(publicDecl.type()).toString());
addToClassToSourceMap(Util.getSootType(((polyglot.ast.ClassDecl)it2.next()).type()).toString(), srcFileName);
}*/
}
/**
* Handling for assert stmts - extra fields and methods are needed
* in the Jimple
*/
private void handleAssert(polyglot.ast.ClassBody cBody){
AssertStmtChecker asc = new AssertStmtChecker();
cBody.visit(asc);
if (!asc.isHasAssert()) return;
// two extra fields
if (!sootClass.declaresField("$assertionsDisabled", soot.BooleanType.v())){
sootClass.addField(new soot.SootField("$assertionsDisabled", soot.BooleanType.v(), soot.Modifier.STATIC | soot.Modifier.FINAL));
}
//System.out.println("adding class$ field to : "+sootClass+" from assert");
if (!sootClass.declaresField("class$"+sootClass.getName(), soot.RefType.v("java.lang.Class"))){
sootClass.addField(new soot.SootField("class$"+sootClass.getName(), soot.RefType.v("java.lang.Class"), soot.Modifier.STATIC));
}
// two extra methods
String methodName = "class$";
soot.Type methodRetType = soot.RefType.v("java.lang.Class");
ArrayList paramTypes = new ArrayList();
paramTypes.add(soot.RefType.v("java.lang.String"));
if (!sootClass.declaresMethod(methodName, paramTypes, methodRetType)){
soot.SootMethod sootMethod = new soot.SootMethod(methodName, paramTypes, methodRetType, soot.Modifier.STATIC);
AssertClassMethodSource mSrc = new AssertClassMethodSource();
sootMethod.setSource(mSrc);
sootClass.addMethod(sootMethod);
}
methodName = "<clinit>";
methodRetType = soot.VoidType.v();
paramTypes = new ArrayList();
if (!sootClass.declaresMethod(methodName, paramTypes, methodRetType)){
soot.SootMethod sootMethod = new soot.SootMethod(methodName, paramTypes, methodRetType, soot.Modifier.STATIC);
PolyglotMethodSource mSrc = new PolyglotMethodSource();
mSrc.hasAssert(true);
sootMethod.setSource(mSrc);
sootClass.addMethod(sootMethod);
}
else {
((soot.javaToJimple.PolyglotMethodSource)sootClass.getMethod(methodName, paramTypes, methodRetType).getSource()).hasAssert(true);
}
}
private int getNextAnonNum(){
if (anonTypeMap == null) return 1;
else return anonTypeMap.size()+1;
}
private void handleClassLiteral(polyglot.ast.ClassBody cBody){
ClassLiteralChecker classLitChecker = new ClassLiteralChecker();
cBody.visit(classLitChecker);
ArrayList classLitList = classLitChecker.getList();
//System.out.println("current class: "+sootClass);
//System.out.println("class lit list: "+classLitList);
String specialClassName = null;
if (!classLitList.isEmpty()) {
String methodName = "class$";
soot.Type methodRetType = soot.RefType.v("java.lang.Class");
ArrayList paramTypes = new ArrayList();
paramTypes.add(soot.RefType.v("java.lang.String"));
soot.SootMethod sootMethod = new soot.SootMethod(methodName, paramTypes, methodRetType, soot.Modifier.STATIC);
ClassLiteralMethodSource mSrc = new ClassLiteralMethodSource();
sootMethod.setSource(mSrc);
if (sootClass.isInterface()) {
// have to create a I$1 class
specialClassName = sootClass.getName()+"$"+getNextAnonNum();
addNameToAST(specialClassName);
soot.SootResolver.v().assertResolvedClass(specialClassName);
// add meth to newly created class not this current one
soot.SootClass specialClass = soot.Scene.v().getSootClass(specialClassName);
if (specialAnonMap == null){
specialAnonMap = new HashMap();
}
specialAnonMap.put(sootClass, specialClass);
if (!specialClass.declaresMethod(methodName, paramTypes, methodRetType)){
specialClass.addMethod(sootMethod);
}
}
else {
if (!sootClass.declaresMethod(methodName, paramTypes, methodRetType)){
sootClass.addMethod(sootMethod);
}
}
}
Iterator classLitIt = classLitList.iterator();
while (classLitIt.hasNext()) {
polyglot.ast.ClassLit classLit = (polyglot.ast.ClassLit)classLitIt.next();
//System.out.println("next class lit: "+classLit);
// field
String fieldName = "class$";
String type = Util.getSootType(classLit.typeNode().type()).toString();
type = soot.util.StringTools.replaceAll(type, ".", "$");
fieldName = fieldName+type;
soot.Type fieldType = soot.RefType.v("java.lang.Class");
soot.SootField sootField = new soot.SootField(fieldName, fieldType, soot.Modifier.STATIC);
if (sootClass.isInterface()){
soot.SootClass specialClass = soot.Scene.v().getSootClass(specialClassName);
//System.out.println("special class fields before: "+specialClass.getFields());
if (!specialClass.declaresField(fieldName, fieldType)){
specialClass.addField(sootField);
}
//System.out.println("special class fields after: "+specialClass.getFields());
}
else {
if (!sootClass.declaresField(fieldName, fieldType)){
sootClass.addField(sootField);
}
}
}
}
private void resolveAnonClass(polyglot.types.ClassType type){
NewFinder finder = new NewFinder();
finder.typeToFind(type);
astNode.visit(finder);
if (finder.newFound() == null){
throw new RuntimeException("Couldn't find New corresponding to the anon class type: "+type);
}
// maybe this anon has already been resolved
if (anonClassMap == null){
anonClassMap = new BiMap();
}
if (anonTypeMap == null){
anonTypeMap = new HashMap();
}
if (!anonClassMap.containsKey(finder.newFound())){
int nextAvailNum = 1;
polyglot.types.ClassType outerToMatch = type.outer();
while (outerToMatch.isNested()){
outerToMatch = outerToMatch.outer();
}
if (!anonTypeMap.isEmpty()){
Iterator matchIt = anonTypeMap.keySet().iterator();
while (matchIt.hasNext()){
polyglot.types.ClassType pType = (polyglot.types.ClassType)((polyglot.util.IdentityKey)matchIt.next()).object();
polyglot.types.ClassType outerMatch = pType.outer();
while (outerMatch.isNested()){
outerMatch = outerMatch.outer();
}
if (outerMatch.equals(outerToMatch)){
int numFound = getAnonClassNum((String)anonTypeMap.get(new polyglot.util.IdentityKey(pType)));
if (numFound >= nextAvailNum){
nextAvailNum = numFound+1;
}
}
}
}
String realName = outerToMatch.fullName()+"$"+nextAvailNum;
anonClassMap.put(finder.newFound(), realName);
anonTypeMap.put(new polyglot.util.IdentityKey(type), realName);
addNameToAST(realName);
soot.SootResolver.v().assertResolvedClass(realName);
}
}
private void resolveLocalClass(polyglot.types.ClassType type){
LocalClassDeclFinder finder = new LocalClassDeclFinder();
finder.typeToFind(type);
astNode.visit(finder);
if (finder.declFound() == null) {
throw new RuntimeException("Couldn't find LocalClassDecl corresponding to the local class type: "+type);
}
// maybe this localdecl has already been resolved
if (localClassMap == null){
localClassMap = new BiMap();
}
if (localTypeMap == null){
localTypeMap = new HashMap();
}
if (!localClassMap.containsKey(finder.declFound())){
int nextAvailNum = 1;
polyglot.types.ClassType outerToMatch = type.outer();
while (outerToMatch.isNested()){
outerToMatch = outerToMatch.outer();
}
if (!localTypeMap.isEmpty()){
Iterator matchIt = localTypeMap.keySet().iterator();
while (matchIt.hasNext()){
polyglot.types.ClassType pType = (polyglot.types.ClassType)((polyglot.util.IdentityKey)matchIt.next()).object();
polyglot.types.ClassType outerMatch = pType.outer();
while (outerMatch.isNested()){
outerMatch = outerMatch.outer();
}
if (outerMatch.equals(outerToMatch)){
int numFound = getLocalClassNum((String)localTypeMap.get(new polyglot.util.IdentityKey(pType)), finder.declFound().decl().name());
if (numFound >= nextAvailNum){
nextAvailNum = numFound+1;
}
}
}
}
String realName = outerToMatch.fullName()+"$"+nextAvailNum+finder.declFound().decl().name();
localClassMap.put(finder.declFound(), realName);
localTypeMap.put(new polyglot.util.IdentityKey(type), realName);
addNameToAST(realName);
soot.SootResolver.v().assertResolvedClass(realName);
}
}
private static final int NO_MATCH = 0;
private int getLocalClassNum(String realName, String simpleName){
// a local inner class is named outer$NsimpleName where outer
// is the very outer most class
//System.out.println("realName: "+realName);
//System.out.println("simpleName: "+simpleName);
int dIndex = realName.indexOf("$");
int nIndex = realName.indexOf(simpleName, dIndex);
//System.out.println("dIndex: "+dIndex+" nIndex: "+nIndex);
if (nIndex == -1) return NO_MATCH;
if (dIndex == -1) {
throw new RuntimeException("Matching an incorrectly named local inner class: "+realName);
}
return (new Integer(realName.substring(dIndex+1, nIndex))).intValue();
}
private int getAnonClassNum(String realName){
// a anon inner class is named outer$N where outer
// is the very outer most class
//System.out.println("realName: "+realName);
int dIndex = realName.indexOf("$");
if (dIndex == -1) {
throw new RuntimeException("Matching an incorrectly named anon inner class: "+realName);
}
return (new Integer(realName.substring(dIndex+1))).intValue();
}
/**
* returns the name of the class without the package part
*/
private String getSimpleClassName(){
String name = sootClass.getName();
if (sootClass.getPackageName() != null){
name = name.substring(name.lastIndexOf(".")+1, name.length());
}
return name;
}
/**
* Source Creation
*/
private void createSource(polyglot.ast.SourceFile source){
String simpleName = sootClass.getName();
Iterator declsIt = source.decls().iterator();
boolean found = false;
// first look in top-level decls
while (declsIt.hasNext()){
Object next = declsIt.next();
if (next instanceof polyglot.ast.ClassDecl) {
polyglot.types.ClassType nextType = ((polyglot.ast.ClassDecl)next).type();
if (Util.getSootType(nextType).equals(sootClass.getType())){
createClassDecl((polyglot.ast.ClassDecl)next);
found = true;
}
/*else {
// if not already there put cdecl name in class to source file map
// its actually a map from class names to the corresponding source file
if (((polyglot.ast.ClassDecl)next).type().isTopLevel() && !((polyglot.ast.ClassDecl)next).flags().isPublic()){
if (sootClass.getName().indexOf("$") == -1){
addToClassToSourceMap(((polyglot.ast.ClassDecl)next).type().fullName(), sootClass.getName());
}
}
}*/
}
}
// if the class wasn't a top level then its nested, local or anon
if (!found) {
NestedClassListBuilder nestedClassBuilder = new NestedClassListBuilder();
source.visit(nestedClassBuilder);
Iterator nestedDeclsIt = nestedClassBuilder.getClassDeclsList().iterator();
while (nestedDeclsIt.hasNext() && !found){
polyglot.ast.ClassDecl nextDecl = (polyglot.ast.ClassDecl)nestedDeclsIt.next();
polyglot.types.ClassType type = (polyglot.types.ClassType)nextDecl.type();
if (type.isLocal() && !type.isAnonymous()) {
if (localClassMap.containsVal(simpleName)){
createClassDecl(((polyglot.ast.LocalClassDecl)localClassMap.getKey(simpleName)).decl());
found = true;
}
}
else {
if (Util.getSootType(type).equals(sootClass.getType())){
createClassDecl(nextDecl);
found = true;
}
}
}
if (!found) {
// assume its anon class (only option left)
//
if ((anonClassMap != null) && anonClassMap.containsVal(simpleName)){
polyglot.ast.New aNew = (polyglot.ast.New)anonClassMap.getKey(simpleName);
createAnonClassDecl(aNew);
createClassBody(aNew.body());
handleFieldInits();
}
else {
// could be an anon class that was created out of thin air
// for handling class lits in interfaces
sootClass.setSuperclass(soot.Scene.v().getSootClass("java.lang.Object"));
}
}
}
}
/**
* ClassToSourceMap is for classes whos names don't match the source file
* name - ex: multiple top level classes in a single file
*/
private void addToClassToSourceMap(String className, String sourceName) {
if (classToSourceMap == null){
classToSourceMap = new HashMap();
}
classToSourceMap.put(className, sourceName);
/*if (sourceToClassMap == null) {
sourceToClassMap = new HashMap();
}
if (soot.SourceLocator.v().getSourceToClassMap() == null) {
soot.SourceLocator.v().setSourceToClassMap(sourceToClassMap);
}
if (!soot.SourceLocator.v().getSourceToClassMap().containsKey(className)) {
System.out.println("adding to source to class map class: "+className+" src: "+sourceName);
soot.SourceLocator.v().addToSourceToClassMap(className, sourceName);
}*/
}
/**
* creates the Jimple for an anon class - in the AST there is no class
* decl for anon classes - the revelant fields and methods are
* created
*/
private void createAnonClassDecl(polyglot.ast.New aNew) {
//System.out.println("creating anonn class decl: "+Util.getSootType(aNew.anonType()));
soot.SootClass typeClass = ((soot.RefType)Util.getSootType(aNew.objectType().type())).getSootClass();
// set superclass
if (((polyglot.types.ClassType)aNew.objectType().type()).flags().isInterface()){
//if (typeClass.isInterface()){
sootClass.addInterface(typeClass);
sootClass.setSuperclass(soot.Scene.v().getSootClass("java.lang.Object"));
}
else {
sootClass.setSuperclass(typeClass);
}
// needs to be done for local also
ArrayList params = new ArrayList();
soot.SootMethod method;
// if interface there are no extra params
if (((polyglot.types.ClassType)aNew.objectType().type()).flags().isInterface()){
//if (typeClass.isInterface()){
method = new soot.SootMethod("<init>", params, soot.VoidType.v());
}
else {
Iterator aIt = aNew.arguments().iterator();
while (aIt.hasNext()){
polyglot.types.Type pType = ((polyglot.ast.Expr)aIt.next()).type();
params.add(Util.getSootType(pType));
}
method = new soot.SootMethod("<init>", params, soot.VoidType.v());
}
AnonClassInitMethodSource src = new AnonClassInitMethodSource();
method.setSource(src);
sootClass.addMethod(method);
AnonLocalClassInfo info = (AnonLocalClassInfo)finalLocalInfo.get(new polyglot.util.IdentityKey(aNew.anonType()));
//System.out.println("new : "+aNew);
if (!info.inStaticMethod()){
addOuterClassThisRefToInit(aNew.anonType().outer());
addOuterClassThisRefField(aNew.anonType().outer());
src.thisOuterType(Util.getSootType(aNew.anonType().outer()));
}
else if (aNew.qualifier() != null) {
// add outer class ref
addOuterClassThisRefToInit(aNew.qualifier().type());
addOuterClassThisRefField(aNew.qualifier().type());
src.thisOuterType(Util.getSootType(aNew.qualifier().type()));
}
src.inStaticMethod(info.inStaticMethod());
//System.out.println("creating anon info: "+info);
if (info != null){
//System.out.println("want to add finals for : "+Util.getSootType(aNew.anonType()));
src.setFinalsList(addFinalLocals(aNew.body(), info.finalLocals(), (polyglot.types.ClassType)aNew.anonType(), info));
}
src.outerClassType(Util.getSootType(aNew.anonType().outer()));
if (((polyglot.types.ClassType)aNew.objectType().type()).isNested()){
src.superOuterType(Util.getSootType(((polyglot.types.ClassType)aNew.objectType().type()).outer()));
src.isSubType(Util.isSubType(aNew.anonType().outer(), ((polyglot.types.ClassType)aNew.objectType().type()).outer()));
}
}
private ArrayList addFinalLocals(polyglot.ast.ClassBody cBody, ArrayList finalLocals, polyglot.types.ClassType nodeKeyType, AnonLocalClassInfo info){
ArrayList finalFields = new ArrayList();
LocalUsesChecker luc = new LocalUsesChecker();
cBody.visit(luc);
Iterator localsNeededIt = luc.getLocals().iterator();
//System.out.println("locals Needed: "+luc.getLocals());
//System.out.println("locals avail: "+finalLocals);
ArrayList localsUsed = new ArrayList();
while (localsNeededIt.hasNext()){
polyglot.types.LocalInstance li = (polyglot.types.LocalInstance)((polyglot.util.IdentityKey)localsNeededIt.next()).object();
if (finalLocals.contains(new polyglot.util.IdentityKey(li))){
// add as param for init
Iterator it = sootClass.getMethods().iterator();
while (it.hasNext()){
soot.SootMethod meth = (soot.SootMethod)it.next();
if (meth.getName().equals("<init>")){
meth.getParameterTypes().add(Util.getSootType(li.type()));
}
}
// add field
soot.SootField sf = new soot.SootField("val$"+li.name(), Util.getSootType(li.type()), soot.Modifier.FINAL | soot.Modifier.PRIVATE);
sootClass.addField(sf);
finalFields.add(sf);
//System.out.println("added field: "+sf.getName()+" to class: "+sootClass.getName());
localsUsed.add(new polyglot.util.IdentityKey(li));
}
}
//System.out.println("locals Used: "+localsUsed);
info.finalLocals(localsUsed);
finalLocalInfo.put(new polyglot.util.IdentityKey(nodeKeyType), info);
return finalFields;
}
/**
* Class Declaration Creation
*/
private void createClassDecl(polyglot.ast.ClassDecl cDecl){
// modifiers
polyglot.types.Flags flags = cDecl.flags();
addModifiers(flags, cDecl);
// super class
if (cDecl.superClass() == null) {
soot.SootClass superClass = soot.Scene.v().getSootClass ("java.lang.Object");
sootClass.setSuperclass(superClass);
}
else {
sootClass.setSuperclass(((soot.RefType)Util.getSootType(cDecl.superClass().type())).getSootClass());
}
// implements
Iterator interfacesIt = cDecl.interfaces().iterator();
while (interfacesIt.hasNext()) {
polyglot.ast.TypeNode next = (polyglot.ast.TypeNode)interfacesIt.next();
//sootClass.addInterface(soot.Scene.v().getSootClass(next.toString()));
sootClass.addInterface(((soot.RefType)Util.getSootType(next.type())).getSootClass());
}
currentClassDeclPos = cDecl.position();
createClassBody(cDecl.body());
// handle initialization of fields
// static fields init in clinit
// other fields init in init
handleFieldInits();
if ((staticFieldInits != null) || (staticInitializerBlocks != null)) {
soot.SootMethod clinitMethod;
if (!sootClass.declaresMethod("<clinit>", new ArrayList(), soot.VoidType.v())) {
clinitMethod = new soot.SootMethod("<clinit>", new ArrayList(), soot.VoidType.v(), soot.Modifier.STATIC, new ArrayList());
sootClass.addMethod(clinitMethod);
clinitMethod.setSource(new soot.javaToJimple.PolyglotMethodSource());
}
else {
clinitMethod = sootClass.getMethod("<clinit>", new ArrayList(), soot.VoidType.v());
}
((PolyglotMethodSource)clinitMethod.getSource()).setStaticFieldInits(staticFieldInits);
((PolyglotMethodSource)clinitMethod.getSource()).setStaticInitializerBlocks(staticInitializerBlocks);
/*Iterator it = sootClass.getMethods().iterator();
while (it.hasNext()){
((PolyglotMethodSource)((soot.SootMethod)it.next()).getSource()).setStaticFieldInits(staticFieldInits);
}*/
}
// add final locals to local inner classes inits
if (cDecl.type().isLocal()) {
//System.out.println("finalLocalInfo: "+finalLocalInfo);
AnonLocalClassInfo info = (AnonLocalClassInfo)finalLocalInfo.get(new polyglot.util.IdentityKey(cDecl.type()));
ArrayList finalsList = addFinalLocals(cDecl.body(), info.finalLocals(), cDecl.type(), info);
Iterator it = sootClass.getMethods().iterator();
while (it.hasNext()){
soot.SootMethod meth = (soot.SootMethod)it.next();
if (meth.getName().equals("<init>")){
((PolyglotMethodSource)meth.getSource()).setFinalsList(finalsList);
}
}
if (!info.inStaticMethod()){
polyglot.types.ClassType outerType = cDecl.type().outer();
addOuterClassThisRefToInit(outerType);
addOuterClassThisRefField(outerType);
}
}
// add outer class ref to constructors of inner classes
// and out class field ref (only for non-static inner classes
else if (cDecl.type().isNested() && !cDecl.flags().isStatic()) {
polyglot.types.ClassType outerType = cDecl.type().outer();
addOuterClassThisRefToInit(outerType);
addOuterClassThisRefField(outerType);
}
Util.addLineTag(sootClass, cDecl);
}
private void handleFieldInits(){
//System.out.println("field inits: "+fieldInits+" for class: "+sootClass);
if ((fieldInits != null) || (initializerBlocks != null)) {
Iterator methodsIt = sootClass.getMethods().iterator();
while (methodsIt.hasNext()) {
soot.SootMethod next = (soot.SootMethod)methodsIt.next();
if (next.getName().equals("<init>")){
//if (next.getSource() instanceof soot.javaToJimple.PolyglotMethodSource){
//System.out.println("setting fieldInits: "+fieldInits+" for meth: "+next);
soot.javaToJimple.PolyglotMethodSource src = (soot.javaToJimple.PolyglotMethodSource)next.getSource();
src.setInitializerBlocks(initializerBlocks);
src.setFieldInits(fieldInits);
//}
/*else if (next.getSource() instanceof soot.javaToJimple.AnonClassInitMethodSource){
soot.javaToJimple.AnonClassInitMethodSource src = (soot.javaToJimple.AnonClassInitMethodSource)next.getSource();
src.initBlocks(initializerBlocks);
src.fieldInits(fieldInits);
}*/
}
}
}
}
private void addOuterClassThisRefToInit(polyglot.types.Type outerType){
soot.Type outerSootType = Util.getSootType(outerType);
Iterator it = sootClass.getMethods().iterator();
while (it.hasNext()){
soot.SootMethod meth = (soot.SootMethod)it.next();
if (meth.getName().equals("<init>")){
meth.getParameterTypes().add(0, outerSootType);
if (hasOuterRefInInit == null){
hasOuterRefInInit = new ArrayList();
}
//System.out.println("actually adding outer class this to init for: "+meth.getDeclaringClass().getType());
//System.out.println("methods: "+meth.getDeclaringClass().getMethods());
hasOuterRefInInit.add(meth.getDeclaringClass().getType());
}
}
}
private void addOuterClassThisRefField(polyglot.types.Type outerType){
soot.Type outerSootType = Util.getSootType(outerType);
soot.SootField field = new soot.SootField("this$0", outerSootType, soot.Modifier.PRIVATE | soot.Modifier.FINAL);
sootClass.addField(field);
}
/**
* adds modifiers
*/
private void addModifiers(polyglot.types.Flags flags, polyglot.ast.ClassDecl cDecl){
int modifiers = 0;
if (cDecl.type().isNested()){
if (flags.isPublic() || flags.isProtected() || flags.isPrivate()){
modifiers = soot.Modifier.PUBLIC;
}
if (flags.isInterface()){
modifiers = modifiers | soot.Modifier.INTERFACE;
}
// if inner classes are declared in an interface they need to be
// given public access but I have no idea why
if (cDecl.type().outer().flags().isInterface()){
modifiers = soot.Modifier.PUBLIC;
}
}
else {
modifiers = Util.getModifier(flags);
}
sootClass.setModifiers(modifiers);
}
/**
* Class Body Creation
*/
private void createClassBody(polyglot.ast.ClassBody classBody){
// reinit static lists
staticFieldInits = null;
fieldInits = null;
initializerBlocks = null;
staticInitializerBlocks = null;
handleClassLiteral(classBody);
handleAssert(classBody);
// handle members
Iterator it = classBody.members().iterator();
while (it.hasNext()){
Object next = it.next();
if (next instanceof polyglot.ast.MethodDecl) {
createMethodDecl((polyglot.ast.MethodDecl)next);
}
else if (next instanceof polyglot.ast.FieldDecl) {
createFieldDecl((polyglot.ast.FieldDecl)next);
}
else if (next instanceof polyglot.ast.ConstructorDecl){
createConstructorDecl((polyglot.ast.ConstructorDecl)next);
}
else if (next instanceof polyglot.ast.ClassDecl){
}
else if (next instanceof polyglot.ast.Initializer) {
createInitializer((polyglot.ast.Initializer)next);
}
else {
throw new RuntimeException("Class Body Member not implemented");
}
}
handlePrivateAccessors(classBody);
}
/**
* inner classes can access private fields and methods of the
* outer class and special methods are created in order
* to make this possible
*/
private void handlePrivateAccessors(polyglot.ast.ClassBody cBody) {
// determine and create acces methods for used private access
// in inner classes
ArrayList privateAccessList = new ArrayList();
ArrayList uses = new ArrayList();
// look through body for private field and procedure decls
PrivateInstancesAvailable privateInsts = new PrivateInstancesAvailable();
cBody.visit(privateInsts);
// look through body again for all inner class bodies
InnerClassBodies icb = new InnerClassBodies();
cBody.visit(icb);
// look through each body and see if they use a private instance
Iterator cbIt = icb.getList().iterator();
while (cbIt.hasNext()){
polyglot.ast.ClassBody cb = (polyglot.ast.ClassBody)cbIt.next();
PrivateAccessUses pau = new PrivateAccessUses();
pau.avail(privateInsts.getList());
cb.visit(pau);
uses.addAll(pau.getList());
}
Iterator listIt = uses.iterator();
while (listIt.hasNext()) {
Object nextInst = ((polyglot.util.IdentityKey)listIt.next()).object();
if (nextInst instanceof polyglot.types.FieldInstance) {
if (Util.getSootType(((polyglot.types.FieldInstance)nextInst).container()).equals(sootClass.getType())){
privateAccessList.add(nextInst);
}
}
if (nextInst instanceof polyglot.types.MethodInstance) {
if (Util.getSootType(((polyglot.types.MethodInstance)nextInst).container()).equals(sootClass.getType())){
privateAccessList.add(nextInst);
}
}
}
Iterator it = privateAccessList.iterator();
while (it.hasNext()) {
polyglot.types.MemberInstance inst = (polyglot.types.MemberInstance)it.next();
String name = "access$"+privateAccessCounter+"00";
ArrayList paramTypesList = new ArrayList();
if (inst instanceof polyglot.types.MethodInstance) {
Iterator paramsIt = ((polyglot.types.MethodInstance)inst).formalTypes().iterator();
while (paramsIt.hasNext()) {
paramTypesList.add(Util.getSootType((polyglot.types.Type)paramsIt.next()));
}
}
if (!inst.flags().isStatic()) {
paramTypesList.add(sootClass.getType());
}
soot.Type returnType = null;
if (inst instanceof polyglot.types.MethodInstance) {
returnType = Util.getSootType(((polyglot.types.MethodInstance)inst).returnType());
}
else {
returnType = Util.getSootType(((polyglot.types.FieldInstance)inst).type());
}
soot.SootMethod accessMeth = new soot.SootMethod(name, paramTypesList, returnType, soot.Modifier.STATIC);
if (inst instanceof polyglot.types.MethodInstance) {
PrivateMethodAccMethodSource pmams = new PrivateMethodAccMethodSource();
pmams.setMethodInst((polyglot.types.MethodInstance)inst);
/*ArrayList formalTypes = new ArrayList();
Iterator fIt = ((polyglot.types.MethodInstance)inst).formalTypes().iterator();
while (fIt.hasNext()){
formalTypes.add(Util.getSootType((polyglot.types.Type)fIt.next()));
}
pmams.formalTypes(formalTypes);
pmams.returnType(Util.getSootType(((polyglot.types.MethodInstance)inst).returnType()));
pmams.name(((polyglot.types.MethodInstance)inst).name());
pmams.flags(Util.getModifier(((polyglot.types.MethodInstance)inst).flags()));*/
accessMeth.setSource(pmams);
}
else {
PrivateFieldAccMethodSource pfams = new PrivateFieldAccMethodSource();
pfams.fieldName(((polyglot.types.FieldInstance)inst).name());
pfams.fieldType(Util.getSootType(((polyglot.types.FieldInstance)inst).type()));
pfams.classToInvoke(((soot.RefType)Util.getSootType(((polyglot.types.FieldInstance)inst).container())).getSootClass());
accessMeth.setSource(pfams);
}
sootClass.addMethod(accessMeth);
if (privateAccessMap == null){
privateAccessMap = new HashMap();
}
privateAccessMap.put(inst, accessMeth);
privateAccessCounter++;
}
}
/**
* Procedure Declaration Helper Methods
* creates procedure name
*/
private String createName(polyglot.ast.ProcedureDecl procedure) {
return procedure.name();
}
/**
* creates soot params from polyglot formals
*/
private ArrayList createParameters(polyglot.ast.ProcedureDecl procedure) {
ArrayList parameters = new ArrayList();
Iterator formalsIt = procedure.formals().iterator();
while (formalsIt.hasNext()){
polyglot.ast.Formal next = (polyglot.ast.Formal)formalsIt.next();
parameters.add(Util.getSootType(next.type().type()));
}
return parameters;
}
/**
* creates soot exceptions from polyglot throws
*/
private ArrayList createExceptions(polyglot.ast.ProcedureDecl procedure) {
ArrayList exceptions = new ArrayList();
Iterator throwsIt = procedure.throwTypes().iterator();
while (throwsIt.hasNext()){
polyglot.types.Type throwType = ((polyglot.ast.TypeNode)throwsIt.next()).type();
exceptions.add(((soot.RefType)Util.getSootType(throwType)).getSootClass());
}
return exceptions;
}
/**
* looks after pos tags for methods and constructors
*/
private void finishProcedure(polyglot.ast.ProcedureDecl procedure, soot.SootMethod sootMethod){
addProcedureToClass(sootMethod);
if (procedure.position() != null){
if (procedure.body() != null) {
if (procedure.body().position() != null) {
Util.addLnPosTags(sootMethod, procedure.position().line(), procedure.body().position().endLine(), procedure.position().column(), procedure.body().position().endColumn());
}
}
}
//handle final local map for local and anon classes
handleFinalLocals(procedure);
/*MethodFinalsChecker mfc = new MethodFinalsChecker();
procedure.visit(mfc);
AnonLocalClassInfo alci = new AnonLocalClassInfo();
if (mem instanceof polyglot.ast.ProcedureDecl){
polyglot.ast.ProcedureDecl procedure = (polyglot.ast.ProcedureDecl)mem;
alci.finalLocals(getFinalLocalsAvail(procedure));
if (procedure.flags().isStatic()){
alci.inStaticMethod(true);
}
}
//System.out.println("alci creation: "+mfc.finalLocals());
//if (soot.Modifier.isStatic(sootMethod.getModifiers())){
if (
if (memsoot.Modifier.isStatic(sootMethod.getModifiers())){
alci.inStaticMethod(true);
}
if (finalLocalInfo == null){
finalLocalInfo = new HashMap();
}
Iterator it = mfc.inners().iterator();
while (it.hasNext()){
AnonLocalClassInfo info = new AnonLocalClassInfo();
info.inStaticMethod(alci.inStaticMethod());
info.finalLocals(alci.finalLocals());
finalLocalInfo.put(it.next(), info);
}*/
//System.out.println("finalLocalInfo: "+finalLocalInfo);
PolyglotMethodSource mSrc = new PolyglotMethodSource(procedure.body(), procedure.formals());
mSrc.setPrivateAccessMap(privateAccessMap);
sootMethod.setSource(mSrc);
}
private void handleFinalLocals(polyglot.ast.ClassMember member){
MethodFinalsChecker mfc = new MethodFinalsChecker();
member.visit(mfc);
AnonLocalClassInfo alci = new AnonLocalClassInfo();
//System.out.println("member: "+member+" alci creation: "+mfc.finalLocals());
if (member instanceof polyglot.ast.ProcedureDecl){
polyglot.ast.ProcedureDecl procedure = (polyglot.ast.ProcedureDecl)member;
//alci.finalLocals(getFinalLocalsAvail(procedure));
// not sure if this will break deep nesting
alci.finalLocals(mfc.finalLocals());
//System.out.println("meth: "+procedure.name()+" staticness: "+procedure.flags().isStatic());
if (procedure.flags().isStatic()){
alci.inStaticMethod(true);
//System.out.println("method is static");
}
}
else if (member instanceof polyglot.ast.FieldDecl){
alci.finalLocals(new ArrayList());
//System.out.println("field: "+member);
if (((polyglot.ast.FieldDecl)member).flags().isStatic()){
alci.inStaticMethod(true);
}
}
else if (member instanceof polyglot.ast.Initializer){
// for now don't make final locals avail in init blocks
// need to test this
//System.out.println("static: "+member);
//alci.finalLocals(getFinalLocalsAvail(member));
//
alci.finalLocals(mfc.finalLocals());
//System.out.println("meth: "+procedure.name()+" staticness: "+procedure.flags().isStatic());
if (((polyglot.ast.Initializer)member).flags().isStatic()){
alci.inStaticMethod(true);
}
}
if (finalLocalInfo == null){
finalLocalInfo = new HashMap();
}
Iterator it = mfc.inners().iterator();
while (it.hasNext()){
polyglot.types.ClassType cType = (polyglot.types.ClassType)((polyglot.util.IdentityKey)it.next()).object();
//System.out.println("alci for type: "+Util.getSootType(cType));
AnonLocalClassInfo info = new AnonLocalClassInfo();
//System.out.println("adding alci.inStaticMethod(): "+alci.inStaticMethod());
//System.out.println("anon type map: "+anonTypeMap);
info.inStaticMethod(alci.inStaticMethod());
info.finalLocals(alci.finalLocals());
//System.out.println("info on add to map: "+info);
finalLocalInfo.put(new polyglot.util.IdentityKey(cType), info);
}
}
private ArrayList getFinalLocalsAvail(polyglot.ast.ClassMember member){
ArrayList finalsAvail = new ArrayList();
if (member instanceof polyglot.ast.ProcedureDecl){
polyglot.ast.ProcedureDecl proc = (polyglot.ast.ProcedureDecl)member;
if (proc.formals() != null){
Iterator formalsIt = proc.formals().iterator();
while (formalsIt.hasNext()){
polyglot.ast.Formal formal = (polyglot.ast.Formal)formalsIt.next();
if (formal.localInstance().flags().isFinal()){
finalsAvail.add(new polyglot.util.IdentityKey(formal.localInstance()));
}
}
}
}
polyglot.ast.Block fBody;
if (member instanceof polyglot.ast.ProcedureDecl){
polyglot.ast.ProcedureDecl proc = (polyglot.ast.ProcedureDecl)member;
fBody = proc.body();
}
else if (member instanceof polyglot.ast.Initializer){
polyglot.ast.Initializer initializer = (polyglot.ast.Initializer)member;
fBody = initializer.body();
}
else {
throw new RuntimeException("Only handle final locals for procedures and initializers!");
}
if ((fBody != null) && (fBody.statements() != null)){
Iterator stmtsIt = fBody.statements().iterator();
while (stmtsIt.hasNext()){
Object next = stmtsIt.next();
if (next instanceof polyglot.ast.LocalDecl){
polyglot.ast.LocalDecl decl = (polyglot.ast.LocalDecl)next;
if (decl.localInstance().flags().isFinal()){
finalsAvail.add(new polyglot.util.IdentityKey(decl.localInstance()));
}
}
}
}
return finalsAvail;
}
private void addProcedureToClass(soot.SootMethod method) {
sootClass.addMethod(method);
}
/**
* Method Declaration Creation
*/
private void createMethodDecl(polyglot.ast.MethodDecl method) {
String name = createName(method);
// parameters
ArrayList parameters = createParameters(method);
// exceptions
ArrayList exceptions = createExceptions(method);
soot.SootMethod sootMethod = createSootMethod(name, method.flags(), method.returnType().type(), parameters, exceptions);
finishProcedure(method, sootMethod);
}
private soot.SootMethod createSootMethod(String name, polyglot.types.Flags flags , polyglot.types.Type returnType, ArrayList parameters, ArrayList exceptions){
int modifier = Util.getModifier(flags);
soot.Type sootReturnType = Util.getSootType(returnType);
soot.SootMethod method = new soot.SootMethod(name, parameters, sootReturnType, modifier, exceptions);
return method;
}
/**
* Field Declaration Creation
*/
private void createFieldDecl(polyglot.ast.FieldDecl field){
int modifiers = Util.getModifier(field.fieldInstance().flags());
String name = field.fieldInstance().name();
soot.Type sootType = Util.getSootType(field.fieldInstance().type());
soot.SootField sootField = new soot.SootField(name, sootType, modifiers);
//System.out.println("adding field: "+name+" to class: "+sootClass);
sootClass.addField(sootField);
if (fieldMap == null) {
fieldMap = new HashMap();
}
fieldMap.put(field.fieldInstance(), sootField);
if (field.fieldInstance().flags().isStatic()) {
if (field.init() != null) {
if (staticFieldInits == null) {
staticFieldInits = new ArrayList();
}
staticFieldInits.add(field);
}
}
else {
if (field.init() != null) {
if (fieldInits == null) {
fieldInits = new ArrayList();
}
fieldInits.add(field);
}
}
handleFinalLocals(field);
Util.addLnPosTags(sootField, field.position());
}
/**
* Initializer Creation
*/
private void createInitializer(polyglot.ast.Initializer initializer) {
if (initializer.flags().isStatic()) {
if (staticInitializerBlocks == null) {
staticInitializerBlocks = new ArrayList();
}
staticInitializerBlocks.add(initializer.body());
}
else {
if (initializerBlocks == null) {
initializerBlocks = new ArrayList();
}
initializerBlocks.add(initializer.body());
}
handleFinalLocals(initializer);
}
/**
* Constructor Declaration Creation
*/
private void createConstructorDecl(polyglot.ast.ConstructorDecl constructor){
String name = "<init>";
ArrayList parameters = createParameters(constructor);
ArrayList exceptions = createExceptions(constructor);
soot.SootMethod sootMethod = createSootConstructor(name, constructor.flags(), parameters, exceptions);
finishProcedure(constructor, sootMethod);
}
private soot.SootMethod createSootConstructor(String name, polyglot.types.Flags flags, ArrayList parameters, ArrayList exceptions) {
int modifier = Util.getModifier(flags);
soot.SootMethod method = new soot.SootMethod(name, parameters, soot.VoidType.v(), modifier);
return method;
}
public BiMap getAnonClassMap(){
return anonClassMap;
}
public BiMap getLocalClassMap(){
return localClassMap;
}
public HashMap getAnonTypeMap(){
return anonTypeMap;
}
public HashMap getLocalTypeMap(){
return localTypeMap;
}
public HashMap finalLocalInfo(){
return finalLocalInfo;
}
public int getNextPrivateAccessCounter(){
int res = privateAccessCounter;
privateAccessCounter++;
return res;
}
public ArrayList getHasOuterRefInInit(){
return hasOuterRefInInit;
}
public HashMap specialAnonMap(){
return specialAnonMap;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
95606f2a512fb09bbceb7996698ae87e63963550 | 9f9fbb72b655e064de2e14b1a8c5c5288f4434ac | /src/cn/com/linkwide/cont/condemage/controller/ConDemageReceivController.java | 321fcbea6e226d08d8f5d80bca041333cbb5ed79 | [] | no_license | kmmao/jeecg | f69d1cdb68e05a2aacf367fd19d590dd1008bcea | 15081d9f91075afeafbe0ace770669caf2669711 | refs/heads/master | 2022-01-21T17:35:43.898731 | 2019-07-22T08:17:11 | 2019-07-22T08:17:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,572 | java | package cn.com.linkwide.cont.condemage.controller;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolation;
import javax.validation.Validator;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.jeecgframework.core.beanvalidator.BeanValidators;
import org.jeecgframework.core.common.controller.BaseController;
import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.constant.Globals;
import org.jeecgframework.core.util.ExceptionUtil;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.jwt.util.ResponseMessage;
import org.jeecgframework.jwt.util.Result;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.web.system.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.util.UriComponentsBuilder;
import com.alibaba.fastjson.JSONArray;
import cn.com.linkwide.cont.condemage.entity.ConDemageEntity;
import cn.com.linkwide.cont.condemage.service.ConDemageServiceI;
import cn.com.linkwide.cont.coninformation.entity.ConInformationEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
/**
* @Title: Controller
* @Description: 合同索赔
* @author onlineGenerator
* @date 2018-08-28 10:54:37
* @version V1.0
*
*/
@Api(value="ConDemage",description="合同索赔",tags="conDemageReceivController")
@Controller
@RequestMapping("/conDemageReceivController")
public class ConDemageReceivController extends BaseController {
/**
* Logger for this class
*/
private static final Logger logger = Logger.getLogger(ConDemageController.class);
@Autowired
private ConDemageServiceI conDemageService;
@Autowired
private SystemService systemService;
@Autowired
private Validator validator;
/**
* 合同索赔列表 页面跳转
*
* @return
*/
@RequestMapping(params = "list")
public ModelAndView list(HttpServletRequest request) {
return new ModelAndView("cn/com/linkwide/cont/receivescont/condemage/conDemageList");
}
/**
* easyui AJAX请求数据
*
* @param request
* @param response
* @param dataGrid
* @param user
*/
@RequestMapping(params = "datagrid")
public void datagrid(ConDemageEntity conDemage, HttpServletRequest request, HttpServletResponse response,
DataGrid dataGrid) {
try {
String conNumber = request.getParameter("conNo");
String conName = request.getParameter("conName");
String money_begin =request.getParameter("money_begin");
String money_end =request.getParameter("money_end");
// 自定义追加查询条件
String query1 = "select a.id as id,b.id as ids,b.con_number as conNumber,b.con_no as conNo,b.con_name as conName,b.other_compy as otherCompy,"
+ "b.con_exec1 as conExec1,a.money as money, b.defout_case as defoutCase"
+ ",b.defout_date as defoutDate,b.start_date as startDate,b.end_date as endDate,a.demage_bz as demageBz";
StringBuffer sql = new StringBuffer();
sql.append(" from con_demage a LEFT JOIN con_information b on a.con_id=b.id ");
sql.append(" where 1=1 and b.is_defout='1' and b.con_type='03' ");
sql.append(" and b.create_by='"+ResourceUtil.getSessionUser().getUserName()+"' ");
String orderStr = "";
if (StringUtil.isNotEmpty(dataGrid.getSort())) {
orderStr = " order by " + dataGrid.getSort() + " " + dataGrid.getOrder();
}
if (StringUtil.isNotEmpty(conNumber)) {
sql.append(" and b.con_number like '%" + conNumber + "%' ");
}
if (StringUtil.isNotEmpty(conName)) {
sql.append(" and b.con_name like '%" + conName + "%' ");
}
if(StringUtil.isNotEmpty(money_begin)){
sql.append(" and a.money>="+money_begin);
}
if(StringUtil.isNotEmpty(money_end)){
sql.append(" and a.money<="+money_end);
}
List<Map<String, Object>> list = systemService.findForJdbc(query1 + sql.toString() + orderStr,
dataGrid.getPage(), dataGrid.getRows());
dataGrid.setResults(list);
List<Map<String, Object>> lisCount = systemService
.findForJdbc("select count(*) as count " + sql.toString(), null);
for (Map<String, Object> map : lisCount) {
dataGrid.setTotal(Integer.valueOf(map.get("count").toString()));
}
} catch (Exception e) {
throw new BusinessException(e.getMessage());
}
TagUtil.datagrid(response, dataGrid);
}
/**
* easyui AJAX请求数据
*
* @param request
* @param response
* @param dataGrid
* @param user
*//*
@RequestMapping(params = "datagrid")
public void datagrid(ConDemageEntity conDemage,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(ConDemageEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, conDemage, request.getParameterMap());
try{
//自定义追加查询条件
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
this.conDemageService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
}
*/
/**
* 删除合同索赔
*
* @return
*/
@RequestMapping(params = "doDel")
@ResponseBody
public AjaxJson doDel(ConDemageEntity conDemage, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
conDemage = systemService.getEntity(ConDemageEntity.class, conDemage.getId());
message = "合同索赔删除成功";
try{
conDemageService.delete(conDemage);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "合同索赔删除失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
* 批量删除合同索赔
*
* @return
*/
@RequestMapping(params = "doBatchDel")
@ResponseBody
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
String message = null;
AjaxJson j = new AjaxJson();
message = "合同索赔删除成功";
try{
for(String id:ids.split(",")){
ConDemageEntity conDemage = systemService.getEntity(ConDemageEntity.class,
id
);
conDemageService.delete(conDemage);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}
}catch(Exception e){
e.printStackTrace();
message = "合同索赔删除失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
* 添加合同索赔
*
* @param ids
* @return
*/
@RequestMapping(params = "doAdd")
@ResponseBody
public AjaxJson doAdd(ConDemageEntity conDemage, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "合同索赔添加成功";
try{
conDemageService.save(conDemage);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "合同索赔添加失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
* 更新合同索赔
*
* @param ids
* @return
*/
@RequestMapping(params = "doUpdate")
@ResponseBody
public AjaxJson doUpdate(ConDemageEntity conDemage, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "合同索赔更新成功";
ConDemageEntity t = conDemageService.get(ConDemageEntity.class, conDemage.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(conDemage, t);
conDemageService.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
message = "合同索赔更新失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
* 合同索赔跳转页面
*
* @return
*/
@RequestMapping(params = "confirmNum")
public ModelAndView confirmNum(ConDemageEntity conDemage, HttpServletRequest req) {
if (StringUtil.isNotEmpty(conDemage.getId())) {
conDemage = conDemageService.getEntity(ConDemageEntity.class, conDemage.getId());
req.setAttribute("conDemagePage", conDemage);
conDemage.setDemageDate(new Date(System.currentTimeMillis()));
}
return new ModelAndView("cn/com/linkwide/cont/receivescont/condemage/condemage-suoPei");
}
/**
* 合同违约原因变更
*
* @return
*/
@RequestMapping(params = "gochecked")
public ModelAndView gochecked(ConInformationEntity conInformation, HttpServletRequest req) {
conInformation = conDemageService.getEntity(ConInformationEntity.class, req.getParameter("id"));
req.setAttribute("conInformationPage", conInformation);
return new ModelAndView("cn/com/linkwide/cont/receivescont/condemage/condemage-change");
}
/**
* 合同索赔
*
* @return
*/
@RequestMapping(params = "dochecked")
@ResponseBody
public AjaxJson dochecked(ConInformationEntity conInformation, HttpServletRequest request) {
String message="";
AjaxJson j = new AjaxJson();
try{
ConInformationEntity conInformationr = conDemageService.getEntity(ConInformationEntity.class, conInformation.getId());
conInformationr.setDefoutCase(conInformation.getDefoutCase());
message = "合同违约原因变更成功";
MyBeanUtils.copyBean2Bean(conInformation, conInformationr);
conDemageService.updateEntitie(conInformationr);
}catch(Exception e){
e.printStackTrace();
message = "合同违约原因变更失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
* 合同索赔
*
* @return
*/
@RequestMapping(params = "doSuoPei")
@ResponseBody
public AjaxJson doSuoPei(ConDemageEntity conDemage, HttpServletRequest request) {
String message="";
AjaxJson j = new AjaxJson();
try{
ConDemageEntity ConDema = conDemageService.getEntity(ConDemageEntity.class, conDemage.getId());
ConDema.setMoney(conDemage.getMoney());
ConDema.setDemageBz(conDemage.getDemageBz());
ConDema.setDemageDate(conDemage.getDemageDate());
message = "索赔成功";
MyBeanUtils.copyBean2Bean(conDemage, ConDema);
conDemageService.updateEntitie(ConDema);
/*//在索赔业务表中新增违约的合同
ConDemageEntity conDemageEntity=new ConDemageEntity();
conDemageEntity.setConId(conInformation.getId());
systemService.save(conDemageEntity);*/
// systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "合同索赔失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
* 合同索赔新增页面跳转
*
* @return
*/
@RequestMapping(params = "goAdd")
public ModelAndView goAdd(ConDemageEntity conDemage, HttpServletRequest req) {
if (StringUtil.isNotEmpty(conDemage.getId())) {
conDemage = conDemageService.getEntity(ConDemageEntity.class, conDemage.getId());
req.setAttribute("conDemagePage", conDemage);
}
return new ModelAndView("cn/com/linkwide/cont/receivescont/condemage/conDemage-add");
}
/**
* 合同索赔编辑页面跳转
*
* @return
*/
@RequestMapping(params = "goUpdate")
public ModelAndView goUpdate(ConDemageEntity conDemage, HttpServletRequest req) {
if (StringUtil.isNotEmpty(conDemage.getId())) {
String id=req.getParameter("conId");
ConInformationEntity conInformation = systemService.getEntity(ConInformationEntity.class, id);
req.setAttribute("conInformationPage", conInformation);
}
return new ModelAndView("cn/com/linkwide/cont/receivescont/coninformation/conInformation-update");
}
/**
* 导入功能跳转
*
* @return
*/
@RequestMapping(params = "upload")
public ModelAndView upload(HttpServletRequest req) {
req.setAttribute("controller_name","conDemageController");
return new ModelAndView("common/upload/pub_excel_upload");
}
/**
* 导出excel
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXls")
public String exportXls(ConDemageEntity conDemage,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
CriteriaQuery cq = new CriteriaQuery(ConDemageEntity.class, dataGrid);
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, conDemage, request.getParameterMap());
List<ConDemageEntity> conDemages = this.conDemageService.getListByCriteriaQuery(cq,false);
modelMap.put(NormalExcelConstants.FILE_NAME,"合同索赔");
modelMap.put(NormalExcelConstants.CLASS,ConDemageEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("合同索赔列表", "导出人:"+ResourceUtil.getSessionUser().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,conDemages);
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
* 导出excel 使模板
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXlsByT")
public String exportXlsByT(ConDemageEntity conDemage,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
modelMap.put(NormalExcelConstants.FILE_NAME,"合同索赔");
modelMap.put(NormalExcelConstants.CLASS,ConDemageEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("合同索赔列表", "导出人:"+ResourceUtil.getSessionUser().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,new ArrayList());
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
@SuppressWarnings("unchecked")
@RequestMapping(params = "importExcel", method = RequestMethod.POST)
@ResponseBody
public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) {
AjaxJson j = new AjaxJson();
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams();
params.setTitleRows(2);
params.setHeadRows(1);
params.setNeedSave(true);
try {
List<ConDemageEntity> listConDemageEntitys = ExcelImportUtil.importExcel(file.getInputStream(),ConDemageEntity.class,params);
for (ConDemageEntity conDemage : listConDemageEntitys) {
conDemageService.save(conDemage);
}
j.setMsg("文件导入成功!");
} catch (Exception e) {
j.setMsg("文件导入失败!");
logger.error(ExceptionUtil.getExceptionMessage(e));
}finally{
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return j;
}
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value="合同索赔列表信息",produces="application/json",httpMethod="GET")
public ResponseMessage<List<ConDemageEntity>> list() {
List<ConDemageEntity> listConDemages=conDemageService.getList(ConDemageEntity.class);
return Result.success(listConDemages);
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value="根据ID获取合同索赔信息",notes="根据ID获取合同索赔信息",httpMethod="GET",produces="application/json")
public ResponseMessage<?> get(@ApiParam(required=true,name="id",value="ID")@PathVariable("id") String id) {
ConDemageEntity task = conDemageService.get(ConDemageEntity.class, id);
if (task == null) {
return Result.error("根据ID获取合同索赔信息为空");
}
return Result.success(task);
}
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@ApiOperation(value="创建合同索赔")
public ResponseMessage<?> create(@ApiParam(name="合同索赔对象")@RequestBody ConDemageEntity conDemage, UriComponentsBuilder uriBuilder) {
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<ConDemageEntity>> failures = validator.validate(conDemage);
if (!failures.isEmpty()) {
return Result.error(JSONArray.toJSONString(BeanValidators.extractPropertyAndMessage(failures)));
}
//保存
try{
conDemageService.save(conDemage);
} catch (Exception e) {
e.printStackTrace();
return Result.error("合同索赔信息保存失败");
}
return Result.success(conDemage);
}
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
@ApiOperation(value="更新合同索赔",notes="更新合同索赔")
public ResponseMessage<?> update(@ApiParam(name="合同索赔对象")@RequestBody ConDemageEntity conDemage) {
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<ConDemageEntity>> failures = validator.validate(conDemage);
if (!failures.isEmpty()) {
return Result.error(JSONArray.toJSONString(BeanValidators.extractPropertyAndMessage(failures)));
}
//保存
try{
conDemageService.saveOrUpdate(conDemage);
} catch (Exception e) {
e.printStackTrace();
return Result.error("更新合同索赔信息失败");
}
//按Restful约定,返回204状态码, 无内容. 也可以返回200状态码.
return Result.success("更新合同索赔信息成功");
}
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
@ApiOperation(value="删除合同索赔")
public ResponseMessage<?> delete(@ApiParam(name="id",value="ID",required=true)@PathVariable("id") String id) {
logger.info("delete[{}]" + id);
// 验证
if (StringUtils.isEmpty(id)) {
return Result.error("ID不能为空");
}
try {
conDemageService.deleteEntityById(ConDemageEntity.class, id);
} catch (Exception e) {
e.printStackTrace();
return Result.error("合同索赔删除失败");
}
return Result.success();
}
}
| [
"52381336+zhangxilong123@users.noreply.github.com"
] | 52381336+zhangxilong123@users.noreply.github.com |
ce490d1f8a0661d1ed7e772e1996f45fda8d4029 | 0293209e040dd0a541dc288bf52c5640f8b8966d | /app/src/main/java/cl/adachersoft/bitacora/views/main/RecordValidation.java | c2dda4f15f772ed76c9c0281d907864b90fcf3d0 | [] | no_license | Himuravidal/Bitacora | 246dc72290e17bac66985e9e40405472babe16e9 | 9be2a80760868aca1fcddfeb93dc40f7f46169eb | refs/heads/master | 2020-07-02T11:58:05.545327 | 2016-11-20T23:53:45 | 2016-11-20T23:53:45 | 74,306,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 626 | java | package cl.adachersoft.bitacora.views.main;
import cl.adachersoft.bitacora.models.Record;
/**
* Created by cristian on 16-11-2016.
*/
public class RecordValidation {
private FirstCallback callback;
public RecordValidation(FirstCallback callback) {
this.callback = callback;
}
public void init(String name) {
if (name.trim().length() > 0) {
Record record = new Record();
record.setName(name);
record.setDone(false);
record.save();
callback.success(record);
} else {
callback.fail();
}
}
}
| [
"cristian.vidal.lopez@gmail.com"
] | cristian.vidal.lopez@gmail.com |
a82b8b2bcbd1eecc54df441504e004df4a46512a | 23d5bdded10dc97da36f1c42f3baa215efb655f8 | /Lab2/src/cpds/lab2_training_1_3/Savage.java | b7267e4aa9f2f83d848dbbfe18a617e9ffff5f4e | [] | no_license | kyriegorrin/CPDS-labs | 52b013ff80fc1ee21cd3580b8ba0cff2f1002635 | f923afb1946e60d50b3e2a20e31f9989f986bd8e | refs/heads/master | 2021-03-13T12:22:01.169331 | 2020-03-12T19:24:30 | 2020-03-12T19:24:30 | 246,680,884 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 737 | 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 cpds.lab2_training_1_3;
import cpds.lab2_training_1_2.*;
import cpds.lab2_training_1_1.*;
/**
*
* @author mdomingu
*/
public class Savage extends Thread {
BadPotTwo pot;
public Savage(BadPotTwo pot) {
this.pot = pot;
}
public void run() {
while (true) {
System.out.println(Thread.currentThread().getName() + " is hungry");
try {
pot.getserving();
Thread.sleep(300);
}
catch(InterruptedException e) {};
}
}
}
| [
"kyriegorrin@gmail.com"
] | kyriegorrin@gmail.com |
41c68b76ce4f1255b50c73824e6733bf48d05203 | 78ae64591380d391171d7e303c19d0841f731920 | /RGB/src/testNG/NewTest2.java | cd133c3cb50dbc6c39f579c5bcbd1c0808c899ba | [] | no_license | vijayrellaboina/java456 | d5b7956c86acd6cdb1624b84afc33bfe55909438 | b5bc0e342621fa4641c9a01bc4189f8fe6959d11 | refs/heads/master | 2023-06-20T08:01:26.195131 | 2021-07-15T04:25:38 | 2021-07-15T04:25:38 | 385,967,383 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 112 | java | package testNG;
import org.testng.annotations.Test;
public class NewTest2 {
@Test
public void f() {
}
}
| [
"madasuvamsi@Vamsi"
] | madasuvamsi@Vamsi |
4181fe4a12af96c0f6bffa736fc1f04284cf06d3 | 77d1948c7fc50787da7a15497a5ad52be2c2acc9 | /CHOOSE/src/chooseeditor/impl/ChooseeditorFactoryImpl.java | d626fbaf06da5626d00148f52316f38d1d484c00 | [] | no_license | SimonZutterman/CHOOSE-Source-Code | ad496bab3146d8855c75ac75eacc5f5b77781510 | b7467901bd902fb0a8187e430363c89ed0e35a11 | refs/heads/master | 2021-01-04T02:37:52.463857 | 2013-05-19T02:00:52 | 2013-05-19T02:00:52 | 10,136,063 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,869 | java | /**
*/
package chooseeditor.impl;
import chooseeditor.Actor;
import chooseeditor.ActorContainer;
import chooseeditor.ChooseeditorFactory;
import chooseeditor.ChooseeditorPackage;
import chooseeditor.Device;
import chooseeditor.Diagram;
import chooseeditor.Goal;
import chooseeditor.HumanActor;
import chooseeditor.Operation;
import chooseeditor.OperationContainer;
import chooseeditor.Project;
import chooseeditor.Refinement;
import chooseeditor.Role;
import chooseeditor.SoftwareActor;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.impl.EFactoryImpl;
import org.eclipse.emf.ecore.plugin.EcorePlugin;
/**
* <!-- begin-user-doc -->
* An implementation of the model <b>Factory</b>.
* <!-- end-user-doc -->
* @generated
*/
public class ChooseeditorFactoryImpl extends EFactoryImpl implements ChooseeditorFactory {
/**
* Creates the default factory implementation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static ChooseeditorFactory init() {
try {
ChooseeditorFactory theChooseeditorFactory = (ChooseeditorFactory)EPackage.Registry.INSTANCE.getEFactory("http://chooseeditor/1.0");
if (theChooseeditorFactory != null) {
return theChooseeditorFactory;
}
}
catch (Exception exception) {
EcorePlugin.INSTANCE.log(exception);
}
return new ChooseeditorFactoryImpl();
}
/**
* Creates an instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ChooseeditorFactoryImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EObject create(EClass eClass) {
switch (eClass.getClassifierID()) {
case ChooseeditorPackage.DIAGRAM: return createDiagram();
case ChooseeditorPackage.GOAL: return createGoal();
case ChooseeditorPackage.REFINEMENT: return createRefinement();
case ChooseeditorPackage.ACTOR_CONTAINER: return createActorContainer();
case ChooseeditorPackage.OPERATION_CONTAINER: return createOperationContainer();
case ChooseeditorPackage.OBJECT: return createObject();
case ChooseeditorPackage.ACTOR: return createActor();
case ChooseeditorPackage.HUMAN_ACTOR: return createHumanActor();
case ChooseeditorPackage.ROLE: return createRole();
case ChooseeditorPackage.DEVICE: return createDevice();
case ChooseeditorPackage.SOFTWARE_ACTOR: return createSoftwareActor();
case ChooseeditorPackage.OPERATION: return createOperation();
case ChooseeditorPackage.PROCESS: return createProcess();
case ChooseeditorPackage.PROJECT: return createProject();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Diagram createDiagram() {
DiagramImpl diagram = new DiagramImpl();
return diagram;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Goal createGoal() {
GoalImpl goal = new GoalImpl();
return goal;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Refinement createRefinement() {
RefinementImpl refinement = new RefinementImpl();
return refinement;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ActorContainer createActorContainer() {
ActorContainerImpl actorContainer = new ActorContainerImpl();
return actorContainer;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public OperationContainer createOperationContainer() {
OperationContainerImpl operationContainer = new OperationContainerImpl();
return operationContainer;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public chooseeditor.Object createObject() {
ObjectImpl object = new ObjectImpl();
return object;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Actor createActor() {
ActorImpl actor = new ActorImpl();
return actor;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public HumanActor createHumanActor() {
HumanActorImpl humanActor = new HumanActorImpl();
return humanActor;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Role createRole() {
RoleImpl role = new RoleImpl();
return role;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Device createDevice() {
DeviceImpl device = new DeviceImpl();
return device;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public SoftwareActor createSoftwareActor() {
SoftwareActorImpl softwareActor = new SoftwareActorImpl();
return softwareActor;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Operation createOperation() {
OperationImpl operation = new OperationImpl();
return operation;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public chooseeditor.Process createProcess() {
ProcessImpl process = new ProcessImpl();
return process;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Project createProject() {
ProjectImpl project = new ProjectImpl();
return project;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ChooseeditorPackage getChooseeditorPackage() {
return (ChooseeditorPackage)getEPackage();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @deprecated
* @generated
*/
@Deprecated
public static ChooseeditorPackage getPackage() {
return ChooseeditorPackage.eINSTANCE;
}
} //ChooseeditorFactoryImpl
| [
"simon.zutterman@ugent.be"
] | simon.zutterman@ugent.be |
98228a0f31989ab655ae4aaf49080bdd8f5ebcc3 | 0d653601ce92228a3fc2dda3b50cfde91e52a7f3 | /kap2/opg5.java | f0eab76d39881dfeb7a2a745795678469b0126da | [] | no_license | rholmdal/oop-kap | 849c86848cdaf743b29a83e4d6cee02b0b99e777 | 490f677a8b27aa8fcd2f3f207489b98825b8d0b4 | refs/heads/master | 2021-01-23T12:11:10.930382 | 2014-11-22T12:12:47 | 2014-11-22T12:12:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 377 | java | import javax.swing.JOptionPane;
public class opg5
{
public static void main ( String args[] )
{
double a, r;
double pi = 3.14;
String radius;
radius = JOptionPane.showInputDialog( "Skriv inn radius:" );
r = Double.parseDouble ( radius );
a = pi * r * r;
JOptionPane.showMessageDialog( null, "Arealer er: " + a,
"Resultat", JOptionPane.PLAIN_MESSAGE );
}
} | [
"rholmdfal@gmail.com"
] | rholmdfal@gmail.com |
36509e257cae204e05455bdb3139e066cd7ff9d9 | 8a79d400724457fc4e0ba1604b2ab263ab8db417 | /src/main/java/com/kahin/lifenglish/model/MainListData.java | 6dcb7b8f804ab64c1ccbe8d709fb66492cbacbb8 | [] | no_license | KahinHui/lifenglish | 1342e7128befb958aeb865b53af33a04d61d6691 | 803911790d07d968d6b9e14461ece08e7a523322 | refs/heads/master | 2022-03-15T06:55:47.644556 | 2019-11-10T14:30:50 | 2019-11-10T14:30:50 | 103,730,540 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,910 | java | package com.kahin.lifenglish.model;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.databinding.ObservableField;
import android.widget.Toast;
import com.kahin.lifenglish.SQLite.DBManager;
import com.kahin.lifenglish.viewModel.MainListViewModel;
import java.util.ArrayList;
import java.util.List;
import static com.kahin.lifenglish.SQLite.DBHelper.MAINLIST_NAME;
import static com.kahin.lifenglish.SQLite.DBHelper.TABLE_MAINLIST;
/**
* Created by admin on 15/5/2017.
*/
public class MainListData {
Context mContext = null;
public List<MainListViewModel> mainlist;
//public final ObservableField<List<MainListViewModel>> mDatas = new ObservableField<>();
//public final ObservableField<String> description = new ObservableField<>();
//public final ObservableField<String> imageUrl = new ObservableField<>();
DBManager mDBManager;
public MainListData(Context context) {
mContext = context;
}
public MainListData(Context context, MainListViewModel data) {
mContext = context;
//description.set(data.description);
//imageUrl.set(data.imageUrl);
}
public void instert() {
mDBManager = DBManager.getInstance(mContext);
SQLiteDatabase db = null;
try {
db = mDBManager.openDatabase();
db.beginTransaction();
insert(db, TABLE_MAINLIST, MAINLIST_NAME, "機場");
insert(db, TABLE_MAINLIST, MAINLIST_NAME, "機上");
insert(db, TABLE_MAINLIST, MAINLIST_NAME, "入境/海關");
insert(db, TABLE_MAINLIST, MAINLIST_NAME, "搭車/問路");
insert(db, TABLE_MAINLIST, MAINLIST_NAME, "酒店");
insert(db, TABLE_MAINLIST, MAINLIST_NAME, "食嘢");
insert(db, TABLE_MAINLIST, MAINLIST_NAME, "買嘢");
insert(db, TABLE_MAINLIST, MAINLIST_NAME, "買飛");
db.setTransactionSuccessful();
} catch (SQLiteException e) {
e.printStackTrace();
} finally {
db.endTransaction();
mDBManager.closeDB();
}
}
private void insert(SQLiteDatabase db, String table, String key, String value) {
//SQLiteDatabase db = getWritableDatabase();
ContentValues cv = new ContentValues();
cv.put(key, value);
db.insert(table, null, cv);
//db.close();
}
public void queryMainList() {
mDBManager = DBManager.getInstance(mContext);
SQLiteDatabase db = null;
try {
db = mDBManager.openDatabase();
db.beginTransaction();
Cursor c = db.query(TABLE_MAINLIST, new String[]{"*"}, MAINLIST_NAME + "=?", new String[]{"機上"}, null, null, null);
//Cursor c = db.query(TABLE_MAINLIST, new String[]{DBHelper.MAINLIST_NAME}, null, null, null, null, null);
Toast.makeText(mContext, "name:"+c.getCount(), Toast.LENGTH_LONG).show();
String a = "";
try {
while (c.moveToNext()) {
String n = c.getString(c.getColumnIndex(MAINLIST_NAME));
a = a + n;
}
} finally {
c.close();
Toast.makeText(mContext, "name:"+a, Toast.LENGTH_LONG).show();
}
db.setTransactionSuccessful();
} catch (SQLiteException e) {
e.printStackTrace();
Toast.makeText(mContext, "e:"+e, Toast.LENGTH_LONG).show();
} finally {
if (db != null) {
db.endTransaction();
mDBManager.closeDB();
}
}
}
public List<MainListViewModel> queryMainListReturn() {
List<MainListViewModel> items = new ArrayList<MainListViewModel>();
mDBManager = DBManager.getInstance(mContext);
SQLiteDatabase db = null;
try {
db = mDBManager.openDatabase();
db.beginTransaction();
Cursor cursor = db.rawQuery("select * from " + TABLE_MAINLIST, null);
try {
while (cursor.moveToNext()) {
String description = cursor.getString(cursor.getColumnIndex(MAINLIST_NAME));
items.add(new MainListViewModel(description, ""));
//Toast.makeText(mContext, description, Toast.LENGTH_SHORT).show();
}
} finally {
cursor.close();
}
db.setTransactionSuccessful();
//db.close();
} catch (SQLiteException e) {
} finally {
if (db != null) {
db.endTransaction();
mDBManager.closeDB();
}
}
return items;
}
}
| [
"xuan488717@gmail.com"
] | xuan488717@gmail.com |
b6fb74caea51f227af115d57d2af98f07cfcb27b | dd67ca8d9dbe4eaa4e8e9d9b655ea01d4f4f52e2 | /src/main/java/chapter2/Triangle.java | 129858b6b33fb0018a128c84620cb377521e34ca | [] | no_license | ChengCuotuo/storage | 73ed17f0204736f88bb820b9716b0d1dd920694d | 6f8e1936acf48579033da9f1ab43e1645e44407e | refs/heads/master | 2022-05-30T12:54:25.191712 | 2019-09-16T16:11:36 | 2019-09-16T16:11:36 | 205,513,168 | 0 | 0 | null | 2022-05-20T21:08:36 | 2019-08-31T07:42:55 | Java | UTF-8 | Java | false | false | 823 | java | package chapter2;
/**
* @Auth: chunlei.wang
* @Date: 2019/09/07
* @Desc: 三角形
*/
public class Triangle {
private int a;
private int b;
private int c;
public Triangle(int a, int b, int c) {
this.a = a;
this.b = b;
this.c = c;
}
public static boolean judge(int a, int b, int c) {
if (a <= 0 || b <= 0 || c <= 0) {
return false;
}
if (a + b <= c) {
return false;
}
if (b + c <= a) {
return false;
}
if (a + c <= b) {
return false;
}
return true;
}
@Override
public String toString() {
return "Triangle{" +
"a=" + a +
", b=" + b +
", c=" + c +
'}';
}
}
| [
"lei021191@outlook.com"
] | lei021191@outlook.com |
cab5d5b8d71a4fcfe88a2b5d1743ffca300cf211 | 4bcd33e293bf50149bd8e1999f19c9c309b31d71 | /src/graphics/grids/layers/RegionLayer.java | 2294e21e192f92482e5c757a9805ef9ae2b11ffa | [] | no_license | zuziik/solver2016 | 972a4a56c1129f602281dd1a32a3c65615874d72 | 6e8ed3e204d789d411dc5ad5d2c8122f16e94b09 | refs/heads/master | 2021-01-21T04:54:47.726260 | 2016-06-13T08:40:50 | 2016-06-13T08:40:50 | 49,322,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,045 | java | package graphics.grids.layers;
import javafx.scene.layout.GridPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import java.util.HashMap;
/**
* Trieda reprezentuje vrstvu s extra regionmi
*/
public class RegionLayer extends GridPane {
private final int size;
private final Rectangle cells[][] = new Rectangle[9][9];
private HashMap<Character,Color> color;
/**
* Konstruktor vytvori vrstvu na farebne oznacovanie policok podla ich prislusnosti k extra regionu.
* @param size velkost jedneho policka v sudoku
*/
public RegionLayer(int size) {
this.size = size;
for ( int i = 0; i < 9; i++ ) {
for ( int j = 0; j < 9; j++ ){
cells[i][j] = new Rectangle(size,size);
cells[i][j].setStroke(Color.BLACK);
cells[i][j].setStrokeWidth(0.25);
setBlank(i,j);
super.add(cells[i][j], j, i);
}
}
fillColors();
}
/** Funkcia definuje farby pre jednotlive extra regiony */
private void fillColors() {
this.color = new HashMap<>(4);
color.put('A', Color.RED);
color.put('B', Color.BLUE);
color.put('C', Color.GREEN);
color.put('D', Color.YELLOW);
}
/** Funkcia nastavi policku na pozicii x, y region A-D
* @param x x-ova suradnica policka
* @param y y-ova suradnica policka
* @param c znak oznacujuci, k akemu regionu policko patri (A-D)
*/
public void color(int x, int y, char c) {
cells[x][y].setFill(color.get(Character.toUpperCase(c)));
cells[x][y].setOpacity(0.25);
}
/** Funkcia zrusi prislusnost policka na pozicii x, y k akemukolvek regionu
* @param x x-ova suradnica policka
* @param y y-ova suradnica policka
*/
public void setBlank(int x, int y) {
cells[x][y].setOpacity(0);
}
/** Funkcia vrati true, ak policko na pozicii x, y patri regionu c
* @param x x-ova suradnica policka
* @param y y-ova suradnica policka
* @param c znak oznacujuci region(A-D)
*/
public boolean isRegion(int x, int y, char c) {
return cells[x][y].getFill().equals(color.get(c)) && cells[x][y].getOpacity() == 0.25;
}
/** Funkcia vrati klon vrstvy s extra regionmi
* @return klon vrstvy s extra regionmi
*/
@Override
public RegionLayer clone() {
RegionLayer cloned = new RegionLayer(size);
Rectangle[][] cloned_cells = new Rectangle[9][9];
for ( int i = 0; i < 9; i++ ) {
for ( int j = 0; j < 9; j++ ) {
Rectangle c = new Rectangle(size, size);
Rectangle old = cells[i][j];
c.setFill(old.getFill());
c.setStroke(old.getStroke());
c.setOpacity(old.getOpacity());
c.setStrokeWidth(old.getStrokeWidth());
cloned.add(c, j, i);
cloned_cells[i][j] = c;
}
}
return cloned;
}
} | [
"zuzana@hromec.sk"
] | zuzana@hromec.sk |
619cc7b65cd41bb8d8bd0a62a2ba110862cecc63 | 285b8c38ab7e1b9c5eecc7d9c858eaa9ed39afc7 | /cloud-config-center-3344/src/main/java/com/atguigu/springcloud/ConfigCenterApplication3344.java | 55d7d83c5a97c3477fdd0ff7c385929386a31dcc | [] | no_license | wangchirl/cloud2020 | 66b22ac12012e29470268b8dfce2f40424ef55ac | ed8f99542be42f321ddb83ef3ef53f487e9a680a | refs/heads/master | 2022-07-04T18:06:58.720928 | 2020-03-13T05:57:43 | 2020-03-13T05:57:43 | 246,998,511 | 0 | 0 | null | 2022-06-21T02:58:46 | 2020-03-13T05:56:19 | Java | UTF-8 | Java | false | false | 521 | java | package com.atguigu.springcloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@SpringBootApplication
@EnableConfigServer
@EnableEurekaClient
public class ConfigCenterApplication3344 {
public static void main(String[] args) {
SpringApplication.run(ConfigCenterApplication3344.class,args);
}
}
| [
"“757748953@qq.com"
] | “757748953@qq.com |
e9027da379796627a725f52e8569a26b5c135687 | 49553c3ee27e6ce762ae3ca7e2751a2588cc78dd | /src/test/java/de/griesser/outfit/restservice/impl/SpringCityControllerTest.java | e18eba5a08ee0d6feffa751e731d7acd44e4285b | [] | no_license | nadegegriesser/outfit-service | c68b9b23666fb6e43d9e8546f13e6926690d8442 | 91f91107a2130aec9ef08c8b3aeae2471fc17d91 | refs/heads/master | 2020-04-11T15:57:42.283952 | 2019-01-31T19:17:15 | 2019-01-31T19:17:15 | 161,908,733 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,207 | java | package de.griesser.outfit.restservice.impl;
import de.griesser.outfit.weatherserviceclient.api.City;
import de.griesser.outfit.weatherserviceclient.api.CityService;
import de.griesser.outfit.weatherserviceclient.api.ClientError;
import de.griesser.outfit.weatherserviceclient.api.ServerError;
import org.junit.Before;
import org.junit.Test;
import org.springframework.web.server.ResponseStatusException;
import java.util.Arrays;
import java.util.List;
import java.util.SortedSet;
import static de.griesser.outfit.restservice.impl.SpringCityController.ERROR_COUNTRY_NOT_FOUND;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.springframework.http.HttpStatus.NOT_FOUND;
public class SpringCityControllerTest {
private static final String COUNTRY_CODE_GERMANY = "de";
private static final String COUNTRY_CODE_UNKNOWN = "xx";
private static final long CITY_ID_KARLSRUHE = 2892794;
private static final String CITY_NAME_KARLSRUHE = "Karlsruhe";
private static final long CITY_ID_KAROW = 2892705;
private static final String CITY_NAME_KAROW = "Karow";
private static final long CITY_ID_LICHTENRADE = 2878044;
private static final String CITY_NAME_LICHTENRADE = "Lichtenrade";
private SpringCityController sut;
@Before
public void setUp() {
sut = new SpringCityController(new SpringCityControllerTest.DummyCityService());
}
@Test(expected = ResponseStatusException.class)
public void testGetCitiesSortedByNameForUnknownCountry() throws ClientError, ServerError {
try {
sut.getCitiesSortedByNameForCountry(COUNTRY_CODE_UNKNOWN);
} catch (ResponseStatusException ex) {
assertEquals(NOT_FOUND, ex.getStatus());
assertEquals(ERROR_COUNTRY_NOT_FOUND, ex.getReason());
throw ex;
}
}
@Test
public void testGetCitiesSortedByNameForGermany() throws ClientError, ServerError {
SortedSet<de.griesser.outfit.restservice.api.City> res = sut.getCitiesSortedByNameForCountry(
COUNTRY_CODE_GERMANY);
assertNotNull(res);
assertEquals(3, res.size());
assertEquals(CITY_ID_KARLSRUHE, res.first().getId());
assertEquals(CITY_NAME_KARLSRUHE, res.first().getName());
assertEquals(CITY_ID_LICHTENRADE, res.last().getId());
assertEquals(CITY_NAME_LICHTENRADE, res.last().getName());
}
private class DummyCityService implements CityService {
@Override
public List<City> getCities() {
return Arrays.asList(
new City(CITY_ID_KAROW,
CITY_NAME_KAROW,
COUNTRY_CODE_GERMANY.toUpperCase(),
null),
new City(CITY_ID_KARLSRUHE,
CITY_NAME_KARLSRUHE,
COUNTRY_CODE_GERMANY.toUpperCase(),
null),
new City(CITY_ID_LICHTENRADE,
CITY_NAME_LICHTENRADE,
COUNTRY_CODE_GERMANY.toUpperCase(),
null));
}
}
}
| [
"nadege.griesser@1und1.de"
] | nadege.griesser@1und1.de |
ff34fb0277a7c6c779571fba6bf6aaf7936aede2 | 163894945c6e452b69be2cd61101ae858102a6de | /src/com/company/arifmetic.java | 2e10332b6a45af09cd577fc178bc928d2b5570e2 | [] | no_license | silver-Sanchez/ZADANIE_JAVA_APPLINE | 33fdeb7fed69f38ec78fff16c462e6312acaff2e | 4279af39ea818299d3566fe3f1d134fe5c512175 | refs/heads/master | 2022-11-10T15:04:41.270182 | 2020-05-08T12:10:45 | 2020-05-08T12:10:45 | 257,037,954 | 0 | 0 | null | 2020-06-30T15:10:57 | 2020-04-19T15:44:23 | Java | UTF-8 | Java | false | false | 1,056 | java | package com.company;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class arifmetic {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Введите число x");
double x = Integer.parseInt(reader.readLine());
System.out.println("Введите число y 2");
double y = Integer.parseInt(reader.readLine());
System.out.println("Введите число3 z 3");
double z = Integer.parseInt(reader.readLine());
double d = x + y + z;
double f = d / 3;
System.out.println("число x = " + x + "число y = " + y + "число z = " + z );
System.out.println("среднего арифметического чисел x, y, z = " + f );
if (f > 3 && d % 2 == 0) {
System.out.println("Программа выполнена корректно");
}
}
}
| [
"55756108+silver-Sanchez@users.noreply.github.com"
] | 55756108+silver-Sanchez@users.noreply.github.com |
33b6f57d1d45044d5488e2edc3858afe186996e3 | 3a105f0f06ee228ded855bf7c4cd165698e46ddc | /src/main/java/com/cruise/entity/PauseParameter.java | d64161a5a80c20f20d1b83d5b3daba520065715a | [] | no_license | fryder/Cruise | 5f3661581c02ed4030e09dd511580320a0e4fd90 | 6b1bf7203f1872600fbc929ace600d176440735e | refs/heads/master | 2020-05-18T08:08:46.268236 | 2019-04-30T15:24:22 | 2019-04-30T15:24:22 | 184,286,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,468 | java | package com.cruise.entity;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Entity
@Table(name = "PAUSE_PARA")
@IdClass(PauseParameterKey.class)
public class PauseParameter implements Serializable {
String currency;
@Id
String metaproduct;
@Id
String product_code;
@Id
String ship_code;
@Id
Date sail_date;
BigDecimal sail_month;
String cat_class;
String occupancy;
String category;
BigDecimal l1_pause;
Date l1_insert_date;
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public String getMetaproduct() {
return metaproduct;
}
public void setMetaproduct(String metaproduct) {
this.metaproduct = metaproduct;
}
public String getProduct_code() {
return product_code;
}
public void setProduct_code(String product_code) {
this.product_code = product_code;
}
public String getShip_code() {
return ship_code;
}
public void setShip_code(String ship_code) {
this.ship_code = ship_code;
}
public Date getSail_date() {
return sail_date;
}
public void setSail_date(Date sail_date) {
this.sail_date = sail_date;
}
public BigDecimal getSail_month() {
return sail_month;
}
public void setSail_month(BigDecimal sail_month) {
this.sail_month = sail_month;
}
public String getCat_class() {
return cat_class;
}
public void setCat_class(String cat_class) {
this.cat_class = cat_class;
}
public String getOccupancy() {
return occupancy;
}
public void setOccupancy(String occupancy) {
this.occupancy = occupancy;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public BigDecimal getL1_pause() {
return l1_pause;
}
public void setL1_pause(BigDecimal l1_pause) {
this.l1_pause = l1_pause;
}
public Date getL1_insert_date() {
return l1_insert_date;
}
public void setL1_insert_date(Date l1_insert_date) {
this.l1_insert_date = l1_insert_date;
}
}
| [
"parvatamaditya@gmail.com"
] | parvatamaditya@gmail.com |
0ed3bf796b7805d7baab5059ee61e95f41afd8b7 | 2b4936b399212972769d4377bff7ea521242aab4 | /src/james/sugden/utils/AudioBuffer.java | 68ce4ecd27b962c1a3c2e7aa318943aa26b02405 | [] | no_license | rexapex/2D-Game-Engine | 58328cfc3a92c00adcea7b7ba0d877baa627e63b | 016739b8c418789d4ce266ae62685db6c8f52ce2 | refs/heads/master | 2019-04-30T09:16:18.769132 | 2017-10-11T08:56:22 | 2017-10-11T08:56:22 | 94,435,947 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,281 | java | package james.sugden.utils;
import static org.lwjgl.openal.AL10.AL_BUFFER;
import static org.lwjgl.openal.AL10.alDeleteBuffers;
import static org.lwjgl.openal.AL10.alDeleteSources;
import static org.lwjgl.openal.AL10.alGenSources;
import static org.lwjgl.openal.AL10.alSourcei;
import james.sugden.engine.audio.AudioSource;
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.List;
public class AudioBuffer
{
private IntBuffer buffer;
private String path, name;
private List<Integer> sources;
public AudioBuffer(IntBuffer buffer, String path, String name)
{
this.buffer = buffer;
this.path = path;
this.name = name;
this.sources = new ArrayList<>();
}
public int createSource()
{
int source = alGenSources();
alSourcei(source, AL_BUFFER, buffer.get(0));
sources.add(source);
return source;
}
public void deleteSource(AudioSource source)
{
alDeleteSources(source.getSource());
}
/**Deletes the buffers and all audio sources using the buffer*/
public void deleteBuffer()
{
System.out.println("Deleted buffer");
for(int source : sources)
{
alDeleteSources(source);
}
alDeleteBuffers(buffer.get(0));
}
public String getPath()
{
return path;
}
public String getName()
{
return name;
}
}
| [
"james@thesugdens.com"
] | james@thesugdens.com |
735b06bed29077792d412ae3ff27949153ce35af | 4754ced1ad1c04d4e023c28d4028e1bca5bb05fe | /src/com/nubes/cj/day7/AtmSwitchStatement.java | e449df0ca118f6a7a700262d3120d58a6a2718bf | [] | no_license | tanviavula/batch_3 | b7c24635cb1a26909f046685cfae6afb01a5465a | 3242b604cf4f8e2204ca5cc8ba49bf306b0575a5 | refs/heads/master | 2021-04-22T04:29:29.257833 | 2020-04-29T01:39:25 | 2020-04-29T01:39:25 | 249,850,815 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 673 | java | package com.nubes.cj.day7;
import java.util.Scanner;
public class AtmSwitchStatement {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("1.Withdraw 2. Change Password 3.Mini statement 4.Exit");
int num = sc.nextInt();
switch (num) {
case 1:
System.out.println("You clicked on withdraw method");
break;
case 2:
System.out.println("You clicked on change password method");
break;
case 3:
System.out.println("You clicked on mini statement");
break;
case 4:
System.out.println("Thank you visit agin...");
break;
default:
break;
}
sc.close();
}
}
| [
"lakshman.avula@outlook.com"
] | lakshman.avula@outlook.com |
3dc5fc21814c6e3cf0bf2371796d2bd6f3725034 | 40e86dc1c209d3f1fd1c5cad7c8d60d42657033d | /core/src/com/chirag/betterbreakout/MovingGameElement.java | a8bb908328adb980782aeebd7e3fc04fff917191 | [] | no_license | clim8change/BetterBreakout | 0a5aba6986774d3f1bca0dc54597c9ea08cd352a | f82f4d9f96ef6911a01ad7c1cae1e06ac5626615 | refs/heads/master | 2020-07-30T10:24:20.644331 | 2018-11-19T01:43:24 | 2018-11-19T01:43:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,129 | java | package com.chirag.betterbreakout;
import com.badlogic.gdx.graphics.Texture;
public class MovingGameElement extends BaseGameElement {
protected float mXVel;
protected float mYVel;
public MovingGameElement(Texture texture, float x, float y, float width, float height, float xVel, float yVel) {
super(texture, x, y, width, height);
mXVel = xVel;
mYVel = yVel;
}
public float getXVel() {
return mXVel;
}
public float getYVel() {
return mYVel;
}
public float getOldX() {
return mX - mXVel;
}
public float getOldY() {
return mY - mYVel;
}
public void stepBack() {
mX -= mXVel;
mY -= mYVel;
}
public void reverseX() {
mXVel *= -1;
}
public void reverseY() {
mYVel *= -1;
}
public void setDead(boolean isDead) {
mIsDead = isDead;
}
public void update() {
mX += mXVel;
mY += mYVel;
if(mX < 0 || mX > BetterBreakout.GAME_WIDTH || mY < 0 || mY > BetterBreakout.GAME_HEIGHT) {
mIsDead = true;
}
}
}
| [
"spafindoople@gmail.com"
] | spafindoople@gmail.com |
b022896a21e7596e9189e344e4b5836d84ae28b3 | 6592b41d63514008c9043377be0c189380a63615 | /app/src/main/java/com/salage/model/JsonToSendServer.java | 81328f1289fbda3f8ebb2f4ca6292f3e3cae934b | [] | no_license | shahkutub/SalageAndroid | c6ff2739262d3d868dcfd69acb8ed65aa2113f5d | 4bd7c3c9cd270cc18e47f25472891e1365ef2cae | refs/heads/master | 2021-01-22T04:33:43.381578 | 2017-03-15T10:07:02 | 2017-03-15T10:07:02 | 81,553,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 541 | java | package com.salage.model;
import java.util.ArrayList;
import java.util.List;
/**
* Created by User on 2/24/2017.
*/
public class JsonToSendServer {
public List<AgentInfo> info =new ArrayList<AgentInfo>();
public SyncData data =new SyncData();
public List<AgentInfo> getInfo() {
return info;
}
public void setInfo(List<AgentInfo> info) {
this.info = info;
}
public SyncData getData() {
return data;
}
public void setData(SyncData data) {
this.data = data;
}
}
| [
"shah.kutub1@gmail.com"
] | shah.kutub1@gmail.com |
9af9f9e1838fa1fa309fed8a38a4f74d6abfadb3 | 8da7eaf2f454546b98fb425f78ee9f212e4c71e9 | /view/TabuleiroGrafico.java | 09a2eb40570ad2a66fd92b5100423cc8e63949ca | [] | no_license | guimilan/xadrez | f8f8b76b0e612f204101c34900182b7082583b54 | aac67f93fb40ced0da005ea66976130de59b6286 | refs/heads/master | 2022-08-20T09:23:23.401877 | 2016-11-05T20:20:23 | 2016-11-05T20:20:23 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 3,514 | java | package view;
import java.awt.Color;
import java.awt.Component;
import java.awt.GridLayout;
import java.awt.Point;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JLabel;
import javax.swing.JPanel;
import game.Xadrez;
public class TabuleiroGrafico extends JPanel {
private static final long serialVersionUID = -6253571512577610354L;
private JPanel [][]casas;
private List<Point> casasDestacadas;
public TabuleiroGrafico() {
super.setLayout(new GridLayout(8, 8));
constroiEColoreAsCasas();
}
private void constroiEColoreAsCasas() {
casas = new JPanel[8][8];
boolean corBranca = true;
for(int i = 0; i < 8; i++) {
for(int j = 0; j < 8; j++) {
casas[i][j] = new JPanel();
if(corBranca) {
casas[i][j].setBackground(Color.WHITE);
} else {
casas[i][j].setBackground(Color.GRAY);
}
JLabel iconeDaPeca = new JLabel();
casas[i][j].add(iconeDaPeca);
super.add(casas[i][j]);
corBranca = !corBranca;
}
corBranca = !corBranca;
}
}
public void atualizaTabuleiroGraficoInteiro(Xadrez jogo) {
for(int i = 0; i < 8; i++) {
for(int j = 0; j < 8; j++) {
JLabel containerDoIconeDaPeca = (JLabel)casas[i][j].getComponent(0);
if(jogo.getTabuleiro().casaEstaVazia(i, j)) {
containerDoIconeDaPeca.setIcon(null);
} else {
containerDoIconeDaPeca.setIcon(jogo.getTabuleiro().getPeca(i, j).getImagem());
}
}
}
//TODO: Testar direito se essa linha realmente não é necessária
//super.paintAll(super.getGraphics());
destacaCasas(jogo.getMovimentosValidos());
}
private void destacaCasas(List<Point> movimentosValidos) {
limpaCasasDestacadasSeHouver();
for(Point movimentoValido : movimentosValidos) {
casas[movimentoValido.x][movimentoValido.y].setBackground(Color.YELLOW);
}
casasDestacadas.addAll(movimentosValidos);
}
public boolean casaEstaDestacada(Point casa) {
return casasDestacadas.contains(casa);
}
public List<Point> getCasasDestacadas() {
return casasDestacadas;
}
private void limpaCasasDestacadasSeHouver() {
if(casasDestacadas != null && !casasDestacadas.isEmpty()) {
for(Point casaDestacada : casasDestacadas) {
if(casaDestacada.x % 2 == 0) {
if(casaDestacada.y % 2 == 0) {
pintaFundoDeBranco(casaDestacada.x, casaDestacada.y);
} else {
pintaFundoDePreto(casaDestacada.x, casaDestacada.y);
}
} else {
if(casaDestacada.y % 2 == 0) {
pintaFundoDePreto(casaDestacada.x, casaDestacada.y);
} else {
pintaFundoDeBranco(casaDestacada.x, casaDestacada.y);
}
}
}
}
casasDestacadas = new ArrayList<Point>();
}
public Point converteCoordenadasEmCasaDoTabuleiro(MouseEvent e) {
Component compClicado = e.getComponent().getComponentAt(e.getX(), e.getY());
int xExtremoEsquerdo = compClicado.getX();
int yExtremoEsquerdo = compClicado.getY();
int larguraComponente = compClicado.getWidth();
int alturaComponente = compClicado.getHeight();
int xPeca = (int) Math.floor(yExtremoEsquerdo/alturaComponente);
int yPeca = (int) Math.floor(xExtremoEsquerdo/larguraComponente);
Point coordenadasPecaSelecionada = new Point(xPeca, yPeca);
return coordenadasPecaSelecionada;
}
private void pintaFundoDePreto(int linha, int coluna) {
casas[linha][coluna].setBackground(Color.GRAY);
}
private void pintaFundoDeBranco(int linha, int coluna) {
casas[linha][coluna].setBackground(Color.WHITE);
}
}
| [
"guilherme.milan9@gmail.com"
] | guilherme.milan9@gmail.com |
1083546a330fc8ff1fd9e0d56411091134e0b824 | 5979994b215fabe125cd756559ef2166c7df7519 | /aimir-mdms-iesco/src/main/java/_1_release/cpsm_v4/MspCIMObject.java | 5abb3888876932cf333a8df072bfc06aa0f8cf70 | [] | no_license | TechTinkerer42/Haiti | 91c45cb1b784c9afc61bf60d43e1d5623aeba888 | debaea96056d1d4611b79bd846af8f7484b93e6e | refs/heads/master | 2023-04-28T23:39:43.176592 | 2021-05-03T10:49:42 | 2021-05-03T10:49:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,918 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.6
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.07.22 at 06:41:41 PM KST
//
package _1_release.cpsm_v4;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
/**
* <p>Java class for mspCIMObject complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="mspCIMObject">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="extensions" type="{cpsm_V4.1_Release}extensions" minOccurs="0"/>
* <element name="comments" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="extensionsList" type="{cpsm_V4.1_Release}extensionsList" minOccurs="0"/>
* <element name="IdentifiedObject" type="{cpsm_V4.1_Release}IdentifiedObject" minOccurs="0"/>
* </sequence>
* <attribute name="objectID" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="verb" type="{cpsm_V4.1_Release}action" default="Change" />
* <attribute name="errorString" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="replaceID" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="utility" type="{http://www.w3.org/2001/XMLSchema}string" />
* <anyAttribute/>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "mspCIMObject", propOrder = {
"extensions",
"comments",
"extensionsList",
"identifiedObject"
})
public abstract class MspCIMObject {
protected Extensions extensions;
protected String comments;
protected ExtensionsList extensionsList;
@XmlElement(name = "IdentifiedObject")
protected IdentifiedObject identifiedObject;
@XmlAttribute(name = "objectID")
protected String objectID;
@XmlAttribute(name = "verb")
protected Action verb;
@XmlAttribute(name = "errorString")
protected String errorString;
@XmlAttribute(name = "replaceID")
protected String replaceID;
@XmlAttribute(name = "utility")
protected String utility;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
/**
* Gets the value of the extensions property.
*
* @return
* possible object is
* {@link Extensions }
*
*/
public Extensions getExtensions() {
return extensions;
}
/**
* Sets the value of the extensions property.
*
* @param value
* allowed object is
* {@link Extensions }
*
*/
public void setExtensions(Extensions value) {
this.extensions = value;
}
/**
* Gets the value of the comments property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getComments() {
return comments;
}
/**
* Sets the value of the comments property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setComments(String value) {
this.comments = value;
}
/**
* Gets the value of the extensionsList property.
*
* @return
* possible object is
* {@link ExtensionsList }
*
*/
public ExtensionsList getExtensionsList() {
return extensionsList;
}
/**
* Sets the value of the extensionsList property.
*
* @param value
* allowed object is
* {@link ExtensionsList }
*
*/
public void setExtensionsList(ExtensionsList value) {
this.extensionsList = value;
}
/**
* Gets the value of the identifiedObject property.
*
* @return
* possible object is
* {@link IdentifiedObject }
*
*/
public IdentifiedObject getIdentifiedObject() {
return identifiedObject;
}
/**
* Sets the value of the identifiedObject property.
*
* @param value
* allowed object is
* {@link IdentifiedObject }
*
*/
public void setIdentifiedObject(IdentifiedObject value) {
this.identifiedObject = value;
}
/**
* Gets the value of the objectID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getObjectID() {
return objectID;
}
/**
* Sets the value of the objectID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setObjectID(String value) {
this.objectID = value;
}
/**
* Gets the value of the verb property.
*
* @return
* possible object is
* {@link Action }
*
*/
public Action getVerb() {
if (verb == null) {
return Action.CHANGE;
} else {
return verb;
}
}
/**
* Sets the value of the verb property.
*
* @param value
* allowed object is
* {@link Action }
*
*/
public void setVerb(Action value) {
this.verb = value;
}
/**
* Gets the value of the errorString property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getErrorString() {
return errorString;
}
/**
* Sets the value of the errorString property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setErrorString(String value) {
this.errorString = value;
}
/**
* Gets the value of the replaceID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getReplaceID() {
return replaceID;
}
/**
* Sets the value of the replaceID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setReplaceID(String value) {
this.replaceID = value;
}
/**
* Gets the value of the utility property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUtility() {
return utility;
}
/**
* Sets the value of the utility property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUtility(String value) {
this.utility = value;
}
/**
* Gets a map that contains attributes that aren't bound to any typed property on this class.
*
* <p>
* the map is keyed by the name of the attribute and
* the value is the string value of the attribute.
*
* the map returned by this method is live, and you can add new attribute
* by updating the map directly. Because of this design, there's no setter.
*
*
* @return
* always non-null
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
}
| [
"marsr0913@nuritelecom.com"
] | marsr0913@nuritelecom.com |
0f20ed8e2d14914412e7032757060fe2b26b7d04 | ec7846ec984a02f79c1b6501a68bce0d84ce7179 | /src/Student.java | 95d8a2c32c78d134b140feb191ace5c037762296 | [] | no_license | Mit493/TimetableManagement | dfb7b78910970507dd2e9e93fe6428484febb6a5 | ca784c302776cc3098ce3c625f51cf4e0c7999ed | refs/heads/master | 2023-04-29T23:04:32.904676 | 2021-05-21T14:04:28 | 2021-05-21T14:04:28 | 365,270,518 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 38,254 | java |
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author diyaa
*/
public class Student extends javax.swing.JFrame {
/**
* Creates new form Student
*/
public Student() {
initComponents();
Connect();
load();
}
Connection con;
PreparedStatement pst;
ResultSet rs;
DefaultTableModel d;
public void Connect(){
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/timetablemanegementsystem","root","");
} catch (ClassNotFoundException ex) {
Logger.getLogger(Student.class.getName()).log(Level.SEVERE, null, ex);
} catch (SQLException ex) {
Logger.getLogger(Student.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void load(){
int c;
try {
pst = con.prepareStatement("select * from student");
rs = pst.executeQuery();
ResultSetMetaData rsd = rs.getMetaData();
c = rsd.getColumnCount();
d = (DefaultTableModel)jTable1.getModel();
d.setRowCount(0);
while(rs.next()){
Vector v2 = new Vector();
for(int i=1; i<=c; i++){
v2.add(rs.getString("ID"));
v2.add(rs.getString("AcademicYear"));
v2.add(rs.getString("AcademicSmester"));
v2.add(rs.getString("Programe"));
v2.add(rs.getString("GroupNumber"));
v2.add(rs.getString("SubGroupNumber"));
v2.add(rs.getString("GroupID"));
v2.add(rs.getString("SubGroupID"));
}
d.addRow(v2);
}
} catch (SQLException ex) {
Logger.getLogger(Student.class.getName()).log(Level.SEVERE, null, ex);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jComboBox1 = new javax.swing.JComboBox<>();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jTextField2 = new javax.swing.JTextField();
jTextField3 = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jLabel8 = new javax.swing.JLabel();
jTextField4 = new javax.swing.JTextField();
jLabel10 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jComboBox2 = new javax.swing.JComboBox<>();
jComboBox3 = new javax.swing.JComboBox<>();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBackground(new java.awt.Color(51, 204, 255));
jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 36)); // NOI18N
jLabel1.setText("Manage Student Groups");
jLabel2.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
jLabel2.setText("Acadamic Year");
jTextField1.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTextField1KeyPressed(evt);
}
});
jLabel3.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
jLabel3.setText("Programme");
jComboBox1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "IT", "CSSE", "CSE", "IM" }));
jComboBox1.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jComboBox1KeyPressed(evt);
}
});
jLabel4.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
jLabel4.setText("Group Number");
jLabel5.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
jLabel5.setText("Sub Group Number");
jLabel6.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
jLabel6.setText("GroupID");
jTextField2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jTextField2MouseClicked(evt);
}
});
jTextField2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField2ActionPerformed(evt);
}
});
jTextField3.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jTextField3MouseClicked(evt);
}
});
jTextField3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField3ActionPerformed(evt);
}
});
jLabel7.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
jLabel7.setText("SubGroupID");
jButton1.setBackground(new java.awt.Color(204, 204, 204));
jButton1.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jButton1.setText("Generate ID");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jTable1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"ID", "Academic Year", "Academic Semester", "Program", "Group No", "SubGroup No", "Group ID", "SubGroup ID"
}
) {
Class[] types = new Class [] {
java.lang.Integer.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
});
jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jTable1MouseClicked(evt);
}
});
jScrollPane1.setViewportView(jTable1);
jButton2.setBackground(new java.awt.Color(204, 204, 204));
jButton2.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/add.jpeg"))); // NOI18N
jButton2.setText("Add");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setBackground(new java.awt.Color(204, 204, 204));
jButton3.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/edit_new.jpeg"))); // NOI18N
jButton3.setText("Edit");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setBackground(new java.awt.Color(204, 204, 204));
jButton4.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/clear.jpeg"))); // NOI18N
jButton4.setText("Delete");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jButton5.setBackground(new java.awt.Color(204, 204, 204));
jButton5.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/clear.jpeg"))); // NOI18N
jButton5.setText("Clear");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jLabel8.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
jLabel8.setText("Academic Semester");
jTextField4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
jLabel10.setBackground(new java.awt.Color(204, 0, 204));
jLabel10.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
jLabel10.setForeground(new java.awt.Color(204, 0, 204));
jLabel10.setText("CAMBRIDGE UNIVERSITY");
jLabel9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Cambridge-United-icon.png"))); // NOI18N
jLabel9.setText("jLabel9");
jComboBox2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "1", "2", "3", "4", "5" }));
jComboBox2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jComboBox2ActionPerformed(evt);
}
});
jComboBox3.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "1", "2" }));
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(40, 40, 40)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(21, 21, 21)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8))
.addGap(23, 23, 23)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 409, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(8, 8, 8)
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 520, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(8, 8, 8)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jComboBox2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jComboBox1, 0, 193, Short.MAX_VALUE)
.addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(126, 126, 126)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(37, 37, 37)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
.addComponent(jTextField3, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
.addComponent(jComboBox3, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(287, 287, 287)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(75, 75, 75))))))))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(144, 144, 144)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(32, 32, 32)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(36, 36, 36)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(44, 44, 44)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(55, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 1075, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 46, Short.MAX_VALUE))))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(31, 31, 31)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(48, 48, 48))
.addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(35, 35, 35)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(33, 33, 33)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(34, 34, 34)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(38, 38, 38)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE)
.addComponent(jComboBox2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 70, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 297, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(37, 37, 37)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(144, 144, 144))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(306, 306, 306)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
String AcademicYear =jTextField1.getText();
String AcademicSmester =jTextField4.getText();
String Programe = jComboBox1.getSelectedItem().toString();
// String value = jSpinner1.getValue().toString();
//String value1 = jSpinner1.getValue().toString();
String value = jComboBox2.getSelectedItem().toString();
String value1 = jComboBox3.getSelectedItem().toString();
String GroupID = AcademicYear+"."+AcademicSmester+"."+Programe+"."+value;
jTextField2.setText(String.valueOf(GroupID));
String SubGroupID = GroupID+"."+value1;
jTextField3.setText(String.valueOf(SubGroupID));
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
try {
String AcadamicYear = jTextField1.getText();
String AcademicSemester= jTextField4.getText();
String Programe =jComboBox1.getSelectedItem().toString();
// Integer groupnumber = (Integer)jSpinner1.getValue();
// String GroupNumber = groupnumber.toString();
// Integer subgroupnumber = (Integer)jSpinner1.getValue();
// String SubGroupNumber = subgroupnumber.toString();
String GroupNumber =jComboBox2.getSelectedItem().toString();
String SubGroupNumber =jComboBox3.getSelectedItem().toString();
String GroupID = jTextField3.getText();
String SubGroupID = jTextField4.getText();
pst = con.prepareStatement("insert into student(AcademicYear,AcademicSmester,Programe,GroupNumber,SubGroupNumber,GroupID,SubGroupID)values(?,?,?,?,?,?,?)");
pst.setString(1, AcadamicYear);
pst.setString(2, AcademicSemester);
pst.setString(3, Programe);
pst.setString(4, GroupNumber);
pst.setString(5, SubGroupNumber);
pst.setString(6, jTextField2.getText());
pst.setString(7, jTextField3.getText());
pst.executeUpdate();
JOptionPane.showMessageDialog(this, "StudentGroup Addddeeeeeed");
jTextField1.setText("");
jTextField4.setText("");
jComboBox1.setSelectedIndex(-1);
// jSpinner1.setValue("");
//jSpinner2.setValue("");
jComboBox2.setSelectedItem(-1);
jComboBox3.setSelectedItem(-1);
jTextField2.setText("");
jTextField3.setText("");
jTextField1.requestFocus();
load();
} catch (SQLException ex) {
Logger.getLogger(Student.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
// TODO add your handling code here:
jButton2.setEnabled(true);
jTextField1.setText("");
jTextField4.setText("");
jComboBox1.setSelectedIndex(-1);
// jSpinner1.setValue("");
//jSpinner2.setValue("");
jComboBox2.setSelectedIndex(-1);
jComboBox3.setSelectedIndex(-1);
jTextField2.setText("");
jTextField3.setText("");
jTextField1.requestFocus();
load();
}//GEN-LAST:event_jButton5ActionPerformed
private void jTextField1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField1KeyPressed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField1KeyPressed
private void jComboBox1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jComboBox1KeyPressed
// TODO add your handling code here:
}//GEN-LAST:event_jComboBox1KeyPressed
private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
// TODO add your handling code here:
d = (DefaultTableModel)jTable1.getModel();
int selectIndex = jTable1.getSelectedRow();
String ID = d.getValueAt(selectIndex, 0).toString();
jTextField1.setText(d.getValueAt(selectIndex, 1).toString());
jTextField4.setText(d.getValueAt(selectIndex, 2).toString());
jComboBox1.setSelectedItem(d.getValueAt(selectIndex, 3).toString());
// jSpinner1.setValue(d.getValueAt(selectIndex, 4).toString());
// jSpinner2.setValue(d.getValueAt(selectIndex, 5).toString());
jComboBox2.setSelectedItem(d.getValueAt(selectIndex, 4).toString());
jComboBox3.setSelectedItem(d.getValueAt(selectIndex, 5).toString());
jTextField2.setText(d.getValueAt(selectIndex, 6).toString());
jTextField3.setText(d.getValueAt(selectIndex, 7).toString());
jButton2.setEnabled(false);
}//GEN-LAST:event_jTable1MouseClicked
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
// TODO add your handling code here:
try {
d = (DefaultTableModel)jTable1.getModel();
int selectIndex = jTable1.getSelectedRow();
String ID = d.getValueAt(selectIndex, 0).toString();
String AcadamicYear = jTextField1.getText();
String AcademicSemester=jTextField4.getText();
String Programe =jComboBox1.getSelectedItem().toString();
//Integer groupnumber = (Integer)jSpinner1.getValue();
//String GroupNumber = groupnumber.toString();
//Integer subgroupnumber = (Integer)jSpinner2.getValue();
//String SubGroupNumber = subgroupnumber.toString();
String GroupNumber =jComboBox2.getSelectedItem().toString();
String SubGroupNumber =jComboBox3.getSelectedItem().toString();
String GroupID = jTextField2.getText();
String SubGroupID = jTextField3.getText();
pst = con.prepareStatement("update student set AcademicYear =?, AcademicSmester=?, Programe=?, GroupNumber=?, SubGroupNumber=?,GroupID=?,SubGroupID=? where ID = ?");
pst.setString(1, AcadamicYear);
pst.setString(2, AcademicSemester);
pst.setString(3, Programe);
pst.setString(4, GroupNumber);
pst.setString(5, SubGroupNumber);
pst.setString(6, GroupID);
pst.setString(7, SubGroupID);
pst.setString(8, ID);
pst.executeUpdate();
JOptionPane.showMessageDialog(this, "Student Updated");
jButton2.setEnabled(true);
jTextField1.setText("");
jTextField4.setText("");
jComboBox1.setSelectedIndex(-1);
// jSpinner1.setValue("");
//jSpinner2.setValue("");
jComboBox2.setSelectedIndex(-1);
jComboBox3.setSelectedIndex(-1);
jTextField2.setText("");
jTextField3.setText("");
jTextField1.requestFocus();
load();
} catch (SQLException ex) {
Logger.getLogger(Student.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
// TODO add your handling code here:
try {
d = (DefaultTableModel)jTable1.getModel();
int selectIndex = jTable1.getSelectedRow();
String ID = d.getValueAt(selectIndex, 0).toString();
pst = con.prepareStatement("delete from student where ID = ?");
pst.setString(1, ID);
pst.executeUpdate();
JOptionPane.showMessageDialog(this, "StudentGroup Deleted");
jButton2.setEnabled(true);
jTextField1.setText("");
jTextField4.setText("");
jComboBox1.setSelectedIndex(-1);
// jSpinner1.setValue("");
// jSpinner2.setValue("");
jComboBox2.setSelectedIndex(-1);
jComboBox3.setSelectedIndex(-1);
jTextField2.setText("");
jTextField3.setText("");
jTextField1.requestFocus();
load();
} catch (SQLException ex) {
Logger.getLogger(Student.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_jButton4ActionPerformed
private void jTextField2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField2MouseClicked
// TODO add your handling code here:
/*
String AcademicYear =jTextField1.getText();
String AcademicSmester =jTextField4.getText();
String Programe = jComboBox1.getSelectedItem().toString();
String GroupNumber = jSpinner1.getValue().toString();
String GroupID = AcademicYear+"."+AcademicSmester+"."+Programe+"."+GroupNumber;
jTextField2.setText(String.valueOf(GroupID));
*/
}//GEN-LAST:event_jTextField2MouseClicked
private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField2ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField2ActionPerformed
private void jTextField3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField3ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextField3ActionPerformed
private void jTextField3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTextField3MouseClicked
// TODO add your handling code here:
/*String AcademicYear =jTextField1.getText();
String AcademicSmester =jTextField4.getText();
String Programe = jComboBox1.getSelectedItem().toString();
String GroupNumber = jSpinner1.getValue().toString();
String SubGroupNumber = jSpinner2.getValue().toString();
String SubGroupID = AcademicYear+"."+AcademicSmester+"."+Programe+"."+GroupNumber+"."+SubGroupNumber;
jTextField3.setText(String.valueOf(SubGroupID));
*/
}//GEN-LAST:event_jTextField3MouseClicked
private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jComboBox2ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Student.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Student.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Student.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Student.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Student().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JComboBox<String> jComboBox1;
private javax.swing.JComboBox<String> jComboBox2;
private javax.swing.JComboBox<String> jComboBox3;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
// End of variables declaration//GEN-END:variables
}
| [
"IT19010472@my.sliit.lk"
] | IT19010472@my.sliit.lk |
054a06bf4f73846da9bedc288c74f3e1716f8a13 | 49085b7612ac681a50e74f3b9c9f58765c53ebf9 | /src/com/tutorialspoint7/StudentDAO.java | 8730a6625564c8b64fb31849edde7556a5c28a96 | [] | no_license | learnlong/spring | 85e40dc79aa08955ec521c17ece1553477c540dd | 8dee758831c337ad1c631e043ace90751a5e587e | refs/heads/master | 2020-03-23T06:44:20.959843 | 2018-08-01T03:02:24 | 2018-08-01T03:02:24 | 141,226,508 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 292 | java | package com.tutorialspoint7;
import java.util.List;
import javax.sql.DataSource;
public interface StudentDAO {
public void setDataSource(DataSource ds);
public void create(String name,Integer age,Integer marks,Integer year);
public List<StudentMarks> listStudents();
}
| [
"28563410399@qq.com"
] | 28563410399@qq.com |
df165e5e87f590c0c37e9e0c45d175b261c7082e | 068915043f2a2d0778d731941de6db84a2f31502 | /java_learn/src/main/java/com/github/chuangkel/java_learn/pattern/action/observer/observerIml/GaoFuShuai.java | a94a63861fa54aa3c44704399b9c066b4ddaf668 | [] | no_license | chuangkel/learn | f6399f556eb7549dd5eb543eed5807a1c38abb3c | 834d9bf7fb3fba42a27d4afe100e7dcb59677879 | refs/heads/master | 2021-06-24T15:47:24.967159 | 2021-02-01T05:45:04 | 2021-02-01T05:45:04 | 188,183,745 | 0 | 0 | null | 2019-11-12T12:11:05 | 2019-05-23T07:29:51 | Java | UTF-8 | Java | false | false | 1,993 | java | /**
* <html>
* <body>
* <P> Copyright 1994 JsonInternational</p>
* <p> All rights reserved.</p>
* <p> Created on 19941115</p>
* <p> Created by Jason</p>
* </body>
* </html>
*/
package com.github.chuangkel.java_learn.pattern.action.observer.observerIml;
//import com.pattern.action.observer.observerAbs.Observer;
import com.github.chuangkel.java_learn.pattern.action.observer.observerAbs.Observer;
/**
* @Package:com.pattern.action.observer.observerIml
* @ClassName:GaoFuShuai
* @Description: <p> 观察者对象 - 高富帅 </p>
* @Author: - Jason
* @CreatTime:
* @Modify By:
* @ModifyTime:
* @Modify marker:
* @version V1.0
*/
public class GaoFuShuai implements Observer {
/**
* 名字
*/
private String name;
/**
* 资产
*/
private Long property;
/**
* 备注
*/
private String Remark;
@Override
public void Update() {
System.out.println("Hello , I'm GaoFuShuai .My Name is " + name);
}
@Override
public void Say() {
System.out.println("Little sister ,小姐姐约吗? My Wechat is " + property);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getProperty() {
return property;
}
public void setProperty(Long property) {
this.property = property;
}
public String getRemark() {
return Remark;
}
public void setRemark(String remark) {
Remark = remark;
}
/**
* GaoFuShuai.
* @param name
* @param property
* @param remark
*/
public GaoFuShuai(String name, Long property, String remark) {
super();
this.name = name;
this.property = property;
Remark = remark;
}
@Override
public String toString() {
return "I'm GaoFuShuai [name=" + name + ", property=" + property + ", Remark=" + Remark + "]";
}
}
| [
"2010344124@qq.com"
] | 2010344124@qq.com |
1caf405550dad771cb58d1fd3643415eacfe0456 | 44ced49c3c680e89535fffc0ff5dc83b05ce1114 | /src/edu/isi/pegasus/planner/catalog/site/impl/old/Text.java | 642d1440ca81c08546a19edb03d240d3d8118c1d | [
"Apache-2.0"
] | permissive | Farisllwaah/pegasus | 143edf34acbd1381de4eccb3405fd38d6940a591 | 037653fc3a8742294e183f72a41a6b1c9b0f6ce3 | refs/heads/master | 2021-01-12T21:45:15.535050 | 2015-01-22T01:22:53 | 2015-01-22T01:22:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,113 | java | /**
* Copyright 2007-2008 University Of Southern California
*
* 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 edu.isi.pegasus.planner.catalog.site.impl.old;
import edu.isi.pegasus.planner.catalog.site.impl.old.classes.PoolConfig;
import edu.isi.pegasus.planner.parser.ScannerException;
import edu.isi.pegasus.planner.parser.SiteCatalogTextParser;
import edu.isi.pegasus.common.logging.LogManager;
import java.io.FileReader;
import java.io.IOException;
/**
* It gets the information about a pool by reading the multiline site
* catalog that is in a multiline format.
*
* @author Gaurang Mehta gmehta@isi.edu
* @author Karan Vahi vahi@isi.edu
* @version $Revision$
*/
public class Text
extends Abstract {
/**
* The internal singleton handle.
*/
private static Text mPoolHandle = null;
/**
* The private constructor that is called only once, when the Singleton is
* invoked for the first time.
*
* @param poolProvider the path to the file that contains the pool
* information in the multiline text format.
*/
private Text( String poolProvider ) {
loadSingletonObjects();
if ( poolProvider == null ) {
throw new RuntimeException(
" Wrong Call to the Singleton invocation of Site Catalog" );
}
this.mPoolProvider = poolProvider;
mPoolConfig = new PoolConfig();
try {
String msg = "Reading " + this.mPoolProvider;
mLogger.log( msg,LogManager.DEBUG_MESSAGE_LEVEL );
SiteCatalogTextParser p = new SiteCatalogTextParser( new FileReader(
this.mPoolProvider ) );
mPoolConfig = p.parse();
mLogger.log( msg + " -DONE", LogManager.DEBUG_MESSAGE_LEVEL);
} catch ( ScannerException pce ) {
mLogger.log( this.mPoolProvider + ": 1" + pce.getMessage(),
LogManager.ERROR_MESSAGE_LEVEL );
} catch ( IOException ioe ) {
mLogger.log( this.mPoolProvider + ": 2" + ioe.getMessage(),
LogManager.ERROR_MESSAGE_LEVEL );
} catch ( Exception e ) {
mLogger.log( this.mPoolProvider + ": 3" + e.getMessage(),
LogManager.ERROR_MESSAGE_LEVEL );
}
mLogger.log( "SC Mode being used is " + this.getPoolMode(),
LogManager.CONFIG_MESSAGE_LEVEL);
mLogger.log( "SC File being used is " + this.mPoolProvider,
LogManager.CONFIG_MESSAGE_LEVEL);
mLogger.log( mPoolConfig.getSites().size() +
" sites loaded in memory", LogManager.DEBUG_MESSAGE_LEVEL);
}
/**
* The private constructor that is called to return a non singleton instance
* of the class.
*
* @param poolProvider the path to the file that contains the pool
* information in the xml format.
* @param propFileName the name of the properties file that needs to be
* picked up from PEGASUS_HOME/etc directory.If it is null,
* then the default properties file should be picked up.
*
*/
private Text( String poolProvider, String propFileName ) {
loadNonSingletonObjects( propFileName );
this.mPoolProvider = poolProvider;
mPoolConfig = new PoolConfig();
try {
String msg = "Reading " + this.mPoolProvider;
mLogger.log( msg, LogManager.DEBUG_MESSAGE_LEVEL);
SiteCatalogTextParser p = new SiteCatalogTextParser( new FileReader(
this.mPoolProvider ) );
mPoolConfig = p.parse();
mLogger.log( msg + " -DONE",LogManager.DEBUG_MESSAGE_LEVEL );
} catch ( ScannerException pce ) {
mLogger.log( this.mPoolProvider + ": 1" + pce.getMessage(),
LogManager.ERROR_MESSAGE_LEVEL );
} catch ( IOException ioe ) {
mLogger.log( this.mPoolProvider + ": 2" + ioe.getMessage(),
LogManager.ERROR_MESSAGE_LEVEL );
} catch ( Exception e ) {
mLogger.log( this.mPoolProvider + ": 3" + e.getMessage(),
LogManager.ERROR_MESSAGE_LEVEL );
}
mLogger.log( "SC Mode being used is " + this.getPoolMode(),
LogManager.CONFIG_MESSAGE_LEVEL );
mLogger.log( "SC File being used is " + this.mPoolProvider,
LogManager.CONFIG_MESSAGE_LEVEL );
mLogger.log( mPoolConfig.getSites().size() +
" sites loaded in memory", LogManager.DEBUG_MESSAGE_LEVEL );
}
/**
* Returns a textual description about the pool mode that is
* implemented by this class. It is purely informative.
*
* @return String corresponding to the description.
*/
public String getPoolMode() {
String st =
"Multiple Line Site Catalog";
return st;
}
/**
* The method returns a singleton instance of the derived InfoProvider class.
*
* @param poolProvider the path to the file containing the pool information.
* @param propFileName the name of the properties file that needs to be
* picked up from PEGASUS_HOME/etc directory. In the singleton
* case only the default properties file is picked up.
*
* @return a singleton instance of this class.
*/
public static PoolInfoProvider singletonInstance( String poolProvider,
String propFileName ) {
if ( mPoolHandle == null ) {
mPoolHandle = new Text( poolProvider );
}
return mPoolHandle;
}
/**
* The method that returns a Non Singleton instance of the dervived
* InfoProvider class. This method if invoked should also ensure that all
* other internal Pegasus objects like PegasusProperties are invoked in a non
* singleton manner.
*
* @param poolProvider the path to the file containing the pool information.
* @param propFileName the name of the properties file that needs to be
* picked up from PEGASUS_HOME/etc directory. If it is null,
* then the default file should be picked up.
*
* @return the non singleton instance of the pool provider.
*
*/
public static PoolInfoProvider nonSingletonInstance( String poolProvider,
String propFileName ) {
mPoolHandle = new Text( poolProvider, propFileName );
return mPoolHandle;
}
}
| [
"vahi@isi.edu"
] | vahi@isi.edu |
c74bc4d2417b2650c59118484210b6ffd3392fbe | 7cc0c9ec45c22aa23d888992ec961a9eb531fa64 | /Java/DailyFlash/20Oct/prog1.java | 2a7b16ef1fa295ac45db07bb6afcc4fa6b16ecc9 | [] | no_license | Audarya07/Core2Web | 1ae8d784258006e27ad586e1a3779b45d054c0f5 | 78b97bcbf62d28a88407806dca8b2f050329d266 | refs/heads/master | 2023-02-01T07:56:04.866347 | 2020-12-18T18:24:54 | 2020-12-18T18:24:54 | 279,018,658 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 417 | java | import java.util.Scanner;
class Prog1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter string:");
String s1 = sc.nextLine();
int cnt = 0;
for (int i = 0; i < s1.length(); i++) {
char ch = s1.charAt(i);
if(ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u')
cnt++;
}
System.out.println("Number of Vowels = " + cnt);
}
} | [
"audiuttarwar2000@gmail.com"
] | audiuttarwar2000@gmail.com |
8007702bcd27026932ea622908eab90c9a8b8a51 | 989d9da38ece4a524370609c7a4d66ca22d02c8b | /src/org/webcat/core/lti/LTILaunchRequest.java | c1ade5266f3532ee11def9cda0af5162f997fc97 | [] | no_license | web-cat/web-cat-subsystem-Core | c4db873a55543b7711c823b577d060b34e6b7b3e | 0a50a2bd0b6ee03e34ffdd2d7c8786ffafdb09df | refs/heads/master | 2022-10-19T08:55:03.235308 | 2022-10-06T01:08:39 | 2022-10-06T01:08:39 | 117,036,190 | 3 | 2 | null | 2020-02-24T17:54:22 | 2018-01-11T02:00:24 | Java | UTF-8 | Java | false | false | 25,563 | java | /*==========================================================================*\
| Copyright (C) 2018-2021 Virginia Tech
|
| This file is part of Web-CAT.
|
| Web-CAT is free software; you can redistribute it and/or modify
| it under the terms of the GNU Affero General Public License as published
| by the Free Software Foundation; either version 3 of the License, or
| (at your option) any later version.
|
| Web-CAT 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 Affero General Public License
| along with Web-CAT; if not, see <http://www.gnu.org/licenses/>.
\*==========================================================================*/
package org.webcat.core.lti;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import org.webcat.core.Application;
import org.webcat.core.AuthenticationDomain;
import org.webcat.core.Course;
import org.webcat.core.CourseOffering;
import org.webcat.core.Department;
import org.webcat.core.Semester;
import org.webcat.core.User;
import org.webcat.woextensions.WCEC;
import net.oauth.OAuth;
import net.oauth.OAuthAccessor;
import net.oauth.OAuthConsumer;
import net.oauth.OAuthMessage;
import net.oauth.OAuthValidator;
import net.oauth.SimpleOAuthValidator;
import com.webobjects.appserver.WOContext;
import com.webobjects.appserver.WORequest;
import com.webobjects.foundation.NSArray;
import com.webobjects.foundation.NSMutableArray;
//-------------------------------------------------------------------------
/**
* Represents an LTI launch request from an LTI Consumer.
*
* @author Stephen Edwards
*/
public class LTILaunchRequest
{
//~ Instance/static fields ................................................
public static final String CONTEXT_ID = "context_id";
public static final String CONTEXT_LABEL = "context_label";
public static final String CONTEXT_TITLE = "context_title";
public static final String CUSTOM_CANVAS_API_DOMAIN =
"custom_canvas_api_domain";
public static final String CUSTOM_CANVAS_ASSIGNMENT_ID =
"custom_canvas_assignment_id";
public static final String CUSTOM_CANVAS_ASSIGNMENT_POINTS_POSSIBLE =
"custom_canvas_assignment_points_possible";
public static final String CUSTOM_CANVAS_ASSIGNMENT_TITLE =
"custom_canvas_assignment_title";
public static final String CUSTOM_CANVAS_COURSE_ID =
"custom_canvas_course_id";
public static final String CUSTOM_CANVAS_ENROLLMENT_STATE =
"custom_canvas_enrollment_state";
public static final String CUSTOM_CANVAS_USER_ID = "custom_canvas_user_id";
public static final String CUSTOM_CANVAS_USER_LOGIN_ID =
"custom_canvas_user_login_id";
public static final String CUSTOM_CANVAS_WORKFLOW_STATE =
"custom_canvas_workflow_state";
public static final String EXT_IMS_LIS_BASIC_OUTCOME_URL =
"ext_ims_lis_basic_outcome_url";
public static final String EXT_LTI_ASSIGNMENT_ID = "ext_lti_assignment_id";
public static final String EXT_OUTCOME_DATA_VALUES_ACCEPTED =
"ext_outcome_data_values_accepted";
public static final String EXT_OUTCOME_RESULT_TOTAL_SCORE_ACCEPTED =
"ext_outcome_result_total_score_accepted";
public static final String EXT_OUTCOMES_TOOL_PLACEMENT_URL =
"ext_outcomes_tool_placement_url";
public static final String EXT_ROLES = "ext_roles";
public static final String LAUNCH_PRESENTATION_DOCUMENT_TARGET =
"launch_presentation_document_target";
public static final String LAUNCH_PRESENTATION_LOCALE =
"launch_presentation_locale";
public static final String LAUNCH_PRESENTATION_RETURN_URL =
"launch_presentation_return_url";
public static final String LIS_COURSE_OFFERING_SOURCEDID =
"lis_course_offering_sourcedid";
public static final String LIS_OUTCOME_SERVICE_URL =
"lis_outcome_service_url";
public static final String LIS_PERSON_CONTACT_EMAIL_PRIMARY =
"lis_person_contact_email_primary";
public static final String LIS_PERSON_NAME_FAMILY =
"lis_person_name_family";
public static final String LIS_PERSON_NAME_FULL = "lis_person_name_full";
public static final String LIS_PERSON_NAME_GIVEN = "lis_person_name_given";
public static final String LIS_PERSON_SOURCEDID = "lis_person_sourcedid";
public static final String LIS_RESULT_SOURCEDID =
"lis_result_sourcedid";
public static final String LTI_MESSAGE_TYPE = "lti_message_type";
public static final String LTI_VERSION = "lti_version";
public static final String RESOURCE_LINK_ID = "resource_link_id";
public static final String RESOURCE_LINK_TITLE = "resource_link_title";
public static final String ROLES = "roles";
public static final String TOOL_CONSUMER_INFO_PRODUCT_FAMILY_CODE =
"tool_consumer_info_product_family_code";
public static final String TOOL_CONSUMER_INFO_VERSION =
"tool_consumer_info_version";
public static final String TOOL_CONSUMER_INSTANCE_CONTACT_EMAIL =
"tool_consumer_instance_contact_email";
public static final String TOOL_CONSUMER_INSTANCE_GUID =
"tool_consumer_instance_guid";
public static final String TOOL_CONSUMER_INSTANCE_NAME =
"tool_consumer_instance_name";
public static final String USER_ID = "user_id";
public static final String USER_IMAGE = "user_image";
//~ Constructors ..........................................................
// ----------------------------------------------------------
public LTILaunchRequest(WOContext context, WCEC ec)
{
this.context = context;
this.request = context.request();
this.ec = ec;
}
//~ Methods ...............................................................
// ----------------------------------------------------------
public boolean isValid()
{
String consumerKey = get(OAUTH_CONSUMER_KEY);
if (consumerKey == null)
{
return false;
}
LMSInstance lms = LMSInstance.uniqueObjectMatchingValues(
ec, LMSInstance.CONSUMER_KEY_KEY, consumerKey);
if (lms == null)
{
return false;
}
String consumerSecret = lms.consumerSecret();
String apiUrl = Application.completeURLWithRequestHandlerKey(context,
"wa", "ltiLaunch", null, true, 0);
List<OAuth.Parameter> params = new ArrayList<OAuth.Parameter>();
for (String key : request.formValueKeys())
{
for (Object value : request.formValuesForKey(key))
{
params.add(new OAuth.Parameter(key, value.toString()));
}
}
if (log.isDebugEnabled())
{
log.debug("lti launch request received: " + params);
}
OAuthMessage message = new OAuthMessage("POST", apiUrl, params);
OAuthConsumer consumer =
new OAuthConsumer(null, consumerKey, consumerSecret, null);
OAuthAccessor accessor = new OAuthAccessor(consumer);
try
{
VALIDATOR.validateMessage(message, accessor);
return true;
}
catch (Exception e)
{
log.error("request is invalid: " + e.getClass().getSimpleName()
+ ": " + e.getMessage());
return false;
}
}
// ----------------------------------------------------------
public String get(String key)
{
return request.stringFormValueForKey(key);
}
// ----------------------------------------------------------
public LMSInstance lmsInstance()
{
if (lmsInstance == null)
{
lmsInstance = LMSInstance.uniqueObjectMatchingQualifier(ec,
LMSInstance.consumerKey.is(
request.stringFormValueForKey(OAUTH_CONSUMER_KEY)));
}
return lmsInstance;
}
// ----------------------------------------------------------
public String userId()
{
return request.stringFormValueForKey(USER_ID);
}
// ----------------------------------------------------------
public User user()
{
if (user == null)
{
AuthenticationDomain d = lmsInstance().authenticationDomain();
LMSIdentity identity = LMSIdentity.firstObjectMatchingQualifier(
ec, LMSIdentity.lmsUserId.is(userId()), null);
if (identity != null)
{
user = identity.user();
}
else
{
String email = get(LIS_PERSON_CONTACT_EMAIL_PRIMARY);
if (email != null)
{
NSArray<User> users = User.objectsMatchingQualifier(ec,
User.email.is(email)
.and(User.authenticationDomain.is(d)));
if (users.size() > 1)
{
String msg = "Multiple users with e-mail address '"
+ email + "' in domain " + d;
log.error(msg);
throw new IllegalStateException(msg);
}
if (users.size() == 0)
{
users = User.objectsMatchingQualifier(ec,
User.email.is(email));
if (users.size() > 1)
{
String msg = "Multiple users with e-mail "
+ "address '" + email + "'";
log.error(msg);
throw new IllegalStateException(msg);
}
else if (users.size() == 1)
{
user = users.get(0);
log.error("user '" + email
+ "' logging in through LMS Instance "
+ lmsInstance()
+ " associated with " + d
+ ", but user belongs to "
+ user.authenticationDomain());
}
}
if (users.size() == 0)
{
String userName = get(CUSTOM_CANVAS_USER_LOGIN_ID);
if (userName != null)
{
users = User.objectsMatchingQualifier(ec,
User.userName.is(userName)
.and(User.authenticationDomain.is(d)));
if (users.size() > 1)
{
String msg = "Multiple users with user name '"
+ userName + "' in domain " + d;
log.error(msg);
throw new IllegalStateException(msg);
}
}
}
if (users.size() == 0)
{
String userName = email;
int pos = userName.indexOf('@');
if (pos > 0)
{
userName = userName.substring(0, pos);
}
users = User.objectsMatchingQualifier(ec,
User.userName.is(userName)
.and(User.authenticationDomain.is(d)));
if (users.size() > 1)
{
String msg = "Multiple users with user name '"
+ userName + "' in domain " + d;
log.error(msg);
throw new IllegalStateException(msg);
}
}
if (users.size() == 1)
{
user = users.get(0);
}
}
if (user == null)
{
String userName = get(CUSTOM_CANVAS_USER_LOGIN_ID);
if (userName != null)
{
NSArray<User> users = User.objectsMatchingQualifier(ec,
User.userName.is(userName)
.and(User.authenticationDomain.is(d)));
if (users.size() == 1)
{
user = users.get(0);
}
else if (users.size() > 1)
{
String msg = "Multiple users with userName '"
+ userName + "' in domain " + d;
log.error(msg);
throw new IllegalStateException(msg);
}
}
}
if (user != null)
{
// Add LMSIdentity, since it is missing
LMSIdentity.create(ec, userId(), lmsInstance, user);
ec.saveChanges();
}
}
if (user == null)
{
// Automatically add user
String email = get(LIS_PERSON_CONTACT_EMAIL_PRIMARY);
String userName = get(CUSTOM_CANVAS_USER_LOGIN_ID);
if (userName == null)
{
if (email != null)
{
userName = email;
int pos = userName.indexOf('@');
if (pos > 0)
{
userName = userName.substring(0, pos);
}
}
if (userName == null)
{
// FIXME: need a better choice here
userName = userId();
}
if (User.firstObjectMatchingQualifier(ec,
User.userName.is(userName)
.and(User.authenticationDomain.is(d)), null) != null)
{
String msg = "User not found with LTI user id "
+ userId() + ", but cannot create new user with "
+ "userName '" + userName + "' since one "
+ "already exists in " + d;
log.error(msg);
throw new IllegalStateException(msg);
}
}
user = User.createUser(
userName,
null, // DO NOT MIRROR PASSWORD IN DATABASE
// for security reasons
d,
User.STUDENT_PRIVILEGES,
ec
);
if (email != null)
{
user.setEmail(email);
}
LMSIdentity.create(ec, userId(), lmsInstance, user);
ec.saveChanges();
}
if (user != null)
{
if (user.accessLevel() < User.INSTRUCTOR_PRIVILEGES
&& isInstructor())
{
// Promote User to instructor-level access, if needed
user.setAccessLevel(User.INSTRUCTOR_PRIVILEGES);
}
if (user.firstName() == null)
{
String first = get(LIS_PERSON_NAME_GIVEN);
if (first != null)
{
user.setFirstName(first);
}
}
if (user.lastName() == null)
{
String last = get(LIS_PERSON_NAME_FAMILY);
if (last != null)
{
user.setLastName(last);
}
}
if (user.changesFromCommittedSnapshot().size() > 0)
{
ec.saveChanges();
}
}
}
return user;
}
// ----------------------------------------------------------
public boolean isInIFrame()
{
String target = request.stringFormValueForKey(
LAUNCH_PRESENTATION_DOCUMENT_TARGET);
return target != null && target.toLowerCase().equals("iframe");
}
// ----------------------------------------------------------
public boolean isInstructor()
{
NSArray<Object> roles = request.formValuesForKey(ROLES);
boolean result = false;
for (int i = 0; i < roles.size(); i++)
{
Object o = roles.get(i);
if (o != null)
{
String role = o.toString().toLowerCase();
if (role.contains("instructor")
|| role.contains("teacher")
|| role.contains("designer")
|| role.contains("consultant"))
{
result = true;
break;
}
}
}
return result;
}
// ----------------------------------------------------------
public String lisOutcomeServiceUrl()
{
return request.stringFormValueForKey(LIS_OUTCOME_SERVICE_URL);
}
// ----------------------------------------------------------
public String lisResultSourcedId()
{
return request.stringFormValueForKey(LIS_RESULT_SOURCEDID);
}
// ----------------------------------------------------------
public String courseName()
{
return request.stringFormValueForKey(CONTEXT_TITLE);
}
// ----------------------------------------------------------
public String courseLabel()
{
return request.stringFormValueForKey(CONTEXT_LABEL);
}
// ----------------------------------------------------------
public String courseOfferingId()
{
return request.stringFormValueForKey(CONTEXT_ID);
}
// ----------------------------------------------------------
public NSArray<CourseOffering> courseOfferings()
{
String contextId = get(CONTEXT_ID);
NSArray<CourseOffering> result = CourseOffering
.objectsMatchingQualifier(ec,
CourseOffering.lmsContextId.is(contextId));
{
String canvasId = get(CUSTOM_CANVAS_COURSE_ID);
NSArray<CourseOffering> canvasResult = null;
if (canvasId != null && !"".equals(canvasId))
{
canvasResult = CourseOffering.objectsMatchingQualifier(ec,
CourseOffering.lmsContextId.is(canvasId));
}
else
{
canvasResult = new NSArray<CourseOffering>();
}
String labelId = get(CONTEXT_LABEL);
NSArray<CourseOffering> labelResult = null;
if (labelId != null && !"".equals(labelId))
{
labelResult = CourseOffering.objectsMatchingQualifier(ec,
CourseOffering.lmsContextId.is(labelId));
}
else
{
labelResult = new NSArray<CourseOffering>();
}
if (canvasResult.count() > 0 || labelResult.count() > 0)
{
NSMutableArray<CourseOffering> newResults =
new NSMutableArray<CourseOffering>();
if (!contextId.equals(canvasId))
{
newResults.addAll(canvasResult);
}
if (!contextId.equals(labelId))
{
newResults.addAll(labelResult);
}
// Update all matching course ids to the proper value
boolean needsSave = false;
for (CourseOffering co : newResults)
{
if (!contextId.equals(co.lmsContextId()))
{
co.setLmsContextId(contextId);
needsSave = true;
}
}
if (needsSave)
{
ec.saveChanges();
}
newResults.addAll(result);
result = newResults;
}
}
LMSInstance lms = lmsInstance();
if (lms != null && result.count() > 0)
{
// Update all matching courses to the proper lmsInstance value
boolean needsSave = false;
for (CourseOffering co : result)
{
LMSInstance thisLms = co.lmsInstance();
if (!lms.equals(thisLms))
{
if (thisLms != null)
{
log.error("course offering " + co + " matches LTI "
+ "request from LTI consumer " + lms + " but "
+ "is associated with " + thisLms + ": forcing to "
+ lms);
}
co.setLmsInstanceRelationship(lms);
needsSave = true;
}
}
if (needsSave)
{
ec.saveChanges();
}
}
log.debug("courseOfferings() = " + result);
return result;
}
// ----------------------------------------------------------
public NSArray<CourseOffering> filterCoursesForUser(
User aUser, NSArray<CourseOffering> courses)
{
if (courses.count() > 0 && aUser != null)
{
NSMutableArray<CourseOffering> filtered =
new NSMutableArray<CourseOffering>();
for (CourseOffering co : courses)
{
if (co.students().contains(aUser) || co.isStaff(aUser))
{
filtered.add(co);
}
}
return filtered;
}
return courses;
}
// ----------------------------------------------------------
public NSArray<CourseOffering> suggestedCourseOfferings(User aUser)
{
return suggestedCourseOfferings(aUser,
Semester.allObjectsOrderedByStartDate(ec).get(0));
}
// ----------------------------------------------------------
public NSArray<CourseOffering> suggestedCourseOfferings(
User aUser, Semester semester)
{
NSArray<CourseOffering> result = null;
String courseId = get(CONTEXT_LABEL);
if (courseId != null && aUser != null)
{
log.debug("processing course label: " + courseId);
courseId = courseId.replaceAll("[^A-Za-z0-9 ]", " ");
log.debug("processing course label: " + courseId);
courseId = courseId.replaceAll("([0-9]+) .*$", "$1");
log.debug("processing course label: " + courseId);
String courseNumber =
courseId.replaceAll("^[^0-9]*([0-9]+).*$", "$1");
log.debug("course number: " + courseNumber);
try
{
int num = Integer.parseInt(courseNumber);
// Could eventually add dept abbrev too
result = CourseOffering.objectsMatchingQualifier(ec,
CourseOffering.course.dot(Course.number).is(num).and(
CourseOffering.course.dot(Course.department)
.dot(Department.institution)
.is(lmsInstance().authenticationDomain())).and(
CourseOffering.semester.is(semester)));
// Filter to courses this user can manage
NSMutableArray<CourseOffering> filtered =
new NSMutableArray<CourseOffering>();
for (CourseOffering co : result)
{
if (co.isInstructor(aUser) || aUser.hasAdminPrivileges())
{
filtered.add(co);
}
}
result = filtered;
}
catch (Exception e)
{
log.info("Unable to extract course number from '"
+ courseId + "'", e);
}
}
if (result == null)
{
result = new NSArray<CourseOffering>();
}
log.debug("suggestedCourseOfferings() = " + result);
return result;
}
// ----------------------------------------------------------
public WORequest rawRequest()
{
return request;
}
//~ Instance/static fields ................................................
private WOContext context;
private WORequest request;
protected WCEC ec;
private LMSInstance lmsInstance;
private User user;
private static final String OAUTH_CONSUMER_KEY = "oauth_consumer_key";
private static OAuthValidator VALIDATOR = new SimpleOAuthValidator();
static Logger log = Logger.getLogger(LTILaunchRequest.class);
}
| [
"edwards@cs.vt.edu"
] | edwards@cs.vt.edu |
8117c267a09e2b95b0a468bcdd1f3144ea657997 | 96afbc3165ac24c6be2d1cd9ec19c7e07ecc05ff | /src/main/java/eu/mihosoft/vmf/core/DelegationInfo.java | 0358088d544387f0af28d77b457b6bc9095daff1 | [
"Apache-2.0"
] | permissive | chandra1123/VMF | b81f240567a9725d3b0b2b339e57589dad547d0d | b931f6f08923c2bdf245c2c63d96313dfea3ba9d | refs/heads/master | 2020-03-23T09:27:19.732898 | 2018-07-16T20:42:38 | 2018-07-16T20:42:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,995 | java | /*
* Copyright 2017-2018 Michael Hoffer <info@michaelhoffer.de>. All rights reserved.
* Copyright 2017-2018 Goethe Center for Scientific Computing, University Frankfurt. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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.
*
* If you use this software for scientific research then please cite the following publication(s):
*
* M. Hoffer, C. Poliwoda, & G. Wittum. (2013). Visual reflection library:
* a framework for declarative GUI programming on the Java platform.
* Computing and Visualization in Science, 2013, 16(4),
* 181–192. http://doi.org/10.1007/s00791-014-0230-y
*/
package eu.mihosoft.vmf.core;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
* Created by miho on 21.03.2017.
*
* @author Michael Hoffer <info@michaelhoffer.de>
*/
public class DelegationInfo {
private final String fullTypeName;
private final String returnType;
private final String methodName;
private final List<String> paramTypes;
private final List<String> paramNames;
private static final List<String> delegationTypes = new ArrayList<>();
private final String varName;
private final boolean constructor;
private DelegationInfo(String fullTypeName, String methodName, String returnType, List<String> paramTypes, List<String> paramNames, boolean constructor) {
this.fullTypeName = fullTypeName;
this.methodName = methodName;
this.returnType = returnType;
this.paramTypes = Collections.unmodifiableList(paramTypes);
this.paramNames = Collections.unmodifiableList(paramNames);
if(!delegationTypes.contains(fullTypeName)) {
delegationTypes.add(fullTypeName);
}
varName = "_vmf_delegate"+delegationTypes.indexOf(fullTypeName);
this.constructor = constructor;
}
public static DelegationInfo newInstance(String className, String methodName, String returnType, List<String> paramTypes, List<String> paramNames, boolean constructor) {
return new DelegationInfo(className, methodName, returnType, paramTypes, paramNames, constructor);
}
public static DelegationInfo newInstance(Model model, Method m) {
DelegateTo delegation = m.getAnnotation(DelegateTo.class);
if(delegation==null) {
return null;
}
List<String> paramTypes = new ArrayList<>(m.getParameters().length);
List<String> paramNames = new ArrayList<>(m.getParameters().length);
for(Parameter p : m.getParameters()) {
paramTypes.add(TypeUtil.getTypeAsString(model,p.getType()));
paramNames.add(p.getName());
}
return newInstance(
delegation.className(),
m.getName(),
TypeUtil.getReturnTypeAsString(model,m),
paramTypes, paramNames, false);
}
public static DelegationInfo newInstance(Model model, Class<?> clazz) {
DelegateTo delegation = clazz.getAnnotation(DelegateTo.class);
if(delegation==null) {
return null;
}
List<String> paramTypes = new ArrayList<>();
List<String> paramNames = new ArrayList<>();
return newInstance(
delegation.className(),
"on"+clazz.getSimpleName()+"Instantiated",
TypeUtil.getTypeAsString(model,clazz),
paramTypes, paramNames, true);
}
public List<String> getParamTypes() {
return paramTypes;
}
public List<String> getParamNames() {
return paramNames;
}
public String getFullTypeName() {
return fullTypeName;
}
public String getMethodName() {
return methodName;
}
public String getReturnType() {
return returnType;
}
public String getMethodDeclaration() {
String method = "public " + getReturnType() + " " + getMethodName()+"(";
for(int i = 0; i < paramTypes.size();i++) {
method += (i>0?", ":"") + paramTypes.get(i) + " " + paramNames.get(i);
}
method+=")";
return method;
}
public boolean isVoid() {
return returnType.equals(void.class.getName());
}
public boolean isConstructor() {
return constructor;
}
public String getVarName() {
return varName;
}
}
| [
"info@michaelhoffer.de"
] | info@michaelhoffer.de |
a80ce25142c7a4c11fbcea088de8bfb488bfd497 | 9c3405b30370c1f1c3f4618224f8677dd0729880 | /MiaoDing/app/src/main/java/cn/cloudworkshop/miaoding/ui/MemberCenterActivity.java | 8ad87d9e275c491c39b61436f7a5500d1adc0783 | [] | no_license | libin1993/newmiaoding | 41c74f49e9af0c43059c75a4ade7ba0abbfc9496 | 0791a24f62a39d12534d205096b1fb326103d5ec | refs/heads/master | 2020-04-13T10:23:12.000920 | 2019-06-06T05:21:50 | 2019-06-06T05:21:50 | 163,138,307 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,105 | java | package cn.cloudworkshop.miaoding.ui;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.PopupWindow;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.flyco.tablayout.CommonTabLayout;
import com.flyco.tablayout.listener.CustomTabEntity;
import com.flyco.tablayout.listener.OnTabSelectListener;
import com.zhy.adapter.recyclerview.CommonAdapter;
import com.zhy.adapter.recyclerview.MultiItemTypeAdapter;
import com.zhy.adapter.recyclerview.base.ViewHolder;
import com.zhy.http.okhttp.OkHttpUtils;
import com.zhy.http.okhttp.callback.StringCallback;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import cn.cloudworkshop.miaoding.R;
import cn.cloudworkshop.miaoding.base.BaseActivity;
import cn.cloudworkshop.miaoding.bean.MemberBean;
import cn.cloudworkshop.miaoding.bean.MemberTabBean;
import cn.cloudworkshop.miaoding.bean.ResponseBean;
import cn.cloudworkshop.miaoding.constant.Constant;
import cn.cloudworkshop.miaoding.utils.DisplayUtils;
import cn.cloudworkshop.miaoding.utils.GsonUtils;
import cn.cloudworkshop.miaoding.utils.SharedPreferencesUtils;
import cn.cloudworkshop.miaoding.utils.ToastUtils;
import cn.cloudworkshop.miaoding.view.CircleImageView;
import okhttp3.Call;
/**
* Author:Libin on 2017/2/14 16:56
* Email:1993911441@qq.com
* Describe:会员中心
*/
public class MemberCenterActivity extends BaseActivity {
@BindView(R.id.img_header_back)
ImageView imgHeaderBack;
@BindView(R.id.tv_header_title)
TextView tvHeaderTitle;
@BindView(R.id.img_header_share)
ImageView imgHeaderShare;
@BindView(R.id.img_member_icon)
CircleImageView imgMemberHead;
@BindView(R.id.tv_member_name)
TextView tvMemberName;
@BindView(R.id.progress_member_grade)
ProgressBar progressMember;
@BindView(R.id.tv_member_score)
TextView tvMemberScore;
@BindView(R.id.tv_member_total)
TextView tvMemberTotal;
@BindView(R.id.tv_check_member)
TextView tvCheckMember;
@BindView(R.id.img_grade_icon)
ImageView imgGradeIcon;
@BindView(R.id.tab_member_grade)
CommonTabLayout tabMemberGrade;
@BindView(R.id.vp_member_rights)
ViewPager vpMemberRights;
@BindView(R.id.img_load_error)
ImageView imgLoadError;
private MemberBean memberBean;
private List<List<MemberBean.DataBean.UserPrivilegeBean>> dataList = new ArrayList<>();
private CommonAdapter<MemberBean.DataBean.UserPrivilegeBean> adapter;
//会员成长值
private int credit;
//当前会员等级
private int currentTab;
//当前礼包
private int currentGift;
//生日
private String birthday;
private PopupWindow mPopupWindow;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_member_center);
ButterKnife.bind(this);
tvHeaderTitle.setText(R.string.member_center);
imgHeaderShare.setVisibility(View.VISIBLE);
initData();
}
/**
* 加载数据
*/
private void initData() {
OkHttpUtils.get()
.url(Constant.MEMBER_GRADE)
.addParams("token", SharedPreferencesUtils.getStr(this, "token"))
.build()
.execute(new StringCallback() {
@Override
public void onError(Call call, Exception e, int id) {
imgLoadError.setVisibility(View.VISIBLE);
}
@Override
public void onResponse(String response, int id) {
imgLoadError.setVisibility(View.GONE);
memberBean = GsonUtils.jsonToBean(response, MemberBean.class);
if (memberBean.getData() != null) {
birthday = memberBean.getData().getUser_info().getBirthday();
initView();
}
}
});
}
/**
* 加载视图
*/
private void initView() {
Glide.with(getApplicationContext())
.load(Constant.IMG_HOST + memberBean.getData().getUser_info().getHead_ico())
.placeholder(R.mipmap.place_holder_goods)
.dontAnimate()
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(imgMemberHead);
tvMemberName.setText(memberBean.getData().getUser_info().getUsername());
Glide.with(getApplicationContext())
.load(Constant.IMG_HOST + memberBean.getData().getUser_info().getUser_grade().getImg2())
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(imgGradeIcon);
credit = memberBean.getData().getUser_info().getExp();
float maxCredit = Float.parseFloat(memberBean.getData().getUser_info().getUser_grade().getMax_credit());
progressMember.setProgress((int) (credit / maxCredit * 100));
tvMemberScore.setText(String.valueOf(credit));
tvMemberTotal.setText("/" + (int) maxCredit);
ArrayList<CustomTabEntity> tabList = new ArrayList<>();
for (int i = 0; i < memberBean.getData().getUser_grade().size(); i++) {
tabList.add(new MemberTabBean(memberBean.getData().getUser_grade().get(i).getName() + getString(R.string.right)));
}
tabMemberGrade.setTabData(tabList);
currentTab = memberBean.getData().getUser_info().getUser_grade().getId() - 1;
initTab();
vpMemberRights.setOffscreenPageLimit(dataList.size());
vpMemberRights.setAdapter(new PagerAdapter() {
@Override
public int getCount() {
return dataList.size();
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
@Override
public Object instantiateItem(ViewGroup container, final int pos) {
View view = LayoutInflater.from(MemberCenterActivity.this).inflate(
R.layout.viewpager_item_member, null);
RecyclerView rvMemberRights = (RecyclerView) view.findViewById(R.id.rv_member_rights);
rvMemberRights.setLayoutManager(new GridLayoutManager(MemberCenterActivity.this, 3));
adapter = new CommonAdapter<MemberBean.DataBean.UserPrivilegeBean>
(MemberCenterActivity.this, R.layout.listitem_member_rights, dataList.get(pos)) {
@Override
protected void convert(ViewHolder holder, MemberBean.DataBean.UserPrivilegeBean
userPrivilegeBean, int position) {
holder.setText(R.id.tv_rights_name, userPrivilegeBean.getName());
Glide.with(MemberCenterActivity.this)
.load(Constant.IMG_HOST + userPrivilegeBean.getImg())
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into((ImageView) holder.getView(R.id.img_rights_icon));
}
};
rvMemberRights.setAdapter(adapter);
adapter.setOnItemClickListener(new MultiItemTypeAdapter.OnItemClickListener() {
@Override
public void onItemClick(View view, RecyclerView.ViewHolder holder, int position) {
currentGift = position;
showGift(pos, position);
}
@Override
public boolean onItemLongClick(View view, RecyclerView.ViewHolder holder, int position) {
return false;
}
});
container.addView(view);
return view;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}
});
tabMemberGrade.setCurrentTab(currentTab);
vpMemberRights.setCurrentItem(currentTab);
tabMemberGrade.setOnTabSelectListener(new OnTabSelectListener() {
@Override
public void onTabSelect(int position) {
currentTab = position;
vpMemberRights.setCurrentItem(currentTab);
}
@Override
public void onTabReselect(int position) {
}
});
vpMemberRights.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
currentTab = position;
tabMemberGrade.setCurrentTab(currentTab);
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
}
/**
* @param grade 等级
* @param position 礼包
* 礼包详情
*/
private void showGift(final int grade, final int position) {
View popupView = getLayoutInflater().inflate(R.layout.ppw_receive_gift, null);
mPopupWindow = new PopupWindow(popupView,
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
mPopupWindow.setTouchable(true);
mPopupWindow.setFocusable(true);
mPopupWindow.setOutsideTouchable(true);
mPopupWindow.setBackgroundDrawable(new BitmapDrawable(getResources(), (Bitmap) null));
if (!isFinishing()) {
mPopupWindow.showAtLocation(getWindow().getDecorView(), Gravity.CENTER, 0, 0);
}
DisplayUtils.setBackgroundAlpha(this, true);
TextView tvTitle = (TextView) popupView.findViewById(R.id.tv_gift_title);
CircleImageView imgGift = (CircleImageView) popupView.findViewById(R.id.img_gift);
final TextView tvInfo = (TextView) popupView.findViewById(R.id.tv_gift_info);
final TextView tvReceive = (TextView) popupView.findViewById(R.id.tv_receive_gift);
Glide.with(this)
.load(Constant.IMG_HOST + dataList.get(grade).get(position).getImg())
.diskCacheStrategy(DiskCacheStrategy.SOURCE)
.into(imgGift);
tvTitle.setText(dataList.get(grade).get(position).getName());
switch (dataList.get(grade).get(position).getIs_get()) {
case 1:
tvInfo.setText(dataList.get(grade).get(position).getDesc());
tvReceive.setText(R.string.close);
tvReceive.setTextColor(ContextCompat.getColor(this, R.color.dark_gray_22));
break;
case 2:
if (!TextUtils.isEmpty(birthday)) {
tvInfo.setText(dataList.get(grade).get(position).getDesc());
tvReceive.setText(R.string.receive);
tvReceive.setTextColor(ContextCompat.getColor(this, R.color.dark_gray_22));
} else {
tvInfo.setText(getString(R.string.birthday_info) + "\r\n" + getString(R.string.birthday_gift));
tvReceive.setText(R.string.to_set);
tvReceive.setTextColor(ContextCompat.getColor(this, R.color.dark_red));
}
break;
case 3:
tvInfo.setText(dataList.get(grade).get(position).getDesc());
tvReceive.setText(R.string.receive);
tvReceive.setTextColor(ContextCompat.getColor(this, R.color.dark_gray_22));
break;
}
mPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
DisplayUtils.setBackgroundAlpha(MemberCenterActivity.this, false);
}
});
tvReceive.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
switch (dataList.get(grade).get(position).getIs_get()) {
case 1:
mPopupWindow.dismiss();
break;
case 2:
if (!TextUtils.isEmpty(birthday)) {
isGetGift(Constant.BIRTHDAY_GIFT);
} else {
Intent intent = new Intent(MemberCenterActivity.this, SetUpActivity.class);
intent.putExtra("set_birthday", true);
mPopupWindow.dismiss();
startActivityForResult(intent, 1);
}
break;
case 3:
isGetGift(Constant.UPGRADE_GIFT);
break;
}
}
});
}
/**
* 加载tab数据
*/
private void initTab() {
for (int i = 0; i < memberBean.getData().getUser_grade().size(); i++) {
List<MemberBean.DataBean.UserPrivilegeBean> itemList = new ArrayList<>();
String[] idStr = memberBean.getData().getUser_grade().get(i).getUser_privilege_ids().split(",");
for (int j = 0; j < memberBean.getData().getUser_privilege().size(); j++) {
for (String anIdStr : idStr) {
if (anIdStr.equals(String.valueOf(memberBean.getData().getUser_privilege()
.get(j).getId()))) {
itemList.add(memberBean.getData().getUser_privilege().get(j));
break;
}
}
}
dataList.add(itemList);
}
}
@OnClick({R.id.img_header_back, R.id.img_header_share, R.id.tv_check_member, R.id.img_load_error})
public void onClick(View view) {
switch (view.getId()) {
case R.id.img_header_back:
finish();
break;
case R.id.img_header_share:
startActivity(new Intent(this, MemberRuleActivity.class));
break;
case R.id.tv_check_member:
Intent intent = new Intent(this, MemberGrowthActivity.class);
intent.putExtra("value", String.valueOf(credit));
startActivity(intent);
break;
case R.id.img_load_error:
initData();
break;
}
}
/**
* 是否达到领取要求
*/
private void isGetGift(String url) {
String privilegeIds = memberBean.getData().getUser_grade().get(memberBean.getData()
.getUser_info().getUser_grade().getId() - 1).getUser_privilege_ids();
String[] split = privilegeIds.split(",");
if (Arrays.asList(split).contains(dataList.get(currentTab).get(currentGift).getId() + "")) {
submitData(url);
} else {
ToastUtils.showToast(this, getString(R.string.member_grade));
mPopupWindow.dismiss();
}
}
/**
* @param url 领取礼包
*/
private void submitData(String url) {
OkHttpUtils.post()
.url(url)
.addParams("token", SharedPreferencesUtils.getStr(this, "token"))
.build()
.execute(new StringCallback() {
@Override
public void onError(Call call, Exception e, int id) {
}
@Override
public void onResponse(String response, int id) {
ResponseBean responseBean = GsonUtils.jsonToBean(response, ResponseBean.class);
ToastUtils.showToast(MemberCenterActivity.this, responseBean.getMsg());
mPopupWindow.dismiss();
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1 && resultCode == 1) {
birthday = data.getStringExtra("birthday");
}
}
}
| [
"1993911441@qq.com"
] | 1993911441@qq.com |
d3c1a3387b451be99b86ab80e3aedddd8f9000c8 | f778cba16c8d77d85c49502a2952234bad311251 | /src/test/java/com/huntkey/rx/sceo/TestStringProducer.java | c7a00a0007d3f170dba2abb0cad0a648d9e4b34c | [] | no_license | taochanglian/message | c6bf1d7fd308877c2c3e1dc12283d02d50859e0a | 53e991e89d363a4512815954132b8eab79e54d03 | refs/heads/master | 2021-09-01T09:47:47.436336 | 2017-12-26T09:39:08 | 2017-12-26T09:39:08 | 115,408,014 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 835 | java | package com.huntkey.rx.sceo;
import com.huntkey.rx.sceo.mpf.common.MsgClient;
import com.huntkey.rx.sceo.mpf.common.MsgClientFactory;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;
/**
* Created by liangh on 2017/5/22.
*/
public class TestStringProducer {
public static void main(String args[]) throws Exception {
//测试发送字符串消息到test主题
String topic = "myTopic";//"mykafka";messageData
String message = "Hello world " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS").format(new Date());
Properties prop = new Properties();
MsgClient client = MsgClientFactory.createClient(prop);
for(int i=0;i<5000;i++) {
client.sendMessage(topic,message + " " + i+1);
}
client.closeProducer();
}
}
| [
"taochangl@huntkey.com"
] | taochangl@huntkey.com |
0070488e8a6f03a158548512528d2119a4b7706d | 3f3da7f612839c7df49925920a481473b3680c1d | /src/main/java/com/tiunida/laundry0/ActivityOrderDetail/OrderDetailInteractor.java | 283faf88ac74a68c0efcfc612c6e1f4029f1d5c5 | [] | no_license | munifahsan/Laundry0 | 9caa2c4637e51dc93c1b5b064a57d2d3ba807088 | 4a02800cd81440b8502c6872db14f048d549de9d | refs/heads/master | 2020-06-04T15:46:35.436625 | 2019-08-13T07:39:16 | 2019-08-13T07:39:16 | 192,088,319 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 655 | java | package com.tiunida.laundry0.ActivityOrderDetail;
public class OrderDetailInteractor implements OrderDetailInteractorMvp{
private OrderDetailReposritoryMvp mOrderDetailReposritoryMvp;
public OrderDetailInteractor(){
mOrderDetailReposritoryMvp = new OrderDetailRepository();
}
@Override
public void getOrderData(String order_id) {
mOrderDetailReposritoryMvp.getOrdersData(order_id);
}
public void updatePaid(String order_id) {
mOrderDetailReposritoryMvp.updatePaid(order_id);
}
public void updateDeliver(String order_id) {
mOrderDetailReposritoryMvp.updateDeliver(order_id);
}
}
| [
"munifahsan.mb9@gmail.com"
] | munifahsan.mb9@gmail.com |
f3c0bc122607a42b785e4d993e92d46ddd82c656 | 9f62d3a5a5923ba1809dc2d621f1a627c4034c73 | /ProgrammingContest/src/leetcode/weekly_contest/_260/A.java | 2ceb670af588809909d6b21f20ed520af3da10da | [] | no_license | smakslow/java-learn | aa5587eaba0acd522850afc9cbc32597ad3be456 | 7d37c59568b047d384245fd28abf7bc3e0013093 | refs/heads/master | 2023-08-30T04:14:13.962547 | 2021-10-11T16:29:17 | 2021-10-11T16:29:17 | 356,228,254 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 447 | java | package leetcode.weekly_contest._260;
public class A {
class Solution {
public int maximumDifference(int[] nums) {
int ans = -1;
for (int i = 0; i < nums.length; i++) {
for (int j = i + 1; j < nums.length; j++) {
if (nums[j] > nums[i])
ans = Math.max(nums[j] - nums[i], ans);
}
}
return ans;
}
}
}
| [
"514841961@qq.com"
] | 514841961@qq.com |
9ad7b8abff7ad00012dfc2b2bcc71eb1a42da0ca | be73270af6be0a811bca4f1710dc6a038e4a8fd2 | /crash-reproduction-moho/results/XCOMMONS-1057-8-11-PESA_II-WeightedSum:TestLen:CallDiversity/org/xwiki/job/AbstractJob_ESTest_scaffolding.java | 8d9bf36f4c3ccbe741df2837105bbcf1dc8415bb | [] | no_license | STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application | cf118b23ecb87a8bf59643e42f7556b521d1f754 | 3bb39683f9c343b8ec94890a00b8f260d158dfe3 | refs/heads/master | 2022-07-29T14:44:00.774547 | 2020-08-10T15:14:49 | 2020-08-10T15:14:49 | 285,804,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 429 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Fri Apr 03 12:26:52 UTC 2020
*/
package org.xwiki.job;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class AbstractJob_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
0d03d0e8a767355c8f6a44baa61e773012dcf9b4 | ee8103b7c43cfaf22855530dd362ebbe38de19e7 | /gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java | 50ed0669a171919d9c35bec25e661a9d205e8f28 | [
"Apache-2.0",
"MIT"
] | permissive | PKUSilvester/LiteGraph | 70181e0953d2e95fe903b47b8820c381782d3d04 | 44724fecc8272e7b6c6902b9411fc183eed16ac5 | refs/heads/master | 2020-07-07T23:37:24.101493 | 2016-08-24T08:32:34 | 2016-08-24T08:32:49 | 65,963,317 | 11 | 2 | null | null | null | null | UTF-8 | Java | false | false | 38,284 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.apache.tinkerpop.gremlin.server;
import java.io.File;
import io.netty.handler.ssl.SslContext;
import io.netty.handler.ssl.SslContextBuilder;
import io.netty.handler.ssl.SslProvider;
import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
import io.netty.handler.ssl.util.SelfSignedCertificate;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.log4j.Logger;
import org.apache.tinkerpop.gremlin.driver.Client;
import org.apache.tinkerpop.gremlin.driver.Cluster;
import org.apache.tinkerpop.gremlin.driver.Result;
import org.apache.tinkerpop.gremlin.driver.ResultSet;
import org.apache.tinkerpop.gremlin.driver.Tokens;
import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
import org.apache.tinkerpop.gremlin.driver.message.ResponseMessage;
import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode;
import org.apache.tinkerpop.gremlin.driver.ser.Serializers;
import org.apache.tinkerpop.gremlin.driver.simple.NioClient;
import org.apache.tinkerpop.gremlin.driver.simple.SimpleClient;
import org.apache.tinkerpop.gremlin.driver.simple.WebSocketClient;
import org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine;
import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.CompileStaticCustomizerProvider;
import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.ConfigurationCustomizerProvider;
import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.InterpreterModeCustomizerProvider;
import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.SimpleSandboxExtension;
import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.TimedInterruptCustomizerProvider;
import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.server.channel.NioChannelizer;
import org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor;
import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
import org.apache.tinkerpop.gremlin.util.Log4jRecordingAppender;
import org.hamcrest.CoreMatchers;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.nio.channels.ClosedChannelException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsInstanceOf.instanceOf;
import static org.hamcrest.core.IsNot.not;
import static org.hamcrest.core.StringEndsWith.endsWith;
import static org.hamcrest.core.StringStartsWith.startsWith;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeThat;
import static org.junit.Assert.assertEquals;
/**
* Integration tests for server-side settings and processing.
*
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegrationTest {
private Log4jRecordingAppender recordingAppender = null;
@Before
public void setupForEachTest() {
recordingAppender = new Log4jRecordingAppender();
final Logger rootLogger = Logger.getRootLogger();
rootLogger.addAppender(recordingAppender);
}
@After
public void teardownForEachTest() {
final Logger rootLogger = Logger.getRootLogger();
rootLogger.removeAppender(recordingAppender);
}
/**
* Configure specific Gremlin Server settings for specific tests.
*/
@Override
public Settings overrideSettings(final Settings settings) {
final String nameOfTest = name.getMethodName();
switch (nameOfTest) {
case "shouldRespectHighWaterMarkSettingAndSucceed":
settings.writeBufferHighWaterMark = 64;
settings.writeBufferLowWaterMark = 32;
break;
case "shouldReceiveFailureTimeOutOnScriptEval":
settings.scriptEvaluationTimeout = 200;
break;
case "shouldReceiveFailureTimeOutOnTotalSerialization":
settings.serializedResponseTimeout = 1;
break;
case "shouldBlockRequestWhenTooBig":
settings.maxContentLength = 1024;
break;
case "shouldBatchResultsByTwos":
settings.resultIterationBatchSize = 2;
break;
case "shouldWorkOverNioTransport":
settings.channelizer = NioChannelizer.class.getName();
break;
case "shouldEnableSsl":
case "shouldEnableSslButFailIfClientConnectsWithoutIt":
settings.ssl = new Settings.SslSettings();
settings.ssl.enabled = true;
break;
case "shouldEnableSslWithSslContextProgrammaticallySpecified":
settings.ssl = new Settings.SslSettings();
settings.ssl.enabled = true;
settings.ssl.overrideSslContext(createServerSslContext());
break;
case "shouldStartWithDefaultSettings":
return new Settings();
case "shouldHaveTheSessionTimeout":
settings.processors.clear();
final Settings.ProcessorSettings processorSettings = new Settings.ProcessorSettings();
processorSettings.className = SessionOpProcessor.class.getCanonicalName();
processorSettings.config = new HashMap<>();
processorSettings.config.put(SessionOpProcessor.CONFIG_SESSION_TIMEOUT, 3000L);
settings.processors.add(processorSettings);
break;
case "shouldExecuteInSessionAndSessionlessWithoutOpeningTransactionWithSingleClient":
case "shouldExecuteInSessionWithTransactionManagement":
deleteDirectory(new File("/tmp/neo4j"));
settings.graphs.put("graph", "conf/neo4j-empty.properties");
break;
case "shouldUseSimpleSandbox":
settings.scriptEngines.get("gremlin-groovy").config = getScriptEngineConfForSimpleSandbox();
break;
case "shouldUseInterpreterMode":
settings.scriptEngines.get("gremlin-groovy").config = getScriptEngineConfForInterpreterMode();
break;
case "shouldReceiveFailureTimeOutOnScriptEvalOfOutOfControlLoop":
settings.scriptEngines.get("gremlin-groovy").config = getScriptEngineConfForTimedInterrupt();
break;
case "shouldUseBaseScript":
settings.scriptEngines.get("gremlin-groovy").config = getScriptEngineConfForBaseScript();
break;
}
return settings;
}
private static SslContext createServerSslContext() {
final SslProvider provider = SslProvider.JDK;
try {
// this is not good for production - just testing
final SelfSignedCertificate ssc = new SelfSignedCertificate();
return SslContextBuilder.forServer(ssc.certificate(), ssc.privateKey()).sslProvider(provider).build();
} catch (Exception ce) {
throw new RuntimeException("Couldn't setup self-signed certificate for test");
}
}
private static Map<String, Object> getScriptEngineConfForSimpleSandbox() {
final Map<String,Object> scriptEngineConf = new HashMap<>();
final Map<String,Object> compilerCustomizerProviderConf = new HashMap<>();
final List<String> sandboxes = new ArrayList<>();
sandboxes.add(SimpleSandboxExtension.class.getName());
compilerCustomizerProviderConf.put(CompileStaticCustomizerProvider.class.getName(), sandboxes);
scriptEngineConf.put("compilerCustomizerProviders", compilerCustomizerProviderConf);
return scriptEngineConf;
}
private static Map<String, Object> getScriptEngineConfForTimedInterrupt() {
final Map<String,Object> scriptEngineConf = new HashMap<>();
final Map<String,Object> timedInterruptProviderConf = new HashMap<>();
final List<Object> config = new ArrayList<>();
config.add(1000);
timedInterruptProviderConf.put(TimedInterruptCustomizerProvider.class.getName(), config);
scriptEngineConf.put("compilerCustomizerProviders", timedInterruptProviderConf);
return scriptEngineConf;
}
private static Map<String, Object> getScriptEngineConfForInterpreterMode() {
final Map<String,Object> scriptEngineConf = new HashMap<>();
final Map<String,Object> interpreterProviderConf = new HashMap<>();
interpreterProviderConf.put(InterpreterModeCustomizerProvider.class.getName(), Collections.EMPTY_LIST);
scriptEngineConf.put("compilerCustomizerProviders", interpreterProviderConf);
return scriptEngineConf;
}
private static Map<String, Object> getScriptEngineConfForBaseScript() {
final Map<String,Object> scriptEngineConf = new HashMap<>();
final Map<String,Object> compilerCustomizerProviderConf = new HashMap<>();
final List<Object> keyValues = new ArrayList<>();
final Map<String,Object> properties = new HashMap<>();
properties.put("ScriptBaseClass", BaseScriptForTesting.class.getName());
keyValues.add(properties);
compilerCustomizerProviderConf.put(ConfigurationCustomizerProvider.class.getName(), keyValues);
scriptEngineConf.put("compilerCustomizerProviders", compilerCustomizerProviderConf);
return scriptEngineConf;
}
@Test
public void shouldUseBaseScript() throws Exception {
final Cluster cluster = Cluster.open();
final Client client = cluster.connect(name.getMethodName());
assertEquals("hello, stephen", client.submit("hello('stephen')").all().get().get(0).getString());
cluster.close();
}
@Test
public void shouldUseInterpreterMode() throws Exception {
final Cluster cluster = Cluster.open();
final Client client = cluster.connect(name.getMethodName());
client.submit("def subtractAway(x,y){x-y};[]").all().get();
client.submit("multiplyIt = { x,y -> x * y};[]").all().get();
assertEquals(2, client.submit("x = 1 + 1").all().get().get(0).getInt());
assertEquals(3, client.submit("int y = x + 1").all().get().get(0).getInt());
assertEquals(5, client.submit("def z = x + y").all().get().get(0).getInt());
final Map<String,Object> m = new HashMap<>();
m.put("x", 10);
assertEquals(-5, client.submit("z - x", m).all().get().get(0).getInt());
assertEquals(15, client.submit("addItUp(x,z)", m).all().get().get(0).getInt());
assertEquals(5, client.submit("subtractAway(x,z)", m).all().get().get(0).getInt());
assertEquals(50, client.submit("multiplyIt(x,z)", m).all().get().get(0).getInt());
cluster.close();
}
@Test
public void shouldNotUseInterpreterMode() throws Exception {
final Cluster cluster = Cluster.open();
final Client client = cluster.connect(name.getMethodName());
client.submit("def subtractAway(x,y){x-y};[]").all().get();
client.submit("multiplyIt = { x,y -> x * y};[]").all().get();
assertEquals(2, client.submit("x = 1 + 1").all().get().get(0).getInt());
assertEquals(3, client.submit("y = x + 1").all().get().get(0).getInt());
assertEquals(5, client.submit("z = x + y").all().get().get(0).getInt());
final Map<String,Object> m = new HashMap<>();
m.put("x", 10);
assertEquals(-5, client.submit("z - x", m).all().get().get(0).getInt());
assertEquals(15, client.submit("addItUp(x,z)", m).all().get().get(0).getInt());
assertEquals(5, client.submit("subtractAway(x,z)", m).all().get().get(0).getInt());
assertEquals(50, client.submit("multiplyIt(x,z)", m).all().get().get(0).getInt());
cluster.close();
}
@Test
public void shouldUseSimpleSandbox() throws Exception {
final Cluster cluster = Cluster.open();
final Client client = cluster.connect();
assertEquals(2, client.submit("1+1").all().get().get(0).getInt());
try {
// this should return "nothing" - there should be no exception
client.submit("java.lang.System.exit(0)").all().get();
fail("The above should not have executed in any successful way as sandboxing is enabled");
} catch (Exception ex) {
assertThat(ex.getCause().getMessage(), containsString("[Static type checking] - Not authorized to call this method: java.lang.System#exit(int)"));
} finally {
cluster.close();
}
}
@Test
public void shouldStartWithDefaultSettings() {
// just quickly validate that results are returning given defaults. no graphs are config'd with defaults
// so just eval a groovy script.
final Cluster cluster = Cluster.open();
final Client client = cluster.connect();
final ResultSet results = client.submit("[1,2,3,4,5,6,7,8,9]");
final AtomicInteger counter = new AtomicInteger(0);
results.stream().map(i -> i.get(Integer.class) * 2).forEach(i -> assertEquals(counter.incrementAndGet() * 2, Integer.parseInt(i.toString())));
cluster.close();
}
@Test
public void shouldEnableSsl() {
final Cluster cluster = Cluster.build().enableSsl(true).create();
final Client client = cluster.connect();
try {
// this should return "nothing" - there should be no exception
assertEquals("test", client.submit("'test'").one().getString());
} finally {
cluster.close();
}
}
@Test
public void shouldEnableSslWithSslContextProgrammaticallySpecified() throws Exception {
// just for testing - this is not good for production use
final SslContextBuilder builder = SslContextBuilder.forClient();
builder.trustManager(InsecureTrustManagerFactory.INSTANCE);
builder.sslProvider(SslProvider.JDK);
final Cluster cluster = Cluster.build().enableSsl(true).sslContext(builder.build()).create();
final Client client = cluster.connect();
try {
// this should return "nothing" - there should be no exception
assertEquals("test", client.submit("'test'").one().getString());
} finally {
cluster.close();
}
}
@Test
public void shouldEnableSslButFailIfClientConnectsWithoutIt() {
final Cluster cluster = Cluster.build().enableSsl(false).create();
final Client client = cluster.connect();
try {
client.submit("'test'").one();
fail("Should throw exception because ssl is enabled on the server but not on client");
} catch(Exception x) {
final Throwable root = ExceptionUtils.getRootCause(x);
assertThat(root, instanceOf(TimeoutException.class));
} finally {
cluster.close();
}
}
@Test
public void shouldRespectHighWaterMarkSettingAndSucceed() throws Exception {
// the highwatermark should get exceeded on the server and thus pause the writes, but have no problem catching
// itself up - this is a tricky tests to get passing on all environments so this assumption will deny the
// test for most cases
assumeThat("Set the 'assertNonDeterministic' property to true to execute this test",
System.getProperty("assertNonDeterministic"), is("true"));
final Cluster cluster = Cluster.open();
final Client client = cluster.connect();
try {
final int resultCountToGenerate = 1000;
final int batchSize = 3;
final String fatty = IntStream.range(0, 175).mapToObj(String::valueOf).collect(Collectors.joining());
final String fattyX = "['" + fatty + "'] * " + resultCountToGenerate;
// don't allow the thread to proceed until all results are accounted for
final CountDownLatch latch = new CountDownLatch(resultCountToGenerate);
final AtomicBoolean expected = new AtomicBoolean(false);
final AtomicBoolean faulty = new AtomicBoolean(false);
final RequestMessage request = RequestMessage.build(Tokens.OPS_EVAL)
.addArg(Tokens.ARGS_BATCH_SIZE, batchSize)
.addArg(Tokens.ARGS_GREMLIN, fattyX).create();
client.submitAsync(request).thenAcceptAsync(r -> {
r.stream().forEach(item -> {
try {
final String aFattyResult = item.getString();
expected.set(aFattyResult.equals(fatty));
} catch (Exception ex) {
ex.printStackTrace();
faulty.set(true);
} finally {
latch.countDown();
}
});
});
assertThat(latch.await(30000, TimeUnit.MILLISECONDS), is(true));
assertEquals(0, latch.getCount());
assertThat(faulty.get(), is(false));
assertThat(expected.get(), is(true));
assertThat(recordingAppender.getMessages().stream().anyMatch(m -> m.contains("Pausing response writing as writeBufferHighWaterMark exceeded on")), is(true));
} catch (Exception ex) {
fail("Shouldn't have tossed an exception");
} finally {
cluster.close();
}
}
@Test
public void shouldReturnInvalidRequestArgsWhenGremlinArgIsNotSupplied() throws Exception {
try (SimpleClient client = new WebSocketClient()) {
final RequestMessage request = RequestMessage.build(Tokens.OPS_EVAL).create();
final ResponseMessage result = client.submit(request).get(0);
assertThat(result.getStatus().getCode(), is(not(ResponseStatusCode.PARTIAL_CONTENT)));
assertEquals(result.getStatus().getCode(), ResponseStatusCode.REQUEST_ERROR_INVALID_REQUEST_ARGUMENTS);
}
}
@Test
public void shouldReturnInvalidRequestArgsWhenInvalidReservedBindingKeyIsUsed() throws Exception {
try (SimpleClient client = new WebSocketClient()) {
final Map<String, Object> bindings = new HashMap<>();
bindings.put(T.id.getAccessor(), "123");
final RequestMessage request = RequestMessage.build(Tokens.OPS_EVAL)
.addArg(Tokens.ARGS_GREMLIN, "[1,2,3,4,5,6,7,8,9,0]")
.addArg(Tokens.ARGS_BINDINGS, bindings).create();
final CountDownLatch latch = new CountDownLatch(1);
final AtomicBoolean pass = new AtomicBoolean(false);
client.submit(request, result -> {
if (result.getStatus().getCode() != ResponseStatusCode.PARTIAL_CONTENT) {
pass.set(ResponseStatusCode.REQUEST_ERROR_INVALID_REQUEST_ARGUMENTS == result.getStatus().getCode());
latch.countDown();
}
});
if (!latch.await(3000, TimeUnit.MILLISECONDS))
fail("Request should have returned error, but instead timed out");
assertThat(pass.get(), is(true));
}
try (SimpleClient client = new WebSocketClient()) {
final Map<String, Object> bindings = new HashMap<>();
bindings.put("id", "123");
final RequestMessage request = RequestMessage.build(Tokens.OPS_EVAL)
.addArg(Tokens.ARGS_GREMLIN, "[1,2,3,4,5,6,7,8,9,0]")
.addArg(Tokens.ARGS_BINDINGS, bindings).create();
final CountDownLatch latch = new CountDownLatch(1);
final AtomicBoolean pass = new AtomicBoolean(false);
client.submit(request, result -> {
if (result.getStatus().getCode() != ResponseStatusCode.PARTIAL_CONTENT) {
pass.set(ResponseStatusCode.REQUEST_ERROR_INVALID_REQUEST_ARGUMENTS == result.getStatus().getCode());
latch.countDown();
}
});
if (!latch.await(3000, TimeUnit.MILLISECONDS))
fail("Request should have returned error, but instead timed out");
assertTrue(pass.get());
}
}
@Test
public void shouldReturnInvalidRequestArgsWhenInvalidTypeBindingKeyIsUsed() throws Exception {
try (SimpleClient client = new WebSocketClient()) {
final Map<Object, Object> bindings = new HashMap<>();
bindings.put(1, "123");
final RequestMessage request = RequestMessage.build(Tokens.OPS_EVAL)
.addArg(Tokens.ARGS_GREMLIN, "[1,2,3,4,5,6,7,8,9,0]")
.addArg(Tokens.ARGS_BINDINGS, bindings).create();
final CountDownLatch latch = new CountDownLatch(1);
final AtomicBoolean pass = new AtomicBoolean(false);
client.submit(request, result -> {
if (result.getStatus().getCode() != ResponseStatusCode.PARTIAL_CONTENT) {
pass.set(ResponseStatusCode.REQUEST_ERROR_INVALID_REQUEST_ARGUMENTS == result.getStatus().getCode());
latch.countDown();
}
});
if (!latch.await(3000, TimeUnit.MILLISECONDS))
fail("Request should have returned error, but instead timed out");
assertThat(pass.get(), is(true));
}
}
@Test
public void shouldReturnInvalidRequestArgsWhenInvalidNullBindingKeyIsUsed() throws Exception {
try (SimpleClient client = new WebSocketClient()) {
final Map<String, Object> bindings = new HashMap<>();
bindings.put(null, "123");
final RequestMessage request = RequestMessage.build(Tokens.OPS_EVAL)
.addArg(Tokens.ARGS_GREMLIN, "[1,2,3,4,5,6,7,8,9,0]")
.addArg(Tokens.ARGS_BINDINGS, bindings).create();
final CountDownLatch latch = new CountDownLatch(1);
final AtomicBoolean pass = new AtomicBoolean(false);
client.submit(request, result -> {
if (result.getStatus().getCode() != ResponseStatusCode.PARTIAL_CONTENT) {
pass.set(ResponseStatusCode.REQUEST_ERROR_INVALID_REQUEST_ARGUMENTS == result.getStatus().getCode());
latch.countDown();
}
});
if (!latch.await(3000, TimeUnit.MILLISECONDS))
fail("Request should have returned error, but instead timed out");
assertThat(pass.get(), is(true));
}
}
@Test
@SuppressWarnings("unchecked")
public void shouldBatchResultsByTwos() throws Exception {
try (SimpleClient client = new WebSocketClient()) {
final RequestMessage request = RequestMessage.build(Tokens.OPS_EVAL)
.addArg(Tokens.ARGS_GREMLIN, "[0,1,2,3,4,5,6,7,8,9]").create();
final List<ResponseMessage> msgs = client.submit(request);
assertEquals(5, client.submit(request).size());
assertEquals(0, ((List<Integer>) msgs.get(0).getResult().getData()).get(0).intValue());
assertEquals(1, ((List<Integer>) msgs.get(0).getResult().getData()).get(1).intValue());
assertEquals(2, ((List<Integer>) msgs.get(1).getResult().getData()).get(0).intValue());
assertEquals(3, ((List<Integer>) msgs.get(1).getResult().getData()).get(1).intValue());
assertEquals(4, ((List<Integer>) msgs.get(2).getResult().getData()).get(0).intValue());
assertEquals(5, ((List<Integer>) msgs.get(2).getResult().getData()).get(1).intValue());
assertEquals(6, ((List<Integer>) msgs.get(3).getResult().getData()).get(0).intValue());
assertEquals(7, ((List<Integer>) msgs.get(3).getResult().getData()).get(1).intValue());
assertEquals(8, ((List<Integer>) msgs.get(4).getResult().getData()).get(0).intValue());
assertEquals(9, ((List<Integer>) msgs.get(4).getResult().getData()).get(1).intValue());
}
}
@Test
@SuppressWarnings("unchecked")
public void shouldBatchResultsByOnesByOverridingFromClientSide() throws Exception {
try (SimpleClient client = new WebSocketClient()) {
final RequestMessage request = RequestMessage.build(Tokens.OPS_EVAL)
.addArg(Tokens.ARGS_GREMLIN, "[0,1,2,3,4,5,6,7,8,9]")
.addArg(Tokens.ARGS_BATCH_SIZE, 1).create();
final List<ResponseMessage> msgs = client.submit(request);
assertEquals(10, msgs.size());
IntStream.rangeClosed(0, 9).forEach(i -> assertEquals(i, ((List<Integer>) msgs.get(i).getResult().getData()).get(0).intValue()));
}
}
@Test
@SuppressWarnings("unchecked")
public void shouldWorkOverNioTransport() throws Exception {
try (SimpleClient client = new NioClient()) {
final RequestMessage request = RequestMessage.build(Tokens.OPS_EVAL)
.addArg(Tokens.ARGS_GREMLIN, "[0,1,2,3,4,5,6,7,8,9,]").create();
final List<ResponseMessage> msg = client.submit(request);
assertEquals(1, msg.size());
final List<Integer> integers = (List<Integer>) msg.get(0).getResult().getData();
IntStream.rangeClosed(0, 9).forEach(i -> assertEquals(i, integers.get(i).intValue()));
}
}
@Test
public void shouldNotThrowNoSuchElementException() throws Exception {
try (SimpleClient client = new WebSocketClient()){
// this should return "nothing" - there should be no exception
final List<ResponseMessage> responses = client.submit("g.V().has('name','kadfjaldjfla')");
assertNull(responses.get(0).getResult().getData());
}
}
@Test
@SuppressWarnings("unchecked")
public void shouldReceiveFailureTimeOutOnScriptEval() throws Exception {
try (SimpleClient client = new WebSocketClient()){
final List<ResponseMessage> responses = client.submit("Thread.sleep(3000);'some-stuff-that-should not return'");
assertThat(responses.get(0).getStatus().getMessage(), startsWith("Script evaluation exceeded the configured 'scriptEvaluationTimeout' threshold of 200 ms for request"));
// validate that we can still send messages to the server
assertEquals(2, ((List<Integer>) client.submit("1+1").get(0).getResult().getData()).get(0).intValue());
}
}
@Test
@SuppressWarnings("unchecked")
public void shouldReceiveFailureTimeOutOnScriptEvalUsingOverride() throws Exception {
try (SimpleClient client = new WebSocketClient()) {
final RequestMessage msg = RequestMessage.build("eval")
.addArg(Tokens.ARGS_SCRIPT_EVAL_TIMEOUT, 100)
.addArg(Tokens.ARGS_GREMLIN, "Thread.sleep(3000);'some-stuff-that-should not return'")
.create();
final List<ResponseMessage> responses = client.submit(msg);
assertThat(responses.get(0).getStatus().getMessage(), startsWith("Script evaluation exceeded the configured 'scriptEvaluationTimeout' threshold of 100 ms for request"));
// validate that we can still send messages to the server
assertEquals(2, ((List<Integer>) client.submit("1+1").get(0).getResult().getData()).get(0).intValue());
}
}
@Test
public void shouldReceiveFailureTimeOutOnScriptEvalOfOutOfControlLoop() throws Exception {
try (SimpleClient client = new WebSocketClient()){
// timeout configured for 1 second so the timed interrupt should trigger prior to the
// scriptEvaluationTimeout which is at 30 seconds by default
final List<ResponseMessage> responses = client.submit("while(true){}");
assertThat(responses.get(0).getStatus().getMessage(), startsWith("Timeout during script evaluation triggered by TimedInterruptCustomizerProvider"));
// validate that we can still send messages to the server
assertEquals(2, ((List<Integer>) client.submit("1+1").get(0).getResult().getData()).get(0).intValue());
}
}
/**
* @deprecated As of release 3.2.1, replaced by tests covering {@link Settings#scriptEvaluationTimeout}.
*/
@Test
@SuppressWarnings("unchecked")
@Deprecated
public void shouldReceiveFailureTimeOutOnTotalSerialization() throws Exception {
try (SimpleClient client = new WebSocketClient()){
final List<ResponseMessage> responses = client.submit("(0..<100000)");
// the last message should contain the error
assertThat(responses.get(responses.size() - 1).getStatus().getMessage(), endsWith("Serialization of the entire response exceeded the 'serializeResponseTimeout' setting"));
// validate that we can still send messages to the server
assertEquals(2, ((List<Integer>) client.submit("1+1").get(0).getResult().getData()).get(0).intValue());
}
}
@Test
@SuppressWarnings("unchecked")
public void shouldLoadInitScript() throws Exception {
try (SimpleClient client = new WebSocketClient()){
assertEquals(2, ((List<Integer>) client.submit("addItUp(1,1)").get(0).getResult().getData()).get(0).intValue());
}
}
@Test
public void shouldGarbageCollectPhantomButNotHard() throws Exception {
final Cluster cluster = Cluster.open();
final Client client = cluster.connect();
assertEquals(2, client.submit("addItUp(1,1)").all().join().get(0).getInt());
assertEquals(0, client.submit("def subtract(x,y){x-y};subtract(1,1)").all().join().get(0).getInt());
assertEquals(0, client.submit("subtract(1,1)").all().join().get(0).getInt());
final Map<String, Object> bindings = new HashMap<>();
bindings.put(GremlinGroovyScriptEngine.KEY_REFERENCE_TYPE, GremlinGroovyScriptEngine.REFERENCE_TYPE_PHANTOM);
assertEquals(4, client.submit("def multiply(x,y){x*y};multiply(2,2)", bindings).all().join().get(0).getInt());
try {
client.submit("multiply(2,2)").all().join().get(0).getInt();
fail("Should throw an exception since reference is phantom.");
} catch (RuntimeException ignored) {
} finally {
cluster.close();
}
}
@Test
public void shouldReceiveFailureOnBadGraphSONSerialization() throws Exception {
final Cluster cluster = Cluster.build("localhost").serializer(Serializers.GRAPHSON_V1D0).create();
final Client client = cluster.connect();
try {
client.submit("def class C { def C getC(){return this}}; new C()").all().join();
fail("Should throw an exception.");
} catch (RuntimeException re) {
final Throwable root = ExceptionUtils.getRootCause(re);
assertThat(root.getMessage(), CoreMatchers.startsWith("Error during serialization: Direct self-reference leading to cycle (through reference chain:"));
// validate that we can still send messages to the server
assertEquals(2, client.submit("1+1").all().join().get(0).getInt());
} finally {
cluster.close();
}
}
@Test
public void shouldReceiveFailureOnBadGryoSerialization() throws Exception {
final Cluster cluster = Cluster.build("localhost").serializer(Serializers.GRYO_V1D0).create();
final Client client = cluster.connect();
try {
client.submit("java.awt.Color.RED").all().join();
fail("Should throw an exception.");
} catch (RuntimeException re) {
final Throwable root = ExceptionUtils.getRootCause(re);
assertThat(root.getMessage(), CoreMatchers.startsWith("Error during serialization: Class is not registered: java.awt.Color"));
// validate that we can still send messages to the server
assertEquals(2, client.submit("1+1").all().join().get(0).getInt());
} finally {
cluster.close();
}
}
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
@Test
public void shouldBlockRequestWhenTooBig() throws Exception {
final Cluster cluster = Cluster.open();
final Client client = cluster.connect();
try {
final String fatty = IntStream.range(0, 1024).mapToObj(String::valueOf).collect(Collectors.joining());
final CompletableFuture<ResultSet> result = client.submitAsync("'" + fatty + "';'test'");
final ResultSet resultSet = result.get(10000, TimeUnit.MILLISECONDS);
resultSet.all().get(10000, TimeUnit.MILLISECONDS);
fail("Should throw an exception.");
} catch (TimeoutException te) {
// the request should not have timed-out - the connection should have been reset, but it seems that
// timeout seems to occur as well on some systems (it's not clear why). however, the nature of this
// test is to ensure that the script isn't processed if it exceeds a certain size, so in this sense
// it seems ok to pass in this case.
} catch (Exception re) {
final Throwable root = ExceptionUtils.getRootCause(re);
assertEquals("Connection reset by peer", root.getMessage());
// validate that we can still send messages to the server
assertEquals(2, client.submit("1+1").all().join().get(0).getInt());
} finally {
cluster.close();
}
}
@Test
public void shouldFailOnDeadHost() throws Exception {
final Cluster cluster = Cluster.build("localhost").create();
final Client client = cluster.connect();
// ensure that connection to server is good
assertEquals(2, client.submit("1+1").all().join().get(0).getInt());
// kill the server which will make the client mark the host as unavailable
this.stopServer();
try {
// try to re-issue a request now that the server is down
client.submit("1+1").all().join();
fail();
} catch (RuntimeException re) {
assertThat(re.getCause().getCause() instanceof ClosedChannelException, is(true));
//
// should recover when the server comes back
//
// restart server
this.startServer();
// the retry interval is 1 second, wait a bit longer
TimeUnit.SECONDS.sleep(5);
List<Result> results = client.submit("1+1").all().join();
assertEquals(1, results.size());
assertEquals(2, results.get(0).getInt());
} finally {
cluster.close();
}
}
@Test
public void shouldNotHavePartialContentWithOneResult() throws Exception {
try (SimpleClient client = new WebSocketClient()) {
final RequestMessage request = RequestMessage.build(Tokens.OPS_EVAL)
.addArg(Tokens.ARGS_GREMLIN, "10").create();
final List<ResponseMessage> responses = client.submit(request);
assertEquals(1, responses.size());
assertEquals(ResponseStatusCode.SUCCESS, responses.get(0).getStatus().getCode());
}
}
@Test
public void shouldFailWithBadScriptEval() throws Exception {
try (SimpleClient client = new WebSocketClient()) {
final RequestMessage request = RequestMessage.build(Tokens.OPS_EVAL)
.addArg(Tokens.ARGS_GREMLIN, "new String().doNothingAtAllBecauseThis is a syntax error").create();
final List<ResponseMessage> responses = client.submit(request);
assertEquals(ResponseStatusCode.SERVER_ERROR_SCRIPT_EVALUATION, responses.get(0).getStatus().getCode());
assertEquals(1, responses.size());
}
}
@Test
@SuppressWarnings("unchecked")
public void shouldStillSupportDeprecatedRebindingsParameterOnServer() throws Exception {
// this test can be removed when the rebindings arg is removed
try (SimpleClient client = new WebSocketClient()) {
final Map<String,String> rebindings = new HashMap<>();
rebindings.put("xyz", "graph");
final RequestMessage request = RequestMessage.build(Tokens.OPS_EVAL)
.addArg(Tokens.ARGS_GREMLIN, "xyz.addVertex('name','jason')")
.addArg(Tokens.ARGS_REBINDINGS, rebindings).create();
final List<ResponseMessage> responses = client.submit(request);
assertEquals(1, responses.size());
final DetachedVertex v = ((ArrayList<DetachedVertex>) responses.get(0).getResult().getData()).get(0);
assertEquals("jason", v.value("name"));
}
}
}
| [
"pkusilvester@126.com"
] | pkusilvester@126.com |
7b0f2138242c22088b08373a96edfe3d3a722897 | 13cbb329807224bd736ff0ac38fd731eb6739389 | /com/sun/org/apache/xerces/internal/impl/xs/opti/SchemaDOM.java | 2349557b91843138ee0aafe8ffb58febdfe0cb12 | [] | no_license | ZhipingLi/rt-source | 5e2537ed5f25d9ba9a0f8009ff8eeca33930564c | 1a70a036a07b2c6b8a2aac6f71964192c89aae3c | refs/heads/master | 2023-07-14T15:00:33.100256 | 2021-09-01T04:49:04 | 2021-09-01T04:49:04 | 401,933,858 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,361 | java | package com.sun.org.apache.xerces.internal.impl.xs.opti;
import com.sun.org.apache.xerces.internal.util.XMLSymbols;
import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
import com.sun.org.apache.xerces.internal.xni.QName;
import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
import com.sun.org.apache.xerces.internal.xni.XMLString;
import java.util.ArrayList;
import java.util.Enumeration;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
public class SchemaDOM extends DefaultDocument {
static final int relationsRowResizeFactor = 15;
static final int relationsColResizeFactor = 10;
NodeImpl[][] relations;
ElementImpl parent;
int currLoc;
int nextFreeLoc;
boolean hidden;
boolean inCDATA;
private StringBuffer fAnnotationBuffer = null;
public SchemaDOM() { reset(); }
public ElementImpl startElement(QName paramQName, XMLAttributes paramXMLAttributes, int paramInt1, int paramInt2, int paramInt3) {
ElementImpl elementImpl = new ElementImpl(paramInt1, paramInt2, paramInt3);
processElement(paramQName, paramXMLAttributes, elementImpl);
this.parent = elementImpl;
return elementImpl;
}
public ElementImpl emptyElement(QName paramQName, XMLAttributes paramXMLAttributes, int paramInt1, int paramInt2, int paramInt3) {
ElementImpl elementImpl = new ElementImpl(paramInt1, paramInt2, paramInt3);
processElement(paramQName, paramXMLAttributes, elementImpl);
return elementImpl;
}
public ElementImpl startElement(QName paramQName, XMLAttributes paramXMLAttributes, int paramInt1, int paramInt2) { return startElement(paramQName, paramXMLAttributes, paramInt1, paramInt2, -1); }
public ElementImpl emptyElement(QName paramQName, XMLAttributes paramXMLAttributes, int paramInt1, int paramInt2) { return emptyElement(paramQName, paramXMLAttributes, paramInt1, paramInt2, -1); }
private void processElement(QName paramQName, XMLAttributes paramXMLAttributes, ElementImpl paramElementImpl) {
paramElementImpl.prefix = paramQName.prefix;
paramElementImpl.localpart = paramQName.localpart;
paramElementImpl.rawname = paramQName.rawname;
paramElementImpl.uri = paramQName.uri;
paramElementImpl.schemaDOM = this;
Attr[] arrayOfAttr = new Attr[paramXMLAttributes.getLength()];
byte b1;
for (b1 = 0; b1 < paramXMLAttributes.getLength(); b1++)
arrayOfAttr[b1] = new AttrImpl(paramElementImpl, paramXMLAttributes.getPrefix(b1), paramXMLAttributes.getLocalName(b1), paramXMLAttributes.getQName(b1), paramXMLAttributes.getURI(b1), paramXMLAttributes.getValue(b1));
paramElementImpl.attrs = arrayOfAttr;
if (this.nextFreeLoc == this.relations.length)
resizeRelations();
if (this.relations[this.currLoc][false] != this.parent) {
this.relations[this.nextFreeLoc][0] = this.parent;
this.currLoc = this.nextFreeLoc++;
}
b1 = 0;
byte b2 = 1;
for (b2 = 1; b2 < this.relations[this.currLoc].length; b2++) {
if (this.relations[this.currLoc][b2] == null) {
b1 = 1;
break;
}
}
if (b1 == 0)
resizeRelations(this.currLoc);
this.relations[this.currLoc][b2] = paramElementImpl;
this.parent.parentRow = this.currLoc;
paramElementImpl.row = this.currLoc;
paramElementImpl.col = b2;
}
public void endElement() {
this.currLoc = this.parent.row;
this.parent = (ElementImpl)this.relations[this.currLoc][0];
}
void comment(XMLString paramXMLString) {
this.fAnnotationBuffer.append("<!--");
if (paramXMLString.length > 0)
this.fAnnotationBuffer.append(paramXMLString.ch, paramXMLString.offset, paramXMLString.length);
this.fAnnotationBuffer.append("-->");
}
void processingInstruction(String paramString, XMLString paramXMLString) {
this.fAnnotationBuffer.append("<?").append(paramString);
if (paramXMLString.length > 0)
this.fAnnotationBuffer.append(' ').append(paramXMLString.ch, paramXMLString.offset, paramXMLString.length);
this.fAnnotationBuffer.append("?>");
}
void characters(XMLString paramXMLString) {
if (!this.inCDATA) {
StringBuffer stringBuffer = this.fAnnotationBuffer;
for (int i = paramXMLString.offset; i < paramXMLString.offset + paramXMLString.length; i++) {
char c = paramXMLString.ch[i];
if (c == '&') {
stringBuffer.append("&");
} else if (c == '<') {
stringBuffer.append("<");
} else if (c == '>') {
stringBuffer.append(">");
} else if (c == '\r') {
stringBuffer.append("
");
} else {
stringBuffer.append(c);
}
}
} else {
this.fAnnotationBuffer.append(paramXMLString.ch, paramXMLString.offset, paramXMLString.length);
}
}
void charactersRaw(String paramString) { this.fAnnotationBuffer.append(paramString); }
void endAnnotation(QName paramQName, ElementImpl paramElementImpl) {
this.fAnnotationBuffer.append("\n</").append(paramQName.rawname).append(">");
paramElementImpl.fAnnotation = this.fAnnotationBuffer.toString();
this.fAnnotationBuffer = null;
}
void endAnnotationElement(QName paramQName) { endAnnotationElement(paramQName.rawname); }
void endAnnotationElement(String paramString) { this.fAnnotationBuffer.append("</").append(paramString).append(">"); }
void endSyntheticAnnotationElement(QName paramQName, boolean paramBoolean) { endSyntheticAnnotationElement(paramQName.rawname, paramBoolean); }
void endSyntheticAnnotationElement(String paramString, boolean paramBoolean) {
if (paramBoolean) {
this.fAnnotationBuffer.append("\n</").append(paramString).append(">");
this.parent.fSyntheticAnnotation = this.fAnnotationBuffer.toString();
this.fAnnotationBuffer = null;
} else {
this.fAnnotationBuffer.append("</").append(paramString).append(">");
}
}
void startAnnotationCDATA() {
this.inCDATA = true;
this.fAnnotationBuffer.append("<![CDATA[");
}
void endAnnotationCDATA() {
this.fAnnotationBuffer.append("]]>");
this.inCDATA = false;
}
private void resizeRelations() {
NodeImpl[][] arrayOfNodeImpl = new NodeImpl[this.relations.length + 15][];
System.arraycopy(this.relations, 0, arrayOfNodeImpl, 0, this.relations.length);
for (int i = this.relations.length; i < arrayOfNodeImpl.length; i++)
arrayOfNodeImpl[i] = new NodeImpl[10];
this.relations = arrayOfNodeImpl;
}
private void resizeRelations(int paramInt) {
NodeImpl[] arrayOfNodeImpl = new NodeImpl[this.relations[paramInt].length + 10];
System.arraycopy(this.relations[paramInt], 0, arrayOfNodeImpl, 0, this.relations[paramInt].length);
this.relations[paramInt] = arrayOfNodeImpl;
}
public void reset() {
if (this.relations != null)
for (byte b1 = 0; b1 < this.relations.length; b1++) {
for (byte b2 = 0; b2 < this.relations[b1].length; b2++)
this.relations[b1][b2] = null;
}
this.relations = new NodeImpl[15][];
this.parent = new ElementImpl(0, 0, 0);
this.parent.rawname = "DOCUMENT_NODE";
this.currLoc = 0;
this.nextFreeLoc = 1;
this.inCDATA = false;
for (byte b = 0; b < 15; b++)
this.relations[b] = new NodeImpl[10];
this.relations[this.currLoc][0] = this.parent;
}
public void printDOM() {}
public static void traverse(Node paramNode, int paramInt) {
indent(paramInt);
System.out.print("<" + paramNode.getNodeName());
if (paramNode.hasAttributes()) {
NamedNodeMap namedNodeMap = paramNode.getAttributes();
for (byte b = 0; b < namedNodeMap.getLength(); b++)
System.out.print(" " + ((Attr)namedNodeMap.item(b)).getName() + "=\"" + ((Attr)namedNodeMap.item(b)).getValue() + "\"");
}
if (paramNode.hasChildNodes()) {
System.out.println(">");
paramInt += 4;
for (Node node = paramNode.getFirstChild(); node != null; node = node.getNextSibling())
traverse(node, paramInt);
paramInt -= 4;
indent(paramInt);
System.out.println("</" + paramNode.getNodeName() + ">");
} else {
System.out.println("/>");
}
}
public static void indent(int paramInt) {
for (byte b = 0; b < paramInt; b++)
System.out.print(' ');
}
public Element getDocumentElement() { return (ElementImpl)this.relations[0][1]; }
public DOMImplementation getImplementation() { return SchemaDOMImplementation.getDOMImplementation(); }
void startAnnotation(QName paramQName, XMLAttributes paramXMLAttributes, NamespaceContext paramNamespaceContext) { startAnnotation(paramQName.rawname, paramXMLAttributes, paramNamespaceContext); }
void startAnnotation(String paramString, XMLAttributes paramXMLAttributes, NamespaceContext paramNamespaceContext) {
if (this.fAnnotationBuffer == null)
this.fAnnotationBuffer = new StringBuffer(256);
this.fAnnotationBuffer.append("<").append(paramString).append(" ");
ArrayList arrayList = new ArrayList();
for (byte b = 0; b < paramXMLAttributes.getLength(); b++) {
String str1 = paramXMLAttributes.getValue(b);
String str2 = paramXMLAttributes.getPrefix(b);
String str3 = paramXMLAttributes.getQName(b);
if (str2 == XMLSymbols.PREFIX_XMLNS || str3 == XMLSymbols.PREFIX_XMLNS)
arrayList.add((str2 == XMLSymbols.PREFIX_XMLNS) ? paramXMLAttributes.getLocalName(b) : XMLSymbols.EMPTY_STRING);
this.fAnnotationBuffer.append(str3).append("=\"").append(processAttValue(str1)).append("\" ");
}
Enumeration enumeration = paramNamespaceContext.getAllPrefixes();
while (enumeration.hasMoreElements()) {
String str1 = (String)enumeration.nextElement();
String str2 = paramNamespaceContext.getURI(str1);
if (str2 == null)
str2 = XMLSymbols.EMPTY_STRING;
if (!arrayList.contains(str1)) {
if (str1 == XMLSymbols.EMPTY_STRING) {
this.fAnnotationBuffer.append("xmlns").append("=\"").append(processAttValue(str2)).append("\" ");
continue;
}
this.fAnnotationBuffer.append("xmlns:").append(str1).append("=\"").append(processAttValue(str2)).append("\" ");
}
}
this.fAnnotationBuffer.append(">\n");
}
void startAnnotationElement(QName paramQName, XMLAttributes paramXMLAttributes) { startAnnotationElement(paramQName.rawname, paramXMLAttributes); }
void startAnnotationElement(String paramString, XMLAttributes paramXMLAttributes) {
this.fAnnotationBuffer.append("<").append(paramString);
for (byte b = 0; b < paramXMLAttributes.getLength(); b++) {
String str = paramXMLAttributes.getValue(b);
this.fAnnotationBuffer.append(" ").append(paramXMLAttributes.getQName(b)).append("=\"").append(processAttValue(str)).append("\"");
}
this.fAnnotationBuffer.append(">");
}
private static String processAttValue(String paramString) {
int i = paramString.length();
for (byte b = 0; b < i; b++) {
char c = paramString.charAt(b);
if (c == '"' || c == '<' || c == '&' || c == '\t' || c == '\n' || c == '\r')
return escapeAttValue(paramString, b);
}
return paramString;
}
private static String escapeAttValue(String paramString, int paramInt) {
int j = paramString.length();
StringBuffer stringBuffer = new StringBuffer(j);
stringBuffer.append(paramString.substring(0, paramInt));
for (int i = paramInt; i < j; i++) {
char c = paramString.charAt(i);
if (c == '"') {
stringBuffer.append(""");
} else if (c == '<') {
stringBuffer.append("<");
} else if (c == '&') {
stringBuffer.append("&");
} else if (c == '\t') {
stringBuffer.append("	");
} else if (c == '\n') {
stringBuffer.append("
");
} else if (c == '\r') {
stringBuffer.append("
");
} else {
stringBuffer.append(c);
}
}
return stringBuffer.toString();
}
}
/* Location: D:\software\jd-gui\jd-gui-windows-1.6.3\rt.jar!\com\sun\org\apache\xerces\internal\impl\xs\opti\SchemaDOM.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.0.7
*/ | [
"michael__lee@yeah.net"
] | michael__lee@yeah.net |
f2c8509be6f98106715e79e9680157c482908dd0 | c06117af33b38466ba9b2bbe2d70318ea111b006 | /src/exceptions/BusinessException.java | d31bbaa6d473ed181f5830b00842a506b8a291be | [] | no_license | MARTINS809/aprendizadoExceptions-java | 5def29092b70a4c9a34dcee4423a42ae13e60734 | 038436d319fcc6c6ecb8b075d947bafafc0208cb | refs/heads/master | 2023-08-15T01:27:55.691184 | 2021-08-22T03:41:26 | 2021-08-22T03:41:26 | 398,685,857 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 197 | java | package exceptions;
public class BusinessException extends RuntimeException {
private static final long serialVersionUID = 1L;
public BusinessException(String msg) {
super(msg);
}
}
| [
"fmartins809@gmail.com"
] | fmartins809@gmail.com |
a841787ae969d835b02fe47af65df8496c8c0e8a | f4dea340b7c6799ed4b627e9f162344291eea9d7 | /app/src/main/java/com/xw/compoint/gallery/GalleryAdapter.java | df226d9b666b92fa6c85eee3194b51267f43178f | [] | no_license | dzs-yaodi/ComPoint | acb7df6d909ac13e5ddf4475045ffb1db8c47439 | 4af22f32e740845202c71dda8cb932111b70995f | refs/heads/master | 2023-07-19T06:40:52.930690 | 2021-08-30T10:20:47 | 2021-08-30T10:20:47 | 400,094,278 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,972 | java | package com.xw.compoint.gallery;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.Glide;
import com.xw.compoint.R;
public class GalleryAdapter extends RecyclerView.Adapter<GalleryAdapter.GalleryViewHolder>{
private int[] mImages = {R.mipmap.image1,R.mipmap.image2,R.mipmap.image3,R.mipmap.image4,
R.mipmap.image5,R.mipmap.image6,R.mipmap.image7,
R.mipmap.image8,R.mipmap.image9,R.mipmap.image10,};
@NonNull
@Override
public GalleryViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new GalleryViewHolder(LayoutInflater.from(parent.getContext()).inflate(
R.layout.item_gallery_layout,parent,false
));
}
@Override
public void onBindViewHolder(@NonNull GalleryViewHolder holder, int position) {
Glide.with(holder.itemView)
.load(mImages[position])
.into(holder.imageView);
}
@Override
public int getItemCount() {
return mImages.length;
}
class GalleryViewHolder extends RecyclerView.ViewHolder{
private ImageView imageView;
public GalleryViewHolder(@NonNull View itemView) {
super(itemView);
imageView = itemView.findViewById(R.id.image);
itemView.setOnClickListener(view -> {
if (onItemlickListener != null) {
onItemlickListener.onItemListener(getAdapterPosition());
}
});
}
}
private OnItemlickListener onItemlickListener;
public void setOnItemlickListener(OnItemlickListener onItemlickListener) {
this.onItemlickListener = onItemlickListener;
}
public interface OnItemlickListener {
void onItemListener(int position);
}
}
| [
"xushiyou@sobey.com"
] | xushiyou@sobey.com |
9276ba7686d77c0e21efe490ad5e5daa566796a0 | 5a076617e29016fe75d6421d235f22cc79f8f157 | /AndroidPdfViewerPDF查看器/src/com/sun/pdfview/Cache.java | 50d1b7fdb8bbfc4c41dddb7a3c4fe61490e114d3 | [] | no_license | dddddttttt/androidsourcecodes | 516b8c79cae7f4fa71b97a2a470eab52844e1334 | 3d13ab72163bbeed2ef226a476e29ca79766ea0b | refs/heads/master | 2020-08-17T01:38:54.095515 | 2018-04-08T15:17:24 | 2018-04-08T15:17:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,778 | java | /*
* $Id: Cache.java,v 1.4 2009/02/12 13:53:56 tomoke Exp $
*
* Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
* Santa Clara, California 95054, U.S.A. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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 St, Fifth Floor, Boston, MA 02110-1301 USA
*/
package com.sun.pdfview;
import java.lang.ref.SoftReference;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import android.graphics.Bitmap;
/**
* A cache of PDF pages and images.
*/
public class Cache {
/** the pages in the cache, mapped by page number */
private Map<Integer,SoftReference> pages;
/** Creates a new instance of a Cache */
public Cache() {
pages = Collections.synchronizedMap(new HashMap<Integer,SoftReference>());
}
/**
* Add a page to the cache. This method should be used for
* pages which have already been completely rendered.
*
* @param pageNumber the page number of this page
* @param page the page to add
*/
public void addPage(Integer pageNumber, PDFPage page) {
addPageRecord(pageNumber, page, null);
}
/**
* Add a page to the cache. This method should be used for
* pages which are still in the process of being rendered.
*
* @param pageNumber the page number of this page
* @param page the page to add
* @param parser the parser which is parsing this page
*/
public void addPage(Integer pageNumber, PDFPage page, PDFParser parser) {
addPageRecord(pageNumber, page, parser);
}
/**
* Add an image to the cache. This method should be used for images
* which have already been completely rendered
*
* @param page page this image is associated with
* @param info the image info associated with this image
* @param image the image to add
*/
public void addImage(PDFPage page, ImageInfo info, Bitmap image) {
addImageRecord(page, info, image, null);
}
/**
* Add an image to the cache. This method should be used for images
* which are still in the process of being rendered.
*
* @param page the page this image is associated with
* @param info the image info associated with this image
* @param image the image to add
* @param renderer the renderer which is rendering this page
*/
public void addImage(PDFPage page, ImageInfo info, Bitmap image,
PDFRenderer renderer) {
addImageRecord(page, info, image, renderer);
}
/**
* Get a page from the cache
*
* @param pageNumber the number of the page to get
* @return the page, if it is in the cache, or null if not
*/
public PDFPage getPage(Integer pageNumber) {
PageRecord rec = getPageRecord(pageNumber);
if (rec != null) {
return (PDFPage) rec.value;
}
// not found
return null;
}
/**
* Get a page's parser from the cache
*
* @param pageNumber the number of the page to get the parser for
* @return the parser, or null if it is not in the cache
*/
public PDFParser getPageParser(Integer pageNumber) {
PageRecord rec = getPageRecord(pageNumber);
if (rec != null) {
return (PDFParser) rec.generator;
}
// not found
return null;
}
/**
* Get an image from the cache
*
* @param page the page the image is associated with
* @param info the image info that describes the image
*
* @return the image if it is in the cache, or null if not
*/
public Bitmap getImage(PDFPage page, ImageInfo info) {
Record rec = getImageRecord(page, info);
if (rec != null) {
return (Bitmap) rec.value;
}
// not found
return null;
}
/**
* Get an image's renderer from the cache
*
* @param page the page this image was generated from
* @param info the image info describing the image
* @return the renderer, or null if it is not in the cache
*/
public PDFRenderer getImageRenderer(PDFPage page, ImageInfo info) {
Record rec = getImageRecord(page, info);
if (rec != null) {
return (PDFRenderer) rec.generator;
}
// not found
return null;
}
/**
* Remove a page and all its associated images, as well as its parser
* and renderers, from the cache
*
* @param pageNumber the number of the page to remove
*/
public void removePage(Integer pageNumber) {
removePageRecord(pageNumber);
}
/**
* Remove an image and its associated renderer from the cache
*
* @param page the page the image is generated from
* @param info the image info of the image to remove
*/
public void removeImage(PDFPage page, ImageInfo info) {
removeImageRecord(page, info);
}
/**
* The internal routine to add a page to the cache, and return the
* page record which was generated
*/
PageRecord addPageRecord(Integer pageNumber, PDFPage page,
PDFParser parser) {
PageRecord rec = new PageRecord();
rec.value = page;
rec.generator = parser;
pages.put(pageNumber, new SoftReference<Record>(rec));
return rec;
}
/**
* Get a page's record from the cache
*
* @return the record, or null if it's not in the cache
*/
PageRecord getPageRecord(Integer pageNumber) {
// System.out.println("Request for page " + pageNumber);
SoftReference ref = pages.get(pageNumber);
if (ref != null) {
String val = (ref.get() == null) ? " not in " : " in ";
// System.out.println("Page " + pageNumber + val + "cache");
return (PageRecord) ref.get();
}
// System.out.println("Page " + pageNumber + " not in cache");
// not in cache
return null;
}
/**
* Remove a page's record from the cache
*/
PageRecord removePageRecord(Integer pageNumber) {
SoftReference ref = pages.remove(pageNumber);
if (ref != null) {
return (PageRecord) ref.get();
}
// not in cache
return null;
}
/**
* The internal routine to add an image to the cache and return the
* record that was generated.
*/
Record addImageRecord(PDFPage page, ImageInfo info,
Bitmap image, PDFRenderer renderer) {
// first, find or create the relevant page record
Integer pageNumber = new Integer(page.getPageNumber());
PageRecord pageRec = getPageRecord(pageNumber);
if (pageRec == null) {
pageRec = addPageRecord(pageNumber, page, null);
}
// next, create the image record
Record rec = new Record();
rec.value = image;
rec.generator = renderer;
// add it to the cache
pageRec.images.put(info, new SoftReference<Record>(rec));
return rec;
}
/**
* Get an image's record from the cache
*
* @return the record, or null if it's not in the cache
*/
Record getImageRecord(PDFPage page, ImageInfo info) {
// first find the relevant page record
Integer pageNumber = new Integer(page.getPageNumber());
// System.out.println("Request for image on page " + pageNumber);
PageRecord pageRec = getPageRecord(pageNumber);
if (pageRec != null) {
SoftReference ref = pageRec.images.get(info);
if (ref != null) {
String val = (ref.get() == null) ? " not in " : " in ";
// System.out.println("Image on page " + pageNumber + val + " cache");
return (Record) ref.get();
}
}
// System.out.println("Image on page " + pageNumber + " not in cache");
// not found
return null;
}
/**
* Remove an image's record from the cache
*/
Record removeImageRecord(PDFPage page, ImageInfo info) {
// first find the relevant page record
Integer pageNumber = new Integer(page.getPageNumber());
PageRecord pageRec = getPageRecord(pageNumber);
if (pageRec != null) {
SoftReference ref = pageRec.images.remove(info);
if (ref != null) {
return (Record) ref.get();
}
}
return null;
}
/** the basic information about a page or image */
class Record {
/** the page or image itself */
Object value;
/** the thing generating the page, or null if done/not provided */
BaseWatchable generator;
}
/** the record stored for each page in the cache */
class PageRecord extends Record {
/** any images associated with the page */
Map<ImageInfo, SoftReference<Record>> images;
/** create a new page record */
public PageRecord() {
images = Collections.synchronizedMap(new HashMap<ImageInfo, SoftReference<Record>>());
}
}
}
| [
"harry.han@gmail.com"
] | harry.han@gmail.com |
60756f2a3f60babe3f8ead53e64a2787ebe7bdef | e41507592722fd1549a9b43d7545b4d6d5d256ed | /src/main/java/org/fhir/service/MedicationDispenseServiceImpl.java | 1049a47ee08f3db2385e2b54747b30a48a44a964 | [
"MIT"
] | permissive | gmai2006/fhir | a91636495409615ab41cc2a01e296cddc64159ee | 8613874a4a93a108c8520f8752155449464deb48 | refs/heads/master | 2021-05-02T07:11:25.129498 | 2021-02-26T00:17:15 | 2021-02-26T00:17:15 | 120,861,248 | 2 | 0 | null | 2020-01-14T22:16:55 | 2018-02-09T05:29:57 | Java | UTF-8 | Java | false | false | 9,535 | java | /*
* #%L
* FHIR Implementation
* %%
* Copyright (C) 2018 DataScience 9 LLC
* %%
* 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.
* #L%
*/
/**
* This code is 100% AUTO generated. Please do not modify it DIRECTLY
* If you need new features or function or changes please update the templates
* then submit the template through our web interface.
*/
package org.fhir.service;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import static java.util.Objects.requireNonNull;
import com.google.inject.Inject;
import com.google.inject.persist.Transactional;
import org.fhir.dao.*;
import org.fhir.entity.*;
import org.fhir.utils.QueryBuilder;
import org.fhir.pojo.MedicationDispense;
/**
* Auto generated from the FHIR specification
* generated on 07/14/2018
*/
public class MedicationDispenseServiceImpl implements MedicationDispenseService {
private final Logger logger = Logger.getLogger(this.getClass().getName());
private final MedicationDispenseDao dao;
@Inject
public MedicationDispenseServiceImpl(final MedicationDispenseDao dao) {
requireNonNull(dao);
this.dao = dao;
}
public MedicationDispense find(String id) {
final MedicationDispense result = dao.find(id);
logger.info("find(MedicationDispense) - exited - return value={} result ");
return result;
}
public List<MedicationDispense> select(int maxResult) {
final List<MedicationDispense> result = dao.select(maxResult);
logger.info("select(MedicationDispense) - exited - return value={} result ");
return result;
}
public List<MedicationDispense> selectAll() {
final List<MedicationDispense> results = dao.selectAll();
logger.info("selectAll(MedicationDispense) - exited - return value={} result ");
return results;
}
@Override
@Transactional
public MedicationDispense create(MedicationDispense bean) {
requireNonNull(bean);
logger.info("create(MedicationDispense={}) - entered bean ");
final MedicationDispense result = dao.create(bean);
logger.info("create(MedicationDispense) - exited - return value={} result ");
return result;
}
@Override
@Transactional
public MedicationDispense update(MedicationDispense bean) {
requireNonNull(bean);
logger.info("update(MedicationDispense={}) - entered bean ");
final MedicationDispense result = dao.update(bean);
logger.info("update(MedicationDispense) - exited - return value={} result ");
return result;
}
@Override
@Transactional
public void delete(String id) {
logger.info("delete(MedicationDispense={}) - entered id " + id);
dao.delete(id);
logger.info("delete(MedicationDispense) - exited - return value={} result ");
}
@Override
public List<MedicationDispense> findByField(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findByField(queryBuilder);
logger.info("findByField- exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findByPartOf(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findByPartOf(queryBuilder);
logger.info("findBypartOf - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findByCategory(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findByCategory(queryBuilder);
logger.info("findBycategory - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findByMedicationCodeableConcept(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findByMedicationCodeableConcept(queryBuilder);
logger.info("findBymedicationCodeableConcept - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findByMedicationReference(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findByMedicationReference(queryBuilder);
logger.info("findBymedicationReference - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findBySubject(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findBySubject(queryBuilder);
logger.info("findBysubject - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findByContext(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findByContext(queryBuilder);
logger.info("findBycontext - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findBySupportingInformation(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findBySupportingInformation(queryBuilder);
logger.info("findBysupportingInformation - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findByPerformer(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findByPerformer(queryBuilder);
logger.info("findByperformer - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findByAuthorizingPrescription(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findByAuthorizingPrescription(queryBuilder);
logger.info("findByauthorizingPrescription - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findByType(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findByType(queryBuilder);
logger.info("findBytype - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findByQuantity(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findByQuantity(queryBuilder);
logger.info("findByquantity - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findByDaysSupply(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findByDaysSupply(queryBuilder);
logger.info("findBydaysSupply - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findByDestination(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findByDestination(queryBuilder);
logger.info("findBydestination - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findByReceiver(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findByReceiver(queryBuilder);
logger.info("findByreceiver - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findByDosageInstruction(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findByDosageInstruction(queryBuilder);
logger.info("findBydosageInstruction - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findBySubstitution(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findBySubstitution(queryBuilder);
logger.info("findBysubstitution - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findByDetectedIssue(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findByDetectedIssue(queryBuilder);
logger.info("findBydetectedIssue - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findByNotDoneReasonCodeableConcept(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findByNotDoneReasonCodeableConcept(queryBuilder);
logger.info("findBynotDoneReasonCodeableConcept - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findByNotDoneReasonReference(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findByNotDoneReasonReference(queryBuilder);
logger.info("findBynotDoneReasonReference - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findByEventHistory(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findByEventHistory(queryBuilder);
logger.info("findByeventHistory - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findByText(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findByText(queryBuilder);
logger.info("findBytext - exited - return value={} result ");
return result;
}
@Override
public List<MedicationDispense> findByMeta(QueryBuilder queryBuilder) {
final List<MedicationDispense> result = dao.findByMeta(queryBuilder);
logger.info("findBymeta - exited - return value={} result ");
return result;
}
} | [
"gmai2006@gmail.com"
] | gmai2006@gmail.com |
9aa3d9c600a202f984f1c8c7f3894ef9d30eae8d | d8293b745b5753ca4a8ee142e9651953d7e3f988 | /src/main/java/com/repository/DrawResultRepository.java | ae2453c64bf53787ab5e26883cabd3ba5b885a1f | [] | no_license | hungtony/LotteryProject | 95eabaf0f0ef60feeb0f76feee1aa11facebef6d | 795fc36d32c7bbd6112f7dd81a5720617bdb3215 | refs/heads/master | 2020-04-17T10:38:00.567791 | 2019-01-25T09:20:40 | 2019-01-25T09:20:40 | 166,507,859 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 515 | java | package com.repository;
import com.pojo.entity.DrawResult;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface DrawResultRepository extends JpaRepository<DrawResult,Integer> {
DrawResult findTopByLotteryIdOrderByIssueCodeDesc(Integer lotteryId);
List<DrawResult> findByLotteryIdOrderByIssueCodeDesc(Integer lotteryId, Pageable pageable);
}
| [
"tony.hung@rdgroup.com.tw"
] | tony.hung@rdgroup.com.tw |
99f9741c8a6cd986488d86397392578b909a58cc | f7c5447bb8845429584cf4646405188174620f95 | /Final Project/project/app/src/main/java/com/example/saboorhussain/project/View/Signup.java | fd1c1fb2352740b474f63778dcbbe0291632d4f5 | [] | no_license | RafayMLk/Software-for-Mobile-Devices | 8cc7182550abe1d7c1ee81547b87f03d5b2a6034 | 2a3911ac1f039bc4bb8f0da2fe6a3eac71dba7f6 | refs/heads/master | 2020-03-28T14:47:29.434044 | 2018-12-12T21:51:52 | 2018-12-12T21:51:52 | 148,522,976 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,691 | java | package com.example.saboorhussain.project.View;
import android.Manifest;
import android.app.Dialog;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Address;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ProgressBar;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import com.example.saboorhussain.project.MainActivity;
import com.example.saboorhussain.project.MapsActivity;
import com.example.saboorhussain.project.Model.LoginInteractor;
import com.example.saboorhussain.project.Model.SignupInteractor;
import com.example.saboorhussain.project.Presenter.LoginPresenter;
import com.example.saboorhussain.project.Presenter.SignupPresenter;
import com.example.saboorhussain.project.R;
import com.example.saboorhussain.project.UploadImage;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.OnProgressListener;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
import java.io.IOException;
import java.net.URI;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static android.support.v4.app.ActivityCompat.startActivityForResult;
public class Signup extends AppCompatActivity implements SignupVIew {
private GoogleMap mMap;
public Marker u1m;
public Marker u2m;
public Marker u3m;
Dialog myDialog;
EditText etEmail, etPassword, etName , etProffession , etAge ,etContact;
Button tvUpload;
Button btSignup;
RadioGroup rgGender;
RadioButton rbMale,rbFemale;
ProgressBar pbSignupProgress;
CheckBox TermAndConditions;
SignupPresenter mSignupPresenter;
ImageButton imageButton;
private int Gallery_intent = 2;
de.hdodenhof.circleimageview.CircleImageView ProfileImage;
StorageReference imagePath;
Uri uri;
String uri1;
String lat;
String lon;
LocationManager locationManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.signup);
locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}
if (locationManager.isProviderEnabled(locationManager.NETWORK_PROVIDER)) {
locationManager.requestLocationUpdates(locationManager.NETWORK_PROVIDER, 0, 0, new LocationListener() {
@Override
public void onLocationChanged(Location location) {
double latitude = location.getLatitude();
double longitude = location.getLongitude();
lat = Double.toString(latitude);
lon = Double.toString(longitude);
LatLng latLng = new LatLng(latitude, longitude);
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onProviderDisabled(String provider) {
}
});
} else if (locationManager.isProviderEnabled(locationManager.GPS_PROVIDER)) {
locationManager.requestLocationUpdates(locationManager.GPS_PROVIDER, 0, 0, new LocationListener() {
@Override
public void onLocationChanged(Location location) {
double latitude = location.getLatitude();
double longitude = location.getLongitude();
LatLng latLng = new LatLng(latitude, longitude);
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onProviderDisabled(String provider) {
}
});
}
etName = findViewById(R.id.editText3);
etProffession = findViewById(R.id.Profession);
etAge = findViewById(R.id.etAge);
etContact = findViewById(R.id.etContact);
etEmail = findViewById(R.id.etEmail);
etPassword = findViewById(R.id.etPassword);
pbSignupProgress = findViewById(R.id.signup_progress);
rgGender = findViewById(R.id.radioSex);
rbMale = findViewById(R.id.rbMale);
rbFemale = findViewById(R.id.rbFemale);
btSignup = findViewById(R.id.btSignup);
imageButton = findViewById(R.id.imageButton1);
TermAndConditions = findViewById(R.id.TC);
ProfileImage = findViewById(R.id.Profile_Image);
tvUpload = findViewById(R.id.TVUpload);
mSignupPresenter = new SignupPresenter(this, new SignupInteractor());
imageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mSignupPresenter.UploadImage();
}
});
tvUpload.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(getApplicationContext(), R.string.Upload, Toast.LENGTH_LONG).show();
imagePath = FirebaseStorage.getInstance().getReference().child("Users").child(uri.getLastPathSegment());
DatabaseReference myref = FirebaseDatabase.getInstance().getReference("Users");
imagePath.putFile(uri).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
pbSignupProgress.setVisibility(View.GONE);
Toast.makeText(getApplicationContext(), R.string.Uploaded, Toast.LENGTH_LONG).show();
imagePath.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
uri1 = uri.toString();
Toast.makeText(getApplicationContext(), R.string.Start + uri1, Toast.LENGTH_LONG).show();
}
});
}
}
).addOnFailureListener(
new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
pbSignupProgress.setVisibility(View.GONE);
Toast.makeText(getApplicationContext(), R.string.Not_uploaded, Toast.LENGTH_LONG).show();
}
}
).addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() {
@Override
public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {
pbSignupProgress.setVisibility(View.VISIBLE);
}
});
}
});
btSignup.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String Email = etEmail.getText().toString();
String Password = etPassword.getText().toString();
String ImageAddress = imagePath.toString();
String Name = etName.getText().toString();
String Age = etAge.getText().toString();
String Contact = etContact.getText().toString();
String Proffession = etProffession.getText().toString();
Toast.makeText(getApplicationContext(), "End" + uri1, Toast.LENGTH_LONG).show();
mSignupPresenter.ValidateCredentials(Email,Password,rgGender,rbMale,rbFemale,TermAndConditions,ImageAddress,Name, Age, Contact , Proffession,uri1,lat,lon);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == Gallery_intent && resultCode == RESULT_OK) {
uri = data.getData();
ProfileImage.setImageURI(uri);
}
}
@Override
public void showProgress() {
pbSignupProgress.setVisibility(View.VISIBLE);
}
@Override
public void ShowSuccessToast() {
Toast.makeText(getApplicationContext(),R.string.Welcome_You_have_Signed_Up, Toast.LENGTH_LONG ).show();
Intent intent = new Intent(Signup.this, LoginActivity.class);
startActivity(intent);
}
@Override
public void showTermAndConditionEmptyError() {
Toast.makeText(getApplicationContext(),R.string.You_must_check_Term_and_Conditions_to_Sign_Up, Toast.LENGTH_LONG ).show();
}
@Override
public void setEmailAlreadyExistsError() {
etEmail.setError(R.string.Email_already_exists);
}
@Override
public void setWeakPasswordError() {
etPassword.setError(R.string.Password_is_very_Weak);
}
@Override
public void setWrongPasswordError() {
etPassword.setError(R.string.Wrong_Password);
}
@Override
public void showVerficationEmailSentMessage() {
Toast.makeText(getApplicationContext(),R.string.A_verification_Email_is_sent_on_your_Entered_E_mail, Toast.LENGTH_LONG ).show();
}
@Override
public void showVerficationEmailFailedMessage(String a) {
Toast.makeText(getApplicationContext(),R.string.Mymessage+a, Toast.LENGTH_LONG ).show();
}
@Override
public void StartIntent(Intent i, int Gallery) {
startActivityForResult(i, Gallery);
}
@Override
public void showmail(String mail) {
Toast.makeText(getApplicationContext(),R.string.Email+mail, Toast.LENGTH_LONG ).show();
}
@Override
public void hideProgress() {
pbSignupProgress.setVisibility(View.GONE);
}
@Override
public void setEmailEmptyError() {
etEmail.setError(R.string.Email_is_Mandatory_to_Signup);
}
@Override
public void setEmailInvalidError() {
etEmail.setError(R.string.Email_is_Invalid);
}
@Override
public void setPasswordEmptyError() {
etPassword.setError(R.string.Password_is_Mandatory_to_Signup);
}
}
| [
"rafay_anwar@hotmail.com"
] | rafay_anwar@hotmail.com |
13741dc23f66bbf606814edbfbea69cb7e80a555 | 4917bcfe0f4d1b8a974ca02ba1a28e0dcad7aaaf | /src/main/java/com/google/schemaorg/core/impl/EmergencyServiceImpl.java | e594af667ea37f85c1c22c43b931f95660d688a7 | [
"Apache-2.0"
] | permissive | google/schemaorg-java | e9a74eb5c5a69014a9763d961103a32254e792b7 | d11c8edf686de6446c34e92f9b3243079d8cb76e | refs/heads/master | 2023-08-23T12:49:26.774277 | 2022-08-25T12:49:06 | 2022-08-25T12:49:06 | 58,669,416 | 77 | 48 | Apache-2.0 | 2022-08-06T11:35:15 | 2016-05-12T19:08:04 | Java | UTF-8 | Java | false | false | 42,865 | java | /*
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* 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.google.schemaorg.core;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import com.google.schemaorg.SchemaOrgTypeImpl;
import com.google.schemaorg.ValueType;
import com.google.schemaorg.core.datatype.Date;
import com.google.schemaorg.core.datatype.Text;
import com.google.schemaorg.core.datatype.URL;
import com.google.schemaorg.goog.GoogConstants;
import com.google.schemaorg.goog.PopularityScoreSpecification;
/** Implementation of {@link EmergencyService}. */
public class EmergencyServiceImpl extends LocalBusinessImpl implements EmergencyService {
private static final ImmutableSet<String> PROPERTY_SET = initializePropertySet();
private static ImmutableSet<String> initializePropertySet() {
ImmutableSet.Builder<String> builder = ImmutableSet.builder();
builder.add(CoreConstants.PROPERTY_ADDITIONAL_PROPERTY);
builder.add(CoreConstants.PROPERTY_ADDITIONAL_TYPE);
builder.add(CoreConstants.PROPERTY_ADDRESS);
builder.add(CoreConstants.PROPERTY_AGGREGATE_RATING);
builder.add(CoreConstants.PROPERTY_ALTERNATE_NAME);
builder.add(CoreConstants.PROPERTY_ALUMNI);
builder.add(CoreConstants.PROPERTY_AREA_SERVED);
builder.add(CoreConstants.PROPERTY_AWARD);
builder.add(CoreConstants.PROPERTY_AWARDS);
builder.add(CoreConstants.PROPERTY_BRANCH_CODE);
builder.add(CoreConstants.PROPERTY_BRANCH_OF);
builder.add(CoreConstants.PROPERTY_BRAND);
builder.add(CoreConstants.PROPERTY_CONTACT_POINT);
builder.add(CoreConstants.PROPERTY_CONTACT_POINTS);
builder.add(CoreConstants.PROPERTY_CONTAINED_IN);
builder.add(CoreConstants.PROPERTY_CONTAINED_IN_PLACE);
builder.add(CoreConstants.PROPERTY_CONTAINS_PLACE);
builder.add(CoreConstants.PROPERTY_CURRENCIES_ACCEPTED);
builder.add(CoreConstants.PROPERTY_DEPARTMENT);
builder.add(CoreConstants.PROPERTY_DESCRIPTION);
builder.add(CoreConstants.PROPERTY_DISSOLUTION_DATE);
builder.add(CoreConstants.PROPERTY_DUNS);
builder.add(CoreConstants.PROPERTY_EMAIL);
builder.add(CoreConstants.PROPERTY_EMPLOYEE);
builder.add(CoreConstants.PROPERTY_EMPLOYEES);
builder.add(CoreConstants.PROPERTY_EVENT);
builder.add(CoreConstants.PROPERTY_EVENTS);
builder.add(CoreConstants.PROPERTY_FAX_NUMBER);
builder.add(CoreConstants.PROPERTY_FOUNDER);
builder.add(CoreConstants.PROPERTY_FOUNDERS);
builder.add(CoreConstants.PROPERTY_FOUNDING_DATE);
builder.add(CoreConstants.PROPERTY_FOUNDING_LOCATION);
builder.add(CoreConstants.PROPERTY_GEO);
builder.add(CoreConstants.PROPERTY_GLOBAL_LOCATION_NUMBER);
builder.add(CoreConstants.PROPERTY_HAS_MAP);
builder.add(CoreConstants.PROPERTY_HAS_OFFER_CATALOG);
builder.add(CoreConstants.PROPERTY_HAS_POS);
builder.add(CoreConstants.PROPERTY_IMAGE);
builder.add(CoreConstants.PROPERTY_ISIC_V4);
builder.add(CoreConstants.PROPERTY_LEGAL_NAME);
builder.add(CoreConstants.PROPERTY_LOCATION);
builder.add(CoreConstants.PROPERTY_LOGO);
builder.add(CoreConstants.PROPERTY_MAIN_ENTITY_OF_PAGE);
builder.add(CoreConstants.PROPERTY_MAKES_OFFER);
builder.add(CoreConstants.PROPERTY_MAP);
builder.add(CoreConstants.PROPERTY_MAPS);
builder.add(CoreConstants.PROPERTY_MEMBER);
builder.add(CoreConstants.PROPERTY_MEMBER_OF);
builder.add(CoreConstants.PROPERTY_MEMBERS);
builder.add(CoreConstants.PROPERTY_NAICS);
builder.add(CoreConstants.PROPERTY_NAME);
builder.add(CoreConstants.PROPERTY_NUMBER_OF_EMPLOYEES);
builder.add(CoreConstants.PROPERTY_OPENING_HOURS);
builder.add(CoreConstants.PROPERTY_OPENING_HOURS_SPECIFICATION);
builder.add(CoreConstants.PROPERTY_OWNS);
builder.add(CoreConstants.PROPERTY_PARENT_ORGANIZATION);
builder.add(CoreConstants.PROPERTY_PAYMENT_ACCEPTED);
builder.add(CoreConstants.PROPERTY_PHOTO);
builder.add(CoreConstants.PROPERTY_PHOTOS);
builder.add(CoreConstants.PROPERTY_POTENTIAL_ACTION);
builder.add(CoreConstants.PROPERTY_PRICE_RANGE);
builder.add(CoreConstants.PROPERTY_REVIEW);
builder.add(CoreConstants.PROPERTY_REVIEWS);
builder.add(CoreConstants.PROPERTY_SAME_AS);
builder.add(CoreConstants.PROPERTY_SEEKS);
builder.add(CoreConstants.PROPERTY_SERVICE_AREA);
builder.add(CoreConstants.PROPERTY_SUB_ORGANIZATION);
builder.add(CoreConstants.PROPERTY_TAX_ID);
builder.add(CoreConstants.PROPERTY_TELEPHONE);
builder.add(CoreConstants.PROPERTY_URL);
builder.add(CoreConstants.PROPERTY_VAT_ID);
builder.add(GoogConstants.PROPERTY_DETAILED_DESCRIPTION);
builder.add(GoogConstants.PROPERTY_POPULARITY_SCORE);
return builder.build();
}
static final class BuilderImpl extends SchemaOrgTypeImpl.BuilderImpl<EmergencyService.Builder>
implements EmergencyService.Builder {
@Override
public EmergencyService.Builder addAdditionalProperty(PropertyValue value) {
return addProperty(CoreConstants.PROPERTY_ADDITIONAL_PROPERTY, value);
}
@Override
public EmergencyService.Builder addAdditionalProperty(PropertyValue.Builder value) {
return addProperty(CoreConstants.PROPERTY_ADDITIONAL_PROPERTY, value.build());
}
@Override
public EmergencyService.Builder addAdditionalProperty(String value) {
return addProperty(CoreConstants.PROPERTY_ADDITIONAL_PROPERTY, Text.of(value));
}
@Override
public EmergencyService.Builder addAdditionalType(URL value) {
return addProperty(CoreConstants.PROPERTY_ADDITIONAL_TYPE, value);
}
@Override
public EmergencyService.Builder addAdditionalType(String value) {
return addProperty(CoreConstants.PROPERTY_ADDITIONAL_TYPE, Text.of(value));
}
@Override
public EmergencyService.Builder addAddress(PostalAddress value) {
return addProperty(CoreConstants.PROPERTY_ADDRESS, value);
}
@Override
public EmergencyService.Builder addAddress(PostalAddress.Builder value) {
return addProperty(CoreConstants.PROPERTY_ADDRESS, value.build());
}
@Override
public EmergencyService.Builder addAddress(Text value) {
return addProperty(CoreConstants.PROPERTY_ADDRESS, value);
}
@Override
public EmergencyService.Builder addAddress(String value) {
return addProperty(CoreConstants.PROPERTY_ADDRESS, Text.of(value));
}
@Override
public EmergencyService.Builder addAggregateRating(AggregateRating value) {
return addProperty(CoreConstants.PROPERTY_AGGREGATE_RATING, value);
}
@Override
public EmergencyService.Builder addAggregateRating(AggregateRating.Builder value) {
return addProperty(CoreConstants.PROPERTY_AGGREGATE_RATING, value.build());
}
@Override
public EmergencyService.Builder addAggregateRating(String value) {
return addProperty(CoreConstants.PROPERTY_AGGREGATE_RATING, Text.of(value));
}
@Override
public EmergencyService.Builder addAlternateName(Text value) {
return addProperty(CoreConstants.PROPERTY_ALTERNATE_NAME, value);
}
@Override
public EmergencyService.Builder addAlternateName(String value) {
return addProperty(CoreConstants.PROPERTY_ALTERNATE_NAME, Text.of(value));
}
@Override
public EmergencyService.Builder addAlumni(Person value) {
return addProperty(CoreConstants.PROPERTY_ALUMNI, value);
}
@Override
public EmergencyService.Builder addAlumni(Person.Builder value) {
return addProperty(CoreConstants.PROPERTY_ALUMNI, value.build());
}
@Override
public EmergencyService.Builder addAlumni(String value) {
return addProperty(CoreConstants.PROPERTY_ALUMNI, Text.of(value));
}
@Override
public EmergencyService.Builder addAreaServed(AdministrativeArea value) {
return addProperty(CoreConstants.PROPERTY_AREA_SERVED, value);
}
@Override
public EmergencyService.Builder addAreaServed(AdministrativeArea.Builder value) {
return addProperty(CoreConstants.PROPERTY_AREA_SERVED, value.build());
}
@Override
public EmergencyService.Builder addAreaServed(GeoShape value) {
return addProperty(CoreConstants.PROPERTY_AREA_SERVED, value);
}
@Override
public EmergencyService.Builder addAreaServed(GeoShape.Builder value) {
return addProperty(CoreConstants.PROPERTY_AREA_SERVED, value.build());
}
@Override
public EmergencyService.Builder addAreaServed(Place value) {
return addProperty(CoreConstants.PROPERTY_AREA_SERVED, value);
}
@Override
public EmergencyService.Builder addAreaServed(Place.Builder value) {
return addProperty(CoreConstants.PROPERTY_AREA_SERVED, value.build());
}
@Override
public EmergencyService.Builder addAreaServed(Text value) {
return addProperty(CoreConstants.PROPERTY_AREA_SERVED, value);
}
@Override
public EmergencyService.Builder addAreaServed(String value) {
return addProperty(CoreConstants.PROPERTY_AREA_SERVED, Text.of(value));
}
@Override
public EmergencyService.Builder addAward(Text value) {
return addProperty(CoreConstants.PROPERTY_AWARD, value);
}
@Override
public EmergencyService.Builder addAward(String value) {
return addProperty(CoreConstants.PROPERTY_AWARD, Text.of(value));
}
@Override
public EmergencyService.Builder addAwards(Text value) {
return addProperty(CoreConstants.PROPERTY_AWARDS, value);
}
@Override
public EmergencyService.Builder addAwards(String value) {
return addProperty(CoreConstants.PROPERTY_AWARDS, Text.of(value));
}
@Override
public EmergencyService.Builder addBranchCode(Text value) {
return addProperty(CoreConstants.PROPERTY_BRANCH_CODE, value);
}
@Override
public EmergencyService.Builder addBranchCode(String value) {
return addProperty(CoreConstants.PROPERTY_BRANCH_CODE, Text.of(value));
}
@Override
public EmergencyService.Builder addBranchOf(Organization value) {
return addProperty(CoreConstants.PROPERTY_BRANCH_OF, value);
}
@Override
public EmergencyService.Builder addBranchOf(Organization.Builder value) {
return addProperty(CoreConstants.PROPERTY_BRANCH_OF, value.build());
}
@Override
public EmergencyService.Builder addBranchOf(String value) {
return addProperty(CoreConstants.PROPERTY_BRANCH_OF, Text.of(value));
}
@Override
public EmergencyService.Builder addBrand(Brand value) {
return addProperty(CoreConstants.PROPERTY_BRAND, value);
}
@Override
public EmergencyService.Builder addBrand(Brand.Builder value) {
return addProperty(CoreConstants.PROPERTY_BRAND, value.build());
}
@Override
public EmergencyService.Builder addBrand(Organization value) {
return addProperty(CoreConstants.PROPERTY_BRAND, value);
}
@Override
public EmergencyService.Builder addBrand(Organization.Builder value) {
return addProperty(CoreConstants.PROPERTY_BRAND, value.build());
}
@Override
public EmergencyService.Builder addBrand(String value) {
return addProperty(CoreConstants.PROPERTY_BRAND, Text.of(value));
}
@Override
public EmergencyService.Builder addContactPoint(ContactPoint value) {
return addProperty(CoreConstants.PROPERTY_CONTACT_POINT, value);
}
@Override
public EmergencyService.Builder addContactPoint(ContactPoint.Builder value) {
return addProperty(CoreConstants.PROPERTY_CONTACT_POINT, value.build());
}
@Override
public EmergencyService.Builder addContactPoint(String value) {
return addProperty(CoreConstants.PROPERTY_CONTACT_POINT, Text.of(value));
}
@Override
public EmergencyService.Builder addContactPoints(ContactPoint value) {
return addProperty(CoreConstants.PROPERTY_CONTACT_POINTS, value);
}
@Override
public EmergencyService.Builder addContactPoints(ContactPoint.Builder value) {
return addProperty(CoreConstants.PROPERTY_CONTACT_POINTS, value.build());
}
@Override
public EmergencyService.Builder addContactPoints(String value) {
return addProperty(CoreConstants.PROPERTY_CONTACT_POINTS, Text.of(value));
}
@Override
public EmergencyService.Builder addContainedIn(Place value) {
return addProperty(CoreConstants.PROPERTY_CONTAINED_IN, value);
}
@Override
public EmergencyService.Builder addContainedIn(Place.Builder value) {
return addProperty(CoreConstants.PROPERTY_CONTAINED_IN, value.build());
}
@Override
public EmergencyService.Builder addContainedIn(String value) {
return addProperty(CoreConstants.PROPERTY_CONTAINED_IN, Text.of(value));
}
@Override
public EmergencyService.Builder addContainedInPlace(Place value) {
return addProperty(CoreConstants.PROPERTY_CONTAINED_IN_PLACE, value);
}
@Override
public EmergencyService.Builder addContainedInPlace(Place.Builder value) {
return addProperty(CoreConstants.PROPERTY_CONTAINED_IN_PLACE, value.build());
}
@Override
public EmergencyService.Builder addContainedInPlace(String value) {
return addProperty(CoreConstants.PROPERTY_CONTAINED_IN_PLACE, Text.of(value));
}
@Override
public EmergencyService.Builder addContainsPlace(Place value) {
return addProperty(CoreConstants.PROPERTY_CONTAINS_PLACE, value);
}
@Override
public EmergencyService.Builder addContainsPlace(Place.Builder value) {
return addProperty(CoreConstants.PROPERTY_CONTAINS_PLACE, value.build());
}
@Override
public EmergencyService.Builder addContainsPlace(String value) {
return addProperty(CoreConstants.PROPERTY_CONTAINS_PLACE, Text.of(value));
}
@Override
public EmergencyService.Builder addCurrenciesAccepted(Text value) {
return addProperty(CoreConstants.PROPERTY_CURRENCIES_ACCEPTED, value);
}
@Override
public EmergencyService.Builder addCurrenciesAccepted(String value) {
return addProperty(CoreConstants.PROPERTY_CURRENCIES_ACCEPTED, Text.of(value));
}
@Override
public EmergencyService.Builder addDepartment(Organization value) {
return addProperty(CoreConstants.PROPERTY_DEPARTMENT, value);
}
@Override
public EmergencyService.Builder addDepartment(Organization.Builder value) {
return addProperty(CoreConstants.PROPERTY_DEPARTMENT, value.build());
}
@Override
public EmergencyService.Builder addDepartment(String value) {
return addProperty(CoreConstants.PROPERTY_DEPARTMENT, Text.of(value));
}
@Override
public EmergencyService.Builder addDescription(Text value) {
return addProperty(CoreConstants.PROPERTY_DESCRIPTION, value);
}
@Override
public EmergencyService.Builder addDescription(String value) {
return addProperty(CoreConstants.PROPERTY_DESCRIPTION, Text.of(value));
}
@Override
public EmergencyService.Builder addDissolutionDate(Date value) {
return addProperty(CoreConstants.PROPERTY_DISSOLUTION_DATE, value);
}
@Override
public EmergencyService.Builder addDissolutionDate(String value) {
return addProperty(CoreConstants.PROPERTY_DISSOLUTION_DATE, Text.of(value));
}
@Override
public EmergencyService.Builder addDuns(Text value) {
return addProperty(CoreConstants.PROPERTY_DUNS, value);
}
@Override
public EmergencyService.Builder addDuns(String value) {
return addProperty(CoreConstants.PROPERTY_DUNS, Text.of(value));
}
@Override
public EmergencyService.Builder addEmail(Text value) {
return addProperty(CoreConstants.PROPERTY_EMAIL, value);
}
@Override
public EmergencyService.Builder addEmail(String value) {
return addProperty(CoreConstants.PROPERTY_EMAIL, Text.of(value));
}
@Override
public EmergencyService.Builder addEmployee(Person value) {
return addProperty(CoreConstants.PROPERTY_EMPLOYEE, value);
}
@Override
public EmergencyService.Builder addEmployee(Person.Builder value) {
return addProperty(CoreConstants.PROPERTY_EMPLOYEE, value.build());
}
@Override
public EmergencyService.Builder addEmployee(String value) {
return addProperty(CoreConstants.PROPERTY_EMPLOYEE, Text.of(value));
}
@Override
public EmergencyService.Builder addEmployees(Person value) {
return addProperty(CoreConstants.PROPERTY_EMPLOYEES, value);
}
@Override
public EmergencyService.Builder addEmployees(Person.Builder value) {
return addProperty(CoreConstants.PROPERTY_EMPLOYEES, value.build());
}
@Override
public EmergencyService.Builder addEmployees(String value) {
return addProperty(CoreConstants.PROPERTY_EMPLOYEES, Text.of(value));
}
@Override
public EmergencyService.Builder addEvent(Event value) {
return addProperty(CoreConstants.PROPERTY_EVENT, value);
}
@Override
public EmergencyService.Builder addEvent(Event.Builder value) {
return addProperty(CoreConstants.PROPERTY_EVENT, value.build());
}
@Override
public EmergencyService.Builder addEvent(String value) {
return addProperty(CoreConstants.PROPERTY_EVENT, Text.of(value));
}
@Override
public EmergencyService.Builder addEvents(Event value) {
return addProperty(CoreConstants.PROPERTY_EVENTS, value);
}
@Override
public EmergencyService.Builder addEvents(Event.Builder value) {
return addProperty(CoreConstants.PROPERTY_EVENTS, value.build());
}
@Override
public EmergencyService.Builder addEvents(String value) {
return addProperty(CoreConstants.PROPERTY_EVENTS, Text.of(value));
}
@Override
public EmergencyService.Builder addFaxNumber(Text value) {
return addProperty(CoreConstants.PROPERTY_FAX_NUMBER, value);
}
@Override
public EmergencyService.Builder addFaxNumber(String value) {
return addProperty(CoreConstants.PROPERTY_FAX_NUMBER, Text.of(value));
}
@Override
public EmergencyService.Builder addFounder(Person value) {
return addProperty(CoreConstants.PROPERTY_FOUNDER, value);
}
@Override
public EmergencyService.Builder addFounder(Person.Builder value) {
return addProperty(CoreConstants.PROPERTY_FOUNDER, value.build());
}
@Override
public EmergencyService.Builder addFounder(String value) {
return addProperty(CoreConstants.PROPERTY_FOUNDER, Text.of(value));
}
@Override
public EmergencyService.Builder addFounders(Person value) {
return addProperty(CoreConstants.PROPERTY_FOUNDERS, value);
}
@Override
public EmergencyService.Builder addFounders(Person.Builder value) {
return addProperty(CoreConstants.PROPERTY_FOUNDERS, value.build());
}
@Override
public EmergencyService.Builder addFounders(String value) {
return addProperty(CoreConstants.PROPERTY_FOUNDERS, Text.of(value));
}
@Override
public EmergencyService.Builder addFoundingDate(Date value) {
return addProperty(CoreConstants.PROPERTY_FOUNDING_DATE, value);
}
@Override
public EmergencyService.Builder addFoundingDate(String value) {
return addProperty(CoreConstants.PROPERTY_FOUNDING_DATE, Text.of(value));
}
@Override
public EmergencyService.Builder addFoundingLocation(Place value) {
return addProperty(CoreConstants.PROPERTY_FOUNDING_LOCATION, value);
}
@Override
public EmergencyService.Builder addFoundingLocation(Place.Builder value) {
return addProperty(CoreConstants.PROPERTY_FOUNDING_LOCATION, value.build());
}
@Override
public EmergencyService.Builder addFoundingLocation(String value) {
return addProperty(CoreConstants.PROPERTY_FOUNDING_LOCATION, Text.of(value));
}
@Override
public EmergencyService.Builder addGeo(GeoCoordinates value) {
return addProperty(CoreConstants.PROPERTY_GEO, value);
}
@Override
public EmergencyService.Builder addGeo(GeoCoordinates.Builder value) {
return addProperty(CoreConstants.PROPERTY_GEO, value.build());
}
@Override
public EmergencyService.Builder addGeo(GeoShape value) {
return addProperty(CoreConstants.PROPERTY_GEO, value);
}
@Override
public EmergencyService.Builder addGeo(GeoShape.Builder value) {
return addProperty(CoreConstants.PROPERTY_GEO, value.build());
}
@Override
public EmergencyService.Builder addGeo(String value) {
return addProperty(CoreConstants.PROPERTY_GEO, Text.of(value));
}
@Override
public EmergencyService.Builder addGlobalLocationNumber(Text value) {
return addProperty(CoreConstants.PROPERTY_GLOBAL_LOCATION_NUMBER, value);
}
@Override
public EmergencyService.Builder addGlobalLocationNumber(String value) {
return addProperty(CoreConstants.PROPERTY_GLOBAL_LOCATION_NUMBER, Text.of(value));
}
@Override
public EmergencyService.Builder addHasMap(Map value) {
return addProperty(CoreConstants.PROPERTY_HAS_MAP, value);
}
@Override
public EmergencyService.Builder addHasMap(Map.Builder value) {
return addProperty(CoreConstants.PROPERTY_HAS_MAP, value.build());
}
@Override
public EmergencyService.Builder addHasMap(URL value) {
return addProperty(CoreConstants.PROPERTY_HAS_MAP, value);
}
@Override
public EmergencyService.Builder addHasMap(String value) {
return addProperty(CoreConstants.PROPERTY_HAS_MAP, Text.of(value));
}
@Override
public EmergencyService.Builder addHasOfferCatalog(OfferCatalog value) {
return addProperty(CoreConstants.PROPERTY_HAS_OFFER_CATALOG, value);
}
@Override
public EmergencyService.Builder addHasOfferCatalog(OfferCatalog.Builder value) {
return addProperty(CoreConstants.PROPERTY_HAS_OFFER_CATALOG, value.build());
}
@Override
public EmergencyService.Builder addHasOfferCatalog(String value) {
return addProperty(CoreConstants.PROPERTY_HAS_OFFER_CATALOG, Text.of(value));
}
@Override
public EmergencyService.Builder addHasPOS(Place value) {
return addProperty(CoreConstants.PROPERTY_HAS_POS, value);
}
@Override
public EmergencyService.Builder addHasPOS(Place.Builder value) {
return addProperty(CoreConstants.PROPERTY_HAS_POS, value.build());
}
@Override
public EmergencyService.Builder addHasPOS(String value) {
return addProperty(CoreConstants.PROPERTY_HAS_POS, Text.of(value));
}
@Override
public EmergencyService.Builder addImage(ImageObject value) {
return addProperty(CoreConstants.PROPERTY_IMAGE, value);
}
@Override
public EmergencyService.Builder addImage(ImageObject.Builder value) {
return addProperty(CoreConstants.PROPERTY_IMAGE, value.build());
}
@Override
public EmergencyService.Builder addImage(URL value) {
return addProperty(CoreConstants.PROPERTY_IMAGE, value);
}
@Override
public EmergencyService.Builder addImage(String value) {
return addProperty(CoreConstants.PROPERTY_IMAGE, Text.of(value));
}
@Override
public EmergencyService.Builder addIsicV4(Text value) {
return addProperty(CoreConstants.PROPERTY_ISIC_V4, value);
}
@Override
public EmergencyService.Builder addIsicV4(String value) {
return addProperty(CoreConstants.PROPERTY_ISIC_V4, Text.of(value));
}
@Override
public EmergencyService.Builder addLegalName(Text value) {
return addProperty(CoreConstants.PROPERTY_LEGAL_NAME, value);
}
@Override
public EmergencyService.Builder addLegalName(String value) {
return addProperty(CoreConstants.PROPERTY_LEGAL_NAME, Text.of(value));
}
@Override
public EmergencyService.Builder addLocation(Place value) {
return addProperty(CoreConstants.PROPERTY_LOCATION, value);
}
@Override
public EmergencyService.Builder addLocation(Place.Builder value) {
return addProperty(CoreConstants.PROPERTY_LOCATION, value.build());
}
@Override
public EmergencyService.Builder addLocation(PostalAddress value) {
return addProperty(CoreConstants.PROPERTY_LOCATION, value);
}
@Override
public EmergencyService.Builder addLocation(PostalAddress.Builder value) {
return addProperty(CoreConstants.PROPERTY_LOCATION, value.build());
}
@Override
public EmergencyService.Builder addLocation(Text value) {
return addProperty(CoreConstants.PROPERTY_LOCATION, value);
}
@Override
public EmergencyService.Builder addLocation(String value) {
return addProperty(CoreConstants.PROPERTY_LOCATION, Text.of(value));
}
@Override
public EmergencyService.Builder addLogo(ImageObject value) {
return addProperty(CoreConstants.PROPERTY_LOGO, value);
}
@Override
public EmergencyService.Builder addLogo(ImageObject.Builder value) {
return addProperty(CoreConstants.PROPERTY_LOGO, value.build());
}
@Override
public EmergencyService.Builder addLogo(URL value) {
return addProperty(CoreConstants.PROPERTY_LOGO, value);
}
@Override
public EmergencyService.Builder addLogo(String value) {
return addProperty(CoreConstants.PROPERTY_LOGO, Text.of(value));
}
@Override
public EmergencyService.Builder addMainEntityOfPage(CreativeWork value) {
return addProperty(CoreConstants.PROPERTY_MAIN_ENTITY_OF_PAGE, value);
}
@Override
public EmergencyService.Builder addMainEntityOfPage(CreativeWork.Builder value) {
return addProperty(CoreConstants.PROPERTY_MAIN_ENTITY_OF_PAGE, value.build());
}
@Override
public EmergencyService.Builder addMainEntityOfPage(URL value) {
return addProperty(CoreConstants.PROPERTY_MAIN_ENTITY_OF_PAGE, value);
}
@Override
public EmergencyService.Builder addMainEntityOfPage(String value) {
return addProperty(CoreConstants.PROPERTY_MAIN_ENTITY_OF_PAGE, Text.of(value));
}
@Override
public EmergencyService.Builder addMakesOffer(Offer value) {
return addProperty(CoreConstants.PROPERTY_MAKES_OFFER, value);
}
@Override
public EmergencyService.Builder addMakesOffer(Offer.Builder value) {
return addProperty(CoreConstants.PROPERTY_MAKES_OFFER, value.build());
}
@Override
public EmergencyService.Builder addMakesOffer(String value) {
return addProperty(CoreConstants.PROPERTY_MAKES_OFFER, Text.of(value));
}
@Override
public EmergencyService.Builder addMap(URL value) {
return addProperty(CoreConstants.PROPERTY_MAP, value);
}
@Override
public EmergencyService.Builder addMap(String value) {
return addProperty(CoreConstants.PROPERTY_MAP, Text.of(value));
}
@Override
public EmergencyService.Builder addMaps(URL value) {
return addProperty(CoreConstants.PROPERTY_MAPS, value);
}
@Override
public EmergencyService.Builder addMaps(String value) {
return addProperty(CoreConstants.PROPERTY_MAPS, Text.of(value));
}
@Override
public EmergencyService.Builder addMember(Organization value) {
return addProperty(CoreConstants.PROPERTY_MEMBER, value);
}
@Override
public EmergencyService.Builder addMember(Organization.Builder value) {
return addProperty(CoreConstants.PROPERTY_MEMBER, value.build());
}
@Override
public EmergencyService.Builder addMember(Person value) {
return addProperty(CoreConstants.PROPERTY_MEMBER, value);
}
@Override
public EmergencyService.Builder addMember(Person.Builder value) {
return addProperty(CoreConstants.PROPERTY_MEMBER, value.build());
}
@Override
public EmergencyService.Builder addMember(String value) {
return addProperty(CoreConstants.PROPERTY_MEMBER, Text.of(value));
}
@Override
public EmergencyService.Builder addMemberOf(Organization value) {
return addProperty(CoreConstants.PROPERTY_MEMBER_OF, value);
}
@Override
public EmergencyService.Builder addMemberOf(Organization.Builder value) {
return addProperty(CoreConstants.PROPERTY_MEMBER_OF, value.build());
}
@Override
public EmergencyService.Builder addMemberOf(ProgramMembership value) {
return addProperty(CoreConstants.PROPERTY_MEMBER_OF, value);
}
@Override
public EmergencyService.Builder addMemberOf(ProgramMembership.Builder value) {
return addProperty(CoreConstants.PROPERTY_MEMBER_OF, value.build());
}
@Override
public EmergencyService.Builder addMemberOf(String value) {
return addProperty(CoreConstants.PROPERTY_MEMBER_OF, Text.of(value));
}
@Override
public EmergencyService.Builder addMembers(Organization value) {
return addProperty(CoreConstants.PROPERTY_MEMBERS, value);
}
@Override
public EmergencyService.Builder addMembers(Organization.Builder value) {
return addProperty(CoreConstants.PROPERTY_MEMBERS, value.build());
}
@Override
public EmergencyService.Builder addMembers(Person value) {
return addProperty(CoreConstants.PROPERTY_MEMBERS, value);
}
@Override
public EmergencyService.Builder addMembers(Person.Builder value) {
return addProperty(CoreConstants.PROPERTY_MEMBERS, value.build());
}
@Override
public EmergencyService.Builder addMembers(String value) {
return addProperty(CoreConstants.PROPERTY_MEMBERS, Text.of(value));
}
@Override
public EmergencyService.Builder addNaics(Text value) {
return addProperty(CoreConstants.PROPERTY_NAICS, value);
}
@Override
public EmergencyService.Builder addNaics(String value) {
return addProperty(CoreConstants.PROPERTY_NAICS, Text.of(value));
}
@Override
public EmergencyService.Builder addName(Text value) {
return addProperty(CoreConstants.PROPERTY_NAME, value);
}
@Override
public EmergencyService.Builder addName(String value) {
return addProperty(CoreConstants.PROPERTY_NAME, Text.of(value));
}
@Override
public EmergencyService.Builder addNumberOfEmployees(QuantitativeValue value) {
return addProperty(CoreConstants.PROPERTY_NUMBER_OF_EMPLOYEES, value);
}
@Override
public EmergencyService.Builder addNumberOfEmployees(QuantitativeValue.Builder value) {
return addProperty(CoreConstants.PROPERTY_NUMBER_OF_EMPLOYEES, value.build());
}
@Override
public EmergencyService.Builder addNumberOfEmployees(String value) {
return addProperty(CoreConstants.PROPERTY_NUMBER_OF_EMPLOYEES, Text.of(value));
}
@Override
public EmergencyService.Builder addOpeningHours(Text value) {
return addProperty(CoreConstants.PROPERTY_OPENING_HOURS, value);
}
@Override
public EmergencyService.Builder addOpeningHours(String value) {
return addProperty(CoreConstants.PROPERTY_OPENING_HOURS, Text.of(value));
}
@Override
public EmergencyService.Builder addOpeningHoursSpecification(OpeningHoursSpecification value) {
return addProperty(CoreConstants.PROPERTY_OPENING_HOURS_SPECIFICATION, value);
}
@Override
public EmergencyService.Builder addOpeningHoursSpecification(
OpeningHoursSpecification.Builder value) {
return addProperty(CoreConstants.PROPERTY_OPENING_HOURS_SPECIFICATION, value.build());
}
@Override
public EmergencyService.Builder addOpeningHoursSpecification(String value) {
return addProperty(CoreConstants.PROPERTY_OPENING_HOURS_SPECIFICATION, Text.of(value));
}
@Override
public EmergencyService.Builder addOwns(OwnershipInfo value) {
return addProperty(CoreConstants.PROPERTY_OWNS, value);
}
@Override
public EmergencyService.Builder addOwns(OwnershipInfo.Builder value) {
return addProperty(CoreConstants.PROPERTY_OWNS, value.build());
}
@Override
public EmergencyService.Builder addOwns(Product value) {
return addProperty(CoreConstants.PROPERTY_OWNS, value);
}
@Override
public EmergencyService.Builder addOwns(Product.Builder value) {
return addProperty(CoreConstants.PROPERTY_OWNS, value.build());
}
@Override
public EmergencyService.Builder addOwns(String value) {
return addProperty(CoreConstants.PROPERTY_OWNS, Text.of(value));
}
@Override
public EmergencyService.Builder addParentOrganization(Organization value) {
return addProperty(CoreConstants.PROPERTY_PARENT_ORGANIZATION, value);
}
@Override
public EmergencyService.Builder addParentOrganization(Organization.Builder value) {
return addProperty(CoreConstants.PROPERTY_PARENT_ORGANIZATION, value.build());
}
@Override
public EmergencyService.Builder addParentOrganization(String value) {
return addProperty(CoreConstants.PROPERTY_PARENT_ORGANIZATION, Text.of(value));
}
@Override
public EmergencyService.Builder addPaymentAccepted(Text value) {
return addProperty(CoreConstants.PROPERTY_PAYMENT_ACCEPTED, value);
}
@Override
public EmergencyService.Builder addPaymentAccepted(String value) {
return addProperty(CoreConstants.PROPERTY_PAYMENT_ACCEPTED, Text.of(value));
}
@Override
public EmergencyService.Builder addPhoto(ImageObject value) {
return addProperty(CoreConstants.PROPERTY_PHOTO, value);
}
@Override
public EmergencyService.Builder addPhoto(ImageObject.Builder value) {
return addProperty(CoreConstants.PROPERTY_PHOTO, value.build());
}
@Override
public EmergencyService.Builder addPhoto(Photograph value) {
return addProperty(CoreConstants.PROPERTY_PHOTO, value);
}
@Override
public EmergencyService.Builder addPhoto(Photograph.Builder value) {
return addProperty(CoreConstants.PROPERTY_PHOTO, value.build());
}
@Override
public EmergencyService.Builder addPhoto(String value) {
return addProperty(CoreConstants.PROPERTY_PHOTO, Text.of(value));
}
@Override
public EmergencyService.Builder addPhotos(ImageObject value) {
return addProperty(CoreConstants.PROPERTY_PHOTOS, value);
}
@Override
public EmergencyService.Builder addPhotos(ImageObject.Builder value) {
return addProperty(CoreConstants.PROPERTY_PHOTOS, value.build());
}
@Override
public EmergencyService.Builder addPhotos(Photograph value) {
return addProperty(CoreConstants.PROPERTY_PHOTOS, value);
}
@Override
public EmergencyService.Builder addPhotos(Photograph.Builder value) {
return addProperty(CoreConstants.PROPERTY_PHOTOS, value.build());
}
@Override
public EmergencyService.Builder addPhotos(String value) {
return addProperty(CoreConstants.PROPERTY_PHOTOS, Text.of(value));
}
@Override
public EmergencyService.Builder addPotentialAction(Action value) {
return addProperty(CoreConstants.PROPERTY_POTENTIAL_ACTION, value);
}
@Override
public EmergencyService.Builder addPotentialAction(Action.Builder value) {
return addProperty(CoreConstants.PROPERTY_POTENTIAL_ACTION, value.build());
}
@Override
public EmergencyService.Builder addPotentialAction(String value) {
return addProperty(CoreConstants.PROPERTY_POTENTIAL_ACTION, Text.of(value));
}
@Override
public EmergencyService.Builder addPriceRange(Text value) {
return addProperty(CoreConstants.PROPERTY_PRICE_RANGE, value);
}
@Override
public EmergencyService.Builder addPriceRange(String value) {
return addProperty(CoreConstants.PROPERTY_PRICE_RANGE, Text.of(value));
}
@Override
public EmergencyService.Builder addReview(Review value) {
return addProperty(CoreConstants.PROPERTY_REVIEW, value);
}
@Override
public EmergencyService.Builder addReview(Review.Builder value) {
return addProperty(CoreConstants.PROPERTY_REVIEW, value.build());
}
@Override
public EmergencyService.Builder addReview(String value) {
return addProperty(CoreConstants.PROPERTY_REVIEW, Text.of(value));
}
@Override
public EmergencyService.Builder addReviews(Review value) {
return addProperty(CoreConstants.PROPERTY_REVIEWS, value);
}
@Override
public EmergencyService.Builder addReviews(Review.Builder value) {
return addProperty(CoreConstants.PROPERTY_REVIEWS, value.build());
}
@Override
public EmergencyService.Builder addReviews(String value) {
return addProperty(CoreConstants.PROPERTY_REVIEWS, Text.of(value));
}
@Override
public EmergencyService.Builder addSameAs(URL value) {
return addProperty(CoreConstants.PROPERTY_SAME_AS, value);
}
@Override
public EmergencyService.Builder addSameAs(String value) {
return addProperty(CoreConstants.PROPERTY_SAME_AS, Text.of(value));
}
@Override
public EmergencyService.Builder addSeeks(Demand value) {
return addProperty(CoreConstants.PROPERTY_SEEKS, value);
}
@Override
public EmergencyService.Builder addSeeks(Demand.Builder value) {
return addProperty(CoreConstants.PROPERTY_SEEKS, value.build());
}
@Override
public EmergencyService.Builder addSeeks(String value) {
return addProperty(CoreConstants.PROPERTY_SEEKS, Text.of(value));
}
@Override
public EmergencyService.Builder addServiceArea(AdministrativeArea value) {
return addProperty(CoreConstants.PROPERTY_SERVICE_AREA, value);
}
@Override
public EmergencyService.Builder addServiceArea(AdministrativeArea.Builder value) {
return addProperty(CoreConstants.PROPERTY_SERVICE_AREA, value.build());
}
@Override
public EmergencyService.Builder addServiceArea(GeoShape value) {
return addProperty(CoreConstants.PROPERTY_SERVICE_AREA, value);
}
@Override
public EmergencyService.Builder addServiceArea(GeoShape.Builder value) {
return addProperty(CoreConstants.PROPERTY_SERVICE_AREA, value.build());
}
@Override
public EmergencyService.Builder addServiceArea(Place value) {
return addProperty(CoreConstants.PROPERTY_SERVICE_AREA, value);
}
@Override
public EmergencyService.Builder addServiceArea(Place.Builder value) {
return addProperty(CoreConstants.PROPERTY_SERVICE_AREA, value.build());
}
@Override
public EmergencyService.Builder addServiceArea(String value) {
return addProperty(CoreConstants.PROPERTY_SERVICE_AREA, Text.of(value));
}
@Override
public EmergencyService.Builder addSubOrganization(Organization value) {
return addProperty(CoreConstants.PROPERTY_SUB_ORGANIZATION, value);
}
@Override
public EmergencyService.Builder addSubOrganization(Organization.Builder value) {
return addProperty(CoreConstants.PROPERTY_SUB_ORGANIZATION, value.build());
}
@Override
public EmergencyService.Builder addSubOrganization(String value) {
return addProperty(CoreConstants.PROPERTY_SUB_ORGANIZATION, Text.of(value));
}
@Override
public EmergencyService.Builder addTaxID(Text value) {
return addProperty(CoreConstants.PROPERTY_TAX_ID, value);
}
@Override
public EmergencyService.Builder addTaxID(String value) {
return addProperty(CoreConstants.PROPERTY_TAX_ID, Text.of(value));
}
@Override
public EmergencyService.Builder addTelephone(Text value) {
return addProperty(CoreConstants.PROPERTY_TELEPHONE, value);
}
@Override
public EmergencyService.Builder addTelephone(String value) {
return addProperty(CoreConstants.PROPERTY_TELEPHONE, Text.of(value));
}
@Override
public EmergencyService.Builder addUrl(URL value) {
return addProperty(CoreConstants.PROPERTY_URL, value);
}
@Override
public EmergencyService.Builder addUrl(String value) {
return addProperty(CoreConstants.PROPERTY_URL, Text.of(value));
}
@Override
public EmergencyService.Builder addVatID(Text value) {
return addProperty(CoreConstants.PROPERTY_VAT_ID, value);
}
@Override
public EmergencyService.Builder addVatID(String value) {
return addProperty(CoreConstants.PROPERTY_VAT_ID, Text.of(value));
}
@Override
public EmergencyService.Builder addDetailedDescription(Article value) {
return addProperty(GoogConstants.PROPERTY_DETAILED_DESCRIPTION, value);
}
@Override
public EmergencyService.Builder addDetailedDescription(Article.Builder value) {
return addProperty(GoogConstants.PROPERTY_DETAILED_DESCRIPTION, value.build());
}
@Override
public EmergencyService.Builder addDetailedDescription(String value) {
return addProperty(GoogConstants.PROPERTY_DETAILED_DESCRIPTION, Text.of(value));
}
@Override
public EmergencyService.Builder addPopularityScore(PopularityScoreSpecification value) {
return addProperty(GoogConstants.PROPERTY_POPULARITY_SCORE, value);
}
@Override
public EmergencyService.Builder addPopularityScore(PopularityScoreSpecification.Builder value) {
return addProperty(GoogConstants.PROPERTY_POPULARITY_SCORE, value.build());
}
@Override
public EmergencyService.Builder addPopularityScore(String value) {
return addProperty(GoogConstants.PROPERTY_POPULARITY_SCORE, Text.of(value));
}
@Override
public EmergencyService build() {
return new EmergencyServiceImpl(properties, reverseMap);
}
}
public EmergencyServiceImpl(
Multimap<String, ValueType> properties, Multimap<String, Thing> reverseMap) {
super(properties, reverseMap);
}
@Override
public String getFullTypeName() {
return CoreConstants.TYPE_EMERGENCY_SERVICE;
}
@Override
public boolean includesProperty(String property) {
return PROPERTY_SET.contains(CoreConstants.NAMESPACE + property)
|| PROPERTY_SET.contains(GoogConstants.NAMESPACE + property)
|| PROPERTY_SET.contains(property);
}
}
| [
"yuanzh@google.com"
] | yuanzh@google.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.