blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
14cf88ab7086fabf90e321002d8d2d8b05b248c8
12691dd6a7eb5989db0c062c6ae8b4f922e211d6
/Java-Advanced/src/main/java/com/okten/JavaAdvanced/service/IUserService.java
74d61c9323727f1776cfde47fe0b1ed62673db5a
[]
no_license
KarinaLazarina/Part7.Java-Advanced
e48354faba1cc3900fa9c5aa3a9d9edc17ff151a
647e90750994ddb46cdde94ab29fbeae434bae0d
refs/heads/master
2022-12-31T15:00:18.815084
2020-10-19T16:16:53
2020-10-19T16:16:53
296,691,113
0
0
null
null
null
null
UTF-8
Java
false
false
348
java
package com.okten.JavaAdvanced.service; import com.okten.JavaAdvanced.dto.UserDTO; import com.okten.JavaAdvanced.entity.User; import java.util.List; public interface IUserService { List<User> getAllUsers(); UserDTO addUser(User user, int carId); User updateUser(User user); void deleteUser(int id); User getById(int id); }
0a9023c6aaf98c11c0d7faced49adb707fef1869
32b72e1dc8b6ee1be2e80bb70a03a021c83db550
/ast_results/SecUSo_privacy-friendly-memo-game/app/src/main/java/org/secuso/privacyfriendlymemory/ui/MainActivity.java
ff6e66cbef210d91636e81ad034166231aa5f06a
[]
no_license
cmFodWx5YWRhdjEyMTA5/smell-and-machine-learning
d90c41a17e88fcd99d543124eeb6e93f9133cb4a
0564143d92f8024ff5fa6b659c2baebf827582b1
refs/heads/master
2020-07-13T13:53:40.297493
2019-01-11T11:51:18
2019-01-11T11:51:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,961
java
// isComment package org.secuso.privacyfriendlymemory.ui; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.RatingBar; import android.widget.TextView; import org.secuso.privacyfriendlymemory.Constants; import org.secuso.privacyfriendlymemory.common.MemoGameStatistics; import org.secuso.privacyfriendlymemory.common.ResIdAdapter; import org.secuso.privacyfriendlymemory.model.CardDesign; import org.secuso.privacyfriendlymemory.model.MemoGameDefaultImages; import org.secuso.privacyfriendlymemory.model.MemoGameDifficulty; import org.secuso.privacyfriendlymemory.model.MemoGameMode; import org.secuso.privacyfriendlymemory.ui.navigation.HelpActivity; import java.util.List; import java.util.Set; public class isClassOrIsInterface extends AppCompatDrawerActivity { private SharedPreferences isVariable = null; private ViewPager isVariable = null; @Override protected void isMethod(Bundle isParameter) { super.isMethod(isNameExpr); isMethod(); if (isMethod()) { isMethod(); isMethod(); isMethod(); } isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr); isMethod(); isMethod(); super.isMethod(); } public void isMethod() { final ImageView isVariable = (ImageView) isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr); final ImageView isVariable = (ImageView) isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr); isNameExpr.isMethod(isNameExpr.isFieldAccessExpr); isNameExpr.isMethod(isNameExpr.isFieldAccessExpr); final SectionsPagerAdapter isVariable = new SectionsPagerAdapter(isMethod()); isNameExpr = (ViewPager) isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr); isNameExpr.isMethod(isNameExpr); isNameExpr.isMethod(isIntegerConstant); isNameExpr.isMethod(new ViewPager.OnPageChangeListener() { @Override public void isMethod(int isParameter, float isParameter, int isParameter) { // isComment } @Override public void isMethod(int isParameter) { isNameExpr.isMethod(isNameExpr == isIntegerConstant ? isNameExpr.isFieldAccessExpr : isNameExpr.isFieldAccessExpr); isNameExpr.isMethod(isNameExpr == isIntegerConstant ? isNameExpr.isFieldAccessExpr : isNameExpr.isFieldAccessExpr); } @Override public void isMethod(int isParameter) { // isComment } }); } public void isMethod() { final TextView isVariable = (TextView) isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr); final RatingBar isVariable = (RatingBar) isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr); isNameExpr.isMethod(new RatingBar.OnRatingBarChangeListener() { @Override public void isMethod(RatingBar isParameter, float isParameter, boolean isParameter) { if (isNameExpr < isIntegerConstant) { isNameExpr.isMethod(isIntegerConstant); } isNameExpr.isMethod(isMethod(isNameExpr.isMethod().isMethod((int) isNameExpr.isMethod() - isIntegerConstant).isMethod())); } }); } public void isMethod(View isParameter) { switch(isNameExpr.isMethod()) { case isNameExpr.isFieldAccessExpr.isFieldAccessExpr: isNameExpr.isMethod(isNameExpr.isFieldAccessExpr); break; case isNameExpr.isFieldAccessExpr.isFieldAccessExpr: isNameExpr.isMethod(isNameExpr.isFieldAccessExpr); break; case isNameExpr.isFieldAccessExpr.isFieldAccessExpr: // isComment int isVariable = isNameExpr.isMethod(); MemoGameMode isVariable = isNameExpr.isMethod().isMethod(isNameExpr); int isVariable = ((RatingBar) isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr)).isMethod() - isIntegerConstant; MemoGameDifficulty isVariable = isNameExpr.isMethod().isMethod(isNameExpr < isIntegerConstant ? isIntegerConstant : isNameExpr); // isComment Intent isVariable = new Intent(this, MemoActivity.class); isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr); isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr); int isVariable = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isIntegerConstant); CardDesign isVariable = isNameExpr.isMethod(isNameExpr); isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr); isMethod(isNameExpr); break; default: break; } } private void isMethod() { List<Integer> isVariable = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isFieldAccessExpr, true); List<Integer> isVariable = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, isNameExpr.isFieldAccessExpr, true); List<String> isVariable = isNameExpr.isMethod(isNameExpr, this); List<String> isVariable = isNameExpr.isMethod(isNameExpr, this); Set<String> isVariable = isNameExpr.isMethod(isNameExpr); Set<String> isVariable = isNameExpr.isMethod(isNameExpr); isNameExpr.isMethod().isMethod(isNameExpr.isFieldAccessExpr, isNameExpr).isMethod(); isNameExpr.isMethod().isMethod(isNameExpr.isFieldAccessExpr, isNameExpr).isMethod(); } private void isMethod() { isNameExpr.isMethod().isMethod(isNameExpr.isFieldAccessExpr, true).isMethod(); } private void isMethod() { new WelcomeDialog().isMethod(isMethod(), WelcomeDialog.class.isMethod()); } private void isMethod() { isNameExpr = isNameExpr.isMethod(this); } private boolean isMethod() { return isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, true); } /** * isComment */ public class isClassOrIsInterface extends FragmentPagerAdapter { public isConstructor(FragmentManager isParameter) { super(isNameExpr); } @Override public Fragment isMethod(int isParameter) { // isComment return isNameExpr.isMethod(isNameExpr); } @Override public int isMethod() { // isComment return isNameExpr.isMethod().isMethod(); } } /** * isComment */ public static class isClassOrIsInterface extends Fragment { /** * isComment */ private static final String isVariable = "isStringConstant"; /** * isComment */ public static GameTypeFragment isMethod(int isParameter) { GameTypeFragment isVariable = new GameTypeFragment(); Bundle isVariable = new Bundle(); isNameExpr.isMethod(isNameExpr, isNameExpr); isNameExpr.isMethod(isNameExpr); return isNameExpr; } public isConstructor() { } @Override public View isMethod(LayoutInflater isParameter, ViewGroup isParameter, Bundle isParameter) { View isVariable = isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, isNameExpr, true); MemoGameMode isVariable = isNameExpr.isMethod().isMethod(isMethod().isMethod(isNameExpr)); ImageView isVariable = (ImageView) isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr); isNameExpr.isMethod(isNameExpr.isMethod()); TextView isVariable = (TextView) isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr); isNameExpr.isMethod(isMethod(isNameExpr.isMethod())); return isNameExpr; } } public static class isClassOrIsInterface extends DialogFragment { @Override public void isMethod(Activity isParameter) { super.isMethod(isNameExpr); } @Override public Dialog isMethod(Bundle isParameter) { LayoutInflater isVariable = isMethod().isMethod(); AlertDialog.Builder isVariable = new AlertDialog.Builder(isMethod()); isNameExpr.isMethod(isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr, null)); isNameExpr.isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr); isNameExpr.isMethod(isMethod().isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr)); isNameExpr.isMethod(isMethod().isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr), null); isNameExpr.isMethod(isMethod().isMethod(isNameExpr.isFieldAccessExpr.isFieldAccessExpr), new DialogInterface.OnClickListener() { @Override public void isMethod(DialogInterface isParameter, int isParameter) { Intent isVariable = new Intent(isMethod(), HelpActivity.class); isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, HelpActivity.HelpFragment.class.isMethod()); isNameExpr.isMethod(isNameExpr.isFieldAccessExpr, true); isMethod(isNameExpr); } }); return isNameExpr.isMethod(); } } }
e106e7b6077135465d8ac1cea6f9f6fc6050ee02
91a41a164dddc64d6c5e5e7a4ca43cde2b6980d4
/app/src/androidTest/java/ga/adriwalter/smartvending/ApplicationTest.java
6c714a7ba7a626953582acbbe848377f79194b4f
[]
no_license
adrielstar/SmartVM
bf43d905f2fc644591d483d4cf495a884c0531e9
207b7c483adf291870fb5c4fea2e5caf6c81d93f
refs/heads/master
2021-01-10T14:54:48.698787
2016-02-01T01:08:30
2016-02-01T01:08:30
50,768,328
0
0
null
null
null
null
UTF-8
Java
false
false
357
java
package ga.adriwalter.smartvending; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
a7117fdab68c8d83bf36f16d471ec55fb06bb11d
d09fc965aae38698a8378c9333e5a9c5a89a6238
/src/main/java/br/com/zup/CasaDoCodigo/Autor/AutorRepository.java
6e470f35ae554123389b7e158868da8e0c76b87d
[]
no_license
LuisGomesRocha/CasaDoCodigo
caeade1ffb935d4ee8e5e9b2b7f3bd503b30b8e0
32ef99b92e62b5170c45a3253eee9bd37284ea4e
refs/heads/main
2023-04-27T01:12:54.550744
2021-05-12T15:52:53
2021-05-12T15:52:53
365,490,224
0
0
null
null
null
null
UTF-8
Java
false
false
174
java
package br.com.zup.CasaDoCodigo.Autor; import org.springframework.data.repository.CrudRepository; public interface AutorRepository extends CrudRepository<Autor, Long> { }
abfa22d91d3bf69454190d77482dec81b3fd9a39
e2087ec9c8ab4910c5f6720518aa630e63ce2ab7
/clients/src/main/java/com/networkedassets/autodoc/clients/atlassian/atlassianProjectsData/User.java
0e22ea6fa770a48df13f9e9eb082699b54a97b82
[ "Apache-2.0" ]
permissive
NetworkedAssets/autodoc
a74b5dfd7ef10eb54f1db463ff3ba2d6a19ccf5e
c84fafd441283309302aa5841e10d0879f81f4bb
refs/heads/master
2021-01-01T05:06:48.796119
2016-05-20T12:26:36
2016-05-20T12:26:36
59,290,837
0
0
null
null
null
null
UTF-8
Java
false
false
4,500
java
package com.networkedassets.autodoc.clients.atlassian.atlassianProjectsData; import java.util.HashMap; import java.util.Map; import javax.annotation.Generated; import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) @Generated("org.jsonschema2pojo") @JsonPropertyOrder({ "name", "emailAddress", "id", "displayName", "active", "slug", "type", "link", "links" }) public class User { @JsonProperty("name") private String name; @JsonProperty("emailAddress") private String emailAddress; @JsonProperty("id") private int id; @JsonProperty("displayName") private String displayName; @JsonProperty("active") private boolean active; @JsonProperty("slug") private String slug; @JsonProperty("type") private String type; @JsonProperty("link") private Link link; @JsonProperty("links") private Links links; @JsonIgnore private Map<String, Object> additionalProperties = new HashMap<String, Object>(); /** * * @return * The name */ @JsonProperty("name") public String getName() { return name; } /** * * @param name * The name */ @JsonProperty("name") public void setName(String name) { this.name = name; } /** * * @return * The emailAddress */ @JsonProperty("emailAddress") public String getEmailAddress() { return emailAddress; } /** * * @param emailAddress * The emailAddress */ @JsonProperty("emailAddress") public void setEmailAddress(String emailAddress) { this.emailAddress = emailAddress; } /** * * @return * The id */ @JsonProperty("id") public int getId() { return id; } /** * * @param id * The id */ @JsonProperty("id") public void setId(int id) { this.id = id; } /** * * @return * The displayName */ @JsonProperty("displayName") public String getDisplayName() { return displayName; } /** * * @param displayName * The displayName */ @JsonProperty("displayName") public void setDisplayName(String displayName) { this.displayName = displayName; } /** * * @return * The active */ @JsonProperty("active") public boolean isActive() { return active; } /** * * @param active * The active */ @JsonProperty("active") public void setActive(boolean active) { this.active = active; } /** * * @return * The slug */ @JsonProperty("slug") public String getSlug() { return slug; } /** * * @param slug * The slug */ @JsonProperty("slug") public void setSlug(String slug) { this.slug = slug; } /** * * @return * The type */ @JsonProperty("type") public String getType() { return type; } /** * * @param type * The type */ @JsonProperty("type") public void setType(String type) { this.type = type; } /** * * @return * The link */ @JsonProperty("link") public Link getLink() { return link; } /** * * @param link * The link */ @JsonProperty("link") public void setLink(Link link) { this.link = link; } /** * * @return * The links */ @JsonProperty("links") public Links getLinks() { return links; } /** * * @param links * The links */ @JsonProperty("links") public void setLinks(Links links) { this.links = links; } @JsonAnyGetter public Map<String, Object> getAdditionalProperties() { return this.additionalProperties; } @JsonAnySetter public void setAdditionalProperty(String name, Object value) { this.additionalProperties.put(name, value); } }
95453ebd4ccfa8dc000288b44be958890dbffe91
09d89e48d371f8ff79aa3335213d08d29edf1b1b
/src/main/java/pt/up/hs/project/service/dto/LabelCriteria.java
3fa67c2b6e690a4d11677249fcaaa81ba070770c
[]
no_license
handspy/handspy-project
2d3febc849a7e5832a12966648f44927c1287916
892f299ae7b52307b8314062e8992faab7ceaf3e
refs/heads/master
2022-12-11T10:51:32.664212
2021-07-07T15:32:59
2021-07-07T15:32:59
243,634,311
0
0
null
2022-12-10T19:47:09
2020-02-27T23:02:06
Java
UTF-8
Java
false
false
3,606
java
package pt.up.hs.project.service.dto; import io.github.jhipster.service.Criteria; import io.github.jhipster.service.filter.Filter; import io.github.jhipster.service.filter.LongFilter; import io.github.jhipster.service.filter.StringFilter; import java.io.Serializable; import java.util.Objects; /** * Criteria class for the {@link pt.up.hs.project.domain.Label} entity. This class is used * in {@link pt.up.hs.project.web.rest.LabelResource} to receive all the possible filtering options from * the Http GET request parameters. * For example the following could be a valid request: * {@code /labels?id.greaterThan=5&attr1.contains=something&attr2.specified=false} * As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use * fix type specific filters. */ public class LabelCriteria implements Serializable, Criteria { private static final long serialVersionUID = 1L; private LongFilter id; private StringFilter name; private StringFilter color; private LongFilter participantsId; private LongFilter tasksId; public LabelCriteria() { } public LabelCriteria(LabelCriteria other) { this.id = other.id == null ? null : other.id.copy(); this.name = other.name == null ? null : other.name.copy(); this.color = other.color == null ? null : other.color.copy(); this.participantsId = other.participantsId == null ? null : other.participantsId.copy(); this.tasksId = other.tasksId == null ? null : other.tasksId.copy(); } @Override public LabelCriteria copy() { return new LabelCriteria(this); } public LongFilter getId() { return id; } public void setId(LongFilter id) { this.id = id; } public StringFilter getName() { return name; } public void setName(StringFilter name) { this.name = name; } public StringFilter getColor() { return color; } public void setColor(StringFilter color) { this.color = color; } public LongFilter getParticipantsId() { return participantsId; } public void setParticipantsId(LongFilter participantsId) { this.participantsId = participantsId; } public LongFilter getTasksId() { return tasksId; } public void setTasksId(LongFilter tasksId) { this.tasksId = tasksId; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final LabelCriteria that = (LabelCriteria) o; return Objects.equals(id, that.id) && Objects.equals(name, that.name) && Objects.equals(color, that.color) && Objects.equals(participantsId, that.participantsId) && Objects.equals(tasksId, that.tasksId); } @Override public int hashCode() { return Objects.hash( id, name, color, participantsId, tasksId ); } @Override public String toString() { return "LabelCriteria{" + (id != null ? "id=" + id + ", " : "") + (name != null ? "name=" + name + ", " : "") + (color != null ? "color=" + color + ", " : "") + (participantsId != null ? "participantsId=" + participantsId + ", " : "") + (tasksId != null ? "tasksId=" + tasksId + ", " : "") + "}"; } }
abc12f549b1177fe733f748950420148985c5790
bb290fab00ae0551e06a0200113f76aa7987f5ff
/app/src/main/java/com/on/diary/adapter/DiaryAdapter.java
5c8fcdcdbe8a2c0a21835da15b602e73c81e6aec
[]
no_license
jlmillie/Diary
82a499faca88c4cc0c79dbd60015a4aa68d4e9c2
b38a5878287bdd707d9498e5b89d5303f6861112
refs/heads/master
2020-03-21T07:15:30.362867
2018-06-22T07:25:36
2018-06-22T07:25:36
138,270,179
0
0
null
null
null
null
UTF-8
Java
false
false
1,940
java
package com.on.diary.adapter; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.on.diary.R; import java.util.List; /** * 日记界面的 Adapter * <p> * Created by developerHaoz on 2017/5/3. */ public class DiaryAdapter extends RecyclerView.Adapter<DiaryAdapter.DiaryViewHolder> { private Context mContext; private LayoutInflater mLayoutInflater; private List<String> list; public DiaryAdapter(Context context, List<String> list) { mContext = context; this.mLayoutInflater = LayoutInflater.from(context); this.list = list; } @Override public DiaryViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new DiaryViewHolder(mLayoutInflater.inflate(R.layout.item_rv_diary, parent, false)); } @Override public void onBindViewHolder(final DiaryViewHolder holder, final int position) { // String dateSystem = GetDate.getDate().toString();//获取系统时间 holder.main_tv_date.setText(list.get(position)); holder.main_iv_circle.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Toast.makeText(mContext,list.get(position),Toast.LENGTH_LONG).show(); } }); } @Override public int getItemCount() { return list.size(); } public static class DiaryViewHolder extends RecyclerView.ViewHolder { ImageView main_iv_circle; TextView main_tv_date; DiaryViewHolder(View view) { super(view); main_iv_circle = (ImageView) view.findViewById(R.id.main_iv_circle); main_tv_date = (TextView) view.findViewById(R.id.main_tv_date); } } }
5b2c4b1075734ffb45723a701bae8bef5e62f16a
ef94ce025eee99c55bafb1a377cc41b75cb829be
/SendMessage/gen/com/iceroe/sendmessage/R.java
9b97afde111673cd840e4a233e1767ecfb41e117
[]
no_license
iceroe/SendMessage
f7338f2d4dcbda0091cc110d9bba62208da845c8
9d657e16c14b33ee097a3285f45f5930b7210f74
refs/heads/master
2020-04-06T12:59:14.647528
2013-08-19T14:14:59
2013-08-19T14:14:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,804
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.iceroe.sendmessage; public final class R { public static final class attr { } public static final class dimen { /** Default screen margins, per the Android Design guidelines. Customize dimensions originally defined in res/values/dimens.xml (such as screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. */ public static final int activity_horizontal_margin=0x7f040000; public static final int activity_vertical_margin=0x7f040001; } public static final class drawable { public static final int ic_launcher=0x7f020000; } public static final class id { public static final int action_settings=0x7f080004; public static final int button1=0x7f080002; public static final int checkBox1=0x7f080003; public static final int editText1=0x7f080001; public static final int textView1=0x7f080000; } public static final class layout { public static final int activity_main=0x7f030000; } public static final class menu { public static final int main=0x7f070000; } public static final class string { public static final int action_settings=0x7f050001; public static final int app_name=0x7f050000; public static final int button=0x7f050004; public static final int encrypt=0x7f050005; public static final int hello_world=0x7f050002; public static final int say_something=0x7f050003; } public static final class style { /** Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. API 11 theme customizations can go here. Base application theme for API 14+. This theme completely replaces AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. API 14 theme customizations can go here. */ public static final int AppBaseTheme=0x7f060000; /** Application theme. All customizations that are NOT specific to a particular API-level can go here. */ public static final int AppTheme=0x7f060001; } }
b34c557c835f197007dee7e40ce8fde862529b57
1466ee85848c40ffd9eb61e2b274354b3bf97a18
/Spring-rest-mongo/src/main/java/com/bookapp/model/Book.java
93d3773612dc1e7aa3ff50a3ee3150b9cd6bccf0
[]
no_license
99002772/Javaprograms
e48588b34cf732ae85c5cd6a77647d7a22a64fdc
91be9f1617a29d031165245e3e0a13493ed0bfc1
refs/heads/main
2022-12-31T14:33:09.072531
2020-10-27T13:51:42
2020-10-27T13:51:42
305,570,590
0
0
null
null
null
null
UTF-8
Java
false
false
1,482
java
package com.bookapp.model; import org.springframework.data.annotation.Id; import org.springframework.data.annotation.TypeAlias; import org.springframework.data.mongodb.core.mapping.Document; @Document(collection = "book") @TypeAlias("Book") public class Book { @Id Integer bookId; String title; String author; String category; Double price; public Book() { super(); // TODO Auto-generated constructor stub } public Book(Integer bookId, String title, String author, String category, Double price) { super(); this.bookId = bookId; this.title = title; this.author = author; this.category = category; this.price = price; } public Integer getBookId() { return bookId; } public void setBookId(Integer bookId) { this.bookId = bookId; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public Double getPrice() { return price; } public void setPrice(Double price) { this.price = price; } @Override public String toString() { return "Book [bookId=" + bookId + ", title=" + title + ", author=" + author + ", category=" + category + ", price=" + price + "]"; } }
820ad3bb6060a9ce13b160a4b9d56b9a191b88ad
9ff4954c1b12ec21e7bd4966e50de5a8c0f5184e
/src/main/java/fr/treeptik/wsimport/GetCityWeatherByZIP.java
f474306e2624f59fabcdc4fdebd22f2c4fb732a6
[]
no_license
RiviereGregory/SampleJBoss-JSF-CDI-EJB
d3d8ceadbf6c5bbe2b68999c9b0608c86d5842ac
14145324dbed18f4a4e440d316a928bfca11fc91
refs/heads/master
2020-05-03T07:05:49.752354
2013-09-13T14:14:27
2013-09-13T14:14:27
12,698,432
0
2
null
null
null
null
UTF-8
Java
false
false
1,447
java
package fr.treeptik.wsimport; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="ZIP" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "zip" }) @XmlRootElement(name = "GetCityWeatherByZIP") public class GetCityWeatherByZIP { @XmlElement(name = "ZIP") protected String zip; /** * Gets the value of the zip property. * * @return * possible object is * {@link String } * */ public String getZIP() { return zip; } /** * Sets the value of the zip property. * * @param value * allowed object is * {@link String } * */ public void setZIP(String value) { this.zip = value; } }
098c61ac7c87a2ff0ec17d0336878d77ee47a979
2a5f0fb2c1589b151d2a26f36bcfd9fb659d0c65
/app/src/main/java/ogma/com/punjabirasoi/network/NetworkConnection.java
48b5f86bebee6a4d5504ababdb987179f27d27a7
[]
no_license
tanima-mukherjee/PunjabiRasoi
d38997ddc981620b644aadeba95a6e4f1038b37a
19acc8abb96d84b1e10d34fefeabc519c840ca6f
refs/heads/master
2020-03-12T14:58:38.777590
2018-04-23T13:48:22
2018-04-23T13:48:22
130,680,519
0
0
null
null
null
null
UTF-8
Java
false
false
825
java
package ogma.com.punjabirasoi.network; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; public class NetworkConnection { private Context mContext; private ConnectivityManager cm; public NetworkConnection(Context context) { // TODO Auto-generated constructor stub mContext = context; cm = (ConnectivityManager) mContext .getSystemService(Context.CONNECTIVITY_SERVICE); } public boolean isNetworkConnected() { NetworkInfo activeNetworkInfo = cm.getActiveNetworkInfo(); return activeNetworkInfo != null && activeNetworkInfo.isConnected(); } public boolean isNetworkConnectingOrConnected() { NetworkInfo activeNetworkInfo = cm.getActiveNetworkInfo(); return activeNetworkInfo != null && activeNetworkInfo.isConnectedOrConnecting(); } }
2a28b8d410b462cb9c39cb8a12b258d47b171a5a
c3c6bd3aded82ab26d045816134730774b4b5ff9
/src/View/TableViewActionListener.java
3642f4e8345449c7994b9f2d8fea3e104d4819c8
[ "MIT" ]
permissive
nirbendror/Poker-Game
7e4cb6a99c7092993dbdcc18d0c53a8045865b9c
a7f3d80b94b59be2a740d7bcac3811b35661a3dc
refs/heads/master
2022-12-29T03:51:16.801830
2020-10-14T09:47:38
2020-10-14T09:47:38
263,359,248
0
0
null
null
null
null
UTF-8
Java
false
false
2,435
java
package View; import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Observable; public class TableViewActionListener extends Observable implements ActionListener { private TableView tableView; private TableObserver observer; //Adjusting each button public TableViewActionListener(TableView table) { observer=new TableObserver("Check","0"); tableView=table; } private void Update() { setChanged(); notifyObservers(observer); } @Override public void actionPerformed(ActionEvent e) { switch (e.getActionCommand()) { case "Check": //Push "Check" - set raise on 0 and update observer.setActionName("Check"); observer.setRaise("0"); Update(); break; case "Fold": //Push "Fold" - fold and update observer.setActionName("Fold"); observer.setRaise("0"); Update(); break; case "Call": //Push "Call" - call and update observer.setActionName("Call"); observer.setRaise("0"); Update(); break; case "AllIN": //Push "ALINN" - raise al the money and update observer.setActionName("AllIN"); observer.setRaise("0"); Update(); break; case "Raise": //Push "Raise" - raise money and update if (InputValidation(tableView.GetHowMuchRaise())) { observer.setActionName("Raise"); observer.setRaise(tableView.GetHowMuchRaise()); Update(); } break; } } //Check if your raise is valid boolean InputValidation(String RaiseAmount) { int value; try{ value = Integer.parseInt(RaiseAmount); } catch(NumberFormatException e) { JOptionPane.showMessageDialog(tableView.getFrame(), "Please Enter Valid Value","Invalid Input",JOptionPane.ERROR_MESSAGE); return false; } return true; } }
20770f300248f88b36ef5e70fabbdca81d03ffa7
7fbb70258f3fa732c2f857ecdf7e42adadd92770
/hongxing1949-api/src/main/java/com/hongxing1949/entity/TokenEntity.java
161a69a185ec80c6c5f17e5cc043476ea24d4b79
[ "Apache-2.0" ]
permissive
FengShaduVIP/hongxing1949
6fcc904f334745f21f018f6a12d506d4c64ce802
4811da4cacc13bb498b22134b9f217ce6497b30c
refs/heads/master
2020-03-09T06:32:16.108317
2018-04-17T15:04:31
2018-04-17T15:04:31
128,641,825
0
0
null
null
null
null
UTF-8
Java
false
false
1,212
java
package com.hongxing1949.entity; import java.io.Serializable; import java.util.Date; /** * 用户Token * * @author chenshun * @email [email protected] * @date 2017-03-23 15:22:07 */ public class TokenEntity implements Serializable { private static final long serialVersionUID = 1L; //用户ID private Long userId; //token private String token; //过期时间 private Date expireTime; //更新时间 private Date updateTime; /** * 设置:用户ID */ public void setUserId(Long userId) { this.userId = userId; } /** * 获取:用户ID */ public Long getUserId() { return userId; } /** * 设置:token */ public void setToken(String token) { this.token = token; } /** * 获取:token */ public String getToken() { return token; } /** * 设置:过期时间 */ public void setExpireTime(Date expireTime) { this.expireTime = expireTime; } /** * 获取:过期时间 */ public Date getExpireTime() { return expireTime; } /** * 设置:更新时间 */ public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } /** * 获取:更新时间 */ public Date getUpdateTime() { return updateTime; } }
9a1481964f58da73f093a15de4cac3a55c86a56c
b9f27172fe9ac6e0be63b04f3e72830a945907a3
/10.Session&Cookie/Cart/src/main/java/session_cookie/cookie/controller/ProductController.java
716def327f08d848b1b79711a12792aa0fd5fdce
[]
no_license
BaoThinh251/C1020G1-BaoThinh_module4
bc7722f88e0c1c1318f2c1327bf113d7a8e0ce11
acab2b8030b5f1a262d917ad04a95d47e9af248a
refs/heads/master
2023-03-17T12:23:31.871080
2021-03-19T12:43:04
2021-03-19T12:43:04
341,098,054
0
0
null
null
null
null
UTF-8
Java
false
false
2,862
java
package session_cookie.cookie.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableDefault; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import session_cookie.cookie.model.Product; import session_cookie.cookie.service.ProductService; import java.util.ArrayList; import java.util.List; @Controller @SessionAttributes("cart") public class ProductController { @Autowired ProductService productService; @ModelAttribute("cart") public List<Product> createCart() { return new ArrayList<>(); } @GetMapping("/") public String getHome(Model model, @PageableDefault(size = 5) Pageable pageable) { model.addAttribute("productList", productService.findAllProduct(pageable)); return "/home"; } @GetMapping("/view/{id}") public String getView(@PathVariable Integer id, Model model) { model.addAttribute("product", productService.findById(id)); return "/view"; } @GetMapping("/order/{id}") public String oderProduct(@ModelAttribute("cart") List<Product> cart, @PathVariable Integer id) { Product product = productService.findById(id); if (!cart.isEmpty()) { for (Product product1 : cart) { if (product.getId() == product1.getId()) { product1.setQuantity(product1.getQuantity() + 1); return "redirect:/"; } } } product.setQuantity(1); cart.add(product); return "redirect:/"; } @GetMapping("/show_cart") public String showCart(@ModelAttribute("cart") List<Product> cart, Model model) { model.addAttribute("cart", cart); return "/cart"; } @GetMapping("/change") public String changeProductInCart(@RequestParam("id") int id, @RequestParam("change") int change, Model model, @ModelAttribute("cart") List<Product> cart) { for (Product product : cart) { if (product.getId() == id) { product.setQuantity(change); } } model.addAttribute("cart", cart); return "/cart"; } @GetMapping("/delete_product/{id}") public String deleteProductInCart(@ModelAttribute("cart") List<Product> cart, @PathVariable Integer id, Model model) { if (id != 0) { for (Product product : cart) { if (id == product.getId()) { cart.remove(product); model.addAttribute("cart", cart); return "/cart"; } } } cart.clear(); return "redirect:/"; } }
e2b1f248af0468eb91c634f3ee20b49d03f9aca7
0f90ae3da939fe64c74e70a6834a3a2da4a5990b
/BlogWeb/src/dao/KullaniciDAO.java
880b0430bcf4be920806d2dfe4bb4d8c90f0404d
[]
no_license
toramanmurat/BlogSitesi
6ee9b13eb58eee04bbd59bfe0e90d879271355e7
f9c54d7ca20e8b01aaa02f3df0a609b7d85a2615
refs/heads/master
2021-07-05T01:47:24.158300
2019-02-15T15:08:47
2019-02-15T15:08:47
170,882,021
0
0
null
2020-09-15T12:46:50
2019-02-15T14:59:57
Java
UTF-8
Java
false
false
3,284
java
package dao; import java.sql.SQLException; import java.sql.Timestamp; import java.util.List; import model.Blog; import model.BlogDetay; import model.Girdi; import model.GirdiDetay; import model.Kullanici; import model.Yorum; import model.YorumDetay; public interface KullaniciDAO { public void baglan() throws SQLException; public void baglantiyiKes(); public void tumTablolariTemizle() ; public void tabloIceriginiSil(String tabloAdi) ; public void kullaniciOlustur(Kullanici k); public void blogOlustur(Blog b); public void girdiOlustur(Girdi g); public void yorumOlustur(Yorum y); public boolean emailKayitliMi(String email) throws SQLException; public int kullaniciIDsiniBul(String kullaniciEmail) throws SQLException; public int blogIDSiniBul(Timestamp OlusturmaTarih) throws SQLException; public int girdiIDSiniBul(Timestamp GirdiTarih) throws SQLException; public Kullanici kullaniciBilgisiniGetir(String kullaniciEmail, String kullaniciSifre) throws SQLException; public Kullanici kullaniciBilgisiGetir(String kullaniciEmail) throws SQLException; public Kullanici kullaniciBilgisiGetir(int kullaniciId) throws SQLException; public List<Kullanici> tumKullanicilariGetir() throws SQLException; public Blog blogBilgisiGetir(int blogId) throws SQLException; public Yorum yorumBilgisiniGetir(int yorumId) throws SQLException; public int[] blogIstatistikGetir(int blogID) throws SQLException; public List<Blog> tumBloglariGetir() throws SQLException; public List<Blog> birKullaniciyaAitTumBloglariGetir(Kullanici k) throws SQLException; public int kullanicininSahipOlduguBloglarinSayisiniGetir(Kullanici k) throws SQLException; public List<Girdi> birBlogaAitTumGirdileriGetir(Blog b) throws SQLException; public List<Yorum> birGirdiyeAitTumYorumlariGetir(Girdi g) throws SQLException; public List<Yorum> birGirdiyeAitTumYorumlariGetir(int girdiId) throws SQLException; public List<YorumDetay> birGirdiyeAitEnGuncelUcYorumDetayiniGetir(int girdiId) throws SQLException; public List<YorumDetay> birGirdiyeAitTumYorumDetaylariniGetir(int girdiId) throws SQLException; public boolean yorumuSil(Yorum y) throws SQLException; public boolean girdiyiSil(Girdi g) throws SQLException; public boolean bloguSil(Blog b) throws SQLException; public boolean kullaniciyiSil(Kullanici k) throws SQLException; public BlogDetay blogDetayGetir(int blogId) throws SQLException; public GirdiDetay enGuncelGirdiyiGetir(int blogId) throws SQLException; public GirdiDetay seciliGirdininDetayiniGetir(int girdiId) throws SQLException; public List<Girdi> enGuncelBesGirdiyiGetir(int blogId) throws SQLException; public List<Girdi> tumGirdileriGetir(int blogId) throws SQLException; public boolean blogBilgisiGuncelle(Blog b) throws SQLException; public boolean kullaniciBilgisiGuncelle(Kullanici k) throws SQLException; public boolean girdiBilgisiGuncelle(Girdi g) throws SQLException; public boolean yorumBilgisiGuncelle(Yorum y) throws SQLException; public int birGirdiyeAitYorumSayisiniGetir(int girdiId) throws SQLException; public String[] tabloKolonAdlariniGetir(String tabloAdi) throws SQLException; }
02eeee41846180776d0da0f654d1887ae2c4a324
3576927e85c1a9d886a9a91487bcb557ec94d11c
/version-4.3/Fuente/AgesicFirmaApplet/.svn/pristine/02/02eeee41846180776d0da0f654d1887ae2c4a324.svn-base
7b800ea0b4ef2011e7749b9943e97ddbbb77f062
[]
no_license
AGESIC-UY/componente-firma-electronica
f8567264425abb02ec673fa988451756008493a0
4545c7b1b18b8465fa3d0c5091d0c5f7163cd308
refs/heads/master
2023-07-20T11:13:45.458915
2023-07-13T15:36:57
2023-07-13T15:36:57
221,989,010
0
0
null
2022-06-30T20:21:41
2019-11-15T19:23:25
Java
UTF-8
Java
false
false
1,699
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package uy.gub.agesic.firma.cliente.store; import java.security.cert.X509Certificate; /** * * @author Sofis Solutions */ public class SofisCertificate{ private boolean ok = true; private String alias; private String nombre; private Integer pos; private X509Certificate certificate; private CertStoreI store; public SofisCertificate(String alias, String nombre, X509Certificate cert, CertStoreI ks) { this.alias = alias; this.nombre = nombre; this.certificate = cert; this.store = ks; } public SofisCertificate(String nombre, Integer pos, X509Certificate cert, CertStoreI ks) { this.alias = nombre; this.nombre = nombre; this.pos = pos; this.certificate = cert; this.store = ks; } public String getNombre() { return nombre; } public String getAlias() { return alias; } public boolean isOk() { return ok; } public void setOk(boolean ok) { this.ok = ok; } public Integer getPos() { return pos; } public void setPos(Integer pos) { this.pos = pos; } public X509Certificate getCertificate() { return certificate; } public void setCertificate(X509Certificate certificate) { this.certificate = certificate; } public CertStoreI getStore() { return store; } public void setStore(CertStoreI store) { this.store = store; } @Override public String toString() { return nombre; } }
7276c6833cf93f205465aef485e00a29d80a12e8
741e45031776819fb6f0c22dc13dbb920e4c0501
/app/src/main/java/com/lzhy/moneyhll/me/order/MyOrderActivity.java
fe72779dc8c92d72ee59fb75d915c1f2519be4a1
[]
no_license
cmmzjwz99/MyfristProject
c8eb3c2aef494f8089548ff00404273c37b5dd22
1934e0a698049f8178addae047e34e755af68fff
refs/heads/master
2020-03-23T06:45:11.032616
2018-07-17T03:42:24
2018-07-17T03:42:24
141,227,385
0
1
null
null
null
null
UTF-8
Java
false
false
2,593
java
package com.lzhy.moneyhll.me.order; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.LinearLayout; import com.lzhy.moneyhll.R; import com.lzhy.moneyhll.custom.BaseTitlebar; import com.lzhy.moneyhll.custom.MySwipeBackActivity; import com.lzhy.moneyhll.me.makerorder.MakerGoodsOrderActivity; import com.lzhy.moneyhll.me.makerorder.MakerPlayOrderActivity; import static com.lzhy.moneyhll.utils.CommonUtil.setTitleBarLeftBtn; import static com.lzhy.moneyhll.utils.UtilCheckLogin.disparityLogin; /** * Created by cmm on 2016/10/26. * 我的订单 */ public class MyOrderActivity extends MySwipeBackActivity implements View.OnClickListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_order); initView(); initTitlebar(); } @Override protected void onResume() { super.onResume(); disparityLogin(); } private void initView() { LinearLayout shoppingOrder = (LinearLayout) findViewById(R.id.ll_shopping_order); LinearLayout projectOrder = (LinearLayout) findViewById(R.id.ll_project_order); LinearLayout makerGoodsOrder = (LinearLayout) findViewById(R.id.ll_maker_goods_order); LinearLayout makerPlayOrder = (LinearLayout) findViewById(R.id.ll_maker_play_order); shoppingOrder.setOnClickListener(this); projectOrder.setOnClickListener(this); makerGoodsOrder.setOnClickListener(this); makerPlayOrder.setOnClickListener(this); } private void initTitlebar() { BaseTitlebar titlebar = (BaseTitlebar) findViewById(R.id.title_bar); setTitleBarLeftBtn(titlebar,"我的订单"); } @Override public void onClick(View view) { switch (view.getId()){ case R.id.ll_shopping_order: startActivity(new Intent(MyOrderActivity.this,GoodsOrderActivity.class)); break; case R.id.ll_project_order: startActivity(new Intent(MyOrderActivity.this,ProjectOrderActivity.class)); break; case R.id.ll_maker_goods_order: startActivity(new Intent(MyOrderActivity.this,MakerGoodsOrderActivity.class)); break; case R.id.ll_maker_play_order: startActivity(new Intent(MyOrderActivity.this,MakerPlayOrderActivity.class)); break; } } }
ee3f66a6c6d8a98cc6adbdc6d6db2a175c238e93
89dad6d2ab915c495749a949ff5600a95881535d
/src/main/java/com/xunxiang/xunxiangwikibase/mapper/PermissionMapper.java
cb4573b858350f958e4dfe0b77d39ba0edc264b9
[]
no_license
XunxiangTech/XunxiangWikiBase
8294d33add14a35a7c4e7578fc434180c72d0775
2f51c694c90745c5c6e4873f563522dea5d83b23
refs/heads/master
2023-08-13T05:53:05.451728
2021-10-18T16:16:07
2021-10-18T16:16:07
383,471,389
0
0
null
2021-07-09T09:17:18
2021-07-06T13:05:00
Java
UTF-8
Java
false
false
1,010
java
package com.xunxiang.xunxiangwikibase.mapper; import com.xunxiang.xunxiangwikibase.domain.Permission; import com.xunxiang.xunxiangwikibase.domain.PermissionExample; import java.util.List; import org.apache.ibatis.annotations.Param; public interface PermissionMapper { long countByExample(PermissionExample example); int deleteByExample(PermissionExample example); int deleteByPrimaryKey(Long id); int insert(Permission record); int insertSelective(Permission record); List<Permission> selectByExample(PermissionExample example); Permission selectByPrimaryKey(Long id); int updateByExampleSelective(@Param("record") Permission record, @Param("example") PermissionExample example); int updateByExample(@Param("record") Permission record, @Param("example") PermissionExample example); int updateByPrimaryKeySelective(Permission record); int updateByPrimaryKey(Permission record); List<Permission> findPermissionByRoleId(@Param("roleId") Long roleId); }
2d1956bd29773cbdee1bfe476784fd3600c467e9
bf6a2ecc7408059d70b9a0c9fd10e10351d93a24
/src/com/constant/Controller.java
e39be004fb12b1332c27dfe0ed3163c66ad7e2ec
[]
no_license
ashishrpaliwal/Inventory
f0b7de44e586cd462075da9a52c97266e732508e
3b8caf73c133710fcd30626ac06cceb0c193e09e
refs/heads/master
2021-05-05T07:38:36.684723
2014-10-30T21:50:23
2014-10-30T21:50:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
832
java
package com.constant; import java.util.List; import javax.jdo.PersistenceManager; import javax.jdo.Query; import com.model.UserDetails; public enum Controller { INSTANCE; public void add(String firstName, String lastName) { synchronized (this) { PersistenceManager pm = PMF.get().getPersistenceManager(); UserDetails user_detail_obj = new UserDetails(firstName, lastName); pm.makePersistent(user_detail_obj); pm.close(); } } public List<UserDetails> listUserDetails() { PersistenceManager pm = PMF.get().getPersistenceManager(); // Read the existing entries Query query = pm.newQuery(UserDetails.class); query.setOrdering("user_Id ascending"); List<UserDetails> userList = (List<UserDetails>) query.execute(); userList = (List<UserDetails>) pm.detachCopyAll(userList); return userList; } }
c74b410dbab747e11740b219c56988d460937c52
135029b7dc511ab1ed60d682b982e2abb28a435d
/PreTaxiWebServices/src/main/java/com/alcord/dao/impl/PassengerEmergencyContactDaoImpl.java
be8620d4e3e909a134e59090b5502d4f70fa3b9f
[]
no_license
xplore2web/RoadCoach
8cc3a4d6559bc4e3e61735b6e4fba69315e838ea
d85d7e9a5afc6181f038cf5271c2e09f4688fbb4
refs/heads/master
2020-12-30T15:09:29.597724
2017-06-07T07:03:07
2017-06-07T07:03:07
91,118,951
0
0
null
null
null
null
UTF-8
Java
false
false
2,939
java
package com.alcord.dao.impl; import java.util.List; import java.util.Locale; import java.util.UUID; import javax.transaction.Transactional; import org.hibernate.Criteria; import org.hibernate.FetchMode; import org.hibernate.criterion.Restrictions; import org.springframework.stereotype.Repository; import com.alcord.dao.PassengerEmergencyContactDao; import com.alcord.exception.ProcessFailed; import com.alcord.model.PassengerEmergencyContact; /** * * @author Razak */ @Repository @Transactional public class PassengerEmergencyContactDaoImpl extends BaseDaoImpl implements PassengerEmergencyContactDao { /** * {@inheritDoc} */ public PassengerEmergencyContact getById(UUID Id) throws ProcessFailed { try { Criteria criteria = getCurrentSession().createCriteria(PassengerEmergencyContact.class) .setFetchMode("fkeyPassengerId", FetchMode.JOIN) .add(Restrictions.eq("id", Id)); if (criteria.list().isEmpty()) { return null; } return (PassengerEmergencyContact) criteria.list().get(0); } catch (ProcessFailed ex) { loggingUtility.error(ex); throw new ProcessFailed(messageSource.getMessage("error_retrieving_message", new String[] {}, Locale.US)); } } /** * {@inheritDoc} */ public UUID save(PassengerEmergencyContact passengerEmergencyContact) throws ProcessFailed { try { return (UUID) getCurrentSession().save(passengerEmergencyContact); } catch (Throwable ex) { loggingUtility.error(ex); throw new ProcessFailed(messageSource.getMessage("error_saving_message", new String[] {}, Locale.US)); } } /** * {@inheritDoc} */ public void update(PassengerEmergencyContact passengerEmergencyContact) throws ProcessFailed { try { getCurrentSession().update(passengerEmergencyContact); } catch (Throwable ex) { loggingUtility.error(ex); throw new ProcessFailed(messageSource.getMessage("error_updating_message", new String[] {}, Locale.US)); } } /** * {@inheritDoc} */ public void delete(PassengerEmergencyContact passengerEmergencyContact) throws ProcessFailed { try { getCurrentSession().delete(passengerEmergencyContact); } catch (Throwable ex) { loggingUtility.error(ex); throw new ProcessFailed(messageSource.getMessage("error_deleting_message", new String[] {}, Locale.US)); } } /** * {@inheritDoc} */ public List<PassengerEmergencyContact> getAllPassengerEmergencyContactByPassengerId(UUID passengerId) throws ProcessFailed { try { Criteria criteria = getCurrentSession().createCriteria(PassengerEmergencyContact.class) .setFetchMode("fkeyPassengerId", FetchMode.JOIN) .add(Restrictions.eq("fkeyPassengerId.id", passengerId)); if (criteria.list().isEmpty()) { return null; } return criteria.list(); } catch (ProcessFailed ex) { loggingUtility.error(ex); throw new ProcessFailed(messageSource.getMessage("error_retrieving_message", new String[] {}, Locale.US)); } } }
[ "syedakmalatintbittech" ]
syedakmalatintbittech
f6abeb876c02ddea1fce27ab1bb098bbc760951c
27bdee438fe71ffbfe2545685194295f8877a85b
/src/decorator/ChickenBurger.java
b26012ca847de038fa77781ae6e48f4062cbc23b
[]
no_license
AlailiSpring/DesignPattern
257fbbb376126175262ac9a1975554981bf742a9
af70e7e2c3a531aeb10d12a80d02941177e2c4f4
refs/heads/master
2023-01-29T06:52:25.440354
2020-12-14T14:49:45
2020-12-14T14:49:45
103,425,189
0
0
null
null
null
null
UTF-8
Java
false
false
254
java
package decorator; /** * Created by AlailiSpring on 2017/4/16. */ public class ChickenBurger extends Humburger { public ChickenBurger() { name= "鸡腿堡"; } @Override public double getPrice() { return 10.0; } }
6fbb3fba9af165b1dafc2406c9d812edf4997c09
a1e587115d2f882f2eb22a3e6a94bbb42e349bf9
/pedido/src/main/java/br/com/hoffmann/pedido/client/produto/ProdutoClient.java
0424ea3d2a44310a122702ac1c39a17e0cb243dd
[]
no_license
CarlosHoff/pedido
2a5a06137626e7d74664d6f3a138464b3d769f9f
d90a5da1db4f9dbf5ced0257e001a5bcb1aab0b0
refs/heads/master
2022-12-21T20:35:31.821676
2020-09-18T03:03:09
2020-09-18T03:03:09
275,753,243
0
0
null
null
null
null
UTF-8
Java
false
false
790
java
package br.com.hoffmann.pedido.client.produto; import br.com.hoffmann.pedido.client.produto.response.ProdutoResponse; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import java.util.List; @FeignClient(url = "${produto.client}", name = "ProdutoClient") public interface ProdutoClient { @RequestMapping(value = "/buscaProdutos", method = RequestMethod.GET) List<ProdutoResponse> buscaProdutos(); @RequestMapping(value = "/buscaProdutoPelaDescricao", method = RequestMethod.GET) ProdutoResponse buscaProdutoPelaDescricao(@RequestParam(value = "descricao") String descricao); }
9ed68e321e70dfd9c78319985b886f136514c52a
da7dce2c893f7e9c3f452fde1aa061997e4feaf8
/app/src/main/java-gen/com/ds/greendao/ConversationDao.java
7afbbbef5e98f18679fa16820966ffd1c376760e
[]
no_license
HachikoDream/SuperMan
4b4c268d8a196711b4268442e56b6cc6a7cd9647
2d8e6d17215e87dcfa1aa0a88981cb51947011f3
refs/heads/master
2021-01-17T07:08:40.495635
2016-02-05T08:35:06
2016-02-05T08:35:06
40,012,885
5
2
null
null
null
null
UTF-8
Java
false
false
5,643
java
package com.ds.greendao; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteStatement; import de.greenrobot.dao.AbstractDao; import de.greenrobot.dao.Property; import de.greenrobot.dao.internal.DaoConfig; import com.ds.greendao.Conversation; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * DAO for table "CONVERSATION". */ public class ConversationDao extends AbstractDao<Conversation, Long> { public static final String TABLENAME = "CONVERSATION"; /** * Properties of entity Conversation.<br/> * Can be used for QueryBuilder and for referencing column names. */ public static class Properties { public final static Property MemberId = new Property(0, Long.class, "memberId", true, "MEMBER_ID"); public final static Property MemberName = new Property(1, String.class, "memberName", false, "MEMBER_NAME"); public final static Property ChatTime = new Property(2, java.util.Date.class, "chatTime", false, "CHAT_TIME"); public final static Property MemberAvater = new Property(3, String.class, "memberAvater", false, "MEMBER_AVATER"); public final static Property LastContent = new Property(4, String.class, "lastContent", false, "LAST_CONTENT"); public final static Property IsRead = new Property(5, Boolean.class, "isRead", false, "IS_READ"); }; public ConversationDao(DaoConfig config) { super(config); } public ConversationDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } /** Creates the underlying database table. */ public static void createTable(SQLiteDatabase db, boolean ifNotExists) { String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "\"CONVERSATION\" (" + // "\"MEMBER_ID\" INTEGER PRIMARY KEY ," + // 0: memberId "\"MEMBER_NAME\" TEXT," + // 1: memberName "\"CHAT_TIME\" INTEGER," + // 2: chatTime "\"MEMBER_AVATER\" TEXT," + // 3: memberAvater "\"LAST_CONTENT\" TEXT," + // 4: lastContent "\"IS_READ\" INTEGER);"); // 5: isRead } /** Drops the underlying database table. */ public static void dropTable(SQLiteDatabase db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"CONVERSATION\""; db.execSQL(sql); } /** @inheritdoc */ @Override protected void bindValues(SQLiteStatement stmt, Conversation entity) { stmt.clearBindings(); Long memberId = entity.getMemberId(); if (memberId != null) { stmt.bindLong(1, memberId); } String memberName = entity.getMemberName(); if (memberName != null) { stmt.bindString(2, memberName); } java.util.Date chatTime = entity.getChatTime(); if (chatTime != null) { stmt.bindLong(3, chatTime.getTime()); } String memberAvater = entity.getMemberAvater(); if (memberAvater != null) { stmt.bindString(4, memberAvater); } String lastContent = entity.getLastContent(); if (lastContent != null) { stmt.bindString(5, lastContent); } Boolean isRead = entity.getIsRead(); if (isRead != null) { stmt.bindLong(6, isRead ? 1L: 0L); } } /** @inheritdoc */ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); } /** @inheritdoc */ @Override public Conversation readEntity(Cursor cursor, int offset) { Conversation entity = new Conversation( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // memberId cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // memberName cursor.isNull(offset + 2) ? null : new java.util.Date(cursor.getLong(offset + 2)), // chatTime cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // memberAvater cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // lastContent cursor.isNull(offset + 5) ? null : cursor.getShort(offset + 5) != 0 // isRead ); return entity; } /** @inheritdoc */ @Override public void readEntity(Cursor cursor, Conversation entity, int offset) { entity.setMemberId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setMemberName(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setChatTime(cursor.isNull(offset + 2) ? null : new java.util.Date(cursor.getLong(offset + 2))); entity.setMemberAvater(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); entity.setLastContent(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); entity.setIsRead(cursor.isNull(offset + 5) ? null : cursor.getShort(offset + 5) != 0); } /** @inheritdoc */ @Override protected Long updateKeyAfterInsert(Conversation entity, long rowId) { entity.setMemberId(rowId); return rowId; } /** @inheritdoc */ @Override public Long getKey(Conversation entity) { if(entity != null) { return entity.getMemberId(); } else { return null; } } /** @inheritdoc */ @Override protected boolean isEntityUpdateable() { return true; } }
50398c1f39fea98a9e846d44640e614ace0d72f7
a37b914827bb963d5cb8f70c93b9c6cc46c70840
/project2MVC/src/project2/Menus.java
d1089399c1cfa87c5001989221028927629f6c31
[]
no_license
lincoln-brown/Mycomp1161-project
03f022417a9fc108568308e1814a7308588d04f5
9c29cbe1cc532d16f12ca0c8c44efcbc59f695f9
refs/heads/master
2022-11-05T21:33:41.418574
2020-06-18T16:26:35
2020-06-18T16:26:35
273,286,161
0
0
null
null
null
null
UTF-8
Java
false
false
4,493
java
package project2; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Date; import javax.swing.*; public class Menus extends JFrame { JButton b5; JButton b6; JButton b7; public Menus(){ //-------------------------Main instansiations ----------------------------- this.setTitle("JLCB BANKING "); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLocation(300, 2); JPanel MainPanel = new JPanel(); JPanel NORTHPanel = new JPanel(); Date d = new Date(); JPanel WESTPanel = new JPanel(); JPanel EASTPanel = new JPanel(); JPanel SOUTHPanel = new JPanel(); JPanel CENTERPanel = new JPanel(); MainPanel.setPreferredSize (new Dimension(960,480)); MainPanel.setLayout(new BorderLayout()); WESTPanel.setLayout(new BoxLayout(WESTPanel,BoxLayout.PAGE_AXIS)); EASTPanel.setLayout(new BoxLayout(EASTPanel,BoxLayout.PAGE_AXIS)); CENTERPanel.setLayout(new GridBagLayout()); //-------------------------textArea located at top ------------------------------------ JTextArea NorthTextArea = new JTextArea(); //(+ d.toString(),SwingConstants.CENTER); //NorthTextArea.(d.toString()); NorthTextArea.setEditable(false); NorthTextArea.setOpaque(false); NorthTextArea.setText("JLCB AUTO MATED BANKING MACHINE\n "); NorthTextArea.append(d.toString()); NORTHPanel.add(NorthTextArea,BorderLayout.CENTER); MainPanel.add(NORTHPanel,BorderLayout.NORTH); NorthTextArea.setFont(new Font("Calibri",Font.ITALIC,30)); //---------buttons AND WEST AND EAST FRAME -------------------------------------- JButton b1 =new JButton("-----------"); JButton b2 =new JButton("-----------"); JButton b3 =new JButton("-----------"); JButton b4 =new JButton("-----------"); b5 =new JButton("BALANCE QUERY"); b6 =new JButton(" WITHDRAW "); b7 =new JButton(" DEPOSIT "); JButton b8 =new JButton("----------------"); b1.setPreferredSize(new Dimension (100,100)); b2.setPreferredSize(new Dimension (100,100)); b3.setPreferredSize(new Dimension (100,100)); b4.setPreferredSize(new Dimension (100,100)); b5.setPreferredSize(new Dimension (150,100)); b6.setPreferredSize(new Dimension (150,100)); b7.setPreferredSize(new Dimension (150,100)); b8.setPreferredSize(new Dimension (150,100)); WESTPanel.add(Box.createRigidArea(new Dimension(50,80))); WESTPanel.add(b1); WESTPanel.add(Box.createRigidArea(new Dimension(30,50))); WESTPanel.add(b2); WESTPanel.add(Box.createRigidArea(new Dimension(30,50))); WESTPanel.add(b3); WESTPanel.add(Box.createRigidArea(new Dimension(30,50))); WESTPanel.add(b4); EASTPanel.add(Box.createRigidArea(new Dimension(30,80))); EASTPanel.add(b5); EASTPanel.add(Box.createRigidArea(new Dimension(30,50))); EASTPanel.add(b6); EASTPanel.add(Box.createRigidArea(new Dimension(30,50))); EASTPanel.add(b7); EASTPanel.add(Box.createRigidArea(new Dimension(30,50))); EASTPanel.add(b8); MainPanel.add(WESTPanel,BorderLayout.WEST); MainPanel.add(EASTPanel,BorderLayout.EAST); //--------------center PANEL --------------------------------- JLabel EnterCardLabel =new JLabel("PLEASE SELECT FROM THE BUTTONS ON THE RIGHT"); EnterCardLabel.setFont(new Font("Calibri",Font.BOLD,20)); CENTERPanel.add(EnterCardLabel); MainPanel.add(CENTERPanel,BorderLayout.CENTER); //----------------------------SOUTH PANEL---------------------------------------------------- SOUTHPanel.setSize(15,10); MainPanel.add(SOUTHPanel,BorderLayout.SOUTH); //---------------------------------------------------------------------------------------- this.getContentPane().add(MainPanel); this.pack(); // this.setVisible(true); } public void addbalancequaryctionListener(ActionListener Balancequarylistener) { b5.addActionListener(Balancequarylistener); } public void addwidthdrawListener(ActionListener widthdrawlistener) { b6.addActionListener(widthdrawlistener); } public void adddepositListener(ActionListener depositelistener) { b7.addActionListener(depositelistener); } public static void main(String[] args) { //Menus Frame = new Menus(); } }
f63d934ad2ca144e7c1fbee6b0b7c3d4896ce43e
fc4b196567b8e0363adad4a11a11640194385ebb
/big_variable_tree/androidAppModule75/src/main/java/com/androidAppModule75/Activity7.java
0811964e492d6a7e02be2a141ef14c4412529d52
[]
no_license
MaTriXy/android-projects
8c9e93233bfff6661c51d55438224883518f8c5b
53faf79ca3f39b16e48ddbd35a4a11470ed5fd03
refs/heads/master
2020-04-10T12:27:35.232439
2018-10-31T21:18:30
2018-10-31T21:18:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
353
java
package com.androidAppModule75; import java.lang.Override; public class Activity7 extends android.app.Activity { @Override public void onCreate(android.os.Bundle savedInstanceState) { super.onCreate(savedInstanceState); new androidAppModule75packageJava0.Foo0().foo3(); setContentView(R.layout.androidappmodule75activity_main7); } }
303535f222d9eb6081c002d98c865740a337904c
ad9f0a6d8459fab9b3e917c518ff607ab4954212
/src/main/java/fi/vamk/e1800945/northwind1/SpringFoxConfig.java
e20ad518b78110df75d613920c09ab3947f89d82
[]
no_license
BrunoNguyen2905/Spring_Northwind
f201b90e8228f5efecec84943c43a865aea3f4d0
f40af609c8ffa05666c4dc4f6de88f56deac6447
refs/heads/master
2022-07-16T23:15:24.010125
2020-02-14T21:30:49
2020-02-14T21:30:49
238,952,804
0
0
null
2020-07-02T02:10:50
2020-02-07T15:06:41
Java
UTF-8
Java
false
false
894
java
package fi.vamk.e1800945.northwind1; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; @Configuration @EnableSwagger2 public class SpringFoxConfig { @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()) .build(); } }
af791060398851d87a650cfa3ccb28f7a3aac37e
bbc1745aac324a690eae2582b669fc6808445067
/Spring-demo-Project-show/src/Spring/HappyFortuneService.java
f2798b3a28fec92538121f4688dedd670dda8dda
[]
no_license
hxz156/Spring-Hibernate
2cbce7dc33dcc644b3c5c02ec226321608de0215
ce06501115e6260db71e240799c5e0c1a694546e
refs/heads/master
2022-01-20T19:18:09.558223
2019-08-02T19:45:53
2019-08-02T19:45:53
198,005,127
0
0
null
null
null
null
UTF-8
Java
false
false
166
java
package Spring; public class HappyFortuneService implements FortuneService { @Override public String getFortune() { return "Today is your Lucky Day!"; } }
0332868edbc21ee647923275a2a31da63a943ef2
12922b5cf82fdb2ccb43eab486b5091a8879acd0
/bluetooth/src/main/java/com/cd/bluetooth/conn/BleCharacterCallback.java
479795a4f8ae824e2848cd9c9ea62816f319a915
[]
no_license
CNHTT/PullListView
1a2841d5bb4829937a67a63d19b5cff37b100fdb
dcc7609691f604f963bb878a5382bc2adfac62b6
refs/heads/master
2021-01-20T13:45:36.220689
2017-06-02T03:59:38
2017-06-02T03:59:38
90,525,679
0
0
null
null
null
null
UTF-8
Java
false
false
359
java
package com.cd.bluetooth.conn; import android.bluetooth.BluetoothGattCharacteristic; /** * 项目名称:0505Bluetooth. * 创建人: CT. * 创建时间: 2017/5/10. * GitHub:https://github.com/CNHTT */ public abstract class BleCharacterCallback extends BleCallback { public abstract void onSuccess(BluetoothGattCharacteristic characteristic); }
a65c2cfb25933115fb1a9e5d6eb688682474b283
1588183ae1117212beeb28ec11b8f176f7dce33a
/core/src/main/java/io/fabric8/maven/core/util/PrefixedLogger.java
6a3d11529bedf5b2bb7329a08897c0fa28e497e9
[]
no_license
davidkuster/fabric8-maven-plugin
b3555a9117730f4a88bf02b1e9babd8fdd262932
1f11710ac41219c99c8aaf58f6a1149d4582db27
refs/heads/master
2021-01-22T18:53:52.706870
2017-03-16T16:24:10
2017-03-16T16:24:10
85,131,111
0
3
null
2017-03-16T16:24:11
2017-03-15T23:28:50
Java
UTF-8
Java
false
false
2,174
java
/* * Copyright 2016 Red Hat, Inc. * * Red Hat 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 io.fabric8.maven.core.util; import io.fabric8.maven.docker.util.Logger; /** * @author roland * @since 23/07/16 */ public class PrefixedLogger implements Logger { private final String prefix; private final Logger log; public PrefixedLogger(String prefix, Logger log) { this.prefix = prefix; this.log = log; } @Override public void debug(String message, Object... objects) { log.debug(p(message), objects); } @Override public void info(String message, Object... objects) { log.info(p(message),objects); } @Override public void verbose(String message, Object... objects) { log.verbose(p(message), objects); } @Override public void warn(String message, Object... objects) { log.warn(p(message), objects); } @Override public void error(String message, Object... objects) { log.error(p(message), objects); } @Override public String errorMessage(String message) { return log.errorMessage(p(message)); } @Override public boolean isDebugEnabled() { return log.isDebugEnabled(); } @Override public void progressStart() { log.progressStart(); } @Override public void progressUpdate(String s, String s1, String s2) { log.progressUpdate(s,s1,s2); } @Override public void progressFinished() { log.progressFinished(); } private String p(String message) { return prefix + ": " + message; } }
1ff614d8260099dbddd8cd6a4e901635fb570a31
17afc620ca821e3b7fa576aeb9592adfd31fe34b
/app/src/main/java/com/github/nagromc/nzbgetclient/model/GlobalDownloadStatus.java
14d920444579988d4cd90a9d3aa3bb36dd54481e
[]
no_license
nagromc/open-nzbget-android-client
8909ac8c62614886e6151d6dc9db36e01f4d4b62
6f1109217adfc75399345b04992036e383440b7b
refs/heads/master
2021-01-20T13:47:33.066304
2014-08-29T17:59:52
2014-08-29T17:59:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
666
java
package com.github.nagromc.nzbgetclient.model; import com.github.nagromc.nzbgetclient.R; public enum GlobalDownloadStatus { // display "play" icon when NZBGet is paused PAUSED(R.drawable.ic_actionbar_action_play), // display "pause" icon when NZBGet is downloading DOWNLOADING(R.drawable.ic_actionbar_action_pause); private int resourceId; private GlobalDownloadStatus(int resourceId) { this.resourceId = resourceId; } public static GlobalDownloadStatus fromBoolean(boolean isDownloading) { return isDownloading ? DOWNLOADING : PAUSED; } public int getResourceId() { return resourceId; } }
9c85ad668384296d02441e5b047bcaa899dd9732
6fb64f3f89970cb877aef9b742d6ed7b803c2d59
/xpush-oppo/src/main/java/com/xuexiang/xpush/oppo/net/HttpUtils.java
cbebaa71804aa994d30cd0123f08fd2b65d45eaa
[ "Apache-2.0" ]
permissive
DrumbeatSoft/XPush
1caacbbe5319b852f7693df4fb594dcaf14b8473
3431cf4e2d55f94e76e1403a01b55b71640e4632
refs/heads/master
2022-11-27T14:54:29.828956
2020-08-11T03:38:43
2020-08-11T03:38:43
262,236,571
4
0
null
null
null
null
UTF-8
Java
false
false
9,402
java
package com.xuexiang.xpush.oppo.net; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Handler; import com.alibaba.fastjson.JSONObject; import com.xuexiang.xpush.logs.PushLog; import com.xuexiang.xpush.oppo.bean.BaseBean; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.net.HttpURLConnection; import java.net.URL; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class HttpUtils { //线程池 private static ExecutorService executor; private static Handler mHandler; private static final String METHOD_GET = "GET"; private static final String METHOD_POST = "POST"; private static final int CONNECT_TIME_OUT = 50000; private static final int READ_TIME_OUT = 50000; static { executor = Executors.newFixedThreadPool(5); mHandler = new Handler(); } public static void postJson(final String url, final Object params, final Callback callback) { final String authorization = DESUtil.encrypt("drumbeatpush", "drumbeat2020!@123" + "-" + System.currentTimeMillis()); executor.execute(new Runnable() { @Override public void run() { HttpURLConnection connection = null; OutputStream outputStream = null; try { PushLog.d("url:" + url); URL u = new URL(url); connection = (HttpURLConnection) u.openConnection(); // 设置输入可用 connection.setDoInput(true); // 设置输出可用 connection.setDoOutput(true); // 设置请求方式 connection.setRequestMethod(METHOD_POST); // 设置连接超时 connection.setConnectTimeout(CONNECT_TIME_OUT); // 设置读取超时 connection.setReadTimeout(READ_TIME_OUT); // 设置缓存不可用 connection.setUseCaches(false); // 设置请求头 connection.setRequestProperty("Content-Type", "application/json"); connection.setRequestProperty("Authorization", authorization); PushLog.d("RequestProperty:" + JSONObject.toJSON(connection.getRequestProperties())); // 开始连接 connection.connect(); if (params != null) { String json = JSONObject.toJSON(params).toString(); PushLog.d("params:" + json); outputStream = connection.getOutputStream(); outputStream.write(json.getBytes()); outputStream.flush(); } int responseCode = connection.getResponseCode(); if (responseCode == 200) { InputStream inputStream = connection.getInputStream(); final String result = inputStream2String(inputStream); if (result != null && callback != null) { postSuccess(result, callback); } } else { if (callback != null) { postFailed(callback, responseCode, new Exception("请求数据失败:" + responseCode)); } } } catch (final Exception e) { e.printStackTrace(); if (callback != null) { postFailed(callback, 0, e); } } finally { if (connection != null) { connection.disconnect(); } if (outputStream != null) { try { outputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } } }); } private static void postSuccess(final String result, final Callback callback) { mHandler.post(new Runnable() { @Override public void run() { PushLog.d("Success result:" + result); BaseBean dataBean = JSONObject.parseObject(result, BaseBean.class); if (dataBean != null) { int code = dataBean.getCode(); if (code == 200) { if (dataBean.getData() != null) { Object o = JSONObject.parseObject(dataBean.getData().toString(), getInterfaceT(callback, 0)); dataBean.setData(o); } callback.onSuccess(dataBean); } else { postFailed(callback, code, new Exception(dataBean.getMessage())); } } else { postFailed(callback, 0, new Exception("json 解析失败")); } } }); } private static void postFailed(final Callback callback, final int code, final Exception e) { mHandler.post(new Runnable() { @Override public void run() { PushLog.d("postFailed code:" + code + "\nException:" + e); callback.onFaileure(code, e); } }); } /** * 字节流转换成字符串 * * @param inputStream * @return */ private static String inputStream2String(InputStream inputStream) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); byte[] bytes = new byte[1024]; int len = 0; try { while ((len = inputStream.read(bytes)) != -1) { baos.write(bytes, 0, len); } return new String(baos.toByteArray()); } catch (IOException e) { e.printStackTrace(); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } if (baos != null) { try { baos.close(); } catch (IOException e) { e.printStackTrace(); } } } return null; } /** * 字节流转换成字节数组 * * @param inputStream 输入流 * @return */ public static byte[] inputStream2ByteArray(InputStream inputStream) { byte[] result = null; ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); // 缓冲区 byte[] bytes = new byte[1024]; int len = -1; try { // 使用字节数据输出流来保存数据 while ((len = inputStream.read(bytes)) != -1) { outputStream.write(bytes, 0, len); } result = outputStream.toByteArray(); } catch (IOException e) { e.printStackTrace(); } finally { try { inputStream.close(); outputStream.close(); } catch (IOException e) { e.printStackTrace(); } } return result; } /** * 判断是否联网 * * @param context * @return */ public static boolean isNetWorkConnected(Context context) { ConnectivityManager manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = manager.getActiveNetworkInfo(); if (networkInfo != null) { return networkInfo.isAvailable(); } return false; } public interface Callback<T> { void onFaileure(int code, Exception e); void onSuccess(T dataBean); } /** * 获取接口上的泛型T * * @param o 接口 * @param index 泛型索引 */ public static Class<?> getInterfaceT(Object o, int index) { Type[] types = o.getClass().getGenericInterfaces(); ParameterizedType parameterizedType = (ParameterizedType) types[index]; Type type = parameterizedType.getActualTypeArguments()[index]; return checkType(type, index); } private static Class<?> checkType(Type type, int index) { if (type instanceof Class<?>) { return (Class<?>) type; } else if (type instanceof ParameterizedType) { ParameterizedType pt = (ParameterizedType) type; Type t = pt.getActualTypeArguments()[index]; return checkType(t, index); } else { String className = type == null ? "null" : type.getClass().getName(); throw new IllegalArgumentException("Expected a Class, ParameterizedType" + ", but <" + type + "> is of type " + className); } } }
3adea0c12217ba0a1ff70eecb91d29b1ddf9c0c4
e217dfd7030c6b9ff61f453d9a9be40c9641b27b
/Codeforces/src/GDSUB.java
bd31bbb4f080f8a27bb3ddf67d2ef1865ac23fc9
[]
no_license
vengalraoguttha/competitive-programming
574cf608188bc7ec69f3adb0c59da366603e1124
5d41bb4748937b6f9fd8f1a61dee1e66c0e9353c
refs/heads/master
2021-08-07T12:23:15.404762
2020-12-22T12:58:55
2020-12-22T12:58:55
232,958,730
0
0
null
null
null
null
UTF-8
Java
false
false
2,999
java
import java.io.IOException; import java.util.Arrays; public class GDSUB { public static void main(String[] args) throws IOException { Reader sc = new Reader(); int n = sc.nextInt(); int k = sc.nextInt(); int[] arr = new int[n]; int[] times = new int[8001]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); times[arr[i]]++; } // Arrays.sort(arr); int mod = 1000000007; long[][] counts = new long[8001][8001]; boolean[] visited = new boolean[8001]; int[] startInd = new int[8001]; int count = 0; // for(int i = 0; i < arr.length ; i++){ // boolean flag = false; // if(!visited[(arr[i])]){ // flag = true; // count++; // visited[arr[i]] = true; // } // for(int l = 1; l <= count ; l++){ // if(l == 1){ // counts[i][l] = (i != 0) ? (counts[i-1][l]+1)%mod : 1; // }else{ // if(flag){ // counts[i][l] = (counts[i-1][l] + counts[i-1][l-1])%mod; // startInd[l-1] = counts[i-1][l-1]; // } // else{ // counts[i][l] = (counts[i-1][l] + startInd[l-1])%mod; // } // // } // } // } int prev = 0; for (int i = 1; i < 8001; i++) { if (times[i] == 0) continue; boolean flag = false; if (!visited[i]) { flag = true; count++; visited[i] = true; } for (int l = 1; l <= count; l++) { if (l == 1) { counts[i][l] = (i != 0) ? (counts[prev][l] + times[i]) % mod : 1; } else { counts[i][l] = (counts[prev][l] + (times[i]%mod) * (counts[prev][l - 1]%mod)) % mod; // if(flag){ // counts[i][l] = (counts[i-1][l] + counts[i-1][l-1])%mod; // startInd[l-1] = counts[i-1][l-1]; // } // else{ // counts[i][l] = (counts[i-1][l] + startInd[l-1])%mod; // } } } prev = i; } long val = 0; for (int i = 0; i <= min(k,8000); i++) { val += counts[prev][i]; val = val % mod; } System.out.println(val + 1); } static int min(int a,int b){ if( a < b) return a; return b; } }
f1f8fb2f6f8aa5e4b59aa87f82ac3b9596f8b222
85716a7c1e5cc6d960d2976828ef2d379d407561
/src/controller/OutputController.java
60b47fabb2aea9f3dc11cbdd04194cf1921fe9f1
[]
no_license
ronellroxas/CSARCH-Decimal64_Simulator
2ed68e0d659d2eed831eeb261333b04d8bdfe124
10c78256c272d23a16a7a6300ebefdd6b511b30c
refs/heads/main
2023-02-27T19:22:44.961436
2021-01-30T04:27:21
2021-01-30T04:27:21
331,031,582
0
0
null
null
null
null
UTF-8
Java
false
false
1,027
java
package controller; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JOptionPane; import javax.swing.JTextArea; import java.awt.datatransfer.StringSelection; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import model.Dec64; public class OutputController implements ActionListener { private JTextArea tfOutput; private Dec64 dec64; @Override public void actionPerformed(ActionEvent e) { String myString = tfOutput.getText(); StringSelection stringSelection = new StringSelection(myString); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(stringSelection, null); JOptionPane.showMessageDialog(tfOutput, "Result copied to clipboard", "Results copied!", JOptionPane.INFORMATION_MESSAGE); } public OutputController(Dec64 n) { this.dec64 = n; } public void setTarget(JTextArea tfOutput) { this.tfOutput = tfOutput; } }
ca0d329ddf1e4153c00c689a54d05eab1a43ddbf
be1f92270383203006b7e3de47571b95593af470
/MainActivity.java
6d84bbc75ca6f8256240a136081f6dbecacf0a1d
[]
no_license
anjali234/environment-sensors
e2a9c804656b341be7452d48662e0b83a6404ce3
d64f24b2c59abd051cb7aeb125585d36a9551808
refs/heads/master
2021-01-20T10:29:55.371725
2017-08-29T08:15:41
2017-08-29T08:15:41
101,636,145
0
0
null
null
null
null
UTF-8
Java
false
false
3,674
java
package com.example.user.environment; import android.content.Intent; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.TextView; public class MainActivity extends AppCompatActivity implements SensorEventListener { private SensorManager mSensorManager; private TextView intensity; private TextView pressure; private TextView temperature; private TextView humidity; float x,y,z,p,t; float normalizedValue; private Sensor accelerometer; float array[]; int i=0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mSensorManager = (SensorManager)this.getSystemService(SENSOR_SERVICE); accelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); array=new float[500]; } /*Method called on sensor event change*/ @Override public void onSensorChanged(SensorEvent event) { TextView tvX = (TextView)findViewById(R.id.lightIntensity); TextView tvY = (TextView)findViewById(R.id.pressure); TextView tvZ = (TextView)findViewById(R.id.humidity); temperature = (TextView)findViewById(R.id.temperature); if(event.sensor.getType()==Sensor.TYPE_ACCELEROMETER) { //acceleration retrieved from the event and the gravity is removed x = event.values[0]; y = event.values[1]; z = event.values[2]; normalizedValue = (float) Math.sqrt(Math.pow(x,2)+Math.pow(y,2)+Math.pow(z,2)); temperature.setText("Acceleration:"+Float.toString(normalizedValue)); while(i<499){ array[i]=normalizedValue; i++; } } else if(event.sensor.getType()==Sensor.TYPE_LIGHT){ tvX.setText("Light:"+Float.toString(event.values[0])); } else if(event.sensor.getType()==Sensor.TYPE_PROXIMITY){ tvZ.setText("Proximity:"+Float.toString(event.values[0])); } else if(event.sensor.getType()==Sensor.TYPE_PRESSURE){ tvY.setText("Pressure: "+Float.toString(event.values[0])); } } @Override public void onAccuracyChanged(Sensor sensor, int i) { } @Override public void onResume(){ super.onResume(); mSensorManager.registerListener((SensorEventListener) this,accelerometer,SensorManager.SENSOR_DELAY_NORMAL); mSensorManager.registerListener((SensorEventListener) this,mSensorManager.getDefaultSensor(Sensor.TYPE_LIGHT),SensorManager.SENSOR_DELAY_FASTEST); mSensorManager.registerListener((SensorEventListener) this,mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY),SensorManager.SENSOR_DELAY_FASTEST); mSensorManager.registerListener((SensorEventListener) this,mSensorManager.getDefaultSensor(Sensor.TYPE_PRESSURE),SensorManager.SENSOR_DELAY_FASTEST); } @Override public void onPause(){ super.onPause(); mSensorManager.unregisterListener((SensorEventListener)this); } public void onPlotClick(View v){ //Starting a new Intent Intent nextScreen = new Intent(getApplicationContext(), PlotData.class); //Sending data to another Activity nextScreen.putExtra("myarray", array); Log.e("n", temperature.getText().toString()); startActivity(nextScreen); } }
59d80037eb75649a61381dd05873469818566025
8d5bd7995b891bbc49d602f3562ff8aed7169b92
/Zuul_ApiGateway/src/main/java/com/project/Zuul_ApiGateway/ZuulApiGatewayApplication.java
49be91fc281dc1cbe375e45d2e5cad99fd3b4691
[]
no_license
Karthika171/Agriculture-crop-deal
c9c30d6f4fee057cd6137ddfb33b580e65f0fd96
9f3b283d475da63a8d83e55df3b7d801edd9c6e8
refs/heads/master
2023-05-31T05:51:45.451216
2021-06-28T10:13:57
2021-06-28T10:13:57
380,987,226
0
0
null
null
null
null
UTF-8
Java
false
false
552
java
package com.project.Zuul_ApiGateway; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.netflix.zuul.EnableZuulProxy; @SpringBootApplication @EnableZuulProxy @EnableEurekaClient public class ZuulApiGatewayApplication { public static void main(String[] args) { SpringApplication.run(ZuulApiGatewayApplication.class, args); System.out.println("API Gateway is running"); } }
7b92dd462e42d174781809f24563ea3c530867cc
7f07e1219bd9fe6ea12a0ddc341760d6c58b5e17
/common/src/main/java/com/rye/common/app/zApplication.java
7b062c3ae41446150a9eff2b2e7b23dd29e6a6ae
[]
no_license
SprrowZ/IM-Chat-Client
752f89d178d03a541ab12c291993cde7304491d0
29432e25ab06e75d4e1e98fc5e548d83873e8d20
refs/heads/master
2021-06-03T20:20:34.416722
2019-12-25T11:56:50
2019-12-25T11:56:50
146,434,607
0
0
null
null
null
null
UTF-8
Java
false
false
1,462
java
package com.rye.common.app; import android.app.Application; import android.os.SystemClock; import java.io.File; /** * Created at 2018/10/31. * * @author Zzg */ public class zApplication extends Application { private static zApplication instance; @Override public void onCreate() { super.onCreate(); instance=this; } // /** // * 静态内部类创建单例模式 // */ // private static class innerApplicaion{ // private static zApplication INSTANCE=new zApplication(); // } // public static zApplication getInstance(){ // return innerApplicaion.INSTANCE; // } /** * 外部获取单例 * * @return Application */ public static Application getInstance() { return instance; } /** * 得到缓存目录 * @return */ private static File getCacheDirFile(){ return getInstance().getCacheDir(); } public static File getPortraitTmpFile(){ //得到头像目录的缓存地址 File dir=new File(getCacheDirFile()+"portrait"); if (!dir.exists()){ dir.mkdirs(); } //删除其他头像文件 File[] files=dir.listFiles(); for (File file : files) { if (file.exists()){ file.delete(); } } //生成头像文件 File path=new File(dir, SystemClock.uptimeMillis()+".jpg"); return path.getAbsoluteFile(); } }
4deaebd21f09c4515c1a65477f36bd27cc9e436a
9371ae6ec24ad4b9914a43e64befb915d71e34f2
/out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/src/org/w3c/dom/Document.java
6c4b5810c6a66d2b896401a5e8e87e4a8c620350
[]
no_license
kanaida/LG-Esteem-Homeless-Kernel
9fac4c52993798eaf3021d9abb72a5e697464398
a5780f82bef7631fdb43b079e6f9ea6dbd187ac7
refs/heads/master
2020-06-09T06:14:50.214296
2012-02-24T04:23:01
2012-02-24T04:23:01
3,532,548
1
2
null
null
null
null
UTF-8
Java
false
false
2,814
java
package org.w3c.dom; public interface Document extends org.w3c.dom.Node { public abstract org.w3c.dom.DocumentType getDoctype(); public abstract org.w3c.dom.DOMImplementation getImplementation(); public abstract org.w3c.dom.Element getDocumentElement(); public abstract org.w3c.dom.Element createElement(java.lang.String tagName) throws org.w3c.dom.DOMException; public abstract org.w3c.dom.DocumentFragment createDocumentFragment(); public abstract org.w3c.dom.Text createTextNode(java.lang.String data); public abstract org.w3c.dom.Comment createComment(java.lang.String data); public abstract org.w3c.dom.CDATASection createCDATASection(java.lang.String data) throws org.w3c.dom.DOMException; public abstract org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data) throws org.w3c.dom.DOMException; public abstract org.w3c.dom.Attr createAttribute(java.lang.String name) throws org.w3c.dom.DOMException; public abstract org.w3c.dom.EntityReference createEntityReference(java.lang.String name) throws org.w3c.dom.DOMException; public abstract org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagname); public abstract org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode, boolean deep) throws org.w3c.dom.DOMException; public abstract org.w3c.dom.Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName) throws org.w3c.dom.DOMException; public abstract org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName) throws org.w3c.dom.DOMException; public abstract org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName); public abstract org.w3c.dom.Element getElementById(java.lang.String elementId); public abstract java.lang.String getInputEncoding(); public abstract java.lang.String getXmlEncoding(); public abstract boolean getXmlStandalone(); public abstract void setXmlStandalone(boolean xmlStandalone) throws org.w3c.dom.DOMException; public abstract java.lang.String getXmlVersion(); public abstract void setXmlVersion(java.lang.String xmlVersion) throws org.w3c.dom.DOMException; public abstract boolean getStrictErrorChecking(); public abstract void setStrictErrorChecking(boolean strictErrorChecking); public abstract java.lang.String getDocumentURI(); public abstract void setDocumentURI(java.lang.String documentURI); public abstract org.w3c.dom.Node adoptNode(org.w3c.dom.Node source) throws org.w3c.dom.DOMException; public abstract org.w3c.dom.DOMConfiguration getDomConfig(); public abstract void normalizeDocument(); public abstract org.w3c.dom.Node renameNode(org.w3c.dom.Node n, java.lang.String namespaceURI, java.lang.String qualifiedName) throws org.w3c.dom.DOMException; }
5bfd0ee658ad320778e495d4911e4905a57e60a7
7a6035ddae02b33de9cb223ed93c56be26bd2dcc
/src/main/java/ru/snake/spritepacker/render/TextureCellRenderer.java
c07eff2556fa673388a9cd4dbfefc75dff9dc663
[ "MIT" ]
permissive
SnakeSolid/java-sprite-packer
531ce6394d3ad87bfbe1cec6673e1866b66d1dd7
cd0a3614072cf706a2c2bdda7ee6a4e5aea5cee7
refs/heads/master
2023-05-02T00:50:20.676194
2014-08-03T06:19:35
2014-08-03T06:19:35
231,435,035
1
1
null
2023-04-14T17:12:39
2020-01-02T18:11:32
Java
UTF-8
Java
false
false
905
java
package ru.snake.spritepacker.render; import java.awt.image.RenderedImage; import javax.swing.Icon; import javax.swing.ListCellRenderer; import ru.snake.spritepacker.core.Texture; @SuppressWarnings("serial") public class TextureCellRenderer extends AbstractIconCellRender implements ListCellRenderer { private static final String TEXTURE_NAME_FORMAT = "<HTML>width=%d<BR>height=%d"; //$NON-NLS-1$ @Override protected boolean isValueValid(Object value) { return value instanceof Texture; } @Override protected void updateIcon(Object value) { Texture texture = (Texture) value; Icon textureIcon = getTextureIcon(texture); icon.setIcon(textureIcon); } @Override protected void updateText(Object value) { Texture texture = (Texture) value; RenderedImage image = texture.image; label.setText(String.format(TEXTURE_NAME_FORMAT, image.getWidth(), image.getHeight())); } }
[ "none@none" ]
none@none
82fb3fff26dc310ab20cc21aece37e8df64c3310
09b8f09f8a66ab4db466b2ed7e9773be6d1d2442
/src/main/java/com/ygb/Dao/SysLogDAO.java
cdde0d0fba3a884de8b876eca73f8c68f915bee0
[]
no_license
qq752657975/maoyan
4ebe5016e0c2fb1d06817927b9697a6b685278a7
fc018311a4a997ca1f4d9469f50b052d00e9040b
refs/heads/master
2022-12-03T18:15:52.437015
2020-08-29T16:14:45
2020-08-29T16:14:45
291,287,683
0
0
null
null
null
null
UTF-8
Java
false
false
416
java
package com.ygb.Dao; import com.ygb.entity.SysLogVo; import com.ygb.util.PageObject; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface SysLogDAO { List<SysLogVo> list(@Param("log") SysLogVo log, @Param("pager") PageObject pager); int count(@Param("log") SysLogVo log); void add(SysLogVo sysLogVo); }
7ddcfdfa775f9f96eaeab4ad288a43d1a508afd2
e40be695c06d0df583ece66d43af313d40151249
/theisland/src/Plant.java
92708b9d83402c387e13da62a2b5dc682f963397
[]
no_license
levan3/Islandv1
1e724773095e0ff32b37acd1823af2aa29fdf803
c8c7b396b5a85e325725037772011e3fdeafb11f
refs/heads/main
2023-01-24T13:31:16.453373
2020-11-26T23:26:42
2020-11-26T23:26:42
316,355,932
0
0
null
null
null
null
UTF-8
Java
false
false
286
java
public class Plant extends Thing { private int size; public Plant(int x, int y, char symbol, int size) { super(x, y, symbol); this.size = size; } public int getSize() { return size; } public void setSize(int size) { this.size = size; } }
1cb1d057c87963abae32a1f7c2fd019c10a9b298
9b5b41e8ca7a5b11c8013b7594d36a8147aec46d
/test/com/model/entity/EntitySuite.java
6eb8cfc810b1540b0f3c34d93e27e4cfc1ddf7cf
[]
no_license
ThiagoKrug/SistemaCaronas
55038bbcaf92ae10752281a81d2d64d5e945f156
8cb37f898700ff5a5201be60e42b0b4efbb9aa92
refs/heads/master
2020-05-24T15:16:04.829277
2013-01-31T13:29:46
2013-01-31T13:29:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,011
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.model.entity; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; /** * * @author Juliano Macedo * @since 28/01/2013 */ @RunWith(Suite.class) @Suite.SuiteClasses({com.model.entity.TipoUsuarioTest.class, com.model.entity.PassageiroTest.class, com.model.entity.SolicitacaoViagemTest.class, com.model.entity.VeiculoTest.class, com.model.entity.StatusSolicitacaoViagemTest.class, com.model.entity.UsuarioTest.class, com.model.entity.TipoVeiculoTest.class}) public class EntitySuite { @BeforeClass public static void setUpClass() throws Exception { } @AfterClass public static void tearDownClass() throws Exception { } @Before public void setUp() throws Exception { } @After public void tearDown() throws Exception { } }
40b064182683a981c2c388037ab652a4ae1e86fc
f08948be16e1c931d14b217dd882a4e954c2c505
/connector/ns8fulfilmentprocess/testsrc/com/ns8/hybris/fulfilmentprocess/test/actions/consignmentfulfilment/CalculatePayment.java
94a5430c9b68dc4e7f69699ab98564c74e343340
[]
no_license
ns8inc/protect-integration-sap-release
f218758fce28e15bbeb12b932e49810606a417da
9af3ed490fb7cb2cbe54077df4c4d329b262f2dc
refs/heads/master
2022-11-21T02:08:34.717053
2020-07-07T19:45:18
2020-07-07T19:45:18
266,125,943
0
0
null
null
null
null
UTF-8
Java
false
false
258
java
/* * Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. */ package com.ns8.hybris.fulfilmentprocess.test.actions.consignmentfulfilment; /** * */ public class CalculatePayment extends AbstractTestConsActionTemp { //empty }
6224b0972fd4613e1ef5855d804106cb4b89f4c1
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-migrationhub/src/main/java/com/amazonaws/services/migrationhub/model/transform/CreatedArtifactMarshaller.java
c26dde12c83f71ee674d1abea8a7ffc1cb227709
[ "Apache-2.0" ]
permissive
aws/aws-sdk-java
2c6199b12b47345b5d3c50e425dabba56e279190
bab987ab604575f41a76864f755f49386e3264b4
refs/heads/master
2023-08-29T10:49:07.379135
2023-08-28T21:05:55
2023-08-28T21:05:55
574,877
3,695
3,092
Apache-2.0
2023-09-13T23:35:28
2010-03-22T23:34:58
null
UTF-8
Java
false
false
2,262
java
/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.migrationhub.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.services.migrationhub.model.*; import com.amazonaws.protocol.*; import com.amazonaws.annotation.SdkInternalApi; /** * CreatedArtifactMarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class CreatedArtifactMarshaller { private static final MarshallingInfo<String> NAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD) .marshallLocationName("Name").build(); private static final MarshallingInfo<String> DESCRIPTION_BINDING = MarshallingInfo.builder(MarshallingType.STRING) .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("Description").build(); private static final CreatedArtifactMarshaller instance = new CreatedArtifactMarshaller(); public static CreatedArtifactMarshaller getInstance() { return instance; } /** * Marshall the given parameter object. */ public void marshall(CreatedArtifact createdArtifact, ProtocolMarshaller protocolMarshaller) { if (createdArtifact == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createdArtifact.getName(), NAME_BINDING); protocolMarshaller.marshall(createdArtifact.getDescription(), DESCRIPTION_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
[ "" ]
0108905d07fd4dc658969eacec623caf73bd40e9
685462fa81b8c36337af0cc61fe876a7a8f59db8
/policemain/src/main/java/com/dark_yx/policemain/launcher/launcher3/accessibility/LauncherAccessibilityDelegate.java
dcbd2665c5156f681f882474a0207b9408d6ecec
[]
no_license
LoveAuroral/Police
428b1e437776ad5bef2631d405dc95882c0c4fe3
d90562398e6dc56995811abc48507b33b2e3d89d
refs/heads/master
2023-02-18T07:09:37.136019
2021-01-19T09:17:00
2021-01-19T09:17:00
299,491,716
0
0
null
null
null
null
UTF-8
Java
false
false
17,976
java
package com.dark_yx.policemain.launcher.launcher3.accessibility; import android.annotation.TargetApi; import android.app.AlertDialog; import android.appwidget.AppWidgetProviderInfo; import android.content.DialogInterface; import android.graphics.Rect; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.text.TextUtils; import android.util.Log; import android.util.SparseArray; import android.view.View; import android.view.View.AccessibilityDelegate; import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction; import com.dark_yx.policemain.R; import com.dark_yx.policemain.launcher.launcher3.AppInfo; import com.dark_yx.policemain.launcher.launcher3.AppWidgetResizeFrame; import com.dark_yx.policemain.launcher.launcher3.CellLayout; import com.dark_yx.policemain.launcher.launcher3.DeleteDropTarget; import com.dark_yx.policemain.launcher.launcher3.DragController; import com.dark_yx.policemain.launcher.launcher3.DragSource; import com.dark_yx.policemain.launcher.launcher3.Folder; import com.dark_yx.policemain.launcher.launcher3.FolderInfo; import com.dark_yx.policemain.launcher.launcher3.InfoDropTarget; import com.dark_yx.policemain.launcher.launcher3.ItemInfo; import com.dark_yx.policemain.launcher.launcher3.Launcher; import com.dark_yx.policemain.launcher.launcher3.LauncherAppWidgetHostView; import com.dark_yx.policemain.launcher.launcher3.LauncherAppWidgetInfo; import com.dark_yx.policemain.launcher.launcher3.LauncherModel; import com.dark_yx.policemain.launcher.launcher3.LauncherSettings; import com.dark_yx.policemain.launcher.launcher3.PendingAddItemInfo; import com.dark_yx.policemain.launcher.launcher3.ShortcutInfo; import com.dark_yx.policemain.launcher.launcher3.UninstallDropTarget; import com.dark_yx.policemain.launcher.launcher3.Workspace; import com.dark_yx.policemain.launcher.launcher3.util.Thunk; import java.util.ArrayList; @TargetApi(Build.VERSION_CODES.LOLLIPOP) public class LauncherAccessibilityDelegate extends AccessibilityDelegate implements DragController.DragListener { private static final String TAG = "LauncherAccessibilityDelegate"; private static final int REMOVE = R.id.action_remove; private static final int INFO = R.id.action_info; private static final int UNINSTALL = R.id.action_uninstall; private static final int ADD_TO_WORKSPACE = R.id.action_add_to_workspace; private static final int MOVE = R.id.action_move; private static final int MOVE_TO_WORKSPACE = R.id.action_move_to_workspace; private static final int RESIZE = R.id.action_resize; public enum DragType { ICON, FOLDER, WIDGET } public static class DragInfo { public DragType dragType; public ItemInfo info; public View item; } private final SparseArray<AccessibilityAction> mActions = new SparseArray<>(); @Thunk final Launcher mLauncher; private DragInfo mDragInfo = null; private AccessibilityDragSource mDragSource = null; public LauncherAccessibilityDelegate(Launcher launcher) { mLauncher = launcher; mActions.put(REMOVE, new AccessibilityAction(REMOVE, launcher.getText(R.string.delete_target_label))); mActions.put(INFO, new AccessibilityAction(INFO, launcher.getText(R.string.info_target_label))); mActions.put(UNINSTALL, new AccessibilityAction(UNINSTALL, launcher.getText(R.string.delete_target_uninstall_label))); mActions.put(ADD_TO_WORKSPACE, new AccessibilityAction(ADD_TO_WORKSPACE, launcher.getText(R.string.action_add_to_workspace))); mActions.put(MOVE, new AccessibilityAction(MOVE, launcher.getText(R.string.action_move))); mActions.put(MOVE_TO_WORKSPACE, new AccessibilityAction(MOVE_TO_WORKSPACE, launcher.getText(R.string.action_move_to_workspace))); mActions.put(RESIZE, new AccessibilityAction(RESIZE, launcher.getText(R.string.action_resize))); } @Override public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(host, info); if (!(host.getTag() instanceof ItemInfo)) return; ItemInfo item = (ItemInfo) host.getTag(); if (DeleteDropTarget.supportsDrop(item)) { info.addAction(mActions.get(REMOVE)); } if (UninstallDropTarget.supportsDrop(host.getContext(), item)) { info.addAction(mActions.get(UNINSTALL)); } if (InfoDropTarget.supportsDrop(host.getContext(), item)) { info.addAction(mActions.get(INFO)); } if ((item instanceof ShortcutInfo) || (item instanceof LauncherAppWidgetInfo) || (item instanceof FolderInfo)) { info.addAction(mActions.get(MOVE)); if (item.container >= 0) { info.addAction(mActions.get(MOVE_TO_WORKSPACE)); } else if (item instanceof LauncherAppWidgetInfo) { if (!getSupportedResizeActions(host, (LauncherAppWidgetInfo) item).isEmpty()) { info.addAction(mActions.get(RESIZE)); } } } if ((item instanceof AppInfo) || (item instanceof PendingAddItemInfo)) { info.addAction(mActions.get(ADD_TO_WORKSPACE)); } } @Override public boolean performAccessibilityAction(View host, int action, Bundle args) { if ((host.getTag() instanceof ItemInfo) && performAction(host, (ItemInfo) host.getTag(), action)) { return true; } return super.performAccessibilityAction(host, action, args); } public boolean performAction(final View host, final ItemInfo item, int action) { if (action == REMOVE) { if (DeleteDropTarget.removeWorkspaceOrFolderItem(mLauncher, item, host)) { announceConfirmation(R.string.item_removed); return true; } return false; } else if (action == INFO) { InfoDropTarget.startDetailsActivityForInfo(item, mLauncher); return true; } else if (action == UNINSTALL) { return UninstallDropTarget.startUninstallActivity(mLauncher, item); } else if (action == MOVE) { beginAccessibleDrag(host, item); } else if (action == ADD_TO_WORKSPACE) { final int[] coordinates = new int[2]; final long screenId = findSpaceOnWorkspace(item, coordinates); mLauncher.showWorkspace(true, new Runnable() { @Override public void run() { if (item instanceof AppInfo) { ShortcutInfo info = ((AppInfo) item).makeShortcut(); LauncherModel.addItemToDatabase(mLauncher, info, LauncherSettings.Favorites.CONTAINER_DESKTOP, screenId, coordinates[0], coordinates[1]); ArrayList<ItemInfo> itemList = new ArrayList<>(); itemList.add(info); mLauncher.bindItems(itemList, 0, itemList.size(), true); } else if (item instanceof PendingAddItemInfo) { PendingAddItemInfo info = (PendingAddItemInfo) item; Workspace workspace = mLauncher.getWorkspace(); workspace.snapToPage(workspace.getPageIndexForScreenId(screenId)); mLauncher.addPendingItem(info, LauncherSettings.Favorites.CONTAINER_DESKTOP, screenId, coordinates, info.spanX, info.spanY); } announceConfirmation(R.string.item_added_to_workspace); } }); return true; } else if (action == MOVE_TO_WORKSPACE) { Folder folder = mLauncher.getWorkspace().getOpenFolder(); mLauncher.closeFolder(folder); ShortcutInfo info = (ShortcutInfo) item; folder.getInfo().remove(info); final int[] coordinates = new int[2]; final long screenId = findSpaceOnWorkspace(item, coordinates); LauncherModel.moveItemInDatabase(mLauncher, info, LauncherSettings.Favorites.CONTAINER_DESKTOP, screenId, coordinates[0], coordinates[1]); // Bind the item in next frame so that if a new workspace page was created, // it will get laid out. new Handler().post(new Runnable() { @Override public void run() { ArrayList<ItemInfo> itemList = new ArrayList<>(); itemList.add(item); mLauncher.bindItems(itemList, 0, itemList.size(), true); announceConfirmation(R.string.item_moved); } }); } else if (action == RESIZE) { final LauncherAppWidgetInfo info = (LauncherAppWidgetInfo) item; final ArrayList<Integer> actions = getSupportedResizeActions(host, info); CharSequence[] labels = new CharSequence[actions.size()]; for (int i = 0; i < actions.size(); i++) { labels[i] = mLauncher.getText(actions.get(i)); } new AlertDialog.Builder(mLauncher) .setTitle(R.string.action_resize) .setItems(labels, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { performResizeAction(actions.get(which), host, info); dialog.dismiss(); } }) .show(); } return false; } private ArrayList<Integer> getSupportedResizeActions(View host, LauncherAppWidgetInfo info) { ArrayList<Integer> actions = new ArrayList<>(); AppWidgetProviderInfo providerInfo = ((LauncherAppWidgetHostView) host).getAppWidgetInfo(); if (providerInfo == null) { return actions; } CellLayout layout = (CellLayout) host.getParent().getParent(); if ((providerInfo.resizeMode & AppWidgetProviderInfo.RESIZE_HORIZONTAL) != 0) { if (layout.isRegionVacant(info.cellX + info.spanX, info.cellY, 1, info.spanY) || layout.isRegionVacant(info.cellX - 1, info.cellY, 1, info.spanY)) { actions.add(R.string.action_increase_width); } if (info.spanX > info.minSpanX && info.spanX > 1) { actions.add(R.string.action_decrease_width); } } if ((providerInfo.resizeMode & AppWidgetProviderInfo.RESIZE_VERTICAL) != 0) { if (layout.isRegionVacant(info.cellX, info.cellY + info.spanY, info.spanX, 1) || layout.isRegionVacant(info.cellX, info.cellY - 1, info.spanX, 1)) { actions.add(R.string.action_increase_height); } if (info.spanY > info.minSpanY && info.spanY > 1) { actions.add(R.string.action_decrease_height); } } return actions; } @Thunk void performResizeAction(int action, View host, LauncherAppWidgetInfo info) { CellLayout.LayoutParams lp = (CellLayout.LayoutParams) host.getLayoutParams(); CellLayout layout = (CellLayout) host.getParent().getParent(); layout.markCellsAsUnoccupiedForView(host); if (action == R.string.action_increase_width) { if (((host.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) && layout.isRegionVacant(info.cellX - 1, info.cellY, 1, info.spanY)) || !layout.isRegionVacant(info.cellX + info.spanX, info.cellY, 1, info.spanY)) { lp.cellX --; info.cellX --; } lp.cellHSpan ++; info.spanX ++; } else if (action == R.string.action_decrease_width) { lp.cellHSpan --; info.spanX --; } else if (action == R.string.action_increase_height) { if (!layout.isRegionVacant(info.cellX, info.cellY + info.spanY, info.spanX, 1)) { lp.cellY --; info.cellY --; } lp.cellVSpan ++; info.spanY ++; } else if (action == R.string.action_decrease_height) { lp.cellVSpan --; info.spanY --; } layout.markCellsAsOccupiedForView(host); Rect sizeRange = new Rect(); AppWidgetResizeFrame.getWidgetSizeRanges(mLauncher, info.spanX, info.spanY, sizeRange); ((LauncherAppWidgetHostView) host).updateAppWidgetSize(null, sizeRange.left, sizeRange.top, sizeRange.right, sizeRange.bottom); host.requestLayout(); LauncherModel.updateItemInDatabase(mLauncher, info); announceConfirmation(mLauncher.getString(R.string.widget_resized, info.spanX, info.spanY)); } @Thunk void announceConfirmation(int resId) { announceConfirmation(mLauncher.getResources().getString(resId)); } @Thunk void announceConfirmation(String confirmation) { mLauncher.getDragLayer().announceForAccessibility(confirmation); } public boolean isInAccessibleDrag() { return mDragInfo != null; } public DragInfo getDragInfo() { return mDragInfo; } /** * @param clickedTarget the actual view that was clicked * @param dropLocation relative to {@param clickedTarget}. If provided, its center is used * as the actual drop location otherwise the views center is used. */ public void handleAccessibleDrop(View clickedTarget, Rect dropLocation, String confirmation) { if (!isInAccessibleDrag()) return; int[] loc = new int[2]; if (dropLocation == null) { loc[0] = clickedTarget.getWidth() / 2; loc[1] = clickedTarget.getHeight() / 2; } else { loc[0] = dropLocation.centerX(); loc[1] = dropLocation.centerY(); } mLauncher.getDragLayer().getDescendantCoordRelativeToSelf(clickedTarget, loc); mLauncher.getDragController().completeAccessibleDrag(loc); if (!TextUtils.isEmpty(confirmation)) { announceConfirmation(confirmation); } } public void beginAccessibleDrag(View item, ItemInfo info) { mDragInfo = new DragInfo(); mDragInfo.info = info; mDragInfo.item = item; mDragInfo.dragType = DragType.ICON; if (info instanceof FolderInfo) { mDragInfo.dragType = DragType.FOLDER; } else if (info instanceof LauncherAppWidgetInfo) { mDragInfo.dragType = DragType.WIDGET; } CellLayout.CellInfo cellInfo = new CellLayout.CellInfo(item, info); Rect pos = new Rect(); mLauncher.getDragLayer().getDescendantRectRelativeToSelf(item, pos); mLauncher.getDragController().prepareAccessibleDrag(pos.centerX(), pos.centerY()); Workspace workspace = mLauncher.getWorkspace(); Folder folder = workspace.getOpenFolder(); if (folder != null) { if (folder.getItemsInReadingOrder().contains(item)) { mDragSource = folder; } else { mLauncher.closeFolder(); } } if (mDragSource == null) { mDragSource = workspace; } mDragSource.enableAccessibleDrag(true); mDragSource.startDrag(cellInfo, true); if (mLauncher.getDragController().isDragging()) { mLauncher.getDragController().addDragListener(this); } } @Override public void onDragStart(DragSource source, Object info, int dragAction) { // No-op } @Override public void onDragEnd() { mLauncher.getDragController().removeDragListener(this); mDragInfo = null; if (mDragSource != null) { mDragSource.enableAccessibleDrag(false); mDragSource = null; } } public static interface AccessibilityDragSource { void startDrag(CellLayout.CellInfo cellInfo, boolean accessible); void enableAccessibleDrag(boolean enable); } /** * Find empty space on the workspace and returns the screenId. */ private long findSpaceOnWorkspace(ItemInfo info, int[] outCoordinates) { Workspace workspace = mLauncher.getWorkspace(); ArrayList<Long> workspaceScreens = workspace.getScreenOrder(); long screenId; // First check if there is space on the current screen. int screenIndex = workspace.getCurrentPage(); screenId = workspaceScreens.get(screenIndex); CellLayout layout = (CellLayout) workspace.getPageAt(screenIndex); boolean found = layout.findCellForSpan(outCoordinates, info.spanX, info.spanY); screenIndex = workspace.hasCustomContent() ? 1 : 0; while (!found && screenIndex < workspaceScreens.size()) { screenId = workspaceScreens.get(screenIndex); layout = (CellLayout) workspace.getPageAt(screenIndex); found = layout.findCellForSpan(outCoordinates, info.spanX, info.spanY); screenIndex++; } if (found) { return screenId; } workspace.addExtraEmptyScreen(); screenId = workspace.commitExtraEmptyScreen(); layout = workspace.getScreenWithId(screenId); found = layout.findCellForSpan(outCoordinates, info.spanX, info.spanY); if (!found) { Log.wtf(TAG, "Not enough space on an empty screen"); } return screenId; } }
43e292496259dc678a6bb865650889668b38e103
12b14b30fcaf3da3f6e9dc3cb3e717346a35870a
/examples/commons-math3/mutations/mutants-BicubicSplineInterpolatingFunction/91/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunction.java
aec88192cf3326bd50d845fbd376e5966aa7b1b3
[ "BSD-3-Clause", "Minpack", "Apache-2.0" ]
permissive
SmartTests/smartTest
b1de326998857e715dcd5075ee322482e4b34fb6
b30e8ec7d571e83e9f38cd003476a6842c06ef39
refs/heads/main
2023-01-03T01:27:05.262904
2020-10-27T20:24:48
2020-10-27T20:24:48
305,502,060
0
0
null
null
null
null
UTF-8
Java
false
false
20,329
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.commons.math3.analysis.interpolation; import java.util.Arrays; import org.apache.commons.math3.analysis.BivariateFunction; import org.apache.commons.math3.exception.DimensionMismatchException; import org.apache.commons.math3.exception.NoDataException; import org.apache.commons.math3.exception.OutOfRangeException; import org.apache.commons.math3.exception.NonMonotonicSequenceException; import org.apache.commons.math3.util.MathArrays; /** * Function that implements the * <a href="http://en.wikipedia.org/wiki/Bicubic_interpolation"> * bicubic spline interpolation</a>. * * @since 2.1 * @version $Id$ */ public class BicubicSplineInterpolatingFunction implements BivariateFunction { /** Number of coefficients. */ private static final int NUM_COEFF = 16; /** * Matrix to compute the spline coefficients from the function values * and function derivatives values */ private static final double[][] AINV = { { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, { 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0 }, { -3,3,0,0,-2,-1,0,0,0,0,0,0,0,1,0,0 }, { 2,-2,0,0,1,1,0,0,0,0,0,0,0,0,0,0 }, { 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0 }, { 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0 }, { 0,0,0,0,0,0,0,0,-3,3,0,0,-2,-1,0,0 }, { 0,0,0,0,0,0,0,0,2,-2,0,0,1,1,0,0 }, { -3,0,3,0,0,0,0,0,-2,0,-1,0,0,0,0,0 }, { 0,0,0,0,-3,0,3,0,0,0,0,0,-2,0,-1,0 }, { 9,-9,-9,9,6,3,-6,-3,6,-6,3,-3,4,2,2,1 }, { -6,6,6,-6,-3,-3,3,3,-4,4,-2,2,-2,-2,-1,-1 }, { 2,0,-2,0,0,0,0,0,1,0,1,0,0,0,0,0 }, { 0,0,0,0,2,0,-2,0,0,0,0,0,1,0,1,0 }, { -6,6,6,-6,-4,-2,4,2,-3,3,-3,3,-2,-1,-2,-1 }, { 4,-4,-4,4,2,2,-2,-2,2,-2,2,-2,1,1,1,1 } }; /** Samples x-coordinates */ private final double[] xval; /** Samples y-coordinates */ private final double[] yval; /** Set of cubic splines patching the whole data grid */ private final BicubicSplineFunction[][] splines; /** * Partial derivatives * The value of the first index determines the kind of derivatives: * 0 = first partial derivatives wrt x * 1 = first partial derivatives wrt y * 2 = second partial derivatives wrt x * 3 = second partial derivatives wrt y * 4 = cross partial derivatives */ private BivariateFunction[][][] partialDerivatives = null; /** * @param x Sample values of the x-coordinate, in increasing order. * @param y Sample values of the y-coordinate, in increasing order. * @param f Values of the function on every grid point. * @param dFdX Values of the partial derivative of function with respect * to x on every grid point. * @param dFdY Values of the partial derivative of function with respect * to y on every grid point. * @param d2FdXdY Values of the cross partial derivative of function on * every grid point. * @throws DimensionMismatchException if the various arrays do not contain * the expected number of elements. * @throws NonMonotonicSequenceException if {@code x} or {@code y} are * not strictly increasing. * @throws NoDataException if any of the arrays has zero length. */ public BicubicSplineInterpolatingFunction(double[] x, double[] y, double[][] f, double[][] dFdX, double[][] dFdY, double[][] d2FdXdY) throws DimensionMismatchException, NoDataException, NonMonotonicSequenceException { final int xLen = x.length; final int yLen = y.length; if (xLen == 0 || yLen == 0 || f.length == 0 || f[0].length == 0) { throw new NoDataException(); } if (xLen != f.length) { throw new DimensionMismatchException(xLen, f.length); } if (xLen != dFdX.length) { throw new DimensionMismatchException(xLen, dFdX.length); } if (xLen != dFdY.length) { throw new DimensionMismatchException(xLen, dFdY.length); } if (xLen != d2FdXdY.length) { throw new DimensionMismatchException(xLen, d2FdXdY.length); } MathArrays.checkOrder(x); MathArrays.checkOrder(y); xval = x.clone(); yval = y.clone(); final int lastI = xLen - 1; final int lastJ = yLen - 1; splines = new BicubicSplineFunction[lastI][lastJ]; for (int i = 0; i < lastI; i++) { if (f[i].length != yLen) { throw new DimensionMismatchException(f[i].length, yLen); } if (dFdX[i].length != yLen) { throw new DimensionMismatchException(dFdX[i].length, yLen); } if (dFdY[i].length != yLen) { throw new DimensionMismatchException(dFdY[i].length, yLen); } if (d2FdXdY[i].length != yLen) { throw new DimensionMismatchException(d2FdXdY[i].length, yLen); } final int ip1 = i + 1; for (int j = 0; j < lastJ; j++) { final int jp1 = j + 1; final double[] beta = new double[] { f[i][j], f[ip1][j], f[i][jp1], f[ip1][jp1], dFdX[i][j], dFdX[ip1][j], dFdX[i][jp1], dFdX[ip1][jp1], dFdY[i][j], dFdY[ip1][j], dFdY[i][jp1], dFdY[ip1][jp1], d2FdXdY[i][j], d2FdXdY[ip1][j], d2FdXdY[i][jp1], d2FdXdY[ip1][jp1] }; splines[i][j] = new BicubicSplineFunction(computeSplineCoefficients(beta)); } } } /** * {@inheritDoc} */ public double value(double x, double y) throws OutOfRangeException { final int i = searchIndex(x, xval); final int j = searchIndex(y, yval); final double xN = (x - xval[i]) / (xval[i + 1] - xval[i]); final double yN = (y - yval[j]) / (yval[j + 1] - yval[j]); return splines[i][j].value(xN, yN); } /** * Indicates whether a point is within the interpolation range. * * @param x First coordinate. * @param y Second coordinate. * @return {@code true} if (x, y) is a valid point. * @since 3.3 */ public boolean isValidPoint(double x, double y) { if (x < xval[0] || x > xval[xval.length - 1] || y < yval[0] || y > yval[yval.length - 1]) { return false; } else { return true; } } /** * @param x x-coordinate. * @param y y-coordinate. * @return the value at point (x, y) of the first partial derivative with * respect to x. * @throws OutOfRangeException if {@code x} (resp. {@code y}) is outside * the range defined by the boundary values of {@code xval} (resp. * {@code yval}). */ public double partialDerivativeX(double x, double y) throws OutOfRangeException { return partialDerivative(0, x, y); } /** * @param x x-coordinate. * @param y y-coordinate. * @return the value at point (x, y) of the first partial derivative with * respect to y. * @throws OutOfRangeException if {@code x} (resp. {@code y}) is outside * the range defined by the boundary values of {@code xval} (resp. * {@code yval}). */ public double partialDerivativeY(double x, double y) throws OutOfRangeException { return partialDerivative(1, x, y); } /** * @param x x-coordinate. * @param y y-coordinate. * @return the value at point (x, y) of the second partial derivative with * respect to x. * @throws OutOfRangeException if {@code x} (resp. {@code y}) is outside * the range defined by the boundary values of {@code xval} (resp. * {@code yval}). */ public double partialDerivativeXX(double x, double y) throws OutOfRangeException { return partialDerivative(2, x, y); } /** * @param x x-coordinate. * @param y y-coordinate. * @return the value at point (x, y) of the second partial derivative with * respect to y. * @throws OutOfRangeException if {@code x} (resp. {@code y}) is outside * the range defined by the boundary values of {@code xval} (resp. * {@code yval}). */ public double partialDerivativeYY(double x, double y) throws OutOfRangeException { return partialDerivative(3, x, y); } /** * @param x x-coordinate. * @param y y-coordinate. * @return the value at point (x, y) of the second partial cross-derivative. * @throws OutOfRangeException if {@code x} (resp. {@code y}) is outside * the range defined by the boundary values of {@code xval} (resp. * {@code yval}). */ public double partialDerivativeXY(double x, double y) throws OutOfRangeException { return partialDerivative(4, x, y); } /** * @param which First index in {@link #partialDerivatives}. * @param x x-coordinate. * @param y y-coordinate. * @return the value at point (x, y) of the selected partial derivative. * @throws OutOfRangeException if {@code x} (resp. {@code y}) is outside * the range defined by the boundary values of {@code xval} (resp. * {@code yval}). */ private double partialDerivative(int which, double x, double y) throws OutOfRangeException { if (partialDerivatives == null) { computePartialDerivatives(); } final int i = searchIndex(x, xval); final int j = searchIndex(y, yval); final double xN = (x - xval[i]) / (xval[i + 1] - xval[i]); final double yN = (y - yval[j]) / (yval[j + 1] - yval[j]); return partialDerivatives[which][i][j].value(xN, yN); } /** * Compute all partial derivatives. */ private void computePartialDerivatives() { final int lastI = xval.length - 1; final int lastJ = yval.length - 1; partialDerivatives = new BivariateFunction[5][lastI][lastJ]; for (int i = 0; i < lastI; i++) { for (int j = 0; j < lastJ; j++) { final BicubicSplineFunction f = splines[i][j]; partialDerivatives[0][i][j] = f.partialDerivativeX(); partialDerivatives[1][i][j] = f.partialDerivativeY(); partialDerivatives[2][i][j] = f.partialDerivativeXX(); partialDerivatives[3][i][j] = f.partialDerivativeYY(); partialDerivatives[4][i][j] = f.partialDerivativeXY(); } } } /** * @param c Coordinate. * @param val Coordinate samples. * @return the index in {@code val} corresponding to the interval * containing {@code c}. * @throws OutOfRangeException if {@code c} is out of the * range defined by the boundary values of {@code val}. */ private int searchIndex(double c, double[] val) { final int r = Arrays.binarySearch(val, c); if (r == -1 || r == -val.length - 1) { throw new OutOfRangeException(c, val[0], val[val.length - 1]); } if (r < 0) { // "c" in within an interpolation sub-interval: Return the // index of the sample at the lower end of the sub-interval. return -r - 2; } final int last = val.length - 1; if (r == last) { // "c" is the last sample of the range: Return the index // of the sample at the lower end of the last sub-interval. return last - 1; } // "c" is another sample point. return r; } /** * Compute the spline coefficients from the list of function values and * function partial derivatives values at the four corners of a grid * element. They must be specified in the following order: * <ul> * <li>f(0,0)</li> * <li>f(1,0)</li> * <li>f(0,1)</li> * <li>f(1,1)</li> * <li>f<sub>x</sub>(0,0)</li> * <li>f<sub>x</sub>(1,0)</li> * <li>f<sub>x</sub>(0,1)</li> * <li>f<sub>x</sub>(1,1)</li> * <li>f<sub>y</sub>(0,0)</li> * <li>f<sub>y</sub>(1,0)</li> * <li>f<sub>y</sub>(0,1)</li> * <li>f<sub>y</sub>(1,1)</li> * <li>f<sub>xy</sub>(0,0)</li> * <li>f<sub>xy</sub>(1,0)</li> * <li>f<sub>xy</sub>(0,1)</li> * <li>f<sub>xy</sub>(1,1)</li> * </ul> * where the subscripts indicate the partial derivative with respect to * the corresponding variable(s). * * @param beta List of function values and function partial derivatives * values. * @return the spline coefficients. */ private double[] computeSplineCoefficients(double[] beta) { final double[] a = new double[NUM_COEFF]; for (int i = 0; i < NUM_COEFF; i++) { double result = 0; final double[] row = AINV[i]; for (int j = 0; j < NUM_COEFF; j++) { result += row[j] * beta[j]; } a[i] = result; } return a; } } /** * 2D-spline function. * * @version $Id$ */ class BicubicSplineFunction implements BivariateFunction { /** Number of points. */ private static final short N = 4; /** Coefficients */ private final double[][] a; /** First partial derivative along x. */ private BivariateFunction partialDerivativeX; /** First partial derivative along y. */ private BivariateFunction partialDerivativeY; /** Second partial derivative along x. */ private BivariateFunction partialDerivativeXX; /** Second partial derivative along y. */ private BivariateFunction partialDerivativeYY; /** Second crossed partial derivative. */ private BivariateFunction partialDerivativeXY; /** * Simple constructor. * @param a Spline coefficients */ public BicubicSplineFunction(double[] a) { this.a = new double[N][N]; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { this.a[i][j] = a[i * N + j]; } } } /** * {@inheritDoc} */ public double value(double x, double y) { if (x < 0 || x > 1) { throw new OutOfRangeException(x, 0, 1); } if (y < 0 || y > 1) { throw new OutOfRangeException(y, 0, 1); } final double x2 = x * x; final double x3 = x2 * x; final double[] pX = {1, x, x2, x3}; final double y2 = y * y; final double y3 = y2 * y; final double[] pY = {1, y, y2, y3}; return apply(pX, pY, a); } /** * Compute the value of the bicubic polynomial. * * @param pX Powers of the x-coordinate. * @param pY Powers of the y-coordinate. * @param coeff Spline coefficients. * @return the interpolated value. */ private double apply(double[] pX, double[] pY, double[][] coeff) { double result = 0; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { result += coeff[i][j] * pX[i] * pY[j]; } } return result; } /** * @return the partial derivative wrt {@code x}. */ public BivariateFunction partialDerivativeX() { if (partialDerivativeX == null) { computePartialDerivatives(); } return partialDerivativeX; } /** * @return the partial derivative wrt {@code y}. */ public BivariateFunction partialDerivativeY() { if (partialDerivativeY == null) { computePartialDerivatives(); } return partialDerivativeY; } /** * @return the second partial derivative wrt {@code x}. */ public BivariateFunction partialDerivativeXX() { if (partialDerivativeXX == null) { computePartialDerivatives(); } return partialDerivativeXX; } /** * @return the second partial derivative wrt {@code y}. */ public BivariateFunction partialDerivativeYY() { if (partialDerivativeYY == null) { computePartialDerivatives(); } return partialDerivativeYY; } /** * @return the second partial cross-derivative. */ public BivariateFunction partialDerivativeXY() { if (partialDerivativeXY == null) { computePartialDerivatives(); } return partialDerivativeXY; } /** * Compute all partial derivatives functions. */ private void computePartialDerivatives() { final double[][] aX = new double[N][N]; final double[][] aY = new double[N][N]; final double[][] aXX = new double[N][N]; final double[][] aYY = new double[N][N]; final double[][] aXY = new double[N][N]; for (int i = 0; i < N; i++) { for (int j = 0; j < N; j++) { final double c = a[i][j]; aX[i][j] = i * c; aY[i][j] = j * c; aXX[i][j] = (i - 1) * aX[i][j]; aYY[i][j] = (j - 1) * aY[i][j]; aXY[i][j] = j * aX[i][j]; } } partialDerivativeX = new BivariateFunction() { public double value(double x, double y) { final double x2 = x * x; final double[] pX = {0, 1, x, x2}; final double y2 = y * y; final double y3 = y2 * y; final double[] pY = {1, y, y2, y3}; return apply(pX, pY, aX); } }; partialDerivativeY = new BivariateFunction() { public double value(double x, double y) { final double x2 = x * x; final double x3 = x2 * x; final double[] pX = {1, x, x2, x3}; final double y2 = y * y; final double[] pY = {0, 1, y, y2}; return apply(pX, pY, aY); } }; partialDerivativeXX = new BivariateFunction() { public double value(double x, double y) { final double[] pX = {0, 0, 1, x}; final double y2 = y * y; final double y3 = y2 * y; final double[] pY = {1, y, y2, y3}; return apply(pX, pY, aXX); } }; partialDerivativeYY = new BivariateFunction() { public double value(double x, double y) { final double x2 = x * x; final double x3 = x2 * x; final double[] pX = {1, x, x2, x3}; final double[] pY = {0, 0, 1, y}; return apply(pX, pY, aYY); } }; partialDerivativeXY = new BivariateFunction() { public double value(double x, double y) { final double x2 = x * x; final double[] pX = {0, 1, x, x2}; final double y2 = y * y; final double[] pY = {0, 1, y, y2}; return apply(pX, pY, aXY); } }; } }
59989e1bda09267b83a8425ece8ae08a25639b09
ef0c1514e9af6de3ba4a20e0d01de7cc3a915188
/sdk/powerbidedicated/azure-resourcemanager-powerbidedicated/src/main/java/com/azure/resourcemanager/powerbidedicated/implementation/PowerBIDedicatedImpl.java
bf62467db5b3f49216671ce341bf14ab8fc807c1
[ "LicenseRef-scancode-generic-cla", "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later", "CC0-1.0", "BSD-3-Clause", "UPL-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
permissive
Azure/azure-sdk-for-java
0902d584b42d3654b4ce65b1dad8409f18ddf4bc
789bdc6c065dc44ce9b8b630e2f2e5896b2a7616
refs/heads/main
2023-09-04T09:36:35.821969
2023-09-02T01:53:56
2023-09-02T01:53:56
2,928,948
2,027
2,084
MIT
2023-09-14T21:37:15
2011-12-06T23:33:56
Java
UTF-8
Java
false
false
11,346
java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.powerbidedicated.implementation; import com.azure.core.annotation.ServiceClient; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpResponse; import com.azure.core.http.rest.Response; import com.azure.core.management.AzureEnvironment; import com.azure.core.management.exception.ManagementError; import com.azure.core.management.exception.ManagementException; import com.azure.core.management.polling.PollResult; import com.azure.core.management.polling.PollerFactory; import com.azure.core.util.Context; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.AsyncPollResponse; import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; import com.azure.resourcemanager.powerbidedicated.fluent.AutoScaleVCoresClient; import com.azure.resourcemanager.powerbidedicated.fluent.CapacitiesClient; import com.azure.resourcemanager.powerbidedicated.fluent.OperationsClient; import com.azure.resourcemanager.powerbidedicated.fluent.PowerBIDedicated; import java.io.IOException; import java.lang.reflect.Type; import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.time.Duration; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; /** Initializes a new instance of the PowerBIDedicatedImpl type. */ @ServiceClient(builder = PowerBIDedicatedBuilder.class) public final class PowerBIDedicatedImpl implements PowerBIDedicated { /** * A unique identifier for a Microsoft Azure subscription. The subscription ID forms part of the URI for every * service call. */ private final String subscriptionId; /** * Gets A unique identifier for a Microsoft Azure subscription. The subscription ID forms part of the URI for every * service call. * * @return the subscriptionId value. */ public String getSubscriptionId() { return this.subscriptionId; } /** server parameter. */ private final String endpoint; /** * Gets server parameter. * * @return the endpoint value. */ public String getEndpoint() { return this.endpoint; } /** Api Version. */ private final String apiVersion; /** * Gets Api Version. * * @return the apiVersion value. */ public String getApiVersion() { return this.apiVersion; } /** The HTTP pipeline to send requests through. */ private final HttpPipeline httpPipeline; /** * Gets The HTTP pipeline to send requests through. * * @return the httpPipeline value. */ public HttpPipeline getHttpPipeline() { return this.httpPipeline; } /** The serializer to serialize an object into a string. */ private final SerializerAdapter serializerAdapter; /** * Gets The serializer to serialize an object into a string. * * @return the serializerAdapter value. */ SerializerAdapter getSerializerAdapter() { return this.serializerAdapter; } /** The default poll interval for long-running operation. */ private final Duration defaultPollInterval; /** * Gets The default poll interval for long-running operation. * * @return the defaultPollInterval value. */ public Duration getDefaultPollInterval() { return this.defaultPollInterval; } /** The CapacitiesClient object to access its operations. */ private final CapacitiesClient capacities; /** * Gets the CapacitiesClient object to access its operations. * * @return the CapacitiesClient object. */ public CapacitiesClient getCapacities() { return this.capacities; } /** The OperationsClient object to access its operations. */ private final OperationsClient operations; /** * Gets the OperationsClient object to access its operations. * * @return the OperationsClient object. */ public OperationsClient getOperations() { return this.operations; } /** The AutoScaleVCoresClient object to access its operations. */ private final AutoScaleVCoresClient autoScaleVCores; /** * Gets the AutoScaleVCoresClient object to access its operations. * * @return the AutoScaleVCoresClient object. */ public AutoScaleVCoresClient getAutoScaleVCores() { return this.autoScaleVCores; } /** * Initializes an instance of PowerBIDedicated client. * * @param httpPipeline The HTTP pipeline to send requests through. * @param serializerAdapter The serializer to serialize an object into a string. * @param defaultPollInterval The default poll interval for long-running operation. * @param environment The Azure environment. * @param subscriptionId A unique identifier for a Microsoft Azure subscription. The subscription ID forms part of * the URI for every service call. * @param endpoint server parameter. */ PowerBIDedicatedImpl( HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, AzureEnvironment environment, String subscriptionId, String endpoint) { this.httpPipeline = httpPipeline; this.serializerAdapter = serializerAdapter; this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; this.apiVersion = "2021-01-01"; this.capacities = new CapacitiesClientImpl(this); this.operations = new OperationsClientImpl(this); this.autoScaleVCores = new AutoScaleVCoresClientImpl(this); } /** * Gets default client context. * * @return the default client context. */ public Context getContext() { return Context.NONE; } /** * Merges default client context with provided context. * * @param context the context to be merged with default client context. * @return the merged context. */ public Context mergeContext(Context context) { return CoreUtils.mergeContexts(this.getContext(), context); } /** * Gets long running operation result. * * @param activationResponse the response of activation operation. * @param httpPipeline the http pipeline. * @param pollResultType type of poll result. * @param finalResultType type of final result. * @param context the context shared by all requests. * @param <T> type of poll result. * @param <U> type of final result. * @return poller flux for poll result and final result. */ public <T, U> PollerFlux<PollResult<T>, U> getLroResult( Mono<Response<Flux<ByteBuffer>>> activationResponse, HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { return PollerFactory .create( serializerAdapter, httpPipeline, pollResultType, finalResultType, defaultPollInterval, activationResponse, context); } /** * Gets the final result, or an error, based on last async poll response. * * @param response the last async poll response. * @param <T> type of poll result. * @param <U> type of final result. * @return the final result, or an error. */ public <T, U> Mono<U> getLroFinalResultOrError(AsyncPollResponse<PollResult<T>, U> response) { if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { String errorMessage; ManagementError managementError = null; HttpResponse errorResponse = null; PollResult.Error lroError = response.getValue().getError(); if (lroError != null) { errorResponse = new HttpResponseImpl( lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); errorMessage = response.getValue().getError().getMessage(); String errorBody = response.getValue().getError().getResponseBody(); if (errorBody != null) { // try to deserialize error body to ManagementError try { managementError = this .getSerializerAdapter() .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); if (managementError.getCode() == null || managementError.getMessage() == null) { managementError = null; } } catch (IOException | RuntimeException ioe) { LOGGER.logThrowableAsWarning(ioe); } } } else { // fallback to default error message errorMessage = "Long running operation failed."; } if (managementError == null) { // fallback to default ManagementError managementError = new ManagementError(response.getStatus().toString(), errorMessage); } return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); } else { return response.getFinalResult(); } } private static final class HttpResponseImpl extends HttpResponse { private final int statusCode; private final byte[] responseBody; private final HttpHeaders httpHeaders; HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { super(null); this.statusCode = statusCode; this.httpHeaders = httpHeaders; this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); } public int getStatusCode() { return statusCode; } public String getHeaderValue(String s) { return httpHeaders.getValue(s); } public HttpHeaders getHeaders() { return httpHeaders; } public Flux<ByteBuffer> getBody() { return Flux.just(ByteBuffer.wrap(responseBody)); } public Mono<byte[]> getBodyAsByteArray() { return Mono.just(responseBody); } public Mono<String> getBodyAsString() { return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); } public Mono<String> getBodyAsString(Charset charset) { return Mono.just(new String(responseBody, charset)); } } private static final ClientLogger LOGGER = new ClientLogger(PowerBIDedicatedImpl.class); }
2a15560511e6a918ee4e1af015096f912c8691c8
a929c65992be426b5db270b32ea8152e4978cc6a
/src/main/java/Java8/by_Deitel/ch20/Fig20_14_15/BlockingBuffer.java
e6a856903485cc4fb1ae1c441383347376a7c09c
[]
no_license
Evegen55/my_examples
346113effa9f17f7c096996544578a391e7c36c2
838f4f51d35817c1a274bf5f5d67da71a74f03eb
refs/heads/master
2020-05-21T16:30:08.155876
2020-05-03T18:35:28
2020-05-03T18:35:28
65,383,107
1
0
null
null
null
null
UTF-8
Java
false
false
2,143
java
package Java8.by_Deitel.ch20.Fig20_14_15; // Fig. 20.14: BlockingBuffer.java // Creating a synchronized buffer using the ArrayBlockingQueue class. import Java8.by_Deitel.ch20.Fig20_09_13.Buffer; import java.util.concurrent.ArrayBlockingQueue; public class BlockingBuffer implements Buffer { private final ArrayBlockingQueue<Integer> buffer; // shared buffer public BlockingBuffer() { buffer = new ArrayBlockingQueue<Integer>(1); } // place value into buffer public void blockingPut(int value) throws InterruptedException { buffer.put(value); // place value in buffer System.out.printf("%s%2d\t%s%d%n", "Producer writes ", value, "Buffer cells occupied: ", buffer.size()); } // return value from buffer public int blockingGet() throws InterruptedException { int readValue = buffer.take(); // remove value from buffer System.out.printf("%s %2d\t%s%d%n", "Consumer reads ", readValue, "Buffer cells occupied: ", buffer.size()); return readValue; } } // end class BlockingBuffer /************************************************************************** * (C) Copyright 1992-2015 by Deitel & Associates, Inc. and * * Pearson Education, Inc. All Rights Reserved. * * * * DISCLAIMER: The authors and publisher of this book have used their * * best efforts in preparing the book. These efforts include the * * development, research, and testing of the theories and programs * * to determine their effectiveness. The authors and publisher make * * no warranty of any kind, expressed or implied, with regard to these * * programs or to the documentation contained in these books. The authors * * and publisher shall not be liable in any event for incidental or * * consequential damages in connection with, or arising out of, the * * furnishing, performance, or use of these programs. * *************************************************************************/
b730e890c23c78ab07c985357f41e472ed21a4c8
00a43571319424345b1e78b567371b00cb2e0bc1
/app/src/main/java/com/huadin/search/SearchDateDetailedFragment.java
2ee033efd18ac4eae393cced15f0c4913b360975
[]
no_license
huadin/WaringApp
eda6ea23332676c2e14b31586b66ea30526d7077
4680fcaeba0608a9f5f1972915c5f27801e2226b
refs/heads/master
2020-06-12T16:40:37.457433
2017-08-07T12:15:11
2017-08-07T12:15:11
75,793,215
0
0
null
null
null
null
UTF-8
Java
false
false
2,162
java
package com.huadin.search; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.huadin.adapter.SearchDateAdapter; import com.huadin.base.BaseFragment; import com.huadin.database.StopPowerBean; import com.huadin.util.LogUtil; import com.huadin.waringapp.R; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; /** * Created by NCL on 2017/2/27. * 搜索数据详细展示 */ public class SearchDateDetailedFragment extends BaseFragment { @BindView(R.id.top_toolbar) Toolbar mToolbar; @BindView(R.id.search_date_detailed_recycler) RecyclerView mRecyclerView; private static final String KEY_POWER_BEAN = "POWER_BEAN"; public static SearchDateDetailedFragment newInstance(List<StopPowerBean> powerBeanList) { Bundle args = new Bundle(); ArrayList<StopPowerBean> arrayList = new ArrayList<>(); arrayList.clear(); arrayList.addAll(powerBeanList); args.putParcelableArrayList(KEY_POWER_BEAN, arrayList); SearchDateDetailedFragment fragment = new SearchDateDetailedFragment(); fragment.setArguments(args); return fragment; } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = getViewResId(inflater, container, R.layout.search_date_detailed_fragment_layout); ButterKnife.bind(this, view); initToolbar(mToolbar, R.string.search_date_result, false); initAdapter(); return view; } private void initAdapter() { Bundle args = getArguments(); List<StopPowerBean> beanList = args.getParcelableArrayList(KEY_POWER_BEAN); SearchDateAdapter adapter = new SearchDateAdapter(mContext, beanList, R.layout.search_date_adapter_item); mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext)); mRecyclerView.setAdapter(adapter); } }
a66a80137ea647f294b8e71c63519cb7561f68a6
e5f5e9297e693da16894d135ef1c85a5a9eb54b6
/java/paper-parent/paper-system/src/main/java/com/qiruipeng/sys/dao/SystemMapper.java
844fd28acd59131bd3ada61b8639723be1f61311
[]
no_license
ruoshui1748/daypaper
3e51507264713f57092112e073f1e584a0ba65e1
00ec854d913e6b8016cc1f0aae1364212f4e5c65
refs/heads/master
2022-12-17T23:30:41.996528
2020-09-11T11:36:58
2020-09-11T11:36:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
223
java
package com.qiruipeng.sys.dao; import com.qiruipeng.sys.pojo.TextSet; import tk.mybatis.mapper.common.Mapper; /** * 数据库System * @author Administrator */ public interface SystemMapper extends Mapper<TextSet> { }
2a40f3437e7ab5be11ab72b962008f81a0e61f49
5fb61527fd17780e8c8ef8275b5b783d71853903
/load-test-framework/src/main/java/com/google/api/gax/grpc/LoadTestGrpcChannelProvider.java
c737f83f259776a5a9715080eee54943b60dc929
[ "Apache-2.0" ]
permissive
iagoquirino/pubsub
f2f8d4f0dad6e296b12214b432ca3ea056684974
f5ff779cf44439b98f25312a4452c2c85ecc3cb7
refs/heads/master
2021-09-13T14:46:01.319206
2018-05-01T11:31:40
2018-05-01T11:31:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,283
java
package com.google.api.gax.grpc; import java.io.IOException; import java.util.Map; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.threeten.bp.Duration; import com.google.api.core.BetaApi; import com.google.api.core.InternalExtensionOnly; import com.google.api.gax.core.ExecutorProvider; import com.google.api.gax.core.FixedExecutorProvider; import com.google.api.gax.rpc.FixedHeaderProvider; import com.google.api.gax.rpc.HeaderProvider; import com.google.api.gax.rpc.TransportChannel; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; import javax.annotation.Nullable; /** * LoadTestGrpcChannelProvider is a TransportChannelProvider which constructs a gRPC ManagedChannel * with a number of configured inputs every time getChannel(...) is called. These inputs include a * port, a service address, and credentials. * * <p>The credentials can either be supplied directly (by providing a FixedCredentialsProvider to * Builder.setCredentialsProvider()) or acquired implicitly from Application Default Credentials (by * providing a GoogleCredentialsProvider to Builder.setCredentialsProvider()). * * <p>The client lib header and generator header values are used to form a value that goes into the * http header of requests to the service. * * Using insecure connection. */ @InternalExtensionOnly public final class LoadTestGrpcChannelProvider implements TransportChannelProvider { private final int processorCount; private final ExecutorProvider executorProvider; private final HeaderProvider headerProvider; private final String endpoint; @Nullable private final Integer maxInboundMessageSize; @Nullable private final Duration keepAliveTime; @Nullable private final Duration keepAliveTimeout; @Nullable private final Boolean keepAliveWithoutCalls; @Nullable private final Integer poolSize; private LoadTestGrpcChannelProvider(Builder builder) { this.processorCount = builder.processorCount; this.executorProvider = builder.executorProvider; this.headerProvider = builder.headerProvider; this.endpoint = builder.endpoint; this.maxInboundMessageSize = builder.maxInboundMessageSize; this.keepAliveTime = builder.keepAliveTime; this.keepAliveTimeout = builder.keepAliveTimeout; this.keepAliveWithoutCalls = builder.keepAliveWithoutCalls; this.poolSize = builder.poolSize; } @Override public boolean needsExecutor() { return executorProvider == null; } @Override public TransportChannelProvider withExecutor(ScheduledExecutorService executor) { return toBuilder().setExecutorProvider(FixedExecutorProvider.create(executor)).build(); } @Override @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") public boolean needsHeaders() { return headerProvider == null; } @Override @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") public TransportChannelProvider withHeaders(Map<String, String> headers) { return toBuilder().setHeaderProvider(FixedHeaderProvider.create(headers)).build(); } @Override public String getTransportName() { return GrpcTransportChannel.getGrpcTransportName(); } @Override public boolean needsEndpoint() { return endpoint == null; } @Override public TransportChannelProvider withEndpoint(String endpoint) { validateEndpoint(endpoint); return toBuilder().setEndpoint(endpoint).build(); } @Override @BetaApi("The surface for customizing pool size is not stable yet and may change in the future.") public boolean acceptsPoolSize() { return poolSize == null; } @Override @BetaApi("The surface for customizing pool size is not stable yet and may change in the future.") public TransportChannelProvider withPoolSize(int size) { Preconditions.checkState(acceptsPoolSize(), "pool size already set to %s", poolSize); return toBuilder().setPoolSize(size).build(); } @Override public TransportChannel getTransportChannel() throws IOException { if (needsExecutor()) { throw new IllegalStateException("getTransportChannel() called when needsExecutor() is true"); } else if (needsHeaders()) { throw new IllegalStateException("getTransportChannel() called when needsHeaders() is true"); } else if (needsEndpoint()) { throw new IllegalStateException("getTransportChannel() called when needsEndpoint() is true"); } else { return createChannel(); } } private TransportChannel createChannel() throws IOException { ManagedChannel outerChannel; if (poolSize == null || poolSize == 1) { outerChannel = createSingleChannel(); } else { ImmutableList.Builder<ManagedChannel> channels = ImmutableList.builder(); for (int i = 0; i < poolSize; i++) { channels.add(createSingleChannel()); } outerChannel = new ChannelPool(channels.build()); } return GrpcTransportChannel.create(outerChannel); } private ManagedChannel createSingleChannel() throws IOException { ScheduledExecutorService executor = executorProvider.getExecutor(); GrpcHeaderInterceptor headerInterceptor = new GrpcHeaderInterceptor(headerProvider.getHeaders()); GrpcMetadataHandlerInterceptor metadataHandlerInterceptor = new GrpcMetadataHandlerInterceptor(); int colon = endpoint.indexOf(':'); if (colon < 0) { throw new IllegalStateException("invalid endpoint - should have been validated: " + endpoint); } int port = Integer.parseInt(endpoint.substring(colon + 1)); String serviceAddress = endpoint.substring(0, colon); ManagedChannelBuilder builder = ManagedChannelBuilder.forAddress(serviceAddress, port) .intercept(headerInterceptor) .intercept(metadataHandlerInterceptor) .userAgent(headerInterceptor.getUserAgentHeader()) .usePlaintext(true) .executor(executor); if (maxInboundMessageSize != null) { builder.maxInboundMessageSize(maxInboundMessageSize); } if (keepAliveTime != null) { builder.keepAliveTime(keepAliveTime.toMillis(), TimeUnit.MILLISECONDS); } if (keepAliveTimeout != null) { builder.keepAliveTimeout(keepAliveTimeout.toMillis(), TimeUnit.MILLISECONDS); } if (keepAliveWithoutCalls != null) { builder.keepAliveWithoutCalls(keepAliveWithoutCalls); } return builder.build(); } /** * The endpoint to be used for the channel. */ public String getEndpoint() { return endpoint; } /** * The time without read activity before sending a keepalive ping. */ public Duration getKeepAliveTime() { return keepAliveTime; } /** * The time without read activity after sending a keepalive ping. */ public Duration getKeepAliveTimeout() { return keepAliveTimeout; } /** * Whether keepalive will be performed when there are no outstanding RPCs. */ public Boolean getKeepAliveWithoutCalls() { return keepAliveWithoutCalls; } @Override public boolean shouldAutoClose() { return true; } public Builder toBuilder() { return new Builder(this); } public static Builder newBuilder() { return new Builder(); } public static final class Builder { private int processorCount; private ExecutorProvider executorProvider; private HeaderProvider headerProvider; private String endpoint; @Nullable private Integer maxInboundMessageSize; @Nullable private Duration keepAliveTime; @Nullable private Duration keepAliveTimeout; @Nullable private Boolean keepAliveWithoutCalls; @Nullable private Integer poolSize; private Builder() { processorCount = Runtime.getRuntime().availableProcessors(); } private Builder(LoadTestGrpcChannelProvider provider) { this.processorCount = provider.processorCount; this.executorProvider = provider.executorProvider; this.headerProvider = provider.headerProvider; this.endpoint = provider.endpoint; this.maxInboundMessageSize = provider.maxInboundMessageSize; this.keepAliveTime = provider.keepAliveTime; this.keepAliveTimeout = provider.keepAliveTimeout; this.keepAliveWithoutCalls = provider.keepAliveWithoutCalls; this.poolSize = provider.poolSize; } /** * Sets the number of available CPUs, used internally for testing. */ Builder setProcessorCount(int processorCount) { this.processorCount = processorCount; return this; } /** * Sets the ExecutorProvider for this TransportChannelProvider. * * <p>This is optional; if it is not provided, needsExecutor() will return true, meaning that * an Executor must be provided when getChannel is called on the constructed * TransportChannelProvider instance. Note: GrpcTransportProvider will automatically provide its * own Executor in this circumstance when it calls getChannel. */ public Builder setExecutorProvider(ExecutorProvider executorProvider) { this.executorProvider = executorProvider; return this; } /** * Sets the HeaderProvider for this TransportChannelProvider. * * <p>This is optional; if it is not provided, needsHeaders() will return true, meaning that * headers must be provided when getChannel is called on the constructed * TransportChannelProvider instance. */ public Builder setHeaderProvider(HeaderProvider headerProvider) { this.headerProvider = headerProvider; return this; } /** * Sets the endpoint used to reach the service, eg "localhost:8080". */ public Builder setEndpoint(String endpoint) { validateEndpoint(endpoint); this.endpoint = endpoint; return this; } public String getEndpoint() { return endpoint; } /** * The maximum message size allowed to be received on the channel. */ public Builder setMaxInboundMessageSize(Integer max) { this.maxInboundMessageSize = max; return this; } /** * The maximum message size allowed to be received on the channel. */ public Integer getMaxInboundMessageSize() { return maxInboundMessageSize; } /** * The time without read activity before sending a keepalive ping. */ public Builder setKeepAliveTime(Duration duration) { this.keepAliveTime = duration; return this; } /** * The time without read activity before sending a keepalive ping. */ public Duration getKeepAliveTime() { return keepAliveTime; } /** * The time without read activity after sending a keepalive ping. */ public Builder setKeepAliveTimeout(Duration duration) { this.keepAliveTimeout = duration; return this; } /** * The time without read activity after sending a keepalive ping. */ public Duration getKeepAliveTimeout() { return keepAliveTimeout; } /** * Whether keepalive will be performed when there are no outstanding RPCs. */ public Builder setKeepAliveWithoutCalls(Boolean keepalive) { this.keepAliveWithoutCalls = keepalive; return this; } /** * Whether keepalive will be performed when there are no outstanding RPCs. */ public Boolean getKeepAliveWithoutCalls() { return keepAliveWithoutCalls; } /** * Number of underlying grpc channels to open. Calls will be load balanced round robin across * them. */ public int getPoolSize() { if (poolSize == null) { return 1; } return poolSize; } /** * Number of underlying grpc channels to open. Calls will be load balanced round robin across * them */ public Builder setPoolSize(int poolSize) { Preconditions.checkArgument(poolSize > 0, "Pool size must be positive"); this.poolSize = poolSize; return this; } /** * Sets the number of channels relative to the available CPUs. */ public Builder setChannelsPerCpu(double multiplier) { return setChannelsPerCpu(multiplier, 100); } public Builder setChannelsPerCpu(double multiplier, int maxChannels) { Preconditions.checkArgument(multiplier > 0, "multiplier must be positive"); Preconditions.checkArgument(maxChannels > 0, "maxChannels must be positive"); int channelCount = (int) Math.ceil(processorCount * multiplier); if (channelCount > maxChannels) { channelCount = maxChannels; } return setPoolSize(channelCount); } public LoadTestGrpcChannelProvider build() { return new LoadTestGrpcChannelProvider(this); } } private static void validateEndpoint(String endpoint) { int colon = endpoint.indexOf(':'); if (colon < 0) { throw new IllegalArgumentException( String.format("invalid endpoint, expecting \"<host>:<port>\"")); } Integer.parseInt(endpoint.substring(colon + 1)); } }
84bbcb2b259a8130427c900967dee6129f142e24
5c23a3ba38714437520a0719e8fe0418e367dda3
/src/Lab_12/Main.java
4af4d69ff2a380fd46851700a52e3ed51f271a56
[]
no_license
cristina-cernat/Java_Labs
0014f6fc1938ae06860700de4ebbb641d347673f
f82170912d62f8596e8cd60b6768a42b1efde1d0
refs/heads/master
2023-08-30T05:29:51.433955
2021-11-10T15:30:20
2021-11-10T15:30:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,284
java
package Lab_12; import Lab_2.Factory; import java.net.URL; import java.io.File; import java.lang.reflect.*; import java.net.MalformedURLException; import java.net.URLClassLoader; public class Main { public static void main(String[] args) throws ClassNotFoundException, MalformedURLException, NoSuchMethodException, InvocationTargetException, IllegalAccessException { String path = "D:/0.Uni/Java_Labs/out/production/Java_Labs/Lab_2/Factory.class"; File f = new File(path); URL[] cp = {f.toURI().toURL()}; URLClassLoader urlClass = new URLClassLoader(cp); Class clazz = urlClass.loadClass("Lab_2.Factory"); System.out.println(clazz.getPackage()); Method[] methods = clazz.getMethods(); for (Method m : methods) { System.out.println(m); } System.out.println("Test methods"); // for(Method m : methods) { if (m.isAnnotationPresent(Cris.class)) { Object obj = m.invoke( null); System.out.println(obj); } } // //just for fun Method method = clazz.getDeclaredMethod("Add", int.class, int.class); Object result = method.invoke(null, 1, 2); System.out.println(result); } }
22e34ee5c946be1ada566094a9643ca79370141d
1bc1e1b2a0a540f68c57ef33b40b4194f613849e
/zlt-demo/sso-demo/web-sso/src/main/java/com/sso/demo/controller/ApiController.java
b5b0506676e219e7dab28ddcb112db0facd2814d
[ "Apache-2.0" ]
permissive
cuixiang2015/microservices-platform
a784c7ef60b967c38ce247fa4abf70a953bdf07f
ed890d098e6219f51d5a494e7b2cf7f679a6e3d6
refs/heads/master
2022-05-27T04:45:31.587471
2022-03-08T03:22:59
2022-03-08T03:22:59
219,458,369
1
0
Apache-2.0
2019-11-04T09:00:22
2019-11-04T09:00:22
null
UTF-8
Java
false
false
4,454
java
package com.sso.demo.controller; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; import sun.misc.BASE64Encoder; import javax.servlet.http.HttpServletRequest; import java.io.UnsupportedEncodingException; import java.util.*; /** * @author zlt * @date 2020/3/10 * <p> * Blog: https://zlt2000.gitee.io * Github: https://github.com/zlt2000 */ @Slf4j @RestController public class ApiController { @Value("${zlt.sso.client-id:}") private String clientId; @Value("${zlt.sso.client-secret:}") private String clientSecret; @Value("${zlt.sso.redirect-uri:}") private String redirectUri; @Value("${zlt.sso.access-token-uri:}") private String accessTokenUri; @Value("${zlt.sso.user-info-uri:}") private String userInfoUri; private final static Map<String, Map<String, Object>> localTokenMap = new HashMap<>(); @GetMapping("/token/{code}") public String tokenInfo(@PathVariable String code) throws UnsupportedEncodingException { //获取token Map tokenMap = getAccessToken(code); String accessToken = (String)tokenMap.get("access_token"); //获取用户信息 Map userMap = getUserInfo(accessToken); List<String> roles = getRoles(userMap); Map result = new HashMap(2); String username = (String)userMap.get("username"); result.put("username", username); result.put("roles", roles); localTokenMap.put(accessToken, result); return accessToken; } /** * 获取token */ public Map getAccessToken(String code) throws UnsupportedEncodingException { RestTemplate restTemplate = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); byte[] authorization = (clientId + ":" + clientSecret).getBytes("UTF-8"); BASE64Encoder encoder = new BASE64Encoder(); String base64Auth = encoder.encode(authorization); headers.add("Authorization", "Basic " + base64Auth); MultiValueMap<String, String> param = new LinkedMultiValueMap<>(); param.add("code", code); param.add("grant_type", "authorization_code"); param.add("redirect_uri", redirectUri); param.add("scope", "app"); HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(param, headers); ResponseEntity<Map> response = restTemplate.postForEntity(accessTokenUri, request , Map.class); Map result = response.getBody(); return result; } /** * 获取用户信息 */ public Map getUserInfo(String accessToken) { RestTemplate restTemplate = new RestTemplate(); Map result = restTemplate.getForObject(userInfoUri+"?access_token="+accessToken, Map.class); return (Map)result.get("datas"); } private List<String> getRoles(Map userMap) { List<Map<String, String>> roles = (List<Map<String, String>>)userMap.get("roles"); List<String> result = new ArrayList<>(); if (CollectionUtil.isNotEmpty(roles)) { roles.forEach(e -> { result.add(e.get("code")); }); } return result; } @GetMapping("/user") public Map<String, Object> user(HttpServletRequest request) { String token = request.getParameter("access_token"); return localTokenMap.get(token); } @GetMapping("/logoutNotify") public void logoutNotify(HttpServletRequest request) { String tokens = request.getParameter("tokens"); log.info("=====logoutNotify: " + tokens); if (StrUtil.isNotEmpty(tokens)) { for (String accessToken : tokens.split(",")) { localTokenMap.remove(accessToken); } } } }
d42e7e0342a5943f2fc9247eed846d82d0d1abd3
6a13f10b18e17e6384cc4fa20e98b49bc5723abb
/Mall-host/src/main/java/com/android/juzbao/adapter/MyWalletBankAdapter.java
97dcaa44898d163203b11ad4a4076635a1a61ffd
[]
no_license
gaoyuan117/Mall-Quna
f48a2ade9fb2d3717dfb46e01007684e80bfcd67
1d4fc95ffec7198d1f029b422a2d54a11c933438
refs/heads/master
2021-01-20T04:29:02.430190
2017-04-28T10:17:09
2017-04-28T10:17:09
89,694,910
0
0
null
null
null
null
UTF-8
Java
false
false
1,862
java
package com.android.juzbao.adapter; import java.util.List; import android.content.Context; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.TextView; import com.server.api.model.Bankcard; import com.android.mall.resource.R; import com.android.zcomponent.adapter.CommonAdapter; /** * <p> * Description: 提现银行卡列表项 * </p> * * @ClassName:MyWalletBankAdapter * @author: wei * @date: 2015-11-10 * */ public class MyWalletBankAdapter extends CommonAdapter { private int miSelectPositon; public MyWalletBankAdapter(Context context, List<?> list) { super(context, list); } public int getSelectPosition() { return miSelectPositon; } @Override public View getView(final int position, View convertView, ViewGroup parent) { if (null == convertView) { convertView = layoutInflater.inflate(R.layout.adapter_my_wallet_bank, null); } TextView tvewRedrawBankName = findViewById(convertView, R.id.tvew_redraw_bank_name_show); TextView tvewRedrawBankNum = findViewById(convertView, R.id.tvew_redraw_bank_num_show); TextView tvewRedrawBankCheck = findViewById(convertView, R.id.tvew_redraw_bank_check_show); Bankcard bankcard = (Bankcard) mList.get(position); tvewRedrawBankName.setText(bankcard.bank_title); tvewRedrawBankNum.setText("尾号" + bankcard.card_no.substring(bankcard.card_no.length() - 4, bankcard.card_no.length())); if (miSelectPositon == position) { tvewRedrawBankCheck.setVisibility(View.VISIBLE); } else { tvewRedrawBankCheck.setVisibility(View.GONE); } convertView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { miSelectPositon = position; notifyDataSetChanged(); } }); return convertView; } }
bea9b31ebd0285927e7609620676c1d636d631cd
5a6d731611367773b759c3c65d82007c5fa6231a
/hadaSogetiAgent/build/tooling/java-gen/de/com/aca/hada/agent/samples/HostNetwork.java
8334dcc322de340876f04e7b038990b05a402551
[]
no_license
thadamitzky/acardian_repo
afefd8839d7a7a973041f125f1650d3ab1f8b707
e6ec551e56626f47f1f3801203822fe6d3667f6b
refs/heads/master
2020-05-17T00:22:54.395964
2014-03-25T10:48:02
2014-03-25T10:48:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
19,672
java
package de.com.aca.hada.agent.samples; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.UUID; import javax.annotation.Generated; import com.quest.glue.api.services.TopologyException; import com.quest.glue.api.services.TopologyNode; import com.quest.glue.api.services.UnitService; /** * WARNING: THIS IS GENERATED CODE, DO NOT EDIT * <p/> * This class handles submitting all the data associated with * the HostNetwork topology object. * <p/> * This class was generated using version 5.6.10 (5.6.10-201309231246-312109-302) * of the FglAM developer's kit. * */ @Generated(value = "FglAM Developer's Kit 5.6.10 (5.6.10-201309231246-312109-302)", date = "2014-03-21T13:15:12+0100") public class HostNetwork extends HostComponent { public final static String NODE_NAME = "HostNetwork"; public final UUID NODE_ID = UUID.randomUUID(); private boolean _resetting = false; private List<NetworkInterface> _interfaces; private boolean _replace_interfaces = false; private SampleMetric _utilization; private SampleMetric _packetsSent; private SampleMetric _packetsReceived; private SampleMetric _sendRate; private SampleMetric _receiveRate; private SampleMetric _transferRate; public HostNetwork(Host host) { // Pass super class ID properties up the line super(host); } /** * Resets all <strong>non-identity</strong>fields to null. * Fields that are themselves topology objects are not null'ed out, * but do have their resetNonIdentity() methods called. * */ @Override public void reset() { if (_resetting == true) { return ; } _resetting = true; super.reset(); if (!(_interfaces == null)) { for (TopologyObject list_element: _interfaces) { list_element.reset(); } } _utilization = null; _packetsSent = null; _packetsReceived = null; _sendRate = null; _receiveRate = null; _transferRate = null; _resetting = false; } /** * Adds this topology sample using the provided node. * * @param submitted * Set of objects that have already been submitted * @param currentNode * This node currently being submitted * @param unitService * An instance of the unit service for converting units. * @throws TopologyException * If there are any problems submitting the data for this class. */ @Override protected void addToNodeTree(TopologyNode currentNode, UnitService unitService, Set<UUID> submitted) throws TopologyException { // Mark this object as having been submitted. submitted.add(__getNodeId()); // Add all the properties (included inherited properties) addPropertiesToNodeTree(currentNode, unitService, submitted); } /** * Adds the relevant portions of this topology sample using the provided node. * * @param submitted * Set of objects that have already been submitted * @param currentNode * This node currently being submitted * @param unitService * An instance of the unit service for converting units. * @throws TopologyException * If there are any problems submitting the data for this class. */ @Override protected void addPropertiesToNodeTree(TopologyNode currentNode, UnitService unitService, Set<UUID> submitted) throws TopologyException { super.addPropertiesToNodeTree(currentNode, unitService, submitted); if (!(_interfaces == null)) { for (TopologyObject list_element: _interfaces) { final TopologyNode _node70 = currentNode.createNode("interfaces"); if (__isIdentity("interfaces")) { _node70 .setIsIdentity(true); } if (_replace_interfaces) { _node70 .setReplace(true); } _replace_interfaces = false; if (submitted.contains(list_element.__getNodeId())) { // field already submitted, just set the reference ID _node70 .setRefId(list_element.__getNodeId().toString()); } else { // Not already submitted, send the entire thing _node70 .setTypeHint(list_element.__getNodeName()); _node70 .setId(list_element.__getNodeId().toString()); list_element.addToNodeTree(_node70, unitService, submitted); } } } if (!(_utilization == null)) { final TopologyNode _node71 = currentNode.createNode("utilization"); _utilization.submit(_node71, unitService.getUnits("percent")); } if (!(_packetsSent == null)) { final TopologyNode _node72 = currentNode.createNode("packetsSent"); _packetsSent.submit(_node72, unitService.getUnits("count/second")); } if (!(_packetsReceived == null)) { final TopologyNode _node73 = currentNode.createNode("packetsReceived"); _packetsReceived.submit(_node73, unitService.getUnits("count/second")); } if (!(_sendRate == null)) { final TopologyNode _node74 = currentNode.createNode("sendRate"); _sendRate.submit(_node74, unitService.getUnits("bit/second")); } if (!(_receiveRate == null)) { final TopologyNode _node75 = currentNode.createNode("receiveRate"); _receiveRate.submit(_node75, unitService.getUnits("bit/second")); } if (!(_transferRate == null)) { final TopologyNode _node76 = currentNode.createNode("transferRate"); _transferRate.submit(_node76, unitService.getUnits("bit/second")); } } /** * Determines if the provided property name is an identity property for this * class or any super-classes. * */ @Override protected boolean __isIdentity(String name) { // not an ID field for this class, check super-classes return super.__isIdentity(name); } /** * Returns the unique node ID for this instance of this topology object. * */ @Override protected UUID __getNodeId() { return NODE_ID; } @Override public int hashCode() { return __getNodeId().hashCode(); } @Override public boolean equals(java.lang.Object _obj) { if ((!(_obj == null))&&(_obj instanceof TopologyObject)) { final TopologyObject _otherObject = ((TopologyObject) _obj); return __getNodeId().equals(_otherObject.__getNodeId()); } else { return false; } } /** * Submits this topology sample using the provided submitter * * @throws Exception * If there are any problems submitting the data for this class.If there are any problems submitting the data for this class. */ public void submit(com.quest.glue.api.services.TopologyDataSubmissionService3 .TopologySubmitter3 submitter, UnitService unitService, long frequency, long timestamp) throws TopologyException { submitter.setTopologyFormat("5.5.5.1"); final TopologyNode node = submitter.createTopLevelNode("__top_of_tree__", frequency); final TopologyNode _obj_root_node = node.createNode(__getNodeName()); _obj_root_node.setId(__getNodeId().toString()); final Set<UUID> submitted = new HashSet<UUID>(); addToNodeTree(_obj_root_node, unitService, submitted); submitter.submit(timestamp); } /** * Submits this topology sample as a verified submission * using the provided submitter * * @throws Exception * If there are any problems submitting the data for this class. */ public com.quest.glue.api.services.TopologyDataSubmissionService3 .VerifiedSubmission3 submitVerified(com.quest.glue.api.services.TopologyDataSubmissionService3 .TopologySubmitter3 submitter, UnitService unitService, long frequency, long timestamp) throws TopologyException { submitter.setTopologyFormat("5.5.5.1"); final TopologyNode node = submitter.createTopLevelNode("__top_of_tree__", frequency); final TopologyNode _obj_root_node = node.createNode(__getNodeName()); _obj_root_node.setId(__getNodeId().toString()); final Set<UUID> submitted = new HashSet<UUID>(); addToNodeTree(_obj_root_node, unitService, submitted); return submitter.submitVerified(timestamp); } /** * Gets the actual type name of the topology object * */ @Override protected String __getNodeName() { return NODE_NAME; } /** * Returns the list containing all of the 'interfaces' properties. * */ public List<NetworkInterface> getInterfaces() { if (_interfaces == null) { _interfaces = new ArrayList<NetworkInterface>(3); } return _interfaces; } /** * Sets whether or not the current values for this list will * replace those on the server (true) or be appended to them (false). * Appending the values is the default action. * */ public void setReplaceForInterfaces(boolean _replace) { _replace_interfaces = _replace; } /** * Sets the current value of the 'utilization' property. * */ public void setUtilization(SampleMetric utilization) { _utilization = utilization; } /** * Returns the current value of the utilization property * This will be <code>null</code> if the metric aggregate values have been specified * */ public Double getUtilization() { if (_utilization == null) { return null; } return _utilization.getValue(); } /** * Returns the aggregate values of the utilization property * */ public SampleMetric getUtilizationAggregate() { return _utilization; } /** * Sets the value of the utilization property as a double * */ public void setUtilization(Double value) { if (value == null) { _utilization = null; return ; } _utilization = new SampleMetric(value); } /** * Sets the aggregate values of the utilization property * */ public void setUtilizationAggregate(Double count, Double sum) { _utilization = new SampleMetric(count, sum); } /** * Sets the aggregate values of the utilization property * */ public void setUtilizationAggregate(Double count, Double sum, Double sum_of_squares, Double min, Double max) { _utilization = new SampleMetric(count, sum, sum_of_squares, min, max); } /** * Sets the current value of the 'packetsSent' property. * */ public void setPacketsSent(SampleMetric packetsSent) { _packetsSent = packetsSent; } /** * Returns the current value of the packetsSent property * This will be <code>null</code> if the metric aggregate values have been specified * */ public Double getPacketsSent() { if (_packetsSent == null) { return null; } return _packetsSent.getValue(); } /** * Returns the aggregate values of the packetsSent property * */ public SampleMetric getPacketsSentAggregate() { return _packetsSent; } /** * Sets the value of the packetsSent property as a double * */ public void setPacketsSent(Double value) { if (value == null) { _packetsSent = null; return ; } _packetsSent = new SampleMetric(value); } /** * Sets the aggregate values of the packetsSent property * */ public void setPacketsSentAggregate(Double count, Double sum) { _packetsSent = new SampleMetric(count, sum); } /** * Sets the aggregate values of the packetsSent property * */ public void setPacketsSentAggregate(Double count, Double sum, Double sum_of_squares, Double min, Double max) { _packetsSent = new SampleMetric(count, sum, sum_of_squares, min, max); } /** * Sets the current value of the 'packetsReceived' property. * */ public void setPacketsReceived(SampleMetric packetsReceived) { _packetsReceived = packetsReceived; } /** * Returns the current value of the packetsReceived property * This will be <code>null</code> if the metric aggregate values have been specified * */ public Double getPacketsReceived() { if (_packetsReceived == null) { return null; } return _packetsReceived.getValue(); } /** * Returns the aggregate values of the packetsReceived property * */ public SampleMetric getPacketsReceivedAggregate() { return _packetsReceived; } /** * Sets the value of the packetsReceived property as a double * */ public void setPacketsReceived(Double value) { if (value == null) { _packetsReceived = null; return ; } _packetsReceived = new SampleMetric(value); } /** * Sets the aggregate values of the packetsReceived property * */ public void setPacketsReceivedAggregate(Double count, Double sum) { _packetsReceived = new SampleMetric(count, sum); } /** * Sets the aggregate values of the packetsReceived property * */ public void setPacketsReceivedAggregate(Double count, Double sum, Double sum_of_squares, Double min, Double max) { _packetsReceived = new SampleMetric(count, sum, sum_of_squares, min, max); } /** * Sets the current value of the 'sendRate' property. * */ public void setSendRate(SampleMetric sendRate) { _sendRate = sendRate; } /** * Returns the current value of the sendRate property * This will be <code>null</code> if the metric aggregate values have been specified * */ public Double getSendRate() { if (_sendRate == null) { return null; } return _sendRate.getValue(); } /** * Returns the aggregate values of the sendRate property * */ public SampleMetric getSendRateAggregate() { return _sendRate; } /** * Sets the value of the sendRate property as a double * */ public void setSendRate(Double value) { if (value == null) { _sendRate = null; return ; } _sendRate = new SampleMetric(value); } /** * Sets the aggregate values of the sendRate property * */ public void setSendRateAggregate(Double count, Double sum) { _sendRate = new SampleMetric(count, sum); } /** * Sets the aggregate values of the sendRate property * */ public void setSendRateAggregate(Double count, Double sum, Double sum_of_squares, Double min, Double max) { _sendRate = new SampleMetric(count, sum, sum_of_squares, min, max); } /** * Sets the current value of the 'receiveRate' property. * */ public void setReceiveRate(SampleMetric receiveRate) { _receiveRate = receiveRate; } /** * Returns the current value of the receiveRate property * This will be <code>null</code> if the metric aggregate values have been specified * */ public Double getReceiveRate() { if (_receiveRate == null) { return null; } return _receiveRate.getValue(); } /** * Returns the aggregate values of the receiveRate property * */ public SampleMetric getReceiveRateAggregate() { return _receiveRate; } /** * Sets the value of the receiveRate property as a double * */ public void setReceiveRate(Double value) { if (value == null) { _receiveRate = null; return ; } _receiveRate = new SampleMetric(value); } /** * Sets the aggregate values of the receiveRate property * */ public void setReceiveRateAggregate(Double count, Double sum) { _receiveRate = new SampleMetric(count, sum); } /** * Sets the aggregate values of the receiveRate property * */ public void setReceiveRateAggregate(Double count, Double sum, Double sum_of_squares, Double min, Double max) { _receiveRate = new SampleMetric(count, sum, sum_of_squares, min, max); } /** * Sets the current value of the 'transferRate' property. * */ public void setTransferRate(SampleMetric transferRate) { _transferRate = transferRate; } /** * Returns the current value of the transferRate property * This will be <code>null</code> if the metric aggregate values have been specified * */ public Double getTransferRate() { if (_transferRate == null) { return null; } return _transferRate.getValue(); } /** * Returns the aggregate values of the transferRate property * */ public SampleMetric getTransferRateAggregate() { return _transferRate; } /** * Sets the value of the transferRate property as a double * */ public void setTransferRate(Double value) { if (value == null) { _transferRate = null; return ; } _transferRate = new SampleMetric(value); } /** * Sets the aggregate values of the transferRate property * */ public void setTransferRateAggregate(Double count, Double sum) { _transferRate = new SampleMetric(count, sum); } /** * Sets the aggregate values of the transferRate property * */ public void setTransferRateAggregate(Double count, Double sum, Double sum_of_squares, Double min, Double max) { _transferRate = new SampleMetric(count, sum, sum_of_squares, min, max); } @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("["); builder.append("HostNetwork"); builder.append("@"); builder.append(String.valueOf(hashCode())); builder.append(" extends "); builder.append("HostComponent"); builder.append("]"); return builder.toString(); } /** * Returns a clone of this topology object with only the ID fields set. * */ @Override protected java.lang.Object __cloneIdOnly() { return new HostNetwork(getHost()); } }
0dcde3e3bdeadd62cc4b813e0363e35644f547a7
6d83620daa8ef282b48c20b4712f821465523485
/src/Vista.java
8684347f3c9b11ffa70673a59489033b7c517bab
[ "MIT" ]
permissive
aleexis9408/horsesgo
50642bba49e1d0dcedd611cc7f1a09651b5cfbb4
d4d0867a624c76778992703f7ca6581385ab2274
refs/heads/master
2020-09-22T12:17:54.881839
2019-12-01T16:17:41
2019-12-01T16:17:41
225,190,141
1
0
null
null
null
null
UTF-8
Java
false
false
9,877
java
import java.awt.Color; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.Image; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.time.Duration; import java.time.Instant; import java.util.ArrayList; import java.util.HashMap; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JRadioButtonMenuItem; import javax.swing.Timer; import net.miginfocom.swing.MigLayout; public class Vista implements ActionListener, MouseListener { public static final int NIVEL_PRINCIPIANTE = 4; public static final int NIVEL_INTERMEDIO = 6; public static final int NIVEL_AVANZADO = 8; public ImageIcon CABALLO_JUGADOR_IMG; public ImageIcon CABALLO_PC_IMG; public ImageIcon AYUDA_IMG; public ImageIcon DELETE_IMG; public static void main(String[] args) { new Vista().init(); } private JFrame frame; private JPanel pGlobal; private JMenuBar menuBar; private JMenu menuMapa, menuNivel; private JMenuItem menuCargar, menuReiniciar; private ButtonGroup niveles; private JRadioButtonMenuItem radioPrincipiante, radioIntermedio, radioAvanzado; private JPanel pMapa; private HashMap<Point, JLabel> Labels; public static Point CABALLO_JUGADOR; public static Point CABALLO_PC; public static Mapa mp; public static ArrayList<Point> MOVIMIENTOS_JUGADOR_POINT = new ArrayList<>(); public static int NIVEL; public void init() { frame = new JFrame(); frame.setTitle("Horses Go"); frame.setLayout(new MigLayout()); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setPreferredSize(new Dimension(700, 700)); frame.setResizable(false); pGlobal = new JPanel(new MigLayout()); frame.add(pGlobal, "span, width max(100%, 100%) "); /** * creacion de menu * */ menuBar = new JMenuBar(); frame.setJMenuBar(menuBar); menuMapa = new JMenu("Juego"); menuBar.add(menuMapa); menuCargar = new JMenuItem("Cargar Mapa"); menuMapa.add(menuCargar); menuReiniciar = new JMenuItem("Reiniciar Mapa"); menuMapa.add(menuReiniciar); menuNivel = new JMenu("Nivel"); menuBar.add(menuNivel); niveles = new ButtonGroup(); radioPrincipiante = new JRadioButtonMenuItem("Principiante"); radioPrincipiante.setSelected(true); niveles.add(radioPrincipiante); menuNivel.add(radioPrincipiante); radioIntermedio = new JRadioButtonMenuItem("Intermedio"); niveles.add(radioIntermedio); menuNivel.add(radioIntermedio); radioAvanzado = new JRadioButtonMenuItem("Avanzado"); niveles.add(radioAvanzado); menuNivel.add(radioAvanzado); /** * creacion panel mapa * */ pMapa = new JPanel(); pMapa.setLayout(new GridLayout()); pMapa.setVisible(true); pMapa.setPreferredSize(new Dimension(600, 600)); pMapa.setBorder(BorderFactory.createTitledBorder("Mapa")); pGlobal.add(pMapa, "span, width max(80%, 90%)"); /** * acciones listener * */ menuCargar.addActionListener(this); menuReiniciar.addActionListener(this); pMapa.addMouseListener(this); frame.pack(); } public void construirMapa(int[][] mp) { pMapa.removeAll(); pMapa.updateUI(); pMapa.setLayout(new GridLayout(mp.length, mp.length)); resize_imagen(); JLabel lbl; Labels = new HashMap<>(); for (int i = 0; i < mp.length; i++) { for (int j = 0; j < mp.length; j++) { lbl = new JLabel(); lbl.setOpaque(true); lbl.setBackground(i % 2 == 0 ^ j % 2 == 0 ? Color.decode("#C19A6B") : Color.decode("#422918"));//XOR if (mp[i][j] == Mapa.CABALLO_JUGADOR_INT) { lbl.setIcon(CABALLO_JUGADOR_IMG); } if (mp[i][j] == Mapa.CABALLO_PC_INT) { lbl.setIcon(CABALLO_PC_IMG); } if (mp[i][j] == Mapa.DESTRUIDA) { lbl.setIcon(DELETE_IMG); } lbl.setBorder(BorderFactory.createLineBorder(Color.WHITE)); lbl.setHorizontalAlignment(JLabel.CENTER); lbl.addMouseListener(this); Labels.put(new Point(j, i), lbl); pMapa.add(lbl); } } pMapa.updateUI(); } public ImageIcon scalar_imagen(String url) { ImageIcon imgIcoUV = new ImageIcon(this.getClass().getResource(url)); Image image = imgIcoUV.getImage(); Image newimg = image.getScaledInstance(pMapa.getWidth() / NIVEL - 50, pMapa.getWidth() / NIVEL - 50, java.awt.Image.SCALE_SMOOTH); return new ImageIcon(newimg); } public void resize_imagen() { CABALLO_JUGADOR_IMG = scalar_imagen("/img/horseHuman.png"); CABALLO_PC_IMG = scalar_imagen("/img/horsePc.png"); AYUDA_IMG = scalar_imagen("/img/verde.png"); DELETE_IMG = scalar_imagen("/img/delete.png"); } public void LimpiarAyuda() { MOVIMIENTOS_JUGADOR_POINT.parallelStream().map((p) -> Labels.get(p)).forEach((lb) -> { lb.setIcon(null); }); } @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == menuCargar) { int nivel = radioPrincipiante.isSelected() ? 4 : 0; nivel = radioIntermedio.isSelected() ? 6 : nivel; nivel = radioAvanzado.isSelected() ? 8 : nivel; NIVEL = nivel; mp = new Mapa(nivel); construirMapa(mp.getMapa()); new Timer(900, new ActionListener() { Minimax m = new Minimax(NIVEL); @Override public void actionPerformed(ActionEvent ae) { Nodo n = m.desicionMinimax(); mover(CABALLO_PC, n.getPosicionPc(), Labels.get(n.getPosicionPc()), false); ((Timer) ae.getSource()).stop(); } }).start(); } } public void mover(Point actual_posicion, Point nueva_posicion, JLabel nueva_posicion_label, boolean indicador) { JLabel anterior = Labels.get(actual_posicion); anterior.setIcon(DELETE_IMG); nueva_posicion_label.setIcon(indicador ? CABALLO_JUGADOR_IMG : CABALLO_PC_IMG); mp.setMapa(indicador ? CABALLO_JUGADOR : CABALLO_PC, Mapa.DESTRUIDA); if (indicador) { CABALLO_JUGADOR = nueva_posicion; } else { CABALLO_PC = nueva_posicion; } mp.setMapa(indicador ? CABALLO_JUGADOR : CABALLO_PC, indicador ? Mapa.CABALLO_JUGADOR_INT : Mapa.CABALLO_PC_INT); } @Override public void mouseClicked(MouseEvent e) { try { if (e.getSource() == Labels.get(CABALLO_JUGADOR)) { MOVIMIENTOS_JUGADOR_POINT = Nodo.getMovimientosPosibles(CABALLO_JUGADOR, mp); MOVIMIENTOS_JUGADOR_POINT.parallelStream().map((p) -> Labels.get(p)).forEach((lb) -> { lb.setIcon(AYUDA_IMG); }); if (MOVIMIENTOS_JUGADOR_POINT.isEmpty()) { JOptionPane.showMessageDialog(frame, "Maquina Gana"); } } if (!MOVIMIENTOS_JUGADOR_POINT.isEmpty() && e.getSource() != Labels.get(CABALLO_JUGADOR)) { try { Point p = MOVIMIENTOS_JUGADOR_POINT.parallelStream() .filter(x -> e.getSource() == Labels.get(x)) .findFirst() .get(); if (p != null) { LimpiarAyuda(); mover(CABALLO_JUGADOR, p, (JLabel) e.getSource(), true); //movimiento de la maquina.... new Timer(1000, new ActionListener() { Minimax m = new Minimax(NIVEL); @Override public void actionPerformed(ActionEvent ae) { Instant inicio = Instant.now(); Nodo n = m.desicionMinimax(); Instant fin = Instant.now(); System.out.println(Duration.between(inicio, fin).toMillis() + " milisegundos"); mover(CABALLO_PC, n.getPosicionPc(), Labels.get(n.getPosicionPc()), false); ((Timer) ae.getSource()).stop(); } }).start(); } } catch (java.util.NoSuchElementException n) { } } } catch (java.lang.NullPointerException n) { } } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } }
[ "Alexis Rojas@Art" ]
Alexis Rojas@Art
e4bf69c57c745e8f087ce214b8889e34a6e8edb0
3390c8c0b03b44ef66985476cbe32cbe52df87a5
/TapNSell/src/com/convertingoffers/tapnsell/twitter/Twitt_Sharing.java
b3d8479c22a650c3557cf97e4f95376d898a9e00
[]
no_license
pbandroid/TapnSell_New_Android
bccbb3faae6a714d0389d137da979f2a481206d7
1b1a67c53a7cdfbeca0d27a36dfeea33f2b696bd
refs/heads/master
2021-01-25T09:59:53.396110
2015-03-16T13:26:49
2015-03-16T13:26:49
32,327,144
0
0
null
null
null
null
UTF-8
Java
false
false
3,495
java
package com.convertingoffers.tapnsell.twitter; import java.io.File; import com.convertingoffers.tapnsell.twitter.Twitter_Handler.TwDialogListener; import twitter4j.StatusUpdate; import twitter4j.Twitter; import twitter4j.TwitterException; import android.app.Activity; import android.app.ProgressDialog; import android.os.AsyncTask; import android.util.Log; import android.widget.Toast; public class Twitt_Sharing { private final Twitter_Handler mTwitter; private final Activity activity; private String twitt_msg; private File image_path; public Twitt_Sharing(Activity act, String consumer_key, String consumer_secret) { this.activity = act; mTwitter = new Twitter_Handler(activity, consumer_key, consumer_secret); } public void shareToTwitter(String msg, File Image_url) { this.twitt_msg = msg; this.image_path = Image_url; mTwitter.setListener(mTwLoginDialogListener); if (mTwitter.hasAccessToken()) { // this will post data in asyn background thread showTwittDialog(); } else { mTwitter.authorize(); } } private void showTwittDialog() { new PostTwittTask().execute(twitt_msg); } private final TwDialogListener mTwLoginDialogListener = new TwDialogListener() { @Override public void onError(String value) { showToast("Login Failed"); mTwitter.resetAccessToken(); } @Override public void onComplete(String value) { showTwittDialog(); } }; void showToast(final String msg) { activity.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(activity, msg, Toast.LENGTH_SHORT).show(); } }); } class PostTwittTask extends AsyncTask<String, Void, String> { ProgressDialog pDialog; @Override protected void onPreExecute() { pDialog = new ProgressDialog(activity); pDialog.setMessage("Posting Twitt..."); pDialog.setCancelable(false); pDialog.show(); super.onPreExecute(); } @SuppressWarnings("static-access") @Override protected String doInBackground(String... twitt) { try { // mTwitter.updateStatus(twitt[0]); // File imgFile = new File("/sdcard/bluetooth/Baby.jpg"); Share_Pic_Text_Titter(image_path, twitt_msg, mTwitter.twitterObj); return "success"; } catch (Exception e) { if (e.getMessage().toString().contains("duplicate")) { return "Posting Failed because of Duplicate message..."; } e.printStackTrace(); return "Posting Failed!!!"; } } @Override protected void onPostExecute(String result) { if(pDialog!=null){ pDialog.dismiss(); } if (null != result && result.equals("success")) { showToast("Posted Successfully"); } else { showToast(result); } super.onPostExecute(result); } } public void Share_Pic_Text_Titter(File image_path, String message, Twitter twitter) throws Exception { try { StatusUpdate st = new StatusUpdate(message); Log.i("File : ", ""+image_path); if(image_path.exists()) { st.setMedia(image_path); } twitter.updateStatus(st); /* * Toast.makeText(activity, "Successfully update on Twitter...!", * Toast.LENGTH_SHORT).show(); */ } catch (TwitterException e) { // Log.d("TAG", "Pic Upload error" + e.getErrorMessage()); // Toast.makeText(activity, "Ooopss..!!! Failed to update on Twitter.", Toast.LENGTH_SHORT).show(); throw e; } } public void Authorize_UserDetail() { } }
8dc56a944d1cf45f1b73c7a2b77e3298cf5a1b88
ab7716b69267cadd999a5a143d9c82a20b9e9c81
/src/GFG_practice/kadanes.java
3278300a0e36e8375bd472753a0fc382438ff1b0
[]
no_license
Shinimani/CompC
bf8735a01fee98fadf9ceb9a7d7ace8109e76137
daeabe914bf94f8555c3826c6235fb39dfb5b49e
refs/heads/master
2021-07-05T01:50:31.232948
2020-09-20T15:46:48
2020-09-20T15:46:48
179,996,758
0
0
null
null
null
null
UTF-8
Java
false
false
827
java
package GFG_practice; public class kadanes { public static void main(String[] args) throws Exception { FastScanner f = new FastScanner(); int T = f.nextInt(); while (T-- > 0) { int N = f.nextInt(); int[] a = f.nextIntArray(N); int max_till_here=0; int max_overall=0; int max_num = a[0]; for (int i = 0; i < N; i++) { max_till_here += a[i]; if (max_till_here<0) max_till_here=0; if (max_overall<max_till_here) max_overall=max_till_here; if(max_num<a[i]) max_num=a[i]; } if (max_num<0) System.out.println(max_num); else System.out.println(max_overall); } } }
49a036fb2563b81ce90d97ecc91b1a6cbf88082f
c7ef73822c391fa531b71a2d4118a30a598d084c
/spring-petclinic-vets-service/src/main/java/org/springframework/samples/petclinic/vets/model/Specialty.java
2e29937427be5bd69c44abcd65e3d98d618edc62
[ "Apache-2.0" ]
permissive
BarisBaB/petclinic-microservices
16137486cc7442ee89023e854e37e610cfbd3d3d
3c825d7c6e697be7d10d54a10c0d690726f33fe0
refs/heads/dev
2023-02-14T14:01:38.650201
2020-12-27T16:34:11
2020-12-27T16:34:11
322,099,210
0
0
NOASSERTION
2020-12-27T13:54:28
2020-12-16T20:52:54
Java
UTF-8
Java
false
false
1,516
java
/* * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.samples.petclinic.vets.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; /** * Models a {@link Vet Vet's} specialty (for example, dentistry). * * @author Juergen Hoeller */ @Entity @Table(name = "specialties") public class Specialty { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; @Column(name = "name") private String name; public Integer getId() { return id; } public void setId(final Integer id) { this.id = id; } public String getName() { return name; } public void setName(final String name) { this.name = name; } }
e72ddf7bd25a58ab7e964b2bd3910b846d9055fd
66ed0f3998a8b94d89aed48abe907405f01f26a7
/ms-tmdp/src/main/java/com/zhuanjingkj/stpbe/tmdp/dto/ks/KsSvsKsvtitfDTO.java
e81f56b630700339420b7ab68ec0c4182a362cce
[]
no_license
shell22/stpbe
a47f337782ba7a2613e693b24d7c0b225f5af8e2
c8ea6b80e714e638e36f61a271dc1fc7c3079761
refs/heads/master
2023-02-24T01:15:28.578592
2021-01-28T06:36:42
2021-01-28T06:36:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
678
java
package com.zhuanjingkj.stpbe.tmdp.dto.ks; import com.alibaba.fastjson.annotation.JSONField; import com.zhuanjingkj.stpbe.data.dto.BaseDTO; public class KsSvsKsvtitfDTO extends BaseDTO { @JSONField(name = "name") private String name; @JSONField(name = "count") private long count; public KsSvsKsvtitfDTO(String name, long count) { this.name = name; this.count = count; } public String getName() { return name; } public void setName(String name) { this.name = name; } public long getCount() { return count; } public void setCount(long count) { this.count = count; } }
83a13b69100abee5feb24676d688ed7ba284311f
ed5159d056e98d6715357d0d14a9b3f20b764f89
/test/irvine/oeis/a150/A150565Test.java
c4bdcb73094ef095329ecd12f5b6120e4c2f98e4
[]
no_license
flywind2/joeis
c5753169cf562939b04dd246f8a2958e97f74558
e5efd6971a0062ac99f4fae21a7c78c9f9e74fea
refs/heads/master
2020-09-13T18:34:35.080552
2019-11-19T05:40:55
2019-11-19T05:40:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
256
java
package irvine.oeis.a150; import irvine.oeis.AbstractSequenceTest; /** * Tests the corresponding class. * @author Sean A. Irvine */ public class A150565Test extends AbstractSequenceTest { @Override protected int maxTerms() { return 10; } }
ed214a15270b25502dee68a28cd7f0a618d16f2e
e2e1afc468f4a5792ae28cc34b97d51e1ec93e19
/src/au/com/mineauz/PlayerSpy/LogTasks/IntegrityCheckTask.java
d0a8be678c0f4bafa9c21ab2907077e84289558a
[]
no_license
Schmoller/PlayerSpy
edbb671176fabdaacf3131e956edeb88f4b13bc7
01ef9d547fd6d55976589030fc4b573b6f461e30
refs/heads/master
2021-01-18T23:08:03.233132
2013-08-11T00:46:22
2013-08-11T00:46:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,446
java
package au.com.mineauz.PlayerSpy.LogTasks; import java.io.File; import java.io.FileFilter; import java.util.ArrayList; import java.util.HashMap; import au.com.mineauz.PlayerSpy.RecordList; import au.com.mineauz.PlayerSpy.tracdata.LogFile; import au.com.mineauz.PlayerSpy.tracdata.LogFileRegistry; import au.com.mineauz.PlayerSpy.tracdata.SessionEntry; public class IntegrityCheckTask extends Task<IntegrityStats> { //private boolean mCleanErrors; public IntegrityCheckTask(boolean cleanErrors) { //mCleanErrors = cleanErrors; } @Override public IntegrityStats call() throws Exception { File[] files = LogFileRegistry.getLogFileDirectory().listFiles(new FileFilter() { @Override public boolean accept( File file ) { return file.getName().endsWith(".trackdata"); } }); int totalSessions = 0; int totalCorruptSessions = 0; ArrayList<String> corruptLogs = new ArrayList<String>(); ArrayList<String> allLogs = new ArrayList<String>(); HashMap<String, Integer> sessions = new HashMap<String, Integer>(); HashMap<String, Integer> corruptSessions = new HashMap<String, Integer>(); // Check each file for corrupt sessions for(File file : files) { LogFile log = new LogFile(); allLogs.add(file.getName()); if(!log.load(file.getAbsolutePath())) { corruptLogs.add(file.getName()); continue; } sessions.put(file.getName(), 0); corruptSessions.put(file.getName(), 0); for(SessionEntry session : log.getSessions()) { totalSessions++; RecordList loaded = log.loadSession(session); if(loaded != null && loaded.size() >= session.RecordCount) sessions.put(file.getName(), sessions.get(file.getName()) + 1); else { corruptSessions.put(file.getName(), corruptSessions.get(file.getName()) + 1); sessions.put(file.getName(), sessions.get(file.getName()) + 1); totalCorruptSessions++; } } log.close(true); } IntegrityStats stats = new IntegrityStats(); stats.mAllLogs = allLogs; stats.mCorruptLogs = corruptLogs; stats.mCorruptSessions = corruptSessions; stats.mSessions = sessions; stats.mTotalCorruptSessions = totalCorruptSessions; stats.mTotalSessions = totalSessions; return stats; } @Override public int getTaskTargetId() { return -1; } @Override public au.com.mineauz.PlayerSpy.LogTasks.Task.Priority getTaskPriority() { return Priority.Low; } }
3f07577c8811bf11a30b5d695096ff26da97720c
98793a13592a0a30aa70197baa8191658954195f
/src/java/socialite/tables/Tuple_int_int_double.java
38ee9086f30123946c89e3d4ffe82bb759bacce8
[]
no_license
socialite-lang/socialite
be0d0b6b36fb437d27907114610c897b754e9030
dbd1a5660a891c52770f703e9679466a1289d72f
refs/heads/master
2021-01-18T23:06:09.827311
2016-07-24T01:48:19
2016-07-24T01:48:19
18,694,723
78
16
null
2016-07-26T05:33:11
2014-04-12T02:48:44
Java
UTF-8
Java
false
false
2,874
java
package socialite.tables; import socialite.util.HashCode; import java.io.Externalizable; import java.io.ObjectInput; import java.io.ObjectOutput; import java.io.IOException; import socialite.util.SociaLiteException; public class Tuple_int_int_double extends Tuple implements Externalizable { private static final long serialVersionUID = 1; public int _0; public int _1; public double _2; public Tuple_int_int_double() {} public Tuple_int_int_double(int __0, int __1, double __2) { _0 = __0; _1 = __1; _2 = __2; } public Tuple_int_int_double clone() { return new Tuple_int_int_double(_0, _1, _2); } public int size() { return 3; } public void update(Tuple _t) { if (!(_t instanceof Tuple_int_int_double)) throw new SociaLiteException("Not supported operation"); Tuple_int_int_double t = (Tuple_int_int_double)_t; _0 = t._0; _1 = t._1; _2 = t._2; } public int hashCode() { return HashCode.get(_0)^HashCode.get(_1)^HashCode.get(_2); } public boolean equals(Object o) { if (!(o instanceof Tuple)) return false; Tuple _t = (Tuple)o; if (_t.getClass().equals(Tuple_int_int_double.class)) { Tuple_int_int_double t=(Tuple_int_int_double)_t; return (_0==(t._0))&& (_1==(t._1))&& (_2==(t._2)); } return false; } public Object get(int column) { if (column==0) return _0; if (column==1) return _1; if (column==2) return _2; return null; } public int getInt(int column) { if (column==0) return _0; if (column==1) return _1; throw new UnsupportedOperationException(); } public long getLong(int column) { throw new UnsupportedOperationException(); } public float getFloat(int column) { throw new UnsupportedOperationException(); } public double getDouble(int column) { if (column==2) return _2; throw new UnsupportedOperationException(); } public Object getObject(int column) { throw new UnsupportedOperationException(); } public void setInt(int column, int v) { if (column==0) { _0=v; return; } if (column==1) { _1=v; return; } throw new UnsupportedOperationException(); } public void setLong(int column, long v) { throw new UnsupportedOperationException(); } public void setFloat(int column, float v) { throw new UnsupportedOperationException(); } public void setDouble(int column, double v) { if (column==2) { _2=v; return; } throw new UnsupportedOperationException(); } public void setObject(int column, Object v) { throw new UnsupportedOperationException(); } public String toString() { return ""+_0+", "+_1+", "+_2; } @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { _0=in.readInt(); _1=in.readInt(); _2=in.readDouble(); } @Override public void writeExternal(ObjectOutput out) throws IOException { out.writeInt(_0); out.writeInt(_1); out.writeDouble(_2); } }
aff16d7f8f615b0559940c918cc672c0abe30401
64265016adcd80907c89c93a28bce6bd1f3010ce
/src/main/java/cn/gx/modules/act/utils/ActUtils.java
61a6a981281c2d2d4310a92a24581a7ea8e1c777
[]
no_license
shaohui625/bug-sys
0c9e839deb3b94fc9467f1d5508be743785cdc52
a78ee3981168efe6899aa5fa822bd7f91cf52154
refs/heads/master
2020-05-20T23:10:22.312839
2016-05-12T15:07:06
2016-05-12T15:07:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,597
java
/** * Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved. */ package cn.gx.modules.act.utils; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.util.HashMap; import java.util.List; import java.util.Map; import org.activiti.engine.impl.persistence.entity.GroupEntity; import org.activiti.engine.impl.persistence.entity.UserEntity; import com.fasterxml.jackson.annotation.JsonBackReference; import com.fasterxml.jackson.annotation.JsonIgnore; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import cn.gx.common.annotation.FieldName; import cn.gx.common.config.Global; import cn.gx.common.utils.Encodes; import cn.gx.common.utils.ObjectUtils; import cn.gx.common.utils.StringUtils; import cn.gx.modules.act.entity.Act; import cn.gx.modules.sys.entity.Role; import cn.gx.modules.sys.entity.User; /** * 流程工具 * @author ThinkGem * @version 2013-11-03 */ public class ActUtils { // private static Logger logger = LoggerFactory.getLogger(ActUtils.class); /** * 定义流程定义KEY,必须以“PD_”开头 * 组成结构:string[]{"流程标识","业务主表表名"} */ public static final String[] PD_LEAVE = new String[]{"leave", "oa_leave"}; public static final String[] PD_LEAVE_EMAIL = new String[]{"leave-mail", "oa_leave_mail"}; public static final String[] PD_TEST_AUDIT = new String[]{"test_audit", "oa_test_audit"}; public static final String[] PD_BUG_AUDIT = new String[]{"bug-default-process", "bug"}; public static final String FLAG = "yes"; // /** // * 流程定义Map(自动初始化) // */ // private static Map<String, String> procDefMap = new HashMap<String, String>() { // private static final long serialVersionUID = 1L; // { // for (Field field : ActUtils.class.getFields()){ // if(StringUtils.startsWith(field.getName(), "PD_")){ // try{ // String[] ss = (String[])field.get(null); // put(ss[0], ss[1]); // }catch (Exception e) { // logger.debug("load pd error: {}", field.getName()); // } // } // } // } // }; // // /** // * 获取流程执行(办理)URL // * @param procId // * @return // */ // public static String getProcExeUrl(String procId) { // String url = procDefMap.get(StringUtils.split(procId, ":")[0]); // if (StringUtils.isBlank(url)){ // return "404"; // } // return url; // } @SuppressWarnings({ "unused" }) public static Map<String, Object> getMobileEntity(Object entity,String spiltType){ if(spiltType==null){ spiltType="@"; } Map<String, Object> map = Maps.newHashMap(); List<String> field = Lists.newArrayList(); List<String> value = Lists.newArrayList(); List<String> chinesName =Lists.newArrayList(); try{ for (Method m : entity.getClass().getMethods()){ if (m.getAnnotation(JsonIgnore.class) == null && m.getAnnotation(JsonBackReference.class) == null && m.getName().startsWith("get")){ if (m.isAnnotationPresent(FieldName.class)) { Annotation p = m.getAnnotation(FieldName.class); FieldName fieldName=(FieldName) p; chinesName.add(fieldName.value()); }else{ chinesName.add(""); } if (m.getName().equals("getAct")){ Object act = m.invoke(entity, new Object[]{}); Method actMet = act.getClass().getMethod("getTaskId"); map.put("taskId", ObjectUtils.toString(m.invoke(act, new Object[]{}), "")); }else{ field.add(StringUtils.uncapitalize(m.getName().substring(3))); value.add(ObjectUtils.toString(m.invoke(entity, new Object[]{}), "")); } } } }catch (Exception e) { e.printStackTrace(); } map.put("beanTitles", StringUtils.join(field, spiltType)); map.put("beanInfos", StringUtils.join(value, spiltType)); map.put("chineseNames", StringUtils.join(chinesName, spiltType)); return map; } /** * 获取流程表单URL * @param formKey * @param act 表单传递参数 * @return */ public static String getFormUrl(String formKey, Act act){ StringBuilder formUrl = new StringBuilder(); String formServerUrl = Global.getConfig("activiti.form.server.url"); if (StringUtils.isBlank(formServerUrl)){ formUrl.append(Global.getAdminPath()); }else{ formUrl.append(formServerUrl); } formUrl.append(formKey).append(formUrl.indexOf("?") == -1 ? "?" : "&"); formUrl.append("act.taskId=").append(act.getTaskId() != null ? act.getTaskId() : ""); formUrl.append("&act.taskName=").append(act.getTaskName() != null ? Encodes.urlEncode(act.getTaskName()) : ""); formUrl.append("&act.taskDefKey=").append(act.getTaskDefKey() != null ? act.getTaskDefKey() : ""); formUrl.append("&act.procInsId=").append(act.getProcInsId() != null ? act.getProcInsId() : ""); formUrl.append("&act.procDefId=").append(act.getProcDefId() != null ? act.getProcDefId() : ""); formUrl.append("&act.status=").append(act.getStatus() != null ? act.getStatus() : ""); formUrl.append("&id=").append(act.getBusinessId() != null ? act.getBusinessId() : ""); return formUrl.toString(); } /** * 转换流程节点类型为中文说明 * @param type 英文名称 * @return 翻译后的中文名称 */ public static String parseToZhType(String type) { Map<String, String> types = new HashMap<String, String>(); types.put("userTask", "用户任务"); types.put("serviceTask", "系统任务"); types.put("startEvent", "开始节点"); types.put("endEvent", "结束节点"); types.put("exclusiveGateway", "条件判断节点(系统自动根据条件处理)"); types.put("inclusiveGateway", "并行处理任务"); types.put("callActivity", "子流程"); return types.get(type) == null ? type : types.get(type); } public static UserEntity toActivitiUser(User user){ if (user == null){ return null; } UserEntity userEntity = new UserEntity(); userEntity.setId(user.getLoginName()); userEntity.setFirstName(user.getName()); userEntity.setLastName(StringUtils.EMPTY); userEntity.setPassword(user.getPassword()); userEntity.setEmail(user.getEmail()); userEntity.setRevision(1); return userEntity; } public static GroupEntity toActivitiGroup(Role role){ if (role == null){ return null; } GroupEntity groupEntity = new GroupEntity(); groupEntity.setId(role.getEnname()); groupEntity.setName(role.getName()); groupEntity.setType(role.getRoleType()); groupEntity.setRevision(1); return groupEntity; } public static void main(String[] args) { User user = new User(); System.out.println(getMobileEntity(user, "@")); } }
4a88b77f2087c22f6c64f117fc05a86e3340eb1b
5f81e2486d18c627d54399d5f24b21ec80d296a9
/ds_tree.java
a40858d066621c56c64080de3b0171f4bc32fb21
[]
no_license
yogesh-7/Java-Coding-Interview
e5b836b5a649d574cb06791297cc7017f7a447b3
7820b836bee9534bb443d075cc423282496aae9c
refs/heads/master
2023-01-21T00:26:08.681489
2020-12-01T12:27:23
2020-12-01T12:27:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,492
java
import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Queue; public class ds_tree { /* Tree - is a data sctructure to simulate a hierarchical tree structure. - Each node of the tree has a root value and a list of references to other nodes which are called child nodes. - Tree can also be defined as a directed acylic graph which has N nodes and N-1 edges. Binary Tree - is a tree in which each node has at most two children (left and right). Binary Tree Traversal Algorithms: 1. pre-order traversal: root -> left subtree -> right subtree 2. in-order traversal: left subtree -> root -> right subtree 3. post-order traversal: left subtree -> right subtree -> root (deleting nodes: delete left child, right child, only then delete root) - All of them can be implemented recursively and iteratively (stack) 4. level Order Traversal (BFS(queue)): level by level, from left to right Binary Search Tree (BST) - special form of a binary tree, where each value of the node must be greater than or equal to any values in its left subtree but less than ot equal to any values in its right subtree, in addition, both left and right subtrees are also BSTs. - In addition, all elements on the right of the root must be greater than the root and the saem for the left children. 1. USED when you want to store data in order and need several operations, such as search, insertion or deletion, at the same time, a BST might be a good choice. Like a Binary Tree, BST can be traversed using: 1. pre-order 2. in-order: we can create a sorted array 3. post-order 4. level-order BST supports 3 operations: 1. search: 1. return the node if the target value is equal to the value of the node; 2. continue searching in the left subtree if the target value is less than the value of the node; 3. continue searching in the right subtree if the target value is larger than the value of the node. 2. insertion: 1. search the left or right subtrees according to the relation of the value of the node and the value of our target node; 2. repeat STEP 1 until reaching an external node; 3. add the new node as its left or right child depending on the relation of the value of the node and the value of our target node. 3. deletion: 1. If the target node has no child, we can simply remove the node. 2. If the target node has one child, we can use its child to replace itself. 3. If the target node has two children, replace the node with its in-order successor or predecessor node and delete that node. Time Complexity for all: O(h), where h - height of the tree Tree (N-ary) Traversal Algorithms: 1. pre-order: root -> left subtree -> right subtree 2. post-order: left subtree -> right subtree -> root 3. level-order: level by level, from left to right - For each child: traverse the subtree rooted at that child by recursively calling the traversal function instead of traverse the left subtree, than the right subtree */ } class BinaryTree { // For Binary Tree public class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } } // pre-order private ArrayList<Integer> result1 = new ArrayList<>(); public List<Integer> preorderTraversal(TreeNode root) { if (root == null) return result1; result1.add(root.val); preorderTraversal(root.left); preorderTraversal(root.right); return result1; } // in-order private ArrayList<Integer> result2 = new ArrayList<>(); public List<Integer> inorderTraversal(TreeNode root) { if (root == null) return result2; inorderTraversal(root.left); result2.add(root.val); inorderTraversal(root.right); return result2; } // post-order private ArrayList<Integer> result3 = new ArrayList<>(); public List<Integer> postorderTraversal(TreeNode root) { if (root == null) return result3; postorderTraversal(root.left); postorderTraversal(root.right); result3.add(root.val); return result3; } // BFS or level-traversal public List<List<Integer>> levelOrder(TreeNode root) { List<List<Integer>> global = new ArrayList<>(); if (root == null) return global; Queue<TreeNode> queue = new LinkedList(); queue.offer(root); while (!queue.isEmpty()) { List<Integer> local = new ArrayList<>(); int size = queue.size(); for (int i=0; i<size; ++i) { TreeNode curr = queue.peek(); local.add(curr.val); if (curr.left != null) queue.offer(curr.left); if (curr.right != null) queue.offer(curr.right); queue.poll(); } global.add(local); } return global; } } class BST { // BST public class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } } // Search public TreeNode searchBST(TreeNode root, int val) { if (root == null) return null; else if (val > root.val) return searchBST(root.right, val); else if (val < root.val) return searchBST(root.left, val); return root; } // insert public TreeNode insertIntoBST(TreeNode root, int val) { if (root == null) return new TreeNode(val); if (val > root.val) root.right = insertIntoBST(root.right, val); else root.left = insertIntoBST(root.left, val); return root; } // delete public TreeNode deleteNode(TreeNode root, int key) { if (root == null) return null; if (key > root.val) { root.right = deleteNode(root.right, key); } else if (key < root.val) { root.left = deleteNode(root.left, key); } else { if (root.left == null) return root.right; else if (root.right == null) return root.left; TreeNode p = findRightMin(root.right); root.val = p.val; root.right = deleteNode(root.right, p.val); } return root; } private TreeNode findRightMin(TreeNode root) { while (root.left != null) { root = root.left; } return root; } } class Tree { // For N-ary Tree public class Node { public int val; public List<Node> children; public Node() {} public Node(int _val) { val = _val; } public Node(int _val, List<Node> _children) { val = _val; children = _children; } }; }
f910e02a44406e96c5e73816c165356dddcb852b
48cebc701bd7a52ab5f5551777f2d878d036f04c
/src/cn/thread/tpool/ThreadPoolTest.java
31ef6a456fcbcf053df3ec647a31e7c39c951ef9
[]
no_license
75168859/test
5cfd67f516102bd2f3a45869d7fd6c04feb3bbb6
d7d360e972dfcb86d9dd865237bdfc4391c8236c
refs/heads/master
2016-09-01T15:48:27.093245
2015-12-25T04:57:51
2015-12-25T04:57:51
47,178,246
0
0
null
null
null
null
UTF-8
Java
false
false
1,599
java
package cn.thread.tpool; import java.io.File; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public class ThreadPoolTest { public static void main(String[] args) { ThreadPoolExecutor executor = new ThreadPoolExecutor(5, 10, 200, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<Runnable>(5)); String fileurl = "C:\\Users\\liuhuan\\Desktop\\pooltest\\"; for(int i=0;i<2;i++){ MyTask myTask = new MyTask(fileurl+i); executor.execute(myTask); System.out.println("线程池中线程数目:"+executor.getPoolSize()+",队列中等待执行的任务数目:"+ executor.getQueue().size()+",已执行玩别的任务数目:"+executor.getCompletedTaskCount()); } executor.shutdown(); } } class MyTask implements Runnable{ private String fileUrl; public MyTask(String fileUrl){ this.fileUrl = fileUrl; } @Override public void run() { try { // Thread.currentThread().sleep(3000); File[] fileList = getFileList(fileUrl); if(fileList != null){ for (int i = 0; i < fileList.length; i++) { String fileUrl = fileList[i].toString(); System.out.println("fileUrl===" + fileUrl); } } } catch (Exception e) { e.printStackTrace(); } } private static File[] getFileList(String filesUrl) { File file = new File(filesUrl); if(file.exists() && file.isDirectory()){ return file.listFiles(); } return null; } }
461af89255d7ef3d334b6e27c1b5cb1f5b8bb8ad
669033961046d67b45ed7d3f5ea00a97bef7ef60
/Spring Advanced Exam/src/test/java/springadvanced/exam/integrationTest/AdminControllerTests.java
b834d71aa6b74304ac1b5c045d0e531af528d5f9
[]
no_license
soheili/Spring-Advanced-Exam
76b5fe4e6e89c92b7c01d57c0d04d9647bd8667c
e243151573cf08aa0886f854dc300df82f7d9419
refs/heads/master
2023-01-22T05:58:38.144854
2020-12-07T15:36:19
2020-12-07T15:36:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,089
java
package springadvanced.exam.integrationTest; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import springadvanced.exam.category.repository.CategoryRepository; import springadvanced.exam.message.repository.MessageRepository; import springadvanced.exam.product.repository.ProductRepository; import springadvanced.exam.user.repository.UserEntityRepository; import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf; import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; @SpringBootTest @AutoConfigureMockMvc public class AdminControllerTests { @Autowired private MockMvc mockMvc; @Autowired private CategoryRepository categoryRepository; @Autowired private ProductRepository productRepository; @Autowired private UserEntityRepository userEntityRepository; @Autowired private MessageRepository messageRepository; @Test public void should_Return_Admin_Page() throws Exception { mockMvc.perform(MockMvcRequestBuilders .get("/admin") .with((user("Pesho").password("123").roles("USER", "ADMIN", "ROOT_ADMIN"))) .with(csrf()) ) .andExpect(status().isOk()) .andExpect(view().name("admin/admin-panel")) .andExpect(model().attributeExists("users")) .andExpect(model().attributeExists("products")) .andExpect(model().attributeExists("messages")) .andExpect(model().attributeExists("categories")) .andExpect(model().attributeExists("stats")); } }
68195bfa869d385614b682c7f98ec522980213d8
7bc94825dacf6aa90c25260441277baecac1d7a2
/fe/fe-core/src/main/java/org/apache/doris/load/DeleteJob.java
dde3e87d9c02b009cc6eb7024048b109989f9872
[ "Apache-2.0", "PSF-2.0", "bzip2-1.0.6", "BSD-3-Clause", "Zlib", "dtoa", "MIT", "GPL-2.0-only", "LicenseRef-scancode-public-domain" ]
permissive
EmmyMiao87/incubator-doris
2330b55b21d8478365b0feec2a45776b62433fc8
af06adb57fbaf306534971bae8cf11162d714404
refs/heads/master
2022-09-30T16:22:13.074082
2020-12-02T02:13:13
2020-12-02T02:13:13
155,680,801
3
3
Apache-2.0
2018-11-01T07:52:59
2018-11-01T07:52:59
null
UTF-8
Java
false
false
7,038
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.doris.load; import org.apache.doris.catalog.Catalog; import org.apache.doris.catalog.Database; import org.apache.doris.catalog.OlapTable; import org.apache.doris.catalog.Replica; import org.apache.doris.common.Config; import org.apache.doris.common.FeConstants; import org.apache.doris.common.MetaNotFoundException; import org.apache.doris.common.UserException; import org.apache.doris.task.PushTask; import org.apache.doris.transaction.AbstractTxnStateChangeCallback; import org.apache.doris.transaction.TransactionState; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.Collection; import java.util.Map; import java.util.Set; public class DeleteJob extends AbstractTxnStateChangeCallback { private static final Logger LOG = LogManager.getLogger(DeleteJob.class); public enum DeleteState { UN_QUORUM, QUORUM_FINISHED, FINISHED } private DeleteState state; // jobId(listenerId). use in beginTransaction to callback function private long id; // transaction id. private long signature; private String label; private Set<Long> totalTablets; private Set<Long> quorumTablets; private Set<Long> finishedTablets; Map<Long, TabletDeleteInfo> tabletDeleteInfoMap; private Set<PushTask> pushTasks; private DeleteInfo deleteInfo; public DeleteJob(long id, long transactionId, String label, DeleteInfo deleteInfo) { this.id = id; this.signature = transactionId; this.label = label; this.deleteInfo = deleteInfo; totalTablets = Sets.newHashSet(); finishedTablets = Sets.newHashSet(); quorumTablets = Sets.newHashSet(); tabletDeleteInfoMap = Maps.newConcurrentMap(); pushTasks = Sets.newHashSet(); state = DeleteState.UN_QUORUM; } /** * check and update if this job's state is QUORUM_FINISHED or FINISHED * The meaning of state: * QUORUM_FINISHED: For each tablet there are more than half of its replicas have been finished * FINISHED: All replicas of this jobs have finished */ public void checkAndUpdateQuorum() throws MetaNotFoundException { long dbId = deleteInfo.getDbId(); long tableId = deleteInfo.getTableId(); long partitionId = deleteInfo.getPartitionId(); Database db = Catalog.getCurrentCatalog().getDb(dbId); if (db == null) { throw new MetaNotFoundException("can not find database "+ dbId +" when commit delete"); } short replicaNum = -1; db.readLock(); try { OlapTable table = (OlapTable) db.getTable(tableId); if (table == null) { throw new MetaNotFoundException("can not find table "+ tableId +" when commit delete"); } replicaNum = table.getPartitionInfo().getReplicationNum(partitionId); } finally { db.readUnlock(); } short quorumNum = (short) (replicaNum / 2 + 1); for (TabletDeleteInfo tDeleteInfo : getTabletDeleteInfo()) { if (tDeleteInfo.getFinishedReplicas().size() == replicaNum) { finishedTablets.add(tDeleteInfo.getTabletId()); } if (tDeleteInfo.getFinishedReplicas().size() >= quorumNum) { quorumTablets.add(tDeleteInfo.getTabletId()); } } LOG.info("check delete job quorum, transaction id: {}, total tablets: {}, quorum tablets: {},", signature, totalTablets.size(), quorumTablets.size()); if (finishedTablets.containsAll(totalTablets)) { setState(DeleteState.FINISHED); } else if (quorumTablets.containsAll(totalTablets)) { setState(DeleteState.QUORUM_FINISHED); } } public void setState(DeleteState state) { this.state = state; } public DeleteState getState() { return this.state; } public boolean addTablet(long tabletId) { return totalTablets.add(tabletId); } public boolean addPushTask(PushTask pushTask) { return pushTasks.add(pushTask); } public boolean addFinishedReplica(long tabletId, Replica replica) { tabletDeleteInfoMap.putIfAbsent(tabletId, new TabletDeleteInfo(tabletId)); TabletDeleteInfo tDeleteInfo = tabletDeleteInfoMap.get(tabletId); return tDeleteInfo.addFinishedReplica(replica); } public DeleteInfo getDeleteInfo() { return deleteInfo; } public String getLabel() { return this.label; } public Set<PushTask> getPushTasks() { return pushTasks; } @Override public long getId() { return this.id; } @Override public void afterVisible(TransactionState txnState, boolean txnOperated) { if (!txnOperated) { return; } executeFinish(); Catalog.getCurrentCatalog().getEditLog().logFinishDelete(deleteInfo); } @Override public void afterAborted(TransactionState txnState, boolean txnOperated, String txnStatusChangeReason) throws UserException { // just to clean the callback Catalog.getCurrentGlobalTransactionMgr().getCallbackFactory().removeCallback(getId()); } public void executeFinish() { setState(DeleteState.FINISHED); Catalog.getCurrentCatalog().getDeleteHandler().recordFinishedJob(this); Catalog.getCurrentGlobalTransactionMgr().getCallbackFactory().removeCallback(getId()); } public long getTransactionId() { return this.signature; } public Collection<TabletDeleteInfo> getTabletDeleteInfo() { return tabletDeleteInfoMap.values(); } public long getTimeoutMs() { if (FeConstants.runningUnitTest) { // for making unit test run fast return 1000; } // timeout is between 30 seconds to 5 min long timeout = Math.max(totalTablets.size() * Config.tablet_delete_timeout_second * 1000L, 30000L); return Math.min(timeout, Config.load_straggler_wait_second * 1000L); } }
6c7d36a1a7541b13b900e8c6fe5368f0d7e5e6b8
4da62dd0a31b342ecfe5ed5eced41b33e7e9d5df
/MihmandarUi/src/main/java/tech/mihmandar/ui/presentation/common/DashboardNavigator.java
0b67e7f6b5e70a2566b719479484be9bf73ef480
[]
no_license
yimu187/mihmandar
982a4f0f52ec9a99960a5f1d5a29d351cb193b88
66b414144820043860e2b03884531606b26cccda
refs/heads/master
2021-01-12T12:18:35.416348
2017-10-29T21:25:40
2017-10-29T21:25:40
72,423,702
0
0
null
null
null
null
UTF-8
Java
false
false
4,994
java
package tech.mihmandar.ui.presentation.common; import com.vaadin.navigator.Navigator; import com.vaadin.navigator.View; import com.vaadin.navigator.ViewChangeListener; import com.vaadin.navigator.ViewProvider; import com.vaadin.server.Page; import com.vaadin.ui.ComponentContainer; import com.vaadin.ui.UI; import org.vaadin.googleanalytics.tracking.GoogleAnalyticsTracker; import tech.mihmandar.ui.presentation.event.MihmandarEvent; import tech.mihmandar.ui.presentation.view.ViewType; @SuppressWarnings("serial") public class DashboardNavigator extends Navigator { // Provide a Google Analytics tracker id here private static final String TRACKER_ID = null;// "UA-658457-6"; private GoogleAnalyticsTracker tracker; private static final ViewType ERROR_VIEW = ViewType.MIHMANDAR_HOME; private ViewProvider errorViewProvider; public DashboardNavigator(final ComponentContainer container) { super(UI.getCurrent(), container); String host = getUI().getPage().getLocation().getHost(); if (TRACKER_ID != null && host.endsWith("demo.vaadin.com")) { initGATracker(TRACKER_ID); } initViewChangeListener(); initViewProviders(); } private void initGATracker(final String trackerId) { tracker = new GoogleAnalyticsTracker(trackerId, "demo.vaadin.com"); // GoogleAnalyticsTracker is an extension add-on for UI so it is // initialized by calling .extend(UI) tracker.extend(UI.getCurrent()); } private void initViewChangeListener() { addViewChangeListener(new ViewChangeListener() { @Override public boolean beforeViewChange(final ViewChangeEvent event) { // Since there's no conditions in switching between the views // we can always return true. return true; } @Override public void afterViewChange(final ViewChangeEvent event) { ViewType view = ViewType.getByViewName(event .getViewName()); // Appropriate events get fired after the view is changed. MihmandarApplication.get().getMihmandarEventbus().post(new MihmandarEvent.PostViewChangeEvent(view)); int browserWindowWidth = MihmandarApplication.get().getPage().getBrowserWindowWidth(); int browserWindowHeight = MihmandarApplication.get().getPage().getBrowserWindowHeight(); MihmandarApplication.get().getMihmandarEventbus().post(new MihmandarEvent.BrowserResizeEvent(browserWindowHeight, browserWindowWidth)); MihmandarApplication.get().getMihmandarEventbus().post(new MihmandarEvent.CloseOpenWindowsEvent()); if (tracker != null) { // The view change is submitted as a pageview for GA tracker tracker.trackPageview("/dashboard/" + event.getViewName()); } } }); } private void initViewProviders() { // A dedicated view provider is added for each separate view type for (final ViewType viewType : ViewType.values()) { ViewProvider viewProvider = new ClassBasedViewProvider( viewType.getViewName(), viewType.getViewClass()) { // This field caches an already initialized view instance if the // view should be cached (stateful views). private View cachedInstance; @Override public View getView(final String viewName) { View result = null; if (viewType.getViewName().equals(viewName)) { if (viewType.isStateful()) { // Stateful views get lazily instantiated if (cachedInstance == null) { cachedInstance = super.getView(viewType .getViewName()); } result = cachedInstance; } else { // Non-stateful views get instantiated every time // they're navigated to result = super.getView(viewType.getViewName()); } } return result; } }; if (viewType == ERROR_VIEW) { errorViewProvider = viewProvider; } addProvider(viewProvider); } setErrorProvider(new ViewProvider() { @Override public String getViewName(final String viewAndParameters) { return ERROR_VIEW.getViewName(); } @Override public View getView(final String viewName) { return errorViewProvider.getView(ERROR_VIEW.getViewName()); } }); } }
07ac2687df1cd10fdf5ea8181ec417d8eb531fb5
ba0c081803beb856eb39c24b8e2d73d627f13789
/src/main/java/com/heima/domain/ItemsExample.java
f5f4d1b9254cbbee8f6fdaa465228a7ca636c246
[]
no_license
zjjzjj123/ssm_good
4fa9e1ffe99dbea1a62750f2a60c6c38696c02bf
628c0b39af43568256d02c57e546b4ed3b4a0e71
refs/heads/master
2022-12-04T12:52:03.002375
2020-08-16T01:23:21
2020-08-16T01:23:21
287,849,317
0
0
null
null
null
null
UTF-8
Java
false
false
15,423
java
package com.heima.domain; import java.util.ArrayList; import java.util.Date; import java.util.List; public class ItemsExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public ItemsExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andIdIsNull() { addCriterion("id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(Integer value) { addCriterion("id =", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualTo(Integer value) { addCriterion("id <>", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThan(Integer value) { addCriterion("id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(Integer value) { addCriterion("id >=", value, "id"); return (Criteria) this; } public Criteria andIdLessThan(Integer value) { addCriterion("id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(Integer value) { addCriterion("id <=", value, "id"); return (Criteria) this; } public Criteria andIdIn(List<Integer> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<Integer> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(Integer value1, Integer value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(Integer value1, Integer value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andNameIsNull() { addCriterion("name is null"); return (Criteria) this; } public Criteria andNameIsNotNull() { addCriterion("name is not null"); return (Criteria) this; } public Criteria andNameEqualTo(String value) { addCriterion("name =", value, "name"); return (Criteria) this; } public Criteria andNameNotEqualTo(String value) { addCriterion("name <>", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThan(String value) { addCriterion("name >", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThanOrEqualTo(String value) { addCriterion("name >=", value, "name"); return (Criteria) this; } public Criteria andNameLessThan(String value) { addCriterion("name <", value, "name"); return (Criteria) this; } public Criteria andNameLessThanOrEqualTo(String value) { addCriterion("name <=", value, "name"); return (Criteria) this; } public Criteria andNameLike(String value) { addCriterion("name like", value, "name"); return (Criteria) this; } public Criteria andNameNotLike(String value) { addCriterion("name not like", value, "name"); return (Criteria) this; } public Criteria andNameIn(List<String> values) { addCriterion("name in", values, "name"); return (Criteria) this; } public Criteria andNameNotIn(List<String> values) { addCriterion("name not in", values, "name"); return (Criteria) this; } public Criteria andNameBetween(String value1, String value2) { addCriterion("name between", value1, value2, "name"); return (Criteria) this; } public Criteria andNameNotBetween(String value1, String value2) { addCriterion("name not between", value1, value2, "name"); return (Criteria) this; } public Criteria andPriceIsNull() { addCriterion("price is null"); return (Criteria) this; } public Criteria andPriceIsNotNull() { addCriterion("price is not null"); return (Criteria) this; } public Criteria andPriceEqualTo(Float value) { addCriterion("price =", value, "price"); return (Criteria) this; } public Criteria andPriceNotEqualTo(Float value) { addCriterion("price <>", value, "price"); return (Criteria) this; } public Criteria andPriceGreaterThan(Float value) { addCriterion("price >", value, "price"); return (Criteria) this; } public Criteria andPriceGreaterThanOrEqualTo(Float value) { addCriterion("price >=", value, "price"); return (Criteria) this; } public Criteria andPriceLessThan(Float value) { addCriterion("price <", value, "price"); return (Criteria) this; } public Criteria andPriceLessThanOrEqualTo(Float value) { addCriterion("price <=", value, "price"); return (Criteria) this; } public Criteria andPriceIn(List<Float> values) { addCriterion("price in", values, "price"); return (Criteria) this; } public Criteria andPriceNotIn(List<Float> values) { addCriterion("price not in", values, "price"); return (Criteria) this; } public Criteria andPriceBetween(Float value1, Float value2) { addCriterion("price between", value1, value2, "price"); return (Criteria) this; } public Criteria andPriceNotBetween(Float value1, Float value2) { addCriterion("price not between", value1, value2, "price"); return (Criteria) this; } public Criteria andPicIsNull() { addCriterion("pic is null"); return (Criteria) this; } public Criteria andPicIsNotNull() { addCriterion("pic is not null"); return (Criteria) this; } public Criteria andPicEqualTo(String value) { addCriterion("pic =", value, "pic"); return (Criteria) this; } public Criteria andPicNotEqualTo(String value) { addCriterion("pic <>", value, "pic"); return (Criteria) this; } public Criteria andPicGreaterThan(String value) { addCriterion("pic >", value, "pic"); return (Criteria) this; } public Criteria andPicGreaterThanOrEqualTo(String value) { addCriterion("pic >=", value, "pic"); return (Criteria) this; } public Criteria andPicLessThan(String value) { addCriterion("pic <", value, "pic"); return (Criteria) this; } public Criteria andPicLessThanOrEqualTo(String value) { addCriterion("pic <=", value, "pic"); return (Criteria) this; } public Criteria andPicLike(String value) { addCriterion("pic like", value, "pic"); return (Criteria) this; } public Criteria andPicNotLike(String value) { addCriterion("pic not like", value, "pic"); return (Criteria) this; } public Criteria andPicIn(List<String> values) { addCriterion("pic in", values, "pic"); return (Criteria) this; } public Criteria andPicNotIn(List<String> values) { addCriterion("pic not in", values, "pic"); return (Criteria) this; } public Criteria andPicBetween(String value1, String value2) { addCriterion("pic between", value1, value2, "pic"); return (Criteria) this; } public Criteria andPicNotBetween(String value1, String value2) { addCriterion("pic not between", value1, value2, "pic"); return (Criteria) this; } public Criteria andCreatetimeIsNull() { addCriterion("createtime is null"); return (Criteria) this; } public Criteria andCreatetimeIsNotNull() { addCriterion("createtime is not null"); return (Criteria) this; } public Criteria andCreatetimeEqualTo(Date value) { addCriterion("createtime =", value, "createtime"); return (Criteria) this; } public Criteria andCreatetimeNotEqualTo(Date value) { addCriterion("createtime <>", value, "createtime"); return (Criteria) this; } public Criteria andCreatetimeGreaterThan(Date value) { addCriterion("createtime >", value, "createtime"); return (Criteria) this; } public Criteria andCreatetimeGreaterThanOrEqualTo(Date value) { addCriterion("createtime >=", value, "createtime"); return (Criteria) this; } public Criteria andCreatetimeLessThan(Date value) { addCriterion("createtime <", value, "createtime"); return (Criteria) this; } public Criteria andCreatetimeLessThanOrEqualTo(Date value) { addCriterion("createtime <=", value, "createtime"); return (Criteria) this; } public Criteria andCreatetimeIn(List<Date> values) { addCriterion("createtime in", values, "createtime"); return (Criteria) this; } public Criteria andCreatetimeNotIn(List<Date> values) { addCriterion("createtime not in", values, "createtime"); return (Criteria) this; } public Criteria andCreatetimeBetween(Date value1, Date value2) { addCriterion("createtime between", value1, value2, "createtime"); return (Criteria) this; } public Criteria andCreatetimeNotBetween(Date value1, Date value2) { addCriterion("createtime not between", value1, value2, "createtime"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
4745ba41b96fc32015a4a30f508521ace6a07f69
995ef1e0d61d191c7c2b42411a90cc66ac4ae748
/src/main/java/AssignmentInterface.java
77d0606d1b1328e0be4b960bdff6bf1e557b77f3
[]
no_license
AzizOKAY/GITaziz
660972f7eebdf5a3f05fc3de3372477010c4fac0
1e7925c736e7e053026c454b3cd04e5a6c2a5970
refs/heads/master
2021-01-20T10:56:19.280790
2016-04-13T20:20:42
2016-04-13T20:20:42
52,486,781
1
0
null
null
null
null
UTF-8
Java
false
false
507
java
import java.util.Date; /* * 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 jan */ public interface AssignmentInterface { public String getFormat(); public Date getDeadline(); public void aboutAssigment(); public Date getLateDaedLine(); public Course getCourseOfAssignment(); public Teacher getTeacherOfAssignment(); }
[ "jan@jan-K53SD" ]
jan@jan-K53SD
f4ac26275e1ba47f43963180b7f8591fd41df87c
207b9f7862c87ef84e405735a2df44ab0621a94e
/app/src/androidTest/java/com/galactichitchhiker/spacetrader/ExampleInstrumentedTest.java
5b6b1bab13cd2ec9269f3700b7d1f56ee37f834d
[]
no_license
cwelter6/2340g42x
b9be48258ff9ea0fc9724f39bb88a37233e1bce8
70c7639afc3bce2433b64c26b06077bd4f31c2c9
refs/heads/master
2020-04-17T02:15:54.147737
2019-09-13T04:04:45
2019-09-13T04:04:45
166,126,727
0
0
null
2019-04-22T12:32:08
2019-01-16T23:19:46
Java
UTF-8
Java
false
false
752
java
package com.galactichitchhiker.spacetrader; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.galactichitchhiker.spacetrader", appContext.getPackageName()); } }
30cb7c329712f99eb108a9122c040381c5588f16
8aceca80149932bb5371b20cd6d3b4e44942a4ac
/src/Order.java
dd3e1ed4640068f3b5eed5a2ac02b2ad3664e081
[]
no_license
sonu98fietz/Company-Orders
769d3cadf0abbd35abef2f164b2cb79f9780c59d
3cb4ff14f75bccad652e3732972a8662ddb9a1c7
refs/heads/main
2023-09-02T18:25:11.327638
2021-10-29T16:59:27
2021-10-29T16:59:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
355
java
public class Order { private OrderedItem item1 = new OrderedItem(2,Company.item1); private OrderedItem item2 = new OrderedItem(3,Company.item2); private OrderedItem item3 = new OrderedItem(1,Company.item3); private OrderedItem item4 = new OrderedItem(2,Company.item4); OrderedItem[] orderedItems = {item1,item2,item3,item4}; }
7be14ff96e113b366297a487d0013c9cb856312d
548243fc2c091c4ce5ad496a1315c5edd8f222b2
/src/main/java/com/asu/secureBankApp/Response/AccountResponses.java
853191fce1e029ee6c2ce073677058f3f1a40df5
[]
no_license
asgaonkar/secureBankApp
95ceb27d540e7784495994b5c7f27381e4d7d67a
a075a54b4d1661738a9c505c6e38c35491642f76
refs/heads/master
2022-09-23T15:03:12.454718
2020-04-04T02:23:17
2020-04-04T03:13:49
266,044,863
1
0
null
2020-05-22T07:19:01
2020-05-22T07:19:00
null
UTF-8
Java
false
false
332
java
package com.asu.secureBankApp.Response; import java.util.List; import com.asu.secureBankApp.dao.AccountDAO; public class AccountResponses { private List<AccountDAO> accounts; public List<AccountDAO> getAccounts() { return accounts; } public void setAccounts(List<AccountDAO> accounts) { this.accounts = accounts; } }
a37f368a83359b3d39a67b615a8f55a2f849a7c5
cc38822e032b172863b5938a21af4f32a3494806
/app/src/test/java/finance/joypay/com/jopayfinance/ExampleUnitTest.java
88c442d4b21bb39a575cbdf70f05898ffb16bc80
[]
no_license
successprabhu/yuvaa_finance_old
1df8b58b0f1b859b629cbe01d65233af84e4b1c8
0136c1d60530641dacc7ebad3d6792a44d68bc6e
refs/heads/master
2023-05-02T19:32:55.229761
2021-05-19T15:58:44
2021-05-19T15:58:44
368,925,407
0
0
null
null
null
null
UTF-8
Java
false
false
409
java
package finance.joypay.com.jopayfinance; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
4dae9347fb1ee595c9c8330c67917d2a5dfb6b57
d97ded2d5755e0981fb159f1c24c815fd3058465
/journeyman-service/src/main/java/com/xorlev/journeyman/service/api/TripGeom.java
df4739e7579842c093e2b7311a167c9ad980fb13
[]
no_license
Xorlev/journeyman-server
2d060a0efec33085ee499553f43dfc374c69da71
22387037765c2fa37cb10fa3e7f96d17965fecb6
refs/heads/master
2021-01-01T17:17:25.567266
2014-02-07T04:42:59
2014-02-07T04:42:59
16,604,558
5
3
null
null
null
null
UTF-8
Java
false
false
390
java
package com.xorlev.journeyman.service.api; import lombok.Data; import org.postgis.Point; import java.util.Date; /** * 2013-12-17 * * @author Michael Rose <[email protected]> */ @Data public class TripGeom { Double startLatitude; Double endLatitude; Double startLongitude; Double endLongitude; Date tripStart; double sumdist; public TripGeom() {} }
265452b3e1e44527ad9dd8459eccafac299038f0
4deed11e791830f235aad2b84753b6910c0e9aca
/fxgl-samples/src/main/java/sandbox/circlegame/CircleNNType.java
6510afb539815afebd5907df6ee83a2af34b8ab3
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
AlmasB/FXGL
57a9f09754e9a9eef648de91290065fcaac8179d
cb7050038826331b99737db16f1fbc7252c4ca67
refs/heads/dev
2023-07-20T06:10:21.780896
2023-07-15T18:32:32
2023-07-15T18:32:32
32,761,091
4,144
651
MIT
2023-08-08T13:36:01
2015-03-23T21:55:07
Java
UTF-8
Java
false
false
297
java
/* * FXGL - JavaFX Game Library. The MIT License (MIT). * Copyright (c) AlmasB ([email protected]). * See LICENSE for details. */ package sandbox.circlegame; /** * @author Almas Baimagambetov ([email protected]) */ public enum CircleNNType { CIRCLE, BLOCK, BULLET, PLAYER, POWERUP }
10fd3378cbf36b585748399345862409eed93ab5
19ee85ef4d54c2ed978b0f396fe20dac4801fe1a
/api-service/src/main/java/com/rich/service/UserService.java
444d45c3cb443785371c4af4ff25acc87650ee4b
[]
no_license
RICH0423/spring-boot-api
59eb8234ca3f47f6105faefa5e8f302d84a6dc69
f0dd9fe2cda887c992215da2c2217b36e65a76df
refs/heads/master
2021-04-06T00:18:46.984095
2018-09-27T07:50:19
2018-09-27T07:50:19
124,505,602
0
0
null
null
null
null
UTF-8
Java
false
false
537
java
package com.rich.service; import com.rich.entity.User; import org.springframework.stereotype.Service; import java.util.Arrays; import java.util.List; import java.util.Optional; import java.util.UUID; @Service public class UserService { public List<User> getAll() { return Arrays.asList(new User("rich", 30), new User("maple", 30)); } public Optional<User> getById(String id) { return Optional.of(new User("rich", 30)); } public String create(User user) { //TODO: persist user return UUID.randomUUID().toString(); } }
af1ba45b7d57bd4ca3b3647b0abd4dd6a17083e0
12d512dade5712b21119702b3d33784bea63ba2b
/UngDungQLNhanSu/app/src/main/java/edu/green/acedemy/ungdungqlnhansu/PhuongThuc.java
bd906763cb70e13aa89aa7a87c770ded30c1d569
[]
no_license
dangdinhchi97/AndroidStudioProjects
4101d7487cef95b355092279bbc8d33716d9fdac
72fea008df400fb862e18040a18b13a38f165688
refs/heads/master
2020-04-04T23:04:26.704240
2018-11-06T07:51:05
2018-11-06T07:51:05
156,346,059
0
0
null
null
null
null
UTF-8
Java
false
false
73
java
package edu.green.acedemy.ungdungqlnhansu; public class PhuongThuc { }
89db065a782bfeaff3cde57340c986855364c077
8567984c254d9cab7917b95e47ded153129e9b3d
/app/src/main/java/com/surgical/decision3/common/bean/intervention/action/CommandAction.java
888575e6f1e219b106aedbdde6104da6c21ea6a0
[ "MIT" ]
permissive
nattaponaie/Intelligent-Tutoring-System-for-Situated-Decision-Making-in-Dental-Surgery
e2dae64b38d1f1433b364e8ad48bd0529b810d4a
41fd9910ca8c02689ba7f449e435583e4b29e75c
refs/heads/master
2020-03-22T07:13:27.269362
2018-07-04T08:35:39
2018-07-04T08:35:39
139,686,674
0
0
MIT
2018-07-04T08:35:40
2018-07-04T07:42:21
Java
UTF-8
Java
false
false
454
java
package com.surgical.decision3.common.bean.intervention.action; import org.simpleframework.xml.Root; @Root public class CommandAction extends BaseAction { public CommandAction() { super(); } public CommandAction(String actionDescription, String actionCode, String semanticActionCode, CommandActionObject onObject, CommandActionObject toObject) { super( actionDescription, actionCode, semanticActionCode, onObject, toObject ); } }
897d7fd828188d9f4761088282325f561b337e72
f84841eb95681192f34e6fc7b59d2bbb467b6a8e
/java8project/src/java8project/Methodlearn.java
3337d6c62eead7075e92dbe124eb414c61e90cf3
[]
no_license
manishyadv46/rock
6becdf527081155c86353f1e18664e90b9e445fc
7e48eac3c125450fda9492052e730c4e3b877b7c
refs/heads/master
2020-12-14T09:41:37.287935
2020-01-19T17:18:30
2020-01-19T17:18:30
234,702,765
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
package java8project; public class Methodlearn { public static void main(String[] args) { //System.out.println("swedfewedfour"); System.out.println(Myutils.printSomeJunk("fgfgdg")); //Myutils.sum2Number(10, 34); //int myvar = Myutils.add10(99)+1000; // System.out.println(myvar); } }
da07e48422a14a5cf519ce78dd94360ff90bafbf
396ae42be1ea3c052ee4975c8505aa10c8b9ebab
/HBProj29_One_to_many_List_bag_set_Map/src/main/java/com/har/entity/Country.java
bfb4e0d9fccb179abf87121df83a67af4d643a8e
[]
no_license
harishviru/Hibernate
ea45cb201c243a7f79fcf4f5db7f75f91c880da2
3be3a74a56fa053e58f089a8bea55bd9dd047fbf
refs/heads/main
2023-06-01T22:12:10.865356
2021-06-18T15:59:39
2021-06-18T15:59:39
369,538,555
0
0
null
null
null
null
UTF-8
Java
false
false
189
java
package com.har.entity; import lombok.Data; import lombok.NoArgsConstructor; @Data @NoArgsConstructor public class Country { private Integer countryId; private String countryName; }
0680b0e600276463e506a9a7477efaa641777652
89ee9c29a3fe3fe6e4ba59ac2cdfd5f009c17390
/HSTCMD/cqatest/src/com/motorola/motocit/alt/altautocycle/FunctionVideoTestActivity.java
df8141c83025d45caaad529098ed5f50818bb51a
[ "Apache-2.0" ]
permissive
XiGuangKai/MyAndroidProjectExercise
4aa4a04259485be82c84b3a89461b5d87efe05ee
da10760d3273ba41fa471ff13e86c4244465a070
refs/heads/master
2020-12-03T01:50:32.943130
2017-06-30T09:52:11
2017-06-30T09:52:11
95,874,402
4
0
null
null
null
null
UTF-8
Java
false
false
6,481
java
/* * Copyright (c) 2015 Motorola Mobility, Inc. * All Rights Reserved * * The contents of this file are Motorola Confidential Restricted (MCR). */ package com.motorola.motocit.alt.altautocycle; import com.motorola.motocit.TestUtils; import com.motorola.motocit.alt.altautocycle.util.Constant; import com.motorola.motocit.alt.altautocycle.util.ConfigTools; import android.content.Context; import android.media.AudioManager; import android.media.MediaPlayer; import android.net.Uri; import android.os.CountDownTimer; import android.os.Handler; import android.os.Message; import android.view.Window; import android.view.WindowManager; import android.widget.VideoView; import java.io.File; public class FunctionVideoTestActivity extends ALTBaseActivity { private AudioManager audioManager; private int maxVolume; private VideoView mVideoView; private CountDownTimer cdTimer = null; @Override void init() { try { this.TAG = "FunctionVideoTestActivity"; setTitle("Video Test"); TestUtils.dbgLog(TAG, "Starting Video Test", 'i'); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(com.motorola.motocit.R.layout.alt_function_video_videoview); audioManager = (AudioManager) FunctionVideoTestActivity.this.getSystemService(Context.AUDIO_SERVICE); maxVolume = (int) audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); int configvolume = ConfigTools.getPlaybackVolume("VIDEO_PLAYBACK_VOLUME"); if (configvolume > 0 && configvolume <= maxVolume) { audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, configvolume, AudioManager.FLAG_SHOW_UI); } else { audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, maxVolume, AudioManager.FLAG_SHOW_UI); } this.audioManager.setSpeakerphoneOn(true); this.audioManager.setMode(AudioManager.MODE_NORMAL); this.mVideoView = (VideoView) this.findViewById(com.motorola.motocit.R.id.function_video_videoview); // this.mVideoView.setVideoURI(Uri.parse("android.resource://" + // "com.motorola.motocit" + "/" + R.raw.alt_autocycle_video)); File videoFile = new File("/system/etc/motorola/12m/alt_autocycle_video.mp4"); if (videoFile.exists()) { this.mVideoView.setVideoURI(Uri.parse("/system/etc/motorola/12m/alt_autocycle_video.mp4")); this.mVideoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { sendMessage(handler, Constant.HANDLER_MESSAGE_VIDEO); } }); this.mVideoView.setOnErrorListener(new MediaPlayer.OnErrorListener() { @Override public boolean onError(MediaPlayer mp, int what, int extra) { logWriter("on error", "VideoView.setOnErrorListener"); return false; } }); } else { TestUtils.dbgLog(TAG, "No video media file exists", 'e'); showToast("Video media file missing"); killActivity(); return; } } catch (Exception e) { TestUtils.dbgLog(TAG, "init exception: " + e.getMessage(), 'e'); logWriter("init exception:", e.getMessage()); } } @Override void start() { isRunning = true; TestUtils.dbgLog(TAG, "Start,isRunning="+isRunning, 'e'); sendMessage(handler, Constant.HANDLER_MESSAGE_VIDEO); cdTimer = new CountDownTimer(realIntervalTime, 60000){ @Override public void onTick(long millisUntilFinished) { sendMessage(handler, Constant.HANDLER_MESSAGE_VIDEO_CHECK); checkProcess(); TestUtils.dbgLog(TAG, "millisUntilFinished="+millisUntilFinished, 'e'); if(!isRunning){ cdTimer.cancel(); } } @Override public void onFinish() { sendMessage(handler, Constant.HANDLER_MESSAGE_STOP); TestUtils.dbgLog(TAG, "End,isRunning="+isRunning, 'e'); } }.start(); } private void playVideo() { new Thread(new Runnable() { public void run() { try { mVideoView.requestFocus(); mVideoView.start(); } catch (Exception e) {} } }).start(); } private void videoCheck() { if (this.mVideoView.isPlaying()) { showToast("Video Test"); logWriter(TAG, "Running"); }else{ TestUtils.dbgLog(TAG, "Video is not playing, restart it", 'e'); logWriter(TAG, "Not Running,Restart"); playVideo(); } } private Handler handler = new Handler() { public void handleMessage(Message msg) { switch (msg.what) { case Constant.HANDLER_MESSAGE_VIDEO: playVideo(); break; case Constant.HANDLER_MESSAGE_VIDEO_CHECK: videoCheck(); break; case Constant.HANDLER_MESSAGE_STOP: killActivity(); TestUtils.dbgLog(TAG, "received stop handler message", 'i'); break; } } }; @Override void release() { try { if (this.mVideoView != null) { this.mVideoView = null; } if (this.audioManager != null) { this.audioManager = null; } TestUtils.dbgLog(TAG, "Video test is completed", 'i'); logWriter(TAG, "Completed"); } catch (Exception e) {} } }
35afab91202c0bdc70c2b385e11f651599cb8d71
9314b7b82cf9bbf1f29fbc059e0fd11f75faad56
/FindTheDifference.java
4fe08fabaf310de9c4dc0f2b5444a0b6371297a7
[]
no_license
zhaoxubin/java
881eae51e7117f2a870467eac29a763419abdc1c
77dd48812f2a3eebb1d43744556eb61941dc3b61
refs/heads/master
2020-10-01T15:30:31.880588
2020-09-07T13:44:14
2020-09-07T13:44:14
227,566,368
0
0
null
null
null
null
UTF-8
Java
false
false
258
java
class Solution { public char findTheDifference(String s, String t) { char res = t.charAt(t.length()-1); for(int i=0; i<s.length(); i++){ res ^= s.charAt(i); res ^= t.charAt(i); } return res; } }
39a7cf5bcec9d6ec7b1ca4601b89b8ae7814f67a
b4ddfbb7ea8c5dc4b9dcc07e0f356254250037af
/src/main/java/hr/fer/zemris/java/hw12/jvdraw/list/DrawingModelListener.java
2098a7ba9b6e71bba639d1f9cf988221daeff6e7
[]
no_license
vilimstaroveski/JavaCourse-HW12
4e3a9bd9ccf0f241f2e1c2f21646cb014f891844
76edc527d2c9dd83ba9a754c1f0f53d1125a5928
refs/heads/master
2021-07-05T22:33:24.401688
2019-06-23T00:42:03
2019-06-23T00:42:03
193,291,603
0
0
null
2020-10-13T14:05:37
2019-06-23T00:41:03
HTML
UTF-8
Java
false
false
1,061
java
package hr.fer.zemris.java.hw12.jvdraw.list; /** * Interface for objects that listens to {@link DrawingModel} * @author Vilim Staroveški * */ public interface DrawingModelListener { /** * Notification fired when objects are added * @param source component on which objects are added * @param index0 index of first added object * @param index1 index of last added object */ public void objectsAdded(DrawingModel source, int index0, int index1); /** * Notification fired when objects are removed * @param source component on which objects are removed * @param index0 index of first removed object * @param index1 index of last removed object */ public void objectsRemoved(DrawingModel source, int index0, int index1); /** * Notification fired when something is changed * @param source component on which objects are changed * @param index0 index of first changed object * @param index1 index of last changed object */ public void objectsChanged(DrawingModel source, int index0, int index1); }
052395219ac5795c38321d4c04cd3a4027e63814
bead5c9388e0d70156a08dfe86d48f52cb245502
/MyNotes/JDK_8/chapter_2/c_2_3/c_2_3_4/Predicate.java
b11f4f4cb54d84532cd8321fafc943d72119648b
[]
no_license
LinZiYU1996/Learning-Java
bd96e2af798c09bc52a56bf21e13f5763bb7a63d
a0d9f538c9d373c3a93ccd890006ce0e5e1f2d5d
refs/heads/master
2020-11-28T22:22:56.135760
2020-05-03T01:24:57
2020-05-03T01:24:57
229,930,586
0
0
null
null
null
null
UTF-8
Java
false
false
110
java
//package JDK_8.chapter_2.c_2_3.c_2_3_4; // //public interface Predicate<T> { // // boolean test(T t); //}
f2b516239cc209c6b19f945275f8e0992cd44938
669cc1deb4f48dc1dd567156ef8b7faf0c0b363f
/src/cn/edu/ncu/java/view/bowlingballteam/CellFactory.java
337177b18e63e5221d9c2e3068906a3548900a36
[]
no_license
ccarmellia/Ball-Scrolling
565474eee18d099e3a2f5a2200deb2d976fd5296
ba34be56166868a9f221f3e84dab41b6478a253f
refs/heads/master
2023-05-25T10:52:35.779527
2021-06-11T13:50:01
2021-06-11T13:50:01
375,661,227
0
0
null
null
null
null
UTF-8
Java
false
false
1,356
java
/** * Copyright (C), 2015-2019, 南昌大学软件学院1807班 * FileName: CellFactory * Author: 肖海军 * Date: 2019/11/10 21:05 * Description: * History: * <author> <time> <version> <desc> * 作者姓名 修改时间 版本号 描述 **/ package cn.edu.ncu.java.view.bowlingballteam; import javafx.beans.value.ObservableValue; import javafx.scene.control.TableCell; import javafx.scene.control.TableColumn; import javafx.scene.control.cell.CheckBoxTableCell; import javafx.util.Callback; import javafx.util.StringConverter; public class CellFactory { public CellFactory() { } public static <S, T> Callback<TableColumn<S, T>, TableCell<S, T>> tableCheckBoxColumn(Callback<Integer, ObservableValue<Boolean>> paramCallback) { return tableCheckBoxColumn(paramCallback, (StringConverter)null); } public static <S, T> Callback<TableColumn<S, T>, TableCell<S, T>> tableCheckBoxColumn(final Callback<Integer, ObservableValue<Boolean>> getSelectedProperty, final StringConverter<T> converter) { return new Callback<TableColumn<S, T>, TableCell<S, T>>() { public TableCell<S, T> call(TableColumn<S, T> paramTableColumn) { return new CheckBoxTableCell(getSelectedProperty, converter); } }; } }
c6d7d27c39e4d4155e560f89ebe4448f48248f32
bc972c868086a4e713fa6a6da90a3985bfaaabbc
/untitled/2020-09-21/src/TestDemo.java
61e3def1375db196a1aa40357c9802c53be7b4d9
[]
no_license
Augustchangan20/twelve
59d63781f0d32603c8d15f691ef7489546e766a7
b9fa47594da9ec20794ee883e4ed6c47f6240fd0
refs/heads/master
2021-04-23T18:20:29.725429
2020-09-27T08:07:58
2020-09-27T08:07:58
249,964,743
0
0
null
null
null
null
UTF-8
Java
false
false
893
java
class Card { public int rank; // 数值 public String suit; // 花色 public Card(int rank, String suit) { this.rank = rank; this.suit = suit; } // @Override public boolean equals(Object obj) { if (this == obj){ return true; } if (obj == null || !(obj instanceof Card)){ //obj不是card的一个子类 return false; } return false; } } public class TestDemo { public static void main(String[] args) { Card card1 = new Card(5,"♥"); Card card2 = new Card(5,"♥"); System.out.println(card1 == card2); System.out.println(card1.equals(card2)); //==比较的是值,card1和card2的地址不同 //equals 比较的是字符串的内容 需要重写String类下的equals 方法,负责还是比较的参数值 } }
7b5800a67fae0b20fc334d12be8ed8825c54cc88
a466e0a30674a541741f979b155f3637c1a74f26
/Utilities/NSFoundation/src/ns/foundation/NSMutableData.java
bf426cf9763be787f65e2a825c9760641cf96287
[]
no_license
wocommunity/wonder
c2971adadfc103f24191f60095c6d88a49dc128f
c0af44e73c9a2a6799b3ecfa1cf451123348cc43
refs/heads/master
2023-06-08T08:15:33.261856
2023-05-28T03:26:27
2023-05-28T03:26:27
1,520,916
89
85
null
2023-05-20T07:53:55
2011-03-24T13:30:25
Java
UTF-8
Java
false
false
1,606
java
package ns.foundation; import java.util.Arrays; public class NSMutableData extends NSData { public NSMutableData() { this(128); } public NSMutableData(NSData aData) { super(aData.immutableBytes(), aData.immutableRange(), false); } public NSMutableData(int size) { super(new byte[size]); } public NSMutableData(byte bytes[]) { super(bytes); } public NSMutableData(byte bytes[], NSRange range) { super(bytes, range); } public NSMutableData(byte bytes[], NSRange range, boolean noCopy) { super(bytes, range, noCopy); } public void setLength(int length) { byte[] data = new byte[ length ]; // inits to zeroes int limit = length > _bytes.length ? _bytes.length : length; System.arraycopy(_bytes, 0, data, 0, limit); this._bytes = data; } /** * Appends the specified data to the end of this data. */ public void appendData(NSData data) { appendBytes(data.bytes()); } public void appendByte(byte b) { setLength(_bytes.length + 1); _bytes[_bytes.length - 1] = b; } public void appendBytes(byte[] b) { int origLen = _bytes.length; setLength(origLen + b.length); System.arraycopy(b, 0, _bytes, origLen, b.length); } /** * Increases the size of the byte array by the specified amount. */ public void increaseLengthBy(int increment) { setLength(length() + increment); } public void resetBytesInRange(NSRange aRange) { Arrays.fill(_bytes, aRange.location(), aRange.maxRange(), (byte)0); } public void setData(NSData aData) { _bytes = aData.bytes(); } }
[ "qdolan@8dc76679-1c23-de11-85cd-0050568e728b" ]
qdolan@8dc76679-1c23-de11-85cd-0050568e728b
6e3d25479c776e127d8a6e2d4de6cf942f060380
272a5796839d8f73fd384edd92577060bc5bdf9a
/controller/FrontController.java
432f6f288d2a8caa95c9736c2d0e81078e4049a4
[]
no_license
jeonka1001/SurveyProject
289b125119cd9c0f45156bf77d86150f77bd488d
ac90df43c136f6132ade9771211edd4eb49cefaf
refs/heads/master
2023-05-10T19:55:34.328247
2021-06-03T17:27:55
2021-06-03T17:27:55
261,087,549
0
1
null
2020-05-18T10:49:31
2020-05-04T05:22:45
Java
UTF-8
Java
false
false
1,835
java
package com.surveypro.controller; import java.io.IOException; import java.util.Enumeration; import java.util.HashMap; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class FrontController extends HttpServlet { private static final long serialVersionUID = 1L; private HashMap<String, BackController> services; @SuppressWarnings("rawtypes") @Override public void init(ServletConfig config) throws ServletException { services = new HashMap<>(); Enumeration<String> params = config.getInitParameterNames(); ServletContext sc = config.getServletContext(); String contextPath = sc.getContextPath(); if (!contextPath.endsWith("/")) { contextPath = contextPath + "/"; } while (params.hasMoreElements()) { String param = params.nextElement(); try { String classPath = config.getInitParameter(param); Class cls = Class.forName(classPath); services.put(contextPath + param, (BackController) cls.newInstance()); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } } } @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String uri = request.getRequestURI(); services.get(uri).execute(request, response); } @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); doGet(request, response); } }
67f07ec41d70790b6fe236b5ea2c771b9e507b3b
647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4
/com.tencent.qqlite/classes.jar/com/tencent/mobileqq/pic/compress/CompressOperator.java
f4cde52217379917c1d1ba012e63ec51fd620972
[]
no_license
tsuzcx/qq_apk
0d5e792c3c7351ab781957bac465c55c505caf61
afe46ef5640d0ba6850cdefd3c11badbd725a3f6
refs/heads/main
2022-07-02T10:32:11.651957
2022-02-01T12:41:38
2022-02-01T12:41:38
453,860,108
36
9
null
2022-01-31T09:46:26
2022-01-31T02:43:22
Java
UTF-8
Java
false
false
7,675
java
package com.tencent.mobileqq.pic.compress; import android.content.Context; import android.graphics.BitmapFactory; import android.graphics.BitmapFactory.Options; import android.os.Bundle; import android.text.TextUtils; import com.tencent.mobileqq.pic.CompressInfo; import com.tencent.mobileqq.pic.Logger; import com.tencent.mobileqq.utils.FileUtils; import com.tencent.qphone.base.util.BaseApplication; import java.util.ArrayList; import java.util.List; public class CompressOperator { public static final String a = "CompressOperatorSRC_PATH"; private static List a; public static final String b = "CompressOperatorPIC_QUALITY"; private static final String c = "CompressOperator"; private static final String d = BaseApplication.getContext().getString(2131364318); public static int a(int paramInt) { switch (paramInt) { case 0: case 1: default: return 0; } return 2; } public static CompressInfo a(Bundle paramBundle) { if (paramBundle == null) { return null; } CompressInfo localCompressInfo = new CompressInfo(); localCompressInfo.c = paramBundle.getString("CompressOperatorSRC_PATH"); localCompressInfo.g = a(paramBundle.getInt("CompressOperatorPIC_QUALITY")); localCompressInfo.jdField_e_of_type_Boolean = Utils.a(); if (Utils.a(localCompressInfo.c)) { localCompressInfo.jdField_f_of_type_Int = 2; return localCompressInfo; } if (Utils.b(localCompressInfo.c)) { localCompressInfo.jdField_f_of_type_Int = 1; return localCompressInfo; } localCompressInfo.jdField_f_of_type_Int = 0; return localCompressInfo; } private static PicType a(CompressInfo paramCompressInfo) { if (paramCompressInfo != null) {} switch (paramCompressInfo.jdField_f_of_type_Int) { default: return null; case 0: return new PicTypeNormal(paramCompressInfo); case 1: return new PicTypeLong(paramCompressInfo); } return new PicTypeGif(paramCompressInfo); } private static void a(CompressInfo paramCompressInfo, boolean paramBoolean) { if ((paramCompressInfo == null) || (TextUtils.isEmpty(paramCompressInfo.c)) || (TextUtils.isEmpty(paramCompressInfo.jdField_e_of_type_JavaLangString))) { Logger.b("CompressOperator", " checkAndLog()", "info == null || TextUtils.isEmpty(info.srcPath) || TextUtils.isEmpty(info.destPath)"); } long l1; long l2; do { do { return; Logger.a("CompressOperator", paramCompressInfo.jdField_a_of_type_JavaLangString + " checkAndLog()", paramCompressInfo.toString()); if (!paramCompressInfo.jdField_a_of_type_Boolean) { break; } } while (paramBoolean); l1 = Utils.a(paramCompressInfo.c); l2 = Utils.a(paramCompressInfo.jdField_e_of_type_JavaLangString); Logger.a("CompressOperator", paramCompressInfo.jdField_a_of_type_JavaLangString + " checkAndLog()", "src File size:" + l1); Logger.a("CompressOperator", paramCompressInfo.jdField_a_of_type_JavaLangString + " checkAndLog()", "dest File size:" + l2); } while ((l1 <= 0L) || (l2 <= l1) || ("webp".equals(FileUtils.a(paramCompressInfo.c)))); Logger.a("CompressOperator", paramCompressInfo.jdField_a_of_type_JavaLangString + " checkAndLog()", d); paramCompressInfo.jdField_f_of_type_JavaLangString = ("CompressOperator" + paramCompressInfo.jdField_a_of_type_JavaLangString + " checkAndLog()" + d); FileUtils.d(paramCompressInfo.jdField_e_of_type_JavaLangString); if (a == null) { a = new ArrayList(); } if (!a.contains(paramBoolean + paramCompressInfo.c)) { a.add(paramBoolean + paramCompressInfo.c); } paramCompressInfo.jdField_e_of_type_JavaLangString = paramCompressInfo.c; Logger.b("CompressOperator", paramCompressInfo.jdField_a_of_type_JavaLangString + " checkAndLog()", " destSize > srcSize, info.destPath = info.srcPath"); return; paramCompressInfo.jdField_e_of_type_JavaLangString = paramCompressInfo.c; Logger.b("CompressOperator", paramCompressInfo.jdField_a_of_type_JavaLangString + " checkAndLog()", "info.isSuccess = false, info.destPath = info.srcPath"); } public static boolean a(CompressInfo paramCompressInfo) { if (paramCompressInfo == null) { return false; } Logger.a("CompressOperator", paramCompressInfo.jdField_a_of_type_JavaLangString + " start()", ""); return a(paramCompressInfo, false); } private static boolean a(CompressInfo paramCompressInfo, boolean paramBoolean) { if ((paramCompressInfo == null) || (TextUtils.isEmpty(paramCompressInfo.c))) { Logger.b("CompressOperator", " startImpl()", "info == null || TextUtils.isEmpty(info.srcPath)"); return false; } Object localObject; if ((a != null) && (a.contains(paramBoolean + paramCompressInfo.c))) { Logger.a("CompressOperator", paramCompressInfo.jdField_a_of_type_JavaLangString + " startImpl()", d); paramCompressInfo.jdField_f_of_type_JavaLangString = ("CompressOperator" + paramCompressInfo.jdField_a_of_type_JavaLangString + " startImpl()" + d); paramCompressInfo.jdField_e_of_type_JavaLangString = paramCompressInfo.c; localObject = new BitmapFactory.Options(); ((BitmapFactory.Options)localObject).inJustDecodeBounds = true; BitmapFactory.decodeFile(paramCompressInfo.jdField_e_of_type_JavaLangString, (BitmapFactory.Options)localObject); paramCompressInfo.d = ((BitmapFactory.Options)localObject).outWidth; paramCompressInfo.jdField_e_of_type_Int = ((BitmapFactory.Options)localObject).outHeight; return true; } paramCompressInfo.jdField_e_of_type_Boolean = Utils.a(); if (Utils.a(paramCompressInfo.c)) { paramCompressInfo.jdField_f_of_type_Int = 2; Logger.a("CompressOperator", " startImpl()", "info:" + paramCompressInfo); localObject = a(paramCompressInfo); if (!paramBoolean) { break label324; } } label324: for (paramCompressInfo.jdField_a_of_type_Boolean = ((PicType)localObject).b();; paramCompressInfo.jdField_a_of_type_Boolean = ((PicType)localObject).a()) { a(paramCompressInfo, paramBoolean); if (paramCompressInfo.jdField_e_of_type_JavaLangString != null) { localObject = new BitmapFactory.Options(); ((BitmapFactory.Options)localObject).inJustDecodeBounds = true; BitmapFactory.decodeFile(paramCompressInfo.jdField_e_of_type_JavaLangString, (BitmapFactory.Options)localObject); paramCompressInfo.d = ((BitmapFactory.Options)localObject).outWidth; paramCompressInfo.jdField_e_of_type_Int = ((BitmapFactory.Options)localObject).outHeight; } return paramCompressInfo.jdField_a_of_type_Boolean; if (Utils.b(paramCompressInfo.c)) { paramCompressInfo.jdField_f_of_type_Int = 1; break; } paramCompressInfo.jdField_f_of_type_Int = 0; break; } } public static boolean b(CompressInfo paramCompressInfo) { if (paramCompressInfo == null) { return false; } Logger.a("CompressOperator", paramCompressInfo.jdField_a_of_type_JavaLangString + " startThumbnail()", ""); return a(paramCompressInfo, true); } } /* Location: L:\local\mybackup\temp\qq_apk\com.tencent.qqlite\classes.jar * Qualified Name: com.tencent.mobileqq.pic.compress.CompressOperator * JD-Core Version: 0.7.0.1 */
a6952fef42a55f2e51d0b249fd6e41d39fb5e431
60ad3755ef8d566d194f74e457cd08d823d4672f
/modules/activiti-bpmn-model/src/main/java/org/activiti/bpmn/model/MessageEventDefinition.java
67b4e9cf001b0338b36976388ef02711febb9cb2
[ "Apache-2.0" ]
permissive
erdemedeiros/Activiti
fd0c62236b558e13139e55065cc4fc9958d12d59
bb32fac4a2a731de6a1790826c8967a1fabca7f2
refs/heads/master
2020-05-21T04:08:14.458613
2017-06-22T08:23:46
2017-06-22T08:26:45
84,570,538
2
0
null
2017-03-10T14:54:53
2017-03-10T14:54:53
null
UTF-8
Java
false
false
1,200
java
/* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.activiti.bpmn.model; /** * @author Tijs Rademakers */ public class MessageEventDefinition extends EventDefinition { protected String messageRef; public String getMessageRef() { return messageRef; } public void setMessageRef(String messageRef) { this.messageRef = messageRef; } public MessageEventDefinition clone() { MessageEventDefinition clone = new MessageEventDefinition(); clone.setValues(this); return clone; } public void setValues(MessageEventDefinition otherDefinition) { super.setValues(otherDefinition); setMessageRef(otherDefinition.getMessageRef()); } }
8bd57e80ba472afa93a34664224d84bcd97394f4
067fea23af0a37ac5f59026143ba12f39d6475eb
/src/main/java/org/tgcloud/zhanzhang/core/FileUtil.java
e7605d83ee9ab882c2733026e96a986b54f70336
[]
no_license
apachewj/zhanzhang
8a67505d1f839663ebcd8b40554127e5d535fd72
b818be4d3b8a1f572b4aae301f7abdb90efdf8fd
refs/heads/master
2021-01-16T19:37:40.409973
2017-08-25T15:13:46
2017-08-25T15:13:46
100,171,662
0
0
null
null
null
null
UTF-8
Java
false
false
11,072
java
package org.tgcloud.zhanzhang.core; import com.google.common.base.Strings; import com.google.common.collect.Lists; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import sun.misc.BASE64Decoder; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.*; import java.nio.channels.FileChannel; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Created by cloudLiu on 2015/8/6. */ public class FileUtil { private static Logger logger = LoggerFactory.getLogger(FileUtil.class); /** * 删除文件 * @param filePath 文件绝对路径 */ public static void delFile(String filePath) { File myDelFile = new File(filePath); if (myDelFile.exists()) { myDelFile.delete(); } } /** * 获取文件大小 * @param file * @return * @throws IOException */ public static long getFileSize(File file) throws IOException { long s = 0; if (file.exists()) { return file.length(); } return s; } /** * 转换文件大小 * @param files * @return */ public static String formateFileSize(long files) { DecimalFormat df = new DecimalFormat("#.00"); String fileSizeString = ""; if (files < 1024) { fileSizeString = df.format((double) files) + "B"; } else if (files < 1048576) { fileSizeString = df.format((double) files / 1024) + "K"; } else if (files < 1073741824) { fileSizeString = df.format((double) files / 1048576) + "M"; } else { fileSizeString = df.format((double) files / 1073741824) + "G"; } return fileSizeString; } /** * 复制文件 * @param src * @param dest * @throws IOException */ public static void copy(File src, File dest) throws IOException { if (!dest.exists()) dest.createNewFile(); transfer(new FileInputStream(src), new FileOutputStream(dest)); } /** * 复制文件 * @param src * @param dest * @throws IOException */ public static void transfer(FileInputStream src, FileOutputStream dest) throws IOException { FileChannel source = null; FileChannel target = null; try { source = src.getChannel(); target = dest.getChannel(); long position = 0, size = source.size(); while ((position += source.transferTo(position, size - position, target)) < size) ; } finally { if (src != null) { try { source.close(); } catch (IOException e) { e.printStackTrace(); } } if (dest != null) { try { target.close(); } catch (IOException e) { e.printStackTrace(); } } } } /** * 复制输入流到指定的输出流 * @param _in * @param _out */ public static void copy(InputStream _in, OutputStream _out) { InputStream in = null; OutputStream out = null; try { in = new BufferedInputStream(_in); out = new BufferedOutputStream(_out); byte[] b = new byte[1024]; int len = 0; while ((len = in.read(b, 0, b.length)) != -1) { out.write(b, 0, len); } out.flush(); } catch (Exception e) { } finally { close(in, out); } } /** * add by panmg copy一个文件夹下面的文件到另一个文件夹 * @param source 必须是文件夹 * @param target 必须是文件夹 * @throws IOException */ public static void copyFolder(String source, String target) throws IOException { new File(target).mkdirs(); // 目标文件夹 File fsource = new File(source); String[] fNames = fsource.list(); for (String name : fNames) { File temp = new File(source + "/" + name); if (temp.isFile()) { FileInputStream in = null; FileOutputStream out = null; try { in = new FileInputStream(temp); out = new FileOutputStream(target + "/" + name); byte[] b = new byte[10240]; int len; while ((len = in.read(b)) != -1) { out.write(b, 0, len); } } finally { if (out != null) out.close(); if (in != null) in.close(); } } else { copyFolder(source + "/" + name, target + "/" + name); } } } /** * add by panmg 删除某个文件夹中的文件 * @param ObjectPath */ public static void deleteDirectory(String ObjectPath) { File file = new File(ObjectPath); if(!file.exists()) return; File[] files = file.listFiles(); for (File f : files) { if (f.isFile()) { f.delete(); } else { /* 先删除文件夹的内文件, 在删文件夹 */ deleteDirectory(ObjectPath + "/" + f.getName()); f.delete(); } } } /** * 关闭资源 * @param in * @param out */ public static void close(InputStream in, OutputStream out) { if (in != null) { try { in.close(); } catch (IOException e) { in = null; } } if (out != null) { try { out.close(); } catch (IOException e) { in = null; } } } /** * add by panmg * @param in * @param out * @param width * @param height * @param proportion * @throws IOException */ public static void compressPic(InputStream in, OutputStream out, int width, int height, boolean proportion) throws IOException { // 获得源文件 java.awt.Image img = ImageIO.read(in); if(img.getWidth(null)==width && img.getHeight(null)==height) return; int newWidth, newHeight; // 判断是否是等比缩放 if (proportion == true) { // 为等比缩放计算输出的图片宽度及高度 double rate1 = ((double) img.getWidth(null)) / (double) width + 0.1; double rate2 = ((double) img.getHeight(null)) / (double) height + 0.1; // 根据缩放比率大的进行缩放控制 double rate = rate1 > rate2 ? rate1 : rate2; newWidth = (int) ((img.getWidth(null)) / rate); newHeight = (int) ((img.getHeight(null)) / rate); } else { newWidth = width; // 输出的图片宽度 newHeight = height; // 输出的图片高度 } BufferedImage tag = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_RGB); /* * Image.SCALE_SMOOTH 的缩略算法 生成缩略图片的平滑度的 优先级比速度高 生成的图片质量比较好 但速度慢 */ tag.getGraphics().drawImage(img.getScaledInstance(newWidth, newHeight, java.awt.Image.SCALE_SMOOTH), 0, 0, null); // JPEGImageEncoder可适用于其他图片类型的转换 out.close(); } /** * 将上传的文件进行重命名 * @param name * @return */ public static String rename(String name) { Long now = Long.parseLong(new SimpleDateFormat("yyyyMMddHHmmss").format(new Date())); Long random = (long) (Math.random() * now); String fileName = now + "" + random; if (name.indexOf(".") != -1) { fileName += name.substring(name.lastIndexOf(".")); } return fileName; } /*检查路径是否存在*/ public static Map<String,String> checkFilePath(Integer type,String outputPath) { //上传文件的路径 String path = null; //相对路径 String modelpath = null; if(!Strings.isNullOrEmpty(outputPath)){ path = GlobalStatic.uploadpath + outputPath; // 检查下路径前后是否自带/ modelpath = "images"+(outputPath.startsWith("/")? "" : "/") + outputPath + (outputPath.endsWith("/")? "" : "/"); } else if(type != null){ if(type == 0){ path = GlobalStatic.uploadpath + "user_head"; modelpath = "/img/user_head/"; }else if(type == 1){ path = GlobalStatic.uploadpath + "good_pic"; modelpath = "/img/good_pic/"; }else if(type == 2){ path = GlobalStatic.uploadpath + "banner_pic"; modelpath = "/img/banner_pic/"; }else if(type == 3){ path = GlobalStatic.uploadpath + "show_pic"; modelpath = "/img/show_pic/"; }else if(type == 4){ path = GlobalStatic.uploadpath + "error_file"; modelpath = "/img/error_file/"; } } if(path == null) { logger.error("没有可上传的路径"); return null; } File fileP = new File(path); if(! fileP.exists()) { fileP.mkdirs(); } Map<String,String> paths = new HashMap<>(); paths.put("path",path); paths.put("modelpath",modelpath); return paths; } public static String uploadBase64(String strBase64,int userType) { String string = strBase64; Map<String ,String > paths = checkFilePath(userType,null); Long now = Long.parseLong(new SimpleDateFormat("yyyyMMddHHmmss").format(new Date())); Long random = (long) (Math.random() * now); String fileName = paths.get("path") + "/" + now + "" + random + ".png"; //生成的新文件 try { // 解码,然后将字节转换为文件 byte[] bytes = new BASE64Decoder().decodeBuffer(string); //将字符串转换为byte数组 ByteArrayInputStream in = new ByteArrayInputStream(bytes); byte[] buffer = new byte[1024]; FileOutputStream out = new FileOutputStream(fileName); /*总字节数*/ int bytesum = 0; int byteread = 0; while ((byteread = in.read(buffer)) != -1) { bytesum += byteread; out.write(buffer, 0, byteread); //文件写操作 } } catch (IOException ioe) { ioe.printStackTrace(); } return paths.get("modelpath") + now + "" + random + ".png"; } }
3ab63b09d88bf83b50e0410da8ca7bd21cddd8d6
a603b45a75149a300b030fa83f059ce1c9260b73
/Eshop-inventory/src/main/java/com/vilderlee/eshopinventory/request/ProductInventoryCacheRefreshRequest.java
423e4cf007b36caf88fca0a6909b313c7854989a
[]
no_license
vilderlee/Springboot
79e2e2305765ae2a0e08a688eeaf5c6289dac8f1
e97e9010c3ac8e2af9687ff641f6011dcfb50e94
refs/heads/master
2022-10-09T11:58:01.313284
2021-04-24T04:22:36
2021-04-24T04:22:36
158,368,542
1
2
null
2022-10-04T23:54:14
2018-11-20T10:06:38
Java
UTF-8
Java
false
false
1,527
java
package com.vilderlee.eshopinventory.request; import com.vilderlee.eshopinventory.model.ProductInventory; import com.vilderlee.eshopinventory.service.ProductInventoryService; import lombok.Getter; import lombok.extern.slf4j.Slf4j; /** * 功能描述: * * @package com.vilderlee.eshopinventory.request * @auther vilderlee * @date 2019/9/19 11:33 下午 */ @Slf4j public class ProductInventoryCacheRefreshRequest implements Request { /** * 库存 */ private Integer productId; /** * 库存服务 */ private ProductInventoryService productInventoryService; /** * * 是否强制刷新缓存 * @param productId * @param productInventoryService */ @Getter private boolean forceRefresh; public ProductInventoryCacheRefreshRequest(Integer productId, ProductInventoryService productInventoryService, boolean isForceRefresh) { this.productId = productId; this.productInventoryService = productInventoryService; this.forceRefresh = isForceRefresh; } @Override public void process() { ProductInventory productInventory = productInventoryService.findProductInventory(productId); log.info("已查到最新的商品库存数量,商品Id为{},库存数量为{}", productInventory.getProductId(),productInventory.getInventoryCnt()); productInventoryService.setProductInventoryCache(productInventory); } @Override public Integer getProductId() { return productId; } }
b69c074920997520d8f6ae3a70b0e82263993f93
9acfbea67325fa4a83ab55334e304dcf2b7b613d
/app/src/main/java/com/babiloneo/puntodeventa/ConsultarActivity.java
60f1e49f40d1475d1997665359ef9ced997a3063
[]
no_license
babiloneo/mipuntodeventa
9b87cd9d496203b005111d524833faeb9ac89a9b
bfd575092696da9e58e3a3122d8343eef9ed1bb4
refs/heads/master
2020-03-20T08:19:02.385563
2018-06-17T03:11:05
2018-06-17T03:11:05
137,305,006
0
0
null
null
null
null
UTF-8
Java
false
false
1,551
java
package com.babiloneo.puntodeventa; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.KeyEvent; import android.widget.ListView; import com.babiloneo.puntodeventa.adaptador.productosAdapter; import com.babiloneo.puntodeventa.dataBase.Producto; import com.babiloneo.puntodeventa.dataBase.service; import java.util.ArrayList; import java.util.List; import io.realm.Realm; public class ConsultarActivity extends AppCompatActivity { productosAdapter adapter; List<Producto> listaProductos; ListView vistaLista; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_consultar); vistaLista=(ListView)findViewById(R.id.listview_prpoductos); listar(); } private void listar() { service s = new service(Realm.getDefaultInstance()); listaProductos=s.obtenerProductos(); adapter=new productosAdapter(getApplicationContext(),R.layout.lista_productos,listaProductos); vistaLista.setAdapter(adapter); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { // TODO Auto-generated method stub if (keyCode == event.KEYCODE_BACK) { Intent view = new Intent(ConsultarActivity.this,ProductosActivity.class); startActivity(view); this.finish(); onBackPressed(); } return super.onKeyDown(keyCode, event); } }
fc09ca8e7ed1280ad1fd561e89c15b77618249d3
a79f109f8b323fb7dea06ea390d64dc0b4005181
/Petnolja/src/com/petnolja/petsitter/model/service/PetsitterReviewService.java
4761fa24e00e8c43b1383aeafb2103efb80f9f00
[]
no_license
jooijin/petnolja-my
e4eca9132e0fe1e6aa80435a8cc00962aa71b966
360654d0408b910fcb6a0cf57dd9c94c114e7afd
refs/heads/master
2023-06-03T23:50:43.931604
2021-06-22T12:01:33
2021-06-22T12:01:33
379,256,521
0
0
null
null
null
null
UTF-8
Java
false
false
608
java
package com.petnolja.petsitter.model.service; import static com.petnolja.common.JDBCTemplate.close; import static com.petnolja.common.JDBCTemplate.getConnection; import java.sql.Connection; import java.util.ArrayList; import com.petnolja.petsitter.model.dao.PetsitterReviewDao; import com.petnolja.petsitter.model.vo.PetsitterReview; public class PetsitterReviewService { public ArrayList<PetsitterReview> selectReview(int sitterNo){ Connection conn = getConnection(); ArrayList<PetsitterReview> list = new PetsitterReviewDao().selectReview(conn, sitterNo); close(conn); return list; } }
b16668eaef485e22b8049a640f529495b41239eb
13386fc12abfb03247f9580da5b5a82eaf718eda
/src/me/mrletsplay/mrcore/json/converter/JSONConvertible.java
946b3515a2d8877a7d1b6dd042b48ab18e692835
[ "MIT" ]
permissive
davidmoshal/MrCore
4951a8f149fed05e7fa5391ae318d6215edda988
3df90e44248c75d4bdce46d1e1c86f10d5093f92
refs/heads/master
2023-03-02T04:45:32.943806
2021-02-01T15:49:50
2021-02-01T15:49:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
435
java
package me.mrletsplay.mrcore.json.converter; import me.mrletsplay.mrcore.json.JSONObject; public interface JSONConvertible { public default JSONObject toJSON() { return toJSON(true); } public default JSONObject toJSON(boolean includeClass) { return JSONConverter.encodeObject(this, includeClass); } public default void preSerialize(JSONObject object) {}; public default void preDeserialize(JSONObject object) {}; }
73e45f4cbe557c062c2bbfdd093339698951a6a3
034dd8550e48d4b7dfd26fae7bbbfe25a23706d0
/subprojects/worldOfSteve/src/shaders/TerrainShader.java
597498980141f6dea685a9219975df716d6eac60
[]
no_license
dtrajko/lwjgl_game
3182a970fc542dc1fb1e606f7c72349d8934e354
91e7e01930f411af3ddc545ce742c6eebf2f5d95
refs/heads/master
2021-05-12T03:02:43.863050
2020-05-01T23:36:35
2020-05-01T23:36:35
117,606,702
1
0
null
null
null
null
UTF-8
Java
false
false
4,618
java
package shaders; import java.util.List; import org.lwjgl.util.vector.Matrix4f; import org.lwjgl.util.vector.Vector3f; import org.lwjgl.util.vector.Vector4f; import entities.Camera; import entities.Light; import toolbox.Maths; public class TerrainShader extends ShaderProgram { private static final int MAX_LIGHTS = 5; private static final String VERTEX_FILE = "shaders/terrainVertexShader.txt"; private static final String FRAGMENT_FILE = "shaders/terrainFragmentShader.txt"; private int location_transformationMatrix; private int location_projectionMatrix; private int location_viewMatrix; private int location_lightPosition[]; private int location_lightColour[]; private int location_attenuation[]; private int location_shineDamper; private int location_reflectivity; private int location_skyColour; private int location_backgroundTexture; private int location_rTexture; private int location_gTexture; private int location_bTexture; private int location_blendMap; private int location_plane; private int location_toShadowMapSpace; private int location_shadowMap; public TerrainShader() { super(VERTEX_FILE, FRAGMENT_FILE); } @Override protected void bindAttributes() { super.bindFragOutput(0, "out_Color"); super.bindFragOutput(1, "out_BrightColor"); super.bindAttribute(0, "position"); super.bindAttribute(1, "textureCoordinates"); super.bindAttribute(2, "normal"); } @Override protected void getAllUniformLocations() { location_transformationMatrix = super.getUniformLocation("transformationMatrix"); location_projectionMatrix = super.getUniformLocation("projectionMatrix"); location_viewMatrix = super.getUniformLocation("viewMatrix"); location_shineDamper = super.getUniformLocation("shineDamper"); location_reflectivity = super.getUniformLocation("reflectivity"); location_skyColour = super.getUniformLocation("skyColour"); location_backgroundTexture = super.getUniformLocation("backgroundTexture"); location_rTexture = super.getUniformLocation("rTexture"); location_gTexture = super.getUniformLocation("gTexture"); location_bTexture = super.getUniformLocation("bTexture"); location_blendMap = super.getUniformLocation("blendMap"); location_plane = super.getUniformLocation("plane"); location_toShadowMapSpace = super.getUniformLocation("toShadowMapSpace"); location_shadowMap = super.getUniformLocation("shadowMap"); location_lightPosition = new int[MAX_LIGHTS]; location_lightColour = new int[MAX_LIGHTS]; location_attenuation = new int[MAX_LIGHTS]; for (int i = 0; i < MAX_LIGHTS; i++) { location_lightPosition[i] = super.getUniformLocation("lightPosition[" + i + "]"); location_lightColour[i] = super.getUniformLocation("lightColour[" + i + "]"); location_attenuation[i] = super.getUniformLocation("attenuation[" + i + "]"); } } public void connectTextureUnits() { super.loadInt(location_backgroundTexture, 0); super.loadInt(location_rTexture, 1); super.loadInt(location_gTexture, 2); super.loadInt(location_bTexture, 3); super.loadInt(location_blendMap, 4); super.loadInt(location_shadowMap, 5); } public void loadToShadowSpaceMatrix(Matrix4f matrix) { super.loadMatrix(location_toShadowMapSpace, matrix); } public void loadClipPlane(Vector4f plane) { super.load4DVector(location_plane, plane); } public void loadSkyColour(float r, float g, float b) { super.loadVector(location_skyColour, new Vector3f(r, g, b)); } public void loadShineVariables(float damper, float reflectivity) { super.loadFloat(location_shineDamper, damper); super.loadFloat(location_reflectivity, reflectivity); } public void loadTransformationMatrix(Matrix4f matrix) { super.loadMatrix(location_transformationMatrix, matrix); } public void loadLights(List<Light> lights) { for (int i = 0; i < MAX_LIGHTS; i++) { if (i < lights.size()) { super.loadVector(location_lightPosition[i], lights.get(i).getPosition()); super.loadVector(location_lightColour[i], lights.get(i).getColour()); super.loadVector(location_attenuation[i], lights.get(i).getAttenuation()); } else { super.loadVector(location_lightPosition[i], new Vector3f(0, 0, 0)); super.loadVector(location_lightColour[i], new Vector3f(0, 0, 0)); super.loadVector(location_attenuation[i], new Vector3f(0, 0, 0)); } } } public void loadViewMatrix(Camera camera) { Matrix4f viewMatrix = Maths.createViewMatrix(camera); super.loadMatrix(location_viewMatrix, viewMatrix); } public void loadProjectionMatrix(Matrix4f matrix) { super.loadMatrix(location_projectionMatrix, matrix); } }
3a66481c6c03a480feb67a28f8ad535de53d2138
7fc60aab8fefa96cf99ad37d8f4d128fb21d5fb6
/HelloWorld/src/TestTwo.java
7969362bcced1a428ff026a8495d878506e78929
[]
no_license
kevinvandervlist/SE
5bd321d3139691b3e8a284fd8345eaad1400bfb6
d4edfc635c822719bda1a64e32ec9212fb994f9c
refs/heads/master
2016-09-05T18:00:54.392243
2012-11-22T11:23:06
2012-11-22T11:23:06
6,577,119
1
0
null
null
null
null
UTF-8
Java
false
false
939
java
import Abstract.Foo; /** * This is a test for a multiline comment * @author kevin * */ public class TestTwo implements ITestTwo { private int cnt = 0; // Blah public TestTwo(int q) { this.cnt = q; } public int getCnt() { return this.cnt; } public void setCnt(int w) { this.cnt = w; } // This is a stupid complex function public int getCnt(int q) { if(q > this.cnt) { if(q > 10) { return this.cnt; } } else { return q; } if(true) { return -1; } return 0; } public static void test(boolean b) { return; } public static void main(String[] args) { System.out.println("Hi"); test(true); test(false); // Blaahaunthaonsuhaosu TestTwo t = new TestTwo(1); System.out.println(t.getCnt()); System.out.println(t.getCnt(5)); /* * Blah */ t.setCnt(100); System.out.println(t.getCnt(12)); Foo f = new Foo(); f.abstractFoo(); f.foo(); } }
[ "kevin@kevinvandervlist" ]
kevin@kevinvandervlist
629bc9bd784cf841e33d2c42a1967fae73f11b85
54653edbc2252356949911b1403266e7d7f81476
/manager/SpeakerManager.java
b066b77f7b247622a6d6fc47423f07041932ac59
[]
no_license
luo0612/w
e404467914cb8be5e91c26aba30e747bd9f6b961
edf057a45ab90d033583bb52d8bb1df23a94c7ee
refs/heads/master
2021-09-05T17:46:27.857308
2018-01-30T01:39:47
2018-01-30T01:39:47
109,260,994
0
0
null
null
null
null
UTF-8
Java
false
false
2,812
java
package com.vogtec.ibx5.manager; import android.content.Context; import android.content.res.AssetFileDescriptor; import android.media.AudioManager; import android.media.MediaPlayer; import com.vogtec.ibx5.R; import com.vogtec.utils.Utils; import com.vogtec.utils.utils.LogUtils; import java.io.FileDescriptor; /** * Created by PC on 2017/3/3. */ public class SpeakerManager { private static final SpeakerManager MANAGER = new SpeakerManager(); private static AudioManager mAudioManager; private static int mMusicMaxVolume; private boolean mIsPlaying = false; private MediaPlayer mMediaPlayer; private int mMusicCurrentVolume; public static SpeakerManager getInstance() { mAudioManager = (AudioManager) Utils.getContext().getSystemService(Context.AUDIO_SERVICE); //获取音乐最大声和当前的声音 mMusicMaxVolume = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); return MANAGER; } public void startSpeaker() { if (!mIsPlaying) { playRingtone(); changeVoiceToMax(); mIsPlaying = true; } } private void changeVoiceToMax() { mMusicCurrentVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC); if (mMusicCurrentVolume != mMusicMaxVolume) { mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, mMusicMaxVolume, AudioManager.FLAG_VIBRATE); } } public void stopSpeaker() { if (mIsPlaying) { changeVoiceToCurrent(); releaseMediaPlayer(); mIsPlaying = false; } } private void changeVoiceToCurrent() { mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, mMusicCurrentVolume, AudioManager.FLAG_VIBRATE); } private void releaseMediaPlayer() { if (mMediaPlayer != null) { mMediaPlayer.stop(); mMediaPlayer.release(); mMediaPlayer = null; } } private void playRingtone() { releaseMediaPlayer();//释放播放资源 int resId = R.raw.bell_d; mMediaPlayer = new MediaPlayer(); mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); AssetFileDescriptor descriptor = Utils.getContext().getResources().openRawResourceFd(resId); try { FileDescriptor fileDescriptor = descriptor.getFileDescriptor(); LogUtils.e(this, fileDescriptor.toString()); mMediaPlayer.setDataSource(fileDescriptor, descriptor.getStartOffset(), descriptor.getDeclaredLength()); descriptor.close(); mMediaPlayer.prepare(); mMediaPlayer.setLooping(true); mMediaPlayer.start(); } catch (Exception e) { e.printStackTrace(); } } }
58133a5cd40b6eb81dfb4538c0a854ea3c2f56b3
35e1aee1685def4d303dbfd1ce62548d1aa000c2
/EstacionTrabajo/src/Objetos/InfoEquipoCampeonato.java
d55fb65c801337e8fd7757bd3c04bd87ff1939b0
[]
no_license
sjcotto/java-swing-ws
d2479e1bedea0ba46e8182c1d9dd91955042e9b8
fd972634a3f58237bb2cfb07fde7113b80d15730
refs/heads/master
2016-09-06T07:43:45.963849
2013-08-15T01:19:17
2013-08-15T01:19:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,690
java
package Objetos; import DataTypes.DataDivEquipo; import DataTypes.DataIdNombre; import java.util.LinkedList; import java.util.List; // NUEVO!! import java.util.ArrayList; import DataTypes.DataApuestaPersistencia; // NUEVO!! public abstract class InfoEquipoCampeonato { protected float dividendoCampeonato; protected Equipo e; private List<ApuestaCampeonato> apuestas; /// NUEVO!! protected Campeonato campeonato; // Falta setearselo!!! public InfoEquipoCampeonato(float div, Equipo e, Campeonato camp) { dividendoCampeonato = div; this.e = e; apuestas = new LinkedList(); this.campeonato = camp; } /// NUEVO!! public float getDividendoCampeonato(){ return dividendoCampeonato; } public final DataDivEquipo getDataDivEquipo() { return new DataDivEquipo(e.getId(),e.getNombre(),this.dividendoCampeonato); } public final DataIdNombre getDataIdNombreEquipo() { return e.getDataIdNombre(); } public Equipo getEquipo(){ return this.e; } public void agregarNavInfoCampApuesta (Apuesta a){ apuestas.add((ApuestaCampeonato)a); } // NUEVO!! public void notificar(boolean gano){ for(int i=0;i<apuestas.size();i++){ apuestas.get(i).notificar(gano); } } public List<DataApuestaPersistencia> getDAP(int idCamp,int idPartido){ List<DataApuestaPersistencia> salida=new ArrayList<DataApuestaPersistencia>(); for(int i=0;i<apuestas.size();i++){ DataApuestaPersistencia dDA=apuestas.get(i).getDAP(idCamp,idPartido); salida.add(dDA); } return salida; } // NUEVO!! }